Skip to content

Commit ebc363f

Browse files
committed
Merge branch 'mlx5-fixes'
Saeed Mahameed says: ==================== Mellanox 100G mlx5 driver fixes This series has few bug fixes for the mlx5 Ethernet driver. Eran fixed a locking issue with time-stamping that could cause a soft-lockup when time-stamping is enabled. Gal fixed the rx/tx packets/bytes counters returned by the driver to actually went through the network stack. Tariq removed a poll CQ optimization which could lead the driver to stop getting interrupts for some of the rings, and a did also fix to HW LRO which is currently broken. He also provided RSS and RX hash fixes for the case of changing the number of rx rings the RX hash/RSS configuration will be out of sync. The time stamping fix from Eran is not for -stable as the feature was only introduced in 4.5 but all of the others are. Changes fro V0: - Eran addressed the irqsave/restore comments from "Dave" and fixed them. This series is generated against net commit 4c0b6ea 'net: thunderx: Fix for Qset error due to CQ full' ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 607e681 + faf4478 commit ebc363f

File tree

8 files changed

+109
-84
lines changed

8 files changed

+109
-84
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ struct mlx5e_pport_stats {
223223

224224
static const char rq_stats_strings[][ETH_GSTRING_LEN] = {
225225
"packets",
226+
"bytes",
226227
"csum_none",
227228
"csum_sw",
228229
"lro_packets",
@@ -232,16 +233,18 @@ static const char rq_stats_strings[][ETH_GSTRING_LEN] = {
232233

233234
struct mlx5e_rq_stats {
234235
u64 packets;
236+
u64 bytes;
235237
u64 csum_none;
236238
u64 csum_sw;
237239
u64 lro_packets;
238240
u64 lro_bytes;
239241
u64 wqe_err;
240-
#define NUM_RQ_STATS 6
242+
#define NUM_RQ_STATS 7
241243
};
242244

243245
static const char sq_stats_strings[][ETH_GSTRING_LEN] = {
244246
"packets",
247+
"bytes",
245248
"tso_packets",
246249
"tso_bytes",
247250
"csum_offload_none",
@@ -253,14 +256,15 @@ static const char sq_stats_strings[][ETH_GSTRING_LEN] = {
253256

254257
struct mlx5e_sq_stats {
255258
u64 packets;
259+
u64 bytes;
256260
u64 tso_packets;
257261
u64 tso_bytes;
258262
u64 csum_offload_none;
259263
u64 stopped;
260264
u64 wake;
261265
u64 dropped;
262266
u64 nop;
263-
#define NUM_SQ_STATS 8
267+
#define NUM_SQ_STATS 9
264268
};
265269

266270
struct mlx5e_stats {
@@ -304,14 +308,9 @@ enum {
304308
MLX5E_RQ_STATE_POST_WQES_ENABLE,
305309
};
306310

307-
enum cq_flags {
308-
MLX5E_CQ_HAS_CQES = 1,
309-
};
310-
311311
struct mlx5e_cq {
312312
/* data path - accessed per cqe */
313313
struct mlx5_cqwq wq;
314-
unsigned long flags;
315314

316315
/* data path - accessed per napi poll */
317316
struct napi_struct *napi;
@@ -452,6 +451,8 @@ enum mlx5e_traffic_types {
452451
MLX5E_NUM_TT,
453452
};
454453

454+
#define IS_HASHING_TT(tt) (tt != MLX5E_TT_ANY)
455+
455456
enum mlx5e_rqt_ix {
456457
MLX5E_INDIRECTION_RQT,
457458
MLX5E_SINGLE_RQ_RQT,
@@ -618,9 +619,12 @@ void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv);
618619
void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);
619620

620621
int mlx5e_redirect_rqt(struct mlx5e_priv *priv, enum mlx5e_rqt_ix rqt_ix);
622+
void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv);
621623

622624
int mlx5e_open_locked(struct net_device *netdev);
623625
int mlx5e_close_locked(struct net_device *netdev);
626+
void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
627+
int num_channels);
624628

625629
static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
626630
struct mlx5e_tx_wqe *wqe, int bf_sz)

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ static void mlx5e_timestamp_overflow(struct work_struct *work)
6262
struct delayed_work *dwork = to_delayed_work(work);
6363
struct mlx5e_tstamp *tstamp = container_of(dwork, struct mlx5e_tstamp,
6464
overflow_work);
65+
unsigned long flags;
6566

66-
write_lock(&tstamp->lock);
67+
write_lock_irqsave(&tstamp->lock, flags);
6768
timecounter_read(&tstamp->clock);
68-
write_unlock(&tstamp->lock);
69+
write_unlock_irqrestore(&tstamp->lock, flags);
6970
schedule_delayed_work(&tstamp->overflow_work, tstamp->overflow_period);
7071
}
7172

@@ -136,10 +137,11 @@ static int mlx5e_ptp_settime(struct ptp_clock_info *ptp,
136137
struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp,
137138
ptp_info);
138139
u64 ns = timespec64_to_ns(ts);
140+
unsigned long flags;
139141

140-
write_lock(&tstamp->lock);
142+
write_lock_irqsave(&tstamp->lock, flags);
141143
timecounter_init(&tstamp->clock, &tstamp->cycles, ns);
142-
write_unlock(&tstamp->lock);
144+
write_unlock_irqrestore(&tstamp->lock, flags);
143145

144146
return 0;
145147
}
@@ -150,10 +152,11 @@ static int mlx5e_ptp_gettime(struct ptp_clock_info *ptp,
150152
struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp,
151153
ptp_info);
152154
u64 ns;
155+
unsigned long flags;
153156

154-
write_lock(&tstamp->lock);
157+
write_lock_irqsave(&tstamp->lock, flags);
155158
ns = timecounter_read(&tstamp->clock);
156-
write_unlock(&tstamp->lock);
159+
write_unlock_irqrestore(&tstamp->lock, flags);
157160

158161
*ts = ns_to_timespec64(ns);
159162

@@ -164,10 +167,11 @@ static int mlx5e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
164167
{
165168
struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp,
166169
ptp_info);
170+
unsigned long flags;
167171

168-
write_lock(&tstamp->lock);
172+
write_lock_irqsave(&tstamp->lock, flags);
169173
timecounter_adjtime(&tstamp->clock, delta);
170-
write_unlock(&tstamp->lock);
174+
write_unlock_irqrestore(&tstamp->lock, flags);
171175

172176
return 0;
173177
}
@@ -176,6 +180,7 @@ static int mlx5e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 delta)
176180
{
177181
u64 adj;
178182
u32 diff;
183+
unsigned long flags;
179184
int neg_adj = 0;
180185
struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp,
181186
ptp_info);
@@ -189,11 +194,11 @@ static int mlx5e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 delta)
189194
adj *= delta;
190195
diff = div_u64(adj, 1000000000ULL);
191196

192-
write_lock(&tstamp->lock);
197+
write_lock_irqsave(&tstamp->lock, flags);
193198
timecounter_read(&tstamp->clock);
194199
tstamp->cycles.mult = neg_adj ? tstamp->nominal_c_mult - diff :
195200
tstamp->nominal_c_mult + diff;
196-
write_unlock(&tstamp->lock);
201+
write_unlock_irqrestore(&tstamp->lock, flags);
197202

198203
return 0;
199204
}

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

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ static int mlx5e_set_channels(struct net_device *dev,
385385
mlx5e_close_locked(dev);
386386

387387
priv->params.num_channels = count;
388+
mlx5e_build_default_indir_rqt(priv->params.indirection_rqt,
389+
MLX5E_INDIR_RQT_SIZE, count);
388390

389391
if (was_opened)
390392
err = mlx5e_open_locked(dev);
@@ -703,18 +705,36 @@ static int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
703705
return 0;
704706
}
705707

708+
static void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)
709+
{
710+
struct mlx5_core_dev *mdev = priv->mdev;
711+
void *tirc = MLX5_ADDR_OF(modify_tir_in, in, ctx);
712+
int i;
713+
714+
MLX5_SET(modify_tir_in, in, bitmask.hash, 1);
715+
mlx5e_build_tir_ctx_hash(tirc, priv);
716+
717+
for (i = 0; i < MLX5E_NUM_TT; i++)
718+
if (IS_HASHING_TT(i))
719+
mlx5_core_modify_tir(mdev, priv->tirn[i], in, inlen);
720+
}
721+
706722
static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
707723
const u8 *key, const u8 hfunc)
708724
{
709725
struct mlx5e_priv *priv = netdev_priv(dev);
710-
bool close_open;
711-
int err = 0;
726+
int inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
727+
void *in;
712728

713729
if ((hfunc != ETH_RSS_HASH_NO_CHANGE) &&
714730
(hfunc != ETH_RSS_HASH_XOR) &&
715731
(hfunc != ETH_RSS_HASH_TOP))
716732
return -EINVAL;
717733

734+
in = mlx5_vzalloc(inlen);
735+
if (!in)
736+
return -ENOMEM;
737+
718738
mutex_lock(&priv->state_lock);
719739

720740
if (indir) {
@@ -723,24 +743,20 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
723743
mlx5e_redirect_rqt(priv, MLX5E_INDIRECTION_RQT);
724744
}
725745

726-
close_open = (key || (hfunc != ETH_RSS_HASH_NO_CHANGE)) &&
727-
test_bit(MLX5E_STATE_OPENED, &priv->state);
728-
if (close_open)
729-
mlx5e_close_locked(dev);
730-
731746
if (key)
732747
memcpy(priv->params.toeplitz_hash_key, key,
733748
sizeof(priv->params.toeplitz_hash_key));
734749

735750
if (hfunc != ETH_RSS_HASH_NO_CHANGE)
736751
priv->params.rss_hfunc = hfunc;
737752

738-
if (close_open)
739-
err = mlx5e_open_locked(priv->netdev);
753+
mlx5e_modify_tirs_hash(priv, in, inlen);
740754

741755
mutex_unlock(&priv->state_lock);
742756

743-
return err;
757+
kvfree(in);
758+
759+
return 0;
744760
}
745761

746762
static int mlx5e_get_rxnfc(struct net_device *netdev,

0 commit comments

Comments
 (0)