diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2012-05-18 02:33:31 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-07-14 17:29:19 -0400 |
commit | 02debdc9b9adf88a4e2a42b96d1544e63b82e69a (patch) | |
tree | 1f5569ea283e069bb076a53ec933cbad79391cec | |
parent | df0676d1bddf085c4cc4aca39b18f9fcbd08d83d (diff) |
ixgbe: Populate the prio_tc_map in ixgbe_setup_tc
There were cases where the prio_tc_map was not populated when we were
calling open. This will result in us incorrectly configuring the traffic
classes when DCB is enabled. In order to correct this I have updated the
code so that we now populate the values prior to allocating the q_vectors
and calling ixgbe_open.
Cc: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | 26 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 28 |
4 files changed, 35 insertions, 23 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c index 39ac2feca1f..5442b359141 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c | |||
@@ -228,8 +228,7 @@ void ixgbe_dcb_unpack_prio(struct ixgbe_dcb_config *cfg, int direction, | |||
228 | ptype[tc] = tc_config[tc].path[direction].prio_type; | 228 | ptype[tc] = tc_config[tc].path[direction].prio_type; |
229 | } | 229 | } |
230 | 230 | ||
231 | static u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *cfg, | 231 | u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *cfg, int direction, u8 up) |
232 | int direction, u8 up) | ||
233 | { | 232 | { |
234 | struct tc_configuration *tc_config = &cfg->tc_config[0]; | 233 | struct tc_configuration *tc_config = &cfg->tc_config[0]; |
235 | u8 prio_mask = 1 << up; | 234 | u8 prio_mask = 1 << up; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h index 24333b71816..1f4108ee154 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.h | |||
@@ -146,6 +146,7 @@ void ixgbe_dcb_unpack_max(struct ixgbe_dcb_config *, u16 *); | |||
146 | void ixgbe_dcb_unpack_bwgid(struct ixgbe_dcb_config *, int, u8 *); | 146 | void ixgbe_dcb_unpack_bwgid(struct ixgbe_dcb_config *, int, u8 *); |
147 | void ixgbe_dcb_unpack_prio(struct ixgbe_dcb_config *, int, u8 *); | 147 | void ixgbe_dcb_unpack_prio(struct ixgbe_dcb_config *, int, u8 *); |
148 | void ixgbe_dcb_unpack_map(struct ixgbe_dcb_config *, int, u8 *); | 148 | void ixgbe_dcb_unpack_map(struct ixgbe_dcb_config *, int, u8 *); |
149 | u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *, int, u8); | ||
149 | 150 | ||
150 | /* DCB credits calculation */ | 151 | /* DCB credits calculation */ |
151 | s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *, | 152 | s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c index 5164a21b13c..f1e002d5fa8 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | |||
@@ -151,34 +151,21 @@ static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) | |||
151 | 151 | ||
152 | static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | 152 | static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) |
153 | { | 153 | { |
154 | int err = 0; | ||
155 | u8 prio_tc[MAX_USER_PRIORITY] = {0}; | ||
156 | int i; | ||
157 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 154 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
155 | int err = 0; | ||
158 | 156 | ||
159 | /* Fail command if not in CEE mode */ | 157 | /* Fail command if not in CEE mode */ |
160 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 158 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
161 | return 1; | 159 | return 1; |
162 | 160 | ||
163 | /* verify there is something to do, if not then exit */ | 161 | /* verify there is something to do, if not then exit */ |
164 | if (!!state != !(adapter->flags & IXGBE_FLAG_DCB_ENABLED)) | 162 | if (!state == !(adapter->flags & IXGBE_FLAG_DCB_ENABLED)) |
165 | goto out; | ||
166 | |||
167 | if (state > 0) { | ||
168 | err = ixgbe_setup_tc(netdev, adapter->dcb_cfg.num_tcs.pg_tcs); | ||
169 | ixgbe_dcb_unpack_map(&adapter->dcb_cfg, DCB_TX_CONFIG, prio_tc); | ||
170 | } else { | ||
171 | err = ixgbe_setup_tc(netdev, 0); | ||
172 | } | ||
173 | |||
174 | if (err) | ||
175 | goto out; | 163 | goto out; |
176 | 164 | ||
177 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) | 165 | err = ixgbe_setup_tc(netdev, |
178 | netdev_set_prio_tc_map(netdev, i, prio_tc[i]); | 166 | state ? adapter->dcb_cfg.num_tcs.pg_tcs : 0); |
179 | |||
180 | out: | 167 | out: |
181 | return err ? 1 : 0; | 168 | return !!err; |
182 | } | 169 | } |
183 | 170 | ||
184 | static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev, | 171 | static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev, |
@@ -584,9 +571,6 @@ static int ixgbe_dcbnl_ieee_setets(struct net_device *dev, | |||
584 | if (err) | 571 | if (err) |
585 | goto err_out; | 572 | goto err_out; |
586 | 573 | ||
587 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) | ||
588 | netdev_set_prio_tc_map(dev, i, ets->prio_tc[i]); | ||
589 | |||
590 | err = ixgbe_dcb_hw_ets(&adapter->hw, ets, max_frame); | 574 | err = ixgbe_dcb_hw_ets(&adapter->hw, ets, max_frame); |
591 | err_out: | 575 | err_out: |
592 | return err; | 576 | return err; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index d3cf8873d48..91bc60fc58e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -6596,6 +6596,31 @@ static void ixgbe_validate_rtr(struct ixgbe_adapter *adapter, u8 tc) | |||
6596 | } | 6596 | } |
6597 | 6597 | ||
6598 | /** | 6598 | /** |
6599 | * ixgbe_set_prio_tc_map - Configure netdev prio tc map | ||
6600 | * @adapter: Pointer to adapter struct | ||
6601 | * | ||
6602 | * Populate the netdev user priority to tc map | ||
6603 | */ | ||
6604 | static void ixgbe_set_prio_tc_map(struct ixgbe_adapter *adapter) | ||
6605 | { | ||
6606 | struct net_device *dev = adapter->netdev; | ||
6607 | struct ixgbe_dcb_config *dcb_cfg = &adapter->dcb_cfg; | ||
6608 | struct ieee_ets *ets = adapter->ixgbe_ieee_ets; | ||
6609 | u8 prio; | ||
6610 | |||
6611 | for (prio = 0; prio < MAX_USER_PRIORITY; prio++) { | ||
6612 | u8 tc = 0; | ||
6613 | |||
6614 | if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE) | ||
6615 | tc = ixgbe_dcb_get_tc_from_up(dcb_cfg, 0, prio); | ||
6616 | else if (ets) | ||
6617 | tc = ets->prio_tc[prio]; | ||
6618 | |||
6619 | netdev_set_prio_tc_map(dev, prio, tc); | ||
6620 | } | ||
6621 | } | ||
6622 | |||
6623 | /** | ||
6599 | * ixgbe_setup_tc - configure net_device for multiple traffic classes | 6624 | * ixgbe_setup_tc - configure net_device for multiple traffic classes |
6600 | * | 6625 | * |
6601 | * @netdev: net device to configure | 6626 | * @netdev: net device to configure |
@@ -6633,6 +6658,8 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) | |||
6633 | 6658 | ||
6634 | if (tc) { | 6659 | if (tc) { |
6635 | netdev_set_num_tc(dev, tc); | 6660 | netdev_set_num_tc(dev, tc); |
6661 | ixgbe_set_prio_tc_map(adapter); | ||
6662 | |||
6636 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | 6663 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; |
6637 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | 6664 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; |
6638 | 6665 | ||
@@ -6642,6 +6669,7 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) | |||
6642 | } | 6669 | } |
6643 | } else { | 6670 | } else { |
6644 | netdev_reset_tc(dev); | 6671 | netdev_reset_tc(dev); |
6672 | |||
6645 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) | 6673 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) |
6646 | adapter->hw.fc.requested_mode = adapter->last_lfc_mode; | 6674 | adapter->hw.fc.requested_mode = adapter->last_lfc_mode; |
6647 | 6675 | ||