Message ID | 20230210221243.228932-1-vladimir.oltean@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1204529wrn; Fri, 10 Feb 2023 14:19:21 -0800 (PST) X-Google-Smtp-Source: AK7set8z+378w2A0AxnkDAJVgbj4JeJC7/fAl5mpq2F0Z9gm61vzm8jxUlKGBSWVHOyaGG/De1ti X-Received: by 2002:a05:6a20:1207:b0:bf:a6c7:39a0 with SMTP id v7-20020a056a20120700b000bfa6c739a0mr14741781pzf.57.1676067561559; Fri, 10 Feb 2023 14:19:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676067561; cv=pass; d=google.com; s=arc-20160816; b=hh+Jg9sPJIMhTg5+6raUMmZyTBjC6oeX6xw0rA9RLZSwF3BSmpDZUU2UEc0v0czxsa jkZkxkE8nQSJB+7fy2oLhUj7ZJcakeqF2N+VDbSV5GSIljsVEADt94mIJOPePyLxY4uM FV3Zihlpi0mXdtIhhQc25fs8XrTrCMhTclxD+VVLG2NR2mPpf0oKhjjbZ/+ZQb2txREj YCmg97OJDgqPi7Xev8XE7AVAMQVZoTVpNWp7TkmXnl3H7Ax4ys5/8UNB07dOp8C+Qjca OqrBj1Y+OoVmEa/9bYA3n2qQeCs1GnRrugg32tDonsvkNC8HvHkqA1enukJKoSoeONi9 Y+HQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=ZGRNLlTrE8tntyz+9V72q3u/cX6EgpJhRGLlnbnMObg=; b=Fzm416KnJLfrZGvb11iPYtmHfCdTyRiiCSjlsnN/FMB3WHA0XZFA+GyCff/s0d3rpX GXnfCLJ7TBH4zLOoUza+bEZ7lsrZIi0q06jVlEIpHS8j0HXP199ZXbcDEIWvCoXdTl8w lC8mJ9kxa2fa10vKMd7ZkHKvAUy90+ShMD6VEerVSPFCz7JNTV16o6ynKhs4/paH3HKW aBv3AwHwVceAuzXEIwiF5U7pNbEMKVs8UVkpJdzGd9IoOhewM1jZTOc8MN39fnCUIP2f RoUYJgzPgeuGRp1OGd+Qy8YB13Yf0gYMiAY6OmNpOz5KIOsqy7MC6NNBAYBXW5gygCe6 qPtA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=PKLDmfbd; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p13-20020a63fe0d000000b004d3d12d6654si288769pgh.138.2023.02.10.14.19.08; Fri, 10 Feb 2023 14:19:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=PKLDmfbd; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233625AbjBJWNG (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Fri, 10 Feb 2023 17:13:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbjBJWNE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 10 Feb 2023 17:13:04 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2079.outbound.protection.outlook.com [40.107.20.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B41EC68AD7; Fri, 10 Feb 2023 14:13:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LtlOG+dnxYZxoxxS3I88bywJn0wP5CfqAtFBJNhjm7Akf5eyX0oHXlOzs2tLtfGcWuuwF0e/D968T7c4VElr1MMT4B1wTVsk3F2vDvA016/Br8xPQrCEtL3tdCy4c6DG4i9lHAoHpQv5yEeUCQiVCs9s2bftFi3A0zCayXS5VqAPcOAtcGQ7PqNywyIQM5XA22+UJ0KilJVxbd29LY/Hx2CsNDhZIsbrO6BYBBiFJFCGHbOm2gTy9RHWE4lLDBxvOIc33tl4NIPpT9DkK7EcHg0tzEwinafcKSPhHwVWBnOtUOCe6xI9ikw+hxB4U+AwGSlhvZbehqxIQ7Ry1Dcieg== 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=ZGRNLlTrE8tntyz+9V72q3u/cX6EgpJhRGLlnbnMObg=; b=HEhXwzTbqrfB7U/W5wisRTCZJUYIGbJNhyN7QB7LeQPcpPJ8ANCvk4/uzaTDnoeWY2xL9Au+VrSUNKgalE5+POY44SIPTnAqQPj9e6nS7W9vhJoA3PuPMl5PBJQO2ryruu05vn6iIvmiiZ0pE1hbKPawPWrVfL2tua9gMj1WjUldCZQgl3wAR7UDo2PiD79ldgCXzXV3Rrv+zHkc1epVFecPpC5kdNmH5dDcXpfabSQmW4x8azYQgMqjw7OEQNhVIaSP2VqsE7cdy8bohzKo/6cQUYxCi4nXJyeOxCuzBhjk+3iePpNKZWqVSn2+ItoN9tyw4sS6cmKCdADBm4Fp5w== 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=ZGRNLlTrE8tntyz+9V72q3u/cX6EgpJhRGLlnbnMObg=; b=PKLDmfbdOHskYhLisNtK08RcYQ0QVOXkf+tmWWYODWha4FWnIO8sP3eYkp56pdmo74/9TaMogRj5B0WODaL+O2mDbRcyE8ijoakArWwdAKvAQff2UhT9h50D1g4wdKRtg00RNOaFTBWP4BCcPx6tYKZDHPXjixbMCpfvHYVPDs0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DU2PR04MB8840.eurprd04.prod.outlook.com (2603:10a6:10:2e3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Fri, 10 Feb 2023 22:12:58 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.019; Fri, 10 Feb 2023 22:12:58 +0000 From: Vladimir Oltean <vladimir.oltean@nxp.com> To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Kubecek <mkubecek@suse.cz>, Vinicius Costa Gomes <vinicius.gomes@intel.com>, Xiaoliang Yang <xiaoliang.yang_1@nxp.com>, Kurt Kanzenbach <kurt@linutronix.de>, Rui Sousa <rui.sousa@nxp.com>, Ferenc Fejes <ferenc.fejes@ericsson.com>, Pranavi Somisetty <pranavi.somisetty@amd.com>, Harini Katakam <harini.katakam@amd.com>, UNGLinuxDriver@microchip.com, Petr Machata <petrm@nvidia.com>, Ido Schimmel <idosch@nvidia.com>, Aaron Conole <aconole@redhat.com> Subject: [RFC PATCH net-next] selftests: forwarding: add a test for MAC Merge layer Date: Sat, 11 Feb 2023 00:12:43 +0200 Message-Id: <20230210221243.228932-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM8P190CA0015.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:219::20) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|DU2PR04MB8840:EE_ X-MS-Office365-Filtering-Correlation-Id: 12991387-62ca-4130-34db-08db0bb3f75f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ci2WCMsAYoIf1e6bALEvd5sEThUPzrNfBH9MVnLCqakJijq+8TdBPLXKhbDoscVZN4+PpZQWAtskJ4VV8e3ls8MDpJoYgFmacCba8d4/Pq9USfxuu3dnn/7v3b/71Fsj8BGv53iB+l9QM/BtIC7b0R/u5ubDRKe9J+nKj0+cTJgcnON9fFbtSv+HubootzUkvdZ6A2+7UyYTAg1tThkLPUTpwtoesyhiWfP5njeBL2cXl/8k/pOHl4XRNccK2MYQ9Mi+/tDF5YSZFHJMjnd7/FspWPrEFhaZQOWuhlOxay9wDe+XbhEtwhycervuuD4iViTAc5KMSdlAhEnnEM3VAiA/IryBp8uu89W1+Lwdv55pKfzfWIL+wwG74jaGV67DqcGmS9F3YNdUGDOV3HLmXR7JIY1RUs1tc++KuqSvCTfRnxnl8+hpTuXQE0sIt5n9ir+44R2sXOQBT5Ny7uYNSJYzxDCmnqCa9OlKcJ3fdrzP63HtknmA2K5aqyeMZW0G6ZhvY8GX7RkAw948T1NanKm/hP5+hAu5df4TIocR6n6uzw4z9SaQLCESLcRdo+2Lk2lx5Otrjcs4WZkavB0trnFGaTD/jFvlHGivnQMuC0IfXwXIFWPV036qEzUO7L6fqhMX19qX1yRBU51ECycD+jKMgH+gWV8xQuvA8Dp6ur+MCuNzddlFCqVlcC0K0u+3BFwz0gQWQMfT9AryfWhT7w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(366004)(39860400002)(376002)(136003)(396003)(346002)(451199018)(5660300002)(66556008)(66946007)(7416002)(316002)(8936002)(6916009)(8676002)(41300700001)(86362001)(38350700002)(38100700002)(36756003)(54906003)(6506007)(186003)(66476007)(52116002)(6666004)(6512007)(26005)(1076003)(44832011)(4326008)(2906002)(2616005)(6486002)(83380400001)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sjBI7erZ17vDCEIOSXD0PIEkSVtMqi3wGNM+ZS0/C6RFQ5WURq+IOTVLHFWSoAc26SskjUkXc2XoCfheYxlW7s3Psg9shUY+Zvd9Wa5WRTyQquwOwRsBZ1mkxebe6bhoBSCjFdCzvhCEF3gdJ3HNup0cDFPDr4v4+t2pgFprGl+UDzee9qCALZH7wnnoISIOfE+31rQZ8UOU5iWmsk7w0UJr9OAvzTbRGY12aeLooahNm0oV/29PcEJQbPYmsYaLK3UNVo11cr9oCEfS1PBo54vm/FdYmVDvl0qkArUIhr0CFwP3M7wAP2C8v0VXLfacnWIaLAY0BTBFfKLN8poy5y+XcUbTXjBdcOr0lxsjIR/OvCuvF49FO8zif7ba+8u6BPhQ4DrH8aiywlnlfkAPvxNsMtPkN9Xk0pGOFCtCzNcSW+Zg64BWkjytIaUqkGPugEJ99imyJA7MxxtPR820SlLqssd/YXZGimZ7JFpDoeQjkbGGAFjJFdAg86U7ELZ5rgcLE+Gv3gfSaqSZ+16DAuayCLTF4lPbbrpS4gj2H/q+mgQrwau3EfwDLG+J0Oa/ooF+DWLa3nXdbwNjNICMLlsi2g4AGQYFyYqMKptwPlfHDWKGvsTD7qwGnYE6Vy1aspmmUURSdaSGfSjNN5SWdQM5yc6RKjNpVcobjb6FukNH2X4xLnRcpz0hlXt2sFwB2HSBwad9bCBsjUx6WVOVKWqvA1Vp7jIrXBG4JrdYC+wWKb72FJiGMnUCBDsxbnIgHm1/k0iQTfCWCzwpfVIfEciyVaZw4LC7IdGSmIbJp4ndEFaRrJlEcePZnKImJjcEfdm6cF6P5i/X4rwOKE3Mti7RPETQ9gl9SMzivMDwDSg/4uWsB+cdi2s9fYBX3MK84gKrg0B4AY0XbN1eUO8thOvHSEFDRQZbn49ifgGNSflajAdKOA0hQzG/ucW2zk2Sn7YvVjydBtZuxQnNGyjnlQJQf/TQ0IsQYCKYRdkwm4gCT2Hq36N2XvojQ1CY3iWeryNiUv65paBcp28gU/hjxDhHCme1cBQW13dfs/Ob9wNcF0bxA3r03nr5EkYpwKX2b9T72XP7vsYjeOAEuoJv1cWKQbu9ZXfofiz29NZU4Uaa3nCup0MZreEFfCLttmZnT36mCCU7hfIaissOlcifZId3s3HHdAhhGrFHTYdamzy39N3a27louHhb2snAj+IFKzj/DBlYDiSUDxkIH/NJ1UzFIv9gS3uGL/KZepC5GbXmpZl0dYa1WANXIInNhBsD4dl9tKtTduZgjjRKU+xxdADYKoeVXtr7SjrXcNrFoOtFEVx12Zvzm0koq56TPU3EbGKzt9rudVvBmIFh+gvUiFCY2C5X2xECgIB3cbY76fRKrk5ITGdjvSFBvkOj6c8IXKTLIwbBkIPTYQa6RqV9Fr+5NcXipq4m15qfKqXGxUFChFsBsBlIqIjTPMaP7MErM5pc3TsmH8Z0J6i5VswoGkAucqYKhKV1p9F4gRx4moJ2qxAr0ZOYzM0Cic62cyLbKNP/1EOfArTZGItzld2jeUXLQWMjDmUQxQshtha+H2TrZQEpItpjvkze+Lbdi/jd8Jlff7WRJiG28NVQVk2/bg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12991387-62ca-4130-34db-08db0bb3f75f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2023 22:12:58.2351 (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: qKX2ofNTTj3wK+9USrO5VtqJ3XqWYu3gwQ1DZytuArHklybmHKKTITA8YsgcX3Az2+vilDXltynjDG1UPQuk9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8840 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757484219794131222?= X-GMAIL-MSGID: =?utf-8?q?1757484219794131222?= |
Series |
[RFC,net-next] selftests: forwarding: add a test for MAC Merge layer
|
|
Commit Message
Vladimir Oltean
Feb. 10, 2023, 10:12 p.m. UTC
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.
This is not really a "forwarding" selftest, but I put it near the other
"ethtool" selftests.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
This is more for the sake of the discussion, because neither the ethtool
nor the openlldp changes for MM were accepted yet.
Not sure if this is the best way to integrate lldpad into a kselftest,
given the fact that systemd starts it with a persistent configuration
file.
.../testing/selftests/net/forwarding/Makefile | 1 +
.../selftests/net/forwarding/ethtool_mm.sh | 174 ++++++++++++++++++
tools/testing/selftests/net/forwarding/lib.sh | 9 +
3 files changed, 184 insertions(+)
create mode 100755 tools/testing/selftests/net/forwarding/ethtool_mm.sh
Comments
Vladimir Oltean <vladimir.oltean@nxp.com> writes: > +# Borrowed from mlxsw/qos_lib.sh, message adapted. > +bail_on_lldpad() > +{ > + if systemctl is-active --quiet lldpad; then > + cat >/dev/stderr <<-EOF > + WARNING: lldpad is running > + > + lldpad will likely autoconfigure the MAC Merge layer, > + while this test will configure it manually. One of them > + is arbitrarily going to overwrite the other. That will > + cause spurious failures (or, unlikely, passes) of this > + test. > + EOF > + exit 1 > + fi > +} This would be good to have unified. Can you make the function reusable, with a generic or parametrized message? I should be able to carve a bit of time later to move it to lib.sh, migrate the mlxsw selftests, and drop the qos_lib.sh copy.
Hi Petr, On Mon, Feb 13, 2023 at 11:51:37AM +0100, Petr Machata wrote: > Vladimir Oltean <vladimir.oltean@nxp.com> writes: > > > +# Borrowed from mlxsw/qos_lib.sh, message adapted. > > +bail_on_lldpad() > > +{ > > + if systemctl is-active --quiet lldpad; then > > + cat >/dev/stderr <<-EOF > > + WARNING: lldpad is running > > + > > + lldpad will likely autoconfigure the MAC Merge layer, > > + while this test will configure it manually. One of them > > + is arbitrarily going to overwrite the other. That will > > + cause spurious failures (or, unlikely, passes) of this > > + test. > > + EOF > > + exit 1 > > + fi > > +} > > This would be good to have unified. Can you make the function reusable, > with a generic or parametrized message? I should be able to carve a bit > of time later to move it to lib.sh, migrate the mlxsw selftests, and > drop the qos_lib.sh copy. Maybe like this? diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_headroom.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_headroom.sh index 3569ff45f7d5..258b4c994bc3 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/qos_headroom.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_headroom.sh @@ -371,7 +371,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..2676fca18e06 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh @@ -393,7 +393,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..99495f5fa63d 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_ets.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_ets.sh @@ -78,5 +78,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_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 c6ce0b448bf3..bf57400e14ee 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,7 @@ # SPDX-License-Identifier: GPL-2.0 source qos_lib.sh -bail_on_lldpad +bail_on_lldpad "configure DCB" "configure Qdiscs" 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..b95e95e3b041 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,7 @@ # SPDX-License-Identifier: GPL-2.0 source qos_lib.sh -bail_on_lldpad +bail_on_lldpad "configure DCB" "configure Qdiscs" 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..c495cb8d38f7 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,7 @@ # SPDX-License-Identifier: GPL-2.0 source qos_lib.sh -bail_on_lldpad +bail_on_lldpad "configure DCB" "configure Qdiscs" lib_dir=$(dirname $0)/../../../net/forwarding TCFLAGS=skip_sw diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 30311214f39f..ab1c2f839167 100755 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -1896,3 +1896,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 +}
On Sat Feb 11 2023, Vladimir Oltean wrote: > 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. > > This is not really a "forwarding" selftest, but I put it near the other > "ethtool" selftests. > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> > --- Looks good to me. Is there any way to test this? I see mm support implemented for enetc and Felix. However, I only have access to Intel i225 NIC(s) which support frame preemption. Thanks, Kurt
On Mon, Feb 13, 2023 at 12:42:04PM +0100, Kurt Kanzenbach wrote: > Looks good to me. Is there any way to test this? Only with driver level support implemented. > I see mm support implemented for enetc and Felix. Yes, those would be the Ethernet interfaces on the NXP LS1028A SoC. That is all hardware I have access to. > However, I only have access to Intel i225 NIC(s) which support frame > preemption. I suppose this patch set would need to be rebased to the current net-next and adapted to the merged version of the ethtool API: https://patchwork.kernel.org/project/netdevbpf/cover/20220520011538.1098888-1-vinicius.gomes@intel.com/
Vladimir Oltean <vladimir.oltean@nxp.com> writes: > Hi Petr, > > On Mon, Feb 13, 2023 at 11:51:37AM +0100, Petr Machata wrote: >> Vladimir Oltean <vladimir.oltean@nxp.com> writes: >> >> > +# Borrowed from mlxsw/qos_lib.sh, message adapted. >> > +bail_on_lldpad() >> > +{ >> > + if systemctl is-active --quiet lldpad; then >> > + cat >/dev/stderr <<-EOF >> > + WARNING: lldpad is running >> > + >> > + lldpad will likely autoconfigure the MAC Merge layer, >> > + while this test will configure it manually. One of them >> > + is arbitrarily going to overwrite the other. That will >> > + cause spurious failures (or, unlikely, passes) of this >> > + test. >> > + EOF >> > + exit 1 >> > + fi >> > +} >> >> This would be good to have unified. Can you make the function reusable, >> with a generic or parametrized message? I should be able to carve a bit >> of time later to move it to lib.sh, migrate the mlxsw selftests, and >> drop the qos_lib.sh copy. > > Maybe like this? Yes, for most of them, but the issue is that... > 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..bf57400e14ee 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,7 @@ > # SPDX-License-Identifier: GPL-2.0 > > source qos_lib.sh > -bail_on_lldpad > +bail_on_lldpad "configure DCB" "configure Qdiscs" ... lib.sh isn't sourced at this point yet. `source $lib_dir/sch_tbf_ets.sh' brings that in later in the file, so the bail would need to be below that. But if it is, it won't run until after the test, which is useless. Maybe all it takes is to replace that `source qos_lib.sh' with `NUM_NETIFS=0 source $lib_dir/lib.sh', as we do in in_ns(), but I'll need to check. That's why I proposed to do it myself, some of it is fiddly and having a switch handy is going to be... um, handy.
Hi Petr, On Tue, Feb 14, 2023 at 12:53:06PM +0100, Petr Machata wrote: > > Vladimir Oltean <vladimir.oltean@nxp.com> writes: > > > Hi Petr, > > > > On Mon, Feb 13, 2023 at 11:51:37AM +0100, Petr Machata wrote: > >> Vladimir Oltean <vladimir.oltean@nxp.com> writes: > >> > >> > +# Borrowed from mlxsw/qos_lib.sh, message adapted. > >> > +bail_on_lldpad() > >> > +{ > >> > + if systemctl is-active --quiet lldpad; then > >> > + cat >/dev/stderr <<-EOF > >> > + WARNING: lldpad is running > >> > + > >> > + lldpad will likely autoconfigure the MAC Merge layer, > >> > + while this test will configure it manually. One of them > >> > + is arbitrarily going to overwrite the other. That will > >> > + cause spurious failures (or, unlikely, passes) of this > >> > + test. > >> > + EOF > >> > + exit 1 > >> > + fi > >> > +} > >> > >> This would be good to have unified. Can you make the function reusable, > >> with a generic or parametrized message? I should be able to carve a bit > >> of time later to move it to lib.sh, migrate the mlxsw selftests, and > >> drop the qos_lib.sh copy. > > > > Maybe like this? > > Yes, for most of them, but the issue is that... > > > 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..bf57400e14ee 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,7 @@ > > # SPDX-License-Identifier: GPL-2.0 > > > > source qos_lib.sh > > -bail_on_lldpad > > +bail_on_lldpad "configure DCB" "configure Qdiscs" > > ... lib.sh isn't sourced at this point yet. `source > $lib_dir/sch_tbf_ets.sh' brings that in later in the file, so the bail > would need to be below that. But if it is, it won't run until after the > test, which is useless. > > Maybe all it takes is to replace that `source qos_lib.sh' with > `NUM_NETIFS=0 source $lib_dir/lib.sh', as we do in in_ns(), but I'll > need to check. > > That's why I proposed to do it myself, some of it is fiddly and having a > switch handy is going to be... um, handy. Are you planning to take a look and see whether the callers of bail_on_lldpad() can also source $lib_dir/lib.sh? Should I resend a blind change here?
Petr Machata <petrm@nvidia.com> writes: > Vladimir Oltean <vladimir.oltean@nxp.com> writes: > >> Hi Petr, >> >> On Mon, Feb 13, 2023 at 11:51:37AM +0100, Petr Machata wrote: >>> Vladimir Oltean <vladimir.oltean@nxp.com> writes: >>> >>> > +# Borrowed from mlxsw/qos_lib.sh, message adapted. >>> > +bail_on_lldpad() >>> > +{ >>> > + if systemctl is-active --quiet lldpad; then >>> > + cat >/dev/stderr <<-EOF >>> > + WARNING: lldpad is running >>> > + >>> > + lldpad will likely autoconfigure the MAC Merge layer, >>> > + while this test will configure it manually. One of them >>> > + is arbitrarily going to overwrite the other. That will >>> > + cause spurious failures (or, unlikely, passes) of this >>> > + test. >>> > + EOF >>> > + exit 1 >>> > + fi >>> > +} >>> >>> This would be good to have unified. Can you make the function reusable, >>> with a generic or parametrized message? I should be able to carve a bit >>> of time later to move it to lib.sh, migrate the mlxsw selftests, and >>> drop the qos_lib.sh copy. >> >> Maybe like this? > > Yes, for most of them, but the issue is that... > >> 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..bf57400e14ee 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,7 @@ >> # SPDX-License-Identifier: GPL-2.0 >> >> source qos_lib.sh >> -bail_on_lldpad >> +bail_on_lldpad "configure DCB" "configure Qdiscs" > > ... lib.sh isn't sourced at this point yet. `source > $lib_dir/sch_tbf_ets.sh' brings that in later in the file, so the bail > would need to be below that. But if it is, it won't run until after the > test, which is useless. > > Maybe all it takes is to replace that `source qos_lib.sh' with > `NUM_NETIFS=0 source $lib_dir/lib.sh', as we do in in_ns(), but I'll > need to check. > > That's why I proposed to do it myself, some of it is fiddly and having a > switch handy is going to be... um, handy. Sorry, this completely slipped my ming. I'm looking into it.
Petr Machata <petrm@nvidia.com> writes: > Petr Machata <petrm@nvidia.com> writes: > >> Vladimir Oltean <vladimir.oltean@nxp.com> writes: >> >>> 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..bf57400e14ee 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,7 @@ >>> # SPDX-License-Identifier: GPL-2.0 >>> >>> source qos_lib.sh >>> -bail_on_lldpad >>> +bail_on_lldpad "configure DCB" "configure Qdiscs" >> >> ... lib.sh isn't sourced at this point yet. `source >> $lib_dir/sch_tbf_ets.sh' brings that in later in the file, so the bail >> would need to be below that. But if it is, it won't run until after the >> test, which is useless. I added a shim as shown below. Comments welcome. Your patch then needs a bit of adaptation, plus I've dropped all the now-useless imports of qos_lib.sh. I'll pass this through our regression, and if nothing explodes, I'll point you at a branch tomorrow, and you can make the two patches a part of your larger patchset? Subject: [PATCH net-next mlxsw] selftests: forwarding: sch_tbs_*: Add a pre-run hook 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 <petrm@nvidia.com> --- 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
diff --git a/tools/testing/selftests/net/forwarding/Makefile b/tools/testing/selftests/net/forwarding/Makefile index 91201ab3c4fc..7d95990e18ce 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..b66db9419a27 --- /dev/null +++ b/tools/testing/selftests/net/forwarding/ethtool_mm.sh @@ -0,0 +1,174 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +ALL_TESTS=" + manual_with_verification + manual_without_verification + lldp +" + +NUM_NETIFS=2 +REQUIRE_MZ=no +source lib.sh + +# Borrowed from mlxsw/qos_lib.sh, message adapted. +bail_on_lldpad() +{ + if systemctl is-active --quiet lldpad; then + cat >/dev/stderr <<-EOF + WARNING: lldpad is running + + lldpad will likely autoconfigure the MAC Merge layer, + while this test will configure it manually. One of them + is arbitrarily going to overwrite the other. That will + cause spurious failures (or, unlikely, passes) of this + test. + EOF + exit 1 + fi +} + +manual_with_verification() +{ + check_ethtool_mm_support + bail_on_lldpad + + ethtool --set-mm $h1 verify-enabled on tx-enabled on + + # Wait for verification to finish + sleep 1 + + ethtool --json --show-mm $h1 | jq -r '.[]."verify-status"' | \ + grep -q 'SUCCEEDED' + check_err "$?" "Verification did not succeed" + + ethtool --json --show-mm $h1 | jq -r '.[]."tx-active"' | grep -q 'true' + check_err "$?" "pMAC TX is not active" + + log_test "Manual configuration with verification" +} + +manual_without_verification() +{ + check_ethtool_mm_support + bail_on_lldpad + + ethtool --set-mm $h2 verify-enabled off tx-enabled on + + ethtool --json --show-mm $h2 | jq -r '.[]."verify-status"' | \ + grep -q 'DISABLED' + check_err "$?" "Verification is not disabled" + + ethtool --json --show-mm $h2 | jq -r '.[]."tx-active"' | grep -q 'true' + check_err "$?" "pMAC TX is not active" + + log_test "Manual configuration without verification" +} + +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 1 + lldptool -i $h2 -t -n -V addEthCaps | \ + grep -q "Additional fragment size: $add_frag_size" +} + +lldp() +{ + require_command lldptool + bail_on_lldpad + + 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 1 + + 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 0 + check_err "$?" "addFragSize 0" + + lldp_change_add_frag_size 1 + check_err "$?" "addFragSize 1" + + lldp_change_add_frag_size 2 + check_err "$?" "addFragSize 2" + + lldp_change_add_frag_size 3 + check_err "$?" "addFragSize 3" + + systemctl stop lldpad + + log_test "LLDP" +} + +h1_create() +{ + ip link set dev $h1 up + + 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 +} + +h1_destroy() +{ + ethtool --set-mm $h1 pmac-enabled off tx-enabled off verify-enabled off + + ip link set dev $h1 down +} + +h2_destroy() +{ + ethtool --set-mm $h2 pmac-enabled off tx-enabled off verify-enabled off + + ip link set dev $h2 down +} + +setup_prepare() +{ + 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 d47499ba81c7..30311214f39f 100755 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -129,6 +129,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