Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp415938rdh; Tue, 19 Dec 2023 02:59:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxi8K9DXTDyYXfEz3qFEEdyIDlvEGqR4gTELDiF96fkfwgXCi1rwf56erHZfeLbRKN6wnR X-Received: by 2002:a50:d582:0:b0:553:67bd:2c8b with SMTP id v2-20020a50d582000000b0055367bd2c8bmr918608edi.95.1702983554736; Tue, 19 Dec 2023 02:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702983554; cv=none; d=google.com; s=arc-20160816; b=Sx+sMY+jGOG46i4eby6EfpWlknqRjYTUvxjVNtCWBwpl5+HkLXcz4FY5ReLJW7vwmZ eaNPUBp3X4BfCqdkJZklbuDFKYaq3UD8r3UNnr6fJh5pdswoWtRmf8AagaI4bHW5Z6Sh jWvbf53r6XI8VHAwriFG2Tv1HxyAsgObmEsv2teYMo58DCdycG4ZQgfCX56cWMBxgoav dGW4/zyOPrm5EgNvEDbJkCF/wJKVwYhajRtuymsf50jGFuj6r/g0IC/Me27PJCrG0hrY MDCOKuqSdx/QgOg2SpbqLnCsB3J92BRnd681WjVeasW6t/LFL63B5sHXGYnqTk4sl5S8 lFbA== 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=9eAJhN4bt9IjXmd4t4wjOUwgSRz/dmqIPuYeFoBTxBE=; fh=atN1XXIEfyrYF91vXjukw10btm2OohYym78OPztZ9zU=; b=IuG2L0JGY8wvbd6rK4hDTDh8yWM20lHahWJgTqGL3z0Vx9AQqJ5mxDN4hfnF4crz3l GSBT2fUsW22TJgxPS9+afYDJBbWvVFIAaV9YodkDo21LZpXM7XGcpk/U6YwGvAMOXO86 lxYAz7ZdOFvuDFrHkZeEoDA/j1L6KtHnSOSoJQDq3I0VDrBMDm7S//zWRqQgBPJhQyGo R8ZjJC3Twpo6vx5Phk5TN5945UcqP77ZjDNazkoHUU3JC4jbG34/niC1lgHmh5D00fUz 3G4QkqN+DGyxftg9pMGYQXlcQkjPUkZ8iE5Sql3HXmv9yNkuswxQuuCpAOUjWFskEXjF qXTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mp0hIQBE; spf=pass (google.com: domain of linux-kernel+bounces-5043-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5043-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g29-20020a50d5dd000000b005536753e578si1330826edj.78.2023.12.19.02.59.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 02:59:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5043-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mp0hIQBE; spf=pass (google.com: domain of linux-kernel+bounces-5043-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5043-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7CAAA1F25D86 for ; Tue, 19 Dec 2023 10:59:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B41A171AB; Tue, 19 Dec 2023 10:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mp0hIQBE" 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 4A7FA168CB; Tue, 19 Dec 2023 10:58:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E652C433C8; Tue, 19 Dec 2023 10:58:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702983500; bh=uVAcXO9H/d2ekloGrECnt2QTdgitfmZi+dWru1a7CuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mp0hIQBEhMU5lFEcAAWMVzo2MtkrdHXqe23Z65/jrehdbUwPVdllXwbQkpvviB1sl 27bfVdV4I+CqMv9RX0C4Zgk/byZbW3wQoxSmqG3Qtp6YsGsAtxA/u6pNetW4jginMh XPiizPvtmNkMLMU4FhG1BIWu3T+bSMKKcYsuByQtl1fM5Rjcl0pJuIsdDpiONAfBpo DLFx9K/guIPpvcPgjTDjFOBgmPY1/6AffHyWFU6bKQDsgxGNqUQJg35ncr5m98GVZM Ioh1AMZNQN0imzsTjFBMuEHquXrAQebMIb+bGm71I7hGTyJ/FKOC/9QZ0b9+vFoxdY 0NM/ZZ2okPL/g== 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 v11 02/10] selftests: forwarding: ethtool_mm: fall back to aggregate if device does not report pMAC stats Date: Tue, 19 Dec 2023 12:57:57 +0200 Message-Id: <20231219105805.80617-3-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231219105805.80617-1-rogerq@kernel.org> References: <20231219105805.80617-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: v11: no change v10: Fix check_ethtool_pmac_std_stats_support() logic. 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 e3740163c384..69ef2a40df21 100755 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -155,6 +155,15 @@ check_ethtool_counter_group_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