[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1747950086-1246773-12-git-send-email-tariqt@nvidia.com>
Date: Fri, 23 May 2025 00:41:26 +0300
From: Tariq Toukan <tariqt@...dia.com>
To: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>, "Andrew
Lunn" <andrew+netdev@...n.ch>
CC: Saeed Mahameed <saeedm@...dia.com>, Leon Romanovsky <leon@...nel.org>,
Tariq Toukan <tariqt@...dia.com>, Richard Cochran <richardcochran@...il.com>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>, John Fastabend
<john.fastabend@...il.com>, <netdev@...r.kernel.org>,
<linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<bpf@...r.kernel.org>, Moshe Shemesh <moshe@...dia.com>, Mark Bloch
<mbloch@...dia.com>, Gal Pressman <gal@...dia.com>, Cosmin Ratiu
<cratiu@...dia.com>, Dragos Tatulea <dtatulea@...dia.com>
Subject: [PATCH net-next V2 11/11] net/mlx5e: Support ethtool tcp-data-split settings
From: Saeed Mahameed <saeedm@...dia.com>
Try enabling HW GRO when requested.
Signed-off-by: Saeed Mahameed <saeedm@...dia.com>
Reviewed-by: Dragos Tatulea <dtatulea@...dia.com>
Signed-off-by: Cosmin Ratiu <cratiu@...dia.com>
Signed-off-by: Tariq Toukan <tariqt@...dia.com>
---
.../ethernet/mellanox/mlx5/core/en_ethtool.c | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index ea078c9f5d15..b6c3b6c11f86 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -371,6 +371,14 @@ void mlx5e_ethtool_get_ringparam(struct mlx5e_priv *priv,
(priv->channels.params.packet_merge.type == MLX5E_PACKET_MERGE_SHAMPO) ?
ETHTOOL_TCP_DATA_SPLIT_ENABLED :
ETHTOOL_TCP_DATA_SPLIT_DISABLED;
+
+ /* if HW GRO is not enabled due to external limitations but is wanted,
+ * report HDS state as unknown so it won't get turned off explicitly.
+ */
+ if (kernel_param->tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_DISABLED &&
+ priv->netdev->wanted_features & NETIF_F_GRO_HW)
+ kernel_param->tcp_data_split = ETHTOOL_TCP_DATA_SPLIT_UNKNOWN;
+
}
static void mlx5e_get_ringparam(struct net_device *dev,
@@ -383,6 +391,43 @@ static void mlx5e_get_ringparam(struct net_device *dev,
mlx5e_ethtool_get_ringparam(priv, param, kernel_param);
}
+static bool mlx5e_ethtool_set_tcp_data_split(struct mlx5e_priv *priv,
+ u8 tcp_data_split)
+{
+ bool enable = (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_ENABLED);
+ struct net_device *dev = priv->netdev;
+
+ if (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_UNKNOWN)
+ return true;
+
+ if (enable && !(dev->hw_features & NETIF_F_GRO_HW)) {
+ netdev_warn(dev, "TCP-data-split is not supported when GRO HW is not supported\n");
+ return false; /* GRO HW is not supported */
+ }
+
+ if (enable && (dev->features & NETIF_F_GRO_HW)) {
+ /* Already enabled */
+ dev->wanted_features |= NETIF_F_GRO_HW;
+ return true;
+ }
+
+ if (!enable && !(dev->features & NETIF_F_GRO_HW)) {
+ /* Already disabled */
+ dev->wanted_features &= ~NETIF_F_GRO_HW;
+ return true;
+ }
+
+ /* Try enable or disable GRO HW */
+ if (enable)
+ dev->wanted_features |= NETIF_F_GRO_HW;
+ else
+ dev->wanted_features &= ~NETIF_F_GRO_HW;
+
+ netdev_change_features(dev);
+
+ return enable == !!(dev->features & NETIF_F_GRO_HW);
+}
+
int mlx5e_ethtool_set_ringparam(struct mlx5e_priv *priv,
struct ethtool_ringparam *param,
struct netlink_ext_ack *extack)
@@ -441,6 +486,10 @@ static int mlx5e_set_ringparam(struct net_device *dev,
{
struct mlx5e_priv *priv = netdev_priv(dev);
+ if (!mlx5e_ethtool_set_tcp_data_split(priv,
+ kernel_param->tcp_data_split))
+ return -EINVAL;
+
return mlx5e_ethtool_set_ringparam(priv, param, extack);
}
@@ -2625,6 +2674,7 @@ const struct ethtool_ops mlx5e_ethtool_ops = {
ETHTOOL_COALESCE_USE_ADAPTIVE |
ETHTOOL_COALESCE_USE_CQE,
.supported_input_xfrm = RXH_XFRM_SYM_OR_XOR,
+ .supported_ring_params = ETHTOOL_RING_USE_TCP_DATA_SPLIT,
.get_drvinfo = mlx5e_get_drvinfo,
.get_link = ethtool_op_get_link,
.get_link_ext_state = mlx5e_get_link_ext_state,
--
2.31.1
Powered by blists - more mailing lists