* [PATCH 0/2 net-next v6] igb/igc: fix XDP registration
@ 2022-01-19 14:52 Corinna Vinschen
2022-01-19 14:52 ` [PATCH 1/2 net-next v6] igc: avoid kernel warning when changing RX ring parameters Corinna Vinschen
2022-01-19 14:52 ` [PATCH 2/2 net-next v6] igb: refactor XDP registration Corinna Vinschen
0 siblings, 2 replies; 7+ messages in thread
From: Corinna Vinschen @ 2022-01-19 14:52 UTC (permalink / raw)
To: intel-wired-lan, netdev, Vinicius Costa Gomes
Cc: Lennert Buytenhek, Alexander Lobakin
Fix the kernel warning "Missing unregister, handled but fix driver"
when running, e.g.,
$ ethtool -G eth0 rx 1024
on igc. Remove memset hack from igb and align igb code to igc.
v3: use dev_err rather than netdev_err, just as in error case.
v4: fix a return copy/pasted from original igc code into the correct
`goto err', improve commit message.
v5: add missing dma_free_coherent calls in error case.
v6: refactor code to register with XDP first, as in igc originally.
Corinna Vinschen (2):
igc: avoid kernel warning when changing RX ring parameters
igb: refactor XDP registration
drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ----
drivers/net/ethernet/intel/igb/igb_main.c | 19 +++++++++++++------
drivers/net/ethernet/intel/igc/igc_main.c | 3 +++
3 files changed, 16 insertions(+), 10 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/2 net-next v6] igc: avoid kernel warning when changing RX ring parameters 2022-01-19 14:52 [PATCH 0/2 net-next v6] igb/igc: fix XDP registration Corinna Vinschen @ 2022-01-19 14:52 ` Corinna Vinschen 2022-01-26 17:13 ` Vinicius Costa Gomes 2022-01-19 14:52 ` [PATCH 2/2 net-next v6] igb: refactor XDP registration Corinna Vinschen 1 sibling, 1 reply; 7+ messages in thread From: Corinna Vinschen @ 2022-01-19 14:52 UTC (permalink / raw) To: intel-wired-lan, netdev, Vinicius Costa Gomes Cc: Lennert Buytenhek, Alexander Lobakin Calling ethtool changing the RX ring parameters like this: $ ethtool -G eth0 rx 1024 on igc triggers kernel warnings like this: [ 225.198467] ------------[ cut here ]------------ [ 225.198473] Missing unregister, handled but fix driver [ 225.198485] WARNING: CPU: 7 PID: 959 at net/core/xdp.c:168 xdp_rxq_info_reg+0x79/0xd0 [...] [ 225.198601] Call Trace: [ 225.198604] <TASK> [ 225.198609] igc_setup_rx_resources+0x3f/0xe0 [igc] [ 225.198617] igc_ethtool_set_ringparam+0x30e/0x450 [igc] [ 225.198626] ethnl_set_rings+0x18a/0x250 [ 225.198631] genl_family_rcv_msg_doit+0xca/0x110 [ 225.198637] genl_rcv_msg+0xce/0x1c0 [ 225.198640] ? rings_prepare_data+0x60/0x60 [ 225.198644] ? genl_get_cmd+0xd0/0xd0 [ 225.198647] netlink_rcv_skb+0x4e/0xf0 [ 225.198652] genl_rcv+0x24/0x40 [ 225.198655] netlink_unicast+0x20e/0x330 [ 225.198659] netlink_sendmsg+0x23f/0x480 [ 225.198663] sock_sendmsg+0x5b/0x60 [ 225.198667] __sys_sendto+0xf0/0x160 [ 225.198671] ? handle_mm_fault+0xb2/0x280 [ 225.198676] ? do_user_addr_fault+0x1eb/0x690 [ 225.198680] __x64_sys_sendto+0x20/0x30 [ 225.198683] do_syscall_64+0x38/0x90 [ 225.198687] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 225.198693] RIP: 0033:0x7f7ae38ac3aa igc_ethtool_set_ringparam() copies the igc_ring structure but neglects to reset the xdp_rxq_info member before calling igc_setup_rx_resources(). This in turn calls xdp_rxq_info_reg() with an already registered xdp_rxq_info. Make sure to unregister the xdp_rxq_info structure first in igc_setup_rx_resources. Fixes: 73f1071c1d29 ("igc: Add support for XDP_TX action") Reported-by: Lennert Buytenhek <buytenh@arista.com> Signed-off-by: Corinna Vinschen <vinschen@redhat.com> --- drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 2f17f36e94fd..adfc3d7fff5d 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -505,6 +505,9 @@ int igc_setup_rx_resources(struct igc_ring *rx_ring) u8 index = rx_ring->queue_index; int size, desc_len, res; + /* XDP RX-queue info */ + if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq)) + xdp_rxq_info_unreg(&rx_ring->xdp_rxq); res = xdp_rxq_info_reg(&rx_ring->xdp_rxq, ndev, index, rx_ring->q_vector->napi.napi_id); if (res < 0) { -- 2.27.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2 net-next v6] igc: avoid kernel warning when changing RX ring parameters 2022-01-19 14:52 ` [PATCH 1/2 net-next v6] igc: avoid kernel warning when changing RX ring parameters Corinna Vinschen @ 2022-01-26 17:13 ` Vinicius Costa Gomes 0 siblings, 0 replies; 7+ messages in thread From: Vinicius Costa Gomes @ 2022-01-26 17:13 UTC (permalink / raw) To: Corinna Vinschen, intel-wired-lan, netdev Cc: Lennert Buytenhek, Alexander Lobakin Corinna Vinschen <vinschen@redhat.com> writes: > Calling ethtool changing the RX ring parameters like this: > > $ ethtool -G eth0 rx 1024 > > on igc triggers kernel warnings like this: > > [ 225.198467] ------------[ cut here ]------------ > [ 225.198473] Missing unregister, handled but fix driver > [ 225.198485] WARNING: CPU: 7 PID: 959 at net/core/xdp.c:168 > xdp_rxq_info_reg+0x79/0xd0 > [...] > [ 225.198601] Call Trace: > [ 225.198604] <TASK> > [ 225.198609] igc_setup_rx_resources+0x3f/0xe0 [igc] > [ 225.198617] igc_ethtool_set_ringparam+0x30e/0x450 [igc] > [ 225.198626] ethnl_set_rings+0x18a/0x250 > [ 225.198631] genl_family_rcv_msg_doit+0xca/0x110 > [ 225.198637] genl_rcv_msg+0xce/0x1c0 > [ 225.198640] ? rings_prepare_data+0x60/0x60 > [ 225.198644] ? genl_get_cmd+0xd0/0xd0 > [ 225.198647] netlink_rcv_skb+0x4e/0xf0 > [ 225.198652] genl_rcv+0x24/0x40 > [ 225.198655] netlink_unicast+0x20e/0x330 > [ 225.198659] netlink_sendmsg+0x23f/0x480 > [ 225.198663] sock_sendmsg+0x5b/0x60 > [ 225.198667] __sys_sendto+0xf0/0x160 > [ 225.198671] ? handle_mm_fault+0xb2/0x280 > [ 225.198676] ? do_user_addr_fault+0x1eb/0x690 > [ 225.198680] __x64_sys_sendto+0x20/0x30 > [ 225.198683] do_syscall_64+0x38/0x90 > [ 225.198687] entry_SYSCALL_64_after_hwframe+0x44/0xae > [ 225.198693] RIP: 0033:0x7f7ae38ac3aa > > igc_ethtool_set_ringparam() copies the igc_ring structure but neglects to > reset the xdp_rxq_info member before calling igc_setup_rx_resources(). > This in turn calls xdp_rxq_info_reg() with an already registered xdp_rxq_info. > > Make sure to unregister the xdp_rxq_info structure first in > igc_setup_rx_resources. > > Fixes: 73f1071c1d29 ("igc: Add support for XDP_TX action") > Reported-by: Lennert Buytenhek <buytenh@arista.com> > Signed-off-by: Corinna Vinschen <vinschen@redhat.com> > --- Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> -- Vinicius ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2 net-next v6] igb: refactor XDP registration 2022-01-19 14:52 [PATCH 0/2 net-next v6] igb/igc: fix XDP registration Corinna Vinschen 2022-01-19 14:52 ` [PATCH 1/2 net-next v6] igc: avoid kernel warning when changing RX ring parameters Corinna Vinschen @ 2022-01-19 14:52 ` Corinna Vinschen 2022-01-26 17:14 ` Vinicius Costa Gomes ` (2 more replies) 1 sibling, 3 replies; 7+ messages in thread From: Corinna Vinschen @ 2022-01-19 14:52 UTC (permalink / raw) To: intel-wired-lan, netdev, Vinicius Costa Gomes Cc: Lennert Buytenhek, Alexander Lobakin On changing the RX ring parameters igb uses a hack to avoid a warning when calling xdp_rxq_info_reg via igb_setup_rx_resources. It just clears the struct xdp_rxq_info content. Instead, change this to unregister if we're already registered. Align code to the igc code. Fixes: 9cbc948b5a20c ("igb: add XDP support") Signed-off-by: Corinna Vinschen <vinschen@redhat.com> --- drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ---- drivers/net/ethernet/intel/igb/igb_main.c | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 51a2dcaf553d..2a5782063f4c 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -965,10 +965,6 @@ static int igb_set_ringparam(struct net_device *netdev, memcpy(&temp_ring[i], adapter->rx_ring[i], sizeof(struct igb_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 = igb_setup_rx_resources(&temp_ring[i]); if (err) { diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 38ba92022cd4..c1e4ad65b02d 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -4352,7 +4352,18 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) { struct igb_adapter *adapter = netdev_priv(rx_ring->netdev); struct device *dev = rx_ring->dev; - int size; + int size, res; + + /* XDP RX-queue info */ + if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq)) + xdp_rxq_info_unreg(&rx_ring->xdp_rxq); + res = xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev, + rx_ring->queue_index, 0); + if (res < 0) { + dev_err(dev, "Failed to register xdp_rxq index %u\n", + rx_ring->queue_index); + return res; + } size = sizeof(struct igb_rx_buffer) * rx_ring->count; @@ -4375,14 +4386,10 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) rx_ring->xdp_prog = adapter->xdp_prog; - /* XDP RX-queue info */ - if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev, - rx_ring->queue_index, 0) < 0) - goto err; - return 0; err: + xdp_rxq_info_unreg(&rx_ring->xdp_rxq); vfree(rx_ring->rx_buffer_info); rx_ring->rx_buffer_info = NULL; dev_err(dev, "Unable to allocate memory for the Rx descriptor ring\n"); -- 2.27.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2 net-next v6] igb: refactor XDP registration 2022-01-19 14:52 ` [PATCH 2/2 net-next v6] igb: refactor XDP registration Corinna Vinschen @ 2022-01-26 17:14 ` Vinicius Costa Gomes 2022-02-05 12:14 ` [Intel-wired-lan] " Corinna Vinschen 2022-02-07 8:58 ` Penigalapati, Sandeep 2 siblings, 0 replies; 7+ messages in thread From: Vinicius Costa Gomes @ 2022-01-26 17:14 UTC (permalink / raw) To: Corinna Vinschen, intel-wired-lan, netdev Cc: Lennert Buytenhek, Alexander Lobakin Corinna Vinschen <vinschen@redhat.com> writes: > On changing the RX ring parameters igb uses a hack to avoid a warning > when calling xdp_rxq_info_reg via igb_setup_rx_resources. It just > clears the struct xdp_rxq_info content. > > Instead, change this to unregister if we're already registered. Align > code to the igc code. > > Fixes: 9cbc948b5a20c ("igb: add XDP support") > Signed-off-by: Corinna Vinschen <vinschen@redhat.com> > --- Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> -- Vinicius ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH 2/2 net-next v6] igb: refactor XDP registration 2022-01-19 14:52 ` [PATCH 2/2 net-next v6] igb: refactor XDP registration Corinna Vinschen 2022-01-26 17:14 ` Vinicius Costa Gomes @ 2022-02-05 12:14 ` Corinna Vinschen 2022-02-07 8:58 ` Penigalapati, Sandeep 2 siblings, 0 replies; 7+ messages in thread From: Corinna Vinschen @ 2022-02-05 12:14 UTC (permalink / raw) To: intel-wired-lan, netdev, Vinicius Costa Gomes On Jan 19 15:52, Corinna Vinschen wrote: > On changing the RX ring parameters igb uses a hack to avoid a warning > when calling xdp_rxq_info_reg via igb_setup_rx_resources. It just > clears the struct xdp_rxq_info content. > > Instead, change this to unregister if we're already registered. Align > code to the igc code. > > Fixes: 9cbc948b5a20c ("igb: add XDP support") > Signed-off-by: Corinna Vinschen <vinschen@redhat.com> > --- > drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ---- > drivers/net/ethernet/intel/igb/igb_main.c | 19 +++++++++++++------ > 2 files changed, 13 insertions(+), 10 deletions(-) Any chance this could be set to "Tested" to go forward here? Thanks, Corinna ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [Intel-wired-lan] [PATCH 2/2 net-next v6] igb: refactor XDP registration 2022-01-19 14:52 ` [PATCH 2/2 net-next v6] igb: refactor XDP registration Corinna Vinschen 2022-01-26 17:14 ` Vinicius Costa Gomes 2022-02-05 12:14 ` [Intel-wired-lan] " Corinna Vinschen @ 2022-02-07 8:58 ` Penigalapati, Sandeep 2 siblings, 0 replies; 7+ messages in thread From: Penigalapati, Sandeep @ 2022-02-07 8:58 UTC (permalink / raw) To: Corinna Vinschen, intel-wired-lan@osuosl.org, netdev@vger.kernel.org, Gomes, Vinicius >-----Original Message----- >From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of >Corinna Vinschen >Sent: Wednesday, January 19, 2022 8:23 PM >To: intel-wired-lan@osuosl.org; netdev@vger.kernel.org; Gomes, Vinicius ><vinicius.gomes@intel.com> >Subject: [Intel-wired-lan] [PATCH 2/2 net-next v6] igb: refactor XDP >registration > >On changing the RX ring parameters igb uses a hack to avoid a warning when >calling xdp_rxq_info_reg via igb_setup_rx_resources. It just clears the struct >xdp_rxq_info content. > >Instead, change this to unregister if we're already registered. Align code to >the igc code. > >Fixes: 9cbc948b5a20c ("igb: add XDP support") >Signed-off-by: Corinna Vinschen <vinschen@redhat.com> >--- > drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ---- > drivers/net/ethernet/intel/igb/igb_main.c | 19 +++++++++++++------ > 2 files changed, 13 insertions(+), 10 deletions(-) > Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-02-07 9:08 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-01-19 14:52 [PATCH 0/2 net-next v6] igb/igc: fix XDP registration Corinna Vinschen 2022-01-19 14:52 ` [PATCH 1/2 net-next v6] igc: avoid kernel warning when changing RX ring parameters Corinna Vinschen 2022-01-26 17:13 ` Vinicius Costa Gomes 2022-01-19 14:52 ` [PATCH 2/2 net-next v6] igb: refactor XDP registration Corinna Vinschen 2022-01-26 17:14 ` Vinicius Costa Gomes 2022-02-05 12:14 ` [Intel-wired-lan] " Corinna Vinschen 2022-02-07 8:58 ` Penigalapati, Sandeep
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).