Skip to content

Commit 6b16468

Browse files
committed
Merge branch 'mlx5-misc-patches'
Tariq Toukan says: ==================== mlx5 misc patches This patchset includes small features and misc code enhancements for the mlx5 core and EN drivers. Patches 1-4 by Gal improves the mlx5e ethtool stats implementation, for example by using standard helpers ethtool_sprintf/puts. Patch 5 by me adds a reset option for the FW command interface debugfs stats entries. This allows explicit FW command interface stats reset between different runs of a test case. Patches 6 and 7 are simple cleanups. Patch 8 by Gal adds driver support for 800Gbps link modes. Patch 9 by Jianbo enhances the L4 steering abilities. Patches 10-11 by Jianbo save redundant operations. ==================== Link: https://lore.kernel.org/r/20240402133043.56322-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 8c73e8b + 07e1bc7 commit 6b16468

File tree

27 files changed

+596
-408
lines changed

27 files changed

+596
-408
lines changed

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,27 +143,37 @@ static ssize_t average_read(struct file *filp, char __user *buf, size_t count,
143143
return simple_read_from_buffer(buf, count, pos, tbuf, ret);
144144
}
145145

146-
static ssize_t average_write(struct file *filp, const char __user *buf,
147-
size_t count, loff_t *pos)
146+
static ssize_t reset_write(struct file *filp, const char __user *buf,
147+
size_t count, loff_t *pos)
148148
{
149149
struct mlx5_cmd_stats *stats;
150150

151151
stats = filp->private_data;
152152
spin_lock_irq(&stats->lock);
153153
stats->sum = 0;
154154
stats->n = 0;
155+
stats->failed = 0;
156+
stats->failed_mbox_status = 0;
157+
stats->last_failed_errno = 0;
158+
stats->last_failed_mbox_status = 0;
159+
stats->last_failed_syndrome = 0;
155160
spin_unlock_irq(&stats->lock);
156161

157162
*pos += count;
158163

159164
return count;
160165
}
161166

162-
static const struct file_operations stats_fops = {
167+
static const struct file_operations reset_fops = {
168+
.owner = THIS_MODULE,
169+
.open = simple_open,
170+
.write = reset_write,
171+
};
172+
173+
static const struct file_operations average_fops = {
163174
.owner = THIS_MODULE,
164175
.open = simple_open,
165176
.read = average_read,
166-
.write = average_write,
167177
};
168178

169179
static ssize_t slots_read(struct file *filp, char __user *buf, size_t count,
@@ -228,8 +238,10 @@ void mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev)
228238
continue;
229239
stats->root = debugfs_create_dir(namep, *cmd);
230240

241+
debugfs_create_file("reset", 0200, stats->root, stats,
242+
&reset_fops);
231243
debugfs_create_file("average", 0400, stats->root, stats,
232-
&stats_fops);
244+
&average_fops);
233245
debugfs_create_u64("n", 0400, stats->root, &stats->n);
234246
debugfs_create_u64("failed", 0400, stats->root, &stats->failed);
235247
debugfs_create_u64("failed_mbox_status", 0400, stats->root,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ void mlx5e_vxlan_set_netdev_info(struct mlx5e_priv *priv);
11601160
void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
11611161
struct ethtool_drvinfo *drvinfo);
11621162
void mlx5e_ethtool_get_strings(struct mlx5e_priv *priv,
1163-
uint32_t stringset, uint8_t *data);
1163+
u32 stringset, u8 *data);
11641164
int mlx5e_ethtool_get_sset_count(struct mlx5e_priv *priv, int sset);
11651165
void mlx5e_ethtool_get_ethtool_stats(struct mlx5e_priv *priv,
11661166
struct ethtool_stats *stats, u64 *data);

drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd,
565565
linear = !!(dma_len - inline_hdr_sz);
566566
ds_cnt = MLX5E_TX_WQE_EMPTY_DS_COUNT + linear + !!inline_hdr_sz;
567567

568-
/* check_result must be 0 if sinfo is passed. */
568+
/* check_result must be 0 if xdptxd->has_frags is true. */
569569
if (!check_result) {
570570
int stop_room = 1;
571571

drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void mlx5e_accel_fs_del_sk(struct mlx5_flow_handle *rule)
7373

7474
struct mlx5_flow_handle *mlx5e_accel_fs_add_sk(struct mlx5e_flow_steering *fs,
7575
struct sock *sk, u32 tirn,
76-
uint32_t flow_tag)
76+
u32 flow_tag)
7777
{
7878
struct mlx5e_accel_fs_tcp *fs_tcp = mlx5e_fs_get_accel_tcp(fs);
7979
struct mlx5_flow_destination dest = {};

drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs);
1111
void mlx5e_accel_fs_tcp_destroy(struct mlx5e_flow_steering *fs);
1212
struct mlx5_flow_handle *mlx5e_accel_fs_add_sk(struct mlx5e_flow_steering *fs,
1313
struct sock *sk, u32 tirn,
14-
uint32_t flow_tag);
14+
u32 flow_tag);
1515
void mlx5e_accel_fs_del_sk(struct mlx5_flow_handle *rule);
1616
#else
1717
static inline int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs) { return 0; }
1818
static inline void mlx5e_accel_fs_tcp_destroy(struct mlx5e_flow_steering *fs) {}
1919
static inline struct mlx5_flow_handle *mlx5e_accel_fs_add_sk(struct mlx5e_flow_steering *fs,
2020
struct sock *sk, u32 tirn,
21-
uint32_t flow_tag)
21+
u32 flow_tag)
2222
{ return ERR_PTR(-EOPNOTSUPP); }
2323
static inline void mlx5e_accel_fs_del_sk(struct mlx5_flow_handle *rule) {}
2424
#endif

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,25 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(ipsec_hw)
7878
unsigned int i;
7979

8080
if (!priv->ipsec)
81-
return idx;
81+
return;
8282

8383
for (i = 0; i < NUM_IPSEC_HW_COUNTERS; i++)
84-
strcpy(data + (idx++) * ETH_GSTRING_LEN,
85-
mlx5e_ipsec_hw_stats_desc[i].format);
86-
87-
return idx;
84+
ethtool_puts(data, mlx5e_ipsec_hw_stats_desc[i].format);
8885
}
8986

9087
static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ipsec_hw)
9188
{
9289
int i;
9390

9491
if (!priv->ipsec)
95-
return idx;
92+
return;
9693

9794
mlx5e_accel_ipsec_fs_read_stats(priv, &priv->ipsec->hw_stats);
9895
for (i = 0; i < NUM_IPSEC_HW_COUNTERS; i++)
99-
data[idx++] = MLX5E_READ_CTR_ATOMIC64(&priv->ipsec->hw_stats,
100-
mlx5e_ipsec_hw_stats_desc, i);
101-
102-
return idx;
96+
mlx5e_ethtool_put_stat(
97+
data,
98+
MLX5E_READ_CTR_ATOMIC64(&priv->ipsec->hw_stats,
99+
mlx5e_ipsec_hw_stats_desc, i));
103100
}
104101

105102
static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(ipsec_sw)
@@ -115,9 +112,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(ipsec_sw)
115112

116113
if (priv->ipsec)
117114
for (i = 0; i < NUM_IPSEC_SW_COUNTERS; i++)
118-
strcpy(data + (idx++) * ETH_GSTRING_LEN,
119-
mlx5e_ipsec_sw_stats_desc[i].format);
120-
return idx;
115+
ethtool_puts(data, mlx5e_ipsec_sw_stats_desc[i].format);
121116
}
122117

123118
static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ipsec_sw)
@@ -126,9 +121,10 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ipsec_sw)
126121

127122
if (priv->ipsec)
128123
for (i = 0; i < NUM_IPSEC_SW_COUNTERS; i++)
129-
data[idx++] = MLX5E_READ_CTR_ATOMIC64(&priv->ipsec->sw_stats,
130-
mlx5e_ipsec_sw_stats_desc, i);
131-
return idx;
124+
mlx5e_ethtool_put_stat(
125+
data, MLX5E_READ_CTR_ATOMIC64(
126+
&priv->ipsec->sw_stats,
127+
mlx5e_ipsec_sw_stats_desc, i));
132128
}
133129

134130
MLX5E_DEFINE_STATS_GRP(ipsec_hw, 0);

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ int mlx5e_ktls_init(struct mlx5e_priv *priv);
9595
void mlx5e_ktls_cleanup(struct mlx5e_priv *priv);
9696

9797
int mlx5e_ktls_get_count(struct mlx5e_priv *priv);
98-
int mlx5e_ktls_get_strings(struct mlx5e_priv *priv, uint8_t *data);
99-
int mlx5e_ktls_get_stats(struct mlx5e_priv *priv, u64 *data);
98+
void mlx5e_ktls_get_strings(struct mlx5e_priv *priv, u8 **data);
99+
void mlx5e_ktls_get_stats(struct mlx5e_priv *priv, u64 **data);
100100

101101
#else
102102
static inline void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)
@@ -144,15 +144,9 @@ static inline bool mlx5e_is_ktls_rx(struct mlx5_core_dev *mdev)
144144
static inline int mlx5e_ktls_init(struct mlx5e_priv *priv) { return 0; }
145145
static inline void mlx5e_ktls_cleanup(struct mlx5e_priv *priv) { }
146146
static inline int mlx5e_ktls_get_count(struct mlx5e_priv *priv) { return 0; }
147-
static inline int mlx5e_ktls_get_strings(struct mlx5e_priv *priv, uint8_t *data)
148-
{
149-
return 0;
150-
}
147+
static inline void mlx5e_ktls_get_strings(struct mlx5e_priv *priv, u8 **data) { }
151148

152-
static inline int mlx5e_ktls_get_stats(struct mlx5e_priv *priv, u64 *data)
153-
{
154-
return 0;
155-
}
149+
static inline void mlx5e_ktls_get_stats(struct mlx5e_priv *priv, u64 **data) { }
156150
#endif
157151

158152
#endif /* __MLX5E_TLS_H__ */

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_stats.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,35 +58,31 @@ int mlx5e_ktls_get_count(struct mlx5e_priv *priv)
5858
return ARRAY_SIZE(mlx5e_ktls_sw_stats_desc);
5959
}
6060

61-
int mlx5e_ktls_get_strings(struct mlx5e_priv *priv, uint8_t *data)
61+
void mlx5e_ktls_get_strings(struct mlx5e_priv *priv, u8 **data)
6262
{
63-
unsigned int i, n, idx = 0;
63+
unsigned int i, n;
6464

6565
if (!priv->tls)
66-
return 0;
66+
return;
6767

6868
n = mlx5e_ktls_get_count(priv);
6969

7070
for (i = 0; i < n; i++)
71-
strcpy(data + (idx++) * ETH_GSTRING_LEN,
72-
mlx5e_ktls_sw_stats_desc[i].format);
73-
74-
return n;
71+
ethtool_puts(data, mlx5e_ktls_sw_stats_desc[i].format);
7572
}
7673

77-
int mlx5e_ktls_get_stats(struct mlx5e_priv *priv, u64 *data)
74+
void mlx5e_ktls_get_stats(struct mlx5e_priv *priv, u64 **data)
7875
{
79-
unsigned int i, n, idx = 0;
76+
unsigned int i, n;
8077

8178
if (!priv->tls)
82-
return 0;
79+
return;
8380

8481
n = mlx5e_ktls_get_count(priv);
8582

8683
for (i = 0; i < n; i++)
87-
data[idx++] = MLX5E_READ_CTR_ATOMIC64(&priv->tls->sw_stats,
88-
mlx5e_ktls_sw_stats_desc,
89-
i);
90-
91-
return n;
84+
mlx5e_ethtool_put_stat(
85+
data,
86+
MLX5E_READ_CTR_ATOMIC64(&priv->tls->sw_stats,
87+
mlx5e_ktls_sw_stats_desc, i));
9288
}

drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_stats.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,13 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(macsec_hw)
3838
unsigned int i;
3939

4040
if (!priv->macsec)
41-
return idx;
41+
return;
4242

4343
if (!mlx5e_is_macsec_device(priv->mdev))
44-
return idx;
44+
return;
4545

4646
for (i = 0; i < NUM_MACSEC_HW_COUNTERS; i++)
47-
strcpy(data + (idx++) * ETH_GSTRING_LEN,
48-
mlx5e_macsec_hw_stats_desc[i].format);
49-
50-
return idx;
47+
ethtool_puts(data, mlx5e_macsec_hw_stats_desc[i].format);
5148
}
5249

5350
static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(macsec_hw)
@@ -56,19 +53,18 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(macsec_hw)
5653
int i;
5754

5855
if (!priv->macsec)
59-
return idx;
56+
return;
6057

6158
if (!mlx5e_is_macsec_device(priv->mdev))
62-
return idx;
59+
return;
6360

6461
macsec_fs = priv->mdev->macsec_fs;
6562
mlx5_macsec_fs_get_stats_fill(macsec_fs, mlx5_macsec_fs_get_stats(macsec_fs));
6663
for (i = 0; i < NUM_MACSEC_HW_COUNTERS; i++)
67-
data[idx++] = MLX5E_READ_CTR64_CPU(mlx5_macsec_fs_get_stats(macsec_fs),
68-
mlx5e_macsec_hw_stats_desc,
69-
i);
70-
71-
return idx;
64+
mlx5e_ethtool_put_stat(
65+
data, MLX5E_READ_CTR64_CPU(
66+
mlx5_macsec_fs_get_stats(macsec_fs),
67+
mlx5e_macsec_hw_stats_desc, i));
7268
}
7369

7470
MLX5E_DEFINE_STATS_GRP(macsec_hw, 0);

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@ void mlx5e_build_ptys2ethtool_map(void)
219219
ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT,
220220
ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT,
221221
ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT);
222+
MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_800GAUI_8_800GBASE_CR8_KR8, ext,
223+
ETHTOOL_LINK_MODE_800000baseCR8_Full_BIT,
224+
ETHTOOL_LINK_MODE_800000baseKR8_Full_BIT,
225+
ETHTOOL_LINK_MODE_800000baseDR8_Full_BIT,
226+
ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT,
227+
ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT,
228+
ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT);
222229
}
223230

224231
static void mlx5e_ethtool_get_speed_arr(struct mlx5_core_dev *mdev,
@@ -269,8 +276,7 @@ void mlx5e_ethtool_get_strings(struct mlx5e_priv *priv, u32 stringset, u8 *data)
269276
switch (stringset) {
270277
case ETH_SS_PRIV_FLAGS:
271278
for (i = 0; i < MLX5E_NUM_PFLAGS; i++)
272-
strcpy(data + i * ETH_GSTRING_LEN,
273-
mlx5e_priv_flags[i].name);
279+
ethtool_puts(&data, mlx5e_priv_flags[i].name);
274280
break;
275281

276282
case ETH_SS_TEST:

0 commit comments

Comments
 (0)