From nobody Fri Apr 10 02:37:13 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ADDC373C0B; Wed, 4 Mar 2026 16:36:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772642183; cv=none; b=QPc8jMPBIS9k6lZmg7ID1G/YkT/+SzNDvSvDJkf+QIVMtM0ew134CJMKy19XO1LU23LZqywzPh7wPsSWwai+24UvLQ3uMSOvu1xnptfMEG+wuf/W9ij4KrDVMwlMiECsUcL0nd7DeloTTnX2vGmevdWZHKnRpsYcpfUgLSGMBlE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772642183; c=relaxed/simple; bh=dFgFR9mD8Y+SNY8Jnfeggcz+/V/svBglT97OuTyNgW4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hSAtbGdQHpUbB5Ni9qszzmwPIHN6vonhvTSBgCuBmQEg1T6B1z9/Fs6D/u0zfpRIYTeXpyUrRAmzUfzJaJLy6aAB12oNb+fDHju7njq7SPr8UlzRHLwYWgGQpjzB99xyug3KrJeJPrUBC+iKlTCODlGa7CNozN9po0GA3qh99E4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ig2OhPhH; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ig2OhPhH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772642175; x=1804178175; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dFgFR9mD8Y+SNY8Jnfeggcz+/V/svBglT97OuTyNgW4=; b=ig2OhPhHrgS86A3S4nMYqiulgCQLlv1i2QDY4FLoe+W826EJxlJW0eut sPhaXPapfRN6+xR9oitBAwuQnYzySqZxMaGb/OcM+WZlQF9e2HWTzInVY rFmTeDil8xrFuVTlmVjQyFkfvBn7bgNwQMRRflzRDtd/o2m8uFMS8dREI YmyOPee4JAdw0/v10QU/Zgu9v5x6FxVntGHtb+sj0aZHv4BqypluqDslE XP+hn57ryzSp0juGYhrIQ528QO4eVkOxWM75jB+ONHrYJmp56d9EkxA22 M0vzDfw2rIgBTEWl2eMi08pFYq5dAGDzU7S2zkPI8kjNm8lTTh20jCQbB w==; X-CSE-ConnectionGUID: QsoC57xbSyWcalqKIXkSzg== X-CSE-MsgGUID: QQLlEfzLRTu99yQ9VKEOTA== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="72906442" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="72906442" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2026 08:36:14 -0800 X-CSE-ConnectionGUID: bmMhBjZnRnaC4vLQ7HpYNw== X-CSE-MsgGUID: xBt0cTI1Sr6BaAXFry3wFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="241405028" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa002.fm.intel.com with ESMTP; 04 Mar 2026 08:36:10 -0800 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 2E7DE312CA; Wed, 4 Mar 2026 16:36:08 +0000 (GMT) From: Larysa Zaremba To: Tony Nguyen , intel-wired-lan@lists.osuosl.org Cc: Larysa Zaremba , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexander Lobakin , Simon Horman , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Aleksandr Loktionov , Natalia Wochtman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH iwl-next v3 09/10] ixgbevf: reconfigure page pool when reallocating buffers Date: Wed, 4 Mar 2026 17:03:41 +0100 Message-ID: <20260304160345.1340940-10-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260304160345.1340940-1-larysa.zaremba@intel.com> References: <20260304160345.1340940-1-larysa.zaremba@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, when MTU is changed, page pool is not reconfigured, which leads to usage of suboptimal buffer sizes. Always destroy page pool when cleaning the ring up and create it anew when we first allocate Rx buffers. Reviewed-by: Aleksandr Loktionov Signed-off-by: Larysa Zaremba --- .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 69 +++++++++---------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/ne= t/ethernet/intel/ixgbevf/ixgbevf_main.c index d00d3b307a8f..196e51eb516a 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -1662,6 +1662,14 @@ static void ixgbevf_rx_destroy_pp(struct ixgbevf_rin= g *rx_ring) .fqes =3D rx_ring->rx_fqes, }; =20 + if (!fq.pp) + return; + + if (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); + } + libeth_rx_fq_destroy(&fq); rx_ring->rx_fqes =3D NULL; rx_ring->pp =3D NULL; @@ -1712,6 +1720,14 @@ static int ixgbevf_rx_create_pp(struct ixgbevf_ring = *rx_ring) rx_ring->truesize =3D fq.truesize; rx_ring->rx_buf_len =3D fq.buf_len; =20 + /* XDP RX-queue info */ + ret =3D __xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev, + rx_ring->queue_index, 0, rx_ring->truesize); + if (ret) + goto err; + + xdp_rxq_info_attach_page_pool(&rx_ring->xdp_rxq, rx_ring->pp); + if (!fq.hsplit) return 0; =20 @@ -1781,6 +1797,8 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_= adapter *adapter, ring->next_to_clean =3D 0; ring->next_to_use =3D 0; =20 + ixgbevf_rx_create_pp(ring); + /* RXDCTL.RLPML does not work on 82599 */ if (adapter->hw.mac.type !=3D ixgbe_mac_82599_vf) { u32 pkt_len =3D @@ -2273,8 +2291,10 @@ static void ixgbevf_clean_all_rx_rings(struct ixgbev= f_adapter *adapter) { int i; =20 - for (i =3D 0; i < adapter->num_rx_queues; i++) + for (i =3D 0; i < adapter->num_rx_queues; i++) { ixgbevf_clean_rx_ring(adapter->rx_ring[i]); + ixgbevf_rx_destroy_pp(adapter->rx_ring[i]); + } } =20 /** @@ -3295,6 +3315,11 @@ static int ixgbevf_setup_all_tx_resources(struct ixg= bevf_adapter *adapter) return err; } =20 +static struct device *ixgbevf_dma_dev_from_ring(struct ixgbevf_ring *ring) +{ + return &ring->q_vector->adapter->pdev->dev; +} + /** * ixgbevf_setup_rx_resources - allocate Rx resources * @adapter: board private structure @@ -3305,43 +3330,25 @@ static int ixgbevf_setup_all_tx_resources(struct ix= gbevf_adapter *adapter) int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *adapter, struct ixgbevf_ring *rx_ring) { - int ret; - - ret =3D ixgbevf_rx_create_pp(rx_ring); - if (ret) - return ret; - u64_stats_init(&rx_ring->syncp); =20 /* Round up to nearest 4K */ rx_ring->dma_size =3D rx_ring->count * sizeof(union ixgbe_adv_rx_desc); rx_ring->dma_size =3D ALIGN(rx_ring->dma_size, 4096); =20 - rx_ring->desc =3D dma_alloc_coherent(rx_ring->pp->p.dev, + rx_ring->desc =3D dma_alloc_coherent(ixgbevf_dma_dev_from_ring(rx_ring), rx_ring->dma_size, &rx_ring->dma, GFP_KERNEL); =20 if (!rx_ring->desc) { - ret =3D -ENOMEM; - goto err; + dev_err(rx_ring->dev, + "Unable to allocate memory for the Rx descriptor ring\n"); + return -ENOMEM; } =20 - /* XDP RX-queue info */ - ret =3D __xdp_rxq_info_reg(&rx_ring->xdp_rxq, adapter->netdev, - rx_ring->queue_index, 0, rx_ring->truesize); - if (ret) - goto err; - - xdp_rxq_info_attach_page_pool(&rx_ring->xdp_rxq, rx_ring->pp); - rx_ring->xdp_prog =3D adapter->xdp_prog; =20 return 0; -err: - ixgbevf_rx_destroy_pp(rx_ring); - dev_err(rx_ring->dev, "Unable to allocate memory for the Rx descriptor ri= ng\n"); - - return ret; } =20 /** @@ -3382,24 +3389,14 @@ static int ixgbevf_setup_all_rx_resources(struct ix= gbevf_adapter *adapter) **/ void ixgbevf_free_rx_resources(struct ixgbevf_ring *rx_ring) { - struct libeth_fq fq =3D { - .fqes =3D rx_ring->rx_fqes, - .pp =3D rx_ring->pp, - }; - ixgbevf_clean_rx_ring(rx_ring); - + ixgbevf_rx_destroy_pp(rx_ring); rx_ring->xdp_prog =3D NULL; - xdp_rxq_info_detach_mem_model(&rx_ring->xdp_rxq); - xdp_rxq_info_unreg(&rx_ring->xdp_rxq); =20 - dma_free_coherent(fq.pp->p.dev, rx_ring->dma_size, rx_ring->desc, + dma_free_coherent(ixgbevf_dma_dev_from_ring(rx_ring), + rx_ring->dma_size, rx_ring->desc, rx_ring->dma); rx_ring->desc =3D NULL; - - libeth_rx_fq_destroy(&fq); - rx_ring->rx_fqes =3D NULL; - rx_ring->pp =3D NULL; } =20 /** --=20 2.52.0