Skip to content

Commit f24686e

Browse files
Gal PressmanSaeed Mahameed
authored andcommitted
net/mlx5e: Add VLAN offloads statistics
The following counters are now exposed through ethtool -S: rx[i]_removed_vlan_packets (per channel) rx_removed_vlan_packets tx[i]_added_vlan_packets (per channel) tx_added_vlan_packets rx_removed_vlan_packets: The number of packets that had their outer VLAN header stripped to the CQE by the hardware. tx_added_vlan_packets: The number of packets that had their outer VLAN header inserted by the hardware. Signed-off-by: Gal Pressman <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 4382c7b commit f24686e

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv)
196196
s->rx_bytes += rq_stats->bytes;
197197
s->rx_lro_packets += rq_stats->lro_packets;
198198
s->rx_lro_bytes += rq_stats->lro_bytes;
199+
s->rx_removed_vlan_packets += rq_stats->removed_vlan_packets;
199200
s->rx_csum_none += rq_stats->csum_none;
200201
s->rx_csum_complete += rq_stats->csum_complete;
201202
s->rx_csum_unnecessary += rq_stats->csum_unnecessary;
@@ -224,6 +225,7 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv)
224225
s->tx_tso_bytes += sq_stats->tso_bytes;
225226
s->tx_tso_inner_packets += sq_stats->tso_inner_packets;
226227
s->tx_tso_inner_bytes += sq_stats->tso_inner_bytes;
228+
s->tx_added_vlan_packets += sq_stats->added_vlan_packets;
227229
s->tx_queue_stopped += sq_stats->stopped;
228230
s->tx_queue_wake += sq_stats->wake;
229231
s->tx_queue_dropped += sq_stats->dropped;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,11 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe,
685685
if (likely(netdev->features & NETIF_F_RXHASH))
686686
mlx5e_skb_set_hash(cqe, skb);
687687

688-
if (cqe_has_vlan(cqe))
688+
if (cqe_has_vlan(cqe)) {
689689
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
690690
be16_to_cpu(cqe->vlan_info));
691+
rq->stats.removed_vlan_packets++;
692+
}
691693

692694
skb->mark = be32_to_cpu(cqe->sop_drop_qpn) & MLX5E_TC_FLOW_ID_MASK;
693695

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ static const struct counter_desc sw_stats_desc[] = {
4242
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_bytes) },
4343
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_packets) },
4444
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_bytes) },
45+
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_added_vlan_packets) },
4546
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) },
4647
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_bytes) },
48+
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_removed_vlan_packets) },
4749
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) },
4850
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) },
4951
{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) },
@@ -733,6 +735,7 @@ static const struct counter_desc rq_stats_desc[] = {
733735
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_tx_full) },
734736
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_packets) },
735737
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_bytes) },
738+
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, removed_vlan_packets) },
736739
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) },
737740
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler) },
738741
{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, buff_alloc_err) },
@@ -755,6 +758,7 @@ static const struct counter_desc sq_stats_desc[] = {
755758
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_bytes) },
756759
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial) },
757760
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
761+
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) },
758762
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },
759763
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },
760764
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) },

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ struct mlx5e_sw_stats {
5959
u64 tx_tso_bytes;
6060
u64 tx_tso_inner_packets;
6161
u64 tx_tso_inner_bytes;
62+
u64 tx_added_vlan_packets;
6263
u64 rx_lro_packets;
6364
u64 rx_lro_bytes;
65+
u64 rx_removed_vlan_packets;
6466
u64 rx_csum_unnecessary;
6567
u64 rx_csum_none;
6668
u64 rx_csum_complete;
@@ -153,6 +155,7 @@ struct mlx5e_rq_stats {
153155
u64 csum_none;
154156
u64 lro_packets;
155157
u64 lro_bytes;
158+
u64 removed_vlan_packets;
156159
u64 xdp_drop;
157160
u64 xdp_tx;
158161
u64 xdp_tx_full;
@@ -180,6 +183,7 @@ struct mlx5e_sq_stats {
180183
u64 tso_inner_bytes;
181184
u64 csum_partial;
182185
u64 csum_partial_inner;
186+
u64 added_vlan_packets;
183187
u64 nop;
184188
/* less likely accessed in data path */
185189
u64 csum_none;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
361361
if (skb_vlan_tag_present(skb)) {
362362
mlx5e_insert_vlan(eseg->inline_hdr.start, skb, ihs, &skb_data, &skb_len);
363363
ihs += VLAN_HLEN;
364+
sq->stats.added_vlan_packets++;
364365
} else {
365366
memcpy(eseg->inline_hdr.start, skb_data, ihs);
366367
mlx5e_tx_skb_pull_inline(&skb_data, &skb_len, ihs);
@@ -372,6 +373,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
372373
if (skb->vlan_proto == cpu_to_be16(ETH_P_8021AD))
373374
eseg->insert.type |= cpu_to_be16(MLX5_ETH_WQE_SVLAN);
374375
eseg->insert.vlan_tci = cpu_to_be16(skb_vlan_tag_get(skb));
376+
sq->stats.added_vlan_packets++;
375377
}
376378

377379
headlen = skb_len - skb->data_len;

0 commit comments

Comments
 (0)