Skip to content

Commit b856df2

Browse files
ogerlitzSaeed Mahameed
authored andcommitted
net/mlx5e: Allow reporting of checksum unnecessary
Currently we practically never report checksum unnecessary, because for all IP packets we take the checksum complete path. Enable non-default runs with reprorting checksum unnecessary, using an ethtool private flag. This can be useful for performance evals and other explorations. Signed-off-by: Or Gerlitz <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent b820e6f commit b856df2

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ enum mlx5e_priv_flag {
209209
MLX5E_PFLAG_TX_CQE_BASED_MODER = (1 << 1),
210210
MLX5E_PFLAG_RX_CQE_COMPRESS = (1 << 2),
211211
MLX5E_PFLAG_RX_STRIDING_RQ = (1 << 3),
212+
MLX5E_PFLAG_RX_NO_CSUM_COMPLETE = (1 << 4),
212213
};
213214

214215
#define MLX5E_SET_PFLAG(params, pflag, enable) \
@@ -290,6 +291,7 @@ struct mlx5e_dcbx_dp {
290291
enum {
291292
MLX5E_RQ_STATE_ENABLED,
292293
MLX5E_RQ_STATE_AM,
294+
MLX5E_RQ_STATE_NO_CSUM_COMPLETE,
293295
};
294296

295297
struct mlx5e_cq {

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ static const char mlx5e_priv_flags[][ETH_GSTRING_LEN] = {
140140
"tx_cqe_moder",
141141
"rx_cqe_compress",
142142
"rx_striding_rq",
143+
"rx_no_csum_complete",
143144
};
144145

145146
int mlx5e_ethtool_get_sset_count(struct mlx5e_priv *priv, int sset)
@@ -1531,6 +1532,27 @@ static int set_pflag_rx_striding_rq(struct net_device *netdev, bool enable)
15311532
return 0;
15321533
}
15331534

1535+
static int set_pflag_rx_no_csum_complete(struct net_device *netdev, bool enable)
1536+
{
1537+
struct mlx5e_priv *priv = netdev_priv(netdev);
1538+
struct mlx5e_channels *channels = &priv->channels;
1539+
struct mlx5e_channel *c;
1540+
int i;
1541+
1542+
if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
1543+
return 0;
1544+
1545+
for (i = 0; i < channels->num; i++) {
1546+
c = channels->c[i];
1547+
if (enable)
1548+
__set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state);
1549+
else
1550+
__clear_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state);
1551+
}
1552+
1553+
return 0;
1554+
}
1555+
15341556
static int mlx5e_handle_pflag(struct net_device *netdev,
15351557
u32 wanted_flags,
15361558
enum mlx5e_priv_flag flag,
@@ -1582,6 +1604,12 @@ static int mlx5e_set_priv_flags(struct net_device *netdev, u32 pflags)
15821604
err = mlx5e_handle_pflag(netdev, pflags,
15831605
MLX5E_PFLAG_RX_STRIDING_RQ,
15841606
set_pflag_rx_striding_rq);
1607+
if (err)
1608+
goto out;
1609+
1610+
err = mlx5e_handle_pflag(netdev, pflags,
1611+
MLX5E_PFLAG_RX_NO_CSUM_COMPLETE,
1612+
set_pflag_rx_no_csum_complete);
15851613

15861614
out:
15871615
mutex_unlock(&priv->state_lock);

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,9 @@ static int mlx5e_open_rq(struct mlx5e_channel *c,
929929
if (params->rx_dim_enabled)
930930
__set_bit(MLX5E_RQ_STATE_AM, &c->rq.state);
931931

932+
if (params->pflags & MLX5E_PFLAG_RX_NO_CSUM_COMPLETE)
933+
__set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state);
934+
932935
return 0;
933936

934937
err_destroy_rq:
@@ -4528,6 +4531,7 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
45284531
params->rx_cqe_compress_def = slow_pci_heuristic(mdev);
45294532

45304533
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS, params->rx_cqe_compress_def);
4534+
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE, false);
45314535

45324536
/* RQ */
45334537
mlx5e_build_rq_params(mdev, params);

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,9 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
782782
return;
783783
}
784784

785+
if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)))
786+
goto csum_unnecessary;
787+
785788
if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) {
786789
if (unlikely(get_ip_proto(skb, proto) == IPPROTO_SCTP))
787790
goto csum_unnecessary;

0 commit comments

Comments
 (0)