16
16
#include "otx2_common.h"
17
17
#include "otx2_struct.h"
18
18
19
+ static void otx2_nix_rq_op_stats (struct queue_stats * stats ,
20
+ struct otx2_nic * pfvf , int qidx )
21
+ {
22
+ u64 incr = (u64 )qidx << 32 ;
23
+ u64 * ptr ;
24
+
25
+ ptr = (u64 * )otx2_get_regaddr (pfvf , NIX_LF_RQ_OP_OCTS );
26
+ stats -> bytes = otx2_atomic64_add (incr , ptr );
27
+
28
+ ptr = (u64 * )otx2_get_regaddr (pfvf , NIX_LF_RQ_OP_PKTS );
29
+ stats -> pkts = otx2_atomic64_add (incr , ptr );
30
+ }
31
+
32
+ static void otx2_nix_sq_op_stats (struct queue_stats * stats ,
33
+ struct otx2_nic * pfvf , int qidx )
34
+ {
35
+ u64 incr = (u64 )qidx << 32 ;
36
+ u64 * ptr ;
37
+
38
+ ptr = (u64 * )otx2_get_regaddr (pfvf , NIX_LF_SQ_OP_OCTS );
39
+ stats -> bytes = otx2_atomic64_add (incr , ptr );
40
+
41
+ ptr = (u64 * )otx2_get_regaddr (pfvf , NIX_LF_SQ_OP_PKTS );
42
+ stats -> pkts = otx2_atomic64_add (incr , ptr );
43
+ }
44
+
45
+ void otx2_update_lmac_stats (struct otx2_nic * pfvf )
46
+ {
47
+ struct msg_req * req ;
48
+
49
+ if (!netif_running (pfvf -> netdev ))
50
+ return ;
51
+
52
+ otx2_mbox_lock (& pfvf -> mbox );
53
+ req = otx2_mbox_alloc_msg_cgx_stats (& pfvf -> mbox );
54
+ if (!req ) {
55
+ otx2_mbox_unlock (& pfvf -> mbox );
56
+ return ;
57
+ }
58
+
59
+ otx2_sync_mbox_msg (& pfvf -> mbox );
60
+ otx2_mbox_unlock (& pfvf -> mbox );
61
+ }
62
+
63
+ int otx2_update_rq_stats (struct otx2_nic * pfvf , int qidx )
64
+ {
65
+ struct otx2_rcv_queue * rq = & pfvf -> qset .rq [qidx ];
66
+
67
+ if (!pfvf -> qset .rq )
68
+ return 0 ;
69
+
70
+ otx2_nix_rq_op_stats (& rq -> stats , pfvf , qidx );
71
+ return 1 ;
72
+ }
73
+
74
+ int otx2_update_sq_stats (struct otx2_nic * pfvf , int qidx )
75
+ {
76
+ struct otx2_snd_queue * sq = & pfvf -> qset .sq [qidx ];
77
+
78
+ if (!pfvf -> qset .sq )
79
+ return 0 ;
80
+
81
+ otx2_nix_sq_op_stats (& sq -> stats , pfvf , qidx );
82
+ return 1 ;
83
+ }
84
+
19
85
void otx2_get_dev_stats (struct otx2_nic * pfvf )
20
86
{
21
87
struct otx2_dev_stats * dev_stats = & pfvf -> hw .dev_stats ;
@@ -590,6 +656,9 @@ static int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16 sqb_aura)
590
656
sq -> lmt_addr = (__force u64 * )(pfvf -> reg_base + LMT_LF_LMTLINEX (qidx ));
591
657
sq -> io_addr = (__force u64 )otx2_get_regaddr (pfvf , NIX_LF_OP_SENDX (0 ));
592
658
659
+ sq -> stats .bytes = 0 ;
660
+ sq -> stats .pkts = 0 ;
661
+
593
662
/* Get memory to put this msg */
594
663
aq = otx2_mbox_alloc_msg_nix_aq_enq (& pfvf -> mbox );
595
664
if (!aq )
@@ -1238,6 +1307,18 @@ void otx2_ctx_disable(struct mbox *mbox, int type, bool npa)
1238
1307
otx2_mbox_unlock (mbox );
1239
1308
}
1240
1309
1310
+ /* Mbox message handlers */
1311
+ void mbox_handler_cgx_stats (struct otx2_nic * pfvf ,
1312
+ struct cgx_stats_rsp * rsp )
1313
+ {
1314
+ int id ;
1315
+
1316
+ for (id = 0 ; id < CGX_RX_STATS_COUNT ; id ++ )
1317
+ pfvf -> hw .cgx_rx_stats [id ] = rsp -> rx_stats [id ];
1318
+ for (id = 0 ; id < CGX_TX_STATS_COUNT ; id ++ )
1319
+ pfvf -> hw .cgx_tx_stats [id ] = rsp -> tx_stats [id ];
1320
+ }
1321
+
1241
1322
void mbox_handler_nix_txsch_alloc (struct otx2_nic * pf ,
1242
1323
struct nix_txsch_alloc_rsp * rsp )
1243
1324
{
@@ -1250,7 +1331,6 @@ void mbox_handler_nix_txsch_alloc(struct otx2_nic *pf,
1250
1331
rsp -> schq_list [lvl ][schq ];
1251
1332
}
1252
1333
1253
- /* Mbox message handlers */
1254
1334
void mbox_handler_npa_lf_alloc (struct otx2_nic * pfvf ,
1255
1335
struct npa_lf_alloc_rsp * rsp )
1256
1336
{
0 commit comments