Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5237712rdb; Wed, 13 Dec 2023 03:07:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFG2a6EUhylO3KmT7HPSeLaOzbdfcb8hHwk337NKvqQGVHaufjaMYYnu9eEUNP/NOf/Nrua X-Received: by 2002:a05:6870:610c:b0:203:2225:bab5 with SMTP id s12-20020a056870610c00b002032225bab5mr1020379oae.113.1702465676819; Wed, 13 Dec 2023 03:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702465676; cv=none; d=google.com; s=arc-20160816; b=RTH4IHQLEmKvEp+C65cM1NNjAP2LXr0L4MNWXO5MfGpYGepnUadLdKl97rQn1ZOYun WIWxx001xPq6muo5O4Qj0yQaPm4GY+wseX6tPFlls/1aZEBp2iK8DgSpjUsZYb88eLmw 0HwfCSWacsa+3umTODvrh8nkXIa6qip4EuR38jk60HY1fpIStbxWAXLv8ZCt+1hUzVxL NhFPVsFHYib4MDnjZT1YLB6nc0UREAiXgubs5+6vAgMC9C2u7rzJemCxhrJO5IzZj5hw I9E0GIqaz1F71yNutMzMC4EC7E6YDQc3MBVP16cOqspXmiLW8VkdowRRpOFfUodPyADi MIEQ== 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=jtop9Pv2BfbPw1jCUWWwmNPRNh2ORPAYwZSqAesCSo8=; fh=asmpGj2YxYe8/ji4bMUZUZytUYtbGpU9WbAkliy8rO0=; b=MmBlIE+pO1iMFn3t8JlJ6Hn0vOzzFYp+y459vlUE83eFOW2TrICBdIq/8h6IXkFxP6 PZNbm5OANE9LhtTiO/LYa1/mnqMNdS15YFQZ//3S0el1nN2YxhH2QdWRlCRA9+K2sxSF P2jlYjAeErVOS92rSUCSrDWXATQWsb0ir1qtlx6CIGr180z4J0NJ3HTVffBy5SL0zUET WLL9ulk+jWn77lkO942DTY605SnB9jBhiFjtUnk9n8Sp88pMi/3EKUNDxiboqwiM1Mld 9H3GYDTQMuuu85rJnirMabdPLPW1o3REhuRLw4u/M/80iDVFYq0/8iHO8Tb3o+Kcq3Ea rqwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Xa0VNslk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id f7-20020a635547000000b005855f67e490si9402567pgm.690.2023.12.13.03.07.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:07:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Xa0VNslk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id AA4C48225CBA; Wed, 13 Dec 2023 03:07:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378558AbjLMLHf (ORCPT + 99 others); Wed, 13 Dec 2023 06:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378614AbjLMLHd (ORCPT ); Wed, 13 Dec 2023 06:07:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE8029C for ; Wed, 13 Dec 2023 03:07:36 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDAE9C433CC; Wed, 13 Dec 2023 11:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702465656; bh=T2+UW0wgOJD87vUUjL4c6NPMZ4qFsnH4UJdV5sl8DqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xa0VNslkNhmR80Aij3XQF2RBSUcV1gOOD61N9nIpQTmB3ma72+qB6pi5ulJ3zmqtq OtPM5IVnPnWDUJMtyo/BIyLUunnullqfXLInohBQL7BT+engf2dP0W7bMEtU+WCOMC 5YfoyH2eyqUeEFfzEkB68VcAzQmkgyQc2k2OEft5htfDtnc8yZFUkh96kA8JFjAACL h9DwvR3BRBodbgtx1JyTUVucrUgouh31fSZvgUeYBhwNey1dkQWe+pylowJ7JWucTa kWna6ZQmgQwlsEPPwMomOUD+qK117tYU6jsQn3gokCmYq0KWUWc+GdjN0Ol/ggVYB8 2yKaEXQ1Phouw== 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 02/11] selftests: forwarding: ethtool_mm: fall back to aggregate if device does not report pMAC stats Date: Wed, 13 Dec 2023 13:07:12 +0200 Message-Id: <20231213110721.69154-3-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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 13 Dec 2023 03:07:52 -0800 (PST) From: Vladimir Oltean Some devices do not support individual 'pmac' and 'emac' stats. For such devices, resort to 'aggregate' stats. 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: 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