A flower filter on a block shared across ports is offloaded as one hardware rule per port, all carrying the same classifier cookie. Deletion looked a rule up by cookie alone and could take another port's copy: with skip_sw, a filter silently stopped being enforced on a still-bound port, while the detached port kept enforcing it. Delete the rule matching the port being unbound instead. Fixes: 8eb9e7520b17 ("net: dsa: yt921x: Add ACL support") Signed-off-by: David Yang --- drivers/net/dsa/motorcomm/tc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/motorcomm/tc.c b/drivers/net/dsa/motorcomm/tc.c index 429345ad1eda..e3f057ed580f 100644 --- a/drivers/net/dsa/motorcomm/tc.c +++ b/drivers/net/dsa/motorcomm/tc.c @@ -1226,7 +1226,7 @@ static u16 yt921x_acl_activated_ports(const struct yt921x_priv *priv) static unsigned int yt921x_acl_find(const struct yt921x_priv *priv, enum tc_setup_type type, - unsigned long tag) + unsigned long tag, u16 ports_mask) { for (unsigned int blkid = 0; blkid < YT921X_ACL_BLK_NUM; blkid++) { const struct yt921x_acl_blk *aclblk = priv->acl_blks[blkid]; @@ -1236,7 +1236,10 @@ yt921x_acl_find(const struct yt921x_priv *priv, enum tc_setup_type type, for (unsigned int i = 0; i < YT921X_ACL_ENT_PER_BLK; i++) if (aclblk->rules[i] && aclblk->rules[i]->tag == tag && - aclblk->rules[i]->type == type) + aclblk->rules[i]->type == type && + FIELD_GET(YT921X_ACL_KEYb_SPORTS_M, + aclblk->rules[i]->entries[0].key[1]) == + ports_mask) return YT921X_ACL_ENT_PER_BLK * blkid + i; } @@ -1364,7 +1367,7 @@ yt921x_acl_commit(struct yt921x_priv *priv, unsigned int entid, u8 entsmask) static int yt921x_acl_del(struct yt921x_priv *priv, enum tc_setup_type type, - unsigned long tag) + unsigned long tag, u16 ports_mask) { struct yt921x_acl_rule *aclrule; struct yt921x_acl_blk *aclblk; @@ -1378,7 +1381,7 @@ yt921x_acl_del(struct yt921x_priv *priv, enum tc_setup_type type, int res; int ret; - entid = yt921x_acl_find(priv, type, tag); + entid = yt921x_acl_find(priv, type, tag, ports_mask); if (entid == UINT_MAX) return -ENOENT; @@ -1553,7 +1556,7 @@ yt921x_dsa_cls_flower_del(struct dsa_switch *ds, int port, int res; mutex_lock(&priv->reg_lock); - res = yt921x_acl_del(priv, TC_SETUP_CLSFLOWER, cls->cookie); + res = yt921x_acl_del(priv, TC_SETUP_CLSFLOWER, cls->cookie, BIT(port)); mutex_unlock(&priv->reg_lock); return res; -- 2.53.0