lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 2 Aug 2021 18:23:01 +0300 From: Ido Schimmel <idosch@...sch.org> To: Vadym Kochan <vadym.kochan@...ision.eu> Cc: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Jamal Hadi Salim <jhs@...atatu.com>, Cong Wang <xiyou.wangcong@...il.com>, Andrew Lunn <andrew@...n.ch>, Vladimir Oltean <olteanv@...il.com>, Serhiy Boiko <serhiy.boiko@...ision.eu>, Volodymyr Mytnyk <volodymyr.mytnyk@...ision.eu>, Taras Chornyi <taras.chornyi@...ision.eu>, Taras Chornyi <tchornyi@...vell.com>, Mickey Rachamim <mickeyr@...vell.com>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org, Volodymyr Mytnyk <vmytnyk@...vell.com>, Vadym Kochan <vkochan@...vell.com> Subject: Re: [PATCH net-next v2 4/4] net: marvell: prestera: Offload FLOW_ACTION_POLICE 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?
Powered by blists - more mailing lists