Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1710854pxy; Mon, 2 Aug 2021 08:24:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZBCXZ+ObdWvdicjySI9LB++AMuL7c00+3hQNKYU94oieRlr79E6DHn/wgkgTRC195RH1v X-Received: by 2002:a05:6e02:198f:: with SMTP id g15mr1464152ilf.120.1627917873112; Mon, 02 Aug 2021 08:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627917873; cv=none; d=google.com; s=arc-20160816; b=YZefIUTCl91sQ267g60EsQyfZi8PESB4QSF8Z118VFb934qHezxFtSO8KbaUk5DBN6 6e+JZUMGnq6tVpJ6vYNW5ELchUv+OcaLtPTm3UCy42840hTzE4RqYUKx01btT6nZVOX/ fjfaWkXQ1e41ZOvSGTE6X1JkCe7lrNOhQ/KBXwcs8OXZQBvYso5HmEMGmF25yHZf1khz 869jb4G2hEilLPpQ1Yw05ovzsyYQemwIFpyAr4NmrV/bD35kTxkLbUj2RrQgI1zE2M3E HpTXrq/+BFcINnufQYLNOo5uC0rTtKbMj8cGH2YjXYf6fltcTCSzH+31ybRSDfF/9mjP qW3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=h1Eq7OAnpvENWQb1PTCF+iVNX7OWS8rEGj8fuJ0u4vs=; b=j0SILiSvZKRYjvsXSaXKfh3jJmv9o2H3WV3xKUIkN6RsmieiClkjck9zHgwMQjk+rM 6iJj4CSXiqyXhDfIBcVuKgRpU2kuTaec6kl/oYBdkYsZ/hE+cp9+fzpx6gvHCYg6qMTv d9E1WYUUG5aiy8fpHynuK1nKImlYy9sB03atXEJMKvJMFTHwRYHw0w2uDlDQuX+jGiwV uK1//yKgrkiSoEzR6L/a8zw2SVHuQNYXQpAP/0UupVF9atA/7BU1nmse3kxgNeLCdqaD zhDlru+hhRlHaEgKJk00BTBymWozY31ir+ljOnpbHTiVIJUH1Aul/41hV3N66otNhefx +MAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LCi7zFly; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t8si12586556ils.46.2021.08.02.08.24.21; Mon, 02 Aug 2021 08:24:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LCi7zFly; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235038AbhHBPXQ (ORCPT + 99 others); Mon, 2 Aug 2021 11:23:16 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:55801 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235029AbhHBPXP (ORCPT ); Mon, 2 Aug 2021 11:23:15 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id E6E1C580CB7; Mon, 2 Aug 2021 11:23:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 02 Aug 2021 11:23:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=h1Eq7O AnpvENWQb1PTCF+iVNX7OWS8rEGj8fuJ0u4vs=; b=LCi7zFlyvxxpGURjsqMB+V gNOVr8ofKhz09x8ju6D6ikV5eQA2M20LZdwPWMHZcRHGtU27lqCnMLznDpG1PWE/ yYyTvsBQ65vLS5+PG4p2rkmbmFOdF8UC/7G7uFLwk2QjpzI+uyHDatDBq94Iz0Oa 6MftU6DKYrgEhB4RMyC+fxGIYWKtQsqYiVTAs0iJfzSazzwQQGbiIaIV+/oVZViZ Q+tB8QRvNvfJpuebHRBmQelWa6bHTnu4/lVlJO5tdH2YJQ+TuS+jKgtzBfWWpMS8 03T22ReQcZ4gOG45qCYQsyrmiLfI++9QbMTbXqMn0rSvCziLfNpukUd13WnCDcKQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddriedvgdekvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepkfguohcuufgt hhhimhhmvghluceoihguohhstghhsehiughoshgthhdrohhrgheqnecuggftrfgrthhtvg hrnheptdffkeekfeduffevgeeujeffjefhtefgueeugfevtdeiheduueeukefhudehleet necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihguoh hstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Aug 2021 11:23:04 -0400 (EDT) Date: Mon, 2 Aug 2021 18:23:01 +0300 From: Ido Schimmel To: Vadym Kochan Cc: "David S. Miller" , Jakub Kicinski , Jamal Hadi Salim , Cong Wang , Andrew Lunn , Vladimir Oltean , Serhiy Boiko , Volodymyr Mytnyk , Taras Chornyi , Taras Chornyi , Mickey Rachamim , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Volodymyr Mytnyk , Vadym Kochan Subject: Re: [PATCH net-next v2 4/4] net: marvell: prestera: Offload FLOW_ACTION_POLICE Message-ID: References: <20210802140849.2050-1-vadym.kochan@plvision.eu> <20210802140849.2050-5-vadym.kochan@plvision.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210802140849.2050-5-vadym.kochan@plvision.eu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 02, 2021 at 05:08:49PM +0300, Vadym Kochan wrote: > diff --git a/drivers/net/ethernet/marvell/prestera/prestera_flower.c b/drivers/net/ethernet/marvell/prestera/prestera_flower.c > index e571ba09ec08..76f30856ac98 100644 > --- a/drivers/net/ethernet/marvell/prestera/prestera_flower.c > +++ b/drivers/net/ethernet/marvell/prestera/prestera_flower.c > @@ -5,6 +5,8 @@ > #include "prestera_acl.h" > #include "prestera_flower.h" > > +#define PRESTERA_HW_TC_NUM 8 > + > static int prestera_flower_parse_actions(struct prestera_flow_block *block, > struct prestera_acl_rule *rule, > struct flow_action *flow_action, > @@ -30,6 +32,11 @@ static int prestera_flower_parse_actions(struct prestera_flow_block *block, > case FLOW_ACTION_TRAP: > a_entry.id = PRESTERA_ACL_RULE_ACTION_TRAP; > break; > + case FLOW_ACTION_POLICE: > + a_entry.id = PRESTERA_ACL_RULE_ACTION_POLICE; > + a_entry.police.rate = act->police.rate_bytes_ps; > + a_entry.police.burst = act->police.burst; If packet rate based policing is not supported, an error should be returned here with extack. It seems the implementation assumes that each rule has a different policer, so an error should be returned in case the same policer is shared between different rules. > + break; > default: > NL_SET_ERR_MSG_MOD(extack, "Unsupported action"); > pr_err("Unsupported action\n"); > @@ -110,6 +117,17 @@ static int prestera_flower_parse(struct prestera_flow_block *block, > return -EOPNOTSUPP; > } > > + if (f->classid) { > + int hw_tc = __tc_classid_to_hwtc(PRESTERA_HW_TC_NUM, f->classid); > + > + if (hw_tc < 0) { > + NL_SET_ERR_MSG_MOD(f->common.extack, "Unsupported HW TC"); > + return hw_tc; > + } > + > + prestera_acl_rule_hw_tc_set(rule, hw_tc); > + } Not sure what this is. Can you show a command line example of how this is used? What about visibility regarding number of packets that were dropped by the policer?