Thread (18 messages) 18 messages, 2 authors, 2024-08-23

Re: [PATCH V3 net-next 02/11] net: hibmcge: Add read/write registers supported through the bar space

From: Jijie Shao <shaojijie@huawei.com>
Date: 2024-08-23 03:14:26
Also in: lkml

on 2024/8/23 0:04, Andrew Lunn wrote:
quoted
  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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help