net/mlx4_en: Enable DCB ETS ops only when supported by the firmware
authorOr Gerlitz <ogerlitz@mellanox.com>
Sun, 7 Apr 2013 03:44:07 +0000 (03:44 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 7 Apr 2013 20:55:46 +0000 (16:55 -0400)
Enable the DCB ETS ops only when supported by the firmware. For older firmware/cards
which don't support ETS, advertize only PFC DCB ops.

Signed-off-by: Eugenia Emantayev <eugenia@mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
drivers/net/ethernet/mellanox/mlx4/fw.c
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
include/linux/mlx4/device.h

index b799ab12a2918bb7f0c5b8bdc0d5db70ecaf4392..321553fd58dfd7a794e602c1db0f54fbbc284e35 100644 (file)
@@ -253,3 +253,11 @@ const struct dcbnl_rtnl_ops mlx4_en_dcbnl_ops = {
        .getdcbx        = mlx4_en_dcbnl_getdcbx,
        .setdcbx        = mlx4_en_dcbnl_setdcbx,
 };
+
+const struct dcbnl_rtnl_ops mlx4_en_dcbnl_pfc_ops = {
+       .ieee_getpfc    = mlx4_en_dcbnl_ieee_getpfc,
+       .ieee_setpfc    = mlx4_en_dcbnl_ieee_setpfc,
+
+       .getdcbx        = mlx4_en_dcbnl_getdcbx,
+       .setdcbx        = mlx4_en_dcbnl_setdcbx,
+};
index 473c9d2fec1a4a0d2274995f4f99ea01fe3057ab..d2a4f919bf1f49164b9806af6d36ba5e791105a3 100644 (file)
@@ -2013,8 +2013,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)
index 876439748cdf9e13e7b512a1ef5badda0d4d1f72..ab470d991ade57cfdccc2fa593f88b927ec4054a 100644 (file)
@@ -109,6 +109,7 @@ static void dump_dev_cap_flags(struct mlx4_dev *dev, u64 flags)
                [41] = "Unicast VEP steering support",
                [42] = "Multicast VEP steering support",
                [48] = "Counters support",
+               [53] = "Port ETS Scheduler support",
                [55] = "Port link type sensing support",
                [59] = "Port management change event support",
                [61] = "64 byte EQE support",
index f710b7ce0dcbbf9ef740d0661add1bb744921b9f..d4cb5d3b28a2a82d19ec08f3ab8cba80b1782dc5 100644 (file)
@@ -624,6 +624,7 @@ int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port);
 
 #ifdef CONFIG_MLX4_EN_DCB
 extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_ops;
+extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_pfc_ops;
 #endif
 
 int mlx4_en_setup_tc(struct net_device *dev, u8 up);
index 811f91cf5e8cbf19dd15449060b3336d7e94b8fe..1bc5a750b330ce1d84f12265a4e0b9f26d397d28 100644 (file)
@@ -140,6 +140,7 @@ enum {
        MLX4_DEV_CAP_FLAG_VEP_UC_STEER  = 1LL << 41,
        MLX4_DEV_CAP_FLAG_VEP_MC_STEER  = 1LL << 42,
        MLX4_DEV_CAP_FLAG_COUNTERS      = 1LL << 48,
+       MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53,
        MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55,
        MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59,
        MLX4_DEV_CAP_FLAG_64B_EQE       = 1LL << 61,