LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Vadym Kochan <vadym.kochan@plvision.eu>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
Serhiy Boiko <serhiy.boiko@plvision.eu>,
Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu>,
Taras Chornyi <taras.chornyi@plvision.eu>,
Taras Chornyi <tchornyi@marvell.com>,
Mickey Rachamim <mickeyr@marvell.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Volodymyr Mytnyk <vmytnyk@marvell.com>,
Vadym Kochan <vkochan@marvell.com>
Subject: Re: [PATCH net-next v2 4/4] net: marvell: prestera: Offload FLOW_ACTION_POLICE
Date: Mon, 2 Aug 2021 18:23:01 +0300 [thread overview]
Message-ID: <YQgN1djql6wOk8dc@shredder> (raw)
In-Reply-To: <20210802140849.2050-5-vadym.kochan@plvision.eu>
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?
next prev parent reply other threads:[~2021-08-02 15:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 14:08 [PATCH net-next v2 0/4] Marvell Prestera add policer support Vadym Kochan
2021-08-02 14:08 ` [PATCH net-next v2 1/4] net: marvell: prestera: do not fail if FW reply is bigger Vadym Kochan
2021-08-02 14:08 ` [PATCH net-next v2 2/4] net: marvell: prestera: turn FW supported versions into an array Vadym Kochan
2021-08-02 14:08 ` [PATCH net-next v2 3/4] net: sched: introduce __tc_classid_to_hwtc() helper Vadym Kochan
2021-08-02 14:08 ` [PATCH net-next v2 4/4] net: marvell: prestera: Offload FLOW_ACTION_POLICE Vadym Kochan
2021-08-02 15:23 ` Ido Schimmel [this message]
2021-08-03 16:19 ` Volodymyr Mytnyk [C]
2021-08-03 16:46 ` Ido Schimmel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YQgN1djql6wOk8dc@shredder \
--to=idosch@idosch.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mickeyr@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=serhiy.boiko@plvision.eu \
--cc=taras.chornyi@plvision.eu \
--cc=tchornyi@marvell.com \
--cc=vadym.kochan@plvision.eu \
--cc=vkochan@marvell.com \
--cc=vmytnyk@marvell.com \
--cc=volodymyr.mytnyk@plvision.eu \
--cc=xiyou.wangcong@gmail.com \
--subject='Re: [PATCH net-next v2 4/4] net: marvell: prestera: Offload FLOW_ACTION_POLICE' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).