diff options
author | Yunsheng Lin | 2018-11-18 04:19:12 +0100 |
---|---|---|
committer | David S. Miller | 2018-11-18 06:57:29 +0100 |
commit | a6d818e31d08bae09c417e579c4a39cf3d6dde2e (patch) | |
tree | 2dfc838bd8c445f3e4d2e12cac624c39b384f7ae /drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | |
parent | net: hns3: Refactor mac mtu setting related functions (diff) | |
download | kernel-qcow2-linux-a6d818e31d08bae09c417e579c4a39cf3d6dde2e.tar.gz kernel-qcow2-linux-a6d818e31d08bae09c417e579c4a39cf3d6dde2e.tar.xz kernel-qcow2-linux-a6d818e31d08bae09c417e579c4a39cf3d6dde2e.zip |
net: hns3: Add vport alive state checking support
Currently there is no way for pf to know if a vf device is
alive or not, so PF does not know which vf to notify when
reset happens, or which vf's mtu is invalid when vf and pf
share the same hardware mtu setting.
This patch adds vport alive state checking support, in order
to support the above scenario.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns3/hns3_enet.c')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index d58d3c193ab7..5cae14c991ee 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3540,6 +3540,22 @@ static void hns3_nic_set_priv_ops(struct net_device *netdev) priv->ops.maybe_stop_tx = hns3_nic_maybe_stop_tx; } +static int hns3_client_start(struct hnae3_handle *handle) +{ + if (!handle->ae_algo->ops->client_start) + return 0; + + return handle->ae_algo->ops->client_start(handle); +} + +static void hns3_client_stop(struct hnae3_handle *handle) +{ + if (!handle->ae_algo->ops->client_stop) + return; + + handle->ae_algo->ops->client_stop(handle); +} + static int hns3_client_init(struct hnae3_handle *handle) { struct pci_dev *pdev = handle->pdev; @@ -3607,6 +3623,12 @@ static int hns3_client_init(struct hnae3_handle *handle) goto out_reg_netdev_fail; } + ret = hns3_client_start(handle); + if (ret) { + dev_err(priv->dev, "hns3_client_start fail! ret=%d\n", ret); + goto out_reg_netdev_fail; + } + hns3_dcbnl_setup(handle); /* MTU range: (ETH_MIN_MTU(kernel default) - 9702) */ @@ -3635,6 +3657,8 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset) struct hns3_nic_priv *priv = netdev_priv(netdev); int ret; + hns3_client_stop(handle); + hns3_remove_hw_addr(netdev); if (netdev->reg_state != NETREG_UNINITIALIZED) |