From patchwork Tue Aug 16 09:23:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oz Shlomo X-Patchwork-Id: 12944559 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FF73C2BB41 for ; Tue, 16 Aug 2022 10:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234228AbiHPKBn (ORCPT ); Tue, 16 Aug 2022 06:01:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233160AbiHPKA6 (ORCPT ); Tue, 16 Aug 2022 06:00:58 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2050.outbound.protection.outlook.com [40.107.244.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF49271A for ; Tue, 16 Aug 2022 02:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M46DUd0ka2Ebmn/y+y+ahO1/LSb0PTx6H8C71/EdQ5SfNJxmRUMgIQQTdRVVIn9BKoQk8NBfJF4g30IMorBcQA4Wkqj20BrrrtcnE586+0X+9ewsUMyp0fINgB43qLUl4/+x8VXg1bwsBUbuvyzIfBPCHIi1IOxU88M5OZA5YBh/JcLMfFU2UUMCf/JGOyaIOc8sLXZL6V22f5rdQcUrGYgQnqlPtB0y06zWprsxFBB3H4v5+kZUHhnN4z++hz7kPe2/W/CIqN8lwv9Li6SS7eGK5fW13PrWn2gU7fDFM2NZOPxGS5Yd+CSPLHPtmbTqmXx1i82hhqn6MOxG/VZT0Q== 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=6/5eQiFgJjA7JjTrExvqwPLqcGOzVSTA9b6b0iScNmM=; b=ifxfHj2GWzz7axJfrSWjIV+Hgb3pF343m6DL8jhUEvJUOv39SXI+oL10vjLcxWL0zslruREbQ2+eyTwcf+TAdphTeyTxrPsAT/7MM1wfsTSZXkvAk9RRiFH81o7rQOl+pOjX1rXkKyEWpeebKNLvyYNQj52eNo0oQ/6Z2ku1v2aM3Y8587qS9Tfz4N77MqrJAqMNPaSt4MemlxqMZ0Q2ffJ0D8LKXsNmB4UC+nus2UkaRT7AhKbUA4vFvhhWsXrSI1NEwzueMixfjPz4nIlZi1X+MoB/1/HxyQYI7rXm2f1NnIpVFt00oL37hM0zJTmOHt8TG0K1tn5XNNAsBxjVAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=corigine.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6/5eQiFgJjA7JjTrExvqwPLqcGOzVSTA9b6b0iScNmM=; b=cC2+MP4mKrYq7Q7l5dycNVtoLqJEyPerWSw0m3XnMDCne+G1Ns8jk1WeCSV4HIgkKiqoBqWQ5AByBI8vmCp+4SsGvKca/TlhJU9r6w8ptCsxgU3xHWuc58WmMRr5SsgNF5k4aGoV6jLs4C++IimcGkF4mjWnWr1y/IzmBXBj5OEgIOr+4UOyO4TiZRfo2mibBk3Yi2+tcPP64tZmgU+D16IN78LCTDHezNOb3bPyvoEqIFBPbVqfm6vfnVFL0D1VygRjctHtkKE8DCaRFbLXoQC2hjd+RQfWl+S4zJ3R92m4XNxVGNVaLHksOAvYetSs6ov99cp8Ju97so+V2yFhyA== Received: from MW2PR16CA0046.namprd16.prod.outlook.com (2603:10b6:907:1::23) by MWHPR1201MB0239.namprd12.prod.outlook.com (2603:10b6:301:50::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.17; Tue, 16 Aug 2022 09:23:49 +0000 Received: from CO1NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:907:1:cafe::4b) by MW2PR16CA0046.outlook.office365.com (2603:10b6:907:1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.18 via Frontend Transport; Tue, 16 Aug 2022 09:23:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by CO1NAM11FT005.mail.protection.outlook.com (10.13.174.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5525.11 via Frontend Transport; Tue, 16 Aug 2022 09:23:48 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Tue, 16 Aug 2022 09:23:48 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Tue, 16 Aug 2022 02:23:47 -0700 Received: from reg-r-vrt-019-180.mtr.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Tue, 16 Aug 2022 02:23:45 -0700 From: Oz Shlomo To: CC: Jiri Pirko , Jamal Hadi Salim , "Simon Horman" , Baowen Zheng , Vlad Buslov , Ido Schimmel , Roi Dayan , Oz Shlomo Subject: [ RFC net-next 1/3] net: sched: Pass flow_stats instead of multiple stats args Date: Tue, 16 Aug 2022 12:23:36 +0300 Message-ID: <20220816092338.12613-2-ozsh@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20220816092338.12613-1-ozsh@nvidia.com> References: <20220816092338.12613-1-ozsh@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0de14785-8693-455a-22f5-08da7f6906de X-MS-TrafficTypeDiagnostic: MWHPR1201MB0239:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eSVNv78LBVBJ+xFA+XiIuIYnaQ3u0HrHqdc8lUBnvY/QssWc7V7n7JUK8hK0uJlJp9yCDtwAd8hJkk3QIKDIB7p6dJulsmVr2ubPFORhZcZcczKpFyVH7ENvdwO4Oy3y40uxdmnZSsgWcjYSxXNF6BSNhfWaYN9ySP6xerCS0IY6dMWWgeLNpLgjPnnaLSaWzyO3oLGSTNTpzQUMV4HIrbkvYkp9WC6nEVC8bHmJlMv8p+lAGri3OmULiOafz1yplO5Yje6kOj0QVF/TeLMTt/gFunbcm5unvISjipQggoU9Zqnn/D1hjwhg6pxjo3Y6X+1VqXLXn90atF1HCjp7BD6LmJ5YjoqpZBeXLzKr9mFyBNnkAR2SEXDxVfa9LWf94JG3/vOOT6v/eZSB/9KSTc30yJDmfS3Z6NUP2m3asdGKhxzLKES1OrW+7KcDuQTiyWyNoQvJ/VkTE27hZKxXRkgHWxk/d3sug5z0HxcN3CDghsTkO8lZa/Dndz1IWUrogufe+768QJRHwQeP+CEkOMHgv9gFXzMffiX9qyxv0Ar3Irc/dfqcdrCtBkHOeulYiH/aBpBYb+zeibCd8Yu2fAtOvGYv6sLFsDYQi5VF1BDXHfsQ1jYGoKxam3xfq/Hq7IIiANcsAJXC0ZBCtjSiz5dF++Viw3TIhTF7MXCb6ul7fg+vkP0iHVWoySEBnELURHGOzIK4ZX7GiYXkGdP/MHJul7VxEuO97FxHAAoSq6KQalo+m5znAyksRnGpJo9ykvCLN5jWmau1U5qidB+8sx65plgUJ1YONQTNaIhejaVyLr/QXJqFg0jC80PkS0uVEqqqcQ+fx7YV8wlgzm0pJA== X-Forefront-Antispam-Report: CIP:12.22.5.236;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(136003)(39860400002)(396003)(46966006)(40470700004)(36840700001)(5660300002)(82740400003)(36860700001)(82310400005)(40480700001)(2906002)(356005)(40460700003)(86362001)(336012)(81166007)(47076005)(186003)(41300700001)(83380400001)(478600001)(26005)(8676002)(426003)(4326008)(70586007)(8936002)(6666004)(107886003)(36756003)(70206006)(54906003)(6916009)(2616005)(316002)(1076003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2022 09:23:48.8611 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0de14785-8693-455a-22f5-08da7f6906de X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.236];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0239 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC From: Roi Dayan Instead of passing 6 stats related args, pass the flow_stats. Signed-off-by: Roi Dayan Signed-off-by: Oz Shlomo --- include/net/pkt_cls.h | 11 +++++------ net/sched/cls_flower.c | 7 +------ net/sched/cls_matchall.c | 6 +----- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index d9d90e6925e1..27eac9e73c61 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -269,8 +269,7 @@ static inline void tcf_exts_put_net(struct tcf_exts *exts) static inline void tcf_exts_hw_stats_update(const struct tcf_exts *exts, - u64 bytes, u64 packets, u64 drops, u64 lastuse, - u8 used_hw_stats, bool used_hw_stats_valid) + struct flow_stats *stats) { #ifdef CONFIG_NET_CLS_ACT int i; @@ -281,12 +280,12 @@ static inline void tcf_exts_put_net(struct tcf_exts *exts) /* if stats from hw, just skip */ if (tcf_action_update_hw_stats(a)) { preempt_disable(); - tcf_action_stats_update(a, bytes, packets, drops, - lastuse, true); + tcf_action_stats_update(a, stats->bytes, stats->pkts, stats->drops, + stats->lastused, true); preempt_enable(); - a->used_hw_stats = used_hw_stats; - a->used_hw_stats_valid = used_hw_stats_valid; + a->used_hw_stats = stats->used_hw_stats; + a->used_hw_stats_valid = stats->used_hw_stats_valid; } } #endif diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 041d63ff809a..7da3337c4356 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -499,12 +499,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f, tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false, rtnl_held); - tcf_exts_hw_stats_update(&f->exts, cls_flower.stats.bytes, - cls_flower.stats.pkts, - cls_flower.stats.drops, - cls_flower.stats.lastused, - cls_flower.stats.used_hw_stats, - cls_flower.stats.used_hw_stats_valid); + tcf_exts_hw_stats_update(&f->exts, &cls_flower.stats); } static void __fl_put(struct cls_fl_filter *f) diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c index 06cf22adbab7..b5520a9c35e6 100644 --- a/net/sched/cls_matchall.c +++ b/net/sched/cls_matchall.c @@ -332,11 +332,7 @@ static void mall_stats_hw_filter(struct tcf_proto *tp, tc_setup_cb_call(block, TC_SETUP_CLSMATCHALL, &cls_mall, false, true); - tcf_exts_hw_stats_update(&head->exts, cls_mall.stats.bytes, - cls_mall.stats.pkts, cls_mall.stats.drops, - cls_mall.stats.lastused, - cls_mall.stats.used_hw_stats, - cls_mall.stats.used_hw_stats_valid); + tcf_exts_hw_stats_update(&head->exts, &cls_mall.stats); } static int mall_dump(struct net *net, struct tcf_proto *tp, void *fh, From patchwork Tue Aug 16 09:23:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oz Shlomo X-Patchwork-Id: 12944560 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A00FC2BB41 for ; Tue, 16 Aug 2022 10:03:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234230AbiHPKDP (ORCPT ); Tue, 16 Aug 2022 06:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234075AbiHPKCh (ORCPT ); Tue, 16 Aug 2022 06:02:37 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2064.outbound.protection.outlook.com [40.107.237.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B88426CA for ; Tue, 16 Aug 2022 02:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=elB0dvRqm1ggtowGrN79bRc9+2UArNK+DnzmjoYU6mzdFF3sy2RVn+2JQAhJf56F//4XomCgwte5Loj4VujHc74AkYvMjko3EMNti6UV0bxe0KOJCmaI50J2zt2KtlRNKvMQmrK4De5PZfBuSltrT8lS1oP/HVAsM/BmVd+UmiORmMlDXT0JHPgS2+lWs3tFqDiNqi9gn6dMTY/ytT94+X175IPCXgkirh09NcjwqS7OgQnOeMJzHK7oY6GcGCTeDdnZ/vHrqCjiTTmsh23E/N76JmiBeWm/9kq+1ZOwCjumxZWEQ+tKlKr62eDgS4aSUMmbIDOvMWRUrJNL/iyyIg== 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=U/HFa6NCIKGXFBczvz7CBa9ojBGUJfxX+qcO62e5xVc=; b=e41mfm/4ccl8vlPoiOefAkQusDP3b3cKycQqcO14vCR1AfEHeYJp+S2sr/Ppznv1MTufMPbcoJgzX40tVQMs64gDWblz9YdcT8k14Bw5XxpZAjT0RhQH50r4RnydWepGw/Gedou3NTm/xjiBcUpSOI+3m4XHavBGEnZ6nk6nz9tKFwZRlwhi5WX1gkEkedbVTJagoSrCtJONB6Cx/UZTyYXwS7EK62yszJBV4Div90hn6v1A4S5d4UNpLqq9vCMlRaBDmPKNHREzWEtfKrLMRBNd4Akl3uc7IwiqdpYgAUKzwgSw2aNHY85qg8XT6UYf8asx6wgn+nadVfWiWxUxyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=corigine.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U/HFa6NCIKGXFBczvz7CBa9ojBGUJfxX+qcO62e5xVc=; b=hbSU7/bxqtTMkJVtg0EmlKjNq5FnayxKDUrll17WNHteT8iQWHTY9owKzkSMRBIF7TNAevPzhidtAncgwbsLhzSZ72Rp9doUt/BkEloCWZ4Vs5LsYEKOcbpKrI7eDWCc3uXowOxhqHIePeqTRJa1590/IdvZk4mvlDhlaZccx5rtnVr3c6PrA/VHeuG6RXX9sxrNF+1IPOwKEgB3ptrxITQ8eVB340OmsetpBCahfVFkv/XiJLwpABPTWhR6I+iIkXkMOmuEMGAmXwu6Ej4Cmz2dVpoqpIdXYHJvj7N9fLvXklkPb5RkYeI0P4ybk/XtGRm+woeqwtOFI+8Q/edJiw== Received: from DS7PR03CA0305.namprd03.prod.outlook.com (2603:10b6:8:2b::25) by BL3PR12MB6642.namprd12.prod.outlook.com (2603:10b6:208:38e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.27; Tue, 16 Aug 2022 09:23:53 +0000 Received: from DM6NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2b:cafe::bb) by DS7PR03CA0305.outlook.office365.com (2603:10b6:8:2b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.16 via Frontend Transport; Tue, 16 Aug 2022 09:23:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT084.mail.protection.outlook.com (10.13.172.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5546.7 via Frontend Transport; Tue, 16 Aug 2022 09:23:52 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Tue, 16 Aug 2022 09:23:52 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Tue, 16 Aug 2022 02:23:51 -0700 Received: from reg-r-vrt-019-180.mtr.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Tue, 16 Aug 2022 02:23:49 -0700 From: Oz Shlomo To: CC: Jiri Pirko , Jamal Hadi Salim , "Simon Horman" , Baowen Zheng , Vlad Buslov , Ido Schimmel , Roi Dayan , Oz Shlomo Subject: [ RFC net-next 2/3] net: flow_offload: add action stats api Date: Tue, 16 Aug 2022 12:23:37 +0300 Message-ID: <20220816092338.12613-3-ozsh@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20220816092338.12613-1-ozsh@nvidia.com> References: <20220816092338.12613-1-ozsh@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c6e96679-e7a6-4448-3f2a-08da7f69095d X-MS-TrafficTypeDiagnostic: BL3PR12MB6642:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LTA8FaAOGwy38FrH2bpvYh1TZ5WUJPJppCegG6w22VtF61/VTdvNFUlb0wF8ucVHm0U7PtdkxNi/Ha6ykwkGaZedS/Dq9YObIpcjmewU7oFfiqWfsMyNKxS1pFIH5W6LBcRvxzfTmX58IlxhdIKniu9B69zvwvjnF0KUeubkjBnbXx9WjEqHIZ+nAqBbBVe4rXp0sPEVGGaesSpCfQl+cOGYojcUaJtaHUApr++VxJw1PRX2hlQzBd9epvb24/1ZljFb6tbClsc+7/SHFwA+FbcduzRYkWeFxaILj20LmoTqLMwz8PbdJvB9RTKLbPZUB4v/o0++GjFijx6s/t9qxGxupvXc+57S9ghAHftzahjSIIBosK2KM3vQLb0CZzSWNs4Xsoehnt3w27wD0tr89jljYa5Q0TBf2YArOlV3RueDk6s/1WTnUMTaA4VdJUsKpSbiYHUOHhi2DRIlfRHALNP8TcHIiy6tr5V7JfO5rV29JKTu36+vB79XuJmQZh1S0K5YnW6xP8zoGp7HVnKLU+O4rdt9+AUVogaxaoDXZ1VDMDOi0s/D327rNn4qMCbPxrFSTvbZ/DnsYce7hxua5oSP77tPfZ5qWiYK5apLovkVuKpLzc3ht0c/mYOJFjdrtpJhpRG1NkPQlxcuapvhJA21Jnzc17GFwGu6f2rZlyM/yCr9J33RkSxyyN09zW+5cFhU8JCXltHTfkN4ekZ/PE8a91WPhjwhVZemQ90gxkjfUh0PAJQa3n1DZnMx2T2fkNkwOv8Ewm2QKjayDlZw+nD7L4yN96LFQroa886RLbyrHbgUKet7tnyvjRpl1VeeuAmpMUecSeocV7LHU1x4yQ== X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(136003)(396003)(39860400002)(40470700004)(46966006)(36840700001)(5660300002)(70206006)(107886003)(40460700003)(82740400003)(8676002)(4326008)(356005)(70586007)(81166007)(336012)(2616005)(1076003)(47076005)(186003)(426003)(478600001)(41300700001)(26005)(6666004)(316002)(83380400001)(86362001)(6916009)(8936002)(82310400005)(36756003)(36860700001)(2906002)(40480700001)(54906003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2022 09:23:52.9871 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6e96679-e7a6-4448-3f2a-08da7f69095d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT084.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6642 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The current offload api provides visibility to flow hw stats. This works as long as the flow stats values apply to all the flow's actions. However, this assumption breaks when an action, such as police, decides to drop or jump over other actions. Extend the flow_offload api to return stat record per action instance. Use the per action stats value, if available, when updating the action instance counters. Signed-off-by: Oz Shlomo --- include/net/flow_offload.h | 6 ++++++ include/net/pkt_cls.h | 26 ++++++++++++++++---------- net/sched/cls_flower.c | 4 +++- net/sched/cls_matchall.c | 2 +- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 2a9a9e42e7fd..5e1a34a76772 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -436,6 +436,11 @@ struct flow_stats { bool used_hw_stats_valid; }; +struct flow_act_stats { + unsigned int num_actions; + struct flow_stats stats[]; +}; + static inline void flow_stats_update(struct flow_stats *flow_stats, u64 bytes, u64 pkts, u64 drops, u64 lastused, @@ -583,6 +588,7 @@ struct flow_cls_offload { struct flow_rule *rule; struct flow_stats stats; u32 classid; + struct flow_act_stats *act_stats; }; enum offload_act_command { diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 27eac9e73c61..f5e5582aef17 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -269,24 +269,30 @@ static inline void tcf_exts_put_net(struct tcf_exts *exts) static inline void tcf_exts_hw_stats_update(const struct tcf_exts *exts, - struct flow_stats *stats) + struct flow_stats *flow_stats, + struct flow_act_stats *act_stats) { #ifdef CONFIG_NET_CLS_ACT int i; for (i = 0; i < exts->nr_actions; i++) { struct tc_action *a = exts->actions[i]; + struct flow_stats *stats = flow_stats; /* if stats from hw, just skip */ - if (tcf_action_update_hw_stats(a)) { - preempt_disable(); - tcf_action_stats_update(a, stats->bytes, stats->pkts, stats->drops, - stats->lastused, true); - preempt_enable(); - - a->used_hw_stats = stats->used_hw_stats; - a->used_hw_stats_valid = stats->used_hw_stats_valid; - } + if (!tcf_action_update_hw_stats(a)) + continue; + + if (act_stats) + stats = &act_stats->stats[i]; + + preempt_disable(); + tcf_action_stats_update(a, stats->bytes, stats->pkts, stats->drops, + stats->lastused, true); + preempt_enable(); + + a->used_hw_stats = stats->used_hw_stats; + a->used_hw_stats_valid = stats->used_hw_stats_valid; } #endif } diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 7da3337c4356..7dc8a62796b5 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -499,7 +499,9 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f, tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, false, rtnl_held); - tcf_exts_hw_stats_update(&f->exts, &cls_flower.stats); + tcf_exts_hw_stats_update(&f->exts, &cls_flower.stats, cls_flower.act_stats); + + kfree(cls_flower.act_stats); } static void __fl_put(struct cls_fl_filter *f) diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c index b5520a9c35e6..0ba4392b93de 100644 --- a/net/sched/cls_matchall.c +++ b/net/sched/cls_matchall.c @@ -332,7 +332,7 @@ static void mall_stats_hw_filter(struct tcf_proto *tp, tc_setup_cb_call(block, TC_SETUP_CLSMATCHALL, &cls_mall, false, true); - tcf_exts_hw_stats_update(&head->exts, &cls_mall.stats); + tcf_exts_hw_stats_update(&head->exts, &cls_mall.stats, NULL); } static int mall_dump(struct net *net, struct tcf_proto *tp, void *fh, From patchwork Tue Aug 16 09:23:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oz Shlomo X-Patchwork-Id: 12944533 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A9CCC32772 for ; Tue, 16 Aug 2022 09:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233963AbiHPJtM (ORCPT ); Tue, 16 Aug 2022 05:49:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbiHPJsy (ORCPT ); Tue, 16 Aug 2022 05:48:54 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2054.outbound.protection.outlook.com [40.107.244.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 348B265677 for ; Tue, 16 Aug 2022 02:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cJSXDT/C1PRG9WZqecu83ekooWWHl1U4P0+l5CnNAzFK9OpeGmhfY00ncFtDSIo7cS6M2b5oSrX4lTs4LcTLmWPAMwIQSNOXGZEcWmtgoe8dTlZkVZBdC3Z9Vux3p4lK944wvGkltvQyFnu6ET3oX/zXWoB7EujU9FW55buaWmXO51XeBOkaLI8xa20reinYJZ5cdCteUWI5QgNsRB1LxYb+t1lE91W3CL3WQkQMSFVEY0BE475zndXEPV9qTnGNEQCgCcwD4P0pzsX/wPXtKlt2dNk9QHDwUv761bkKgFT5NbiFJp4z0LNGmfGceRmWgWzje9dLgKngR5Z2G/hVVQ== 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=bOX4SV3YGtRZvKECwnbSLPDhITdMdozC0YC5aPXcskg=; b=X9RAPs0mYxPScIo0kbfKVOZMSKOr+ovftqT9dhf8QB4i1giqKwWHc6a1DgBFyJ5iyZjRbVZuGhy/fdUXJiPb//hfLIE+1fMHliCtH7UXTMmpQYJgMxtJNh/9wsiz0eg5BJh89LLNdQsLUcNfGfhlr1c/1QABJ8EOg/YAVt/sokdJ5OsEcUW9IuTvTfpXJzvQSj9FVeIXAbn6LUpvYrzkjT6rmbXujCCuSk+u8xrVX/rMhn8Kmrnm8qEnt4znp7sEMwpfc3laDrYPtC6HVsChOD928NGjmNPCktEfcQckrB/aWArxgwqOn/JZCQkRrMCYyquJGF8fCBpqToL+4nvB5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=corigine.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bOX4SV3YGtRZvKECwnbSLPDhITdMdozC0YC5aPXcskg=; b=JLC7IR2NzIhVDFL7Q8wvR+qc6lU+GsdIPPIrnjniyZDIrZoccPbmpsG9RQickIcRUGF1XhnFnHmFTSx2jjpME3GipA+JiC4NaImIhmA96lbpLWjt5fCAKIdHYyzPR591/ldLGOl4JNLQMCgnL1WLcgyv3nq432kzBvALDMm7vsBX4pK/xOgcVL3luH4FRjoh9emU0jFg7Gv5sWBEm2rMERh5UBOmqJuwvqmhcmDEe/E25smII/Tj5JkJne+22UQ6Cwni2MzxSsW2KmEXUO2mYp6FSqVm/YjbVEI2q5dhciGbEXXpiJtsYzw/QcIJN0LS78U+r7uQ1i/nHOk/q6Q8EA== Received: from BN1PR14CA0009.namprd14.prod.outlook.com (2603:10b6:408:e3::14) by PH7PR12MB6609.namprd12.prod.outlook.com (2603:10b6:510:213::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.17; Tue, 16 Aug 2022 09:23:58 +0000 Received: from BN8NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e3:cafe::dd) by BN1PR14CA0009.outlook.office365.com (2603:10b6:408:e3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.16 via Frontend Transport; Tue, 16 Aug 2022 09:23:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT056.mail.protection.outlook.com (10.13.177.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5525.11 via Frontend Transport; Tue, 16 Aug 2022 09:23:57 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Tue, 16 Aug 2022 09:23:57 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Tue, 16 Aug 2022 02:23:56 -0700 Received: from reg-r-vrt-019-180.mtr.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Tue, 16 Aug 2022 02:23:53 -0700 From: Oz Shlomo To: CC: Jiri Pirko , Jamal Hadi Salim , "Simon Horman" , Baowen Zheng , Vlad Buslov , Ido Schimmel , Roi Dayan , Oz Shlomo Subject: [ RFC net-next 3/3] net/sched: act_api: update hw stats for tc action list Date: Tue, 16 Aug 2022 12:23:38 +0300 Message-ID: <20220816092338.12613-4-ozsh@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20220816092338.12613-1-ozsh@nvidia.com> References: <20220816092338.12613-1-ozsh@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1a54ab1-759d-46b1-3e90-08da7f690c38 X-MS-TrafficTypeDiagnostic: PH7PR12MB6609:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i0nADNsTXNY5ENxgU7AkWe2YY/pfxB535xNqpoErvDsB/J1aOWCEUwVfU+05yb2A4zU0GurS+MeYJF4uMFdSXAQZNWGEPRGnCOYnuRwFefUm/aShGEiICZL0TIkfJqtByGv5bcNWrbouImcFMoC5cYmjhD3TYcJMRY4zGbDgia78p+ygLCVoRDq0JOtWmnNz/FZ8wAGbm4G0ZckfrCIeoUNkDftKyFph/MBIIxzBmBsnGW/HttwyQ5w4TN47ccHHw5sc/tU6cmxGzpcpwWYj5LZM+Lu6A1y+zsYnWWmdQCND8ZjkSHS0YF7iuNOzUwwm0uhRTNtJiQugqws96jP7ogxAu5H4u2QsRJN61V/fV8rOKHzVfJhwadLbJPnKF6PBQ8pCNUPv2JlEp68LAPfnOSyLsorTR5TYu/MAeXAwhQp8ytAaXhZr/bsbH88WDNDIBkrGGCHaEhSzLdKSZ5r1n16j13izsRlc38KslEjExC6238AX+blLPnzwBhLSE2+Qig/WNWCvtNSl9ur11WF53aTKdN3Z1eU2iurl0vmTbxVr5S7l9Jaij0H1tKbwtZSAq/clCzjCvrlPKNLmABapz6D6XS7UUSGksns1MOtZn4i21Nc7QWtb7eucC+K6D/JrgeNBKWHIKiAyu5MxsJR7GoqK9puDmLj7favFG/fJpVa/m/cmpVqvb+7SXvF1IMjP2Wz8XrdCJJx+s3s9dvFuhO/UnX+qM0OuaOtj/kl+gwBMWXvNJNQEx0PEjXvZTPfVwmJI5RX4iOG9N2Mkw3EkOWPwyM01uMC1dWBvVZlDnnjiPWqv50iUeXQkfh99QANMhvp7pgqGRhocqM3lq/57XQ== X-Forefront-Antispam-Report: CIP:12.22.5.234;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(136003)(346002)(376002)(396003)(39860400002)(46966006)(40470700004)(36840700001)(336012)(82310400005)(1076003)(47076005)(107886003)(186003)(83380400001)(15650500001)(8676002)(2616005)(8936002)(4326008)(2906002)(426003)(70206006)(70586007)(41300700001)(40480700001)(36756003)(478600001)(6666004)(26005)(40460700003)(86362001)(36860700001)(54906003)(5660300002)(316002)(6916009)(81166007)(82740400003)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2022 09:23:57.7777 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1a54ab1-759d-46b1-3e90-08da7f690c38 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.234];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6609 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Currently action hw stats are updated during the tc filter dump sequence. HW actions are also updated during the tc action dump sequence. However, tc action dump does not update the hw stats for actions created during filter instantiation. Use the existing hw action api to update hw stats during tc action dump. Signed-off-by: Oz Shlomo --- net/sched/act_api.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 817065aa2833..5d7b6e438085 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -301,14 +301,11 @@ static int tcf_action_offload_add(struct tc_action *action, return tcf_action_offload_add_ex(action, extack, NULL, NULL); } -int tcf_action_update_hw_stats(struct tc_action *action) +static int tcf_action_set_hw_stats(struct tc_action *action) { struct flow_offload_action fl_act = {}; int err; - if (!tc_act_in_hw(action)) - return -EOPNOTSUPP; - err = offload_action_init(&fl_act, action, FLOW_ACT_STATS, NULL); if (err) return err; @@ -330,6 +327,14 @@ int tcf_action_update_hw_stats(struct tc_action *action) return 0; } + +int tcf_action_update_hw_stats(struct tc_action *action) +{ + if (!tc_act_in_hw(action)) + return -EOPNOTSUPP; + + return tcf_action_set_hw_stats(action); +} EXPORT_SYMBOL(tcf_action_update_hw_stats); static int tcf_action_offload_del_ex(struct tc_action *action, @@ -543,6 +548,8 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb, index--; goto nla_put_failure; } + tcf_action_set_hw_stats(p); + err = (act_flags & TCA_ACT_FLAG_TERSE_DUMP) ? tcf_action_dump_terse(skb, p, true) : tcf_action_dump_1(skb, p, 0, 0);