Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5237790rdb; Wed, 13 Dec 2023 03:08:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVdZc77lA/G2eVbzxxGfnT5ZnEMsn9Bv38nhdrMEWV/kOQEjmtADAKKeguMpKi3EDyd03y X-Received: by 2002:a05:6830:14d4:b0:6d8:74e2:5d18 with SMTP id t20-20020a05683014d400b006d874e25d18mr8027988otq.65.1702465686247; Wed, 13 Dec 2023 03:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702465686; cv=none; d=google.com; s=arc-20160816; b=WxI/ZnfHVdbskqxS0BS2MaKCesyiLqd0oKaZ9GsTPDwqtkbRidpmmF6TxofghoFTuc rm/fTOARqZcrHZPUQhQBnkNPy+zLMYuZQe53B2rpttCf3xkW//wMeklS12S+VOf5CNp8 1sLygD7AjnzQAktPfI0nbEBTV2hihoMgQNF5bWL2Q4mzQQw0vkxs8GZNAN2Jemm+E7Bl eP/dznW3/NglHH/mUmO3jsVsBhR3zx4wCqI7Mx3yBccjfTUeb/e6TG5Rn6ORX3Lr/Eqw XdY26rEnSvJH9ailwdnC87UNonej9SdHq+IKr/rnkrGGzPPswrobxdmQA3yIBb4YXGVP U5MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WZ5pT3zkEJZNZsbpcdbaKx/ko5D/kF13zgr66b+QaYE=; fh=asmpGj2YxYe8/ji4bMUZUZytUYtbGpU9WbAkliy8rO0=; b=I7mACm1i7QuEF8VnGcE/OsBj8lhvZxiQhWqQw8oOrjJ29GBNVNEki/o7TX3w/d9Pa1 i9xHFeZWp26F08VXQVhlMjI5aW2HsAReNxTZ7s3Id67SmEsgTNAuNjCXcbV1xjZpRgkB bJelINOHTSAyYxA9vqLGui9fxnU1E4zWV0hsCHIle5ca++kRNJU9haemuHeJ03M0yW1q +8ztmo/wbJCTgHDDw3zON2QqNM53yqECQ/LxLOCjpdEKRBzc5rQEp0sbYUyoQN8kg81b lMymkuFV7aY7uE31qDkcHrZGi/2lbVeztSLA7bNe445dy18K0zb/Brgj1judfxKxlYaI BIww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EKMmdZRd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id by26-20020a056a02059a00b005c6832282f7si9747905pgb.304.2023.12.13.03.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:08:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EKMmdZRd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id ABD09804A4CD; Wed, 13 Dec 2023 03:08:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378569AbjLMLH2 (ORCPT + 99 others); Wed, 13 Dec 2023 06:07:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378268AbjLMLH0 (ORCPT ); Wed, 13 Dec 2023 06:07:26 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD9CE9C for ; Wed, 13 Dec 2023 03:07:32 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3995C433C9; Wed, 13 Dec 2023 11:07:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702465652; bh=luTbTqBQ8DMKuNwZi0BFIhQt17aA3AZ6dUCiYEFUG78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EKMmdZRd3tOoBhYEEqp92FsyKlLPp2ialvjcWZ4D7abe27zHUAKm1PWjk4Voyqinp fqmUMlv7iGnpnrBAgHGFKJnLGYckzF6RqIcytgkodeKQftoD/m3VDZZ/zP5BHOmFCw GrLHYd8ZIPN2DIjjvzmoYuK9oCqzjl+acfn1aOI4VRkVsyOtCqC+kwOdExoYe2PL5O /X3sWEXYI5g22Q1uufJt78WQqCLVRE6xHmLhzg9wXZfaoxbJtdlAEak7UFU+qqomul BeJ0R5o92C19Rjz0LU84SscEyTvcorQalr4+P48DxXga/N5grHRUWiU2psBkfxgnvX vmC49Xr6/jbyw== From: Roger Quadros To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, vladimir.oltean@nxp.com Cc: s-vadapalli@ti.com, r-gunasekaran@ti.com, vigneshr@ti.com, srk@ti.com, horms@kernel.org, p-varis@ti.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, rogerq@kernel.org Subject: [PATCH v8 net-next 01/11] selftests: forwarding: ethtool_mm: support devices with higher rx-min-frag-size Date: Wed, 13 Dec 2023 13:07:11 +0200 Message-Id: <20231213110721.69154-2-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231213110721.69154-1-rogerq@kernel.org> References: <20231213110721.69154-1-rogerq@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 13 Dec 2023 03:08:02 -0800 (PST) From: Vladimir Oltean Some devices have errata due to which they cannot report ETH_ZLEN (60) in the rx-min-frag-size. This was foreseen of course, and lldpad has logic that when we request it to advertise addFragSize 0, it will round it up to the lowest value that is _actually_ supported by the hardware. The problem is that the selftest expects lldpad to report back to us the same value as we requested. Make the selftest smarter by figuring out on its own what is a reasonable value to expect. Signed-off-by: Vladimir Oltean Tested-by: Roger Quadros Signed-off-by: Roger Quadros --- .../selftests/net/forwarding/ethtool_mm.sh | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) Changelog: v8: no change. Moved to the beginning of series. v7: initial commit diff --git a/tools/testing/selftests/net/forwarding/ethtool_mm.sh b/tools/testing/selftests/net/forwarding/ethtool_mm.sh index 39e736f30322..6212913f4ad1 100755 --- a/tools/testing/selftests/net/forwarding/ethtool_mm.sh +++ b/tools/testing/selftests/net/forwarding/ethtool_mm.sh @@ -155,15 +155,48 @@ manual_failed_verification_h2_to_h1() manual_failed_verification $h2 $h1 } +smallest_supported_add_frag_size() +{ + local iface=$1 + local rx_min_frag_size= + + rx_min_frag_size=$(ethtool --json --show-mm $iface | \ + jq '.[]."rx-min-frag-size"') + + if [ $rx_min_frag_size -le 60 ]; then + echo 0 + elif [ $rx_min_frag_size -le 124 ]; then + echo 1 + elif [ $rx_min_frag_size -le 188 ]; then + echo 2 + elif [ $rx_min_frag_size -le 252 ]; then + echo 3 + else + echo "$iface: RX min frag size $rx_min_frag_size cannot be advertised over LLDP" + exit 1 + fi +} + +expected_add_frag_size() +{ + local iface=$1 + local requested=$2 + local min=$(smallest_supported_add_frag_size $iface) + + [ $requested -le $min ] && echo $min || echo $requested +} + lldp_change_add_frag_size() { local add_frag_size=$1 + local pattern= 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" + pattern=$(printf "Additional fragment size: %d" \ + $(expected_add_frag_size $h1 $add_frag_size)) + lldptool -i $h2 -t -n -V addEthCaps | grep -q "$pattern" } lldp() -- 2.34.1