[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <afd2f3b10b077fcf024753eba56580dd086c8548.1729607879.git.petrm@nvidia.com>
Date: Tue, 22 Oct 2024 16:50:14 +0200
From: Petr Machata <petrm@...dia.com>
To: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, <netdev@...r.kernel.org>
CC: Ido Schimmel <idosch@...dia.com>, Petr Machata <petrm@...dia.com>, "Amit
Cohen" <amcohen@...dia.com>, Vladimir Oltean <vladimir.oltean@....com>,
<mlxsw@...dia.com>, Przemek Kitszel <przemyslaw.kitszel@...el.com>,
<intel-wired-lan@...ts.osuosl.org>, <UNGLinuxDriver@...rochip.com>, "Manish
Chopra" <manishc@...vell.com>, <GR-Linux-NIC-Dev@...vell.com>, "Kuniyuki
Iwashima" <kuniyu@...zon.com>, Andrew Lunn <andrew+netdev@...n.ch>
Subject: [PATCH net-next 3/8] ndo_fdb_del: Shift responsibility for notifying to drivers
As described in the previous patch, the drivers that provide their own
fdb_add and fdb_del callbacks should from now on be responsible for sending
the notification themselves. In this patch, implement the fdb_del leg of
the change.
Signed-off-by: Petr Machata <petrm@...dia.com>
Reviewed-by: Amit Cohen <amcohen@...dia.com>
---
CC: Przemek Kitszel <przemyslaw.kitszel@...el.com>
CC: intel-wired-lan@...ts.osuosl.org
CC: UNGLinuxDriver@...rochip.com
CC: Manish Chopra <manishc@...vell.com>
CC: GR-Linux-NIC-Dev@...vell.com
CC: Kuniyuki Iwashima <kuniyu@...zon.com>
CC: Andrew Lunn <andrew+netdev@...n.ch>
---
drivers/net/ethernet/intel/ice/ice_main.c | 3 +++
drivers/net/ethernet/mscc/ocelot_net.c | 8 +++++++-
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 4 ++++
drivers/net/macvlan.c | 3 +++
include/linux/netdevice.h | 2 ++
net/core/rtnetlink.c | 9 ++++-----
6 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index a3398814a1cb..65f9dcf4745b 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -6188,6 +6188,9 @@ ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[],
else
err = -EINVAL;
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH, ndm->ndm_state);
+
return err;
}
diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c
index cf972444e254..12958d985fd7 100644
--- a/drivers/net/ethernet/mscc/ocelot_net.c
+++ b/drivers/net/ethernet/mscc/ocelot_net.c
@@ -756,8 +756,14 @@ static int ocelot_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
struct ocelot_port *ocelot_port = &priv->port;
struct ocelot *ocelot = ocelot_port->ocelot;
int port = priv->port.index;
+ int err;
- return ocelot_fdb_del(ocelot, port, addr, vid, ocelot_port->bridge);
+ err = ocelot_fdb_del(ocelot, port, addr, vid, ocelot_port->bridge);
+
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH, ndm->ndm_state);
+
+ return err;
}
static int ocelot_port_fdb_do_dump(const unsigned char *addr, u16 vid,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 1de0290e15e0..db847aed5222 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -388,6 +388,10 @@ static int qlcnic_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
err = -EINVAL;
}
}
+
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH, ndm->ndm_state);
+
return err;
}
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index b1e828581ec4..2c61b7b83875 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -1069,6 +1069,9 @@ static int macvlan_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
else if (is_multicast_ether_addr(addr))
err = dev_mc_del(dev, addr);
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH, ndm->ndm_state);
+
return err;
}
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9f7de8d0414a..9e1ffb21de18 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1254,6 +1254,8 @@ struct netdev_net_notifier {
* struct net_device *dev,
* const unsigned char *addr, u16 vid)
* Deletes the FDB entry from dev corresponding to addr.
+ * Callee is responsible for sending appropriate notification, as with
+ * ndo_fdb_add().
* int (*ndo_fdb_del_bulk)(struct nlmsghdr *nlh, struct net_device *dev,
* struct netlink_ext_ack *extack);
* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a9f56a50fa57..4788bfc58aa2 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -4506,6 +4506,9 @@ int ndo_dflt_fdb_del(struct ndmsg *ndm,
else if (is_multicast_ether_addr(addr))
err = dev_mc_del(dev, addr);
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH, ndm->ndm_state);
+
return err;
}
EXPORT_SYMBOL(ndo_dflt_fdb_del);
@@ -4604,12 +4607,8 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
err = ops->ndo_fdb_del_bulk(nlh, dev, extack);
}
- if (!err) {
- if (!del_bulk)
- rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH,
- ndm->ndm_state);
+ if (!err)
ndm->ndm_flags &= ~NTF_SELF;
- }
}
out:
return err;
--
2.45.0
Powered by blists - more mailing lists