From: Corinna Vinschen <vinschen@redhat.com> To: intel-wired-lan@osuosl.org, netdev@vger.kernel.org, Vinicius Costa Gomes <vinicius.gomes@intel.com> Cc: Lennert Buytenhek <buytenh@wantstofly.org>, Alexander Lobakin <alexandr.lobakin@intel.com> Subject: [PATCH 1/2 net-next v2] igc: avoid kernel warning when changing RX ring parameters Date: Fri, 14 Jan 2022 12:43:53 +0100 [thread overview] Message-ID: <20220114114354.1071776-2-vinschen@redhat.com> (raw) In-Reply-To: <20220114114354.1071776-1-vinschen@redhat.com> Calling ethtool changing the RX ring parameters like this: $ ethtool -G eth0 rx 1024 on igc triggers the "Missing unregister, handled but fix driver" warning in xdp_rxq_info_reg(). 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. Move xdp_rxq_info handling down to bethe last action, thus allowing to remove the xdp_rxq_info_unreg call in the error path. Fixes: 73f1071c1d29 ("igc: Add support for XDP_TX action") Signed-off-by: Corinna Vinschen <vinschen@redhat.com> --- drivers/net/ethernet/intel/igc/igc_main.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 2f17f36e94fd..97144f6db36e 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -505,14 +505,6 @@ int igc_setup_rx_resources(struct igc_ring *rx_ring) u8 index = rx_ring->queue_index; int size, desc_len, res; - res = xdp_rxq_info_reg(&rx_ring->xdp_rxq, ndev, index, - rx_ring->q_vector->napi.napi_id); - if (res < 0) { - netdev_err(ndev, "Failed to register xdp_rxq index %u\n", - index); - return res; - } - size = sizeof(struct igc_rx_buffer) * rx_ring->count; rx_ring->rx_buffer_info = vzalloc(size); if (!rx_ring->rx_buffer_info) @@ -534,10 +526,20 @@ int igc_setup_rx_resources(struct igc_ring *rx_ring) rx_ring->next_to_clean = 0; rx_ring->next_to_use = 0; + /* 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) { + netdev_err(ndev, "Failed to register xdp_rxq index %u\n", + index); + return res; + } + return 0; err: - xdp_rxq_info_unreg(&rx_ring->xdp_rxq); vfree(rx_ring->rx_buffer_info); rx_ring->rx_buffer_info = NULL; netdev_err(ndev, "Unable to allocate memory for Rx descriptor ring\n"); -- 2.27.0
WARNING: multiple messages have this Message-ID (diff)
From: Corinna Vinschen <vinschen@redhat.com> To: intel-wired-lan@osuosl.org Subject: [Intel-wired-lan] [PATCH 1/2 net-next v2] igc: avoid kernel warning when changing RX ring parameters Date: Fri, 14 Jan 2022 12:43:53 +0100 [thread overview] Message-ID: <20220114114354.1071776-2-vinschen@redhat.com> (raw) In-Reply-To: <20220114114354.1071776-1-vinschen@redhat.com> Calling ethtool changing the RX ring parameters like this: $ ethtool -G eth0 rx 1024 on igc triggers the "Missing unregister, handled but fix driver" warning in xdp_rxq_info_reg(). 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. Move xdp_rxq_info handling down to bethe last action, thus allowing to remove the xdp_rxq_info_unreg call in the error path. Fixes: 73f1071c1d29 ("igc: Add support for XDP_TX action") Signed-off-by: Corinna Vinschen <vinschen@redhat.com> --- drivers/net/ethernet/intel/igc/igc_main.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 2f17f36e94fd..97144f6db36e 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -505,14 +505,6 @@ int igc_setup_rx_resources(struct igc_ring *rx_ring) u8 index = rx_ring->queue_index; int size, desc_len, res; - res = xdp_rxq_info_reg(&rx_ring->xdp_rxq, ndev, index, - rx_ring->q_vector->napi.napi_id); - if (res < 0) { - netdev_err(ndev, "Failed to register xdp_rxq index %u\n", - index); - return res; - } - size = sizeof(struct igc_rx_buffer) * rx_ring->count; rx_ring->rx_buffer_info = vzalloc(size); if (!rx_ring->rx_buffer_info) @@ -534,10 +526,20 @@ int igc_setup_rx_resources(struct igc_ring *rx_ring) rx_ring->next_to_clean = 0; rx_ring->next_to_use = 0; + /* 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) { + netdev_err(ndev, "Failed to register xdp_rxq index %u\n", + index); + return res; + } + return 0; err: - xdp_rxq_info_unreg(&rx_ring->xdp_rxq); vfree(rx_ring->rx_buffer_info); rx_ring->rx_buffer_info = NULL; netdev_err(ndev, "Unable to allocate memory for Rx descriptor ring\n"); -- 2.27.0
next prev parent reply other threads:[~2022-01-14 11:44 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-14 11:43 [PATCH 0/2 net-next v2] igb/igc: fix XDP registration Corinna Vinschen 2022-01-14 11:43 ` [Intel-wired-lan] " Corinna Vinschen 2022-01-14 11:43 ` Corinna Vinschen [this message] 2022-01-14 11:43 ` [Intel-wired-lan] [PATCH 1/2 net-next v2] igc: avoid kernel warning when changing RX ring parameters Corinna Vinschen 2022-01-14 11:43 ` [PATCH 2/2 net-next v2] igb: refactor XDP registration Corinna Vinschen 2022-01-14 11:43 ` [Intel-wired-lan] " Corinna Vinschen 2022-01-14 14:13 ` Denis Kirjanov 2022-01-14 14:13 ` [Intel-wired-lan] " Denis Kirjanov 2022-01-14 16:51 ` Corinna Vinschen 2022-01-14 16:51 ` [Intel-wired-lan] " Corinna Vinschen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220114114354.1071776-2-vinschen@redhat.com \ --to=vinschen@redhat.com \ --cc=alexandr.lobakin@intel.com \ --cc=buytenh@wantstofly.org \ --cc=intel-wired-lan@osuosl.org \ --cc=netdev@vger.kernel.org \ --cc=vinicius.gomes@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.