All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] igc: Clear old XDP info when changing ring settings
@ 2022-02-04  8:02 ` Kurt Kanzenbach
  0 siblings, 0 replies; 6+ messages in thread
From: Kurt Kanzenbach @ 2022-02-04  8:02 UTC (permalink / raw)
  To: Vinicius Costa Gomes, Jesse Brandeburg, Tony Nguyen
  Cc: David S. Miller, Jakub Kicinski, Alexei Starovoitov,
	Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
	Andre Guedes, Maciej Fijalkowski, Jithu Joseph, Vedang Patel,
	intel-wired-lan, netdev, Kurt Kanzenbach

When changing ring sizes the driver triggers kernel warnings in XDP code.

For instance, running 'ethtool -G $interface tx 1024 rx 1024' yields:

|[  754.838136] Missing unregister, handled but fix driver
|[  754.838143] WARNING: CPU: 4 PID: 704 at net/core/xdp.c:170 xdp_rxq_info_reg+0x7d/0xe0

The newly allocated ring is copied by memcpy() and still contains the old XDP
information. Therefore, it has to be cleared before allocating new resources
by igc_setup_rx_resources().

Igb does it the same way. Keep the code in sync.

Fixes: 4609ffb9f615 ("igc: Refactor XDP rxq info registration")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 8cc077b712ad..93839106504d 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -671,6 +671,10 @@ igc_ethtool_set_ringparam(struct net_device *netdev,
 			memcpy(&temp_ring[i], adapter->rx_ring[i],
 			       sizeof(struct igc_ring));
 
+			/* Clear copied XDP RX-queue info */
+			memset(&temp_ring[i].xdp_rxq, 0,
+			       sizeof(temp_ring[i].xdp_rxq));
+
 			temp_ring[i].count = new_rx_count;
 			err = igc_setup_rx_resources(&temp_ring[i]);
 			if (err) {
-- 
2.30.2


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

* [Intel-wired-lan] [PATCH net] igc: Clear old XDP info when changing ring settings
@ 2022-02-04  8:02 ` Kurt Kanzenbach
  0 siblings, 0 replies; 6+ messages in thread
From: Kurt Kanzenbach @ 2022-02-04  8:02 UTC (permalink / raw)
  To: intel-wired-lan

When changing ring sizes the driver triggers kernel warnings in XDP code.

For instance, running 'ethtool -G $interface tx 1024 rx 1024' yields:

|[  754.838136] Missing unregister, handled but fix driver
|[  754.838143] WARNING: CPU: 4 PID: 704 at net/core/xdp.c:170 xdp_rxq_info_reg+0x7d/0xe0

The newly allocated ring is copied by memcpy() and still contains the old XDP
information. Therefore, it has to be cleared before allocating new resources
by igc_setup_rx_resources().

Igb does it the same way. Keep the code in sync.

Fixes: 4609ffb9f615 ("igc: Refactor XDP rxq info registration")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 8cc077b712ad..93839106504d 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -671,6 +671,10 @@ igc_ethtool_set_ringparam(struct net_device *netdev,
 			memcpy(&temp_ring[i], adapter->rx_ring[i],
 			       sizeof(struct igc_ring));
 
+			/* Clear copied XDP RX-queue info */
+			memset(&temp_ring[i].xdp_rxq, 0,
+			       sizeof(temp_ring[i].xdp_rxq));
+
 			temp_ring[i].count = new_rx_count;
 			err = igc_setup_rx_resources(&temp_ring[i]);
 			if (err) {
-- 
2.30.2


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

* Re: [PATCH net] igc: Clear old XDP info when changing ring settings
  2022-02-04  8:02 ` [Intel-wired-lan] " Kurt Kanzenbach
@ 2022-02-04 17:04   ` Nguyen, Anthony L
  -1 siblings, 0 replies; 6+ messages in thread
From: Nguyen, Anthony L @ 2022-02-04 17:04 UTC (permalink / raw)
  To: Gomes, Vinicius, kurt, Brandeburg, Jesse
  Cc: davem, andre.guedes, Joseph, Jithu, john.fastabend, daniel,
	Fijalkowski, Maciej, hawk, ast, kuba, vedang.patel,
	intel-wired-lan, netdev

Hi Kurt,

On Fri, 2022-02-04 at 09:02 +0100, Kurt Kanzenbach wrote:
> When changing ring sizes the driver triggers kernel warnings in XDP
> code.
> 
> For instance, running 'ethtool -G $interface tx 1024 rx 1024' yields:
> 
> > [  754.838136] Missing unregister, handled but fix driver
> > [  754.838143] WARNING: CPU: 4 PID: 704 at net/core/xdp.c:170
> > xdp_rxq_info_reg+0x7d/0xe0
> 
> The newly allocated ring is copied by memcpy() and still contains the
> old XDP
> information. Therefore, it has to be cleared before allocating new
> resources
> by igc_setup_rx_resources().
> 
> Igb does it the same way. Keep the code in sync.

Thanks for the patch, but we have a patch[1] to resolve this issue in a
more preferred method. igb is actually changing as well to this new
solution [2].

Thanks,
Tony

[1] https://patchwork.ozlabs.org/patch/1581816/
[2] https://patchwork.ozlabs.org/patch/1581815/

> Fixes: 4609ffb9f615 ("igc: Refactor XDP rxq info registration")
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>


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

* [Intel-wired-lan] [PATCH net] igc: Clear old XDP info when changing ring settings
@ 2022-02-04 17:04   ` Nguyen, Anthony L
  0 siblings, 0 replies; 6+ messages in thread
From: Nguyen, Anthony L @ 2022-02-04 17:04 UTC (permalink / raw)
  To: intel-wired-lan

Hi Kurt,

On Fri, 2022-02-04 at 09:02 +0100, Kurt Kanzenbach wrote:
> When changing ring sizes the driver triggers kernel warnings in XDP
> code.
> 
> For instance, running 'ethtool -G $interface tx 1024 rx 1024' yields:
> 
> > [? 754.838136] Missing unregister, handled but fix driver
> > [? 754.838143] WARNING: CPU: 4 PID: 704 at net/core/xdp.c:170
> > xdp_rxq_info_reg+0x7d/0xe0
> 
> The newly allocated ring is copied by memcpy() and still contains the
> old XDP
> information. Therefore, it has to be cleared before allocating new
> resources
> by igc_setup_rx_resources().
> 
> Igb does it the same way. Keep the code in sync.

Thanks for the patch, but we have a patch[1] to resolve this issue in a
more preferred method. igb is actually changing as well to this new
solution [2].

Thanks,
Tony

[1] https://patchwork.ozlabs.org/patch/1581816/
[2] https://patchwork.ozlabs.org/patch/1581815/

> Fixes: 4609ffb9f615 ("igc: Refactor XDP rxq info registration")
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>


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

* Re: [PATCH net] igc: Clear old XDP info when changing ring settings
  2022-02-04 17:04   ` [Intel-wired-lan] " Nguyen, Anthony L
@ 2022-02-05  9:57     ` Kurt Kanzenbach
  -1 siblings, 0 replies; 6+ messages in thread
From: Kurt Kanzenbach @ 2022-02-05  9:57 UTC (permalink / raw)
  To: Nguyen, Anthony L, Gomes, Vinicius, Brandeburg, Jesse
  Cc: davem, andre.guedes, Joseph, Jithu, john.fastabend, daniel,
	Fijalkowski, Maciej, hawk, ast, kuba, vedang.patel,
	intel-wired-lan, netdev

[-- Attachment #1: Type: text/plain, Size: 231 bytes --]

On Fri Feb 04 2022, Anthony L. Nguyen wrote:
> Thanks for the patch, but we have a patch[1] to resolve this issue in a
> more preferred method. igb is actually changing as well to this new
> solution [2].

OK, great.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

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

* [Intel-wired-lan] [PATCH net] igc: Clear old XDP info when changing ring settings
@ 2022-02-05  9:57     ` Kurt Kanzenbach
  0 siblings, 0 replies; 6+ messages in thread
From: Kurt Kanzenbach @ 2022-02-05  9:57 UTC (permalink / raw)
  To: intel-wired-lan

On Fri Feb 04 2022, Anthony L. Nguyen wrote:
> Thanks for the patch, but we have a patch[1] to resolve this issue in a
> more preferred method. igb is actually changing as well to this new
> solution [2].

OK, great.

Thanks,
Kurt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 861 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20220205/97771d38/attachment-0001.asc>

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

end of thread, other threads:[~2022-02-05  9:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04  8:02 [PATCH net] igc: Clear old XDP info when changing ring settings Kurt Kanzenbach
2022-02-04  8:02 ` [Intel-wired-lan] " Kurt Kanzenbach
2022-02-04 17:04 ` Nguyen, Anthony L
2022-02-04 17:04   ` [Intel-wired-lan] " Nguyen, Anthony L
2022-02-05  9:57   ` Kurt Kanzenbach
2022-02-05  9:57     ` [Intel-wired-lan] " Kurt Kanzenbach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.