[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <81cbefc2-1cf1-4684-b4b1-5610ee02a8a2@huawei.com>
Date: Fri, 23 Aug 2024 11:14:21 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: Andrew Lunn <andrew@...n.ch>
CC: <shaojijie@...wei.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <shenjian15@...wei.com>,
<wangpeiyang1@...wei.com>, <liuyonglong@...wei.com>,
<sudongming1@...wei.com>, <xujunsheng@...wei.com>, <shiyongbang@...wei.com>,
<libaihan@...wei.com>, <jdamato@...tly.com>, <horms@...nel.org>,
<jonathan.cameron@...wei.com>, <shameerali.kolothum.thodi@...wei.com>,
<salil.mehta@...wei.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V3 net-next 02/11] net: hibmcge: Add read/write registers
supported through the bar space
on 2024/8/23 0:04, Andrew Lunn wrote:
>> static int hbg_pci_init(struct pci_dev *pdev)
>> {
>> @@ -56,10 +62,15 @@ static int hbg_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>> if (ret)
>> return ret;
>>
>> + ret = hbg_init(priv);
>> + if (ret)
>> + return ret;
>> +
>> ret = devm_register_netdev(dev, netdev);
>> if (ret)
>> return dev_err_probe(dev, ret, "failed to register netdev\n");
>>
>> + set_bit(HBG_NIC_STATE_INITED, &priv->state);
> There is a potential race here. Before devm_register_netdev() even
> returns, the linux stack could be sending packets. You need to ensure
> nothing actual needs HBG_NIC_STATE_INITED when the interface is
> operating, because it might not be set yet.
>
> In general, such state variables are not needed. If registration
> failed, probe failed, and the driver will be unloaded. If registration
> succeeded and other functions are being used, registration must of
> been successful.
>
> Andrew
HBG_NIC_STATE_INITED is not used in TX or RX.
We want to be able to use it in function reset and FLR(not including in this patch set).
There is a time gap between pci_init and register_netdev.
Therefore, HBG_NIC_STATE_INITED is introduced to judge whether probe is complete.
Jijie Shao
Powered by blists - more mailing lists