Skip to content

Commit 0df57e6

Browse files
Jakub Kicinskidavem330
authored andcommitted
nfp: add a separate counter for packets with CHECKSUM_COMPLETE
We are currently counting packets with CHECKSUM_COMPLETE as "hw_rx_csum_ok". This is confusing. Add a new counter. To make sure it fits in the same cacheline move the less used error counter to a different location. Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Dirk van der Merwe <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b714295 commit 0df57e6

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

drivers/net/ethernet/netronome/nfp/nfp_net.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ struct nfp_net_rx_ring {
391391
* @rx_drops: Number of packets dropped on RX due to lack of resources
392392
* @hw_csum_rx_ok: Counter of packets where the HW checksum was OK
393393
* @hw_csum_rx_inner_ok: Counter of packets where the inner HW checksum was OK
394+
* @hw_csum_rx_complete: Counter of packets with CHECKSUM_COMPLETE reported
394395
* @hw_csum_rx_error: Counter of packets with bad checksums
395396
* @tx_sync: Seqlock for atomic updates of TX stats
396397
* @tx_pkts: Number of Transmitted packets
@@ -434,7 +435,7 @@ struct nfp_net_r_vector {
434435
u64 rx_drops;
435436
u64 hw_csum_rx_ok;
436437
u64 hw_csum_rx_inner_ok;
437-
u64 hw_csum_rx_error;
438+
u64 hw_csum_rx_complete;
438439

439440
struct nfp_net_tx_ring *xdp_ring;
440441

@@ -446,6 +447,7 @@ struct nfp_net_r_vector {
446447
u64 tx_gather;
447448
u64 tx_lso;
448449

450+
u64 hw_csum_rx_error;
449451
u64 rx_replace_buf_alloc_fail;
450452
u64 tx_errors;
451453
u64 tx_busy;

drivers/net/ethernet/netronome/nfp/nfp_net_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ static void nfp_net_rx_csum(struct nfp_net_dp *dp,
14061406
skb->ip_summed = meta->csum_type;
14071407
skb->csum = meta->csum;
14081408
u64_stats_update_begin(&r_vec->rx_sync);
1409-
r_vec->hw_csum_rx_ok++;
1409+
r_vec->hw_csum_rx_complete++;
14101410
u64_stats_update_end(&r_vec->rx_sync);
14111411
return;
14121412
}

drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static const struct nfp_et_stat nfp_mac_et_stats[] = {
179179

180180
#define NN_ET_GLOBAL_STATS_LEN ARRAY_SIZE(nfp_net_et_stats)
181181
#define NN_ET_SWITCH_STATS_LEN 9
182-
#define NN_RVEC_GATHER_STATS 8
182+
#define NN_RVEC_GATHER_STATS 9
183183
#define NN_RVEC_PER_Q_STATS 3
184184

185185
static void nfp_net_get_nspinfo(struct nfp_app *app, char *version)
@@ -468,6 +468,7 @@ static u8 *nfp_vnic_get_sw_stats_strings(struct net_device *netdev, u8 *data)
468468

469469
data = nfp_pr_et(data, "hw_rx_csum_ok");
470470
data = nfp_pr_et(data, "hw_rx_csum_inner_ok");
471+
data = nfp_pr_et(data, "hw_rx_csum_complete");
471472
data = nfp_pr_et(data, "hw_rx_csum_err");
472473
data = nfp_pr_et(data, "rx_replace_buf_alloc_fail");
473474
data = nfp_pr_et(data, "hw_tx_csum");
@@ -493,18 +494,19 @@ static u64 *nfp_vnic_get_sw_stats(struct net_device *netdev, u64 *data)
493494
data[0] = nn->r_vecs[i].rx_pkts;
494495
tmp[0] = nn->r_vecs[i].hw_csum_rx_ok;
495496
tmp[1] = nn->r_vecs[i].hw_csum_rx_inner_ok;
496-
tmp[2] = nn->r_vecs[i].hw_csum_rx_error;
497-
tmp[3] = nn->r_vecs[i].rx_replace_buf_alloc_fail;
497+
tmp[2] = nn->r_vecs[i].hw_csum_rx_complete;
498+
tmp[3] = nn->r_vecs[i].hw_csum_rx_error;
499+
tmp[4] = nn->r_vecs[i].rx_replace_buf_alloc_fail;
498500
} while (u64_stats_fetch_retry(&nn->r_vecs[i].rx_sync, start));
499501

500502
do {
501503
start = u64_stats_fetch_begin(&nn->r_vecs[i].tx_sync);
502504
data[1] = nn->r_vecs[i].tx_pkts;
503505
data[2] = nn->r_vecs[i].tx_busy;
504-
tmp[4] = nn->r_vecs[i].hw_csum_tx;
505-
tmp[5] = nn->r_vecs[i].hw_csum_tx_inner;
506-
tmp[6] = nn->r_vecs[i].tx_gather;
507-
tmp[7] = nn->r_vecs[i].tx_lso;
506+
tmp[5] = nn->r_vecs[i].hw_csum_tx;
507+
tmp[6] = nn->r_vecs[i].hw_csum_tx_inner;
508+
tmp[7] = nn->r_vecs[i].tx_gather;
509+
tmp[8] = nn->r_vecs[i].tx_lso;
508510
} while (u64_stats_fetch_retry(&nn->r_vecs[i].tx_sync, start));
509511

510512
data += NN_RVEC_PER_Q_STATS;

0 commit comments

Comments
 (0)