Re: [PATCH net-next v1] hinic: add three net_device_ops of vf

From: Jakub Kicinski
Date: Fri May 08 2020 - 17:50:00 EST


On Thu, 7 May 2020 18:21:19 +0000 Luo bin wrote:
> diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c
> index 564fb2294a29..bc2f87e6cb5d 100644
> --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c
> +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c
> @@ -627,7 +627,7 @@ wait_for_mbox_seg_completion(struct hinic_mbox_func_to_func *func_to_func,
> struct hinic_hwdev *hwdev = func_to_func->hwdev;
> struct completion *done = &send_mbox->send_done;
> u32 cnt = 0;
> - ulong jif;
> + unsigned long jif;
>
> if (poll) {
> while (cnt < MBOX_MSG_POLLING_TIMEOUT) {
> @@ -869,7 +869,7 @@ int hinic_mbox_to_func(struct hinic_mbox_func_to_func *func_to_func,
> {
> struct hinic_recv_mbox *mbox_for_resp;
> struct mbox_msg_info msg_info = {0};
> - ulong timeo;
> + unsigned long timeo;
> int err;
>
> mbox_for_resp = &func_to_func->mbox_resp[dst_func];

Unrelated cleanup.

> diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c
> index b66bb86cff96..3d6569d7bac8 100644
> --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c
> +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c
> @@ -427,10 +427,6 @@ static int hinic_open(struct net_device *netdev)
> goto err_func_port_state;
> }
>
> - if (!HINIC_IS_VF(nic_dev->hwdev->hwif))
> - /* Wait up to 3 sec between port enable to link state */
> - msleep(3000);

Why is this no longer needed?

> down(&nic_dev->mgmt_lock);
>
> err = hinic_port_link_state(nic_dev, &link_state);

> + if (link_state == HINIC_LINK_STATE_DOWN) {
> + netif_err(nic_dev, drv, netdev,
> + "Link status must be up when setting vf tx rate\n");
> + return -EPERM;
> + }

Does this also mean the configuration is lost if link goes down?