@@ -13126,6 +13126,9 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
if (err == -EEXIST && !(flags & NLM_F_EXCL))
err = 0;
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH, ndm->ndm_state);
+
return err;
}
@@ -6154,6 +6154,9 @@ ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[],
if (err == -EEXIST && !(flags & NLM_F_EXCL))
err = 0;
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH, ndm->ndm_state);
+
return err;
}
@@ -737,8 +737,14 @@ static int ocelot_port_fdb_add(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_add(ocelot, port, addr, vid, ocelot_port->bridge);
+ err = ocelot_fdb_add(ocelot, port, addr, vid, ocelot_port->bridge);
+
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH, ndm->ndm_state);
+
+ return err;
}
static int ocelot_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
@@ -409,7 +409,7 @@ static int qlcnic_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
}
if (ether_addr_equal(addr, adapter->mac_addr))
- return err;
+ goto out;
if (is_unicast_ether_addr(addr)) {
if (netdev_uc_count(netdev) < adapter->ahw->max_uc_count)
@@ -422,6 +422,11 @@ static int qlcnic_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
err = -EINVAL;
}
+out:
+ if (!err)
+ rtnl_fdb_notify(netdev, addr, vid, RTM_NEWNEIGH,
+ ndm->ndm_state);
+
return err;
}
@@ -1044,6 +1044,9 @@ static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
else if (is_multicast_ether_addr(addr))
err = dev_mc_add_excl(dev, addr);
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH, ndm->ndm_state);
+
return err;
}
@@ -1247,6 +1247,9 @@ struct netdev_net_notifier {
* const unsigned char *addr, u16 vid, u16 flags,
* struct netlink_ext_ack *extack);
* Adds an FDB entry to dev for addr.
+ * Callee is responsible for sending appropriate notification. The helper
+ * rtnl_fdb_notify() can be invoked to send a generic notification in case
+ * the driver does not need to customize the notification.
* int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],
* struct net_device *dev,
* const unsigned char *addr, u16 vid)
@@ -4376,6 +4376,9 @@ int ndo_dflt_fdb_add(struct ndmsg *ndm,
if (err == -EEXIST && !(flags & NLM_F_EXCL))
err = 0;
+ if (!err)
+ rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH, ndm->ndm_state);
+
return err;
}
EXPORT_SYMBOL(ndo_dflt_fdb_add);
@@ -4473,11 +4476,8 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
err = ndo_dflt_fdb_add(ndm, tb, dev, addr, vid,
nlh->nlmsg_flags);
- if (!err) {
- rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH,
- ndm->ndm_state);
+ if (!err)
ndm->ndm_flags &= ~NTF_SELF;
- }
}
out:
return err;