From patchwork Tue Apr 11 19:26:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13208165 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA27BC7619A for ; Tue, 11 Apr 2023 19:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229638AbjDKT1C (ORCPT ); Tue, 11 Apr 2023 15:27:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjDKT1B (ORCPT ); Tue, 11 Apr 2023 15:27:01 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2062.outbound.protection.outlook.com [40.107.21.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A0DE12B; Tue, 11 Apr 2023 12:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ngkOEjPp5ILnZvJjrWpfbKItN2UHwb0R4fCZ8VXjz8isWTdZMqCjqY/NTwSbtZnL7NTWiMMwNtgyFaY0ElDWWDbziJE3uk41k5FPpIXlkSzYizhtoFLHi0T/QK8PBGhHk3RpMVVfDktIjvuJ/uOBaekkqEswm/poSOzNKmtNbxI4WGG9rGv7EocnShio38qrmHwo0dxKUh/ygBoB2T2bg500hdsP6wuHdDXS8+wo727c1rfkp5m7B2zkI+oO9Fjzn3iwe89NHsCeXAq5FQI55rzVwjxlD2zkP73oGEvCSufPfAknqts6+JbynAZ3U24RMu4L9S+zOOOPUbMhGxoyUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ki2Ke+B+gy2S/bIMYwcuLofFFxWjRr3kvQbSkzdJsG8=; b=CEtFlUr0hzu9HpwY13gT6HXL9xKoQFR/+vyROJQaOKOY5LdLv3Nnw7Ewd2EQXuEd4RUwNBdyWrC0TvCVNF+JRwWNGM5S+n+MxDk8QLl06o1VGykLu7VXa8mNfFvtqd/T2GqFdjhfgTPMIXzCil060ogJlA4zoH+AFKGKfmJYhq7ci8ph+PO2LqKhD4z0Rc4odLBM1sqXzH8jr/J95WlYNQ7cdhhiiqyMrXpWla1bVHhONQgV/OkuBMUGvAc+YmbPV6ejYmXU3CWNLwhxUSNXr5/Y0uV0HDpDfmr/AE0xb6//tPIGitScjqJ/z/GHo8qZtrz2mFJttbrtR/kXTkO1SQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ki2Ke+B+gy2S/bIMYwcuLofFFxWjRr3kvQbSkzdJsG8=; b=eyTMBGi6leEs1vdWKmbVQXdG7EYssyUWQJLWL+QkkZZGisfRnlLkxTNhzwedgiPZgDJOYBDBn5XMsa51sZTsos2Ucwh1FVsskGJLL9g1RflXlv3jtot84tZLa18hHVpLhgrg5Dv8c7pGbHK2baZvwuPsZ7s8cyoo4GtSmQ3whE8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by PR3PR04MB7450.eurprd04.prod.outlook.com (2603:10a6:102:8a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 19:26:54 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Tue, 11 Apr 2023 19:26:54 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , linux-kernel@vger.kernel.org Subject: [PATCH net] net: enetc: workaround for unresponsive pMAC after receiving express traffic Date: Tue, 11 Apr 2023 22:26:45 +0300 Message-Id: <20230411192645.1896048-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: FR0P281CA0241.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:af::19) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|PR3PR04MB7450:EE_ X-MS-Office365-Filtering-Correlation-Id: cd9ecacd-9edb-44bb-22d3-08db3ac2b54e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4/jd+2IiAFVOJQhNFDQru5Lq36Fb2uJczeZjC7ak2BkisaeuNL3SSVDgFA7B/cSJx8dSBjq7HvLZd9uzf2xxlo7CchFZ4X9c8Ga5tP1Y+81CzACAvZ33WHpcxo6ANBVLsOmP2LYCN6Ryqp6GySy3FkQImHcz4DpqPoNi2Z6V/3KPxrNFFaPGx5J+alabdlKRvrhGls0nBBQX+d6o8JAmA2M0Wl4Uxoy62TdfUw2NUiitw9jfRdSe6pQF+WpDSKmXdTTDbvb/qeXOFZVdGU0IJU/pr/T4wNfTmR2/1M7hOK4y2JKXuimad6NUs8x6fPbX5w1HbSo4tNnuSJrGkZ9SZ6j9bTs0aTK77o4bY3rniU/rn2mdUnlSXfd62P08Re57P+VSOH3EHC+BWahrDm8m5xUfDYbo5qtizFaBhveHztMrtQt2HqzfgUK13UlaAkeaZ8+RJeXMrq5FecgmBEQkjaezxxScbfeNIPuMaWFcbzN/pfJiUsIbQd3G2kJFAY5YaQ9NrmVqAHZ+m5WZ2CmzyK6koYlq9rIQdIGnRyGZV2e+o75Vn8P6/UTznK0nJmmLvZ9DBHYO8mQcSbsFWfzKCA5HZ7SbzSs+lvu+YmhhnBd1W5N4adLMn7rA+F2IJVX+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(136003)(39860400002)(376002)(366004)(451199021)(478600001)(52116002)(1076003)(26005)(316002)(6506007)(186003)(44832011)(54906003)(2906002)(5660300002)(4326008)(66946007)(8676002)(6916009)(6666004)(66476007)(6486002)(41300700001)(8936002)(66556008)(38350700002)(83380400001)(86362001)(36756003)(6512007)(2616005)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k36rGFlTLtRVL74bVF8qEPABJ4Y0vSrBlo7hJ1myTYcPlO3hdU+ZCOvVmu0tvB1I1FiC6ZgeZruq6D0Ixs0MllAvel2Jv5wrPQgj1cponGsftxUEUJpmO/PcLPtJU6v5Hi6BujQc2HGfQz1MSuFESP5ErsfHEBo5WDAjMs4/TuZTgB6tBvcefNQ79kO471JjONFp8892AmawtdhLc3RXD506+zZkpbCYYX13ppOO0Dc67TbNFUe0EPcpD34zh+gMElFbcEqNqWKi2DpdLFunolp0auUQQkSj9fU6F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UlBzei1gMrGEPWaJelMbtlwxkKRhd+1qMnHqF2RntFX32kveXiCGThtVg+4ys+uUWJq7bxZIarCHbAscxs+2cVbl4Ix/XrsV+j9g/1cKLfhI3T3g5HRZyrSLHCdZabPIuGVMropDgyrF2jKUEMNnuwbpO2fu6zTEKy6zD4dhr+OB0dr5pS9e9UOgiHAVLg06XmwXfs4G1q4MfAGTodYj/ndE+DrxZJccp7VrKmavBT28GUstjgaoNfYm9Hf4Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd9ecacd-9edb-44bb-22d3-08db3ac2b54e X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 19:26:54.4853 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pe94Q7861ps+35Sps4qYZ4J1FoMmxg8qMCPpX9JqFWsCCxfc2AaZsW69eS3tbVYJ76X08j4UmT1/ZkO+34wGSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7450 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org I have observed an issue where the RX direction of the LS1028A ENETC pMAC seems unresponsive. The minimal procedure to reproduce the issue is: 1. Connect ENETC port 0 with a loopback RJ45 cable to one of the Felix switch ports (0). 2. Bring the ports up (MAC Merge layer is not enabled on either end). 3. Send a large quantity of unidirectional (express) traffic from Felix to ENETC. I tried altering frame size and frame count, and it doesn't appear to be specific to either of them, but rather, to the quantity of octets received. Lowering the frame count, the minimum quantity of packets to reproduce relatively consistently seems to be around 37000 frames at 1514 octets (w/o FCS) each. 4. Using ethtool --set-mm, enable the pMAC in the Felix and in the ENETC ports, in both RX and TX directions, and with verification on both ends. 5. Wait for verification to complete on both sides. 6. Configure a traffic class as preemptible on both ends. 7. Send some packets again. The issue is at step 5, where the verification process of ENETC ends (meaning that Felix responds with an SMD-R and ENETC sees the response), but the verification process of Felix never ends (it remains VERIFYING). If step 3 is skipped or if ENETC receives less traffic than approximately that threshold, the test runs all the way through (verification succeeds on both ends, preemptible traffic passes fine). If, between step 4 and 5, the step below is also introduced: 4.1. Disable and re-enable PM0_COMMAND_CONFIG bit RX_EN then again, the sequence of steps runs all the way through, and verification succeeds, even if there was the previous RX traffic injected into ENETC. Traffic sent *by* the ENETC port prior to enabling the MAC Merge layer does not seem to influence the verification result, only received traffic does. The LS1028A manual does not mention any relationship between PM0_COMMAND_CONFIG and MMCSR, and the hardware people don't seem to know for now either. The bit that is toggled to work around the issue is also toggled by enetc_mac_enable(), called from phylink's mac_link_down() and mac_link_up() methods - which is how the workaround was found: verification would work after a link down/up. Fixes: c7b9e8086902 ("net: enetc: add support for MAC Merge layer") Signed-off-by: Vladimir Oltean Reviewed-by: Jacob Keller --- .../net/ethernet/freescale/enetc/enetc_ethtool.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index da9d4b310fcd..838750a03cf6 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -989,6 +989,20 @@ static int enetc_get_mm(struct net_device *ndev, struct ethtool_mm_state *state) return 0; } +/* FIXME: Workaround for the link partner's verification failing if ENETC + * priorly received too much express traffic. The documentation doesn't + * suggest this is needed. + */ +static void enetc_restart_emac_rx(struct enetc_si *si) +{ + u32 val = enetc_port_rd(&si->hw, ENETC_PM0_CMD_CFG); + + enetc_port_wr(&si->hw, ENETC_PM0_CMD_CFG, val & ~ENETC_PM0_RX_EN); + + if (val & ENETC_PM0_RX_EN) + enetc_port_wr(&si->hw, ENETC_PM0_CMD_CFG, val); +} + static int enetc_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg, struct netlink_ext_ack *extack) { @@ -1040,6 +1054,8 @@ static int enetc_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg, enetc_port_wr(hw, ENETC_MMCSR, val); + enetc_restart_emac_rx(priv->si); + mutex_unlock(&priv->mm_lock); return 0;