From nobody Fri Apr 10 02:37:11 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 6D647374745; Wed, 4 Mar 2026 16:36:16 +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=1772642184; cv=none; b=rX9MoWhVD4cpgGrf0E973SYRNzBocEczVHXN0hxLJWuvKnNSMHEi5JpXVetuoPcTwrUr3YRPf3Ue0AqilBIIhuV9kARMl/rHMb7MlBOPgmPVID9w0eyvflE1Jlaxa8uoF182V/GoyE0nlkekV3nr2V7sTaSQdkj3lM+nh+mP2ys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772642184; c=relaxed/simple; bh=xSoRegfDOP/5IirhtXxj8ro8oytZUXfZQIPbEnLhFj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fKLX5/v2yVkpSvyRNb3gnXtagZyMWNJ0rq2Z7HUTSGIwARmHuAdc+Z5DPcXh64ci1u3AW923gQ6nt1hGkzA9Apdhf06z90ajIXEehlH7KKpLb3SK4ibu61RoxcbqSkm43gN4qbFh1ktT3RKcVkAXqj5SFQw3ZidHjEUZ2VjGk4Q= 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=W1fvYWFH; 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="W1fvYWFH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772642176; x=1804178176; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xSoRegfDOP/5IirhtXxj8ro8oytZUXfZQIPbEnLhFj0=; b=W1fvYWFHPWDTUvwr+a6TUurNqZ/eK7OHMrVTvsKdUEegMXpoVQChGinI 1GjOKr9JJyANH+TkqeLaIy7z8KeEknOgV7czEtfVZblp22HWnCKF4We/g VEkABcEN9q4fTOvQNPj3c3XGMF/C1osDQszLCwJRSO+rtHvAFNtFI8PbM MJO/Y8rILcbXS55L2/tdTyhMl9N4aPT2SMxwqgffyb9vsX9Sy73HmV9Aa doxQ4cs5T7pVkB3H4nqrcQnoJJR7G5A+Pf4WiyaEsgDvw3M6tmABDP/zm wuVfRasade6sYtJu49yel6SvrB0c1CpihF/4Y0oDibNst+nr3f+5ke/gz g==; X-CSE-ConnectionGUID: lPlGa30tR7a5mWu+tY9sEA== X-CSE-MsgGUID: XIKd8roiTBCe43olBpK+NA== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="72906460" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="72906460" 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:15 -0800 X-CSE-ConnectionGUID: 7wkR9efNR9uyL5ijqtiN3Q== X-CSE-MsgGUID: 1fYrwHwiR7qWLIM1XMTJOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="241405043" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa002.fm.intel.com with ESMTP; 04 Mar 2026 08:36:11 -0800 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 109DB312CB; Wed, 4 Mar 2026 16:36:10 +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 10/10] ixgbevf: allow changing MTU when XDP program is attached Date: Wed, 4 Mar 2026 17:03:42 +0100 Message-ID: <20260304160345.1340940-11-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" xskxceiver attempts to change MTU after attaching XDP program, ixgbevf rejects the request leading to test being failed. Support MTU change operation even when XDP program is already attached, perform the same frame size check as when attaching a program. Reviewed-by: Aleksandr Loktionov Signed-off-by: Larysa Zaremba --- .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/ne= t/ethernet/intel/ixgbevf/ixgbevf_main.c index 196e51eb516a..08ea2ae45cea 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -569,8 +569,8 @@ static void ixgbevf_alloc_rx_buffers(struct ixgbevf_rin= g *rx_ring, }; u16 ntu =3D rx_ring->next_to_use; =20 - /* nothing to do or no valid netdev defined */ - if (unlikely(!cleaned_count || !rx_ring->netdev)) + /* nothing to do or page pool is not present */ + if (unlikely(!cleaned_count || !fq.pp)) return; =20 rx_desc =3D IXGBEVF_RX_DESC(rx_ring, ntu); @@ -1764,6 +1764,7 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_= adapter *adapter, bool rlpml_valid =3D false; u64 rdba =3D ring->dma; u32 rxdctl; + int err; =20 /* disable queue to avoid issues while updating state */ rxdctl =3D IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx)); @@ -1797,7 +1798,13 @@ 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); + err =3D ixgbevf_rx_create_pp(ring); + if (err) { + netdev_err(ring->netdev, + "Failed to create Page Pool for buffer allocation: (%pe), RxQ %d is = disabled, driver reload may be needed\n", + ERR_PTR(err), ring->queue_index); + return; + } =20 /* RXDCTL.RLPML does not work on 82599 */ if (adapter->hw.mac.type !=3D ixgbe_mac_82599_vf) { @@ -4082,6 +4089,18 @@ static int ixgbevf_set_mac(struct net_device *netdev= , void *p) return 0; } =20 +static bool ixgbevf_xdp_mtu_ok(const struct ixgbevf_adapter *adapter, + const struct bpf_prog *prog, unsigned int mtu) +{ + u32 frame_size =3D mtu + LIBETH_RX_LL_LEN; + bool requires_mbuf; + + requires_mbuf =3D frame_size > IXGBEVF_RX_PAGE_LEN(LIBETH_XDP_HEADROOM) || + adapter->flags & IXGBEVF_FLAG_HSPLIT; + + return prog->aux->xdp_has_frags || !requires_mbuf; +} + /** * ixgbevf_change_mtu - Change the Maximum Transfer Unit * @netdev: network interface device structure @@ -4097,8 +4116,10 @@ static int ixgbevf_change_mtu(struct net_device *net= dev, int new_mtu) int ret; =20 /* prevent MTU being changed to a size unsupported by XDP */ - if (adapter->xdp_prog) { - dev_warn(&adapter->pdev->dev, "MTU cannot be changed while XDP program i= s loaded\n"); + if (adapter->xdp_prog && + !ixgbevf_xdp_mtu_ok(adapter, adapter->xdp_prog, new_mtu)) { + netdev_warn(netdev, + "MTU value provided cannot be set while current XDP program is atta= ched\n"); return -EPERM; } =20 @@ -4261,14 +4282,10 @@ ixgbevf_features_check(struct sk_buff *skb, struct = net_device *dev, static int ixgbevf_xdp_setup(struct net_device *dev, struct bpf_prog *prog, struct netlink_ext_ack *extack) { - u32 frame_size =3D READ_ONCE(dev->mtu) + LIBETH_RX_LL_LEN; struct ixgbevf_adapter *adapter =3D netdev_priv(dev); struct bpf_prog *old_prog; - bool requires_mbuf; =20 - requires_mbuf =3D frame_size > IXGBEVF_RX_PAGE_LEN(LIBETH_XDP_HEADROOM) || - adapter->flags & IXGBEVF_FLAG_HSPLIT; - if (prog && !prog->aux->xdp_has_frags && requires_mbuf) { + if (prog && !ixgbevf_xdp_mtu_ok(adapter, prog, READ_ONCE(dev->mtu))) { NL_SET_ERR_MSG_MOD(extack, "Configured MTU or HW limitations require non-linear frames and XDP= prog does not support frags"); return -EOPNOTSUPP; --=20 2.52.0