Re: [PATCH net 3/3] eet: ena: invoke netif_carrier_off() only after netdev registered
Right. I’ll remove this patch. On 1/2/18, 9:08 PM, "David Miller" wrote: From: Date: Thu, 28 Dec 2017 21:30:20 + > From: Netanel Belgazal > > netif_carrier_off() should be called only after register netdev. > Move the function's call after the registration. > > Signed-off-by: Netanel Belgazal > --- > drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c > index fbe21a817bd8..ee50c56765a4 100644 > --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c > +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c > @@ -3276,14 +3276,14 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > > memcpy(adapter->netdev->perm_addr, adapter->mac_addr, netdev->addr_len); > > - netif_carrier_off(netdev); > - > rc = register_netdev(netdev); > if (rc) { > dev_err(&pdev->dev, "Cannot register net device\n"); > goto err_rss; > } > > + netif_carrier_off(netdev); > + You cannot invoke this after register_netdev(), asynchronous activity can cause this call to lose information and lose a link up event.
Re: [PATCH net 3/3] eet: ena: invoke netif_carrier_off() only after netdev registered
From: Date: Thu, 28 Dec 2017 21:30:20 + > From: Netanel Belgazal > > netif_carrier_off() should be called only after register netdev. > Move the function's call after the registration. > > Signed-off-by: Netanel Belgazal > --- > drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c > b/drivers/net/ethernet/amazon/ena/ena_netdev.c > index fbe21a817bd8..ee50c56765a4 100644 > --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c > +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c > @@ -3276,14 +3276,14 @@ static int ena_probe(struct pci_dev *pdev, const > struct pci_device_id *ent) > > memcpy(adapter->netdev->perm_addr, adapter->mac_addr, netdev->addr_len); > > - netif_carrier_off(netdev); > - > rc = register_netdev(netdev); > if (rc) { > dev_err(&pdev->dev, "Cannot register net device\n"); > goto err_rss; > } > > + netif_carrier_off(netdev); > + You cannot invoke this after register_netdev(), asynchronous activity can cause this call to lose information and lose a link up event.
Re: [PATCH net 3/3] eet: ena: invoke netif_carrier_off() only after netdev registered
On Fri, 29 Dec 2017 08:00:33 +, Belgazal, Netanel wrote: > Yes, I mean in my driver. > netif_carrier_off() have no effect when netdev is uninitialized. Please look at the implementation again, test_*and_set*_bit(). > So I must call it after register_netdev(). Is there a user-visible problem you're trying to solve here?
Re: [PATCH net 3/3] eet: ena: invoke netif_carrier_off() only after netdev registered
Yes, I mean in my driver. netif_carrier_off() have no effect when netdev is uninitialized. So I must call it after register_netdev(). On 12/29/17, 9:46 AM, "Jakub Kicinski" wrote: By "should" you mean in your driver, right? I think calling netif_carrier_off() on an unregistered netdev is a pretty standard thing to do for drivers which manage carrier state.
Re: [PATCH net 3/3] eet: ena: invoke netif_carrier_off() only after netdev registered
On Thu, 28 Dec 2017 21:30:20 +, neta...@amazon.com wrote: > From: Netanel Belgazal > > netif_carrier_off() should be called only after register netdev. > Move the function's call after the registration. By "should" you mean in your driver, right? I think calling netif_carrier_off() on an unregistered netdev is a pretty standard thing to do for drivers which manage carrier state. > Signed-off-by: Netanel Belgazal > --- > drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c > b/drivers/net/ethernet/amazon/ena/ena_netdev.c > index fbe21a817bd8..ee50c56765a4 100644 > --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c > +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c > @@ -3276,14 +3276,14 @@ static int ena_probe(struct pci_dev *pdev, const > struct pci_device_id *ent) > > memcpy(adapter->netdev->perm_addr, adapter->mac_addr, netdev->addr_len); > > - netif_carrier_off(netdev); > - > rc = register_netdev(netdev); > if (rc) { > dev_err(&pdev->dev, "Cannot register net device\n"); > goto err_rss; > } > > + netif_carrier_off(netdev); > + > INIT_WORK(&adapter->reset_task, ena_fw_reset_device); This looks suspicious. After you call register_netdev() someone can open the device and link may come up before you clear it again with carrier off. Leading to netdev without a carrier until it's reopened. > adapter->last_keep_alive_jiffies = jiffies;
[PATCH net 3/3] eet: ena: invoke netif_carrier_off() only after netdev registered
From: Netanel Belgazal netif_carrier_off() should be called only after register netdev. Move the function's call after the registration. Signed-off-by: Netanel Belgazal --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index fbe21a817bd8..ee50c56765a4 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -3276,14 +3276,14 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) memcpy(adapter->netdev->perm_addr, adapter->mac_addr, netdev->addr_len); - netif_carrier_off(netdev); - rc = register_netdev(netdev); if (rc) { dev_err(&pdev->dev, "Cannot register net device\n"); goto err_rss; } + netif_carrier_off(netdev); + INIT_WORK(&adapter->reset_task, ena_fw_reset_device); adapter->last_keep_alive_jiffies = jiffies; -- 2.7.3.AMZN