Article View: linux.kernel.netdev
Article #20323[PATCH net-next v2 6/9] eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling
From: Jakub Kicinski
Date: Sun, 22 Nov 2026 01:01
Date: Sun, 22 Nov 2026 01:01
139 lines
13075 bytes
13075 bytes
The core clears HW-GRO and LRO before ndo_bpf runs and keeps them off
for as long as a program is attached. mlx5e_fix_features() never sees
either with params->xdp_prog set, and packet merge is always off by the
time mlx5e_xdp_set() gets called, packet_merge.type only follows the two
feature handlers. If tcp-data-split keeps HW-GRO on, the core refuses
the attach with -EBUSY before calling the driver.
The netdev_update_features() call at the end of mlx5e_xdp_set() was
there to apply and release the XDP clause of mlx5e_fix_features().
The core recomputes the features itself, on detach after the program
is gone.
XDP features were only advertised with packet merge off, matching
the old refusal. Key them off tcp-data-split instead, the only setting
under which the attach is still refused.
The AF_XDP check stays, the core doesn't know about XSK pools.
This does change user visible behavior: attaching XDP with HW-GRO or LRO
on used to fail with -EINVAL and now succeeds with them turned off.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2:
- drop the netdev_update_features() call from mlx5e_xdp_set() (Dragos)
- key XDP features off tcp-data-split rather than packet merge (Dragos)
v1: https://lore.kernel.org/20261118232315.3593731-6-kuba@kernel.org
---
.../ethernet/mellanox/mlx5/core/en_ethtool.c | 8 +++-
.../net/ethernet/mellanox/mlx5/core/en_main.c | 40 +++----------------
2 files changed, 12 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 8e7c748caf2d..da224ad3dea9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -488,9 +488,13 @@ static int mlx5e_set_ringparam(struct net_device *dev,
if (err)
return err;
- /* Might need to adjust HW-GRO if it was kept on/off due to hds. */
- if (dev->cfg->hds_config != kernel_param->tcp_data_split)
+ /* Might need to adjust HW-GRO if it was kept on/off due to hds.
+ * XDP features depend on hds as well.
+ */
+ if (dev->cfg->hds_config != kernel_param->tcp_data_split) {
netdev_update_features(priv->netdev);
+ mlx5e_set_xdp_feature(priv);
+ }
return 0;
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 06a8a4be4be7..08568137d044 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4487,12 +4487,14 @@ static int mlx5e_handle_feature(struct net_device *netdev,
void mlx5e_set_xdp_feature(struct mlx5e_priv *priv)
{
+ struct netdev_config *cfg = priv->netdev->cfg_pending;
struct mlx5e_params *params = &priv->channels.params;
struct net_device *netdev = priv->netdev;
xdp_features_t val = 0;
+ /* XDP can't run with HW-GRO, and tcp-data-split keeps HW-GRO on */
if (netdev->netdev_ops->ndo_bpf &&
- params->packet_merge.type == MLX5E_PACKET_MERGE_NONE)
+ cfg->hds_config != ETHTOOL_TCP_DATA_SPLIT_ENABLED)
val = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
NETDEV_XDP_ACT_XSK_ZEROCOPY |
NETDEV_XDP_ACT_RX_SG;
@@ -4604,17 +4606,6 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
}
}
- if (params->xdp_prog) {
- if (features & NETIF_F_LRO) {
- netdev_warn(netdev, "LRO is incompatible with XDP\n");
- features &= ~NETIF_F_LRO;
- }
- if (features & NETIF_F_GRO_HW) {
- netdev_warn(netdev, "HW GRO is incompatible with XDP\n");
- features &= ~NETIF_F_GRO_HW;
- }
- }
-
if (priv->xsk.refcnt) {
if (features & NETIF_F_LRO) {
netdev_warn(netdev, "LRO is incompatible with AF_XDP (%u XSKs are active)\n",
@@ -5203,20 +5194,6 @@ static void mlx5e_tx_timeout(struct net_device *dev, unsigned int txqueue)
queue_work(priv->wq, &priv->tx_timeout_work);
}
-static int mlx5e_xdp_allowed(struct net_device *netdev, struct mlx5_core_dev *mdev,
- struct mlx5e_params *params)
-{
- if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
- netdev_warn(netdev, "can't set XDP while HW-GRO/LRO is on, disable them first\n");
- return -EINVAL;
- }
-
- if (!mlx5e_params_validate_xdp(netdev, mdev, params))
- return -EINVAL;
-
- return 0;
-}
-
static void mlx5e_rq_replace_xdp_prog(struct mlx5e_rq *rq, struct bpf_prog *prog)
{
struct bpf_prog *old_prog;
@@ -5241,10 +5218,9 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
new_params = priv->channels.params;
new_params.xdp_prog = prog;
- if (prog) {
- err = mlx5e_xdp_allowed(netdev, priv->mdev, &new_params);
- if (err)
- goto unlock;
+ if (prog && !mlx5e_params_validate_xdp(netdev, priv->mdev, &new_params)) {
+ err = -EINVAL;
+ goto unlock;
}
/* no need for full reset when exchanging programs */
@@ -5279,10 +5255,6 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
unlock:
mutex_unlock(&priv->state_lock);
- /* Need to fix some features. */
- if (!err)
- netdev_update_features(netdev);
-
return err;
}
--
2.56.1
Technical Details
Message-ID:
<20261122010112.1471146-7-kuba@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368559-linux-kernel-netdev=dewy.ruReferences:
<20261122010112.1471146-1-kuba@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368559-linux-kernel-netdev=dewy.ru From: kuba@kernel.org (Jakub Kicinski) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v2 6/9] eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling Date: Sat, 21 Nov 2026 17:01:09 -0800 Organization: Usenet Network Message-ID: <20261122010112.1471146-7-kuba@kernel.org> References: <20261122010112.1471146-1-kuba@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3536131"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:GqgLEEF9MMG6sQ9uTHaVv1zutxw= sha256:/mMpDFTU//zXSRy79Kx2Z8aHRlUlRlvki+JPOkwIITU= sha1:7pZ9Z7oCrBGVYJv3seNHkUShzSY= sha256:0ySaX7ANL+kcb1gd4cxJm6HIl9Sa7bu0lZsXOjYq9FM= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 6D686115C55; Sun, 22 Nov 2026 04:01:49 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HziyD4U1Rfoj; Sun, 22 Nov 2026 04:01:46 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368559-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 9E99E115C56; Sun, 22 Nov 2026 04:01:37 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 86AC9366BC; Sun, 22 Nov 2026 01:01:27 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795309282; b=Gyo2j2aWFKAbHnZdrHehwBgU2b6HqSHdjljDsKwD32dYDA6QMAiKNbTCxK/VvHKfKMeO btC+zke22xNc4V72BtFVYSeOxX0SQnqZ5lOVlz1/HUKWNopBOo8VIJyFGnV1hI2szBzHR U5qRoYywKMwl57w81FrfQkpw8ESDC0NA0PdplCI3lNiKcf26wKybhwodhUlV+D6GiEJD3 DujinTwQ7DMSjohXxzRW5V6QAoGpn+zahrYc4qAht9QT9Xfnm0rP1KLBS/7FqDc7h96c2 xVAxagaUS5s6ANFXGiVn1l+e9kK+y5jn9DrZ1P8lqB2i3Di2cpul0v1iZ5+WKHb6vhw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795309282; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding; bh=tXjeZU5GSs/uz0hKlC0URJrZHP/eBhjfdOTv8TzdxBI=; b=V1Z2FxRTY3fS4dxVj84E64eCy8oaFakjm77AzD4s7SDyv7s4JbzXX00fgiOaRapH1Dcg 3Ls3mmJo1JzUy9FnDAYcMrR6OTW7if1Fk0N4E6Wdr2RljQxehnVCT+QpDK5Ozr68/eLaT k2JIWJxS+pDVOkNEdka8HB9klJvGexwtG2nCsY6y0RXihkqLb5/SEQmvSFnY8tBOGoM8Y WpQBTosrSx7lUOgGlJDl/EGWpQ6s5O8qpj+odBsudkvcFPSlUN8WEyZo4oqV5G4mf8lYl E8ppnbcfJEefHnjStROa9c3rfWd4JVZp+4XiC7E0wCi/Sq1K+TTJ9Hq03QYKID3GKRg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OXyRtWqu; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D333A606A68B; Sun, 22 Nov 2026 01:01:22 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OXyRtWqu X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795309282; b=knGeNdxKQ9g6m00VgyB6CGynL9HivHuKr/K5mq8UTAy19GIPOYVib5XC7HpvmUvnkAdG wmAmjmQMKcGdTvuWkTovTAAnlaQPHCYjWuX7dCn0jLdO4AzeB8vRVJxN+pp5LaT14mk0a DHqdWs/pyIbI7hXDlKCoKfHCP9HiCP/xh1xGAFjBuSJ3zOCfeSvtLYb3bEbwwFprZfePp zdPAbXM+la59Or9Mj9nlhCO783P1lpq2OEogNR9SVOeX58T+Km+2xEnTfYKaO2/vCcOP1 lhGUNTX48s6VE9gnhtIGPsRQQH9QH8lI6Sy66rJ5n32gwT+ypdCsZzN+/AXAnDChOqA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795309282; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=tXjeZU5GSs/uz0hKlC0URJrZHP/eBhjfdOTv8TzdxBI=; b=L3KW7YMP89OtJmXXZ/Gk87queKaqSLzDNZY3BEnaea5WR5Kehsr2U57qOHqeR0dJmx1J CimN8WbJ+36iKVCdL/J+7eyJeP0yZMEL8j+xbzeTNg9/Dvuuylu32z5GgVJrojy88/uOd n04CP/QpYBqD3FRdo+7O+ABV5hdHOGj+e7g11cA7oAEnzG2aPCNUs3NhYNN6wO2zM4bwb feX6SUhSaZc1F5R7S0806F8WNLXA1g08KjYNubIPJSwltis7I0rZfdwlVHvCuVSqVqLNS HApVJg12ZcatzDDoC4OwE42gH7zxNP0kYzLVGEnZrxJ6JY1p2WtiKqzO10CwoPkq+xw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OXyRtWqu; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0177D606A33F; Sun, 22 Nov 2026 01:01:22 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 537981F000D0; Sun, 22 Nov 2026 01:01:21 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795309281; bh=tXjeZU5GSs/uz0hKlC0URJrZHP/eBhjfdOTv8TzdxBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OXyRtWqu1BaINOKsbnlFoJ2y0Gvp7BI0djrH3TmiqcsghgQpgfSsnXBDT7seZ/TnP j2zQ5vS6aBifB92XgDGp1Mznl+y1Kg7VlmD+OZKwrTgG0bCIthcfBx53hvN7oTFcgx YVZuYCJm9IJMvynQfzrYPIENKh2y/168AGh7fhb5KelgDXWoGNYZKwssaUVugByKaR 4+f6hNvRQ02rwvLmqEeQBC29EgaEK/9Efe7LyygoBnN61eWslITZA7frjh/iCnB9Nq ksSmGnodvQVCDjnjjuZTYBk0Jnmz7filLsTrikJQQ1vWHvFDJ16dbiN1z3Nu5tNMNK Q93O7NxqUUbmw== X-Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, michael.chan@broadcom.com, manishc@marvell.com, joshwash@google.com, hramamurthy@google.com, tariqt@nvidia.com, saeedm@nvidia.com, daniel@iogearbox.net, hawk@kernel.org, sdf@fomichev.me, willemb@google.com, przemyslaw.kitszel@intel.com, bpf@vger.kernel.org, Jakub Kicinski <kuba@kernel.org> X-Mailer: git-send-email 2.56.1 X-In-Reply-To: <20261122010112.1471146-1-kuba@kernel.org> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Received-Bytes: 12789