OSDN Git Service

net: Add extack argument to ndo_fdb_add()
authorPetr Machata <petrm@mellanox.com>
Wed, 16 Jan 2019 23:06:50 +0000 (23:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Jan 2019 23:18:47 +0000 (15:18 -0800)
Drivers may not be able to support certain FDB entries, and an error
code is insufficient to give clear hints as to the reasons of rejection.

In order to make it possible to communicate the rejection reason, extend
ndo_fdb_add() with an extack argument. Adapt the existing
implementations of ndo_fdb_add() to take the parameter (and ignore it).
Pass the extack parameter when invoking ndo_fdb_add() from rtnl_fdb_add().

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 files changed:
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/ice/ice_main.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
drivers/net/macvlan.c
drivers/net/vxlan.c
include/linux/netdevice.h
net/bridge/br_fdb.c
net/bridge/br_private.h
net/core/rtnetlink.c
net/dsa/dsa_priv.h
net/dsa/slave.c

index f52e2c4..0ee641c 100644 (file)
@@ -11644,7 +11644,8 @@ static int i40e_get_phys_port_id(struct net_device *netdev,
 static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                            struct net_device *dev,
                            const unsigned char *addr, u16 vid,
-                           u16 flags)
+                           u16 flags,
+                           struct netlink_ext_ack *extack)
 {
        struct i40e_netdev_priv *np = netdev_priv(dev);
        struct i40e_pf *pf = np->vsi->back;
index f4bf6bd..48f0339 100644 (file)
@@ -2438,7 +2438,8 @@ static void ice_set_rx_mode(struct net_device *netdev)
  */
 static int ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[],
                       struct net_device *dev, const unsigned char *addr,
-                      u16 vid, u16 flags)
+                      u16 vid, u16 flags,
+                      struct netlink_ext_ack *extack)
 {
        int err;
 
index 87bdf16..3615e2e 100644 (file)
@@ -2486,7 +2486,8 @@ static int igb_set_features(struct net_device *netdev,
 static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                           struct net_device *dev,
                           const unsigned char *addr, u16 vid,
-                          u16 flags)
+                          u16 flags,
+                          struct netlink_ext_ack *extack)
 {
        /* guarantee we can provide a unique filter for the unicast address */
        if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) {
index daff818..b53087a 100644 (file)
@@ -9910,7 +9910,8 @@ static void ixgbe_del_udp_tunnel_port(struct net_device *dev,
 static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                             struct net_device *dev,
                             const unsigned char *addr, u16 vid,
-                            u16 flags)
+                            u16 flags,
+                            struct netlink_ext_ack *extack)
 {
        /* guarantee we can provide a unique filter for the unicast address */
        if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) {
index 215a453..c6a575e 100644 (file)
@@ -721,7 +721,8 @@ static void ocelot_get_stats64(struct net_device *dev,
 
 static int ocelot_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                          struct net_device *dev, const unsigned char *addr,
-                         u16 vid, u16 flags)
+                         u16 vid, u16 flags,
+                         struct netlink_ext_ack *extack)
 {
        struct ocelot_port *port = netdev_priv(dev);
        struct ocelot *ocelot = port->ocelot;
index 16d0479..7a87300 100644 (file)
@@ -396,7 +396,8 @@ static int qlcnic_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
 
 static int qlcnic_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                        struct net_device *netdev,
-                       const unsigned char *addr, u16 vid, u16 flags)
+                       const unsigned char *addr, u16 vid, u16 flags,
+                       struct netlink_ext_ack *extack)
 {
        struct qlcnic_adapter *adapter = netdev_priv(netdev);
        int err = 0;
index fc726ce..084a1b3 100644 (file)
@@ -963,7 +963,8 @@ static int macvlan_vlan_rx_kill_vid(struct net_device *dev,
 static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                           struct net_device *dev,
                           const unsigned char *addr, u16 vid,
-                          u16 flags)
+                          u16 flags,
+                          struct netlink_ext_ack *extack)
 {
        struct macvlan_dev *vlan = netdev_priv(dev);
        int err = -EINVAL;
index 83f65eb..11f38fd 100644 (file)
@@ -1087,7 +1087,8 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 /* Add static entry (via netlink) */
 static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                         struct net_device *dev,
-                        const unsigned char *addr, u16 vid, u16 flags)
+                        const unsigned char *addr, u16 vid, u16 flags,
+                        struct netlink_ext_ack *extack)
 {
        struct vxlan_dev *vxlan = netdev_priv(dev);
        /* struct net *net = dev_net(vxlan->dev); */
index 1377d08..a57b9a8 100644 (file)
@@ -1152,7 +1152,8 @@ struct dev_ifalias {
  *
  * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[],
  *                   struct net_device *dev,
- *                   const unsigned char *addr, u16 vid, u16 flags)
+ *                   const unsigned char *addr, u16 vid, u16 flags,
+ *                   struct netlink_ext_ack *extack);
  *     Adds an FDB entry to dev for addr.
  * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],
  *                   struct net_device *dev,
@@ -1376,7 +1377,8 @@ struct net_device_ops {
                                               struct net_device *dev,
                                               const unsigned char *addr,
                                               u16 vid,
-                                              u16 flags);
+                                              u16 flags,
+                                              struct netlink_ext_ack *extack);
        int                     (*ndo_fdb_del)(struct ndmsg *ndm,
                                               struct nlattr *tb[],
                                               struct net_device *dev,
index fe3c758..6664cb8 100644 (file)
@@ -915,7 +915,8 @@ static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge *br,
 /* Add new permanent fdb entry with RTM_NEWNEIGH */
 int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
               struct net_device *dev,
-              const unsigned char *addr, u16 vid, u16 nlh_flags)
+              const unsigned char *addr, u16 vid, u16 nlh_flags,
+              struct netlink_ext_ack *extack)
 {
        struct net_bridge_vlan_group *vg;
        struct net_bridge_port *p = NULL;
index eabf8bf..00deef7 100644 (file)
@@ -573,7 +573,8 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
 int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
                  struct net_device *dev, const unsigned char *addr, u16 vid);
 int br_fdb_add(struct ndmsg *nlh, struct nlattr *tb[], struct net_device *dev,
-              const unsigned char *addr, u16 vid, u16 nlh_flags);
+              const unsigned char *addr, u16 vid, u16 nlh_flags,
+              struct netlink_ext_ack *extack);
 int br_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
                struct net_device *dev, struct net_device *fdev, int *idx);
 int br_fdb_get(struct sk_buff *skb, struct nlattr *tb[], struct net_device *dev,
index 5ea1bed..b302df0 100644 (file)
@@ -3639,7 +3639,7 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
                const struct net_device_ops *ops = br_dev->netdev_ops;
 
                err = ops->ndo_fdb_add(ndm, tb, dev, addr, vid,
-                                      nlh->nlmsg_flags);
+                                      nlh->nlmsg_flags, extack);
                if (err)
                        goto out;
                else
@@ -3651,7 +3651,8 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
                if (dev->netdev_ops->ndo_fdb_add)
                        err = dev->netdev_ops->ndo_fdb_add(ndm, tb, dev, addr,
                                                           vid,
-                                                          nlh->nlmsg_flags);
+                                                          nlh->nlmsg_flags,
+                                                          extack);
                else
                        err = ndo_dflt_fdb_add(ndm, tb, dev, addr, vid,
                                               nlh->nlmsg_flags);
index 026a057..1f4972d 100644 (file)
@@ -103,7 +103,8 @@ static inline void dsa_legacy_unregister(void) { }
 int dsa_legacy_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                       struct net_device *dev,
                       const unsigned char *addr, u16 vid,
-                      u16 flags);
+                      u16 flags,
+                      struct netlink_ext_ack *extack);
 int dsa_legacy_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
                       struct net_device *dev,
                       const unsigned char *addr, u16 vid);
index a3fcc1d..d5680a9 100644 (file)
@@ -1009,7 +1009,8 @@ static const struct ethtool_ops dsa_slave_ethtool_ops = {
 int dsa_legacy_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
                       struct net_device *dev,
                       const unsigned char *addr, u16 vid,
-                      u16 flags)
+                      u16 flags,
+                      struct netlink_ext_ack *extack)
 {
        struct dsa_port *dp = dsa_slave_to_port(dev);