Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / drivers / net / ethernet / mellanox / mlx4 / en_netdev.c
index f278b10ef7140a6e195056e11a12075de02afabc..e7e27842d8d4ab0706be9f18ef81e7969b8faf51 100644 (file)
@@ -356,7 +356,8 @@ static void mlx4_en_filter_rfs_expire(struct mlx4_en_priv *priv)
 }
 #endif
 
-static int mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
+static int mlx4_en_vlan_rx_add_vid(struct net_device *dev,
+                                  __be16 proto, u16 vid)
 {
        struct mlx4_en_priv *priv = netdev_priv(dev);
        struct mlx4_en_dev *mdev = priv->mdev;
@@ -381,7 +382,8 @@ static int mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
        return 0;
 }
 
-static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
+static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev,
+                                   __be16 proto, u16 vid)
 {
        struct mlx4_en_priv *priv = netdev_priv(dev);
        struct mlx4_en_dev *mdev = priv->mdev;
@@ -411,8 +413,8 @@ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
 
 static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac)
 {
-       unsigned int i;
-       for (i = ETH_ALEN - 1; i; --i) {
+       int i;
+       for (i = ETH_ALEN - 1; i >= 0; --i) {
                dst_mac[i] = src_mac & 0xff;
                src_mac >>= 8;
        }
@@ -1931,79 +1933,6 @@ static int mlx4_en_set_features(struct net_device *netdev,
 
 }
 
-static int mlx4_en_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
-                          struct net_device *dev,
-                          const unsigned char *addr, u16 flags)
-{
-       struct mlx4_en_priv *priv = netdev_priv(dev);
-       struct mlx4_dev *mdev = priv->mdev->dev;
-       int err;
-
-       if (!mlx4_is_mfunc(mdev))
-               return -EOPNOTSUPP;
-
-       /* Hardware does not support aging addresses, allow only
-        * permanent addresses if ndm_state is given
-        */
-       if (ndm->ndm_state && !(ndm->ndm_state & NUD_PERMANENT)) {
-               en_info(priv, "Add FDB only supports static addresses\n");
-               return -EINVAL;
-       }
-
-       if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr))
-               err = dev_uc_add_excl(dev, addr);
-       else if (is_multicast_ether_addr(addr))
-               err = dev_mc_add_excl(dev, addr);
-       else
-               err = -EINVAL;
-
-       /* Only return duplicate errors if NLM_F_EXCL is set */
-       if (err == -EEXIST && !(flags & NLM_F_EXCL))
-               err = 0;
-
-       return err;
-}
-
-static int mlx4_en_fdb_del(struct ndmsg *ndm,
-                          struct nlattr *tb[],
-                          struct net_device *dev,
-                          const unsigned char *addr)
-{
-       struct mlx4_en_priv *priv = netdev_priv(dev);
-       struct mlx4_dev *mdev = priv->mdev->dev;
-       int err;
-
-       if (!mlx4_is_mfunc(mdev))
-               return -EOPNOTSUPP;
-
-       if (ndm->ndm_state && !(ndm->ndm_state & NUD_PERMANENT)) {
-               en_info(priv, "Del FDB only supports static addresses\n");
-               return -EINVAL;
-       }
-
-       if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr))
-               err = dev_uc_del(dev, addr);
-       else if (is_multicast_ether_addr(addr))
-               err = dev_mc_del(dev, addr);
-       else
-               err = -EINVAL;
-
-       return err;
-}
-
-static int mlx4_en_fdb_dump(struct sk_buff *skb,
-                           struct netlink_callback *cb,
-                           struct net_device *dev, int idx)
-{
-       struct mlx4_en_priv *priv = netdev_priv(dev);
-       struct mlx4_dev *mdev = priv->mdev->dev;
-
-       if (mlx4_is_mfunc(mdev))
-               idx = ndo_dflt_fdb_dump(skb, cb, dev, idx);
-
-       return idx;
-}
-
 static const struct net_device_ops mlx4_netdev_ops = {
        .ndo_open               = mlx4_en_open,
        .ndo_stop               = mlx4_en_close,
@@ -2025,9 +1954,6 @@ static const struct net_device_ops mlx4_netdev_ops = {
 #ifdef CONFIG_RFS_ACCEL
        .ndo_rx_flow_steer      = mlx4_en_filter_rfs,
 #endif
-       .ndo_fdb_add            = mlx4_en_fdb_add,
-       .ndo_fdb_del            = mlx4_en_fdb_del,
-       .ndo_fdb_dump           = mlx4_en_fdb_dump,
 };
 
 int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
@@ -2089,8 +2015,14 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
        INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
        INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
 #ifdef CONFIG_MLX4_EN_DCB
-       if (!mlx4_is_slave(priv->mdev->dev))
-               dev->dcbnl_ops = &mlx4_en_dcbnl_ops;
+       if (!mlx4_is_slave(priv->mdev->dev)) {
+               if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_SET_ETH_SCHED) {
+                       dev->dcbnl_ops = &mlx4_en_dcbnl_ops;
+               } else {
+                       en_info(priv, "enabling only PFC DCB ops\n");
+                       dev->dcbnl_ops = &mlx4_en_dcbnl_pfc_ops;
+               }
+       }
 #endif
 
        for (i = 0; i < MLX4_EN_MAC_HASH_SIZE; ++i)
@@ -2152,8 +2084,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 
        dev->hw_features |= NETIF_F_RXCSUM | NETIF_F_RXHASH;
        dev->features = dev->hw_features | NETIF_F_HIGHDMA |
-                       NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
-                       NETIF_F_HW_VLAN_FILTER;
+                       NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
+                       NETIF_F_HW_VLAN_CTAG_FILTER;
        dev->hw_features |= NETIF_F_LOOPBACK;
 
        if (mdev->dev->caps.steering_mode ==