net/mlx5e: Add rx/tx bytes software counters
Sum up rx/tx bytes in software as we do for rx/tx packets, to be reported in upcoming statistics fix. Signed-off-by: Gal Pressman <galp@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
85082dba0a
commit
b081da5ee1
|
@ -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] = {
|
||||||
|
|
||||||
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] = {
|
||||||
|
|
||||||
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 {
|
||||||
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 {
|
||||||
|
|
|
@ -263,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:
|
||||||
|
|
|
@ -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)
|
||||||
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)
|
||||||
!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)
|
||||||
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:
|
||||||
|
|
Loading…
Reference in New Issue