|
@@ -165,6 +165,18 @@ static const struct {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
+static unsigned long mlx5e_query_pfc_combined(struct mlx5e_priv *priv)
|
|
|
+{
|
|
|
+ struct mlx5_core_dev *mdev = priv->mdev;
|
|
|
+ u8 pfc_en_tx;
|
|
|
+ u8 pfc_en_rx;
|
|
|
+ int err;
|
|
|
+
|
|
|
+ err = mlx5_query_port_pfc(mdev, &pfc_en_tx, &pfc_en_rx);
|
|
|
+
|
|
|
+ return err ? 0 : pfc_en_tx | pfc_en_rx;
|
|
|
+}
|
|
|
+
|
|
|
#define MLX5E_NUM_Q_CNTRS(priv) (NUM_Q_COUNTERS * (!!priv->q_counter))
|
|
|
#define MLX5E_NUM_RQ_STATS(priv) \
|
|
|
(NUM_RQ_STATS * priv->params.num_channels * \
|
|
@@ -172,6 +184,7 @@ static const struct {
|
|
|
#define MLX5E_NUM_SQ_STATS(priv) \
|
|
|
(NUM_SQ_STATS * priv->params.num_channels * priv->params.num_tc * \
|
|
|
test_bit(MLX5E_STATE_OPENED, &priv->state))
|
|
|
+#define MLX5E_NUM_PFC_COUNTERS(priv) hweight8(mlx5e_query_pfc_combined(priv))
|
|
|
|
|
|
static int mlx5e_get_sset_count(struct net_device *dev, int sset)
|
|
|
{
|
|
@@ -183,7 +196,8 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
|
|
|
MLX5E_NUM_Q_CNTRS(priv) +
|
|
|
NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS +
|
|
|
MLX5E_NUM_RQ_STATS(priv) +
|
|
|
- MLX5E_NUM_SQ_STATS(priv);
|
|
|
+ MLX5E_NUM_SQ_STATS(priv) +
|
|
|
+ MLX5E_NUM_PFC_COUNTERS(priv);
|
|
|
/* fallthrough */
|
|
|
default:
|
|
|
return -EOPNOTSUPP;
|
|
@@ -192,7 +206,8 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
|
|
|
|
|
|
static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
|
|
|
{
|
|
|
- int i, j, tc, idx = 0;
|
|
|
+ int i, j, tc, prio, idx = 0;
|
|
|
+ unsigned long pfc_combined;
|
|
|
|
|
|
/* SW counters */
|
|
|
for (i = 0; i < NUM_SW_COUNTERS; i++)
|
|
@@ -220,6 +235,21 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
|
|
|
strcpy(data + (idx++) * ETH_GSTRING_LEN,
|
|
|
pport_2819_stats_desc[i].name);
|
|
|
|
|
|
+ for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
|
|
|
+ for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
|
|
|
+ sprintf(data + (idx++) * ETH_GSTRING_LEN, "prio%d_%s",
|
|
|
+ prio,
|
|
|
+ pport_per_prio_traffic_stats_desc[i].name);
|
|
|
+ }
|
|
|
+
|
|
|
+ pfc_combined = mlx5e_query_pfc_combined(priv);
|
|
|
+ for_each_set_bit(prio, &pfc_combined, NUM_PPORT_PRIO) {
|
|
|
+ for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) {
|
|
|
+ sprintf(data + (idx++) * ETH_GSTRING_LEN, "prio%d_%s",
|
|
|
+ prio, pport_per_prio_pfc_stats_desc[i].name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
|
|
|
return;
|
|
|
|
|
@@ -260,7 +290,8 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
|
|
|
struct ethtool_stats *stats, u64 *data)
|
|
|
{
|
|
|
struct mlx5e_priv *priv = netdev_priv(dev);
|
|
|
- int i, j, tc, idx = 0;
|
|
|
+ int i, j, tc, prio, idx = 0;
|
|
|
+ unsigned long pfc_combined;
|
|
|
|
|
|
if (!data)
|
|
|
return;
|
|
@@ -294,6 +325,20 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
|
|
|
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters,
|
|
|
pport_2819_stats_desc, i);
|
|
|
|
|
|
+ for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
|
|
|
+ for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
|
|
|
+ data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
|
|
|
+ pport_per_prio_traffic_stats_desc, i);
|
|
|
+ }
|
|
|
+
|
|
|
+ pfc_combined = mlx5e_query_pfc_combined(priv);
|
|
|
+ for_each_set_bit(prio, &pfc_combined, NUM_PPORT_PRIO) {
|
|
|
+ for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) {
|
|
|
+ data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
|
|
|
+ pport_per_prio_pfc_stats_desc, i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
|
|
|
return;
|
|
|
|