diff options
author | John Fastabend <john.r.fastabend@intel.com> | 2011-07-18 18:38:36 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-08-29 04:18:13 -0400 |
commit | e7589eab92919483d624eb3356cf3ac80efc0790 (patch) | |
tree | 48003a6309184806ecfd4f973a7f3399cf1f9293 /drivers/net/ethernet | |
parent | 6172207634b9259bc57ebde158bb7a7313e31335 (diff) |
ixgbe: consolidate, setup for multiple traffic classes
This consolidates setup code for multiple traffic classes in
the setup_tc routine.
Prep work to allow IEEE DCBX to optimize for number of traffic
classes. Also simplifies code paths.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | 46 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 30 |
2 files changed, 27 insertions, 49 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c index da6d53e7af99..0422e356b6fc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | |||
@@ -118,49 +118,11 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
118 | if (!!state != !(adapter->flags & IXGBE_FLAG_DCB_ENABLED)) | 118 | if (!!state != !(adapter->flags & IXGBE_FLAG_DCB_ENABLED)) |
119 | return err; | 119 | return err; |
120 | 120 | ||
121 | if (state > 0) { | 121 | if (state > 0) |
122 | /* Turn on DCB */ | 122 | err = ixgbe_setup_tc(netdev, MAX_TRAFFIC_CLASS); |
123 | if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { | 123 | else |
124 | e_err(drv, "Enable failed, needs MSI-X\n"); | 124 | err = ixgbe_setup_tc(netdev, 0); |
125 | err = 1; | ||
126 | goto out; | ||
127 | } | ||
128 | |||
129 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | ||
130 | |||
131 | switch (adapter->hw.mac.type) { | ||
132 | case ixgbe_mac_82598EB: | ||
133 | adapter->last_lfc_mode = adapter->hw.fc.current_mode; | ||
134 | adapter->hw.fc.requested_mode = ixgbe_fc_none; | ||
135 | break; | ||
136 | case ixgbe_mac_82599EB: | ||
137 | case ixgbe_mac_X540: | ||
138 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
139 | break; | ||
140 | default: | ||
141 | break; | ||
142 | } | ||
143 | |||
144 | ixgbe_setup_tc(netdev, MAX_TRAFFIC_CLASS); | ||
145 | } else { | ||
146 | /* Turn off DCB */ | ||
147 | adapter->hw.fc.requested_mode = adapter->last_lfc_mode; | ||
148 | adapter->temp_dcb_cfg.pfc_mode_enable = false; | ||
149 | adapter->dcb_cfg.pfc_mode_enable = false; | ||
150 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; | ||
151 | switch (adapter->hw.mac.type) { | ||
152 | case ixgbe_mac_82599EB: | ||
153 | case ixgbe_mac_X540: | ||
154 | if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
155 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
156 | break; | ||
157 | default: | ||
158 | break; | ||
159 | } | ||
160 | ixgbe_setup_tc(netdev, 0); | ||
161 | } | ||
162 | 125 | ||
163 | out: | ||
164 | return err; | 126 | return err; |
165 | } | 127 | } |
166 | 128 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 2b1bb606c638..3932cd06103a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -7065,11 +7065,11 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) | |||
7065 | struct ixgbe_adapter *adapter = netdev_priv(dev); | 7065 | struct ixgbe_adapter *adapter = netdev_priv(dev); |
7066 | struct ixgbe_hw *hw = &adapter->hw; | 7066 | struct ixgbe_hw *hw = &adapter->hw; |
7067 | 7067 | ||
7068 | /* If DCB is anabled do not remove traffic classes, multiple | 7068 | /* Multiple traffic classes requires multiple queues */ |
7069 | * traffic classes are required to implement DCB | 7069 | if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { |
7070 | */ | 7070 | e_err(drv, "Enable failed, needs MSI-X\n"); |
7071 | if (!tc && (adapter->flags & IXGBE_FLAG_DCB_ENABLED)) | 7071 | return -EINVAL; |
7072 | return 0; | 7072 | } |
7073 | 7073 | ||
7074 | /* Hardware supports up to 8 traffic classes */ | 7074 | /* Hardware supports up to 8 traffic classes */ |
7075 | if (tc > MAX_TRAFFIC_CLASS || | 7075 | if (tc > MAX_TRAFFIC_CLASS || |
@@ -7084,11 +7084,27 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) | |||
7084 | ixgbe_close(dev); | 7084 | ixgbe_close(dev); |
7085 | ixgbe_clear_interrupt_scheme(adapter); | 7085 | ixgbe_clear_interrupt_scheme(adapter); |
7086 | 7086 | ||
7087 | if (tc) | 7087 | if (tc) { |
7088 | netdev_set_num_tc(dev, tc); | 7088 | netdev_set_num_tc(dev, tc); |
7089 | else | 7089 | adapter->last_lfc_mode = adapter->hw.fc.current_mode; |
7090 | |||
7091 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | ||
7092 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
7093 | |||
7094 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) | ||
7095 | adapter->hw.fc.requested_mode = ixgbe_fc_none; | ||
7096 | } else { | ||
7090 | netdev_reset_tc(dev); | 7097 | netdev_reset_tc(dev); |
7091 | 7098 | ||
7099 | adapter->hw.fc.requested_mode = adapter->last_lfc_mode; | ||
7100 | |||
7101 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; | ||
7102 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
7103 | |||
7104 | adapter->temp_dcb_cfg.pfc_mode_enable = false; | ||
7105 | adapter->dcb_cfg.pfc_mode_enable = false; | ||
7106 | } | ||
7107 | |||
7092 | ixgbe_init_interrupt_scheme(adapter); | 7108 | ixgbe_init_interrupt_scheme(adapter); |
7093 | ixgbe_validate_rtr(adapter, tc); | 7109 | ixgbe_validate_rtr(adapter, tc); |
7094 | if (netif_running(dev)) | 7110 | if (netif_running(dev)) |