]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
net: mscc: ocelot: fix VCAP filters remaining active after being deleted
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 30 Sep 2021 12:53:30 +0000 (15:53 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 1 Oct 2021 22:13:20 +0000 (15:13 -0700)
When ocelot_flower.c calls ocelot_vcap_filter_add(), the filter has a
given filter->id.cookie. This filter is added to the block->rules list.

However, when ocelot_flower.c calls ocelot_vcap_block_find_filter_by_id()
which passes the cookie as argument, the filter is never found by
filter->id.cookie when searching through the block->rules list.

This is unsurprising, since the filter->id.cookie is an unsigned long,
but the cookie argument provided to ocelot_vcap_block_find_filter_by_id()
is a signed int, and the comparison fails.

Fixes: 50c6cc5b9283 ("net: mscc: ocelot: store a namespaced VCAP filter ID")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20210930125330.2078625-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mscc/ocelot_vcap.c
include/soc/mscc/ocelot_vcap.h

index 7945393a06557d972bf8600d6181eada7cfd4892..99d7376a70a748d50d123ace7797a722b5e7f372 100644 (file)
@@ -998,8 +998,8 @@ ocelot_vcap_block_find_filter_by_index(struct ocelot_vcap_block *block,
 }
 
 struct ocelot_vcap_filter *
-ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block, int cookie,
-                                   bool tc_offload)
+ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block,
+                                   unsigned long cookie, bool tc_offload)
 {
        struct ocelot_vcap_filter *filter;
 
index 25fd525aaf92844e75b7e709415a4fdfc530671f..4869ebbd438d9a66c584bce7573ccfa1cba25431 100644 (file)
@@ -694,7 +694,7 @@ int ocelot_vcap_filter_add(struct ocelot *ocelot,
 int ocelot_vcap_filter_del(struct ocelot *ocelot,
                           struct ocelot_vcap_filter *rule);
 struct ocelot_vcap_filter *
-ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block, int id,
-                                   bool tc_offload);
+ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block,
+                                   unsigned long cookie, bool tc_offload);
 
 #endif /* _OCELOT_VCAP_H_ */