[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DB8PR04MB57852F0E658C57DD4B0B76E2F0C09@DB8PR04MB5785.eurprd04.prod.outlook.com>
Date: Thu, 19 Aug 2021 10:00:43 +0000
From: Xiaoliang Yang <xiaoliang.yang_1@....com>
To: Vladimir Oltean <vladimir.oltean@....com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"allan.nielsen@...rochip.com" <allan.nielsen@...rochip.com>,
"joergen.andreasen@...rochip.com" <joergen.andreasen@...rochip.com>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
"vinicius.gomes@...el.com" <vinicius.gomes@...el.com>,
"michael.chan@...adcom.com" <michael.chan@...adcom.com>,
"vishal@...lsio.com" <vishal@...lsio.com>,
"saeedm@...lanox.com" <saeedm@...lanox.com>,
"jiri@...lanox.com" <jiri@...lanox.com>,
"idosch@...lanox.com" <idosch@...lanox.com>,
"alexandre.belloni@...tlin.com" <alexandre.belloni@...tlin.com>,
"kuba@...nel.org" <kuba@...nel.org>, Po Liu <po.liu@....com>,
Leo Li <leoyang.li@....com>
Subject: RE: [RFC v2 net-next 4/8] net: mscc: ocelot: add gate and police
action offload to PSFP
Hi Vladimir,
On Wed, Aug 18, 2021 at 23:01:23PM +0800, Vladimir Oltean wrote:
> > @@ -718,6 +734,15 @@ int ocelot_cls_flower_replace(struct ocelot *ocelot,
> int port,
> > if (filter->type == OCELOT_VCAP_FILTER_DUMMY)
> > return ocelot_vcap_dummy_filter_add(ocelot, filter);
> >
> > + if (filter->type == OCELOT_PSFP_FILTER_OFFLOAD) {
> > + kfree(filter);
> > + if (ocelot->ops->psfp_filter_add)
> > + return ocelot->ops->psfp_filter_add(ocelot, f);
> > +
> > + NL_SET_ERR_MSG_MOD(extack, "PSFP chain is not supported in
> HW");
> > + return -EOPNOTSUPP;
> > + }
> > +
> > return ocelot_vcap_filter_add(ocelot, filter, f->common.extack); }
>
> Hmm, I don't really like the idea of allocating an ocelot_vcap_filter which we
> don't need for PSFP filters, just to kfree it later.
>
> Is it that much more complicated to not allocate it at all in the first place, add
> a bunch of "if" conditions that allocate a VCAP filter only if we are offloading a
> VCAP chain?
>
> And that means, don't create ocelot_vcap_filter::type ==
> OCELOT_PSFP_FILTER_OFFLOAD, because PSFP filters are not VCAP filters.
The "vcap filter" variable need to be created and use ocelot_flower_parse() to get the type. If the rule is checked as a OCELOT_VCAP_FILTER_DUMMY, the chain 30000 dummy rule will be added in vcap_dummy_filter. And not offload to PSFP filter function. So I created the "vcap filter" and free it before offload to PSFP filter function.
Thanks,
xiaoliang
Powered by blists - more mailing lists