Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6667723rdb; Fri, 15 Dec 2023 05:21:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHixkZnG0dzM6NhrJjha0n7ECMRfDe8N/1At4Jw0r9E8bqyn6lSTIRGSHpR7H5En5eikIt7 X-Received: by 2002:a17:90b:3007:b0:28b:bad:163d with SMTP id hg7-20020a17090b300700b0028b0bad163dmr1256957pjb.92.1702646509938; Fri, 15 Dec 2023 05:21:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702646509; cv=none; d=google.com; s=arc-20160816; b=x0+arpTynxrOm4w89OxO/MYcRTReBUZYr12KofvDzYqtmbho4L5KoHYBUaw0zAqL8R vjJvVAIFXIu0Oz5zugSdEtlct7OPw90xhj4rgKTmexpWoGrNxn65iMYQlNYhVi0wz4Ps +J140yNw1cB184E+Y/mnQj8JW0FQzfFXWPBsdUfNXzpFdXZbkmFKwec7BHHmeWmnt9B6 bSWK+10wL5r2F8PmUyJaxOGH2kECp2cLztlOV8wk/iePQF0EWgdkliLmOkXHlOVvcS+X sbnrfvzWdSyYhYkkso+bK+nQtH013nAk5cRlUxt+WQWreCd9JWAiiQe0FLMi6Mpq75PS V5XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=FkSPvK8TVRzsigKT9w1bFGj+3ygNi+SMAbI1deaI4eA=; fh=atN1XXIEfyrYF91vXjukw10btm2OohYym78OPztZ9zU=; b=rWhnb1poEq5SpCehtxpDYTNLJ+bIFUSqLAbScVwgA1X/y/+aYFTulF8grHWNiHgska l4qPRvTCZU7Q5HUw8/8VVKESCmpyi6l41/JMnDefRQuFsnkIU+v9zzPQ0K2DLn4cHMEB xkSSb1lQ0tWLe0lHfgkSGnfToRUo3mMakqV2043e6CFXriQF6qf17wbo/0GAFiWKOINz 2IUFIMPjrjG1L99Nb/Lm2lSIcvmetCxH8JVFrKIhGysSEkA0AnyDxr5pRuqWJ2D39SGP bRtBm3WmPK/yqtCq1cPmK3URnnGK2WQ9CyVc4KDkA6oorNPFm0sqf2ZIoZbaTjAm9hYv P1VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eQDvHcYi; spf=pass (google.com: domain of linux-kernel+bounces-996-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-996-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s3-20020a17090a948300b0028ae97e2467si4343659pjo.31.2023.12.15.05.21.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 05:21:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-996-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eQDvHcYi; spf=pass (google.com: domain of linux-kernel+bounces-996-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-996-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 99F5E2815A6 for ; Fri, 15 Dec 2023 13:21:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B099B2DB91; Fri, 15 Dec 2023 13:21:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eQDvHcYi" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD3FF2E62B; Fri, 15 Dec 2023 13:21:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ADA4C433C8; Fri, 15 Dec 2023 13:20:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702646462; bh=glwQUbZej9xPHHx7W0zMnqG4yuuk1wNalrDhBBFRPnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eQDvHcYi3V4aMF5bwJg1UGxS4x4Iuk/FTTudklABc3whggNVpuqJv/dJcdaTMWL4q sq8XbDvi2/WBE93+M2cf8+0Y+uP2ZEx+rGrJRgzw4IBCzNBLshi8lBh+VaiEgmQ5QQ Zco/EIFABt5BpR8Fw8vJy+J+WMPsKV2i0Xap+W1bwyzS7PPEAczl2IEcrz6tXddaGR ICNlLs2yCE0ydZ08XrgsjEeiSU5dJrFL9lGQah7IFcPZTzsVSDpORc7f7ktDcn4DZq M4wVIZ1leHhZyf1/qzL9jkh153TB2/py4vVnlhfIT72Pz9r+TCDr4Yeeoi5N80QR6u Xow6QHrbYSXhQ== 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, linux-kselftest@vger.kernel.org, rogerq@kernel.org Subject: [PATCH net-next v9 02/10] selftests: forwarding: ethtool_mm: fall back to aggregate if device does not report pMAC stats Date: Fri, 15 Dec 2023 15:20:40 +0200 Message-Id: <20231215132048.43727-3-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231215132048.43727-1-rogerq@kernel.org> References: <20231215132048.43727-1-rogerq@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Vladimir Oltean Some devices do not support individual 'pmac' and 'emac' stats. For such devices, resort to 'aggregate' stats. Cc: Shuah Khan Signed-off-by: Vladimir Oltean Tested-by: Roger Quadros Signed-off-by: Roger Quadros --- tools/testing/selftests/net/forwarding/ethtool_mm.sh | 11 +++++++++++ tools/testing/selftests/net/forwarding/lib.sh | 9 +++++++++ 2 files changed, 20 insertions(+) Changelog: v9: no code change. Added Kselftest maintainer in Cc. v8: initial commit diff --git a/tools/testing/selftests/net/forwarding/ethtool_mm.sh b/tools/testing/selftests/net/forwarding/ethtool_mm.sh index 6212913f4ad1..50d5bfb17ef1 100755 --- a/tools/testing/selftests/net/forwarding/ethtool_mm.sh +++ b/tools/testing/selftests/net/forwarding/ethtool_mm.sh @@ -25,6 +25,10 @@ traffic_test() local after= local delta= + if [ ${has_pmac_stats[$if]} = false ]; then + src="aggregate" + fi + 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 @@ -317,6 +321,13 @@ for netif in ${NETIFS[@]}; do echo "SKIP: $netif does not support MAC Merge" exit $ksft_skip fi + + if check_ethtool_pmac_std_stats_support $netif eth-mac; then + has_pmac_stats[$netif]=true + else + has_pmac_stats[$netif]=false + echo "$netif does not report pMAC statistics, falling back to aggregate" + fi done trap cleanup EXIT diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 8f6ca458af9a..763c262a3453 100755 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -146,6 +146,15 @@ check_ethtool_mm_support() fi } +check_ethtool_pmac_std_stats_support() +{ + local dev=$1; shift + local grp=$1; shift + + [ 0 -ne $(ethtool --json -S $dev --all-groups --src pmac 2>/dev/null \ + | jq '.[]."$grp" | length') ] +} + check_locked_port_support() { if ! bridge -d link show | grep -q " locked"; then -- 2.34.1