The previous patch made the notifications resulting from adding, replacing and deleting bridge and VXLAN FDB entries carry the port ID of the requester in nlmsg_pid. Bulk deletion (flush) does not go through ndo_fdb_del, and thus does not take struct ndo_fdb_parms, but goes through ndo_fdb_del_bulk instead, and still reports zero. Add a port ID argument to ndo_fdb_del_bulk, and pass the port ID of the requester from rtnl_fdb_del(). The bridge and VXLAN implementations pass it on to the flush helpers, which already know how to use it. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel Reviewed-by: Nikolay Aleksandrov --- drivers/net/vxlan/vxlan_core.c | 4 ++-- include/linux/netdevice.h | 3 ++- net/bridge/br_fdb.c | 4 ++-- net/bridge/br_private.h | 2 +- net/core/rtnetlink.c | 6 ++++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 9df9f7a8cde7..8725ddd9f79c 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -3208,7 +3208,7 @@ static const struct nla_policy vxlan_del_bulk_policy[NDA_MAX + 1] = { NTF_ROUTER) static int vxlan_fdb_delete_bulk(struct nlmsghdr *nlh, struct net_device *dev, - struct netlink_ext_ack *extack) + u32 portid, struct netlink_ext_ack *extack) { struct vxlan_dev *vxlan = netdev_priv(dev); struct vxlan_fdb_flush_desc desc = {}; @@ -3266,7 +3266,7 @@ static int vxlan_fdb_delete_bulk(struct nlmsghdr *nlh, struct net_device *dev, desc.dst_ip = ip; } - vxlan_flush(vxlan, &desc, 0); + vxlan_flush(vxlan, &desc, portid); return 0; } diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 233584013fc9..b2846b586a7f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1358,7 +1358,7 @@ struct ndo_fdb_parms { * Callee shall set *notified to true if it sent any appropriate * notification(s). Otherwise core will send a generic one. * int (*ndo_fdb_del_bulk)(struct nlmsghdr *nlh, struct net_device *dev, - * struct netlink_ext_ack *extack); + * u32 portid, struct netlink_ext_ack *extack); * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, * struct net_device *dev, struct net_device *filter_dev, * int *idx) @@ -1638,6 +1638,7 @@ struct net_device_ops { struct netlink_ext_ack *extack); int (*ndo_fdb_del_bulk)(struct nlmsghdr *nlh, struct net_device *dev, + u32 portid, struct netlink_ext_ack *extack); int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 3712e6db90f0..6b1c067974ff 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -797,7 +797,7 @@ static const struct nla_policy br_fdb_del_bulk_policy[NDA_MAX + 1] = { }; int br_fdb_delete_bulk(struct nlmsghdr *nlh, struct net_device *dev, - struct netlink_ext_ack *extack) + u32 portid, struct netlink_ext_ack *extack) { struct net_bridge_fdb_flush_desc desc = {}; struct ndmsg *ndm = nlmsg_data(nlh); @@ -864,7 +864,7 @@ int br_fdb_delete_bulk(struct nlmsghdr *nlh, struct net_device *dev, br_debug(br, "flushing port ifindex: %d vlan id: %u flags: 0x%lx flags mask: 0x%lx\n", desc.port_ifindex, desc.vlan_id, desc.flags, desc.flags_mask); - br_fdb_flush(br, &desc, 0); + br_fdb_flush(br, &desc, portid); return 0; } diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 4bb45f2baabc..5166ce9606fa 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -1023,7 +1023,7 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], const struct ndo_fdb_parms *parms, bool *notified, struct netlink_ext_ack *extack); int br_fdb_delete_bulk(struct nlmsghdr *nlh, struct net_device *dev, - struct netlink_ext_ack *extack); + u32 portid, struct netlink_ext_ack *extack); int br_fdb_add(struct ndmsg *nlh, struct nlattr *tb[], const struct ndo_fdb_parms *parms, bool *notified, struct netlink_ext_ack *extack); diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index e0d411c251aa..e1607a3232c7 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -5001,7 +5001,8 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, ¬ified, extack); } else { if (ops->ndo_fdb_del_bulk) - err = ops->ndo_fdb_del_bulk(nlh, dev, extack); + err = ops->ndo_fdb_del_bulk(nlh, dev, portid, + extack); } if (err) @@ -5025,7 +5026,8 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, /* in case err was cleared by NTF_MASTER call */ err = -EOPNOTSUPP; if (ops->ndo_fdb_del_bulk) - err = ops->ndo_fdb_del_bulk(nlh, dev, extack); + err = ops->ndo_fdb_del_bulk(nlh, dev, portid, + extack); } if (!err) { -- 2.56.1