diff mbox series

[net] igc: Clear old XDP info when changing ring settings

Message ID 20220204080217.70054-1-kurt@linutronix.de (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net] igc: Clear old XDP info when changing ring settings | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: bpf@vger.kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Kurt Kanzenbach Feb. 4, 2022, 8:02 a.m. UTC
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(+)

Comments

Tony Nguyen Feb. 4, 2022, 5:04 p.m. UTC | #1
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>
Kurt Kanzenbach Feb. 5, 2022, 9:57 a.m. UTC | #2
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
diff mbox series

Patch

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) {