]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
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 f52e2c46e6a7b2beeafcb4b0c5c035afece68fcf..0ee641c41be4b6860dd68bfc7aee77768b75aad0 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 f4bf6bda32a90103228a00801c28cffca0169fd9..48f033928aa207d715ce7f56fd10a8bca24201b1 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 87bdf1604ae2c5933e18827a0a7d5ad02942b936..3615e2e52399e79daa0f30a3ef8dc4ded468ea7b 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 daff8183534b96b1aa3dbaaf482d5d7c5101c1f9..b53087a980ef481ef4ca05a1d4d7cf4e04269164 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 215a45374d7b08d6a05d7efe6a62b14e24dae075..c6a575eb0ff5e32dda9ff88cf4880227411176ca 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 16d0479f68913418b95fcc3db9776ca3d14220fd..7a873002e6263d955c88775f1ee380d0fba98dae 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 fc726ce4c164efaa30e713529f217a40c548a9ec..084a1b3fbc80b96777c7e6dc22e50931c4a440e3 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 83f65eb3085f913bcf4e419a1a435665a1589d80..11f38fd71678410d2b8f0201d81b44174dee3a84 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 1377d085ef99d64bd2eb07b93f57bb07ef7986ee..a57b9a853aab7e65e99b2b36a2135d303f3ee3e3 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 fe3c758791ca99671d57b151b656e72cba38a718..6664cb8590f8fdf381d7cbf42341f002d57d24e9 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 eabf8bf28a3f1fd5909b17ebe9fb00caace24881..00deef7fc1f303656b8f7c7ce7b094ba6194944a 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 5ea1bed08edef2cc5a35c95130165eba39968710..b302df0cd5aecd481ede62a8ec76694d8b6c44e4 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 026a05774bf7973881f817cc9cbbb6461a3c1ff1..1f4972dab9f2f8fe6554ca1c82306db6cd65adf4 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 a3fcc1d016153c03bd2ec34a738e29b3ecdae9b0..d5680a98a7f021c408d51c057ad4ee5f4cea8307 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);