mirror of https://gitee.com/openkylin/linux.git
net/mlx5e: Add PTP-RX statistics
Like PTP-TX, once the PTP-RX is opened, corresponding statistics appear. Add indication that PTP-RX was ever opened: rx_ptp_opened. If any of the PTP RX or TX were opened, display the PTP channel's statistics. Signed-off-by: Aya Levin <ayal@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
a099da8ffc
commit
a28359e922
|
@ -860,6 +860,7 @@ struct mlx5e_priv {
|
|||
u16 max_nch;
|
||||
u8 max_opened_tc;
|
||||
bool tx_ptp_opened;
|
||||
bool rx_ptp_opened;
|
||||
struct hwtstamp_config tstamp;
|
||||
u16 q_counter;
|
||||
u16 drop_rq_q_counter;
|
||||
|
|
|
@ -610,6 +610,9 @@ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,
|
|||
if (unlikely(err))
|
||||
goto err_napi_del;
|
||||
|
||||
if (test_bit(MLX5E_PTP_STATE_RX, c->state))
|
||||
priv->rx_ptp_opened = true;
|
||||
|
||||
*cp = c;
|
||||
|
||||
kvfree(cparams);
|
||||
|
|
|
@ -3496,6 +3496,13 @@ void mlx5e_fold_sw_stats64(struct mlx5e_priv *priv, struct rtnl_link_stats64 *s)
|
|||
s->tx_dropped += sq_stats->dropped;
|
||||
}
|
||||
}
|
||||
if (priv->rx_ptp_opened) {
|
||||
struct mlx5e_rq_stats *rq_stats = &priv->ptp_stats.rq;
|
||||
|
||||
s->rx_packets += rq_stats->packets;
|
||||
s->rx_bytes += rq_stats->bytes;
|
||||
s->multicast += rq_stats->mcast_packets;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -407,13 +407,21 @@ static void mlx5e_stats_grp_sw_update_stats_ptp(struct mlx5e_priv *priv,
|
|||
{
|
||||
int i;
|
||||
|
||||
if (!priv->tx_ptp_opened)
|
||||
if (!priv->tx_ptp_opened && !priv->rx_ptp_opened)
|
||||
return;
|
||||
|
||||
mlx5e_stats_grp_sw_update_stats_ch_stats(s, &priv->ptp_stats.ch);
|
||||
|
||||
for (i = 0; i < priv->max_opened_tc; i++) {
|
||||
mlx5e_stats_grp_sw_update_stats_sq(s, &priv->ptp_stats.sq[i]);
|
||||
if (priv->tx_ptp_opened) {
|
||||
for (i = 0; i < priv->max_opened_tc; i++) {
|
||||
mlx5e_stats_grp_sw_update_stats_sq(s, &priv->ptp_stats.sq[i]);
|
||||
|
||||
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657 */
|
||||
barrier();
|
||||
}
|
||||
}
|
||||
if (priv->rx_ptp_opened) {
|
||||
mlx5e_stats_grp_sw_update_stats_rq_stats(s, &priv->ptp_stats.rq);
|
||||
|
||||
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657 */
|
||||
barrier();
|
||||
|
@ -1760,6 +1768,38 @@ static const struct counter_desc ptp_cq_stats_desc[] = {
|
|||
{ MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, abort_abs_diff_ns) },
|
||||
};
|
||||
|
||||
static const struct counter_desc ptp_rq_stats_desc[] = {
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, packets) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, bytes) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, csum_complete) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, csum_complete_tail) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, csum_complete_tail_slow) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, csum_unnecessary) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, csum_none) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, xdp_drop) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, xdp_redirect) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, lro_packets) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, lro_bytes) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, ecn_mark) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, removed_vlan_packets) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, wqe_err) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, mpwqe_filler_cqes) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, mpwqe_filler_strides) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, oversize_pkts_sw_drop) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, buff_alloc_err) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, cqe_compress_blks) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, cache_reuse) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, cache_full) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, cache_empty) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, cache_busy) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, cache_waive) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, congst_umr) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, arfs_err) },
|
||||
{ MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, recover) },
|
||||
};
|
||||
|
||||
static const struct counter_desc qos_sq_stats_desc[] = {
|
||||
{ MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, packets) },
|
||||
{ MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, bytes) },
|
||||
|
@ -1805,6 +1845,7 @@ static const struct counter_desc qos_sq_stats_desc[] = {
|
|||
#define NUM_PTP_SQ_STATS ARRAY_SIZE(ptp_sq_stats_desc)
|
||||
#define NUM_PTP_CH_STATS ARRAY_SIZE(ptp_ch_stats_desc)
|
||||
#define NUM_PTP_CQ_STATS ARRAY_SIZE(ptp_cq_stats_desc)
|
||||
#define NUM_PTP_RQ_STATS ARRAY_SIZE(ptp_rq_stats_desc)
|
||||
#define NUM_QOS_SQ_STATS ARRAY_SIZE(qos_sq_stats_desc)
|
||||
|
||||
static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(qos)
|
||||
|
@ -1851,32 +1892,46 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(qos) { return; }
|
|||
|
||||
static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(ptp)
|
||||
{
|
||||
return priv->tx_ptp_opened ?
|
||||
NUM_PTP_CH_STATS +
|
||||
((NUM_PTP_SQ_STATS + NUM_PTP_CQ_STATS) * priv->max_opened_tc) :
|
||||
0;
|
||||
int num = NUM_PTP_CH_STATS;
|
||||
|
||||
if (!priv->tx_ptp_opened && !priv->rx_ptp_opened)
|
||||
return 0;
|
||||
|
||||
if (priv->tx_ptp_opened)
|
||||
num += (NUM_PTP_SQ_STATS + NUM_PTP_CQ_STATS) * priv->max_opened_tc;
|
||||
if (priv->rx_ptp_opened)
|
||||
num += NUM_PTP_RQ_STATS;
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(ptp)
|
||||
{
|
||||
int i, tc;
|
||||
|
||||
if (!priv->tx_ptp_opened)
|
||||
if (!priv->tx_ptp_opened && !priv->rx_ptp_opened)
|
||||
return idx;
|
||||
|
||||
for (i = 0; i < NUM_PTP_CH_STATS; i++)
|
||||
sprintf(data + (idx++) * ETH_GSTRING_LEN,
|
||||
ptp_ch_stats_desc[i].format);
|
||||
|
||||
for (tc = 0; tc < priv->max_opened_tc; tc++)
|
||||
for (i = 0; i < NUM_PTP_SQ_STATS; i++)
|
||||
sprintf(data + (idx++) * ETH_GSTRING_LEN,
|
||||
ptp_sq_stats_desc[i].format, tc);
|
||||
if (priv->tx_ptp_opened) {
|
||||
for (tc = 0; tc < priv->max_opened_tc; tc++)
|
||||
for (i = 0; i < NUM_PTP_SQ_STATS; i++)
|
||||
sprintf(data + (idx++) * ETH_GSTRING_LEN,
|
||||
ptp_sq_stats_desc[i].format, tc);
|
||||
|
||||
for (tc = 0; tc < priv->max_opened_tc; tc++)
|
||||
for (i = 0; i < NUM_PTP_CQ_STATS; i++)
|
||||
for (tc = 0; tc < priv->max_opened_tc; tc++)
|
||||
for (i = 0; i < NUM_PTP_CQ_STATS; i++)
|
||||
sprintf(data + (idx++) * ETH_GSTRING_LEN,
|
||||
ptp_cq_stats_desc[i].format, tc);
|
||||
}
|
||||
if (priv->rx_ptp_opened) {
|
||||
for (i = 0; i < NUM_PTP_RQ_STATS; i++)
|
||||
sprintf(data + (idx++) * ETH_GSTRING_LEN,
|
||||
ptp_cq_stats_desc[i].format, tc);
|
||||
ptp_rq_stats_desc[i].format);
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
@ -1884,7 +1939,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ptp)
|
|||
{
|
||||
int i, tc;
|
||||
|
||||
if (!priv->tx_ptp_opened)
|
||||
if (!priv->tx_ptp_opened && !priv->rx_ptp_opened)
|
||||
return idx;
|
||||
|
||||
for (i = 0; i < NUM_PTP_CH_STATS; i++)
|
||||
|
@ -1892,18 +1947,25 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ptp)
|
|||
MLX5E_READ_CTR64_CPU(&priv->ptp_stats.ch,
|
||||
ptp_ch_stats_desc, i);
|
||||
|
||||
for (tc = 0; tc < priv->max_opened_tc; tc++)
|
||||
for (i = 0; i < NUM_PTP_SQ_STATS; i++)
|
||||
data[idx++] =
|
||||
MLX5E_READ_CTR64_CPU(&priv->ptp_stats.sq[tc],
|
||||
ptp_sq_stats_desc, i);
|
||||
if (priv->tx_ptp_opened) {
|
||||
for (tc = 0; tc < priv->max_opened_tc; tc++)
|
||||
for (i = 0; i < NUM_PTP_SQ_STATS; i++)
|
||||
data[idx++] =
|
||||
MLX5E_READ_CTR64_CPU(&priv->ptp_stats.sq[tc],
|
||||
ptp_sq_stats_desc, i);
|
||||
|
||||
for (tc = 0; tc < priv->max_opened_tc; tc++)
|
||||
for (i = 0; i < NUM_PTP_CQ_STATS; i++)
|
||||
for (tc = 0; tc < priv->max_opened_tc; tc++)
|
||||
for (i = 0; i < NUM_PTP_CQ_STATS; i++)
|
||||
data[idx++] =
|
||||
MLX5E_READ_CTR64_CPU(&priv->ptp_stats.cq[tc],
|
||||
ptp_cq_stats_desc, i);
|
||||
}
|
||||
if (priv->rx_ptp_opened) {
|
||||
for (i = 0; i < NUM_PTP_RQ_STATS; i++)
|
||||
data[idx++] =
|
||||
MLX5E_READ_CTR64_CPU(&priv->ptp_stats.cq[tc],
|
||||
ptp_cq_stats_desc, i);
|
||||
|
||||
MLX5E_READ_CTR64_CPU(&priv->ptp_stats.rq,
|
||||
ptp_rq_stats_desc, i);
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#define MLX5E_DECLARE_PTP_TX_STAT(type, fld) "ptp_tx%d_"#fld, offsetof(type, fld)
|
||||
#define MLX5E_DECLARE_PTP_CH_STAT(type, fld) "ptp_ch_"#fld, offsetof(type, fld)
|
||||
#define MLX5E_DECLARE_PTP_CQ_STAT(type, fld) "ptp_cq%d_"#fld, offsetof(type, fld)
|
||||
#define MLX5E_DECLARE_PTP_RQ_STAT(type, fld) "ptp_rq%d_"#fld, offsetof(type, fld)
|
||||
|
||||
#define MLX5E_DECLARE_QOS_TX_STAT(type, fld) "qos_tx%d_"#fld, offsetof(type, fld)
|
||||
|
||||
|
|
Loading…
Reference in New Issue