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: 13215427 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 BEEE8C77B75 for ; Tue, 18 Apr 2023 11:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231310AbjDRLPX (ORCPT ); Tue, 18 Apr 2023 07:15:23 -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/vMFfDe1wBV2UlHzbzoTRWhxE4h7O2AVhyPu2UYs+TH1D90wqb3Bc0z1hDv/u/sasM2EeW+zZHMyCtlkzzlQSNWeVlj9JTSKTcDuIrZzUhcuxk7RkFg8KRQ4XFc1nwezNUQuGf9lna9ICxozmsokgk9dbGkOOck+FjgJEX1r2AMW9g2rRB2y697uswKwXe1fBW/TO5kr35c5sxj/Zzyw7YSCdUOZdCTHSXLXZSUslC2mswyOkaaKWmZayiuwS+mBZqVAXWqpfMlqg56UucG0QBorcUu3fb4sc3PdJEoHdsInYrtOdHdcgt4exViE9Lj8U9uEUn0sGrp14+jSXYQ2DIeb6Vx+dTgT+u5wzC6QnhXvtljJpl5iQ38IceqdkXJMTLgovUk5sKioAB1lYCYcN4F1ZiWrbSu4cWc1+FI5QdFF1n8izdcASK5PHltSp6D9GkogMuHhgtMylzSGv5Hwr6dohi/Vdu/DdbM1e7IU/xcOZz3KiZCYdgdBAouJj4l37w4VRhD6eWqXUJQufwoDkpfg/Z6xM7IjBHjGwHgnFT36CvEjd93QR5jeIaH5BPd1rsWBkT5Uh89LfbTm8DYzp3lYYw2Wif/DPvZ8jQOmcEvEjCPQYiILNh0AmZ0dw+lh6UrSbgm8JcgJvt2mJtuZ3ds3mKX7Pw/9iLiKOWAbQEpnFu6RYzWfd6w9xYms9/0MBhbhrZp/c7K6hdk+ZFUhW4rVZFTDUTW0HC0vAr0odPK0t2gQvw9ID8a+kdBP+CDqYppWf6Ly7MGQvtdrVvCXmqvmOo4XvbSBTtaTccZJHRNSIzTsCojtT04lZmin4mjm6xDQOA5bitm0XFgtahEvS0IEW+BMo/1m9bq3lnIKg4w4k1E00bP3o3teIpnPyhO59df/Zc1H7jhd2wiigZgxMAMmLtJkdUbVsEoUWKhUx3KRJHAAZftn0Ab5PiTg68NKBqlTRDSScpGAJavh2SQgg1USskxCViX7pYnXH9p6Y7AjGq/TfHk3Wq8Ohl/vhM0yFxJtGufCuEra3JsNaNg4zAIhiI8rFARmWM3CW3l5/bdpiLSo8FXxAPibgwF8G0VU6pQ5IZy8DwYAj4Q== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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); From patchwork Tue Apr 18 11:14:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13215429 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 AB7F8C77B76 for ; Tue, 18 Apr 2023 11:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231344AbjDRLPY (ORCPT ); Tue, 18 Apr 2023 07:15:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230434AbjDRLPW (ORCPT ); Tue, 18 Apr 2023 07:15:22 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2045.outbound.protection.outlook.com [40.107.104.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 544A2189; Tue, 18 Apr 2023 04:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S2OcQLi4GCxsJfWZ9ysy9TGPydyOi72PiBmgKV1gOTEg2r1FLyo7k/FpfIzuwXB7cOTIxJkhbVtWnKUUWlC+z5j4anA7n6tLBh+2b/Pinowi8+soa0R5ANOVFQGAv2RxUocLtWaHZVWY/dQz3tf+skDGbIyNUO0DrE9LqWph7MnBxwe38A2ypi40AebvDh6DAD93msLPOOHsfxC6eD4ZgRtv4t2pclUxNRa0+S9aF1Jp1Pha3KwZHTkq1rTWoh+IKuJSL4KQult27rS6kmr7DQ44TWFDU/UpNAb4VsYDTMBtxkOjfEaGN8G5/dElT4t+4loagJDOwvjXoSjiIJHsnA== 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=jvyICuPSzwJikGzzhP1t3R1NSkSUN3eLcXTcjy/KZaU=; b=L/4psWEdDJIK1MYxeQ3l5CdXai/n7RFIJtjEh1j2qKlBxmXK9WrHnRZVl9Ysid1S6UQAmJNQc7Te0RZFnhCiadSju5BPMESTt6z7YgBlX2gvY9MHqhSTtrVKe80UIrOT79dnOk0tP/Vgu/CVG16zzIxBsFDMKvaSXNTAOYWiZj0h76HndDG5cHZOiTjZTvp3x3swpjoRYOhp2tq3rBOn7WGWNO4oKzJS/G0TPpMaa7ui0bbYo0C47EF8rnGM2JDLJMlAmdmVGkrPnLKePH/DQklZdUlz7I00t1ityuj3pqc+RxYR3d/aqvfPIpO+FasxsV+aaTB1xE/tvxoCVZV4+w== 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=jvyICuPSzwJikGzzhP1t3R1NSkSUN3eLcXTcjy/KZaU=; b=fUrkH6Jk5gATRFfDuQv1RKyZIM4XSd4SJ2dg3a6tjJfXudxrtxuUZhNtHrK38JHLpg39MW9oWe5snXpMNyeMuE43/YgIFdOjjhYnWsgZe+kUnnYfMYBwfSqEZCH/8CdHBzaT5um5nILrEVh58xOdhgFw+6NyQ2o/Ce4ceR5LRac= 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 AS8PR04MB8659.eurprd04.prod.outlook.com (2603:10a6:20b:42a::22) 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:18 +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:18 +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 2/9] net: enetc: report mm tx-active based on tx-enabled and verify-status Date: Tue, 18 Apr 2023 14:14:52 +0300 Message-Id: <20230418111459.811553-3-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_|AS8PR04MB8659:EE_ X-MS-Office365-Filtering-Correlation-Id: 5dac5699-580b-4669-ce6e-08db3ffe3118 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u/DFxF6TT1xP1R2jJJGYfNVQ0+L/nVKou9LQ6rMOn5jQBa5sgtIPPNjxl4QLDxOSnyFWwzJnqKeVVnnduza4eUHfS1T6oPhbw7eJZHu+A+318usmSpkMAHs5H9frkJzXHlN9Gre6XRUZYXoFiHH4JG556otChkYySzpMAGgYzpkgXJfFVHpM996uBKwU9gTvbybNSATdf/SP+puTOMtqW622iM7OH3JePquicaDYLN74KMh5FOe78xmhhw25tAmTccRiOh6B/n6b+OJd63kuuHoaEBur6bkSY9E8+mj7Mbzg6r1gF7xO19L03sVwZ3Eh9GtYt0FO3d7/+Zknkn7ec5jV+LVxR8kzBo3ZJJ7zPj70m4zaNfBQy7hyO2nK7ot5/xXG9aJxJBrWtTpXPhVQvP6wTIeC8M7E4MFDWfvC7UcjPVtN46e+XZV7c0ptJs7IjPaQ8Qm90drM+i7t0vVSu8oncHJ0kAO1cSIYTynQ0gs7ovBHTkzcB489tR3YPD8SXbFOAXwwbdl0Xsb2PjaRn9Y4GvRwDVEel8ykQvPgcvcCsUSjGOxHggYV3FkAhFEsZ0ZkWfKYwTXufuZMhEnDD5ttF9YrxIYkYFtrLKoMkesRRbQLIb4UxCI4RgWDZqMG 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199021)(6666004)(6486002)(478600001)(86362001)(2616005)(36756003)(26005)(83380400001)(6512007)(1076003)(6506007)(186003)(38100700002)(38350700002)(52116002)(66556008)(66946007)(66476007)(316002)(2906002)(4326008)(6916009)(8936002)(5660300002)(8676002)(7416002)(44832011)(15650500001)(41300700001)(66899021)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KZThwevfQRpZ1CFcReeuT49+cu/ig748KKXqhPJEHAz1/1T+DsP30Ou9mdErDmM2+MP57knvg8arjLm1yT2L5E65n97b/HZnlh9UIaDduzE3XN3QUiMaP6zkx86wlUGQaR1B4/z5vmg/ds+fGbQBTkni2RzM1M8stVbeshmvoBxXQFZ4aX3Zf/6rWdjZCsxj009VMyL6I6uxy+9xnxL3wt0lqNGNb2nCMmWlySpxyu/VgF94Q0nQuvHp1f2hp7ek8Q/yVA6vNOC8f061Emb38mkcL3lv8Cv8L6HlWB/8GiW56cnazEZ45EHdTtEsy1CP/u0vd2IXNQFFP2EhwLaI2reRhpYW2g4urwzKjNww2SHM8aoypx2fyh0DW5GwsA/p9nETnCi18uZe/RdiCIe4VyD7KaWpTEL8MzYtSZuD5XDZ8WOIzL6F1zk6WCNhsqB2OsCpIuhY1Oaw9W8Rb0bdlio+As1w7s+3ehw7/CtHE73eYoVhMM1KOBf6kkq6YtAHg+47GN1YR8IJU0xKAHjcBCibBqnNTT6m6XcUtenSrkdzQJFK+8g3Y9jjOo5u1PoXR+3WXL0ZJSgq85E+qNzobUitO7HYkW2JfWsaj8zYtoor7nDm1fStuECYCE2iYlF2rbba/Nq9rLx7GtA8pSdP4mz90Lj4LFhVM6awyAr3/IAAxuv2fdVqj81nqysFanp+TD225AznIzZEqXpUvixpYYQ9l1ANeL5o4RsQc3ooXbSLUPbmla3kAl4gSGQGGZq4AsfOf9Iu3G8hcgXCYmfCVToi6lhRgoHclgyt++jeQdBLq8jEFUZCbJFJBdfZD2tKd3n/osKno7TOHB8qUMjzcCYAYygD5EDHC96H+qheKnPEAEEm4a5Q8s/haziKAAuhw0Mk9a6XTneHeDIqu9Gih1gMP1xv7NbkcGWxXSY/ynY81JffxHfWWF+9JAix8G4GDm2sLDLs03R2UY5gcLo1OkPdQOC0apg2azKDfusqXk4PGyT8ONlIUOCuo2MMaRhhpYoc68PNj1jjmydzQbe9mPU4VWQdprKHrAOWvpTg+8UZ0BcjLtKFMii5FbfDTlOwG7AMl+BPLaz96nbguOkeOIYUO2GKkyAMbQrEg7uTtB8tW7tMMEGFXgPbCnlkQZaXiFYdn9TfAgYmPDeprr/Ph69tl50AxiJkqeW2YzE51ZWBJSi1xjoEgWwgrSge0mUqABh6afy0ix5mZVs5gjb+OvQ5whK2Zgp5yWwGyug82VQ0oYfqIa/yrL2bXKYUGh6zJ3eZhQ6YGQJ44oZ9x2gNRUH42Fi8fthd6f1WSC8umIgrRdEbcFA3/27vxery5F5+wv67fm7ZZcty3MrVN8tuZNwsWXp1RdXnH3V4YIGDKXxYWdcClApjObgrQnEcBDMJhMMCzYJNTXMbjfXBX6BJ3/E4rNY6ldUt6ol8EaMTyY+rqgscYSHkPdZbprQxFjKSxH2Z7b4f6iB3X+ox+YNJDPtCKZj/xynzbSRLeONGIGGV5X1FL/kaOEl6w7bQ97UntL7Fa9OKYvcnKNjK7niICAU0fVbjD7MB7C86Vu153AdxjQ0wATPXrY7j4V2ttSA29c6r4idn92Kf51mDH3VnYw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5dac5699-580b-4669-ce6e-08db3ffe3118 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:18.2846 (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: aAZTS0LrpoKxmvZ926KlD8v5N7d1EO916H2FzCPEgEt9AL4LFmbrUbw5jCHdg3XEnNsivgpAoPiOvSgXymEwHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8659 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The MMCSR register contains 2 fields with overlapping meaning: - LPA (Local preemption active): This read-only status bit indicates whether preemption is active for this port. This bit will be set if preemption is both enabled and has completed the verification process. - TXSTS (Merge status): This read-only status field provides the state of the MAC Merge sublayer transmit status as defined in IEEE Std 802.3-2018 Clause 99. 00 Transmit preemption is inactive 01 Transmit preemption is active 10 Reserved 11 Reserved However none of these 2 fields offer reliable reporting to software. When connecting ENETC to a link partner which is not capable of Frame Preemption, the expectation is that ENETC's verification should fail (VSTS=4) and its MM TX direction should be inactive (LPA=0, TXSTS=00) even though the MM TX is enabled (ME=1). But surprise, the LPA bit of MMCSR stays set even if VSTS=4 and ME=1. OTOH, the TXSTS field has the opposite problem. I cannot get its value to change from 0, even when connecting to a link partner capable of frame preemption, which does respond to its verification frames (ME=1 and VSTS=3, "SUCCEEDED"). The only option with such buggy hardware seems to be to reimplement the formula for calculating tx-active in software, which is for tx-enabled to be true, and for the verify-status to be either SUCCEEDED, or DISABLED. Without reliable tx-active reporting, we have no good indication when to commit the preemptible traffic classes to hardware, which makes it possible (but not desirable) to send preemptible traffic to a link partner incapable of receiving it. However, currently we do not have the logic to wait for TX to be active yet, so the impact is limited. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman --- v1->v2: patch is new drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index ee1ea71fe79e..deb674752851 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -976,7 +976,9 @@ static int enetc_get_mm(struct net_device *ndev, struct ethtool_mm_state *state) lafs = ENETC_MMCSR_GET_LAFS(val); state->rx_min_frag_size = ethtool_mm_frag_size_add_to_min(lafs); state->tx_enabled = !!(val & ENETC_MMCSR_LPE); /* mirror of MMCSR_ME */ - state->tx_active = !!(val & ENETC_MMCSR_LPA); + state->tx_active = state->tx_enabled && + (state->verify_status == ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED || + state->verify_status == ETHTOOL_MM_VERIFY_STATUS_DISABLED); state->verify_enabled = !(val & ENETC_MMCSR_VDIS); state->verify_time = ENETC_MMCSR_GET_VT(val); /* A verifyTime of 128 ms would exceed the 7 bit width From patchwork Tue Apr 18 11:14:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13215430 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 ACD4BC6FD18 for ; Tue, 18 Apr 2023 11:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231386AbjDRLP0 (ORCPT ); Tue, 18 Apr 2023 07:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231326AbjDRLPY (ORCPT ); Tue, 18 Apr 2023 07:15:24 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2045.outbound.protection.outlook.com [40.107.104.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1393128; Tue, 18 Apr 2023 04:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BJcRmxgOVhfo68pDKy/kdQ9K5yh+bcHTYlhTEE6DqPhC8ML0nepSn36yoFPHAw6L24MA67CIiVNGy5W9eAGAwTZ8mMkV1pp3weaORqCUUBssfahmVOut9D5NMw7+Xnrr4tcE3qKn2z0IvoS09BXJ0LKNGaDlbtJGTqWlkLw0gt49czPmRG2QkX/P9XU9CWkVnfOTS1ylHPHWIntNYlHzZbMLj91FNxpUpp9wfxZWr9nHFoZ6fj/4tsdGFjgT6ac/iKgT9FQHFO31MGL1fNx0FhvKTFbRc73Jkb7GQPpcvaTlDyA9Pvsm2ZR/oNIAXhpkobyRzn/rWt9gPZvFmlKGfw== 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=Ov0QUbtEK2+jpxZgdRkTqB1XbAcXl+/wK52Cx6aAgbY=; b=NyS4JNnyIoy01QHyDIHVN2vSvI6SE92h10J7s8bCCoNFWWVnrd7+eBb3citHH1naQ1Ye64+YXYz8i1qhhs9Ik+wuKlEPcImydbK6f0TPgtM+7qy8wrcfoRs0HP9VV0+2+deNqIb+8F7VOc6ZOkX38psd6yfgZwkntyAocwxt8UxJnALu+tXmphszfzQHas6gPN7ntIRmpbLDMtRnM26C39t/RYg6KLlqI16I6TYIu92b11n4NbsT0o6Ws4H/0F2M4RTReZnrSisVRDMHYwVcsLj+WNjiiiZ4OwrdjvGxtsv9AhTbfNre3K+BAjK3J6gr6iBLDd6i72JK+WVYFH/LRg== 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=Ov0QUbtEK2+jpxZgdRkTqB1XbAcXl+/wK52Cx6aAgbY=; b=NhcDov3rq43xobkT4XgYvXLEzUZtPIZPA4SJbajMiJnpccBVOzooeqXbqPkWg3GhsxZx7WMrog7yCU7NFgiCLdVW3QJ0YYLXxKI43311jC2oRsk83fsv+I/vmHZOVmyCtvw614c++2Qtp6GDqvN83Psggcmp6adaUORIJRuwYfM= 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 AS8PR04MB8659.eurprd04.prod.outlook.com (2603:10a6:20b:42a::22) 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:19 +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:19 +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 3/9] net: enetc: only commit preemptible TCs to hardware when MM TX is active Date: Tue, 18 Apr 2023 14:14:53 +0300 Message-Id: <20230418111459.811553-4-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_|AS8PR04MB8659:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a074e68-5599-4049-73ad-08db3ffe31e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TJEgqDhc81OMoFYy9d20mMTOfGTsrCx0az60CiVff+mOIIP4jDts6iLJbDC2qgP9mqMMzTyzqA+BDbvhPCEUnKu95xFVJzfYbHwwfGzSTIRxhQmxI0f3OzqWoR/v0/2XznvsWQysZ/yNh0hsOQ/quExkj/ZxIIsNYOzsENnwupTOIZZfX1xyrW6h9JSlmU0eV9+9pODOX51mh/pGIIaTQ1rsSAY9AFiXQ6BLYixqN69sJ7A66QsfrSBVSHzDqZnIaxWv5cRvNDU06d/3pAtPVvBuV9MpztlBf4UIqMeUaAzDoIDpMjk1CdxGU9iyAEvDW04GBvTYIuMVBPBQ7OS1paOktv6xl9c4+dQxl4FIiPqqQh6aZaA6MaGtIYhex68ASSRj4xCGGLTvqfxZruQAfHQ6RKHVHHBMJU2aIaTDhK2tz9SByLdfbivtOCGHE9ra564JOYenmNOjEQHJfTqIwp26eEqXYTxvwo5ifQJM7sswNKxAQDtXXhFzV8D3MOHZadeD79UDRAbtC0pVYl3x9THN2n7YdHfItJWSsMmEj2nREDrtGDmJmAa/njMBqLX5hsgDgZ2Wi/ajjPD2V5wIhI8om/LmAlHpvkUwwWQOjuiY3AwTUzzUJ8ZEA7onf5jr 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199021)(6666004)(6486002)(478600001)(86362001)(2616005)(36756003)(26005)(83380400001)(6512007)(1076003)(6506007)(186003)(38100700002)(38350700002)(52116002)(66556008)(66946007)(66476007)(316002)(2906002)(4326008)(6916009)(8936002)(5660300002)(8676002)(7416002)(44832011)(41300700001)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N2PJAoe/IMHj2lPwwTDxNC54Oep7KTCvUrX6b/m9rEqswhvzVXKAPJyUkVjdDDUd9wnGL09SQSwDApXRAz//UP5WQ4L9TCtWgNOThbEl/QUMLbmTbLJ2d9Vj+SddJypyWSm3slbY02yOs9PTTnu3IADA77eUZTP/yOrlJUjKN65O/WeGrNAqXGDyIsIctm1vHfkAx2DOltKFScPxHJiMjyR5oipUYPxv+AY2dZnWXl46orNeZ/wddgp8L5wMcW34ZKdJduQs8hEk9v4qelPPyrb8k0E4QlXbRJtVDC9S4o8kMUtSe0l+tzk/HZ7Wy2q6p2irRL6RRj8FWesYoNC7FLz6Nd6AjphlTW/RmKks7hON8pFbCdEW2J4Qv1E6U4+diSOI1nsegIEBqpLjmaCxDHHZ4yN99jlaCzc1rDt2dhJdz+dbB8PVx8EWaIZrFwoCzbJPqVLHRMkcCGJTw4Qqs5eiFxsRQwTWIMtG/fHPvEDleu8FjZsC1JVo/haJVcQy8AgZH5kNUPAVE0/cDXtvss2bnwlQo+rcqPK/LRHadPsG8NlQWnunX1QzHqL/t0Q+otPTpRYiiKCV+o4OoRXrUqIYhjo6Yd/fQs66IWLAWGU6xIXiGYlwHQrRudwNoECeKVwn7Kd0aN7ULh35BbFjSrZqnwiEz60+XjflLz+fWkQztKTgJ10J2g3LT7Ii9I+Q7UepDd5JtR9lw7lusNd1xajLfoQCqJ+wrGVyIUIrYYRzQwqfVimtEmdmXSKUUtGZhxEfzWDUtMub916K8bzMMml8ZyrGFXVVHXwy25Mso9z9EqoAmwjTEX6hTIMPmuM3OvSiqZFHwcsWcBabbP04tgMJa5IlzeNmFb9vlXrO7yheYn33tbsvgj35/twvex/cSkRc7FgMu4gRQSTZWVQmAGtZM3/NOLR+SLQeq01oAcQTovkEQ6KkPKBc4GToc2bKeh1f9xa4TzdZgMqcjDbPufiNGJbBA0XinqUSs4VOZn618BF5Nb5zxmFs/eWW6/29FZM+NbGZPMak+jX/GyLwQi+Ob/XlzBDZiIS3SglzfAHGaWgO4tzF9P9Rup+itpMx2m4GKTkKzN/w6K6MP+f0+CLSwj5gAejOKr+4C6etDetEX9FZY2hQe3A3oGeiodx3AZwwteTAQI8crWTPPYaxUeCYxwpgeHLFYBZmUwpO6mj3yiSZYkEWi/itHVzj0MdkAroQyBAMzrAOzC1fIZIvRvmjkdFHiVcsi3lUqZqXcc3hpIhFZeBVwGL6NStgduY2vC3ED6BrttAuJl3bdE3BxE7oTllqAQ2e07XRgXxkzgzxDsC3d23i5ujvrzKer93eQxr41yGwywOKifs9yvJlxAo4MTEmQLzIJCkB4e1NhRBBlx3qG5Wo3T3VTUe6TTwIGcsxRfqQvOwX05xiO/W/KXUowDXG9AToxnV0/1TKBA7tZUO0Rockgyqc0TXmn51RbMnC+7L88bahjXjLYzolLPy+bh/jytIZU0VzlzIsiaHsiniS0L8cAxxy9wrxRQptowzbqAHostKxkmEEtrHmj4CAiOAh3ZNUv6jZk7vnij5LLjruETDBlKuH8nXpcc0a6UDiBX9qTK7g8u8zN/DhxA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a074e68-5599-4049-73ad-08db3ffe31e3 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:19.5864 (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: D96hlKf9OMNWuVcMGWJK2+c12nTT66ZSO1nrH6Z9J3lWCjMCWtVqeKYSXORALlYYMCtGO9Lfg5E8eGRV77lAPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8659 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This was left as TODO in commit 01e23b2b3bad ("net: enetc: add support for preemptible traffic classes") since it's relatively complicated. Where this makes a difference is with a configuration as follows: ethtool --set-mm eno0 pmac-enabled on tx-enabled on verify-enabled on Preemptible packets should only be sent when the MAC Merge TX direction becomes active (i.o.w. when the verification process succeeds, aka when the link partner confirms it can process preemptible traffic). But the tc qdisc with the preemptible traffic classes is offloaded completely asynchronously w.r.t. the MM becoming active. The ENETC manual does suggest that this should be handled in the driver: "On startup, software should wait for the verification process to complete (MMCSR[VSTS]=011) before initiating traffic". Adding the necessary logic allows future selftests to uphold the claim that an inactive or disabled MAC Merge layer should never send data packets through the pMAC. This change moves enetc_set_ptcfpr() from enetc.c to enetc_ethtool.c, where its only caller is now - enetc_mm_commit_preemptible_tcs(). Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman --- v1->v2: patch is new drivers/net/ethernet/freescale/enetc/enetc.c | 23 ++----- drivers/net/ethernet/freescale/enetc/enetc.h | 5 +- .../ethernet/freescale/enetc/enetc_ethtool.c | 62 +++++++++++++++++++ .../net/ethernet/freescale/enetc/enetc_hw.h | 3 + 4 files changed, 75 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 41c194c1672d..3c4fa26f0f9b 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -25,23 +25,12 @@ void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 val) } EXPORT_SYMBOL_GPL(enetc_port_mac_wr); -void enetc_set_ptcfpr(struct enetc_hw *hw, unsigned long preemptible_tcs) +static void enetc_change_preemptible_tcs(struct enetc_ndev_priv *priv, + u8 preemptible_tcs) { - u32 val; - int tc; - - for (tc = 0; tc < 8; tc++) { - val = enetc_port_rd(hw, ENETC_PTCFPR(tc)); - - if (preemptible_tcs & BIT(tc)) - val |= ENETC_PTCFPR_FPE; - else - val &= ~ENETC_PTCFPR_FPE; - - enetc_port_wr(hw, ENETC_PTCFPR(tc), val); - } + priv->preemptible_tcs = preemptible_tcs; + enetc_mm_commit_preemptible_tcs(priv); } -EXPORT_SYMBOL_GPL(enetc_set_ptcfpr); static int enetc_num_stack_tx_queues(struct enetc_ndev_priv *priv) { @@ -2659,7 +2648,7 @@ static void enetc_reset_tc_mqprio(struct net_device *ndev) enetc_debug_tx_ring_prios(priv); - enetc_set_ptcfpr(hw, 0); + enetc_change_preemptible_tcs(priv, 0); } int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) @@ -2714,7 +2703,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) enetc_debug_tx_ring_prios(priv); - enetc_set_ptcfpr(hw, mqprio->preemptible_tcs); + enetc_change_preemptible_tcs(priv, mqprio->preemptible_tcs); return 0; diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index 143078a9ef16..c97a8e3d7a7f 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -355,6 +355,9 @@ struct enetc_ndev_priv { u16 rx_bd_count, tx_bd_count; u16 msg_enable; + + u8 preemptible_tcs; + enum enetc_active_offloads active_offloads; u32 speed; /* store speed for compare update pspeed */ @@ -433,6 +436,7 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_frames, /* ethtool */ void enetc_set_ethtool_ops(struct net_device *ndev); void enetc_mm_link_state_update(struct enetc_ndev_priv *priv, bool link); +void enetc_mm_commit_preemptible_tcs(struct enetc_ndev_priv *priv); /* control buffer descriptor ring (CBDR) */ int enetc_setup_cbdr(struct device *dev, struct enetc_hw *hw, int bd_count, @@ -486,7 +490,6 @@ static inline void enetc_cbd_free_data_mem(struct enetc_si *si, int size, void enetc_reset_ptcmsdur(struct enetc_hw *hw); void enetc_set_ptcmsdur(struct enetc_hw *hw, u32 *queue_max_sdu); -void enetc_set_ptcfpr(struct enetc_hw *hw, unsigned long preemptible_tcs); #ifdef CONFIG_FSL_ENETC_QOS int enetc_qos_query_caps(struct net_device *ndev, void *type_data); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index deb674752851..838a92131963 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -991,6 +991,64 @@ static int enetc_get_mm(struct net_device *ndev, struct ethtool_mm_state *state) return 0; } +static int enetc_mm_wait_tx_active(struct enetc_hw *hw, int verify_time) +{ + int timeout = verify_time * USEC_PER_MSEC * ENETC_MM_VERIFY_RETRIES; + u32 val; + + /* This will time out after the standard value of 3 verification + * attempts. To not sleep forever, it relies on a non-zero verify_time, + * guarantee which is provided by the ethtool nlattr policy. + */ + return read_poll_timeout(enetc_port_rd, val, + ENETC_MMCSR_GET_VSTS(val) == 3, + ENETC_MM_VERIFY_SLEEP_US, timeout, + true, hw, ENETC_MMCSR); +} + +static void enetc_set_ptcfpr(struct enetc_hw *hw, u8 preemptible_tcs) +{ + u32 val; + int tc; + + for (tc = 0; tc < 8; tc++) { + val = enetc_port_rd(hw, ENETC_PTCFPR(tc)); + + if (preemptible_tcs & BIT(tc)) + val |= ENETC_PTCFPR_FPE; + else + val &= ~ENETC_PTCFPR_FPE; + + enetc_port_wr(hw, ENETC_PTCFPR(tc), val); + } +} + +/* ENETC does not have an IRQ to notify changes to the MAC Merge TX status + * (active/inactive), but the preemptible traffic classes should only be + * committed to hardware once TX is active. Resort to polling. + */ +void enetc_mm_commit_preemptible_tcs(struct enetc_ndev_priv *priv) +{ + struct enetc_hw *hw = &priv->si->hw; + u8 preemptible_tcs = 0; + u32 val; + int err; + + val = enetc_port_rd(hw, ENETC_MMCSR); + if (!(val & ENETC_MMCSR_ME)) + goto out; + + if (!(val & ENETC_MMCSR_VDIS)) { + err = enetc_mm_wait_tx_active(hw, ENETC_MMCSR_GET_VT(val)); + if (err) + goto out; + } + + preemptible_tcs = priv->preemptible_tcs; +out: + enetc_set_ptcfpr(hw, preemptible_tcs); +} + /* 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. @@ -1061,6 +1119,8 @@ static int enetc_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg, enetc_restart_emac_rx(priv->si); + enetc_mm_commit_preemptible_tcs(priv); + mutex_unlock(&priv->mm_lock); return 0; @@ -1094,6 +1154,8 @@ void enetc_mm_link_state_update(struct enetc_ndev_priv *priv, bool link) enetc_port_wr(hw, ENETC_MMCSR, val); + enetc_mm_commit_preemptible_tcs(priv); + mutex_unlock(&priv->mm_lock); } EXPORT_SYMBOL_GPL(enetc_mm_link_state_update); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h index 36bb2d6d5658..1619943fb263 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -3,6 +3,9 @@ #include +#define ENETC_MM_VERIFY_SLEEP_US USEC_PER_MSEC +#define ENETC_MM_VERIFY_RETRIES 3 + /* ENETC device IDs */ #define ENETC_DEV_ID_PF 0xe100 #define ENETC_DEV_ID_VF 0xef00 From patchwork Tue Apr 18 11:14:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13215431 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 72427C6FD18 for ; Tue, 18 Apr 2023 11:15:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231445AbjDRLP4 (ORCPT ); Tue, 18 Apr 2023 07:15:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231381AbjDRLPZ (ORCPT ); Tue, 18 Apr 2023 07:15:25 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2045.outbound.protection.outlook.com [40.107.104.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C897131; Tue, 18 Apr 2023 04:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DDZbPMVD82F12xzVzqa8I80rv+MDfV5tsXEBsK3y6ETP/EWYpAvb9tcqFas6TIX1IiKhXOQL3CvDT7zv0eTyOvobzIj2REcOlLlDaGl9FNImbe7riCiZ7UooLWcUbptULWJc3OMtsXYjnjn/JZ2nfszSblEFmUkexqocYleDBD1SxOwpCQKNvP9Dcgigr14jLbRjKOJ3dXTyRDqUWdaU8RdzzoukxclqorlBVy+wNlGhwmTweUYRERb136be6Of5r6RCGjiv3ZieZhXnI30IssJam8Tw0kxp3Se1+PyyoK1dje52ql85r0qtQA50meM3DulOYf0B7s0KPuLBEIeVvQ== 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=zT70HQvHEGA9i75ZWy4R/BZdgkENulL3EBYoUIpUZ2I=; b=XEMmXrPhlnzPxHqu5V10aHthfPNcS7kjURmHnplhnLiOrF1odJyXMK/6Kd94HfeXiGubuNdSwwRc6vMacdKiDqMEClTMfPUsD2pO4qB7XhP1iFW3ayuiBN0AgQZAs9Eagtws3ov5oJteE0tUEbFn8IfrnL1BbI2/K9ZLI7QR4KTQ14J58T6007oyhGzK3zm/QH8gTplCUzKe5U0MwY55j6ikxJIDw6hHkOa6yIEIb6dZdV24A50UX7p0SV4dNbQbsQdfbyQD0+GUrw31yQNPjF7ylNm7dOlBUnoaPF7LukmXqI1t2m9pEItOL50GuzCG6vciqi6jwdTJZkmnE/+PkQ== 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=zT70HQvHEGA9i75ZWy4R/BZdgkENulL3EBYoUIpUZ2I=; b=nkadiEDDHJiMinm5wn6K6K2ms+wjaVyd2Qvc7fAMubG02yYjVXt/rosYdgJ1wNJDIdIV0TXsYZnlR7HF1CINhZf6QKg5+F0DgCIahF4pFHor8y9ZpYqvg0lDT33/H4PuHPqs/Ba9slKYjy/wAn/ntztyZ+bBALemqy7Mo3kzA1U= 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 AS8PR04MB8659.eurprd04.prod.outlook.com (2603:10a6:20b:42a::22) 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:20 +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:20 +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 4/9] net: enetc: include MAC Merge / FP registers in register dump Date: Tue, 18 Apr 2023 14:14:54 +0300 Message-Id: <20230418111459.811553-5-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_|AS8PR04MB8659:EE_ X-MS-Office365-Filtering-Correlation-Id: cb5c1b4b-edbe-4ec7-5469-08db3ffe32a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iR17Ikgoq6rfgEzSW78tCP6+37VdNNH3V2hzV7IY/dMpe19ZEsApoYTWZDZ50vZThYXJAg3ND8ElEDs+cENOsE6NBlRYTzFiyce9vea1L+d9w/aq3tEEyxe12UorglqxNNgX2yc4YhSDy1yGkxii7d50rTQa6iem+afIYV01QN8Eh/7zRt2x8R2WdXA25x/Elc3xR+Ihly/7EGLtzuHRWte5zii9pj27LqgzljDV/MJAtddy0F7l8wAQFU4j8KCXLlfK6XolrSUrW2BN48PNcKntJdDXRP6aS6+OLdSWzQ+MlIIoipm1ZFDe6hw8pe3P9XnQncausEcheo7SG5E4CX2zHyqLenv8qD1Hv/YvMZowIReXrfHwYKO8l0Rk4HK5EJYyh4DHV4MAWFpC36dxNYpeH48yHKkBxpuNAZtPi4oj3y9wYfrKEUIBmzQblkFtkV4pwNDXouw3JoM6frsqLm5VGS/q0A2Jj/eZvDo+yRXPQqfDB+AMtHLb/L3KlqQ40Yq/hcIYNw/QuG4Yp5xRp4OLfvGpAe2urfOPHg53M19Ehf/3sPYqQ704meKS99egd7kfdYYuLJ9jBcjx8yFIpzkaxmGQFUMwUkOXqY8MM99y/UsTVBXY2L7epiH38rxd 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199021)(6666004)(6486002)(478600001)(86362001)(2616005)(36756003)(26005)(6512007)(1076003)(6506007)(186003)(38100700002)(38350700002)(52116002)(66556008)(66946007)(66476007)(316002)(2906002)(4326008)(6916009)(8936002)(5660300002)(8676002)(7416002)(44832011)(41300700001)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +Vw+4De4qcxxduc8gJ7USblIhRZ8OXs2dCDRqG7kmO3aqps/PelCi9vSYN9EXOIovjdB3TgSVL2EQsFjKuMVz1LTK4e7/jueCAh9/SbBM38tOiNGDYr60mOi5v3qdP5WuE1rwhRfqpL4LtiZ0rOJaOszJugcGDPwIHHRJjsJ0RV/UPaXqugsxIcBcUCrhK0YB8ej0HMYw5tpNgLB20MdlrOtjBGjGBKv1XW/FFtV1NXv5g40x5JayiBpauwtBDvCF8K4gKB9x/PAwrDIpY0OFcu8K4ZwREJo4i7OI0cjof+PGs00vlGh8m/Dn5IIFepytQdvIaUbIBs7D7Ll+k8YdL1xf90OPzLT6G7JQKcGO81jg7QINQsWSfqIbvWELdov/cikh4gLfG3HenX3K3rnC9svku/YPrv4mn5gvH+pv9erVnUDWotGflQ4SLKDlofOVaRO0WMNZVOOBoyl5TFt1g08o103DqPWDXHJ4E7yhNEvHrd8ELB9h8urrPgvNtZPP/lcmDs0Aw464pkHJ0Ch0sPs+FslGQ7OHmu2EdiAVhXfwdkpNTnoze2E0S2YItObILFXsh4Er9LAI6c2QozhNN33N6uWrRCDApIlUm/sv9V2+Ln/yW8H99fl4f9gVQhqygCSLFFoK24MXJt4swO14KDUNhwEAj4axoHPuXk5grjUnyn2GVz3j144CLENnahDu9dwqRPDaC0YMD0ClORhOEji6zOoy0OKaWLfwlNn5OzG98eYpEmKFAv+glhRZvze584ZiSAu8qe6H57oFXH7XqIOvlFTTQKeuI0EAtIu9qL67TkKky5uXBAjX3A6fa/kK7vKC+hMuFBIh1N8Vl2km0VL/dVnFBQ45zb0wDSgU7wePUWAlikPoP/enoCPqPSLQeJ6qpHhevPae94sWDGXbcdzNIIgqDqhP9wBhfSx/rVfJ5ABWPPFYQWL/lzG6vdt/FrVDfAMYdo780bdlCF1PKaVC5+BNQuoTdAQA4dKCdBXjLwPoH3jR3h6/A1NumhY+U0gshKbiHzV1ryFZBr4sbYhm59agRZC2Vz3rLzL5bWP2VzV3ZbapUPkJfq91T5RNMbbzIjaVZcGwl63iEkLoMKXN2a26gxxeNvPRoymRIPCdL76macxf/uNTEArDN2JC+m0rxN92cyo66qoTWuL7V/yHl9d3Qsj5eFk8C/LsYgS4X46gzDWB+ipQNuL+2MjtwcVQv01/U9gHjLlW3+VjA0JFnhTacSM+3a6pwyjTxcRTIkUz9gAtDQs8juyVZnnkTk4E96ZeqBgrrKmi8O9HQ3iBmC5U8YFNVnuLwPpOwdQpNgUHgiTgyLk7wjJ2uDNInqOWOM4/iaJw5Z0Ws9bPJXwBlv93ew80Yg2dFig+LjpaL0+iGM6ukfIzhFjczRre0OSphNQXCMlqeZWvV9Utulwu/Laqt6dCL3u7UTOJTN7/vPEcZs4F+IydSBQ88tsaPRVWxXsE51Lp/yBLU1sXWol7OLOBI/R0HLPc5raFOMOK76qjoTDNYdwjd/S0ruXFuC9asWYovbOmDXK7DBQroxvlTou58ojv6tfaKCBI87vpxzN95E08ieR6/Y9NYfV/HQ+QQ5g0JHNxNmx26qUuw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb5c1b4b-edbe-4ec7-5469-08db3ffe32a9 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:20.8751 (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: eVeGsBjt1W4QSsIQ3+FKpe/zeJu3nDF47b+gk0r46UdiU8Y3vFI/jEkHE4DUK94ijy+WSmGgBkD/dilz4/i1JA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8659 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org These have been useful in debugging various problems related to frame preemption, so make them available through ethtool --register-dump for later too. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman --- v1->v2: patch is new .../ethernet/freescale/enetc/enetc_ethtool.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index 838a92131963..e993ed04ab57 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -32,6 +32,12 @@ static const u32 enetc_port_regs[] = { ENETC_PM0_CMD_CFG, ENETC_PM0_MAXFRM, ENETC_PM0_IF_MODE }; +static const u32 enetc_port_mm_regs[] = { + ENETC_MMCSR, ENETC_PFPMR, ENETC_PTCFPR(0), ENETC_PTCFPR(1), + ENETC_PTCFPR(2), ENETC_PTCFPR(3), ENETC_PTCFPR(4), ENETC_PTCFPR(5), + ENETC_PTCFPR(6), ENETC_PTCFPR(7), +}; + static int enetc_get_reglen(struct net_device *ndev) { struct enetc_ndev_priv *priv = netdev_priv(ndev); @@ -45,6 +51,9 @@ static int enetc_get_reglen(struct net_device *ndev) if (hw->port) len += ARRAY_SIZE(enetc_port_regs); + if (hw->port && !!(priv->si->hw_features & ENETC_SI_F_QBU)) + len += ARRAY_SIZE(enetc_port_mm_regs); + len *= sizeof(u32) * 2; /* store 2 entries per reg: addr and value */ return len; @@ -90,6 +99,14 @@ static void enetc_get_regs(struct net_device *ndev, struct ethtool_regs *regs, *buf++ = addr; *buf++ = enetc_rd(hw, addr); } + + if (priv->si->hw_features & ENETC_SI_F_QBU) { + for (i = 0; i < ARRAY_SIZE(enetc_port_mm_regs); i++) { + addr = ENETC_PORT_BASE + enetc_port_mm_regs[i]; + *buf++ = addr; + *buf++ = enetc_rd(hw, addr); + } + } } static const struct { From patchwork Tue Apr 18 11:14:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13215432 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 DC512C77B75 for ; Tue, 18 Apr 2023 11:15:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231461AbjDRLP5 (ORCPT ); Tue, 18 Apr 2023 07:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231390AbjDRLP1 (ORCPT ); Tue, 18 Apr 2023 07:15:27 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2045.outbound.protection.outlook.com [40.107.104.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDBB146BA; Tue, 18 Apr 2023 04:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OQlpzmFq2EEpQ1MUs+lSNws3mZOx01PfQIfRTbTEfv8Lugfd/CiSo9Tc71609tPE2JGHaikDvkRLSsx0fKaDxtTT9X8VQzXOFMrvHZtLjeISLIA4320Z8jWjxOwWx6mmGtR56sszko1mLjeKBXYE7LldSD2cEa+Cg27qwaFBDrw0ARdDQ9/n5l78nd4zUdS4sosjK+wTIdS8r0lgHjVDsXM124nzTd/FLICZlHU0F5XMiZ13ylVvzSzK+SlF+L9YesAH9LZ1iLVof/DZV1mHIRAieabY9e/jJgDlhai+08W9g8tIU7BohXbInh807Hy+fIh4gaXFJAZh+QjD89BsxQ== 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=ZUBfqL8ZER71p4PwFMmPWN6oiSM69vL5qZGaDNdIfiQ=; b=StwkvzV6MmwnxIp0wgwgktt3lrFRfkBsT4LobM/eqpMJ5stBfRkE6Hk5J8U6wPkckeBCaXw2HYLePMYmGn949RVA8TuW1dnz+zFJ1Zu1pYi8xylTaBnNkmYRMSSsmskESIXjgpFJUjFHs+WkPo96BzPuQYI941z7M4USFgZXfqJTIq6gB9NOiqqpT8srLB84Z77yizK7QSR3UJmjvYnblIYB+ZFvcvAhAKd35SuA5NaEuO5mrBvJuQedHcB7v7DBXo45+dIRfZlxnnEZdPig0ZWAqK8G1YHmgT+UFUGy0AweXIzTbqqc7EkF79M+5Zie13L8cFRbO6gp81Un7giY3Q== 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=ZUBfqL8ZER71p4PwFMmPWN6oiSM69vL5qZGaDNdIfiQ=; b=pUmfJpVryqR7A7P05ePoJeM057H5bzRPrZTVIeahYHGRkqTLKnlKdu3rDltB63R0tvrwbtlkAPLDYazCCL1orT6n/kpq4xTcnI2texH2UmIPUEyEn5VCnjQWJCj6BJa0yJkYFRWoD9WcAp9JCBl2LlGzEfxJbjKgCpKOx0BWNJE= 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 AS8PR04MB8659.eurprd04.prod.outlook.com (2603:10a6:20b:42a::22) 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:22 +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:22 +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 5/9] net: ethtool: mm: sanitize some UAPI configurations Date: Tue, 18 Apr 2023 14:14:55 +0300 Message-Id: <20230418111459.811553-6-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_|AS8PR04MB8659:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fec4046-b3ee-46e1-f7c4-08db3ffe3392 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MWvPWjyF9r57ZJ455F7nsF7X4+v++Qo12iA1/2fR4moH+QgYROGZ0Sn0yfd2AgiKI/cXRnvLcFdgaklbjuMyzTbJpB56xnRCvFTHbAp2a4xAPPCLr4/6nnzZih+zm4kzNqw4gvQwy6ZUEj03gViaBph6SqWilKWvyId5r20HY/CDmX5uiOg+VU+spUCl7+V7g9tuNHXaDJnhXJcTzzFej9szESlocZ87G+QqHqxXOju+F4j3pqMeT8FEdkMLtLQRyZui4eML3ILa09/ujAXAwTdhCDhC0AVSEaMj6pm8818ZMJ/E5OKIi92d/gr2Bxq9qRVyNAt6T8rXAQ6V1uXt51cTBGGpy235nNXWfJMwf1vO7UnRZjJLjQUAKzMEjKxAGT5EbTfNKeFOuH4kFNVEqAoPy8EubQfpakrSEGQCZUuc/WJM7IZFJNqcKxJS4sa1IGJeIWShbBMigzjuCsaHhmw30/3sNM7XXFgkpLQdccOSDRrsibyIo/1aY3JnkqidyJ898HWzBFcCvJUFQVJo2JE2z9k+/4HkL89mZhtBbHCNGLRvF01OP4Ff2hovvXmHo/KoB/CR913ey6R2EK23jHefmYHGlGzf6GKDjzvVMYLvKVXMloBBIqYpMTqHC931 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199021)(6666004)(6486002)(478600001)(86362001)(2616005)(36756003)(26005)(83380400001)(6512007)(1076003)(6506007)(186003)(38100700002)(38350700002)(52116002)(66556008)(66946007)(66476007)(316002)(2906002)(4326008)(6916009)(8936002)(5660300002)(8676002)(7416002)(44832011)(41300700001)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ha525zYnbg+7ay56hOfH82Djy0iEdEW8kunTxmas0L/+qw9iksyXU6vWT6N+WiBRXewxI/W759FrVIQ+VlTJUrx7++nop0qT3ZBQ7q0qi/itZb4PKwKUtPB9VMJPNP28VX2/Ww2vMBCrqbQBZQ7kPHT6LkC2IEJ9MSbxvNMvTUggkflUk41jhSYKWBLlY/X6BI07779gKBrBqmNpxsiZbMaMLqHY0vhhfVUUVCa9edEhZ6jLiBm6A0zMxdaIjcUzHDrn0dm3uDBF7Wv5L237GPuOgX5FMNJJYpH6miJiqQnPmlP1C15Tlse1aTQ+ZSM6TM+2eVmrfNNoyds/r6nvuToCrEWpDyG4TX3oJv/g09YoB5K8H4UrziRiwOKRPjSo2IdBfHONj7jcZZqwfvpHniklEFqfFfwDOzJ5Hmeu3NJl3+Qqhtw+tswqnqlDyHg5ahE+BJRjktTOBObIOaQ0ZwiXw03LF01y0kkANiQmKXoY7SBA9qLCZRCLSwlCO/BMnyQBdI4uYnIzANR9ze+VOyNXnJ+ltoDeF3G20gaQYkj/U2E0g8V+xfPSum3arO5Lt6Tlu61mB9FgDvpVEeJq4x8WqKmpTh1/L0fLsFKwJzaUTJ01iFYzEGpV0ezFl80ZfwvScYigS49ic5n753MyFC52JoDDJ80uL+BlvDpex/CU3paba+VH6PeVFB/QW8kk4mW659TxCDoaefnkTvwM5yLLDzoSOVlHRqKUCQqY8EfZE1xZoJyFhs+N1L2Txhf70ESFStuwgWjtgsipkohjct+I0xkJI3LTVOlK7Zygze3r+qbYBPqVtQLRdIu5lDkI+SASqPffkx1HdtYWsIuvUVv44XIruwQJMGRKHR8uM51hslDswhaF+XaYwbg9W8RHJy93QpC1th/4ZbQ/SyILUvv3LFr4LWsfKL1RbphAtRW7wLXD5fFRhd3nj1sw4qe17z1WnZh/J7rqPkL5SP3F9G21b8wr5DRb7O70z3jD0hen+V15s5VYVMv/D5S+t38e/F/jUBWzVRjsErRmSy8ReLPoTdrDdfPKyf1x/XPlRXWo0jyya2FXpH56w8yS6FvXgiEhBld2AoeJ3ssO5ENeIAgRqGFXG70ohh2O/yv6ziaN3PQfgmUomlgeONKeQR99mG5nCVX2ILHLRQyOYRoMtBpblFrc+lNfGT8IIZ56woe4SnWUXE/65q6F83wx/ifP4+B3rs6P+pbNjlQL8tHG0xUZaEkrdJ3U52Q7wJtd4bC9XTWiHAfpoAQsWl2EjZGON6T3eVYAMPfzvyAMW2GEBBMaOKW/0iWGvnsCiqzW43DtWfRxPbcbVw5FULL7GQC+Bzeq/I8iXbZ9+mPa37kIDeRQdHl856Aowbost8avsSU6+za27uLyQRrk9db0d8w0i+m6gnktNhzWIcvwohaKsOwgNoN3PSagHcknFVxDzw92PYuja1g/qR5v3UwPt4tk+/c0hfhBdOp/A2OBSt9t7CKkSXVvjp3/UKah4aBFIxzHDj/jvrFlGZgZBY/Vw4/b6DENsw98dtYuPIQ8+OY8QWdR0MLdNP0LlCHj5t6agDstn7tJgfTBG05He0Yw4cJUnJiF/l+R909l0Edjyb+DpA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8fec4046-b3ee-46e1-f7c4-08db3ffe3392 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:22.4304 (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: mvz9d6+mNxjGJbyYvi2ONn0kvTIMC4hRCz8DQDM3jcNZ2J+YLaqhFBlshkJ0Jxgr23mEm+VEecNgDCDu4iD+Bw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8659 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The verify-enabled boolean (ETHTOOL_A_MM_VERIFY_ENABLED) was intended to be a sub-setting of tx-enabled (ETHTOOL_A_MM_TX_ENABLED). IOW, MAC Merge TX can be enabled with or without verification, but verification with TX disabled makes no sense. The pmac-enabled boolean (ETHTOOL_A_MM_PMAC_ENABLED) was intended to be a global toggle from an API perspective, whereas tx-enabled just handles the TX direction. IOW, the pMAC can be enabled with or without TX, but it doesn't make sense to enable TX if the pMAC is not enabled. Add two checks which sanitize and reject these invalid cases. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman --- v1->v2: add missing "Verification requires TX enabled" check which was only mentioned in the commit message net/ethtool/mm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/ethtool/mm.c b/net/ethtool/mm.c index e00d7d5cea7e..4058a557b5a4 100644 --- a/net/ethtool/mm.c +++ b/net/ethtool/mm.c @@ -214,6 +214,16 @@ static int ethnl_set_mm(struct ethnl_req_info *req_info, struct genl_info *info) return -ERANGE; } + if (cfg.verify_enabled && !cfg.tx_enabled) { + NL_SET_ERR_MSG(extack, "Verification requires TX enabled"); + return -EINVAL; + } + + if (cfg.tx_enabled && !cfg.pmac_enabled) { + NL_SET_ERR_MSG(extack, "TX enabled requires pMAC enabled"); + return -EINVAL; + } + ret = dev->ethtool_ops->set_mm(dev, &cfg, extack); return ret < 0 ? ret : 1; } From patchwork Tue Apr 18 11:14:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13215433 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 2FC2AC6FD18 for ; Tue, 18 Apr 2023 11:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231381AbjDRLP6 (ORCPT ); Tue, 18 Apr 2023 07:15:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231423AbjDRLP4 (ORCPT ); Tue, 18 Apr 2023 07:15:56 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2045.outbound.protection.outlook.com [40.107.104.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DE8126AD; Tue, 18 Apr 2023 04:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gv5B7AoPqtImOlehtkpdN0UUysRp0RXYAmY8UpBMmsu19KPsEyAyASsWphLmRCIWWp4FROs8AvZsnQSN/wLqHFkr1wlJ0gowvNWxnAmPSxILgbS8uVjqBox42BLPaHH22xqXeGlGEZYrxfkuzs9IFFuVoPRq78tnlvTMRoaV+AHJMAvbgGIBFVG98kTOy29ayo44DVzcznzK9JAGYU8n5g0t5OrCijFDGtiEh4BjUW9VLaGBqL4AzLQQ/u8Sa9upGbXzOxB0x4ID3V14f8SnT0cqeInYeNGSIyU8qC1/7HyVsVzGL+JdHxgjxWEklSJIfX/jpYx+BF49IkQhDhkrJA== 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=u/WbGqpZdzz7a1IaX8ZTpWons9aKUG8SCU8qFLaYAZk=; b=ig/yTjcb3EghKiX8SwcNs3ktMsuH9M8hjmgSnz+evxvQk/KJOoWal+z2zgoHWyFh/Rf1UfHqZB3MjNOLXbjdn/8NfSK3yggOb7vEW6cR8JRtrNeQOWGlERIAuyi5h7hjtiyWPhWIxR7sokf4Cp7rBIdNbJ8xxMUTvHy0uHU5SiWTpxE3Naq20qwGKZVIq187Y96d1cWAMuuA+4j8maZDTHfVOX3Pb7KYJcq2JYozL2apr1Zk7qCvmJHan4MPHuybS03r2hJwNZNBLZ7NScIyy/dVGLsnaw+8y0tE+VOWrAaHvWfiymw4bd5JcdUVYtkx7Ta4hUzS+hagkq4Zj59wkA== 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=u/WbGqpZdzz7a1IaX8ZTpWons9aKUG8SCU8qFLaYAZk=; b=Q7/LfCeI9cb9eOuBc9mTXcJGuFa5cpDmKJ4eikwsdAcFplE3KKM9JPLotdVHzeVEI0I5MAp7RGZHMOSAuZ9WPnkWUEzQgB/W5GSFcYNHgpjFyHSCFTcul4g0B6tIAaC//SO0SvK9u0ulfV32DaRGDYlzg3SBqJube97aKJw0QHY= 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 AS8PR04MB8659.eurprd04.prod.outlook.com (2603:10a6:20b:42a::22) 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:23 +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:23 +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 6/9] selftests: forwarding: sch_tbf_*: Add a pre-run hook Date: Tue, 18 Apr 2023 14:14:56 +0300 Message-Id: <20230418111459.811553-7-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_|AS8PR04MB8659:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f37e036-6e70-4036-7611-08db3ffe3456 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IPFwC3lhJDHCmig+8RI9Bm4q5c69JL3UpFF5mPt5A5gbc2Tsi4f9DKMn/Rl4zvEBo8odhlRLNXQy6dEa/P8hOD2YPXPwdjvCIHWdYRMcVsRWjqsRq1XCCBp4g51EpAau6MVb//Kmz9ISuuXhnBy87VQD4KSrFfi8Ode4mCjI+pvIJ7fG5Kq+ftaamNFpi3h9cNHD976llIhca3gBuuUyHQ/bOiQUoYNdC2dWBOjnxA293+6dolnBXpGEDYTWiIMQd+GCMH4iQcqvIM2nmgTA0wLpzrE+dTrVOHDiVMdZLQ8N8nVTs2dFxAYnhGOx7pHEkE4T1e8v4PyfP5WBQ8m76fqgHIul/2DYAlTpaxSHJpeYBWGg/apVTicqk2Ja10dAPBPUDwsil5COi/wq0gX4GqlQR6mbgF6EG4g7boaq4WzFk3oYIWDZsNW8GvTJTjzuXDBW6FEdV05zGOA/15I8o7sWmy5ypTzrVqOXR9UEqRe9Zy0sqJEeYtnQ5etmxAKHCR1UTkxqjgVJ7eW+Xdo3BjS2aVdUZX4gUFZIAFL2YR6baH+RDXguwrE/PpiK3wpaswN96yjFONQTaTPa72mAlxcUkFdioBlWQKRQoHArS3SuG/VwxpxwjR/gMZSBJ8dH 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199021)(6666004)(6486002)(478600001)(86362001)(2616005)(36756003)(26005)(83380400001)(6512007)(1076003)(6506007)(186003)(38100700002)(38350700002)(52116002)(66556008)(66946007)(66476007)(316002)(2906002)(4326008)(6916009)(8936002)(5660300002)(8676002)(7416002)(44832011)(41300700001)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w/Yp7vLnaB5LbTqSC/aaNj0NbMQd4mX0cvR1lSzsGqwwTLb6yHHMLbMI+qRoHm0y2tRQePw9f7VlGf3jeiiRd31p76tivovL5JwCf0Gb/qTaAL0WRFsDXPjE1D42yB50Xf9G3jARNS9HMonM2jyRlHUaFCUDfBLw/mFJA8ku6WLVpfy5sjJn9t/7Vb3L/nxttEtfSbOpKHfa4hwB8qviXfcRKB4wOtKstTsve3ki4lUiXdbVft+6q+DUSz1PJx4kwcqZqA6zjrs8Vi4BL+3RcxfF8MTWDom/G6zIX0qMn9a5Unpv3+AcxCYXd73nI0Xe5AMjKEUOG/Xc1Sp96UV6+RbLHr4V4SkXi+cXVQQYc0DD9EK/fcno53y2C2JwAH+VkoxVPH+3RjiIRmmtiL8VPEeV/eLTrhiC+k6hu6RAoqxVqHf0vEuL7qgViCKhRupXZAQt9wDosAM7NqhtklDkTTnN3bKiwxu34PdGXgg5KbF//OYwEyMRh9wNGPw3UrsDLDogQIE/QMkiIJly582kSBWMOHobMlOd+dcnsBqBI3/NmUqwJvQVbnfm+Ip6OOfCSnRE9PXkSvYiOo8Ohh1cIqyqsvh0xJG+IRo3znyx+GtmRsGwR5bdyVo4WaYi/QNyzycX3kH1PzQ2ZMgvLqO7nomj4Q6uO1ZtcRuj+6hDfBr0x48LpCUKxhBHU9zOHNrSdZeNpGrfn36pqzKkj3kGxBa1vK9sntusmD1YKTlaRPm2kNcY/yAeTwJsvPTAgbT6AFWsh2nR2idF/W5PuzAQLXxJyvbF6rA3r08l2ZlaPhPWugGfI1v6x1Fe2jb2xfpYxwkyFjBWR6BzEBlVIk1A/vQBGq98TxqsMAPZKJjhPzAjsmiT2ZU3KgaQpkT3vOxTcE9spLhfTLoQosJfbav+TNpohlVGQKn7JrDCRCM6CvCr4jik4xkuNWfIYx1gu9DgkY5P/zBXLn4mTXjVNO4J8ycpjLRsr1ZIpGqxfHuNzwpM68aukYhsz9zsjZ/1RbDZI3yZ4+4WooV3/frkQuJU9JK37HybaM/Jx0GEak8wJMs506YOhE2bDdFaGPLIZcOPJCBnvcKiRgoD64qVMvGfMj7t+7EpUGDd/5JW7iQLGaGg6cIgF/ciodysQDnwx7/YxvzNMR5uUH31iKhE8yddtfqFJpU4QygmDcchLrkOfXaQH+y6e0wouu1QNOu555pPWTrvR3h5IfAwc4XmcrNW9FUHm+QN6mxKmzVIZI2cOBVg11biHdLKLCjx7c5FzZJXyjdPDHt9A3i8fuXGsivMklq6w3L4Zzkf4+V6PfMasVd6dmDvjdP4CdH5Jom3xY1ip+1ubvPgPA8VylT4E9qneUFUDBIppXxkv6kmUk32hmDB6NtQix1gdXsrCu8vfC6YwY7f2b7EL1qMKiUAdZIrhjYQBH7rf4fkXtyAneZmZ/sN0ZqOw6LZ2v9C9hAP+qskA4VhSqT3bh9mTuOwp3t6mBsLNCo1PMACeNkRP0sktttgYY4wTo1JTvbM9FuxpBpaZCr3RTeL4Ym5u+o1n+6g/RL5Y254utTWYwxxwyLRv33B2YBGZaMLqh3cyX/DnO6phbWmOQB6OuC1Pnv5shgDow== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f37e036-6e70-4036-7611-08db3ffe3456 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:23.7301 (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: 47JhNNU+7/t34hqu8VNdws7CCkEoGo4FZphESo3iv5M3t42EkI3oNfxkoXLC14ppMwp9Ew9bWv2ih9ayTdqHzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8659 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: Petr Machata The driver-specific wrappers of these selftests invoke bail_on_lldpad to make sure that LLDPAD doesn't trample the configuration. The function bail_on_lldpad is going to move to lib.sh in the next patch. With that, it won't be visible for the wrappers before sourcing the framework script. And after sourcing it, it is too late: the selftest will have run by then. One option might be to source NUM_NETIFS=0 lib.sh from the wrapper, but even if that worked (it might, it might not), that seems cumbersome. lib.sh is doing fair amount of stuff, and even if it works today, it does not look particularly solid as a solution. Instead, introduce a hook, sch_tbf_pre_hook(), that when available, gets invoked. Move the bail to the hook. Signed-off-by: Petr Machata Reviewed-by: Danielle Ratson Signed-off-by: Vladimir Oltean --- v1->v2: new patch from Petr tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh | 6 +++++- tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh | 6 +++++- tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh | 6 +++++- tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh | 4 ++++ tools/testing/selftests/net/forwarding/sch_tbf_root.sh | 4 ++++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh index c6ce0b448bf3..b9b4cdf14ceb 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh @@ -2,7 +2,11 @@ # SPDX-License-Identifier: GPL-2.0 source qos_lib.sh -bail_on_lldpad + +sch_tbf_pre_hook() +{ + bail_on_lldpad +} lib_dir=$(dirname $0)/../../../net/forwarding TCFLAGS=skip_sw diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh index 8d245f331619..dff9810ee04f 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh @@ -2,7 +2,11 @@ # SPDX-License-Identifier: GPL-2.0 source qos_lib.sh -bail_on_lldpad + +sch_tbf_pre_hook() +{ + bail_on_lldpad +} lib_dir=$(dirname $0)/../../../net/forwarding TCFLAGS=skip_sw diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh index 013886061f15..75406bd7036e 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh @@ -2,7 +2,11 @@ # SPDX-License-Identifier: GPL-2.0 source qos_lib.sh -bail_on_lldpad + +sch_tbf_pre_hook() +{ + bail_on_lldpad +} lib_dir=$(dirname $0)/../../../net/forwarding TCFLAGS=skip_sw diff --git a/tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh b/tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh index 75a37c189ef3..df9bcd6a811a 100644 --- a/tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh +++ b/tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh @@ -57,6 +57,10 @@ tbf_root_test() tc qdisc del dev $swp2 root } +if type -t sch_tbf_pre_hook >/dev/null; then + sch_tbf_pre_hook +fi + trap cleanup EXIT setup_prepare diff --git a/tools/testing/selftests/net/forwarding/sch_tbf_root.sh b/tools/testing/selftests/net/forwarding/sch_tbf_root.sh index 72aa21ba88c7..96c997be0d03 100755 --- a/tools/testing/selftests/net/forwarding/sch_tbf_root.sh +++ b/tools/testing/selftests/net/forwarding/sch_tbf_root.sh @@ -23,6 +23,10 @@ tbf_test() tc qdisc del dev $swp2 root } +if type -t sch_tbf_pre_hook >/dev/null; then + sch_tbf_pre_hook +fi + trap cleanup EXIT setup_prepare From patchwork Tue Apr 18 11:14:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13215435 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 DB053C77B75 for ; Tue, 18 Apr 2023 11:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231482AbjDRLP7 (ORCPT ); Tue, 18 Apr 2023 07:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231444AbjDRLP4 (ORCPT ); Tue, 18 Apr 2023 07:15:56 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2045.outbound.protection.outlook.com [40.107.104.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9B7A7EC8; Tue, 18 Apr 2023 04:15:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OBLOpwI5AbqCRSAyuBSCprsR8zian8DjZuCNgL3lCGQQEDWifpMyw7UX2ArIQQemgrXp6DcuUhrY1BbxqL0PkU/nLYJUkjlkR/qXzKVkhvmZSrUVOa/4fPhLjx7Ru1JruUPm+Gx603BtD7YSu3K2YZbiIRwdA5SLT9ZV9ojgPwUue2Eb/RFB/UHe/NjeamQJ+I+9utaOM4BTuEKDTscP1IDFj2FmN2o/qgv8X1nHtfyeGQLWNO2tEfE9EoHCbczUmnUtbrCwy5z+EZhL+H5oRYJa+lC2AdguCC7d63ipzFSFtnVdBkm2M8R1GXYdu1Jj9/Yx0Boj8mbQbbrm3GBpzw== 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=b004uq+1MEuH0toHwUCzkpI74907JbHOBxiLaLkv6es=; b=nUmU3pkrCd5C/yrMWTeVgaKG9seT77yPlJUYH8laliJDZMxdOhk6p3NDTsMLqKhaIm83iXe48sh/1Gc4EVkGTI0ra0TQhAw+K136BrdtC4/BnnKaaVueo1Wd0UzwfFcyRt64adIwTEZBjOFXVElN1XsBLhNMC3e723XUE1u//g4D1LZC4hwfNhZS/eip9bD6e/Ygav23ERHlXd03dUHjE0iddEu2V8EM3EQA40IKpUi0MHYenANPlCzMjnqOH9b2bdlyoz1xRWLCf8Awlb2HpkhGLyt7KjwRtUe5joWDJeWi0eMCZccZa+0A6K+jnVcYf5nMboPONr572t0IW82TEw== 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=b004uq+1MEuH0toHwUCzkpI74907JbHOBxiLaLkv6es=; b=ObsudGMBSXGGPruokiIKI7J5xYVBICMhNVi7/dHVztI0E1Jg0WaKZ5gmUSb+MHR275ntMnxwHMS9psP2m0Nqo3OM5LSvIlafCO4JFjfP6VDA4fgnjymYuons98RD8Ms0su/MgXIHFiNYb/Cp7tdadXa0eu9KOzEKK1z0CAVSFqU= 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 AS8PR04MB8659.eurprd04.prod.outlook.com (2603:10a6:20b:42a::22) 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:25 +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:25 +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 7/9] selftests: forwarding: generalize bail_on_lldpad from mlxsw Date: Tue, 18 Apr 2023 14:14:57 +0300 Message-Id: <20230418111459.811553-8-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_|AS8PR04MB8659:EE_ X-MS-Office365-Filtering-Correlation-Id: 342a45d5-b2c2-4e27-1b5d-08db3ffe3521 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uH61K1LCZpzEFK/y5IKyIN+btc8P42h2YzzQgZgS9feQoER9bn+Jdm+qNeZp4ws6nm/0MG862u+Q5j7dqicuDFozZg0o328xISg3YSpYoU2xwALG4OiNtBlP8BxV38Rcm88uzmtawSRqtpUcKA9NJxCcFspVYOpb1fZsuTPw1hD+8uc0YBRKkFjZGjwwGsQT8Pf8XI+4Gg4JLjleHLa/8PfYOs8lIWu1t/TP+rbVp9FbHeS9IaFtXzo9FwEhy+bJ615ETCE6zGOB/kvv58U9t48WFldgbA2QPTlNwCTnaPpW9sJHImzqIndDY3eIOfbah3wec3XzPdMHBuqvxzK52M4nzcY2XH7Fhjzl9wdmOjCYh53j0LWx+L0rNao9zB4m+SkyYQwuJAvDniTLeiFgHJ77av3O5TCX6jxqneUQ7fr14kB95vB6+kY02KZLGv11SH2DESuqGuwNYYVsCSbf1jjFy7VMS1ReO+QNNvaJw41IomGM6h8OWuWbM2PXUgvT8c3LbVekkjCZnlWi0IIG8Af7uVPSp/VbVysXpRTOBeSj1e3xxDAFWq4JlCkxom/+ZvelioYEfZZaJat7ZeUO6QpiotdxCtTvmx99cDKKI/C66zvnQY+TZh3p2k+NeVvhpca0B1wh8J83VYfKjJQEiQ== 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199021)(6666004)(6486002)(478600001)(86362001)(2616005)(36756003)(26005)(83380400001)(6512007)(1076003)(6506007)(186003)(38100700002)(38350700002)(52116002)(66556008)(66946007)(66476007)(316002)(2906002)(4326008)(6916009)(8936002)(5660300002)(8676002)(7416002)(44832011)(41300700001)(54906003)(17423001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SkIEGVZkVFuJ9nDB91o8kITlMJMFK9GDo3nFv4i5bj7Bxkw2WEMAmYEBIROVTmNoBIaaiyXUu0a3W7casWZZ2PT7sXhB6Jh/XYkzF5HPTomGr1kL2oripGd/IGqHaLDQoQYpin2eZXB1Ewcov/IpfZLHMZrTt6pwn4LwKIx2zvPOMqrVu0QMhgWVR/hvTz9RB2+eEExDq70alvui057vr9hjM4XbHMBWhq9fuX+hRHS5GsqlrNyNkV53bWMpKzHp4YFGiwqgiMbfmra80pMqrSbRA9yNCxELCX8TxtNp2bB1tIjh0RIyiGIJKoVzSSGp5pCgRDVH01s8i/3UlfMcEZXJLOjtISGe5KtfdBEVL5WbJD8y0ugQE19M2n/OR43nTAD8NFksscGNeKQM/si/9iv1WNI/XEddGnAIiCWQAuNZMAA+Iyxjs1Bv1vTFp2g9aHTW1eFrj3YzEzBNFJ2iiwiRgy5AJuH3JoJt4kh/ffREmyM8gWDpQqvY1AF/BkPZGLhJTq2HSs0tBk+12BFsrjytUEBNZHBTxvJed8HjcfGH4m1hQKv5W4Qlijq1KSaTileQpvxsQ9Ya3aJCJkClXO+9I311W9SF1y1u1zF0ScEmAeMdoqbEm1DRZU+CpqjS1L9PYL1Pqw9zbO7SuIpyFzFrxwYD1ptRMMbLOzVCq4IaQubZkrHvedMn+GkFj71R3uPKj0cLUwNAsPCZizn2xU6dbY91QpIIGqw4zT/f0dKovFNLGj3PDa7M96g+3y2Il1Xf2BgK6BEqoxT2YTqgeZTbiFcy/1vu9DUBEIJqzMcxc//tjeXRB4jCRLXMErGaYEkrufT4UMR+z/zohPlieG7hSCoOWLjUa/qtPKywUUEFmpui9IpZYnmvwVwlpPbjCrZI33dYWMvnt05ag4Gi1UFGHi/i8OoGXCW27pPnFY7pu9SJWJebK5VCsCMwNinGqSU8ps4qGNN2PN3u0u2cvGcSXl51NRYnb+M4i4gK4lATk9X8MsMLIfwIKQXORRSuuLdxPE9EFWQW9GpNxUU8hHxfXgbtADIJy1L/ztLJShYoSqRouwysNksNIaDeq9FmQeGhh9r4P+Vvw13ERdLfZR0OIGQ6JN3TAVucEcCL2SMC7Watpr7RMR9A3iPyFlc/dQKvwlXH0yOsJQpPg/8rMgQpuqvug5EN47cFEiw9O7QAQ95GeyYlARYqDAVzhWCK0PQNd6oUuNxGZzfzmz5GtftnqgXD3xahid6WYI00Ah6TlZ/xlIMkxrWlvyZZRmDUDITpbUC8I+QGtbKVgxFrPt1i1KI1cItsEcgHLhwGG9QR+Qdcv/bwR7ni2We2F17lUcA/2LFZ+mR7QGVj07Q60mmLJHoHCqqMSGhUzBOHuJXe7nzbAYnbwJPYJs9/qP74XaIJ5dNg+hZ0RYaZmkLVxnfpcaAZKOLnMx/uRDmVcMDafyyUpv0YshFIKtLMPxsBdx9gXXh3WLVuk/R9lzIMn30pMdiC7F2fJp/GMQid6ZW0WdsD/I0AEyAYzju4/KkzwvJRgGpU40NmQij6A+v/u+XD8sKFzMXRz4bmyYiPCXqA/QHujKl4rnO9FTA8YBcK4VPqF1+yMtl/zec707nqeA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 342a45d5-b2c2-4e27-1b5d-08db3ffe3521 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:25.0155 (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: jIQlzZXSOI1fyHEt48XUXqgkf/URFuVFkzWIJDCT45SyAXAtAYiFy1z/Iqc1mqNobnvjl/As7oMBz0IvTV+Vrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8659 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: Petr Machata mlxsw selftests often invoke a bail_on_lldpad() helper to make sure LLDPAD is not running, to prevent conflicts between the QoS configuration applied through TC or DCB command line tool, and the DCB configuration that LLDPAD might apply. This helper might be useful to others. Move the function to lib.sh, and parameterize to make reusable in other contexts. Signed-off-by: Petr Machata Reviewed-by: Danielle Ratson Signed-off-by: Vladimir Oltean --- v1->v2: new patch from Petr .../drivers/net/mlxsw/qos_headroom.sh | 3 +- .../selftests/drivers/net/mlxsw/qos_lib.sh | 28 ----------------- .../selftests/drivers/net/mlxsw/qos_pfc.sh | 3 +- .../selftests/drivers/net/mlxsw/sch_ets.sh | 3 +- .../drivers/net/mlxsw/sch_red_core.sh | 1 - .../drivers/net/mlxsw/sch_red_ets.sh | 2 +- .../drivers/net/mlxsw/sch_red_root.sh | 2 +- .../drivers/net/mlxsw/sch_tbf_ets.sh | 4 +-- .../drivers/net/mlxsw/sch_tbf_prio.sh | 4 +-- .../drivers/net/mlxsw/sch_tbf_root.sh | 4 +-- tools/testing/selftests/net/forwarding/lib.sh | 31 +++++++++++++++++++ 11 files changed, 39 insertions(+), 46 deletions(-) diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_headroom.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_headroom.sh index 3569ff45f7d5..88162b4027c0 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/qos_headroom.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_headroom.sh @@ -18,7 +18,6 @@ lib_dir=$(dirname $0)/../../../net/forwarding NUM_NETIFS=0 source $lib_dir/lib.sh source $lib_dir/devlink_lib.sh -source qos_lib.sh swp=$NETIF_NO_CABLE @@ -371,7 +370,7 @@ test_tc_int_buf() tc qdisc delete dev $swp root } -bail_on_lldpad +bail_on_lldpad "configure DCB" "configure Qdiscs" trap cleanup EXIT setup_wait diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_lib.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_lib.sh index faa51012cdac..5ad092b9bf10 100644 --- a/tools/testing/selftests/drivers/net/mlxsw/qos_lib.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_lib.sh @@ -54,31 +54,3 @@ measure_rate() echo $ir $er return $ret } - -bail_on_lldpad() -{ - if systemctl is-active --quiet lldpad; then - - cat >/dev/stderr <<-EOF - WARNING: lldpad is running - - lldpad will likely configure DCB, and this test will - configure Qdiscs. mlxsw does not support both at the - same time, one of them is arbitrarily going to overwrite - the other. That will cause spurious failures (or, - unlikely, passes) of this test. - EOF - - if [[ -z $ALLOW_LLDPAD ]]; then - cat >/dev/stderr <<-EOF - - If you want to run the test anyway, please set - an environment variable ALLOW_LLDPAD to a - non-empty string. - EOF - exit 1 - else - return - fi - fi -} diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh index f9858e221996..42ce602d8d49 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh @@ -79,7 +79,6 @@ lib_dir=$(dirname $0)/../../../net/forwarding NUM_NETIFS=6 source $lib_dir/lib.sh source $lib_dir/devlink_lib.sh -source qos_lib.sh _1KB=1000 _100KB=$((100 * _1KB)) @@ -393,7 +392,7 @@ test_qos_pfc() log_test "PFC" } -bail_on_lldpad +bail_on_lldpad "configure DCB" "configure Qdiscs" trap cleanup EXIT setup_prepare diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_ets.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_ets.sh index ceaa76b17a43..139175fd03e7 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_ets.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_ets.sh @@ -5,7 +5,6 @@ lib_dir=$(dirname $0)/../../../net/forwarding source $lib_dir/sch_ets_core.sh source $lib_dir/devlink_lib.sh -source qos_lib.sh ALL_TESTS=" ping_ipv4 @@ -78,5 +77,5 @@ collect_stats() done } -bail_on_lldpad +bail_on_lldpad "configure DCB" "configure Qdiscs" ets_run diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh index 45b41b8f3232..299e06a5808c 100644 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh @@ -74,7 +74,6 @@ lib_dir=$(dirname $0)/../../../net/forwarding source $lib_dir/lib.sh source $lib_dir/devlink_lib.sh source mlxsw_lib.sh -source qos_lib.sh ipaddr() { diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh index 0d01c7cd82a1..8ecddafa79b3 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh @@ -166,7 +166,7 @@ ecn_mirror_test() uninstall_qdisc } -bail_on_lldpad +bail_on_lldpad "configure DCB" "configure Qdiscs" trap cleanup EXIT setup_prepare diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh index 860205338e6f..159108d02895 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh @@ -73,7 +73,7 @@ red_mirror_test() uninstall_qdisc } -bail_on_lldpad +bail_on_lldpad "configure DCB" "configure Qdiscs" trap cleanup EXIT setup_prepare diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh index b9b4cdf14ceb..ecc3664376b3 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh @@ -1,11 +1,9 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -source qos_lib.sh - sch_tbf_pre_hook() { - bail_on_lldpad + bail_on_lldpad "configure DCB" "configure Qdiscs" } lib_dir=$(dirname $0)/../../../net/forwarding diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh index dff9810ee04f..2e0a4efb1703 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh @@ -1,11 +1,9 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -source qos_lib.sh - sch_tbf_pre_hook() { - bail_on_lldpad + bail_on_lldpad "configure DCB" "configure Qdiscs" } lib_dir=$(dirname $0)/../../../net/forwarding diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh index 75406bd7036e..6679a338dfc4 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh @@ -1,11 +1,9 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -source qos_lib.sh - sch_tbf_pre_hook() { - bail_on_lldpad + bail_on_lldpad "configure DCB" "configure Qdiscs" } lib_dir=$(dirname $0)/../../../net/forwarding diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index d47499ba81c7..efd48e1cadd2 100755 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -1887,3 +1887,34 @@ mldv1_done_get() payload_template_expand_checksum "$hbh$icmpv6" $checksum } + +bail_on_lldpad() +{ + local reason1="$1"; shift + local reason2="$1"; shift + + if systemctl is-active --quiet lldpad; then + + cat >/dev/stderr <<-EOF + WARNING: lldpad is running + + lldpad will likely $reason1, and this test will + $reason2. Both are not supported at the same time, + one of them is arbitrarily going to overwrite the + other. That will cause spurious failures (or, unlikely, + passes) of this test. + EOF + + if [[ -z $ALLOW_LLDPAD ]]; then + cat >/dev/stderr <<-EOF + + If you want to run the test anyway, please set + an environment variable ALLOW_LLDPAD to a + non-empty string. + EOF + exit 1 + else + return + fi + fi +} From patchwork Tue Apr 18 11:14:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13215434 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 5E374C7EE20 for ; Tue, 18 Apr 2023 11:16:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231492AbjDRLQA (ORCPT ); Tue, 18 Apr 2023 07:16:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbjDRLP4 (ORCPT ); Tue, 18 Apr 2023 07:15:56 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2045.outbound.protection.outlook.com [40.107.104.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD0E87ED1; Tue, 18 Apr 2023 04:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PKiWqHDcznDvL2KWlDuoCc9W/dcsRQLykNPrYN4whE1A5RYKjP8A+QCiOJPX4RF/YwFdbGIojLVwF93LeOuI0LxouuIjmY53PYt3v6PPheiOdzR5SObELbEKnjhHoLSrxZyqTsbTbJUlOq4wb+KEtIfQTXX0d5Smgkrp8SAfFQyBz+OTXpadWIobjktFBDKxsi2BVhQtWQHKpGb843ELI9eOmM5Cc1RLc+yC/ASTOuiErM5lyw/Sk38bqcQFetQpJ8y1GSA1mqJqnaMKkek5Oqk8QuSKc6JYcxeP7VWnhCWa4BI9EreuVq+1WtAa/ky8F8o0VVwEzsAuByHTRtG7QQ== 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=FNJoeWLjyVB2LWaj/CAkCgVQequpiOHssTo2XTeNbkU=; b=mlY2IXqFazMO+1KbN5ldQ/NSH7iZZ+ME7tigEUtO99rTzGh7YDumOhYQyHc41n1/johevuquX857F/ybkm5jeK7vWbeLHy6ccM0/SghLsrfmD76IbD8aVuiSSMGUNy62iJO7ZtDsJ3UlpmvzczqY7K1/Hu0wwhXJJZaoKh3z7CgxYnDaZ2evcqFKEs2x6CUp25Z5bU1oShgYYb2ok3zfLNZ2YJnV3DeXd03cgzvfodKnaTGjEb/Rpa1niZCHF+wta5Qgx64OUYT4JYQ0sruTL1PMzRvrR3b4Z+bQuczlU43UvTq5eZrT47VP4jfBNuCJgCy/pQfMOIgbaANLGcadPA== 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=FNJoeWLjyVB2LWaj/CAkCgVQequpiOHssTo2XTeNbkU=; b=IxtuU/kkUhDeLHSzuCEzkfO3aJVxazESK5FjSTkQ/KvcxkTxLhUPSv8ggBROSnYmicFKRxt0hIs2ynSgW3a9kZfKn5c3q6PFNJTfzIhJUlaY4g16Dbj9Er2UKLj7Lizdrfw3+UbVdVCxrwbJpk+Vzfb4IsODqYFZOehURWK5OTg= 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 AS8PR04MB8659.eurprd04.prod.outlook.com (2603:10a6:20b:42a::22) 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:26 +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:26 +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 8/9] selftests: forwarding: introduce helper for standard ethtool counters Date: Tue, 18 Apr 2023 14:14:58 +0300 Message-Id: <20230418111459.811553-9-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_|AS8PR04MB8659:EE_ X-MS-Office365-Filtering-Correlation-Id: 8155f5dc-4a08-4e57-3759-08db3ffe35e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zv1+RJTdlaMt84O1ADRtfLJSXFVeMyXJa7sH8+KxETEDMdgcTomCRQV2ZlbGvWJWGDmmygKUu3RH8oldU2HBahZMG2JmCp/uKyGlOaOHsB8ycKJTfMEkK6fBNZl30lgsoIaYkMU8KB8lkf8BMDERSr/FEo/BrATcbD/h8Z1nitMgb2Ii1uajdf4aBNT9cBWEF98KX44mlY+SRTBniGJ2/KnAulHplEdxxV+C+gZocGrJVigU0AbEOgiQUj0Z9/IC/iDLArg3aftlWXYNZ/bYHjuuSxCElsaXAoGtKodFfFarbi/jceb9XSS5TUS24eZ3WUEibSdV6QvQNSbEA/EliKS8eLDzhZkeKbfTnUeDHVHoJPCVinugg/75PbrHR5lzvu6VCk6OFW3u+LF6dCoMgAFrzGyEg7TpHFQABl7hY5nxIl9rCs0gIhn6hWYV3pjl51YWga0h46p9hNZuV7EXlIKvFnumrR6+ZhwTXxFd1R0xwrhL1XRZWrp0rMUSVrV3NBz7xSuhtvrLeugs5aSE8zuastCN3mk8C2aUZWD7oy2aCzhic68A/z8B8Y5jqBP5GBYrJZRlFF3cclZXmkiWG6lzybDJ+H5HUhPWAPFZFRn37Rqyiwgcjm+iqARtE8Ye 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199021)(6666004)(6486002)(478600001)(86362001)(2616005)(36756003)(26005)(6512007)(1076003)(6506007)(186003)(38100700002)(38350700002)(52116002)(66556008)(66946007)(66476007)(316002)(2906002)(4326008)(6916009)(8936002)(5660300002)(8676002)(7416002)(44832011)(41300700001)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Dc7sx8EWNVzq27W11WWtliuWmWgHwS04w8zcQSMewuzlq1xShZWu2dFkdAFQnLZe2DdoXpnzGbwL4v3tJlMu9uFATL/Vza4LnYAzCDsMvmYrH/CEey8sTB9D4nUTx09k2qlACPP22X/a/KgtkgKeGKnilVRAqovEVyHehqWe0tC+hFPYfZQPdQV+q+JRrY+nEkP3gXgo6Eqqd0jlrOZSj7Gjy4jhh8j04uJzsKobTrsN5M5QXBjq55hUd2mEbGkZ6pTZRAMHNUUqcO/PCi71HyGxylJLZuxXKh5BcZqNxf2FBbTJXakm3Fy7qVw0t5HTKM4u3vC3XgQez1hRsgY0te6qxWzTt5IozqpJaH24hd7jolwN6bowlXUsqjC6Fp+kXRo32bRMZx6XX7M8PvO+dSBtUogOupQ10/ezKxYCxY+MAHWK6H/pUkEgPw+fdTUD+UzkXuYfhz/4udwGsrDdofu0ukcvTPHaT/qLiBJRhUutBbh6B++R6emEbArxmMTI/zSqT2NDHWPtehcgRIAvZz0BRDpr+cB1YM0Z/N41560rb8DdFcaJMF2fo2+LSHTeq39cri7TV32TRoR5SSpsWhSvyFXMIddXwTCFd9z76QsuVw929BbndLbHQCkherkpmf4Ge8HwEE1wzeqdy35Wpg42viz6TlEAgubwuE5fbGSuIVTs8YeLWisgVjjDTU1wVk0U2w6iFeZcG1FPW+7o6gdJYQaRpsESndO/Qn7zAZADh583gj2G+Z2DoF8vtdhi9aFjmrg5BuaQcEBFMfPKSzI3qxNw3/HNd2hN3bEf6azXRiWb83VxQtLkn4LqMYZxR+ExylenoQ8rPcdriTWXvZ4hyS8n4NQL+1MM8x+EjHy16K4hZ9SyJcgacRwgHNwdDsaorwQp8lFGONfnhYe23iIFgGhv7NPi47rkiThzWrYY3pfczlfMGifVKSkjFlXS1JTG38C9QBncssaK12ZzicQFOjFojr4kwqco0U0B02gTEUrhDOHrjW+cGiocil8GBvdZstTQoUWgLHgo0DEoqB8zaRdT/fHhRWW9B2groykKH0v/ctnoVGFRBSrflkxiYMbMKGqRahehRX6k4Jdy4v9pmPz43mzVYDNR8Ee/nT7Y19v/r0T3rMKIXyvGfVVIXHsBuQ0JH2H9/m7CInupxXkaYWWL9j51/XK6Ikzn9J7ppbWfG7w+vegWrmcI7ffygsfAV928WHDTxNR9jgt3r7tMlyT5YTb1RLfjQA5UZT2KvcUb8cU1gv9XMiyIjk5fT0xwLK8vHzSA7A41xdAfPyW17nyAECbT2sl1ruyyklc3u5Zf9FLj9d4ksuPgHfX7KcKMnjcTn5XLtJ7ygRFDo4QfG3rqVYeWPHWaRNKxTP1whBU+AqmpV67AT6qE2F5PmNd0gDqDnqrNVilfauXB/+VWDH50f4nIMm3w863YslyteeaOJpLqkrd+4xnYU4UAgxJtqGkWEnhrtpSLHOVmNftkjmdf+oLYHfC3eQibKutRM2kJxgZ3ZolKn+1qwH3X3u9e9mHEd5xVnYfrMN6BZ5W+V5qOafUllIz90pWDaqdFSW9CMkTbdBLFJcgy7q42DxuSGcz/1bfl2d3EbWgxBw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8155f5dc-4a08-4e57-3759-08db3ffe35e2 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:26.2991 (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: hIGkp3fhnqsnS4TwdmxDV+4fmJY+QKAzkI64e8W2tXKqVOFSYHD2dgNgjOYLouvEL+jTUp2KAYIRZ/g/jhEgSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8659 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Counters for the MAC Merge layer and preemptible MAC have standardized so far on using structured ethtool stats as opposed to the driver specific names and meanings. Benefit from that rare opportunity and introduce a helper to lib.sh for querying standardized counters, in the hope that these will take off for other uses as well. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new tools/testing/selftests/net/forwarding/lib.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index efd48e1cadd2..36e47c9d7cca 100755 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -787,6 +787,17 @@ ethtool_stats_get() ethtool -S $dev | grep "^ *$stat:" | head -n 1 | cut -d: -f2 } +ethtool_std_stats_get() +{ + local dev=$1; shift + local grp=$1; shift + local name=$1; shift + local src=$1; shift + + ethtool --json -S $dev --groups $grp -- --src $src | \ + jq '.[]."'"$grp"'"."'$name'"' +} + qdisc_stats_get() { local dev=$1; shift From patchwork Tue Apr 18 11:14:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13215436 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 87E96C77B76 for ; Tue, 18 Apr 2023 11:16:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231550AbjDRLQc (ORCPT ); Tue, 18 Apr 2023 07:16:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231485AbjDRLP7 (ORCPT ); Tue, 18 Apr 2023 07:15:59 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2045.outbound.protection.outlook.com [40.107.104.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E84DE43; Tue, 18 Apr 2023 04:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FgnHWqreL1dEgpWtTe5gKjITeOlhFHTe1GEZAY8SIfaIeItHx4xEcXLbGTfZI387bov/aEOcc0tWzDtdQMzznNjvGK1joWg5EfDBjS+KZ8uUrFitYI3R6QHgVPGrSmEFqi2WPq+ZUEdwQQdQ0XfmYv8HBbV45BbCkodCzZNPnk6v5VKS8qd4BX560muZDv+KEZ1n+jv90gjW5lwhbQfuofHs2lfywBuSE52be3eUr7eJ48m4p/mCG3nz7B0oUwso7PvT0YklxDwrAy+LQZD6IO817LXwX7NZLumKDk7IrTHnrHS0jzLNJroizXOYzbA5J71os9C8IjZoSAUdGvw3dA== 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=SlRtNdKCgMkztqQQH+sDeS5a03EnGoS1PxFt0sEugjc=; b=fMkzRcIdZ2iuom/YGppGsTRb8SYQDnNHGGF9QkafBwgRIs+FTnOZXH61Q4AW5EKa1Z9+TDoRWQYi/G3l3NhwfdWZwPWQJKuFRKmsy4Z4wJgdw3/idmoYDDTKBjLnO/ksLtbvLLt02BY7sv0RdqpIP316C+8jvBCRi31pOSDyyIFptwWG/H6HODG9elJMHygZoxBl8/DYb91Ng4O3niLIHIv5MihgnLvIh0a5O6sdS/qIazt7x2/ICUEPnf/TlqsY4ZpgQOYynvv3lVpOfy01bdiPqhbPQaxjkdw6eZH1z0PmsnDn8A1gi8BFsi0MyyLsNZfp+9ExVXerY12T7qT0ew== 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=SlRtNdKCgMkztqQQH+sDeS5a03EnGoS1PxFt0sEugjc=; b=p7eYJGQr8u86q89KPmx6oUmH6/VZ+ibOm12eQYDOAy1CLRq09CSSIPKTeZ51woZ9ofarjb1MsUUwUPRyZ7Z+Uqw+9VYuYSAUWlu1s6vPXGvSavJgES/+giI2/QUs3ulqbCSxkm0HhQHZwCRnnWkDY/hsMfoCqZqHlw6oqdxKMCk= 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 AS8PR04MB8659.eurprd04.prod.outlook.com (2603:10a6:20b:42a::22) 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:27 +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:27 +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 9/9] selftests: forwarding: add a test for MAC Merge layer Date: Tue, 18 Apr 2023 14:14:59 +0300 Message-Id: <20230418111459.811553-10-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_|AS8PR04MB8659:EE_ X-MS-Office365-Filtering-Correlation-Id: e1ab4642-b249-4916-7a6e-08db3ffe36aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hio13WFva8Bc7w0sFEzvNMPJkJRFN+oCTCbcnGsL3UBXUXUcljYOLSjySLClRGfddjwexPZHop89SXlPRNwqq5KN69LCLhiVUtgq0bRjjQtUFRgUQHH0nZxM9vrbQ43ImBTqkD1rLsEGWt518DrRXUE2yFL1gSv9Ca3ybxXeLrDW0Bly2Z+UV+JMow6BZ/ZvQzCWGkpFGzFFMGAcC/V59RUMTHWirhI2+/G74V3+5n+xz8L8vHgUEnNRqPtsOuS739aM1iD1c+x73gh49nDxGWBNhZuRvw5kTV7EBVkKYRLjasTCnezibWvB7HN4Kt5KraZ1zO9ZjRFu3REvPsYLc0lD4+H5g/LzwHg7C+e+oUwn3sxnkLlvDcOvWDW1i/siLspKNS/YqZGqjHUyVhf1pMqaofcW3LbvJLJpwmVSG8ZUTUBNWZWnXTWuqhtCcu58YvLoQ+NETUjcV+BA81b2GHuefjC9DmAwQEUu+r+tkxHK5MeNLyvqzxT+2umqH0JDjx4KJv7hnmA1wssmBSiY7V8/UlubkWiwgyvbGESmoHeEJsqU2mIYYMVHyLJ4WkTlksmgB9X8sGWeNw9pUv4sRGk+8c7ClDLHZOJAbLe3X4fJXNludSorNrf3eWFjx+a1 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199021)(6666004)(6486002)(478600001)(86362001)(2616005)(36756003)(26005)(83380400001)(6512007)(1076003)(6506007)(186003)(38100700002)(38350700002)(52116002)(66556008)(66946007)(30864003)(66476007)(316002)(2906002)(4326008)(6916009)(8936002)(5660300002)(8676002)(7416002)(44832011)(41300700001)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oTLYvZD9l9EhjL26WNbgVBrquvXYfvonyWf+87tmz5k0ejbgzkTNYyDupGSgJCo6FQK6OpOFZ4Ed6t4otUdaQgCtvK55+fsxRV5ZniU4TW8iAWdqAjjK1e9nmhxBIPcidZXTmnhitbiWWZ2rnkTESKjG0mExegTNhUscqOQ7y+R9mHySipIL0FkiArS0o+CSUVLtNdrgVo3ayS134EnkZbQe1L3ttc/7QI15AcoaZuu5jeQBjL5bvSG0EgUzi31ICpMn/QBjEjc+8V0hyH/C+EVPoS87/E/vbzFDrXoRRhIIkat6i/KGcFz4Ijfon5xCgVJukhr7DDlirORFzAnpKbpniIFBMJgr7SbFlLTlwzWLMJXQ+TITXUWS1e8aHGVyxTf3IgE/7xw+TuINis11Hct8KLh9uuGxbX2SVfqFgqM2jH+hI3UokY1HS8Yy6itGwcdg9P5wcVhxstvOlCGnVq43u+aGcRpJANWk7QUS9GMMkUeNs7EHdufqbRb0O7hD8915YFK53/0s7Y9Eb2W/8lFqsV5F0CQidpHIsoEiVa7o4mUrSCinK0+TscY9Gztxx4i7TriNVPh0KfPf2WKo/xswsfeehoq52zhTJt/6Bt8VjKSbIzwZ76hZa9rtNeJ62ilYdwhKyKXzEm2dpRz5qOGr62aV5W7fnKZKMpH59g7HLlyLKWOhbbn3rMEDGiRtcVHidTAW6NnB7M3o1d0j6W21frdh31TDsoy1lBhAJmEy6FmV5/nZhbtKoNR1pMuWYhnuFuPiVnk1JOFAJU/By/z2Zpd6kz5AuYwHMXKgpiZiyMi/2URFwXd3Hn4+xdf6QczRZQd1jlhOM7nX4bWkbDFY67OzuYEMuq5BXqe1xsBiyKMC2shtdY5C/qSgIbDvY74LtkmUAHE73Q7PoVALUks7vQKOJzuelLbZ9KqKd6ryuP+fZuS8RqclCgb/IRK6qCvzQ0bDjATH7Lmhp5aBJlbC/AcGyIbt7eZ7LrRpNMNDMvwHBNKhn0shVUaEYt1coqyKa8ux2/10KGFXY163GQ8d67oJQPGdMnlJpjxsAPdO0WSIsNaMKFo/4JTD4O/pwjSwRq6TpQw52oX1+Ir1oBUh083cdzvshefvSaHgDNrbiZ9O62PacuLWW9ESuHjPSzakLElJA/jQacBInmHjeRBBlvHTh+y2keOg/Q+xHiJLwYS8viwJRE4KtCTPPvUhkFlBm652F4R5cE3fODK0TsbvFvGCsjGcAsC5LJ5i+2vrrO/WGjvVOMpWV2zpArfOZwtrpgjq5NIRgkseR6CzYZH72ctcn703yOcgXbNa1Gm70fWp6B7q8EAYoK06EBWXdqFx7oXivhQO+btpE6n8IGxnLG9EFwCuc2jzkwrW5BU7ZvJoHjI7UxcXQdpZ86JWNshZXQfirRSB/EkMhM3Q1UlEyIseyrYPzkUUnZXFm9Kg6WL274b9fd4qNRouywzzckI6C4gvy/1C9vrSUyy9FrJlewSJrD1zp1owh/Wb0BcscJ2+aK/I/DZp90XS+MKw5vw93ZBEl6qfvhxjdoXC5dpfy/HdY3rChgvGpHwvOMHqu12Dyh7ZmYAv4WkfsKX2zq5tEdf2+7M9KRBsP20Osw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1ab4642-b249-4916-7a6e-08db3ffe36aa 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:27.6684 (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: GcKmdOgvX299eDxP0Pj4aruSC0IMjk1JEuVD3Q5D0CTN6nFj8LPZrAUECDxFCMBqyN2MB8YAuraFD4BfBNFXNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8659 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The MAC Merge layer (IEEE 802.3-2018 clause 99) does all the heavy lifting for Frame Preemption (IEEE 802.1Q-2018 clause 6.7.2), a TSN feature for minimizing latency. Preemptible traffic is different on the wire from normal traffic in incompatible ways. If we send a preemptible packet and the link partner doesn't support preemption, it will drop it as an error frame and we will never know. The MAC Merge layer has a control plane of its own, which can be manipulated (using ethtool) in order to negotiate this capability with the link partner (through LLDP). Actually the TLV format for LLDP solves this problem only partly, because both partners only advertise: - if they support preemption (RX and TX) - if they have enabled preemption (TX) so we cannot tell the link partner what to do - we cannot force it to enable reception of our preemptible packets. That is fully solved by the verification feature, where the local device generates some small probe frames which look like preemptible frames with no useful content, and the link partner is obliged to respond to them if it supports the standard. If the verification times out, we know that preemption isn't active in our TX direction on the link. Having clarified the definition, this selftest exercises the manual (ethtool) configuration path of 2 link partners (with and without verification), and the LLDP code path, using the openlldp project. The test also verifies the TX activity of the MAC Merge layer by sending traffic through a traffic class configured as preemptible (using mqprio). There isn't a good way to make this really portable (user space cannot find out how many traffic classes there are for a device), but I chose num_tc 4 here, that should work reasonably well. I also know that some devices (stmmac) only permit TXQ0 to be preemptible, so this is why PREEMPTIBLE_PRIO was strategically chosen as 0. Even if other hardware is more configurable, this test should cover the baseline. This is not really a "forwarding" selftest, but I put it near the other "ethtool" selftests. $ ./ethtool_mm.sh eno0 swp0 TEST: Manual configuration with verification: eno0 to swp0 [ OK ] TEST: Manual configuration with verification: swp0 to eno0 [ OK ] TEST: Manual configuration without verification: eno0 to swp0 [ OK ] TEST: Manual configuration without verification: swp0 to eno0 [ OK ] TEST: Manual configuration with failed verification: eno0 to swp0 [ OK ] TEST: Manual configuration with failed verification: swp0 to eno0 [ OK ] TEST: LLDP [ OK ] Signed-off-by: Vladimir Oltean --- v1->v2: - bail_on_lldpad is generic - manual ethtool mm tests are bidirectional - new "failed verification" test - testing with traffic as well .../testing/selftests/net/forwarding/Makefile | 1 + .../selftests/net/forwarding/ethtool_mm.sh | 288 ++++++++++++++++++ tools/testing/selftests/net/forwarding/lib.sh | 18 ++ 3 files changed, 307 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/ethtool_mm.sh diff --git a/tools/testing/selftests/net/forwarding/Makefile b/tools/testing/selftests/net/forwarding/Makefile index 236f6b796a52..a474c60fe348 100644 --- a/tools/testing/selftests/net/forwarding/Makefile +++ b/tools/testing/selftests/net/forwarding/Makefile @@ -15,6 +15,7 @@ TEST_PROGS = bridge_igmp.sh \ custom_multipath_hash.sh \ dual_vxlan_bridge.sh \ ethtool_extended_state.sh \ + ethtool_mm.sh \ ethtool.sh \ gre_custom_multipath_hash.sh \ gre_inner_v4_multipath.sh \ diff --git a/tools/testing/selftests/net/forwarding/ethtool_mm.sh b/tools/testing/selftests/net/forwarding/ethtool_mm.sh new file mode 100755 index 000000000000..c580ad623848 --- /dev/null +++ b/tools/testing/selftests/net/forwarding/ethtool_mm.sh @@ -0,0 +1,288 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +ALL_TESTS=" + manual_with_verification_h1_to_h2 + manual_with_verification_h2_to_h1 + manual_without_verification_h1_to_h2 + manual_without_verification_h2_to_h1 + manual_failed_verification_h1_to_h2 + manual_failed_verification_h2_to_h1 + lldp +" + +NUM_NETIFS=2 +REQUIRE_MZ=no +PREEMPTIBLE_PRIO=0 +source lib.sh + +traffic_test() +{ + local if=$1; shift + local src=$1; shift + local num_pkts=10000 + local before= + local after= + local delta= + + before=$(ethtool_std_stats_get $if "eth-mac" "FramesTransmittedOK" $src) + + $MZ $if -q -c $num_pkts -p 64 -b bcast -t ip -R $PREEMPTIBLE_PRIO + + after=$(ethtool_std_stats_get $if "eth-mac" "FramesTransmittedOK" $src) + + delta=$((after - before)) + + # Allow an extra 1% tolerance for random packets sent by the stack + [ $delta -ge $num_pkts ] && [ $delta -le $((num_pkts + 100)) ] +} + +manual_with_verification() +{ + local tx=$1; shift + local rx=$1; shift + + RET=0 + + # It isn't completely clear from IEEE 802.3-2018 Figure 99-5: Transmit + # Processing state diagram whether the "send_r" variable (send response + # to verification frame) should be taken into consideration while the + # MAC Merge TX direction is disabled. That being said, at least the + # NXP ENETC does not, and requires tx-enabled on in order to respond to + # the link partner's verification frames. + ethtool --set-mm $rx tx-enabled on + ethtool --set-mm $tx verify-enabled on tx-enabled on + + # Wait for verification to finish + sleep 1 + + ethtool --json --show-mm $tx | jq -r '.[]."verify-status"' | \ + grep -q 'SUCCEEDED' + check_err "$?" "Verification did not succeed" + + ethtool --json --show-mm $tx | jq -r '.[]."tx-active"' | grep -q 'true' + check_err "$?" "pMAC TX is not active" + + traffic_test $tx "pmac" + check_err "$?" "Traffic did not get sent through $tx's pMAC" + + ethtool --set-mm $tx verify-enabled off tx-enabled off + ethtool --set-mm $rx tx-enabled off + + log_test "Manual configuration with verification: $tx to $rx" +} + +manual_with_verification_h1_to_h2() +{ + manual_with_verification $h1 $h2 +} + +manual_with_verification_h2_to_h1() +{ + manual_with_verification $h2 $h1 +} + +manual_without_verification() +{ + local tx=$1; shift + local rx=$1; shift + + RET=0 + + ethtool --set-mm $tx verify-enabled off tx-enabled on + + ethtool --json --show-mm $tx | jq -r '.[]."verify-status"' | \ + grep -q 'DISABLED' + check_err "$?" "Verification is not disabled" + + ethtool --json --show-mm $tx | jq -r '.[]."tx-active"' | grep -q 'true' + check_err "$?" "pMAC TX is not active" + + traffic_test $tx "pmac" + check_err "$?" "Traffic did not get sent through $tx's pMAC" + + ethtool --set-mm $tx verify-enabled off tx-enabled off + + log_test "Manual configuration without verification: $tx to $rx" +} + +manual_without_verification_h1_to_h2() +{ + manual_without_verification $h1 $h2 +} + +manual_without_verification_h2_to_h1() +{ + manual_without_verification $h2 $h1 +} + +manual_failed_verification() +{ + local tx=$1; shift + local rx=$1; shift + + RET=0 + + ethtool --set-mm $rx pmac-enabled off + ethtool --set-mm $tx verify-enabled on tx-enabled on + + # Wait for verification to time out + sleep 1 + + ethtool --json --show-mm $tx | jq -r '.[]."verify-status"' | \ + grep -q 'SUCCEEDED' + check_fail "$?" "Verification succeeded when it shouldn't have" + + ethtool --json --show-mm $tx | jq -r '.[]."tx-active"' | grep -q 'true' + check_fail "$?" "pMAC TX is active when it shouldn't have" + + traffic_test $tx "emac" + check_err "$?" "Traffic did not get sent through $tx's eMAC" + + ethtool --set-mm $tx verify-enabled off tx-enabled off + ethtool --set-mm $rx pmac-enabled on + + log_test "Manual configuration with failed verification: $tx to $rx" +} + +manual_failed_verification_h1_to_h2() +{ + manual_failed_verification $h1 $h2 +} + +manual_failed_verification_h2_to_h1() +{ + manual_failed_verification $h2 $h1 +} + +lldp_change_add_frag_size() +{ + local add_frag_size=$1 + + lldptool -T -i $h1 -V addEthCaps addFragSize=$add_frag_size >/dev/null + # Wait for TLVs to be received + sleep 2 + lldptool -i $h2 -t -n -V addEthCaps | \ + grep -q "Additional fragment size: $add_frag_size" +} + +lldp() +{ + RET=0 + + systemctl start lldpad + + # Configure the interfaces to receive and transmit LLDPDUs + lldptool -L -i $h1 adminStatus=rxtx >/dev/null + lldptool -L -i $h2 adminStatus=rxtx >/dev/null + + # Enable the transmission of Additional Ethernet Capabilities TLV + lldptool -T -i $h1 -V addEthCaps enableTx=yes >/dev/null + lldptool -T -i $h2 -V addEthCaps enableTx=yes >/dev/null + + # Wait for TLVs to be received + sleep 2 + + lldptool -i $h1 -t -n -V addEthCaps | \ + grep -q "Preemption capability active" + check_err "$?" "$h1 pMAC TX is not active" + + lldptool -i $h2 -t -n -V addEthCaps | \ + grep -q "Preemption capability active" + check_err "$?" "$h2 pMAC TX is not active" + + lldp_change_add_frag_size 3 + check_err "$?" "addFragSize 3" + + lldp_change_add_frag_size 2 + check_err "$?" "addFragSize 2" + + lldp_change_add_frag_size 1 + check_err "$?" "addFragSize 1" + + lldp_change_add_frag_size 0 + check_err "$?" "addFragSize 0" + + traffic_test $h1 "pmac" + check_err "$?" "Traffic did not get sent through $h1's pMAC" + + traffic_test $h2 "pmac" + check_err "$?" "Traffic did not get sent through $h2's pMAC" + + systemctl stop lldpad + + log_test "LLDP" +} + +h1_create() +{ + ip link set dev $h1 up + + tc qdisc add dev $h1 root mqprio num_tc 4 map 0 1 2 3 \ + queues 1@0 1@1 1@2 1@3 \ + fp P E E E \ + hw 1 + + ethtool --set-mm $h1 pmac-enabled on tx-enabled off verify-enabled off +} + +h2_create() +{ + ip link set dev $h2 up + + ethtool --set-mm $h2 pmac-enabled on tx-enabled off verify-enabled off + + tc qdisc add dev $h2 root mqprio num_tc 4 map 0 1 2 3 \ + queues 1@0 1@1 1@2 1@3 \ + fp P E E E \ + hw 1 +} + +h1_destroy() +{ + ethtool --set-mm $h1 pmac-enabled off tx-enabled off verify-enabled off + + tc qdisc del dev $h1 root + + ip link set dev $h1 down +} + +h2_destroy() +{ + tc qdisc del dev $h2 root + + ethtool --set-mm $h2 pmac-enabled off tx-enabled off verify-enabled off + + ip link set dev $h2 down +} + +setup_prepare() +{ + check_ethtool_mm_support + check_tc_fp_support + require_command lldptool + bail_on_lldpad "autoconfigure the MAC Merge layer" "configure it manually" + + h1=${NETIFS[p1]} + h2=${NETIFS[p2]} + + h1_create + h2_create +} + +cleanup() +{ + pre_cleanup + + h2_destroy + h1_destroy +} + +trap cleanup EXIT + +setup_prepare +setup_wait + +tests_run + +exit $EXIT_STATUS diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 36e47c9d7cca..057c3d0ad620 100755 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -120,6 +120,15 @@ check_tc_action_hw_stats_support() fi } +check_tc_fp_support() +{ + tc qdisc add dev lo mqprio help 2>&1 | grep -q "fp " + if [[ $? -ne 0 ]]; then + echo "SKIP: iproute2 too old; tc is missing frame preemption support" + exit $ksft_skip + fi +} + check_ethtool_lanes_support() { ethtool --help 2>&1| grep lanes &> /dev/null @@ -129,6 +138,15 @@ check_ethtool_lanes_support() fi } +check_ethtool_mm_support() +{ + ethtool --help 2>&1| grep -- '--show-mm' &> /dev/null + if [[ $? -ne 0 ]]; then + echo "SKIP: ethtool too old; it is missing MAC Merge layer support" + exit $ksft_skip + fi +} + check_locked_port_support() { if ! bridge -d link show | grep -q " locked"; then