|
@@ -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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
|
|
|
|
mlx5e_build_tir_ctx_lro(tirc, priv);
|
|
mlx5e_build_tir_ctx_lro(tirc, priv);
|
|
|
|
|
|
- err = mlx5_core_modify_tir(mdev, priv->tirn[tt], in, inlen);
|
|
|
|
|
|
+ for (tt = 0; tt < MLX5E_NUM_TT; tt++) {
|
|
|
|
+ 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)
|
|
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_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);
|
|
|
|
- }
|
|
|
|
|
|
+ mlx5e_build_tir_ctx_hash(tirc, priv);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -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);
|
|
|
|
- mlx5e_modify_tir_lro(priv, MLX5E_TT_IPV6_TCP);
|
|
|
|
|
|
+ err = mlx5e_modify_tirs_lro(priv);
|
|
|
|
+ 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)
|
|
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,
|
|
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++)
|
|
|
|
- priv->params.indirection_rqt[i] = i % num_channels;
|
|
|
|
|
|
+ mlx5e_build_default_indir_rqt(priv->params.indirection_rqt,
|
|
|
|
+ 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;
|