From patchwork Wed Jun 7 12:54:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13270681 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 E3B2B210A for ; Wed, 7 Jun 2023 12:54:59 +0000 (UTC) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2072.outbound.protection.outlook.com [40.107.241.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6784310DE for ; Wed, 7 Jun 2023 05:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IpJ/vAZAlSIQ0dZMv2dpXaXZn4hR8pD15jo+qUznvAqSBAGhHGdDgN4vQED5spEDvsJGnDKuyxHxUMFnaEvvhVgYMeKPGRGf92XerTtqHJgxT8MiMSLuZ35wruFWib4s6+xP4MtNd8J6gL5uiWkrJTO1pC5Kb0pybPh5hXGJmIoT6vLSY9t7aLg9AgyyJpURMtayQaIg+FboTDZ0yGV47ULxaoMePtBTAjPoVIo5NQVztO3I5BkkR28UdeE4Pt8/VO8J/QlB0q8vWeRBA2U8lL6Z1A+bL8T+ba8KDOQULMvQtyZRXWReA5PzZPnANE6w59SGBewZO+Hb/GZLcpjrcA== 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=k1aUBm4jlXelQ//RTBq5Ibkidc/aBJpPjbvwG0mv+nQ=; b=Sf+oF1Sv0zL2lx6WjvvPywLKvU1gs36YS0d29uAWF15tCBwW2GG8vt5NYeakmPR8YOLN70ufXIxF9mvccqtwMi1On5zkNNLFTtQwBFh8v1e+9lNV3MHgROw9+g1fd/CoTLTjxeAie6tFA/wK1atxyAxjKEZYRJT+ppxu582EH00P0SXLtXbyiP0E0wb1NQSXwCDW6LBZ5V1CUT5+bS40HUwDe7Uz+T5Uv5JDNcGoWFfo6qekmJhISnGWLX4Y9UA6+3qU3FBUwheUaVhTr6nxZjMLTBWwWjF2WxPI6BzJOZDw3ZLuK98DsEblmV9EGT0YV5FICShcmXq7bqZklb2EJQ== 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=k1aUBm4jlXelQ//RTBq5Ibkidc/aBJpPjbvwG0mv+nQ=; b=m/MJox+fELPSY4XwEKXbURj1I8bWTU+PVQsQpEQvNKYXIVFN47uMQxsmp4BH+G3I7AFR1DceMVdLDnQ/CS3bOF9yyr/H1iY6f+t58E5bhuh2Ck9hdZqCFNpoyZYq4S8wT1sJamjMYEs3zcTWDJtCUujQgYljJ9JYeY+n+yFNNrY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by PA4PR04MB8030.eurprd04.prod.outlook.com (2603:10a6:102:cc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 12:54:55 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460%4]) with mapi id 15.20.6455.030; Wed, 7 Jun 2023 12:54:53 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: David Ahern , Stephen Hemminger Subject: [PATCH iproute2-next] tc/taprio: print the offload xstats Date: Wed, 7 Jun 2023 15:54:41 +0300 Message-Id: <20230607125441.3819767-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: FR0P281CA0133.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:97::11) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|PA4PR04MB8030:EE_ X-MS-Office365-Filtering-Correlation-Id: 91b548a6-92ce-49e1-af97-08db67566367 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yZaV2Gq/EHSQw2zvh4eE0Si7Q0IvBXk+LQT/ua762qSuCbaT9QdcpY1R6GlvBpxnLSWCDdQBEPm9HkILOLjKcSGnVwdX+AVM1OevCT12Ev9LVZUApmuA20fyphe73fYR7UMuCtW3S2aA4hlpDXaTvrzoUsdWCLYjvEXDZWo+IN/DbDxloFKdpYFlK/9XkPY6FjsIiax+CjMNrbQ3VWXECL677pNUo6SOYUtWIz93HpgvSWO/Capnxd/ml6UvG9LC4ylQhtAqDiA3iJiiQwameaWPDhgSO+X4jaq5sMrk9ZLQSz/LlayNlKOWRJ5KWBhEIzPFJ9Q7JDxXe59aCQer0RnOQ3x4P/VHqk9Fb/79Z6LN8mdSlm63MsHp1xgVQ/OhVRyBLFF0QKnArPVqqwy+TlI3PueZtHE7pdxgKoFewJ+F2AzotA+NsQGfu6w/LIccUlgZ9erggmuyOtUAqygHlnDwMTc00NrWN5xWT67VOx+fFGh0biWcFt7WDXMYXb1uFVFcP8c8hEMrnTYMhnJD85WV2651v0M+/AaDMxU4KWlcBMTJS6As/i86FWq5Eiu846Rx2Y9okbFM9DSja6uwiBPrkaeT5qu3zuGr2vBzCpvG5a5xEgCFw+vxIxz8GLw+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(136003)(39860400002)(366004)(346002)(451199021)(54906003)(478600001)(5660300002)(44832011)(8936002)(36756003)(2906002)(86362001)(8676002)(66476007)(6916009)(66556008)(66946007)(316002)(4326008)(38100700002)(41300700001)(38350700002)(1076003)(6506007)(2616005)(26005)(6512007)(186003)(52116002)(6666004)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sbOsnK4qjboLkHxztueUFzXFLqsOiVdS5U3DqnshOwi1cH4BmdOF+uqL0QsHo4cH4wA56KyP+Y+n+TbT8g2+uq65huvtBnlwtD2Q8DXBUVvd/LKsfQnl/ow+f6WqAEvOCfWAEqPDDQRcnpvTgkr6XJorRvDATGMQsU9IZGwnoGhmXTC/zqA+xDwDT9i1CL/niIe4WGhGsfnM+a9BJ7Gd+brhUM/r4PhOkdIw/xb9SZzV7cW5f0cGGRppIdF8CGE/mJGAE+PwH1Qbv7Ys5VUz3ttATxCsJpScerBGADWMPhRraduP+XYKkVW53r7LfZ1Inn0VFr3NXAH6ZC99obSTsZGChebuqwc2WQbEM8eGsbCYlUnp+xBhRO5yNjgtC+yztcjuCm1iH/uZIuxsiSqCKhxeg1/NMJRCJoQlzbRsvrcdfb2FaUFGSwot4PBp/cAL/ONOZHLerHaejoSrwJoh8wjQtMbHcIdGVw+dpy1rLsVxcqxhApYPO2Hs9EfBkC/Uy+3zO22tso3xS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GaJNnIS5ZKnAr2zg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91b548a6-92ce-49e1-af97-08db67566367 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 12:54:53.7414 (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: /lrzUm/CXmnywXLUCocyo9yTKKPXNHCfhNbzwcPVjrX6vqDR6j8uWc3zcToBAugzkdfcn4uC/rceitqAA1Ovxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB8030 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,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com When the kernel reports offload counters through TCA_STATS2 -> TCA_STATS_APP for the taprio qdisc, decode and print them. Usage: # Global stats $ tc -s qdisc show dev eth0 root # Per-tc stats $ tc -s class show dev eth0 Signed-off-by: Vladimir Oltean --- tc/q_taprio.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tc/q_taprio.c b/tc/q_taprio.c index bc29710c4686..359c4c03b8c6 100644 --- a/tc/q_taprio.c +++ b/tc/q_taprio.c @@ -649,8 +649,32 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } +static int taprio_print_xstats(struct qdisc_util *qu, FILE *f, + struct rtattr *xstats) +{ + struct rtattr *st[TCA_TAPRIO_OFFLOAD_STATS_MAX + 1], *nla; + + if (!xstats) + return 0; + + parse_rtattr_nested(st, TCA_TAPRIO_OFFLOAD_STATS_MAX, xstats); + + nla = st[TCA_TAPRIO_OFFLOAD_STATS_WINDOW_DROPS]; + if (nla) + print_lluint(PRINT_ANY, "window-drops", " Window drops: %llu", + rta_getattr_u64(nla)); + + nla = st[TCA_TAPRIO_OFFLOAD_STATS_TX_OVERRUNS]; + if (nla) + print_lluint(PRINT_ANY, "tx-overruns", " Transmit overruns: %llu", + rta_getattr_u64(nla)); + + return 0; +} + struct qdisc_util taprio_qdisc_util = { .id = "taprio", .parse_qopt = taprio_parse_opt, .print_qopt = taprio_print_opt, + .print_xstats = taprio_print_xstats, };