From patchwork Tue Apr 18 11:14:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 84757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2764405vqo; Tue, 18 Apr 2023 04:19:54 -0700 (PDT) X-Google-Smtp-Source: AKy350YYPLtCiJWZSiq71avkS9FuChfJIjwx5m+Q2tJy+gggwC+UIdrknQ2FnFjQBBZJ6f8sUFuY X-Received: by 2002:a17:90a:10c2:b0:23f:2d2c:abd0 with SMTP id b2-20020a17090a10c200b0023f2d2cabd0mr2040927pje.4.1681816794481; Tue, 18 Apr 2023 04:19:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681816794; cv=pass; d=google.com; s=arc-20160816; b=nF0Ji3fObAmHs7FCqroIzdbyv2y6/ANYay6jNszC7TGLonxNUxWvuHOg+V76/goVlI 3lzJ3alTFpR1zZhmkMn3JWfN/QmxV2XUMiZV1nji1NBnvlqHAaX9bo/NkmhKq+f8Bv4S tLe/3E51s5ze1u33mumz6U6f7zwA2fitMVunXfjtSdmh6VwyGtQjzGmpOXieoZeogsBL Tcab+7n1CZhlY7aQc4K8NsJ2cLzm6Wa0z8oR0WYRcgvZobhcvh97vwYKgRdvZE+0AXzw eIY5M7UtZZQlqB/YGOohnoN9aw6IL9/ljt508mtZX274ulXYluHHvjnl66XhgLv21j6R hnYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RZjUA7315lPdf2IMj2yyXjYZ08dOVjBQffQl85JGoFs=; b=FuYUyrk/7MMzB/acwhtH46tKB3dhz32TndwL07cl+npvYEm0gND1WBUNaC6g7ct2c2 np80G3J6HkzxYZNWYEJ25ret8uugrBpcsF/83B9UfJkqA23MwuE3nepNq8NXJgxOJBS+ d2GV5UOe5A/tQLd+BBsrQYuwy3MN6Q/N+Pvwycuc5joLUgDY4OiZHBlS+64TZ5EIXTTp ZZeaUh+Gw8SyllVe7oapwUgmNCu6mtM0t2cs7NuwfrXH2Ia9ALwVWRjCrjK8fVlzVzzZ VNcDfX4pyudJBjtRFFGmmMk+Hf6sW3RwMh08KDh83/LM6D3lKVeWywj583pPTCqaXhBY tF3g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Y27qcEQc; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 128-20020a630186000000b0051f0d0d6359si2444186pgb.118.2023.04.18.04.19.42; Tue, 18 Apr 2023 04:19:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Y27qcEQc; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231409AbjDRLP2 (ORCPT + 99 others); Tue, 18 Apr 2023 07:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbjDRLPV (ORCPT ); Tue, 18 Apr 2023 07:15:21 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060.outbound.protection.outlook.com [40.107.22.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BABAC131; Tue, 18 Apr 2023 04:15:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hk8gW1f1ucnp5Ay7YwWOq4k1AZlL7Tz6BguG4jjYD7914+0CStr/wEX2u75WbHBKKDK6oIBfuZkOVBKtHOXcb0V+kiCuFHKbGTJTa/YxB4RS+S23Kd7K0e5G1vG71+I55xQ3sLXR+5L33ahfwV1GqpwZpGIH3hg2NEE29Ju20BvRE/DS+pOnvrHpmCU/MRtepGwvYo4WH77umdWZkHgISvG2zsGu/jGBuve0ZIbijkJGlQH2GwolcHYjxOGpM7tLbxKb3Du+aiw5WsEjaXirrO/iEfwjtfUvS1ZlcR1DuaN/ZF/pHBPtEzuXCnLwOPc3JDo/u1TmlJCD76B+Ff1Z3w== 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=RZjUA7315lPdf2IMj2yyXjYZ08dOVjBQffQl85JGoFs=; b=dmx17KhWeh9ClOPpJv0if41XOzWVWcyUNaKGmgJbaxx5xU0APmAJwwSf+AWSkz8bOAMd1viW9dJgWnL5cHLue1pVs+N5oB6r9KufuCxOuqkYjZ6hmwaZftDBBDInBqV6p74z56LeQdltF/0HZPx/u83TIU9zvcd67U7v4veExrSfxBuDcqIE6G7lxrgM+hzgJ0EJQux24UK68QR3en0ulnjWjbLQsXl4dqc7IUaMfHA25VEZ2UzOulsIa8JMnBPk2jUVEGSVynzYtrvjNjhqpmdwVqdNA9CLopQ8xDpWGQ48otD6J5Eu81+g7kBj717zKA/0NTCVhlOumXl5vLBlJg== 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=RZjUA7315lPdf2IMj2yyXjYZ08dOVjBQffQl85JGoFs=; b=Y27qcEQci60D7Q9wqywusQLYHegrZk+mEib18Fc1Vpuy8PsQO6UlCmjm5Ly+SOX3+XdPKWCDpS1MCy+OqH0PCYEGu87zZ3KgftudzgZ1bZp9z1of/Dg5yuwKc3vcSFgsF0tLbRw8azavtrR66BF6jYzteZHk7uCq7d2chcpQawg= 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 AS8PR04MB7863.eurprd04.prod.outlook.com (2603:10a6:20b:2a8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Tue, 18 Apr 2023 11:15:17 +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, 18 Apr 2023 11:15:17 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Michal Kubecek , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Xiaoliang Yang , Petr Machata , Danielle Ratson , Pranavi Somisetty , Harini Katakam , Vinicius Costa Gomes , Kurt Kanzenbach , Gerhard Engleder , Ferenc Fejes , Aaron Conole , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 1/9] net: enetc: fix MAC Merge layer remaining enabled until a link down event Date: Tue, 18 Apr 2023 14:14:51 +0300 Message-Id: <20230418111459.811553-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230418111459.811553-1-vladimir.oltean@nxp.com> References: <20230418111459.811553-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: FR2P281CA0152.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:98::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_|AS8PR04MB7863:EE_ X-MS-Office365-Filtering-Correlation-Id: 33d3fdc7-0760-40fb-2923-08db3ffe304e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IcAdhzOLD/f56UpyiMCJOoonpOlnbVm3tlcflPmRqOLG7c6Zlk1g43mPCn0V2CpWgB42u3uA1G/IItYpoJuzinod7EqfzbjuzFoFkGJn8CwkG3ElTLdWo35ag6HtRlEDqkV+kg02Sdrqx1pO9u5bdopcJzBXHYI6WaARzZ/meJKHkoNRkLGf7pMqvcE1gwcWVt1VJidC5kYxu6iJR+2N05iL0SMCr2ObHWTB8N6YxP1FUtu76aPikMMcYO1kY1JQ+xK9EhmhOaSlvmhFlC4zKGQMT8UDirZDRDTK7qNC+wX8F16iEDPrPQg1TPCoV7NvxrVOykqPhbRSd0KRxGoxm5UGNtjCmxASdyxvP74Z8Y6yuwCQbau3WpGXnOPRzuQvmh5mjscLzOPI2NDq1BPv+7+ERH85JZsLvg04BBg0OUViFxyYwPpNd+bpO6H7ueY4mVsgBQpaxC6kyuxMVxpfr/uYaGH+kw26YvA3jY8DgpJeEOhck7AtNa1p9ERZAFgg+5hbG7jM+cPaslM96ZOs9kv4hrgvUg1vMFBow1cAUbZZ1XOBQhZSn2kUZV7y2V7eAsvsKKvTJ6CoFxlA0QwOE7vYZBOo4gynSu0Nqa/Z5pXG0ERCk9lqHYWxPiYa1HyW 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)(366004)(136003)(346002)(376002)(39860400002)(451199021)(7416002)(5660300002)(44832011)(86362001)(2616005)(6512007)(83380400001)(186003)(1076003)(26005)(6506007)(38100700002)(38350700002)(8676002)(8936002)(478600001)(54906003)(6486002)(6666004)(316002)(52116002)(41300700001)(36756003)(66476007)(66556008)(4326008)(6916009)(66946007)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9zDqS0Nw8ZHMb91/0h5FCNsvWNwqslNnp6xbGXxcSgoqmpOerxxsskqXh9HWvI+eZIzaZNYtQhPAQxAeKjmjZuFsFte/Uo+74FFWPu/JT6kT5sxNaOHjOAIGLfOs48/57U60+a58hhKuM/l+tcbOM8zitWUcoilsXpTU3k+hbFsoK3Ye5QUP4Rr3mmTzmCTF7uD5a9KyPCmEcK5MHRboqYgncARsaQGm9So5H6O5PIXPdvFpnCPKW2BXCmXrZV2QfURuk9z4pSYQQCtVBtzIB31fK2AQoPivt+Jtk67Lo1pWxC3WCNEtZj0VpuKvWjW6i6doE0rGSOPOmP/CaC4F1V6w6PiP2S9sYZ5K0KVshL71FKBBkipbbtCuq+YiOKWriME4wk7w/wEfM5CO2UcIdXfBz8BSeO7Fwt/mIgu97vTNYVxXFWB/BvKGXNq5/hKf+6CyhAyMznnXO4ysgflqwexA8kIpwT2Ut679WpTvh26l1af6urNii1EXkBkr09GAXcWn8wG/vMFfDe1wBV2UlHzb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F8G0VU6pQ5IZy8DwYAj4Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33d3fdc7-0760-40fb-2923-08db3ffe304e X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2023 11:15:16.9531 (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: FdRcqIHMuCeUrQPPAoocNdIBSIVNXhgGT+NJgETVXNwYHkt8Lb1j6REcQfWbcZc7IpUnHJ5qEhGCLsFw9jYpTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7863 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763512727134445147?= X-GMAIL-MSGID: =?utf-8?q?1763512727134445147?= Current enetc_set_mm() is designed to set the priv->active_offloads bit ENETC_F_QBU for enetc_mm_link_state_update() to act on, but if the link is already up, it modifies the ENETC_MMCSR_ME ("Merge Enable") bit directly. The problem is that it only *sets* ENETC_MMCSR_ME if the link is up, it doesn't *clear* it if needed. So subsequent enetc_get_mm() calls still see tx-enabled as true, up until a link down event, which is when enetc_mm_link_state_update() will get called. This is not a functional issue as far as I can assess. It has only come up because I'd like to uphold a simple API rule in core ethtool code: the pMAC cannot be disabled if TX is going to be enabled. Currently, the fact that TX remains enabled for longer than expected (after the enetc_set_mm() call that disables it) is going to violate that rule, which is how it was caught. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman --- v1->v2: none drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index 838750a03cf6..ee1ea71fe79e 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -1041,10 +1041,13 @@ static int enetc_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg, else priv->active_offloads &= ~ENETC_F_QBU; - /* If link is up, enable MAC Merge right away */ - if (!!(priv->active_offloads & ENETC_F_QBU) && - !(val & ENETC_MMCSR_LINK_FAIL)) - val |= ENETC_MMCSR_ME; + /* If link is up, enable/disable MAC Merge right away */ + if (!(val & ENETC_MMCSR_LINK_FAIL)) { + if (!!(priv->active_offloads & ENETC_F_QBU)) + val |= ENETC_MMCSR_ME; + else + val &= ~ENETC_MMCSR_ME; + } val &= ~ENETC_MMCSR_VT_MASK; val |= ENETC_MMCSR_VT(cfg->verify_time);