From: "Volodymyr Mytnyk [C]" <vmytnyk@marvell.com>
To: Ido Schimmel <idosch@idosch.org>,
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 [C]" <tchornyi@marvell.com>,
Mickey Rachamim <mickeyr@marvell.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Vadym Kochan [C]" <vkochan@marvell.com>
Subject: Re: [PATCH net-next v2 4/4] net: marvell: prestera: Offload FLOW_ACTION_POLICE
Date: Tue, 3 Aug 2021 16:19:03 +0000 [thread overview]
Message-ID: <SJ0PR18MB4009243B42CB9A03C2C35647B2F09@SJ0PR18MB4009.namprd18.prod.outlook.com> (raw)
In-Reply-To: <YQgN1djql6wOk8dc@shredder>
Hi Ido,
Thanks for the review. Pls see the comments inline.
> 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.
Agree, it makes sense.
>
> 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.
Each rule has a different policer assigned by HW. Do you mean the police.index should be checked here ?
>
> > + 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?
This is HW traffic class used for packets that are trapped to CPU port. The usage is as the following:
tc qdisc add dev DEV clsact
tc filter add dev DEV ingress flower skip_sw dst_mac 00:AA:AA:AA:AA:00 hw_tc 1 action trap
>
> What about visibility regarding number of packets that were dropped by
> the policer?
This is not support at this moment by the driver, so it is always zero now.
next prev parent reply other threads:[~2021-08-03 16:19 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
2021-08-03 16:19 ` Volodymyr Mytnyk [C] [this message]
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=SJ0PR18MB4009243B42CB9A03C2C35647B2F09@SJ0PR18MB4009.namprd18.prod.outlook.com \
--to=vmytnyk@marvell.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=idosch@idosch.org \
--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=volodymyr.mytnyk@plvision.eu \
--cc=xiyou.wangcong@gmail.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).