Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH iwl-net v2 0/2] Enhance the tx-usecs coalesce setting implementation
@ 2023-07-11  0:34 Muhammad Husaini Zulkifli
  2023-07-11  0:34 ` [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user Muhammad Husaini Zulkifli
  2023-07-11  0:34 ` [Intel-wired-lan] [PATCH iwl-net v2 2/2] igc: Modify the tx-usecs coalesce setting Muhammad Husaini Zulkifli
  0 siblings, 2 replies; 7+ messages in thread
From: Muhammad Husaini Zulkifli @ 2023-07-11  0:34 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: anthony.l.nguyen

The current tx-usecs coalesce setting implementation in the driver code is
improved by this patch series. The implementation of the current driver code
may have previously been a copy of the legacy code i210.

Patch 1:
Allow the user to see the tx-usecs colease setting's current value when using
the ethtool command. The previous value was 0.

Patch 2:
Give the user the ability to modify the tx-usecs colease setting's value.
Previously, it was restricted to rx-usecs.

V1 -> V2:
- Split the patch file into two, like Anthony suggested.

Muhammad Husaini Zulkifli (2):
  igc: Expose tx-usecs coalesce setting to user
  igc: Modify the tx-usecs coalesce setting

 drivers/net/ethernet/intel/igc/igc_ethtool.c | 46 +++++++++++++++-----
 1 file changed, 34 insertions(+), 12 deletions(-)

--
2.17.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user
  2023-07-11  0:34 [Intel-wired-lan] [PATCH iwl-net v2 0/2] Enhance the tx-usecs coalesce setting implementation Muhammad Husaini Zulkifli
@ 2023-07-11  0:34 ` Muhammad Husaini Zulkifli
  2023-07-12 20:39   ` Tony Nguyen
  2023-07-25 11:04   ` naamax.meir
  2023-07-11  0:34 ` [Intel-wired-lan] [PATCH iwl-net v2 2/2] igc: Modify the tx-usecs coalesce setting Muhammad Husaini Zulkifli
  1 sibling, 2 replies; 7+ messages in thread
From: Muhammad Husaini Zulkifli @ 2023-07-11  0:34 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: anthony.l.nguyen

When users attempt to obtain the coalesce setting using the
ethtool command, current code always returns 0 for tx-usecs.
This is because I225/6 always uses a queue pair setting, hence
tx_coalesce_usecs does not return a value during the
igc_ethtool_get_coalesce() callback process. The pair queue
condition checking in igc_ethtool_get_coalesce() is removed by
this patch so that the user gets information of the value of tx-usecs.

Even if i225/6 is using queue pair setting, there is no harm in
notifying the user of the tx-usecs. The implementation of the current
code may have previously been a copy of the legacy code i210.

How to test:
User can get the coalesce value using ethtool command.

Example command:
Get: ethtool -c <interface>

Previous output:

rx-usecs: 3
rx-frames: n/a
rx-usecs-irq: n/a
rx-frames-irq: n/a

tx-usecs: 0
tx-frames: n/a
tx-usecs-irq: n/a
tx-frames-irq: n/a

New output:

rx-usecs: 3
rx-frames: n/a
rx-usecs-irq: n/a
rx-frames-irq: n/a

tx-usecs: 3
tx-frames: n/a
tx-usecs-irq: n/a
tx-frames-irq: n/a

Fixes: 8c5ad0dae93c ("igc: Add ethtool support")
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 93bce729be76..62d925b26f2c 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -880,12 +880,10 @@ static int igc_ethtool_get_coalesce(struct net_device *netdev,
 	else
 		ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2;
 
-	if (!(adapter->flags & IGC_FLAG_QUEUE_PAIRS)) {
-		if (adapter->tx_itr_setting <= 3)
-			ec->tx_coalesce_usecs = adapter->tx_itr_setting;
-		else
-			ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2;
-	}
+	if (adapter->tx_itr_setting <= 3)
+		ec->tx_coalesce_usecs = adapter->tx_itr_setting;
+	else
+		ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2;
 
 	return 0;
 }
@@ -910,9 +908,6 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev,
 	    ec->tx_coalesce_usecs == 2)
 		return -EINVAL;
 
-	if ((adapter->flags & IGC_FLAG_QUEUE_PAIRS) && ec->tx_coalesce_usecs)
-		return -EINVAL;
-
 	/* If ITR is disabled, disable DMAC */
 	if (ec->rx_coalesce_usecs == 0) {
 		if (adapter->flags & IGC_FLAG_DMAC)
-- 
2.17.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* [Intel-wired-lan] [PATCH iwl-net v2 2/2] igc: Modify the tx-usecs coalesce setting
  2023-07-11  0:34 [Intel-wired-lan] [PATCH iwl-net v2 0/2] Enhance the tx-usecs coalesce setting implementation Muhammad Husaini Zulkifli
  2023-07-11  0:34 ` [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user Muhammad Husaini Zulkifli
@ 2023-07-11  0:34 ` Muhammad Husaini Zulkifli
  2023-07-26 11:56   ` naamax.meir
  1 sibling, 1 reply; 7+ messages in thread
From: Muhammad Husaini Zulkifli @ 2023-07-11  0:34 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: anthony.l.nguyen

This patch enables users to modify the tx-usecs parameter.
The rx-usecs value will adhere to the same value as tx-usecs
if the queue pair setting is enabled.

How to test:
User can set the coalesce value using ethtool command.

Example command:
Set: ethtool -C <interface>

Previous output:

root@P12DYHUSAINI:~# ethtool -C enp170s0 tx-usecs 10
netlink error: Invalid argument

New output:

root@P12DYHUSAINI:~# ethtool -C enp170s0 tx-usecs 10
rx-usecs: 10
rx-frames: n/a
rx-usecs-irq: n/a
rx-frames-irq: n/a

tx-usecs: 10
tx-frames: n/a
tx-usecs-irq: n/a
tx-frames-irq: n/a

Fixes: 8c5ad0dae93c ("igc: Add ethtool support")
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 33 ++++++++++++++++++--
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 62d925b26f2c..1cf7131a82c5 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -914,6 +914,34 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev,
 			adapter->flags &= ~IGC_FLAG_DMAC;
 	}
 
+	if (adapter->flags & IGC_FLAG_QUEUE_PAIRS) {
+		u32 old_tx_itr, old_rx_itr;
+
+		/* This is to get back the original value before byte shifting */
+		old_tx_itr = (adapter->tx_itr_setting <= 3) ?
+			      adapter->tx_itr_setting : adapter->tx_itr_setting >> 2;
+
+		old_rx_itr = (adapter->rx_itr_setting <= 3) ?
+			      adapter->rx_itr_setting : adapter->rx_itr_setting >> 2;
+
+		if (old_tx_itr != ec->tx_coalesce_usecs) {
+			if (ec->tx_coalesce_usecs && ec->tx_coalesce_usecs <= 3)
+				adapter->tx_itr_setting = ec->tx_coalesce_usecs;
+			else
+				adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2;
+
+			adapter->rx_itr_setting = adapter->tx_itr_setting;
+		} else if (old_rx_itr != ec->rx_coalesce_usecs) {
+			if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3)
+				adapter->rx_itr_setting = ec->rx_coalesce_usecs;
+			else
+				adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2;
+
+			adapter->tx_itr_setting = adapter->rx_itr_setting;
+		}
+		goto program_itr;
+	}
+
 	/* convert to rate of irq's per second */
 	if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3)
 		adapter->rx_itr_setting = ec->rx_coalesce_usecs;
@@ -921,13 +949,12 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev,
 		adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2;
 
 	/* convert to rate of irq's per second */
-	if (adapter->flags & IGC_FLAG_QUEUE_PAIRS)
-		adapter->tx_itr_setting = adapter->rx_itr_setting;
-	else if (ec->tx_coalesce_usecs && ec->tx_coalesce_usecs <= 3)
+	if (ec->tx_coalesce_usecs && ec->tx_coalesce_usecs <= 3)
 		adapter->tx_itr_setting = ec->tx_coalesce_usecs;
 	else
 		adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2;
 
+program_itr:
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		struct igc_q_vector *q_vector = adapter->q_vector[i];
 
-- 
2.17.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user
  2023-07-11  0:34 ` [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user Muhammad Husaini Zulkifli
@ 2023-07-12 20:39   ` Tony Nguyen
  2023-07-13  0:09     ` Zulkifli, Muhammad Husaini
  2023-07-25 11:04   ` naamax.meir
  1 sibling, 1 reply; 7+ messages in thread
From: Tony Nguyen @ 2023-07-12 20:39 UTC (permalink / raw)
  To: Muhammad Husaini Zulkifli, intel-wired-lan

On 7/10/2023 5:34 PM, Muhammad Husaini Zulkifli wrote:

...

>   }
> @@ -910,9 +908,6 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev,
>   	    ec->tx_coalesce_usecs == 2)
>   		return -EINVAL;
>   
> -	if ((adapter->flags & IGC_FLAG_QUEUE_PAIRS) && ec->tx_coalesce_usecs)
> -		return -EINVAL;
> -

Seems like this belongs in patch 2?

>   	/* If ITR is disabled, disable DMAC */
>   	if (ec->rx_coalesce_usecs == 0) {
>   		if (adapter->flags & IGC_FLAG_DMAC)
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user
  2023-07-12 20:39   ` Tony Nguyen
@ 2023-07-13  0:09     ` Zulkifli, Muhammad Husaini
  0 siblings, 0 replies; 7+ messages in thread
From: Zulkifli, Muhammad Husaini @ 2023-07-13  0:09 UTC (permalink / raw)
  To: Nguyen, Anthony L, intel-wired-lan@osuosl.org

Dear Anthony,

> -----Original Message-----
> From: Nguyen, Anthony L <anthony.l.nguyen@intel.com>
> Sent: Thursday, 13 July, 2023 4:39 AM
> To: Zulkifli, Muhammad Husaini <muhammad.husaini.zulkifli@intel.com>; intel-
> wired-lan@osuosl.org
> Cc: Neftin, Sasha <sasha.neftin@intel.com>; naamax.meir@linux.intel.com
> Subject: Re: [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user
> 
> On 7/10/2023 5:34 PM, Muhammad Husaini Zulkifli wrote:
> 
> ...
> 
> >   }
> > @@ -910,9 +908,6 @@ static int igc_ethtool_set_coalesce(struct net_device
> *netdev,
> >   	    ec->tx_coalesce_usecs == 2)
> >   		return -EINVAL;
> >
> > -	if ((adapter->flags & IGC_FLAG_QUEUE_PAIRS) && ec-
> >tx_coalesce_usecs)
> > -		return -EINVAL;
> > -
> 
> Seems like this belongs in patch 2?

The first patch should have this. Without this line, we would be unable to configure rx-usecs at all.

> 
> >   	/* If ITR is disabled, disable DMAC */
> >   	if (ec->rx_coalesce_usecs == 0) {
> >   		if (adapter->flags & IGC_FLAG_DMAC)
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user
  2023-07-11  0:34 ` [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user Muhammad Husaini Zulkifli
  2023-07-12 20:39   ` Tony Nguyen
@ 2023-07-25 11:04   ` naamax.meir
  1 sibling, 0 replies; 7+ messages in thread
From: naamax.meir @ 2023-07-25 11:04 UTC (permalink / raw)
  To: Muhammad Husaini Zulkifli, intel-wired-lan; +Cc: anthony.l.nguyen

On 7/11/2023 03:34, Muhammad Husaini Zulkifli wrote:
> When users attempt to obtain the coalesce setting using the
> ethtool command, current code always returns 0 for tx-usecs.
> This is because I225/6 always uses a queue pair setting, hence
> tx_coalesce_usecs does not return a value during the
> igc_ethtool_get_coalesce() callback process. The pair queue
> condition checking in igc_ethtool_get_coalesce() is removed by
> this patch so that the user gets information of the value of tx-usecs.
> 
> Even if i225/6 is using queue pair setting, there is no harm in
> notifying the user of the tx-usecs. The implementation of the current
> code may have previously been a copy of the legacy code i210.
> 
> How to test:
> User can get the coalesce value using ethtool command.
> 
> Example command:
> Get: ethtool -c <interface>
> 
> Previous output:
> 
> rx-usecs: 3
> rx-frames: n/a
> rx-usecs-irq: n/a
> rx-frames-irq: n/a
> 
> tx-usecs: 0
> tx-frames: n/a
> tx-usecs-irq: n/a
> tx-frames-irq: n/a
> 
> New output:
> 
> rx-usecs: 3
> rx-frames: n/a
> rx-usecs-irq: n/a
> rx-frames-irq: n/a
> 
> tx-usecs: 3
> tx-frames: n/a
> tx-usecs-irq: n/a
> tx-frames-irq: n/a
> 
> Fixes: 8c5ad0dae93c ("igc: Add ethtool support")
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> ---
>   drivers/net/ethernet/intel/igc/igc_ethtool.c | 13 ++++---------
>   1 file changed, 4 insertions(+), 9 deletions(-)

Tested-by: Naama Meir <naamax.meir@linux.intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH iwl-net v2 2/2] igc: Modify the tx-usecs coalesce setting
  2023-07-11  0:34 ` [Intel-wired-lan] [PATCH iwl-net v2 2/2] igc: Modify the tx-usecs coalesce setting Muhammad Husaini Zulkifli
@ 2023-07-26 11:56   ` naamax.meir
  0 siblings, 0 replies; 7+ messages in thread
From: naamax.meir @ 2023-07-26 11:56 UTC (permalink / raw)
  To: Muhammad Husaini Zulkifli, intel-wired-lan; +Cc: anthony.l.nguyen

On 7/11/2023 03:34, Muhammad Husaini Zulkifli wrote:
> This patch enables users to modify the tx-usecs parameter.
> The rx-usecs value will adhere to the same value as tx-usecs
> if the queue pair setting is enabled.
> 
> How to test:
> User can set the coalesce value using ethtool command.
> 
> Example command:
> Set: ethtool -C <interface>
> 
> Previous output:
> 
> root@P12DYHUSAINI:~# ethtool -C enp170s0 tx-usecs 10
> netlink error: Invalid argument
> 
> New output:
> 
> root@P12DYHUSAINI:~# ethtool -C enp170s0 tx-usecs 10
> rx-usecs: 10
> rx-frames: n/a
> rx-usecs-irq: n/a
> rx-frames-irq: n/a
> 
> tx-usecs: 10
> tx-frames: n/a
> tx-usecs-irq: n/a
> tx-frames-irq: n/a
> 
> Fixes: 8c5ad0dae93c ("igc: Add ethtool support")
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> ---
>   drivers/net/ethernet/intel/igc/igc_ethtool.c | 33 ++++++++++++++++++--
>   1 file changed, 30 insertions(+), 3 deletions(-)


Tested-by: Naama Meir <naamax.meir@linux.intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

end of thread, other threads:[~2023-07-26 11:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-11  0:34 [Intel-wired-lan] [PATCH iwl-net v2 0/2] Enhance the tx-usecs coalesce setting implementation Muhammad Husaini Zulkifli
2023-07-11  0:34 ` [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Expose tx-usecs coalesce setting to user Muhammad Husaini Zulkifli
2023-07-12 20:39   ` Tony Nguyen
2023-07-13  0:09     ` Zulkifli, Muhammad Husaini
2023-07-25 11:04   ` naamax.meir
2023-07-11  0:34 ` [Intel-wired-lan] [PATCH iwl-net v2 2/2] igc: Modify the tx-usecs coalesce setting Muhammad Husaini Zulkifli
2023-07-26 11:56   ` naamax.meir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox