[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250911123324.GJ30363@horms.kernel.org>
Date: Thu, 11 Sep 2025 13:33:24 +0100
From: Simon Horman <horms@...nel.org>
To: Fan Gong <gongfan1@...wei.com>
Cc: Zhu Yikai <zhuyikai1@...artners.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Andrew Lunn <andrew+netdev@...n.ch>, linux-doc@...r.kernel.org,
Jonathan Corbet <corbet@....net>,
Bjorn Helgaas <helgaas@...nel.org>, luosifu <luosifu@...wei.com>,
Xin Guo <guoxin09@...wei.com>,
Shen Chenyang <shenchenyang1@...ilicon.com>,
Zhou Shuai <zhoushuai28@...wei.com>, Wu Like <wulike1@...wei.com>,
Shi Jing <shijing34@...wei.com>,
Luo Yang <luoyang82@...artners.com>,
Meny Yossefi <meny.yossefi@...wei.com>,
Gur Stavi <gur.stavi@...wei.com>, Lee Trager <lee@...ger.us>,
Michael Ellerman <mpe@...erman.id.au>,
Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Suman Ghosh <sumang@...vell.com>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Joe Damato <jdamato@...tly.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: Re: [PATCH net-next v05 12/14] hinic3: Add port management
On Tue, Sep 09, 2025 at 03:33:37PM +0800, Fan Gong wrote:
> Add port management of enable/disable/query/flush function.
>
> Co-developed-by: Zhu Yikai <zhuyikai1@...artners.com>
> Signed-off-by: Zhu Yikai <zhuyikai1@...artners.com>
> Signed-off-by: Fan Gong <gongfan1@...wei.com>
...
> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c
> index 3d17ca5e7ba5..a07fa4bd71e7 100644
> --- a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c
> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c
> @@ -326,6 +326,59 @@ static void hinic3_close_channel(struct net_device *netdev)
> hinic3_free_qp_ctxts(nic_dev);
> }
>
> +static int hinic3_vport_up(struct net_device *netdev)
> +{
> + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> + bool link_status_up;
> + u16 glb_func_id;
> + int err;
> +
> + glb_func_id = hinic3_global_func_id(nic_dev->hwdev);
> + err = hinic3_set_vport_enable(nic_dev->hwdev, glb_func_id, true);
> + if (err) {
> + netdev_err(netdev, "Failed to enable vport\n");
> + goto err_flush_qps_res;
> + }
> +
> + err = netif_set_real_num_queues(netdev, nic_dev->q_params.num_qps,
> + nic_dev->q_params.num_qps);
> + if (err) {
> + netdev_err(netdev, "Failed to set real number of queues\n");
> + goto err_flush_qps_res;
> + }
> + netif_tx_start_all_queues(netdev);
> +
> + err = hinic3_get_link_status(nic_dev->hwdev, &link_status_up);
> + if (!err && link_status_up)
> + netif_carrier_on(netdev);
> +
> + return 0;
> +
> +err_flush_qps_res:
> + hinic3_flush_qps_res(nic_dev->hwdev);
> + /* wait to guarantee that no packets will be sent to host */
> + msleep(100);
I realise that Jakub's feedback on msleep() in his review of v3 was
in a different code path. But I do wonder if there is a better way.
> +
> + return err;
> +}
> +
> +static void hinic3_vport_down(struct net_device *netdev)
> +{
> + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> + u16 glb_func_id;
> +
> + netif_carrier_off(netdev);
> + netif_tx_disable(netdev);
> +
> + glb_func_id = hinic3_global_func_id(nic_dev->hwdev);
> + hinic3_set_vport_enable(nic_dev->hwdev, glb_func_id, false);
> +
> + hinic3_flush_txqs(netdev);
> + /* wait to guarantee that no packets will be sent to host */
> + msleep(100);
Likewise, here.
> + hinic3_flush_qps_res(nic_dev->hwdev);
> +}
> +
> static int hinic3_open(struct net_device *netdev)
> {
> struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
...
Powered by blists - more mailing lists