@@ -59,74 +59,44 @@ enum nfp_dump_diag {
59
59
NFP_DUMP_NSP_DIAG = 0 ,
60
60
};
61
61
62
- /* Support for stats. Returns netdev, driver, and device stats */
63
- enum { NETDEV_ET_STATS , NFP_NET_DRV_ET_STATS , NFP_NET_DEV_ET_STATS };
64
- struct _nfp_net_et_stats {
62
+ struct nfp_et_stat {
65
63
char name [ETH_GSTRING_LEN ];
66
- int type ;
67
- int sz ;
68
64
int off ;
69
65
};
70
66
71
- #define NN_ET_NETDEV_STAT (m ) NETDEV_ET_STATS, \
72
- FIELD_SIZEOF(struct net_device_stats, m), \
73
- offsetof(struct net_device_stats, m)
74
- /* For stats in the control BAR (other than Q stats) */
75
- #define NN_ET_DEV_STAT (m ) NFP_NET_DEV_ET_STATS, \
76
- sizeof(u64), \
77
- (m)
78
- static const struct _nfp_net_et_stats nfp_net_et_stats [] = {
79
- /* netdev stats */
80
- {"rx_packets" , NN_ET_NETDEV_STAT (rx_packets )},
81
- {"tx_packets" , NN_ET_NETDEV_STAT (tx_packets )},
82
- {"rx_bytes" , NN_ET_NETDEV_STAT (rx_bytes )},
83
- {"tx_bytes" , NN_ET_NETDEV_STAT (tx_bytes )},
84
- {"rx_errors" , NN_ET_NETDEV_STAT (rx_errors )},
85
- {"tx_errors" , NN_ET_NETDEV_STAT (tx_errors )},
86
- {"rx_dropped" , NN_ET_NETDEV_STAT (rx_dropped )},
87
- {"tx_dropped" , NN_ET_NETDEV_STAT (tx_dropped )},
88
- {"multicast" , NN_ET_NETDEV_STAT (multicast )},
89
- {"collisions" , NN_ET_NETDEV_STAT (collisions )},
90
- {"rx_over_errors" , NN_ET_NETDEV_STAT (rx_over_errors )},
91
- {"rx_crc_errors" , NN_ET_NETDEV_STAT (rx_crc_errors )},
92
- {"rx_frame_errors" , NN_ET_NETDEV_STAT (rx_frame_errors )},
93
- {"rx_fifo_errors" , NN_ET_NETDEV_STAT (rx_fifo_errors )},
94
- {"rx_missed_errors" , NN_ET_NETDEV_STAT (rx_missed_errors )},
95
- {"tx_aborted_errors" , NN_ET_NETDEV_STAT (tx_aborted_errors )},
96
- {"tx_carrier_errors" , NN_ET_NETDEV_STAT (tx_carrier_errors )},
97
- {"tx_fifo_errors" , NN_ET_NETDEV_STAT (tx_fifo_errors )},
67
+ static const struct nfp_et_stat nfp_net_et_stats [] = {
98
68
/* Stats from the device */
99
- {"dev_rx_discards" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_RX_DISCARDS ) },
100
- {"dev_rx_errors" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_RX_ERRORS ) },
101
- {"dev_rx_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_RX_OCTETS ) },
102
- {"dev_rx_uc_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_RX_UC_OCTETS ) },
103
- {"dev_rx_mc_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_RX_MC_OCTETS ) },
104
- {"dev_rx_bc_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_RX_BC_OCTETS ) },
105
- {"dev_rx_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_RX_FRAMES ) },
106
- {"dev_rx_mc_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_RX_MC_FRAMES ) },
107
- {"dev_rx_bc_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_RX_BC_FRAMES ) },
108
-
109
- {"dev_tx_discards" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_TX_DISCARDS ) },
110
- {"dev_tx_errors" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_TX_ERRORS ) },
111
- {"dev_tx_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_TX_OCTETS ) },
112
- {"dev_tx_uc_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_TX_UC_OCTETS ) },
113
- {"dev_tx_mc_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_TX_MC_OCTETS ) },
114
- {"dev_tx_bc_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_TX_BC_OCTETS ) },
115
- {"dev_tx_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_TX_FRAMES ) },
116
- {"dev_tx_mc_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_TX_MC_FRAMES ) },
117
- {"dev_tx_bc_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_TX_BC_FRAMES ) },
118
-
119
- {"bpf_pass_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_APP0_FRAMES ) },
120
- {"bpf_pass_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_APP0_BYTES ) },
69
+ { "dev_rx_discards" , NFP_NET_CFG_STATS_RX_DISCARDS },
70
+ { "dev_rx_errors" , NFP_NET_CFG_STATS_RX_ERRORS },
71
+ { "dev_rx_bytes" , NFP_NET_CFG_STATS_RX_OCTETS },
72
+ { "dev_rx_uc_bytes" , NFP_NET_CFG_STATS_RX_UC_OCTETS },
73
+ { "dev_rx_mc_bytes" , NFP_NET_CFG_STATS_RX_MC_OCTETS },
74
+ { "dev_rx_bc_bytes" , NFP_NET_CFG_STATS_RX_BC_OCTETS },
75
+ { "dev_rx_pkts" , NFP_NET_CFG_STATS_RX_FRAMES },
76
+ { "dev_rx_mc_pkts" , NFP_NET_CFG_STATS_RX_MC_FRAMES },
77
+ { "dev_rx_bc_pkts" , NFP_NET_CFG_STATS_RX_BC_FRAMES },
78
+
79
+ { "dev_tx_discards" , NFP_NET_CFG_STATS_TX_DISCARDS },
80
+ { "dev_tx_errors" , NFP_NET_CFG_STATS_TX_ERRORS },
81
+ { "dev_tx_bytes" , NFP_NET_CFG_STATS_TX_OCTETS },
82
+ { "dev_tx_uc_bytes" , NFP_NET_CFG_STATS_TX_UC_OCTETS },
83
+ { "dev_tx_mc_bytes" , NFP_NET_CFG_STATS_TX_MC_OCTETS },
84
+ { "dev_tx_bc_bytes" , NFP_NET_CFG_STATS_TX_BC_OCTETS },
85
+ { "dev_tx_pkts" , NFP_NET_CFG_STATS_TX_FRAMES },
86
+ { "dev_tx_mc_pkts" , NFP_NET_CFG_STATS_TX_MC_FRAMES },
87
+ { "dev_tx_bc_pkts" , NFP_NET_CFG_STATS_TX_BC_FRAMES },
88
+
89
+ { "bpf_pass_pkts" , NFP_NET_CFG_STATS_APP0_FRAMES },
90
+ { "bpf_pass_bytes" , NFP_NET_CFG_STATS_APP0_BYTES },
121
91
/* see comments in outro functions in nfp_bpf_jit.c to find out
122
92
* how different BPF modes use app-specific counters
123
93
*/
124
- {"bpf_app1_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_APP1_FRAMES ) },
125
- {"bpf_app1_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_APP1_BYTES ) },
126
- {"bpf_app2_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_APP2_FRAMES ) },
127
- {"bpf_app2_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_APP2_BYTES ) },
128
- {"bpf_app3_pkts" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_APP3_FRAMES ) },
129
- {"bpf_app3_bytes" , NN_ET_DEV_STAT ( NFP_NET_CFG_STATS_APP3_BYTES ) },
94
+ { "bpf_app1_pkts" , NFP_NET_CFG_STATS_APP1_FRAMES },
95
+ { "bpf_app1_bytes" , NFP_NET_CFG_STATS_APP1_BYTES },
96
+ { "bpf_app2_pkts" , NFP_NET_CFG_STATS_APP2_FRAMES },
97
+ { "bpf_app2_bytes" , NFP_NET_CFG_STATS_APP2_BYTES },
98
+ { "bpf_app3_pkts" , NFP_NET_CFG_STATS_APP3_FRAMES },
99
+ { "bpf_app3_bytes" , NFP_NET_CFG_STATS_APP3_BYTES },
130
100
};
131
101
132
102
#define NN_ET_GLOBAL_STATS_LEN ARRAY_SIZE(nfp_net_et_stats)
@@ -421,28 +391,13 @@ static void nfp_net_get_stats(struct net_device *netdev,
421
391
{
422
392
u64 gathered_stats [NN_ET_RVEC_GATHER_STATS ] = {};
423
393
struct nfp_net * nn = netdev_priv (netdev );
424
- struct rtnl_link_stats64 * netdev_stats ;
425
- struct rtnl_link_stats64 temp = {};
426
394
u64 tmp [NN_ET_RVEC_GATHER_STATS ];
427
395
u8 __iomem * io_p ;
428
396
int i , j , k ;
429
- u8 * p ;
430
-
431
- netdev_stats = dev_get_stats (netdev , & temp );
432
397
433
398
for (i = 0 ; i < NN_ET_GLOBAL_STATS_LEN ; i ++ ) {
434
- switch (nfp_net_et_stats [i ].type ) {
435
- case NETDEV_ET_STATS :
436
- p = (char * )netdev_stats + nfp_net_et_stats [i ].off ;
437
- data [i ] = nfp_net_et_stats [i ].sz == sizeof (u64 ) ?
438
- * (u64 * )p : * (u32 * )p ;
439
- break ;
440
-
441
- case NFP_NET_DEV_ET_STATS :
442
- io_p = nn -> dp .ctrl_bar + nfp_net_et_stats [i ].off ;
443
- data [i ] = readq (io_p );
444
- break ;
445
- }
399
+ io_p = nn -> dp .ctrl_bar + nfp_net_et_stats [i ].off ;
400
+ data [i ] = readq (io_p );
446
401
}
447
402
for (j = 0 ; j < nn -> dp .num_r_vecs ; j ++ ) {
448
403
unsigned int start ;
0 commit comments