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 | |
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>
-rw-r--r-- | drivers/net/ixgbe/ixgbe_dcb_nl.c | 52 | ||||
-rw-r--r-- | include/net/dcbnl.h | 2 | ||||
-rw-r--r-- | net/dcb/dcbnl.c | 5 |
3 files changed, 32 insertions, 27 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index 615c2803202a..7d158a5c545b 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, |
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h index 91e0a3d7faf2..775cfc8055be 100644 --- a/include/net/dcbnl.h +++ b/include/net/dcbnl.h | |||
@@ -26,7 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | struct dcbnl_rtnl_ops { | 27 | struct dcbnl_rtnl_ops { |
28 | u8 (*getstate)(struct net_device *); | 28 | u8 (*getstate)(struct net_device *); |
29 | void (*setstate)(struct net_device *, u8); | 29 | u8 (*setstate)(struct net_device *, u8); |
30 | void (*getpermhwaddr)(struct net_device *, u8 *); | 30 | void (*getpermhwaddr)(struct net_device *, u8 *); |
31 | void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8); | 31 | void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8); |
32 | void (*setpgbwgcfgtx)(struct net_device *, int, u8); | 32 | void (*setpgbwgcfgtx)(struct net_device *, int, u8); |
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index a1254061629f..fc88fc4d4f63 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
@@ -714,9 +714,8 @@ static int dcbnl_setstate(struct net_device *netdev, struct nlattr **tb, | |||
714 | 714 | ||
715 | value = nla_get_u8(tb[DCB_ATTR_STATE]); | 715 | value = nla_get_u8(tb[DCB_ATTR_STATE]); |
716 | 716 | ||
717 | netdev->dcbnl_ops->setstate(netdev, value); | 717 | ret = dcbnl_reply(netdev->dcbnl_ops->setstate(netdev, value), |
718 | 718 | RTM_SETDCB, DCB_CMD_SSTATE, DCB_ATTR_STATE, | |
719 | ret = dcbnl_reply(0, RTM_SETDCB, DCB_CMD_SSTATE, DCB_ATTR_STATE, | ||
720 | pid, seq, flags); | 719 | pid, seq, flags); |
721 | 720 | ||
722 | return ret; | 721 | return ret; |