From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
Khalid Manaa <khalidm@nvidia.com>,
Ben Ben-Ishay <benishay@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 12/14] net/mlx5e: Add HW-GRO offload
Date: Tue, 26 Oct 2021 19:33:45 -0700 [thread overview]
Message-ID: <20211027023347.699076-13-saeed@kernel.org> (raw)
In-Reply-To: <20211027023347.699076-1-saeed@kernel.org>
From: Khalid Manaa <khalidm@nvidia.com>
This commit introduces HW-GRO offload by using the SHAMPO feature
- Add set feature handler for HW-GRO.
Signed-off-by: Ben Ben-Ishay <benishay@nvidia.com>
Signed-off-by: Khalid Manaa <khalidm@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en_main.c | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index e922584f2702..ecaad2d6c216 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3549,6 +3549,35 @@ static int set_feature_lro(struct net_device *netdev, bool enable)
return err;
}
+static int set_feature_hw_gro(struct net_device *netdev, bool enable)
+{
+ struct mlx5e_priv *priv = netdev_priv(netdev);
+ struct mlx5e_params new_params;
+ bool reset = true;
+ int err = 0;
+
+ mutex_lock(&priv->state_lock);
+ new_params = priv->channels.params;
+
+ if (enable) {
+ new_params.packet_merge.type = MLX5E_PACKET_MERGE_SHAMPO;
+ new_params.packet_merge.shampo.match_criteria_type =
+ MLX5_RQC_SHAMPO_MATCH_CRITERIA_TYPE_EXTENDED;
+ new_params.packet_merge.shampo.alignment_granularity =
+ MLX5_RQC_SHAMPO_NO_MATCH_ALIGNMENT_GRANULARITY_STRIDE;
+ } else if (new_params.packet_merge.type == MLX5E_PACKET_MERGE_SHAMPO) {
+ new_params.packet_merge.type = MLX5E_PACKET_MERGE_NONE;
+ } else {
+ goto out;
+ }
+
+ err = mlx5e_safe_switch_params(priv, &new_params,
+ mlx5e_modify_tirs_packet_merge_ctx, NULL, reset);
+out:
+ mutex_unlock(&priv->state_lock);
+ return err;
+}
+
static int set_feature_cvlan_filter(struct net_device *netdev, bool enable)
{
struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -3722,6 +3751,7 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features)
mlx5e_handle_feature(netdev, &oper_features, features, feature, handler)
err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro);
+ err |= MLX5E_HANDLE_FEATURE(NETIF_F_GRO_HW, set_feature_hw_gro);
err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER,
set_feature_cvlan_filter);
err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TC, set_feature_hw_tc);
@@ -3782,6 +3812,10 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n");
features &= ~NETIF_F_LRO;
}
+ if (features & NETIF_F_GRO_HW) {
+ netdev_warn(netdev, "Disabling HW-GRO, not supported in legacy RQ\n");
+ features &= ~NETIF_F_GRO_HW;
+ }
}
if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS)) {
@@ -4723,6 +4757,10 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev->hw_features |= NETIF_F_HW_VLAN_STAG_TX;
+ if (!!MLX5_CAP_GEN(mdev, shampo) &&
+ mlx5e_check_fragmented_striding_rq_cap(mdev))
+ netdev->hw_features |= NETIF_F_GRO_HW;
+
if (mlx5e_tunnel_any_tx_proto_supported(mdev)) {
netdev->hw_enc_features |= NETIF_F_HW_CSUM;
netdev->hw_enc_features |= NETIF_F_TSO;
@@ -4773,6 +4811,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
if (fcs_enabled)
netdev->features &= ~NETIF_F_RXALL;
netdev->features &= ~NETIF_F_LRO;
+ netdev->features &= ~NETIF_F_GRO_HW;
netdev->features &= ~NETIF_F_RXFCS;
#define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f)
--
2.31.1
next prev parent reply other threads:[~2021-10-27 2:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 2:33 [pull request][net-next 00/14] mlx5 HW GRO 2021-10-26 Saeed Mahameed
2021-10-27 2:33 ` [net-next 01/14] lib: bitmap: Introduce node-aware alloc API Saeed Mahameed
2021-10-27 13:50 ` patchwork-bot+netdevbpf
2021-10-27 2:33 ` [net-next 02/14] net: Prevent HW-GRO and LRO features operate together Saeed Mahameed
2021-10-27 2:33 ` [net-next 03/14] net/mlx5e: Rename lro_timeout to packet_merge_timeout Saeed Mahameed
2021-10-27 2:33 ` [net-next 04/14] net/mlx5: Add SHAMPO caps, HW bits and enumerations Saeed Mahameed
2021-10-27 2:33 ` [net-next 05/14] net/mlx5e: Rename TIR lro functions to TIR packet merge functions Saeed Mahameed
2021-10-27 2:33 ` [net-next 06/14] net/mlx5e: Add support to klm_umr_wqe Saeed Mahameed
2021-10-27 2:33 ` [net-next 07/14] net/mlx5e: Add control path for SHAMPO feature Saeed Mahameed
2021-10-27 2:33 ` [net-next 08/14] net/mlx5e: Add handle SHAMPO cqe support Saeed Mahameed
2021-10-27 2:33 ` [net-next 09/14] net/mlx5e: Add data path for SHAMPO feature Saeed Mahameed
2021-10-27 2:33 ` [net-next 10/14] net/mlx5e: HW_GRO cqe handler implementation Saeed Mahameed
2021-10-27 2:33 ` [net-next 11/14] net/mlx5e: Add HW_GRO statistics Saeed Mahameed
2021-10-27 2:33 ` Saeed Mahameed [this message]
2021-10-27 2:33 ` [net-next 13/14] net/mlx5e: Prevent HW-GRO and CQE-COMPRESS features operate together Saeed Mahameed
2021-10-27 2:33 ` [net-next 14/14] net/mlx5: Lag, Make mlx5_lag_is_multipath() be static inline Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211027023347.699076-13-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=benishay@nvidia.com \
--cc=davem@davemloft.net \
--cc=khalidm@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).