diff options
author | Don Skidmore <donald.c.skidmore@intel.com> | 2008-12-21 23:09:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-21 23:09:50 -0500 |
commit | 1486a61ebcd2711532f8163d30babc40e11e7b40 (patch) | |
tree | 49fb6ba4e4f6ade0f1db0f6c86d0feb207857e65 /drivers/net/ixgbe/ixgbe_dcb_nl.c | |
parent | c2da953a46b18b7515ad476c1c1686640a12e93a (diff) |
net: fix DCB setstate to return success/failure
Data Center Bridging (DCB) had no way to know if setstate had failed in the
driver. This patch enables dcb netlink code to handle the status for the DCB
setstate interface. Likewise it allows the driver to return a failed status
if MSI-X isn't enabled.
Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: Eric W Multanen <eric.w.multanen@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_dcb_nl.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_dcb_nl.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index 615c2803202..7d158a5c545 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -124,39 +124,45 @@ static u16 ixgbe_dcb_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | static void ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | 127 | static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) |
128 | { | 128 | { |
129 | u8 err = 0; | ||
129 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 130 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
130 | 131 | ||
131 | DPRINTK(DRV, INFO, "Set DCB Admin Mode.\n"); | 132 | DPRINTK(DRV, INFO, "Set DCB Admin Mode.\n"); |
132 | 133 | ||
133 | if (state > 0) { | 134 | if (state > 0) { |
134 | /* Turn on DCB */ | 135 | /* Turn on DCB */ |
135 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 136 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) |
136 | return; | 137 | goto out; |
137 | } else { | ||
138 | if (netif_running(netdev)) | ||
139 | netdev->stop(netdev); | ||
140 | ixgbe_reset_interrupt_capability(adapter); | ||
141 | ixgbe_napi_del_all(adapter); | ||
142 | kfree(adapter->tx_ring); | ||
143 | kfree(adapter->rx_ring); | ||
144 | adapter->tx_ring = NULL; | ||
145 | adapter->rx_ring = NULL; | ||
146 | netdev->select_queue = &ixgbe_dcb_select_queue; | ||
147 | 138 | ||
148 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; | 139 | if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { |
149 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | 140 | DPRINTK(DRV, ERR, "Enable failed, needs MSI-X\n"); |
150 | ixgbe_init_interrupt_scheme(adapter); | 141 | err = 1; |
151 | ixgbe_napi_add_all(adapter); | 142 | goto out; |
152 | if (netif_running(netdev)) | ||
153 | netdev->open(netdev); | ||
154 | } | 143 | } |
144 | |||
145 | if (netif_running(netdev)) | ||
146 | netdev->netdev_ops->ndo_stop(netdev); | ||
147 | ixgbe_reset_interrupt_capability(adapter); | ||
148 | ixgbe_napi_del_all(adapter); | ||
149 | kfree(adapter->tx_ring); | ||
150 | kfree(adapter->rx_ring); | ||
151 | adapter->tx_ring = NULL; | ||
152 | adapter->rx_ring = NULL; | ||
153 | netdev->select_queue = &ixgbe_dcb_select_queue; | ||
154 | |||
155 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; | ||
156 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | ||
157 | ixgbe_init_interrupt_scheme(adapter); | ||
158 | ixgbe_napi_add_all(adapter); | ||
159 | if (netif_running(netdev)) | ||
160 | netdev->netdev_ops->ndo_open(netdev); | ||
155 | } else { | 161 | } else { |
156 | /* Turn off DCB */ | 162 | /* Turn off DCB */ |
157 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 163 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
158 | if (netif_running(netdev)) | 164 | if (netif_running(netdev)) |
159 | netdev->stop(netdev); | 165 | netdev->netdev_ops->ndo_stop(netdev); |
160 | ixgbe_reset_interrupt_capability(adapter); | 166 | ixgbe_reset_interrupt_capability(adapter); |
161 | ixgbe_napi_del_all(adapter); | 167 | ixgbe_napi_del_all(adapter); |
162 | kfree(adapter->tx_ring); | 168 | kfree(adapter->tx_ring); |
@@ -170,11 +176,11 @@ static void ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
170 | ixgbe_init_interrupt_scheme(adapter); | 176 | ixgbe_init_interrupt_scheme(adapter); |
171 | ixgbe_napi_add_all(adapter); | 177 | ixgbe_napi_add_all(adapter); |
172 | if (netif_running(netdev)) | 178 | if (netif_running(netdev)) |
173 | netdev->open(netdev); | 179 | netdev->netdev_ops->ndo_open(netdev); |
174 | } else { | ||
175 | return; | ||
176 | } | 180 | } |
177 | } | 181 | } |
182 | out: | ||
183 | return err; | ||
178 | } | 184 | } |
179 | 185 | ||
180 | static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev, | 186 | static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev, |