提交 1486a61e 编写于 作者: D Don Skidmore 提交者: David S. Miller

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: NDon Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: NEric W Multanen <eric.w.multanen@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c2da953a
...@@ -124,19 +124,26 @@ static u16 ixgbe_dcb_select_queue(struct net_device *dev, struct sk_buff *skb) ...@@ -124,19 +124,26 @@ static u16 ixgbe_dcb_select_queue(struct net_device *dev, struct sk_buff *skb)
return 0; return 0;
} }
static void ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
{ {
u8 err = 0;
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
DPRINTK(DRV, INFO, "Set DCB Admin Mode.\n"); DPRINTK(DRV, INFO, "Set DCB Admin Mode.\n");
if (state > 0) { if (state > 0) {
/* Turn on DCB */ /* Turn on DCB */
if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
return; goto out;
} else {
if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
DPRINTK(DRV, ERR, "Enable failed, needs MSI-X\n");
err = 1;
goto out;
}
if (netif_running(netdev)) if (netif_running(netdev))
netdev->stop(netdev); netdev->netdev_ops->ndo_stop(netdev);
ixgbe_reset_interrupt_capability(adapter); ixgbe_reset_interrupt_capability(adapter);
ixgbe_napi_del_all(adapter); ixgbe_napi_del_all(adapter);
kfree(adapter->tx_ring); kfree(adapter->tx_ring);
...@@ -150,13 +157,12 @@ static void ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) ...@@ -150,13 +157,12 @@ static void ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
ixgbe_init_interrupt_scheme(adapter); ixgbe_init_interrupt_scheme(adapter);
ixgbe_napi_add_all(adapter); ixgbe_napi_add_all(adapter);
if (netif_running(netdev)) if (netif_running(netdev))
netdev->open(netdev); netdev->netdev_ops->ndo_open(netdev);
}
} else { } else {
/* Turn off DCB */ /* Turn off DCB */
if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
if (netif_running(netdev)) if (netif_running(netdev))
netdev->stop(netdev); netdev->netdev_ops->ndo_stop(netdev);
ixgbe_reset_interrupt_capability(adapter); ixgbe_reset_interrupt_capability(adapter);
ixgbe_napi_del_all(adapter); ixgbe_napi_del_all(adapter);
kfree(adapter->tx_ring); kfree(adapter->tx_ring);
...@@ -170,11 +176,11 @@ static void ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) ...@@ -170,11 +176,11 @@ static void ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
ixgbe_init_interrupt_scheme(adapter); ixgbe_init_interrupt_scheme(adapter);
ixgbe_napi_add_all(adapter); ixgbe_napi_add_all(adapter);
if (netif_running(netdev)) if (netif_running(netdev))
netdev->open(netdev); netdev->netdev_ops->ndo_open(netdev);
} else {
return;
} }
} }
out:
return err;
} }
static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev, static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
*/ */
struct dcbnl_rtnl_ops { struct dcbnl_rtnl_ops {
u8 (*getstate)(struct net_device *); u8 (*getstate)(struct net_device *);
void (*setstate)(struct net_device *, u8); u8 (*setstate)(struct net_device *, u8);
void (*getpermhwaddr)(struct net_device *, u8 *); void (*getpermhwaddr)(struct net_device *, u8 *);
void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8); void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8);
void (*setpgbwgcfgtx)(struct net_device *, int, u8); void (*setpgbwgcfgtx)(struct net_device *, int, u8);
......
...@@ -714,9 +714,8 @@ static int dcbnl_setstate(struct net_device *netdev, struct nlattr **tb, ...@@ -714,9 +714,8 @@ static int dcbnl_setstate(struct net_device *netdev, struct nlattr **tb,
value = nla_get_u8(tb[DCB_ATTR_STATE]); value = nla_get_u8(tb[DCB_ATTR_STATE]);
netdev->dcbnl_ops->setstate(netdev, value); ret = dcbnl_reply(netdev->dcbnl_ops->setstate(netdev, value),
RTM_SETDCB, DCB_CMD_SSTATE, DCB_ATTR_STATE,
ret = dcbnl_reply(0, RTM_SETDCB, DCB_CMD_SSTATE, DCB_ATTR_STATE,
pid, seq, flags); pid, seq, flags);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册