netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2][pull request] Intel Wired LAN Driver Updates 2023-08-10 (igb, e1000e)
@ 2023-08-10 17:54 Tony Nguyen
  2023-08-10 17:54 ` [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary Tony Nguyen
  2023-08-10 17:54 ` [PATCH net-next 2/2] e1000e: Use PME poll to circumvent unreliable ACPI wake Tony Nguyen
  0 siblings, 2 replies; 9+ messages in thread
From: Tony Nguyen @ 2023-08-10 17:54 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev; +Cc: Tony Nguyen

This series contains updates to igb and e1000e drivers.

Alessio Igor Bogani cleans up PTP related workqueues when it fails to
initialize on igb.

Kai-Heng Feng utilizes PME poll to workaround ACPI wake issues.

The following are changes since commit 29afcd69672a4e3d8604d17206d42004540d6d5c:
  Merge branch 'improve-the-taprio-qdisc-s-relationship-with-its-children'
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 1GbE

Alessio Igor Bogani (1):
  igb: Stop PTP related workqueues if aren't necessary

Kai-Heng Feng (1):
  e1000e: Use PME poll to circumvent unreliable ACPI wake

 drivers/net/ethernet/intel/e1000e/netdev.c | 4 +++-
 drivers/net/ethernet/intel/igb/igb_ptp.c   | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

-- 
2.38.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary
  2023-08-10 17:54 [PATCH net-next 0/2][pull request] Intel Wired LAN Driver Updates 2023-08-10 (igb, e1000e) Tony Nguyen
@ 2023-08-10 17:54 ` Tony Nguyen
  2023-08-13  9:01   ` Leon Romanovsky
  2023-08-10 17:54 ` [PATCH net-next 2/2] e1000e: Use PME poll to circumvent unreliable ACPI wake Tony Nguyen
  1 sibling, 1 reply; 9+ messages in thread
From: Tony Nguyen @ 2023-08-10 17:54 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Alessio Igor Bogani, anthony.l.nguyen, richardcochran,
	Pucha Himasekhar Reddy

From: Alessio Igor Bogani <alessio.bogani@elettra.eu>

The workqueues ptp_tx_work and ptp_overflow_work are unconditionally allocated
by igb_ptp_init(). Stop them if aren't necessary (ptp_clock_register() fails
and CONFIG_PTP is disabled).

Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_ptp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index 405886ee5261..02276c922ac0 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -1406,7 +1406,13 @@ void igb_ptp_init(struct igb_adapter *adapter)
 		dev_info(&adapter->pdev->dev, "added PHC on %s\n",
 			 adapter->netdev->name);
 		adapter->ptp_flags |= IGB_PTP_ENABLED;
+		return;
 	}
+
+	if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
+		cancel_delayed_work_sync(&adapter->ptp_overflow_work);
+
+	cancel_work_sync(&adapter->ptp_tx_work);
 }
 
 /**
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 2/2] e1000e: Use PME poll to circumvent unreliable ACPI wake
  2023-08-10 17:54 [PATCH net-next 0/2][pull request] Intel Wired LAN Driver Updates 2023-08-10 (igb, e1000e) Tony Nguyen
  2023-08-10 17:54 ` [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary Tony Nguyen
@ 2023-08-10 17:54 ` Tony Nguyen
  2023-08-13  9:01   ` Leon Romanovsky
  1 sibling, 1 reply; 9+ messages in thread
From: Tony Nguyen @ 2023-08-10 17:54 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Kai-Heng Feng, anthony.l.nguyen, sasha.neftin, Naama Meir,
	Simon Horman

From: Kai-Heng Feng <kai.heng.feng@canonical.com>

On some I219 devices, ethernet cable plugging detection only works once
from PCI D3 state. Subsequent cable plugging does set PME bit correctly,
but device still doesn't get woken up.

Since I219 connects to the root complex directly, it relies on platform
firmware (ACPI) to wake it up. In this case, the GPE from _PRW only
works for first cable plugging but fails to notify the driver for
subsequent plugging events.

The issue was originally found on CNP, but the same issue can be found
on ADL too. So workaround the issue by continuing use PME poll after
first ACPI wake. As PME poll is always used, the runtime suspend
restriction for CNP can also be removed.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Acked-by: Sasha Neftin <sasha.neftin@intel.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 771a3c909c45..18a5e73b8680 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -7021,6 +7021,8 @@ static __maybe_unused int e1000e_pm_runtime_resume(struct device *dev)
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	int rc;
 
+	pdev->pme_poll = true;
+
 	rc = __e1000_resume(pdev);
 	if (rc)
 		return rc;
@@ -7682,7 +7684,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_SMART_PREPARE);
 
-	if (pci_dev_run_wake(pdev) && hw->mac.type != e1000_pch_cnp)
+	if (pci_dev_run_wake(pdev))
 		pm_runtime_put_noidle(&pdev->dev);
 
 	return 0;
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary
  2023-08-10 17:54 ` [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary Tony Nguyen
@ 2023-08-13  9:01   ` Leon Romanovsky
  2023-08-14 22:16     ` Tony Nguyen
  0 siblings, 1 reply; 9+ messages in thread
From: Leon Romanovsky @ 2023-08-13  9:01 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, kuba, pabeni, edumazet, netdev, Alessio Igor Bogani,
	richardcochran, Pucha Himasekhar Reddy

On Thu, Aug 10, 2023 at 10:54:09AM -0700, Tony Nguyen wrote:
> From: Alessio Igor Bogani <alessio.bogani@elettra.eu>
> 
> The workqueues ptp_tx_work and ptp_overflow_work are unconditionally allocated
> by igb_ptp_init(). Stop them if aren't necessary (ptp_clock_register() fails
> and CONFIG_PTP is disabled).
> 
> Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/igb/igb_ptp.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index 405886ee5261..02276c922ac0 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -1406,7 +1406,13 @@ void igb_ptp_init(struct igb_adapter *adapter)
>  		dev_info(&adapter->pdev->dev, "added PHC on %s\n",
>  			 adapter->netdev->name);
>  		adapter->ptp_flags |= IGB_PTP_ENABLED;
> +		return;
>  	}
> +
> +	if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> +		cancel_delayed_work_sync(&adapter->ptp_overflow_work);
> +
> +	cancel_work_sync(&adapter->ptp_tx_work);

Is it possible to move work initialization to be after call to ptp_clock_register()?

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index 405886ee5261..56fd2b0fe70c 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -1386,11 +1386,6 @@ void igb_ptp_init(struct igb_adapter *adapter)
        }
 
        spin_lock_init(&adapter->tmreg_lock);
-       INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
-
-       if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
-               INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
-                                 igb_ptp_overflow_check);
 
        adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
        adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
@@ -1407,6 +1402,15 @@ void igb_ptp_init(struct igb_adapter *adapter)
                         adapter->netdev->name);
                adapter->ptp_flags |= IGB_PTP_ENABLED;
        }
+
+       if (!adapter->ptp_clock)
+               return;
+
+       INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
+
+       if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
+               INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
+                                 igb_ptp_overflow_check);
 }
 
 /**




>  }
>  
>  /**
> -- 
> 2.38.1
> 
> 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 2/2] e1000e: Use PME poll to circumvent unreliable ACPI wake
  2023-08-10 17:54 ` [PATCH net-next 2/2] e1000e: Use PME poll to circumvent unreliable ACPI wake Tony Nguyen
@ 2023-08-13  9:01   ` Leon Romanovsky
  0 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2023-08-13  9:01 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, kuba, pabeni, edumazet, netdev, Kai-Heng Feng,
	sasha.neftin, Naama Meir, Simon Horman

On Thu, Aug 10, 2023 at 10:54:10AM -0700, Tony Nguyen wrote:
> From: Kai-Heng Feng <kai.heng.feng@canonical.com>
> 
> On some I219 devices, ethernet cable plugging detection only works once
> from PCI D3 state. Subsequent cable plugging does set PME bit correctly,
> but device still doesn't get woken up.
> 
> Since I219 connects to the root complex directly, it relies on platform
> firmware (ACPI) to wake it up. In this case, the GPE from _PRW only
> works for first cable plugging but fails to notify the driver for
> subsequent plugging events.
> 
> The issue was originally found on CNP, but the same issue can be found
> on ADL too. So workaround the issue by continuing use PME poll after
> first ACPI wake. As PME poll is always used, the runtime suspend
> restriction for CNP can also be removed.
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> Tested-by: Naama Meir <naamax.meir@linux.intel.com>
> Acked-by: Sasha Neftin <sasha.neftin@intel.com>
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/e1000e/netdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary
  2023-08-13  9:01   ` Leon Romanovsky
@ 2023-08-14 22:16     ` Tony Nguyen
  2023-08-15  5:23       ` Leon Romanovsky
  0 siblings, 1 reply; 9+ messages in thread
From: Tony Nguyen @ 2023-08-14 22:16 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: davem, kuba, pabeni, edumazet, netdev, Alessio Igor Bogani,
	richardcochran, Pucha Himasekhar Reddy



On 8/13/2023 2:01 AM, Leon Romanovsky wrote:
> On Thu, Aug 10, 2023 at 10:54:09AM -0700, Tony Nguyen wrote:
>> From: Alessio Igor Bogani <alessio.bogani@elettra.eu>
>>
>> The workqueues ptp_tx_work and ptp_overflow_work are unconditionally allocated
>> by igb_ptp_init(). Stop them if aren't necessary (ptp_clock_register() fails
>> and CONFIG_PTP is disabled).
>>
>> Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
>> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
>> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
>> ---
>>   drivers/net/ethernet/intel/igb/igb_ptp.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
>> index 405886ee5261..02276c922ac0 100644
>> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
>> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
>> @@ -1406,7 +1406,13 @@ void igb_ptp_init(struct igb_adapter *adapter)
>>   		dev_info(&adapter->pdev->dev, "added PHC on %s\n",
>>   			 adapter->netdev->name);
>>   		adapter->ptp_flags |= IGB_PTP_ENABLED;
>> +		return;
>>   	}
>> +
>> +	if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
>> +		cancel_delayed_work_sync(&adapter->ptp_overflow_work);
>> +
>> +	cancel_work_sync(&adapter->ptp_tx_work);
> 
> Is it possible to move work initialization to be after call to ptp_clock_register()?

I'm under the impression that everything should be ready to go before 
calling ptp_clock_register() so we shouldn't register until the 
workqueues are set up.

Thanks,
Tony

> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index 405886ee5261..56fd2b0fe70c 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -1386,11 +1386,6 @@ void igb_ptp_init(struct igb_adapter *adapter)
>          }
>   
>          spin_lock_init(&adapter->tmreg_lock);
> -       INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
> -
> -       if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> -               INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
> -                                 igb_ptp_overflow_check);
>   
>          adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
>          adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
> @@ -1407,6 +1402,15 @@ void igb_ptp_init(struct igb_adapter *adapter)
>                           adapter->netdev->name);
>                  adapter->ptp_flags |= IGB_PTP_ENABLED;
>          }
> +
> +       if (!adapter->ptp_clock)
> +               return;
> +
> +       INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
> +
> +       if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> +               INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
> +                                 igb_ptp_overflow_check);
>   }
>   
>   /**
> 
> 
> 
> 
>>   }
>>   
>>   /**
>> -- 
>> 2.38.1
>>
>>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary
  2023-08-14 22:16     ` Tony Nguyen
@ 2023-08-15  5:23       ` Leon Romanovsky
  2023-08-15  5:46         ` Rahul Rameshbabu
  0 siblings, 1 reply; 9+ messages in thread
From: Leon Romanovsky @ 2023-08-15  5:23 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, kuba, pabeni, edumazet, netdev, Alessio Igor Bogani,
	richardcochran, Pucha Himasekhar Reddy

On Mon, Aug 14, 2023 at 03:16:05PM -0700, Tony Nguyen wrote:
> 
> 
> On 8/13/2023 2:01 AM, Leon Romanovsky wrote:
> > On Thu, Aug 10, 2023 at 10:54:09AM -0700, Tony Nguyen wrote:
> > > From: Alessio Igor Bogani <alessio.bogani@elettra.eu>
> > > 
> > > The workqueues ptp_tx_work and ptp_overflow_work are unconditionally allocated
> > > by igb_ptp_init(). Stop them if aren't necessary (ptp_clock_register() fails
> > > and CONFIG_PTP is disabled).
> > > 
> > > Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
> > > Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
> > > Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> > > ---
> > >   drivers/net/ethernet/intel/igb/igb_ptp.c | 6 ++++++
> > >   1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> > > index 405886ee5261..02276c922ac0 100644
> > > --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> > > +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> > > @@ -1406,7 +1406,13 @@ void igb_ptp_init(struct igb_adapter *adapter)
> > >   		dev_info(&adapter->pdev->dev, "added PHC on %s\n",
> > >   			 adapter->netdev->name);
> > >   		adapter->ptp_flags |= IGB_PTP_ENABLED;
> > > +		return;
> > >   	}
> > > +
> > > +	if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> > > +		cancel_delayed_work_sync(&adapter->ptp_overflow_work);
> > > +
> > > +	cancel_work_sync(&adapter->ptp_tx_work);
> > 
> > Is it possible to move work initialization to be after call to ptp_clock_register()?
> 
> I'm under the impression that everything should be ready to go before
> calling ptp_clock_register() so we shouldn't register until the workqueues
> are set up.

I honestly don't know.

Thanks

> 
> Thanks,
> Tony
> 
> > diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> > index 405886ee5261..56fd2b0fe70c 100644
> > --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> > +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> > @@ -1386,11 +1386,6 @@ void igb_ptp_init(struct igb_adapter *adapter)
> >          }
> >          spin_lock_init(&adapter->tmreg_lock);
> > -       INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
> > -
> > -       if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> > -               INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
> > -                                 igb_ptp_overflow_check);
> >          adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
> >          adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
> > @@ -1407,6 +1402,15 @@ void igb_ptp_init(struct igb_adapter *adapter)
> >                           adapter->netdev->name);
> >                  adapter->ptp_flags |= IGB_PTP_ENABLED;
> >          }
> > +
> > +       if (!adapter->ptp_clock)
> > +               return;
> > +
> > +       INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
> > +
> > +       if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> > +               INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
> > +                                 igb_ptp_overflow_check);
> >   }
> >   /**
> > 
> > 
> > 
> > 
> > >   }
> > >   /**
> > > -- 
> > > 2.38.1
> > > 
> > > 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary
  2023-08-15  5:23       ` Leon Romanovsky
@ 2023-08-15  5:46         ` Rahul Rameshbabu
  2023-08-15 15:24           ` Tony Nguyen
  0 siblings, 1 reply; 9+ messages in thread
From: Rahul Rameshbabu @ 2023-08-15  5:46 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Tony Nguyen, davem, kuba, pabeni, edumazet, netdev,
	Alessio Igor Bogani, richardcochran, Pucha Himasekhar Reddy

On Tue, 15 Aug, 2023 08:23:01 +0300 Leon Romanovsky <leon@kernel.org> wrote:
> On Mon, Aug 14, 2023 at 03:16:05PM -0700, Tony Nguyen wrote:
>> 
>> 
>> On 8/13/2023 2:01 AM, Leon Romanovsky wrote:
>> > On Thu, Aug 10, 2023 at 10:54:09AM -0700, Tony Nguyen wrote:
>> > > From: Alessio Igor Bogani <alessio.bogani@elettra.eu>
>> > > 
>> > > The workqueues ptp_tx_work and ptp_overflow_work are unconditionally allocated
>> > > by igb_ptp_init(). Stop them if aren't necessary (ptp_clock_register() fails
>> > > and CONFIG_PTP is disabled).
>> > > 
>> > > Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
>> > > Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
>> > > Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
>> > > ---
>> > >   drivers/net/ethernet/intel/igb/igb_ptp.c | 6 ++++++
>> > >   1 file changed, 6 insertions(+)
>> > > 
>> > > diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
>> > > index 405886ee5261..02276c922ac0 100644
>> > > --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
>> > > +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
>> > > @@ -1406,7 +1406,13 @@ void igb_ptp_init(struct igb_adapter *adapter)
>> > >   		dev_info(&adapter->pdev->dev, "added PHC on %s\n",
>> > >   			 adapter->netdev->name);
>> > >   		adapter->ptp_flags |= IGB_PTP_ENABLED;
>> > > +		return;
>> > >   	}
>> > > +
>> > > +	if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
>> > > +		cancel_delayed_work_sync(&adapter->ptp_overflow_work);
>> > > +
>> > > +	cancel_work_sync(&adapter->ptp_tx_work);
>> > 
>> > Is it possible to move work initialization to be after call to ptp_clock_register()?
>> 
>> I'm under the impression that everything should be ready to go before
>> calling ptp_clock_register() so we shouldn't register until the workqueues
>> are set up.
>
> I honestly don't know.
>
> Thanks

I do not think it's an issue for the work initialization to be after the
call to ptp_clock_register after taking a quick read.

ptp_clock_register essentially sets up the needed infrastructure for the
ptp hardware clock (PHC) and exposes the hardware clock to the
userspace. None of the PHC operations seem to depend on scheduling work
related to the ptp_tx_work and ptp_overflow_work work_struct instances
from what I can tell. Essentially, the only case this order would matter
is if any of the adapter->ptp_caps operation callbacks depends on
scheduling related work. From what I can tell, this is not the case in
the igb driver.

>
>> 
>> Thanks,
>> Tony
>> 
>> > diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
>> > index 405886ee5261..56fd2b0fe70c 100644
>> > --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
>> > +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
>> > @@ -1386,11 +1386,6 @@ void igb_ptp_init(struct igb_adapter *adapter)
>> >          }
>> >          spin_lock_init(&adapter->tmreg_lock);
>> > -       INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
>> > -
>> > -       if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
>> > -               INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
>> > -                                 igb_ptp_overflow_check);
>> >          adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
>> >          adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
>> > @@ -1407,6 +1402,15 @@ void igb_ptp_init(struct igb_adapter *adapter)
>> >                           adapter->netdev->name);
>> >                  adapter->ptp_flags |= IGB_PTP_ENABLED;
>> >          }
>> > +
>> > +       if (!adapter->ptp_clock)
>> > +               return;
>> > +
>> > +       INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
>> > +
>> > +       if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
>> > +               INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
>> > +                                 igb_ptp_overflow_check);
>> >   }
>> >   /**
>> > 
>> > 
>> > 
>> > 
>> > >   }
>> > >   /**
>> > > -- 
>> > > 2.38.1
>> > > 
>> > > 

--
Thanks,

Rahul Rameshbabu

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary
  2023-08-15  5:46         ` Rahul Rameshbabu
@ 2023-08-15 15:24           ` Tony Nguyen
  0 siblings, 0 replies; 9+ messages in thread
From: Tony Nguyen @ 2023-08-15 15:24 UTC (permalink / raw)
  To: Rahul Rameshbabu, Leon Romanovsky
  Cc: davem, kuba, pabeni, edumazet, netdev, Alessio Igor Bogani,
	richardcochran, Pucha Himasekhar Reddy



On 8/14/2023 10:46 PM, Rahul Rameshbabu wrote:
> 
> I do not think it's an issue for the work initialization to be after the
> call to ptp_clock_register after taking a quick read.
> 
> ptp_clock_register essentially sets up the needed infrastructure for the
> ptp hardware clock (PHC) and exposes the hardware clock to the
> userspace. None of the PHC operations seem to depend on scheduling work
> related to the ptp_tx_work and ptp_overflow_work work_struct instances
> from what I can tell. Essentially, the only case this order would matter
> is if any of the adapter->ptp_caps operation callbacks depends on
> scheduling related work. From what I can tell, this is not the case in
> the igb driver.

Thanks for clearing it up Rahul. I believe I have a version from Alessio 
that has the changes that Leon suggested, but it hasn't gone through 
validation yet. I'll drop this from this PR and will send that one after 
testing.

Thanks,
Tony

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-15 15:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 17:54 [PATCH net-next 0/2][pull request] Intel Wired LAN Driver Updates 2023-08-10 (igb, e1000e) Tony Nguyen
2023-08-10 17:54 ` [PATCH net-next 1/2] igb: Stop PTP related workqueues if aren't necessary Tony Nguyen
2023-08-13  9:01   ` Leon Romanovsky
2023-08-14 22:16     ` Tony Nguyen
2023-08-15  5:23       ` Leon Romanovsky
2023-08-15  5:46         ` Rahul Rameshbabu
2023-08-15 15:24           ` Tony Nguyen
2023-08-10 17:54 ` [PATCH net-next 2/2] e1000e: Use PME poll to circumvent unreliable ACPI wake Tony Nguyen
2023-08-13  9:01   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).