Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp789314pxb; Tue, 5 Apr 2022 23:24:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywqOgirvWaw7GVUwj9NX0NFO07s/BqPzY4lTBv5fG86SspoxNdj2QibQV7gAq6DtJ3BuTM X-Received: by 2002:a17:902:ab5c:b0:156:8913:ced4 with SMTP id ij28-20020a170902ab5c00b001568913ced4mr7015292plb.39.1649226264114; Tue, 05 Apr 2022 23:24:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1649226264; cv=pass; d=google.com; s=arc-20160816; b=yRk6qji6WcHBi9ctjbdYAB5bmqVD7k5JkfIVua+0bC3P0AFZGY45nbPk2UdoKSE9ZY D95nCpt8H2lc+2Jd18YTHWyYvWojw5NUqlKJASB3j3WrKoLghlvgtPuw4Nn3hG7yYOu0 ADhstILM1IF8iiHAm/mWsj8857lvk3cXoPHP2UZzKi9NvaGu9y6pu/GtIkeUKRKs/nHp pVv8jeSJfB91AEyrPQl8qZzuqKOSZ3aaQQFXQqkK7HjRRyiwYG4qD0uhZ2jdWJur8uLL oaQYKyZ3RFZzSPo5HPKieMrh7XyPHMF/ZebovundimWQPqKQIkz+XVbc75ZRtngIS7dP 3gBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=AqiyLJ4FfVt8HKeE9E6l5cX8iHUCIS2409tRiE+lZMQ=; b=kgMjH1OgYtQwZyYRETMhS0X4fY6KPlKX0xDup8jIND/yKhT23XfragxbF0MSAp6Z/4 SRR2J2LqONCmfAIZ25lLfOkQe9PCZe1JdXb9agWi5hPK85eeg2WtnUoXwUpmf1ZIxogo uT00dZWWkvWLp7NO0MZRqqZ1+69Lqf6vTmq3dFLzYWOnP9xZ7egOBLwrAql2Fi0nsjLJ hrm4E87cESDcD6KhVxq9elLIno11oK6LTCGONocfOkjEABGSIUCsEAJzkOlAI77YxGeE ix7sK3Dswrwx2uwD+H4yF2JphGvaGMP1eC6FTkjWcap8eASAzjCaBLBj0mL1OC5go93R BVhQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=fm5RlxpH; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a14-20020a17090a740e00b001c6841aa3e2si4495607pjg.37.2022.04.05.23.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 23:24:24 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=fm5RlxpH; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EEA1D41857F; Tue, 5 Apr 2022 23:23:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584032AbiDEX5v (ORCPT + 99 others); Tue, 5 Apr 2022 19:57:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389041AbiDEOm3 (ORCPT ); Tue, 5 Apr 2022 10:42:29 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80137.outbound.protection.outlook.com [40.107.8.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D42D313F2C; Tue, 5 Apr 2022 06:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RryM/jp6PB3QNn70/oEkKJQUZXGUCYm3W/9UgPwUAwXoL36WLcfA+RmXlyFlAmn3OGRavptJ4Zt0eQiDWiaFQkE2Fb1sWBhM9Zb/PpFoNBRDgLPHRVtjT7vAIXu/YAm6+yGuHMIPc9syiJDxxKsSydzoZdFQmJTOwsy/QguaC9DChbgfm9ZYObZXgjDZA77IuT9KogANPKnsrjC6tSD5iMZJk6CgYPfwUrbphrVNAC5jRAgq6L5LCVHG3SWd9po+KVM6Sg+T/KrNa20uIUDtlkXR76nhypdOqO5pGj3wik7zPPHDVN1uOnFQEtkbSwrJb5VffhBLaBZHFsjur7h2dA== 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=AqiyLJ4FfVt8HKeE9E6l5cX8iHUCIS2409tRiE+lZMQ=; b=I3giLR/qn8xS/cAh0hryCteEFC+xmw5bKjEqGbz2LjBfeEo+52rq7tRs0+1aP4c83kCxuChXZifjVSaPw24YZDuwdOq7q+7GyQTrbW+ULl1Y4/8UWBZWHxPB6PtOrCy6/GTe+J8NfpOaMV/D2YOIs6/lGuqggXraSGdVO349uA4RzBwo8+0jsJM/a8CtXcMIE7Mdrrv/32fmRbZ9eCvLvkIIvvV1aXc2j9mrrVFUte3AxwmnaFAW7pt8MqpQOWCUI+Z0692yLsukq99fdeeNHkHcAHswA+2Tk4QVRMyhlELFhXEVeD5a6JVGvGgP2CG5ex+cpG9AOEdpOYAn/VP5/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=plvision.eu; dmarc=pass action=none header.from=plvision.eu; dkim=pass header.d=plvision.eu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plvision.eu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AqiyLJ4FfVt8HKeE9E6l5cX8iHUCIS2409tRiE+lZMQ=; b=fm5RlxpHW+3EELN6vPCeJmRy2UYRfuKtK/eQvz++FRwHpno4TASfoH3M0+JOrzl2rmyT5VGmYxWfnk+boTfA76rUv2ppikQwcwkihv012cpsoXt9j4XyPoJF4jEbY/vxCsq5C91dvpbvSXbIxhGOZdKIqCna/t3AWRBpWmg/twk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=plvision.eu; Received: from VI1P190MB0734.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:123::23) by HE1P190MB0380.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:61::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.30; Tue, 5 Apr 2022 13:20:24 +0000 Received: from VI1P190MB0734.EURP190.PROD.OUTLOOK.COM ([fe80::f50a:467e:d704:784]) by VI1P190MB0734.EURP190.PROD.OUTLOOK.COM ([fe80::f50a:467e:d704:784%4]) with mapi id 15.20.5123.031; Tue, 5 Apr 2022 13:20:24 +0000 From: Volodymyr Mytnyk To: netdev@vger.kernel.org Cc: Taras Chornyi , Mickey Rachamim , Serhiy Pshyk , Volodymyr Mytnyk , Volodymyr Mytnyk , Taras Chornyi , "David S. Miller" , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net-next] prestera: acl: add action hw_stats support Date: Tue, 5 Apr 2022 16:20:14 +0300 Message-Id: <1649164814-18731-1-git-send-email-volodymyr.mytnyk@plvision.eu> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-ClientProxiedBy: AM6P193CA0088.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::29) To VI1P190MB0734.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:123::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b58e01cd-3295-4c54-2df5-08da17070ab0 X-MS-TrafficTypeDiagnostic: HE1P190MB0380:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 752+mi4iI1+z7Fw08KTghJgwr/NbyTLQ522X4raoilj0YfuKXy0UsxnnaoI2AJD1r8uZlTS12zjCwthXjjBzq/JKIuwXQYj434/jc5b+bISqR31cidXdZJ0QN2UjnEJLrl8GuzWM6AjR3fIwCnj2gtVAborenfqP+TkNipxDvcVotuFfbA3rU/RHX8zebFYRN/MqGX5u0+HoxK69354X5MzMguqJDzKnmjSe5x7hq4+Sr4UbdAMs8oQjv+Khjf2kC0s3TbensPJpuIG7btgatzvGwIE05P2LT20MvbyG51i/rIDLuKmI+721FUdlNHhSXVqOFVPDmfcJ37yDz3pflRRqD3JtPPuXtkCutNXSpNApd/83OLtyydxryTxv4Ff2hI08mwZ5OPk0r33jS9XXywfMaYFsMbiwazyIu2cqyEeBtk0CRjQd+OMofQ7pkhahozcXiOAp7ixh2oGb1E6daSIxfvCKRCJI9hURkaDtPWlFLLSECq8jbN1jtI+77f2hE+QYxQxTjSnZikU/xNVu6ANMyjBaVIvde/tkzSmeLRU1QY3ZgkMo+krCLIRaUIYFi3AFwXXP7j1jEx2PeDQKfG8Xmvwfy3fvyyVrQ8dFBuZwXCdaz1E7xliXL+n1Dp171o4I5KQFowF12t90hPfVWSJ5rbPHGtiQatWOfS3ZZLyeflzndSVVmWfdJbmWq1pa3IqisLEqYQvlfH0hJDxQtA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1P190MB0734.EURP190.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230001)(366004)(396003)(136003)(39830400003)(376002)(346002)(66476007)(66946007)(508600001)(4326008)(66556008)(8676002)(52116002)(6486002)(6666004)(2616005)(2906002)(6512007)(83380400001)(8936002)(6506007)(86362001)(44832011)(26005)(186003)(38350700002)(5660300002)(36756003)(316002)(38100700002)(6916009)(54906003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?OPKSOPV+yIm64t3KIawzJzC9WWLdUZWyJc+8ainBL/7fO21L8vGZJPg0Ov1t?= =?us-ascii?Q?NtvSeVtMCwl8rBYTvxv6Kxz9oKVnFl/2LwIMfQyr9wXyuUDdPZ51ZyXNt6j0?= =?us-ascii?Q?nVbak5T4axCcZzk3Zfyut7qD+kj3ZaZpoVddzieZSdmrlu60XBVX7hxDNXHK?= =?us-ascii?Q?ngtNp+v9RKdGbqrqROF9CqfGlymiAoEjacy///cMEiFciiij+lw2uR+BS2eR?= =?us-ascii?Q?PjSzF8c2jIy8Bcjo62PXF8XOJqmURR5dLYPxZ7ktGcT8kjCSr3AhKw2yCI3w?= =?us-ascii?Q?OsRbfbAAanRTSK/oFaHnA2Cx3W5+D8n1Nmnsh56YcKlwua0xmHYSPCuK7EuX?= =?us-ascii?Q?R4gkH3+hdY1MuiqGOP0WXZjs7Dd60ssM9So1C4mfEoSi7mvIelD5raQDULnr?= =?us-ascii?Q?Gz7tJ16IZeZGFLkNBe9AsTZpEU+qrIoIHSxO3LZQ8Fj5QjEclxgIQdy55cMe?= =?us-ascii?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M9R+aElMAvXYOJEVq0V7We?= =?us-ascii?Q?frSpGKQrq3bqsG26gpY4GY9HpZlW9HiQnR6hCYECpSORqch7PxsX7oG2vh2D?= =?us-ascii?Q?eaQpu/29kk/95haH/SfQ7N44woFGJ1HtHHCov8FlHtjgUP8lihUGBZenF74A?= =?us-ascii?Q?h1dJyPDKylpCf5gyWFo2V/aRcHPaD9whCFaY3aPPlAoP/m29AwGInhKCapfC?= =?us-ascii?Q?NSOJ3HB35cNQDyxWm1Oc6zJIHW7YaIqya0/vCwgmOUrh0kNSS9cALAs/+JSM?= =?us-ascii?Q?UgZ3jEb3FRMr1iM1VScEn5nnvZSKdcyIOg+Dmbp+IPBmJgffB55BpiaGWn8p?= =?us-ascii?Q?mx2WGBGhz52k/NiQs2ur/fIO+uJ8Xz7kYukkv3FS/AKdl2B+7gAtIfXVM3j3?= =?us-ascii?Q?JygFRE5YHkGtUav3xE8VphudeSDxs4s=3D?= X-OriginatorOrg: plvision.eu X-MS-Exchange-CrossTenant-Network-Message-Id: b58e01cd-3295-4c54-2df5-08da17070ab0 X-MS-Exchange-CrossTenant-AuthSource: VI1P190MB0734.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2022 13:20:23.9280 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 03707b74-30f3-46b6-a0e0-ff0a7438c9c4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: stP3ck4wIhZPEMha06yfYC1vlrsyyO/o1klK/MFPLI2kn0nDuIgmtQnpPRF5jAY4wZP7/plXun9CoCh5kSdEkU0YnDag99Nw4k1CkwaVLaE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1P190MB0380 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Volodymyr Mytnyk Currently, when user adds a tc action and the action gets offloaded, the user expects the HW stats to be counted also. This limits the amount of supported offloaded filters, as HW counter resources may be quite limited. Without counter assigned, the HW is capable to carry much more filters. To resolve the issue above, the following types of HW stats are offloaded and supported by the driver: any - current default, user does not care about the type. delayed - polled from HW periodically. disabled - no HW stats needed. immediate - not supported. Example: tc filter add dev PORT ingress proto ip flower skip_sw ip_proto 0x11 \ action drop tc filter add dev PORT ingress proto ip flower skip_sw ip_proto 0x12 \ action drop hw_stats disabled tc filter add dev sw1p1 ingress proto ip flower skip_sw ip_proto 0x14 \ action drop hw_stats delayed Signed-off-by: Volodymyr Mytnyk --- drivers/net/ethernet/marvell/prestera/prestera_acl.c | 7 ------- .../net/ethernet/marvell/prestera/prestera_flower.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_acl.c b/drivers/net/ethernet/marvell/prestera/prestera_acl.c index 47c899c08951..e5627782fac6 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_acl.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_acl.c @@ -421,13 +421,6 @@ int prestera_acl_rule_add(struct prestera_switch *sw, rule->re_arg.vtcam_id = ruleset->vtcam_id; rule->re_key.prio = rule->priority; - /* setup counter */ - rule->re_arg.count.valid = true; - err = prestera_acl_chain_to_client(ruleset->ht_key.chain_index, - &rule->re_arg.count.client); - if (err) - goto err_rule_add; - rule->re = prestera_acl_rule_entry_find(sw->acl, &rule->re_key); err = WARN_ON(rule->re) ? -EEXIST : 0; if (err) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_flower.c b/drivers/net/ethernet/marvell/prestera/prestera_flower.c index 921959a980ee..c12b09ac6559 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_flower.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_flower.c @@ -70,6 +70,24 @@ static int prestera_flower_parse_actions(struct prestera_flow_block *block, if (!flow_action_has_entries(flow_action)) return 0; + if (!flow_action_mixed_hw_stats_check(flow_action, extack)) + return -EOPNOTSUPP; + + act = flow_action_first_entry_get(flow_action); + if (act->hw_stats & FLOW_ACTION_HW_STATS_DISABLED) { + /* Nothing to do */ + } else if (act->hw_stats & FLOW_ACTION_HW_STATS_DELAYED) { + /* setup counter first */ + rule->re_arg.count.valid = true; + err = prestera_acl_chain_to_client(chain_index, + &rule->re_arg.count.client); + if (err) + return err; + } else { + NL_SET_ERR_MSG_MOD(extack, "Unsupported action HW stats type"); + return -EOPNOTSUPP; + } + flow_action_for_each(i, act, flow_action) { switch (act->id) { case FLOW_ACTION_ACCEPT: -- 2.7.4