]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ice: fix rxq info registering in mbuf packets
authorLarysa Zaremba <larysa.zaremba@intel.com>
Thu, 5 Mar 2026 11:12:44 +0000 (12:12 +0100)
committerSasha Levin <sashal@kernel.org>
Thu, 12 Mar 2026 11:09:59 +0000 (07:09 -0400)
[ Upstream commit 02852b47c706772af795d3e28fca99fc9b923b2c ]

XDP RxQ info contains frag_size, which depends on the MTU. This makes the
old way of registering RxQ info before calculating new buffer sizes
invalid. Currently, it leads to frag_size being outdated, making it
sometimes impossible to grow tailroom in a mbuf packet. E.g. fragments are
actually 3K+, but frag size is still as if MTU was 1500.

Always register new XDP RxQ info after reconfiguring memory pools.

Fixes: 2fba7dc5157b ("ice: Add support for XDP multi-buffer on Rx side")
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Link: https://patch.msgid.link/20260305111253.2317394-4-larysa.zaremba@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ice/ice_base.c
drivers/net/ethernet/intel/ice/ice_ethtool.c
drivers/net/ethernet/intel/ice/ice_txrx.c
drivers/net/ethernet/intel/ice/ice_xsk.c

index f0da50df6791c9a9efd843ee0330fa47d12e0fd0..2c117ca7c76aab09403216e78c4856c8cf6c192e 100644 (file)
@@ -666,23 +666,12 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
 
        if (ring->vsi->type == ICE_VSI_PF || ring->vsi->type == ICE_VSI_SF ||
            ring->vsi->type == ICE_VSI_LB) {
-               if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) {
-                       err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
-                                                ring->q_index,
-                                                ring->q_vector->napi.napi_id,
-                                                ring->rx_buf_len);
-                       if (err)
-                               return err;
-               }
-
                ice_rx_xsk_pool(ring);
                err = ice_realloc_rx_xdp_bufs(ring, ring->xsk_pool);
                if (err)
                        return err;
 
                if (ring->xsk_pool) {
-                       xdp_rxq_info_unreg(&ring->xdp_rxq);
-
                        rx_buf_len =
                                xsk_pool_get_rx_frame_size(ring->xsk_pool);
                        err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
@@ -705,14 +694,13 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
                        if (err)
                                return err;
 
-                       if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) {
-                               err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
-                                                        ring->q_index,
-                                                        ring->q_vector->napi.napi_id,
-                                                        ring->rx_buf_len);
-                               if (err)
-                                       goto err_destroy_fq;
-                       }
+                       err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
+                                                ring->q_index,
+                                                ring->q_vector->napi.napi_id,
+                                                ring->rx_buf_len);
+                       if (err)
+                               goto err_destroy_fq;
+
                        xdp_rxq_info_attach_page_pool(&ring->xdp_rxq,
                                                      ring->pp);
                }
index 5377550a2b6e1cb9c757f3fe179336b7566aad36..1b343c53874e1ecc3d3a0eb957a86ddb3ae0acf8 100644 (file)
@@ -3332,6 +3332,7 @@ process_rx:
                rx_rings[i].cached_phctime = pf->ptp.cached_phc_time;
                rx_rings[i].desc = NULL;
                rx_rings[i].xdp_buf = NULL;
+               rx_rings[i].xdp_rxq = (struct xdp_rxq_info){ };
 
                /* this is to allow wr32 to have something to write to
                 * during early allocation of Rx buffers
index ad76768a42323f7e1058a78156d18c5104a28a1e..f47b96ceb9a4755090a8127a300d0bb1d06f7d4a 100644 (file)
@@ -560,7 +560,9 @@ void ice_clean_rx_ring(struct ice_rx_ring *rx_ring)
                        i = 0;
        }
 
-       if (rx_ring->vsi->type == ICE_VSI_PF &&
+       if ((rx_ring->vsi->type == ICE_VSI_PF ||
+            rx_ring->vsi->type == ICE_VSI_SF ||
+            rx_ring->vsi->type == ICE_VSI_LB) &&
            xdp_rxq_info_is_reg(&rx_ring->xdp_rxq)) {
                xdp_rxq_info_detach_mem_model(&rx_ring->xdp_rxq);
                xdp_rxq_info_unreg(&rx_ring->xdp_rxq);
index 989ff1fd91103e21127785a96247eef1246fef2f..102631398af3cdf7336c68f080b0df2f3517f916 100644 (file)
@@ -900,6 +900,9 @@ void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring)
        u16 ntc = rx_ring->next_to_clean;
        u16 ntu = rx_ring->next_to_use;
 
+       if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq))
+               xdp_rxq_info_unreg(&rx_ring->xdp_rxq);
+
        while (ntc != ntu) {
                struct xdp_buff *xdp = *ice_xdp_buf(rx_ring, ntc);