Thread (17 messages) flat view 17 messages, 2 authors, 2021-08-19

Re: [RFC v2 net-next 4/8] net: mscc: ocelot: add gate and police action offload to PSFP

From: Vladimir Oltean <vladimir.oltean@nxp.com>
Date: 2021-08-18 15:01:01
Also in: lkml

On Wed, Aug 18, 2021 at 02:19:18PM +0800, Xiaoliang Yang wrote:
quoted hunk ↗ jump to hunk
@@ -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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help