aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Fastabend <john.r.fastabend@intel.com>2011-04-26 06:05:14 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-06-21 04:18:47 -0400
commit1fcd86b51179518f7e69164e37353fb59cd6301e (patch)
tree1d1102061589f998b3791ce5a605b331bde1cdfa
parentc12db7695e1f52b27108c3dfde3cf655a0368c58 (diff)
ixgbe: dcbnl reduce duplicated code and indentation
Replace duplicated code in if/else branches with single check and ixgbe_init_interrupt_scheme(). 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>
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_nl.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c
index 5e7ed225851a..293ff06ba16f 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c
@@ -146,37 +146,34 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
146 adapter->flags |= IXGBE_FLAG_DCB_ENABLED; 146 adapter->flags |= IXGBE_FLAG_DCB_ENABLED;
147 if (!netdev_get_num_tc(netdev)) 147 if (!netdev_get_num_tc(netdev))
148 ixgbe_setup_tc(netdev, MAX_TRAFFIC_CLASS); 148 ixgbe_setup_tc(netdev, MAX_TRAFFIC_CLASS);
149
150 ixgbe_init_interrupt_scheme(adapter);
151 if (netif_running(netdev))
152 netdev->netdev_ops->ndo_open(netdev);
153 } else { 149 } else {
154 /* Turn off DCB */ 150 /* Turn off DCB */
155 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 151 if (!(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
156 if (netif_running(netdev)) 152 goto out;
157 netdev->netdev_ops->ndo_stop(netdev);
158 ixgbe_clear_interrupt_scheme(adapter);
159 153
160 adapter->hw.fc.requested_mode = adapter->last_lfc_mode; 154 if (netif_running(netdev))
161 adapter->temp_dcb_cfg.pfc_mode_enable = false; 155 netdev->netdev_ops->ndo_stop(netdev);
162 adapter->dcb_cfg.pfc_mode_enable = false; 156 ixgbe_clear_interrupt_scheme(adapter);
163 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; 157
164 switch (adapter->hw.mac.type) { 158 adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
165 case ixgbe_mac_82599EB: 159 adapter->temp_dcb_cfg.pfc_mode_enable = false;
166 case ixgbe_mac_X540: 160 adapter->dcb_cfg.pfc_mode_enable = false;
167 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; 161 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
168 break; 162 switch (adapter->hw.mac.type) {
169 default: 163 case ixgbe_mac_82599EB:
170 break; 164 case ixgbe_mac_X540:
171 } 165 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
172 166 break;
173 ixgbe_setup_tc(netdev, 0); 167 default:
174 168 break;
175 ixgbe_init_interrupt_scheme(adapter);
176 if (netif_running(netdev))
177 netdev->netdev_ops->ndo_open(netdev);
178 } 169 }
170
171 ixgbe_setup_tc(netdev, 0);
179 } 172 }
173
174 ixgbe_init_interrupt_scheme(adapter);
175 if (netif_running(netdev))
176 netdev->netdev_ops->ndo_open(netdev);
180out: 177out:
181 return err; 178 return err;
182} 179}