Re: [PATCH net-next v05 12/14] hinic3: Add port management

Simon Horman
2025-09-12T16:44:54Z

On Thu, Sep 11, 2025 at 10:25:04PM +0800, Fan Gong wrote:
> On 9/11/2025 8:33 PM, Simon Horman wrote:
>
> > > + 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.
>
> ...
>
> > > + hinic3_flush_txqs(netdev);
> > > + /* wait to guarantee that no packets will be sent to host */
> > > + msleep(100);
> >
> > Likewise, here.
>
> Thanks for your review, Simon.
>
> Firstly, The main issue on the code of Jakub's feedback on msleep() is
> duplicate code function. The msleep() in hinic3_vport_down and
> hinic3_free_hwdev is repetitive because of our oversight. So we removed
> msleep() in hinic3_free_hwdev in v04 patch.
>
> Secondly, there is no better way indeed. As our HW bad decision, HW
> didn't have an accurate way of checking if rq has been flushed. The
> only way is to close the func & port . Then we wait for HW to process
> the pkts and upload them to driver.
> The sleep time is determined through our testing. The two calls of
> msleep() are the same issue.

Thanks for the clarification, much appreciated.

> Finally, we have received your reviews on other patches and we will
> fix them soon in the next version.
>