summaryrefslogtreecommitdiff
path: root/net/bridge/br_if.c
diff options
context:
space:
mode:
authorTobias Waldekranz <tobias@waldekranz.com>2021-07-21 19:24:00 +0300
committerDavid S. Miller <davem@davemloft.net>2021-07-22 10:26:23 +0300
commit8582661048eb64341edf73dd2ca828b4f039c5c2 (patch)
treeece8b1dcaf1c398f100ee29f5e4629918649c4ce /net/bridge/br_if.c
parentf7cf972f9375388838b0fbdaa007ce8494646990 (diff)
downloadlinux-8582661048eb64341edf73dd2ca828b4f039c5c2.tar.xz
net: bridge: switchdev: recycle unused hwdoms
Since hwdoms have only been used thus far for equality comparisons, the bridge has used the simplest possible assignment policy; using a counter to keep track of the last value handed out. With the upcoming transmit offloading, we need to perform set operations efficiently based on hwdoms, e.g. we want to answer questions like "has this skb been forwarded to any port within this hwdom?" Move to a bitmap-based allocation scheme that recycles hwdoms once all members leaves the bridge. This means that we can use a single unsigned long to keep track of the hwdoms that have received an skb. v1->v2: convert the typedef DECLARE_BITMAP(br_hwdom_map_t, BR_HWDOM_MAX) into a plain unsigned long. v2->v6: none Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r--net/bridge/br_if.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 838a277e3cf7..c0df50e4abbb 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -349,6 +349,7 @@ static void del_nbp(struct net_bridge_port *p)
nbp_backup_clear(p);
nbp_update_port_count(br);
+ nbp_switchdev_del(p);
netdev_upper_dev_unlink(dev, br->dev);
@@ -643,7 +644,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
if (err)
goto err5;
- err = nbp_switchdev_hwdom_set(p);
+ err = nbp_switchdev_add(p);
if (err)
goto err6;
@@ -719,6 +720,7 @@ err7:
list_del_rcu(&p->list);
br_fdb_delete_by_port(br, p, 0, 1);
nbp_update_port_count(br);
+ nbp_switchdev_del(p);
err6:
netdev_upper_dev_unlink(dev, br->dev);
err5: