bnxt_en: Re-factor bnxt_setup_tc().
authorMichael Chan <michael.chan@broadcom.com>
Sat, 3 Dec 2016 02:17:15 +0000 (21:17 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Dec 2016 18:21:39 +0000 (13:21 -0500)
Add a new function bnxt_setup_mq_tc() to handle MQPRIO.  This new function
will be called during ETS setup when we add DCBNL in the next patch.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index 0e4f168bea9e0f0d816101534f3a3c3ffccc4379..76642817650340e0fa44c41e6ab48ce504e70e55 100644 (file)
@@ -6337,17 +6337,10 @@ static int bnxt_change_mtu(struct net_device *dev, int new_mtu)
        return 0;
 }
 
-static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
-                        struct tc_to_netdev *ntc)
+int bnxt_setup_mq_tc(struct net_device *dev, u8 tc)
 {
        struct bnxt *bp = netdev_priv(dev);
        bool sh = false;
-       u8 tc;
-
-       if (ntc->type != TC_SETUP_MQPRIO)
-               return -EINVAL;
-
-       tc = ntc->tc;
 
        if (tc > bp->max_tc) {
                netdev_err(dev, "too many traffic classes requested: %d Max supported is %d\n",
@@ -6390,6 +6383,15 @@ static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
        return 0;
 }
 
+static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
+                        struct tc_to_netdev *ntc)
+{
+       if (ntc->type != TC_SETUP_MQPRIO)
+               return -EINVAL;
+
+       return bnxt_setup_mq_tc(dev, ntc->tc);
+}
+
 #ifdef CONFIG_RFS_ACCEL
 static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
                            struct bnxt_ntuple_filter *f2)
index 47be7894c67bcea3e1f1002fcfc88a1992d10b22..fcd07ee12ed4053c925845bcc0aec2a1177467d6 100644 (file)
@@ -1225,5 +1225,6 @@ int bnxt_hwrm_set_link_setting(struct bnxt *, bool, bool);
 int bnxt_hwrm_fw_set_time(struct bnxt *);
 int bnxt_open_nic(struct bnxt *, bool, bool);
 int bnxt_close_nic(struct bnxt *, bool, bool);
+int bnxt_setup_mq_tc(struct net_device *dev, u8 tc);
 int bnxt_get_max_rings(struct bnxt *, int *, int *, bool);
 #endif