Commit ebc363f5 authored by David S. Miller's avatar David S. Miller

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 4c0b6eaf 'net:
thunderx: Fix for Qset error due to CQ full'
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 607e6811 faf4478b
...@@ -223,6 +223,7 @@ struct mlx5e_pport_stats { ...@@ -223,6 +223,7 @@ struct mlx5e_pport_stats {
static const char rq_stats_strings[][ETH_GSTRING_LEN] = { static const char rq_stats_strings[][ETH_GSTRING_LEN] = {
"packets", "packets",
"bytes",
"csum_none", "csum_none",
"csum_sw", "csum_sw",
"lro_packets", "lro_packets",
...@@ -232,16 +233,18 @@ static const char rq_stats_strings[][ETH_GSTRING_LEN] = { ...@@ -232,16 +233,18 @@ static const char rq_stats_strings[][ETH_GSTRING_LEN] = {
struct mlx5e_rq_stats { struct mlx5e_rq_stats {
u64 packets; u64 packets;
u64 bytes;
u64 csum_none; u64 csum_none;
u64 csum_sw; u64 csum_sw;
u64 lro_packets; u64 lro_packets;
u64 lro_bytes; u64 lro_bytes;
u64 wqe_err; u64 wqe_err;
#define NUM_RQ_STATS 6 #define NUM_RQ_STATS 7
}; };
static const char sq_stats_strings[][ETH_GSTRING_LEN] = { static const char sq_stats_strings[][ETH_GSTRING_LEN] = {
"packets", "packets",
"bytes",
"tso_packets", "tso_packets",
"tso_bytes", "tso_bytes",
"csum_offload_none", "csum_offload_none",
...@@ -253,6 +256,7 @@ static const char sq_stats_strings[][ETH_GSTRING_LEN] = { ...@@ -253,6 +256,7 @@ static const char sq_stats_strings[][ETH_GSTRING_LEN] = {
struct mlx5e_sq_stats { struct mlx5e_sq_stats {
u64 packets; u64 packets;
u64 bytes;
u64 tso_packets; u64 tso_packets;
u64 tso_bytes; u64 tso_bytes;
u64 csum_offload_none; u64 csum_offload_none;
...@@ -260,7 +264,7 @@ struct mlx5e_sq_stats { ...@@ -260,7 +264,7 @@ struct mlx5e_sq_stats {
u64 wake; u64 wake;
u64 dropped; u64 dropped;
u64 nop; u64 nop;
#define NUM_SQ_STATS 8 #define NUM_SQ_STATS 9
}; };
struct mlx5e_stats { struct mlx5e_stats {
...@@ -304,14 +308,9 @@ enum { ...@@ -304,14 +308,9 @@ enum {
MLX5E_RQ_STATE_POST_WQES_ENABLE, MLX5E_RQ_STATE_POST_WQES_ENABLE,
}; };
enum cq_flags {
MLX5E_CQ_HAS_CQES = 1,
};
struct mlx5e_cq { struct mlx5e_cq {
/* data path - accessed per cqe */ /* data path - accessed per cqe */
struct mlx5_cqwq wq; struct mlx5_cqwq wq;
unsigned long flags;
/* data path - accessed per napi poll */ /* data path - accessed per napi poll */
struct napi_struct *napi; struct napi_struct *napi;
...@@ -452,6 +451,8 @@ enum mlx5e_traffic_types { ...@@ -452,6 +451,8 @@ enum mlx5e_traffic_types {
MLX5E_NUM_TT, MLX5E_NUM_TT,
}; };
#define IS_HASHING_TT(tt) (tt != MLX5E_TT_ANY)
enum mlx5e_rqt_ix { enum mlx5e_rqt_ix {
MLX5E_INDIRECTION_RQT, MLX5E_INDIRECTION_RQT,
MLX5E_SINGLE_RQ_RQT, MLX5E_SINGLE_RQ_RQT,
...@@ -618,9 +619,12 @@ void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv); ...@@ -618,9 +619,12 @@ void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv);
void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv); void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);
int mlx5e_redirect_rqt(struct mlx5e_priv *priv, enum mlx5e_rqt_ix rqt_ix); int mlx5e_redirect_rqt(struct mlx5e_priv *priv, enum mlx5e_rqt_ix rqt_ix);
void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv);
int mlx5e_open_locked(struct net_device *netdev); int mlx5e_open_locked(struct net_device *netdev);
int mlx5e_close_locked(struct net_device *netdev); int mlx5e_close_locked(struct net_device *netdev);
void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
int num_channels);
static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
struct mlx5e_tx_wqe *wqe, int bf_sz) struct mlx5e_tx_wqe *wqe, int bf_sz)
......
...@@ -62,10 +62,11 @@ static void mlx5e_timestamp_overflow(struct work_struct *work) ...@@ -62,10 +62,11 @@ static void mlx5e_timestamp_overflow(struct work_struct *work)
struct delayed_work *dwork = to_delayed_work(work); struct delayed_work *dwork = to_delayed_work(work);
struct mlx5e_tstamp *tstamp = container_of(dwork, struct mlx5e_tstamp, struct mlx5e_tstamp *tstamp = container_of(dwork, struct mlx5e_tstamp,
overflow_work); overflow_work);
unsigned long flags;
write_lock(&tstamp->lock); write_lock_irqsave(&tstamp->lock, flags);
timecounter_read(&tstamp->clock); timecounter_read(&tstamp->clock);
write_unlock(&tstamp->lock); write_unlock_irqrestore(&tstamp->lock, flags);
schedule_delayed_work(&tstamp->overflow_work, tstamp->overflow_period); schedule_delayed_work(&tstamp->overflow_work, tstamp->overflow_period);
} }
...@@ -136,10 +137,11 @@ static int mlx5e_ptp_settime(struct ptp_clock_info *ptp, ...@@ -136,10 +137,11 @@ static int mlx5e_ptp_settime(struct ptp_clock_info *ptp,
struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp, struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp,
ptp_info); ptp_info);
u64 ns = timespec64_to_ns(ts); u64 ns = timespec64_to_ns(ts);
unsigned long flags;
write_lock(&tstamp->lock); write_lock_irqsave(&tstamp->lock, flags);
timecounter_init(&tstamp->clock, &tstamp->cycles, ns); timecounter_init(&tstamp->clock, &tstamp->cycles, ns);
write_unlock(&tstamp->lock); write_unlock_irqrestore(&tstamp->lock, flags);
return 0; return 0;
} }
...@@ -150,10 +152,11 @@ static int mlx5e_ptp_gettime(struct ptp_clock_info *ptp, ...@@ -150,10 +152,11 @@ static int mlx5e_ptp_gettime(struct ptp_clock_info *ptp,
struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp, struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp,
ptp_info); ptp_info);
u64 ns; u64 ns;
unsigned long flags;
write_lock(&tstamp->lock); write_lock_irqsave(&tstamp->lock, flags);
ns = timecounter_read(&tstamp->clock); ns = timecounter_read(&tstamp->clock);
write_unlock(&tstamp->lock); write_unlock_irqrestore(&tstamp->lock, flags);
*ts = ns_to_timespec64(ns); *ts = ns_to_timespec64(ns);
...@@ -164,10 +167,11 @@ static int mlx5e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) ...@@ -164,10 +167,11 @@ static int mlx5e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
{ {
struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp, struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp,
ptp_info); ptp_info);
unsigned long flags;
write_lock(&tstamp->lock); write_lock_irqsave(&tstamp->lock, flags);
timecounter_adjtime(&tstamp->clock, delta); timecounter_adjtime(&tstamp->clock, delta);
write_unlock(&tstamp->lock); write_unlock_irqrestore(&tstamp->lock, flags);
return 0; return 0;
} }
...@@ -176,6 +180,7 @@ static int mlx5e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 delta) ...@@ -176,6 +180,7 @@ static int mlx5e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 delta)
{ {
u64 adj; u64 adj;
u32 diff; u32 diff;
unsigned long flags;
int neg_adj = 0; int neg_adj = 0;
struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp, struct mlx5e_tstamp *tstamp = container_of(ptp, struct mlx5e_tstamp,
ptp_info); ptp_info);
...@@ -189,11 +194,11 @@ static int mlx5e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 delta) ...@@ -189,11 +194,11 @@ static int mlx5e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 delta)
adj *= delta; adj *= delta;
diff = div_u64(adj, 1000000000ULL); diff = div_u64(adj, 1000000000ULL);
write_lock(&tstamp->lock); write_lock_irqsave(&tstamp->lock, flags);
timecounter_read(&tstamp->clock); timecounter_read(&tstamp->clock);
tstamp->cycles.mult = neg_adj ? tstamp->nominal_c_mult - diff : tstamp->cycles.mult = neg_adj ? tstamp->nominal_c_mult - diff :
tstamp->nominal_c_mult + diff; tstamp->nominal_c_mult + diff;
write_unlock(&tstamp->lock); write_unlock_irqrestore(&tstamp->lock, flags);
return 0; return 0;
} }
......
...@@ -385,6 +385,8 @@ static int mlx5e_set_channels(struct net_device *dev, ...@@ -385,6 +385,8 @@ static int mlx5e_set_channels(struct net_device *dev,
mlx5e_close_locked(dev); mlx5e_close_locked(dev);
priv->params.num_channels = count; priv->params.num_channels = count;
mlx5e_build_default_indir_rqt(priv->params.indirection_rqt,
MLX5E_INDIR_RQT_SIZE, count);
if (was_opened) if (was_opened)
err = mlx5e_open_locked(dev); err = mlx5e_open_locked(dev);
...@@ -703,18 +705,36 @@ static int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, ...@@ -703,18 +705,36 @@ static int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
return 0; return 0;
} }
static void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)
{
struct mlx5_core_dev *mdev = priv->mdev;
void *tirc = MLX5_ADDR_OF(modify_tir_in, in, ctx);
int i;
MLX5_SET(modify_tir_in, in, bitmask.hash, 1);
mlx5e_build_tir_ctx_hash(tirc, priv);
for (i = 0; i < MLX5E_NUM_TT; i++)
if (IS_HASHING_TT(i))
mlx5_core_modify_tir(mdev, priv->tirn[i], in, inlen);
}
static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
const u8 *key, const u8 hfunc) const u8 *key, const u8 hfunc)
{ {
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
bool close_open; int inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
int err = 0; void *in;
if ((hfunc != ETH_RSS_HASH_NO_CHANGE) && if ((hfunc != ETH_RSS_HASH_NO_CHANGE) &&
(hfunc != ETH_RSS_HASH_XOR) && (hfunc != ETH_RSS_HASH_XOR) &&
(hfunc != ETH_RSS_HASH_TOP)) (hfunc != ETH_RSS_HASH_TOP))
return -EINVAL; return -EINVAL;
in = mlx5_vzalloc(inlen);
if (!in)
return -ENOMEM;
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
if (indir) { if (indir) {
...@@ -723,11 +743,6 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, ...@@ -723,11 +743,6 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
mlx5e_redirect_rqt(priv, MLX5E_INDIRECTION_RQT); mlx5e_redirect_rqt(priv, MLX5E_INDIRECTION_RQT);
} }
close_open = (key || (hfunc != ETH_RSS_HASH_NO_CHANGE)) &&
test_bit(MLX5E_STATE_OPENED, &priv->state);
if (close_open)
mlx5e_close_locked(dev);
if (key) if (key)
memcpy(priv->params.toeplitz_hash_key, key, memcpy(priv->params.toeplitz_hash_key, key,
sizeof(priv->params.toeplitz_hash_key)); sizeof(priv->params.toeplitz_hash_key));
...@@ -735,12 +750,13 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, ...@@ -735,12 +750,13 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
if (hfunc != ETH_RSS_HASH_NO_CHANGE) if (hfunc != ETH_RSS_HASH_NO_CHANGE)
priv->params.rss_hfunc = hfunc; priv->params.rss_hfunc = hfunc;
if (close_open) mlx5e_modify_tirs_hash(priv, in, inlen);
err = mlx5e_open_locked(priv->netdev);
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
return err; kvfree(in);
return 0;
} }
static int mlx5e_get_rxnfc(struct net_device *netdev, static int mlx5e_get_rxnfc(struct net_device *netdev,
......
...@@ -141,6 +141,10 @@ void mlx5e_update_stats(struct mlx5e_priv *priv) ...@@ -141,6 +141,10 @@ void mlx5e_update_stats(struct mlx5e_priv *priv)
return; return;
/* Collect firts the SW counters and then HW for consistency */ /* Collect firts the SW counters and then HW for consistency */
s->rx_packets = 0;
s->rx_bytes = 0;
s->tx_packets = 0;
s->tx_bytes = 0;
s->tso_packets = 0; s->tso_packets = 0;
s->tso_bytes = 0; s->tso_bytes = 0;
s->tx_queue_stopped = 0; s->tx_queue_stopped = 0;
...@@ -155,6 +159,8 @@ void mlx5e_update_stats(struct mlx5e_priv *priv) ...@@ -155,6 +159,8 @@ void mlx5e_update_stats(struct mlx5e_priv *priv)
for (i = 0; i < priv->params.num_channels; i++) { for (i = 0; i < priv->params.num_channels; i++) {
rq_stats = &priv->channel[i]->rq.stats; rq_stats = &priv->channel[i]->rq.stats;
s->rx_packets += rq_stats->packets;
s->rx_bytes += rq_stats->bytes;
s->lro_packets += rq_stats->lro_packets; s->lro_packets += rq_stats->lro_packets;
s->lro_bytes += rq_stats->lro_bytes; s->lro_bytes += rq_stats->lro_bytes;
s->rx_csum_none += rq_stats->csum_none; s->rx_csum_none += rq_stats->csum_none;
...@@ -164,6 +170,8 @@ void mlx5e_update_stats(struct mlx5e_priv *priv) ...@@ -164,6 +170,8 @@ void mlx5e_update_stats(struct mlx5e_priv *priv)
for (j = 0; j < priv->params.num_tc; j++) { for (j = 0; j < priv->params.num_tc; j++) {
sq_stats = &priv->channel[i]->sq[j].stats; sq_stats = &priv->channel[i]->sq[j].stats;
s->tx_packets += sq_stats->packets;
s->tx_bytes += sq_stats->bytes;
s->tso_packets += sq_stats->tso_packets; s->tso_packets += sq_stats->tso_packets;
s->tso_bytes += sq_stats->tso_bytes; s->tso_bytes += sq_stats->tso_bytes;
s->tx_queue_stopped += sq_stats->stopped; s->tx_queue_stopped += sq_stats->stopped;
...@@ -225,23 +233,6 @@ void mlx5e_update_stats(struct mlx5e_priv *priv) ...@@ -225,23 +233,6 @@ void mlx5e_update_stats(struct mlx5e_priv *priv)
s->tx_broadcast_bytes = s->tx_broadcast_bytes =
MLX5_GET_CTR(out, transmitted_eth_broadcast.octets); MLX5_GET_CTR(out, transmitted_eth_broadcast.octets);
s->rx_packets =
s->rx_unicast_packets +
s->rx_multicast_packets +
s->rx_broadcast_packets;
s->rx_bytes =
s->rx_unicast_bytes +
s->rx_multicast_bytes +
s->rx_broadcast_bytes;
s->tx_packets =
s->tx_unicast_packets +
s->tx_multicast_packets +
s->tx_broadcast_packets;
s->tx_bytes =
s->tx_unicast_bytes +
s->tx_multicast_bytes +
s->tx_broadcast_bytes;
/* Update calculated offload counters */ /* Update calculated offload counters */
s->tx_csum_offload = s->tx_packets - tx_offload_none; s->tx_csum_offload = s->tx_packets - tx_offload_none;
s->rx_csum_good = s->rx_packets - s->rx_csum_none - s->rx_csum_good = s->rx_packets - s->rx_csum_none -
...@@ -1199,7 +1190,6 @@ static void mlx5e_fill_indir_rqt_rqns(struct mlx5e_priv *priv, void *rqtc) ...@@ -1199,7 +1190,6 @@ static void mlx5e_fill_indir_rqt_rqns(struct mlx5e_priv *priv, void *rqtc)
ix = mlx5e_bits_invert(i, MLX5E_LOG_INDIR_RQT_SIZE); ix = mlx5e_bits_invert(i, MLX5E_LOG_INDIR_RQT_SIZE);
ix = priv->params.indirection_rqt[ix]; ix = priv->params.indirection_rqt[ix];
ix = ix % priv->params.num_channels;
MLX5_SET(rqtc, rqtc, rq_num[i], MLX5_SET(rqtc, rqtc, rq_num[i],
test_bit(MLX5E_STATE_OPENED, &priv->state) ? test_bit(MLX5E_STATE_OPENED, &priv->state) ?
priv->channel[ix]->rq.rqn : priv->channel[ix]->rq.rqn :
...@@ -1317,7 +1307,22 @@ static void mlx5e_build_tir_ctx_lro(void *tirc, struct mlx5e_priv *priv) ...@@ -1317,7 +1307,22 @@ static void mlx5e_build_tir_ctx_lro(void *tirc, struct mlx5e_priv *priv)
lro_timer_supported_periods[2])); lro_timer_supported_periods[2]));
} }
static int mlx5e_modify_tir_lro(struct mlx5e_priv *priv, int tt) void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv)
{
MLX5_SET(tirc, tirc, rx_hash_fn,
mlx5e_rx_hash_fn(priv->params.rss_hfunc));
if (priv->params.rss_hfunc == ETH_RSS_HASH_TOP) {
void *rss_key = MLX5_ADDR_OF(tirc, tirc,
rx_hash_toeplitz_key);
size_t len = MLX5_FLD_SZ_BYTES(tirc,
rx_hash_toeplitz_key);
MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
memcpy(rss_key, priv->params.toeplitz_hash_key, len);
}
}
static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv)
{ {
struct mlx5_core_dev *mdev = priv->mdev; struct mlx5_core_dev *mdev = priv->mdev;
...@@ -1325,6 +1330,7 @@ static int mlx5e_modify_tir_lro(struct mlx5e_priv *priv, int tt) ...@@ -1325,6 +1330,7 @@ static int mlx5e_modify_tir_lro(struct mlx5e_priv *priv, int tt)
void *tirc; void *tirc;
int inlen; int inlen;
int err; int err;
int tt;
inlen = MLX5_ST_SZ_BYTES(modify_tir_in); inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
in = mlx5_vzalloc(inlen); in = mlx5_vzalloc(inlen);
...@@ -1336,7 +1342,11 @@ static int mlx5e_modify_tir_lro(struct mlx5e_priv *priv, int tt) ...@@ -1336,7 +1342,11 @@ static int mlx5e_modify_tir_lro(struct mlx5e_priv *priv, int tt)
mlx5e_build_tir_ctx_lro(tirc, priv); mlx5e_build_tir_ctx_lro(tirc, priv);
for (tt = 0; tt < MLX5E_NUM_TT; tt++) {
err = mlx5_core_modify_tir(mdev, priv->tirn[tt], in, inlen); err = mlx5_core_modify_tir(mdev, priv->tirn[tt], in, inlen);
if (err)
break;
}
kvfree(in); kvfree(in);
...@@ -1672,17 +1682,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt) ...@@ -1672,17 +1682,7 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, int tt)
default: default:
MLX5_SET(tirc, tirc, indirect_table, MLX5_SET(tirc, tirc, indirect_table,
priv->rqtn[MLX5E_INDIRECTION_RQT]); priv->rqtn[MLX5E_INDIRECTION_RQT]);
MLX5_SET(tirc, tirc, rx_hash_fn, mlx5e_build_tir_ctx_hash(tirc, priv);
mlx5e_rx_hash_fn(priv->params.rss_hfunc));
if (priv->params.rss_hfunc == ETH_RSS_HASH_TOP) {
void *rss_key = MLX5_ADDR_OF(tirc, tirc,
rx_hash_toeplitz_key);
size_t len = MLX5_FLD_SZ_BYTES(tirc,
rx_hash_toeplitz_key);
MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
memcpy(rss_key, priv->params.toeplitz_hash_key, len);
}
break; break;
} }
...@@ -1885,8 +1885,10 @@ static int mlx5e_set_features(struct net_device *netdev, ...@@ -1885,8 +1885,10 @@ static int mlx5e_set_features(struct net_device *netdev,
mlx5e_close_locked(priv->netdev); mlx5e_close_locked(priv->netdev);
priv->params.lro_en = !!(features & NETIF_F_LRO); priv->params.lro_en = !!(features & NETIF_F_LRO);
mlx5e_modify_tir_lro(priv, MLX5E_TT_IPV4_TCP); err = mlx5e_modify_tirs_lro(priv);
mlx5e_modify_tir_lro(priv, MLX5E_TT_IPV6_TCP); if (err)
mlx5_core_warn(priv->mdev, "lro modify failed, %d\n",
err);
if (was_opened) if (was_opened)
err = mlx5e_open_locked(priv->netdev); err = mlx5e_open_locked(priv->netdev);
...@@ -2089,12 +2091,20 @@ u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev) ...@@ -2089,12 +2091,20 @@ u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev)
2 /*sizeof(mlx5e_tx_wqe.inline_hdr_start)*/; 2 /*sizeof(mlx5e_tx_wqe.inline_hdr_start)*/;
} }
void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
int num_channels)
{
int i;
for (i = 0; i < len; i++)
indirection_rqt[i] = i % num_channels;
}
static void mlx5e_build_netdev_priv(struct mlx5_core_dev *mdev, static void mlx5e_build_netdev_priv(struct mlx5_core_dev *mdev,
struct net_device *netdev, struct net_device *netdev,
int num_channels) int num_channels)
{ {
struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_priv *priv = netdev_priv(netdev);
int i;
priv->params.log_sq_size = priv->params.log_sq_size =
MLX5E_PARAMS_DEFAULT_LOG_SQ_SIZE; MLX5E_PARAMS_DEFAULT_LOG_SQ_SIZE;
...@@ -2118,8 +2128,8 @@ static void mlx5e_build_netdev_priv(struct mlx5_core_dev *mdev, ...@@ -2118,8 +2128,8 @@ static void mlx5e_build_netdev_priv(struct mlx5_core_dev *mdev,
netdev_rss_key_fill(priv->params.toeplitz_hash_key, netdev_rss_key_fill(priv->params.toeplitz_hash_key,
sizeof(priv->params.toeplitz_hash_key)); sizeof(priv->params.toeplitz_hash_key));
for (i = 0; i < MLX5E_INDIR_RQT_SIZE; i++) mlx5e_build_default_indir_rqt(priv->params.indirection_rqt,
priv->params.indirection_rqt[i] = i % num_channels; MLX5E_INDIR_RQT_SIZE, num_channels);
priv->params.lro_wqe_sz = priv->params.lro_wqe_sz =
MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ; MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ;
......
...@@ -230,10 +230,6 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) ...@@ -230,10 +230,6 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
struct mlx5e_rq *rq = container_of(cq, struct mlx5e_rq, cq); struct mlx5e_rq *rq = container_of(cq, struct mlx5e_rq, cq);
int work_done; int work_done;
/* avoid accessing cq (dma coherent memory) if not needed */
if (!test_and_clear_bit(MLX5E_CQ_HAS_CQES, &cq->flags))
return 0;
for (work_done = 0; work_done < budget; work_done++) { for (work_done = 0; work_done < budget; work_done++) {
struct mlx5e_rx_wqe *wqe; struct mlx5e_rx_wqe *wqe;
struct mlx5_cqe64 *cqe; struct mlx5_cqe64 *cqe;
...@@ -267,6 +263,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) ...@@ -267,6 +263,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
mlx5e_build_rx_skb(cqe, rq, skb); mlx5e_build_rx_skb(cqe, rq, skb);
rq->stats.packets++; rq->stats.packets++;
rq->stats.bytes += be32_to_cpu(cqe->byte_cnt);
napi_gro_receive(cq->napi, skb); napi_gro_receive(cq->napi, skb);
wq_ll_pop: wq_ll_pop:
...@@ -279,8 +276,5 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) ...@@ -279,8 +276,5 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
/* ensure cq space is freed before enabling more cqes */ /* ensure cq space is freed before enabling more cqes */
wmb(); wmb();
if (work_done == budget)
set_bit(MLX5E_CQ_HAS_CQES, &cq->flags);
return work_done; return work_done;
} }
...@@ -179,6 +179,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) ...@@ -179,6 +179,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
unsigned int skb_len = skb->len; unsigned int skb_len = skb->len;
u8 opcode = MLX5_OPCODE_SEND; u8 opcode = MLX5_OPCODE_SEND;
dma_addr_t dma_addr = 0; dma_addr_t dma_addr = 0;
unsigned int num_bytes;
bool bf = false; bool bf = false;
u16 headlen; u16 headlen;
u16 ds_cnt; u16 ds_cnt;
...@@ -204,8 +205,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) ...@@ -204,8 +205,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
opcode = MLX5_OPCODE_LSO; opcode = MLX5_OPCODE_LSO;
ihs = skb_transport_offset(skb) + tcp_hdrlen(skb); ihs = skb_transport_offset(skb) + tcp_hdrlen(skb);
payload_len = skb->len - ihs; payload_len = skb->len - ihs;
wi->num_bytes = skb->len + num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs;
(skb_shinfo(skb)->gso_segs - 1) * ihs;
sq->stats.tso_packets++; sq->stats.tso_packets++;
sq->stats.tso_bytes += payload_len; sq->stats.tso_bytes += payload_len;
} else { } else {
...@@ -213,9 +213,11 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) ...@@ -213,9 +213,11 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
!skb->xmit_more && !skb->xmit_more &&
!skb_shinfo(skb)->nr_frags; !skb_shinfo(skb)->nr_frags;
ihs = mlx5e_get_inline_hdr_size(sq, skb, bf); ihs = mlx5e_get_inline_hdr_size(sq, skb, bf);
wi->num_bytes = max_t(unsigned int, skb->len, ETH_ZLEN); num_bytes = max_t(unsigned int, skb->len, ETH_ZLEN);
} }
wi->num_bytes = num_bytes;
if (skb_vlan_tag_present(skb)) { if (skb_vlan_tag_present(skb)) {
mlx5e_insert_vlan(eseg->inline_hdr_start, skb, ihs, &skb_data, mlx5e_insert_vlan(eseg->inline_hdr_start, skb, ihs, &skb_data,
&skb_len); &skb_len);
...@@ -307,6 +309,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) ...@@ -307,6 +309,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
sq->bf_budget = bf ? sq->bf_budget - 1 : 0; sq->bf_budget = bf ? sq->bf_budget - 1 : 0;
sq->stats.packets++; sq->stats.packets++;
sq->stats.bytes += num_bytes;
return NETDEV_TX_OK; return NETDEV_TX_OK;
dma_unmap_wqe_err: dma_unmap_wqe_err:
...@@ -335,10 +338,6 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq) ...@@ -335,10 +338,6 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq)
u16 sqcc; u16 sqcc;
int i; int i;
/* avoid accessing cq (dma coherent memory) if not needed */
if (!test_and_clear_bit(MLX5E_CQ_HAS_CQES, &cq->flags))
return false;
sq = container_of(cq, struct mlx5e_sq, cq); sq = container_of(cq, struct mlx5e_sq, cq);
npkts = 0; npkts = 0;
...@@ -422,10 +421,6 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq) ...@@ -422,10 +421,6 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq)
netif_tx_wake_queue(sq->txq); netif_tx_wake_queue(sq->txq);
sq->stats.wake++; sq->stats.wake++;
} }
if (i == MLX5E_TX_CQ_POLL_BUDGET) {
set_bit(MLX5E_CQ_HAS_CQES, &cq->flags);
return true;
}
return false; return (i == MLX5E_TX_CQ_POLL_BUDGET);
} }
...@@ -88,7 +88,6 @@ void mlx5e_completion_event(struct mlx5_core_cq *mcq) ...@@ -88,7 +88,6 @@ void mlx5e_completion_event(struct mlx5_core_cq *mcq)
{ {
struct mlx5e_cq *cq = container_of(mcq, struct mlx5e_cq, mcq); struct mlx5e_cq *cq = container_of(mcq, struct mlx5e_cq, mcq);
set_bit(MLX5E_CQ_HAS_CQES, &cq->flags);
set_bit(MLX5E_CHANNEL_NAPI_SCHED, &cq->channel->flags); set_bit(MLX5E_CHANNEL_NAPI_SCHED, &cq->channel->flags);
barrier(); barrier();
napi_schedule(cq->napi); napi_schedule(cq->napi);
......
...@@ -4245,7 +4245,9 @@ struct mlx5_ifc_modify_tir_bitmask_bits { ...@@ -4245,7 +4245,9 @@ struct mlx5_ifc_modify_tir_bitmask_bits {
u8 reserved_at_20[0x1b]; u8 reserved_at_20[0x1b];
u8 self_lb_en[0x1]; u8 self_lb_en[0x1];
u8 reserved_at_3c[0x3]; u8 reserved_at_3c[0x1];
u8 hash[0x1];
u8 reserved_at_3e[0x1];
u8 lro[0x1]; u8 lro[0x1];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment