forked from freebsd/freebsd-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbxe_stats.c
2027 lines (1725 loc) · 72.5 KB
/
bxe_stats.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*-
* Copyright (c) 2007-2014 QLogic Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "bxe.h"
#include "bxe_stats.h"
#ifdef __i386__
#define BITS_PER_LONG 32
#else
#define BITS_PER_LONG 64
#endif
static inline long
bxe_hilo(uint32_t *hiref)
{
uint32_t lo = *(hiref + 1);
#if (BITS_PER_LONG == 64)
uint32_t hi = *hiref;
return (HILO_U64(hi, lo));
#else
return (lo);
#endif
}
static inline uint16_t
bxe_get_port_stats_dma_len(struct bxe_softc *sc)
{
uint16_t res = 0;
uint32_t size;
/* 'newest' convention - shmem2 contains the size of the port stats */
if (SHMEM2_HAS(sc, sizeof_port_stats)) {
size = SHMEM2_RD(sc, sizeof_port_stats);
if (size) {
res = size;
}
/* prevent newer BC from causing buffer overflow */
if (res > sizeof(struct host_port_stats)) {
res = sizeof(struct host_port_stats);
}
}
/*
* Older convention - all BCs support the port stats fields up until
* the 'not_used' field
*/
if (!res) {
res = (offsetof(struct host_port_stats, not_used) + 4);
/* if PFC stats are supported by the MFW, DMA them as well */
if (sc->devinfo.bc_ver >= REQ_BC_VER_4_PFC_STATS_SUPPORTED) {
res += (offsetof(struct host_port_stats, pfc_frames_rx_lo) -
offsetof(struct host_port_stats, pfc_frames_tx_hi) + 4);
}
}
res >>= 2;
DBASSERT(sc, !(res > 2 * DMAE_LEN32_RD_MAX), ("big stats dmae length\n"));
return (res);
}
/*
* Init service functions
*/
static void
bxe_dp_stats(struct bxe_softc *sc)
{
int i;
BLOGD(sc, DBG_STATS,
"dumping stats:\n"
" fw_stats_req\n"
" hdr\n"
" cmd_num %d\n"
" reserved0 %d\n"
" drv_stats_counter %d\n"
" reserved1 %d\n"
" stats_counters_addrs %x %x\n",
sc->fw_stats_req->hdr.cmd_num,
sc->fw_stats_req->hdr.reserved0,
sc->fw_stats_req->hdr.drv_stats_counter,
sc->fw_stats_req->hdr.reserved1,
sc->fw_stats_req->hdr.stats_counters_addrs.hi,
sc->fw_stats_req->hdr.stats_counters_addrs.lo);
for (i = 0; i < sc->fw_stats_req->hdr.cmd_num; i++) {
BLOGD(sc, DBG_STATS,
"query[%d]\n"
" kind %d\n"
" index %d\n"
" funcID %d\n"
" reserved %d\n"
" address %x %x\n",
i,
sc->fw_stats_req->query[i].kind,
sc->fw_stats_req->query[i].index,
sc->fw_stats_req->query[i].funcID,
sc->fw_stats_req->query[i].reserved,
sc->fw_stats_req->query[i].address.hi,
sc->fw_stats_req->query[i].address.lo);
}
}
/*
* Post the next statistics ramrod. Protect it with the lock in
* order to ensure the strict order between statistics ramrods
* (each ramrod has a sequence number passed in a
* sc->fw_stats_req->hdr.drv_stats_counter and ramrods must be
* sent in order).
*/
static void
bxe_storm_stats_post(struct bxe_softc *sc)
{
int rc;
if (!sc->stats_pending) {
BXE_STATS_LOCK(sc);
if (sc->stats_pending) {
BXE_STATS_UNLOCK(sc);
return;
}
sc->fw_stats_req->hdr.drv_stats_counter =
htole16(sc->stats_counter++);
BLOGD(sc, DBG_STATS,
"sending statistics ramrod %d\n",
le16toh(sc->fw_stats_req->hdr.drv_stats_counter));
/* adjust the ramrod to include VF queues statistics */
// XXX bxe_iov_adjust_stats_req(sc);
bxe_dp_stats(sc);
/* send FW stats ramrod */
rc = bxe_sp_post(sc, RAMROD_CMD_ID_COMMON_STAT_QUERY, 0,
U64_HI(sc->fw_stats_req_mapping),
U64_LO(sc->fw_stats_req_mapping),
NONE_CONNECTION_TYPE);
if (rc == 0) {
sc->stats_pending = 1;
}
BXE_STATS_UNLOCK(sc);
}
}
static void
bxe_hw_stats_post(struct bxe_softc *sc)
{
struct dmae_command *dmae = &sc->stats_dmae;
uint32_t *stats_comp = BXE_SP(sc, stats_comp);
int loader_idx;
uint32_t opcode;
*stats_comp = DMAE_COMP_VAL;
if (CHIP_REV_IS_SLOW(sc)) {
return;
}
/* Update MCP's statistics if possible */
if (sc->func_stx) {
memcpy(BXE_SP(sc, func_stats), &sc->func_stats,
sizeof(sc->func_stats));
}
/* loader */
if (sc->executer_idx) {
loader_idx = PMF_DMAE_C(sc);
opcode = bxe_dmae_opcode(sc, DMAE_SRC_PCI, DMAE_DST_GRC,
TRUE, DMAE_COMP_GRC);
opcode = bxe_dmae_opcode_clr_src_reset(opcode);
memset(dmae, 0, sizeof(struct dmae_command));
dmae->opcode = opcode;
dmae->src_addr_lo = U64_LO(BXE_SP_MAPPING(sc, dmae[0]));
dmae->src_addr_hi = U64_HI(BXE_SP_MAPPING(sc, dmae[0]));
dmae->dst_addr_lo = ((DMAE_REG_CMD_MEM +
sizeof(struct dmae_command) *
(loader_idx + 1)) >> 2);
dmae->dst_addr_hi = 0;
dmae->len = sizeof(struct dmae_command) >> 2;
if (CHIP_IS_E1(sc)) {
dmae->len--;
}
dmae->comp_addr_lo = (dmae_reg_go_c[loader_idx + 1] >> 2);
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
*stats_comp = 0;
bxe_post_dmae(sc, dmae, loader_idx);
} else if (sc->func_stx) {
*stats_comp = 0;
bxe_post_dmae(sc, dmae, INIT_DMAE_C(sc));
}
}
static int
bxe_stats_comp(struct bxe_softc *sc)
{
uint32_t *stats_comp = BXE_SP(sc, stats_comp);
int cnt = 10;
while (*stats_comp != DMAE_COMP_VAL) {
if (!cnt) {
BLOGE(sc, "Timeout waiting for stats finished\n");
break;
}
cnt--;
DELAY(1000);
}
return (1);
}
/*
* Statistics service functions
*/
static void
bxe_stats_pmf_update(struct bxe_softc *sc)
{
struct dmae_command *dmae;
uint32_t opcode;
int loader_idx = PMF_DMAE_C(sc);
uint32_t *stats_comp = BXE_SP(sc, stats_comp);
if (sc->devinfo.bc_ver <= 0x06001400) {
/*
* Bootcode v6.0.21 fixed a GRC timeout that occurs when accessing
* BRB registers while the BRB block is in reset. The DMA transfer
* below triggers this issue resulting in the DMAE to stop
* functioning. Skip this initial stats transfer for old bootcode
* versions <= 6.0.20.
*/
return;
}
/* sanity */
if (!sc->port.pmf || !sc->port.port_stx) {
BLOGE(sc, "BUG!\n");
return;
}
sc->executer_idx = 0;
opcode = bxe_dmae_opcode(sc, DMAE_SRC_GRC, DMAE_DST_PCI, FALSE, 0);
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = bxe_dmae_opcode_add_comp(opcode, DMAE_COMP_GRC);
dmae->src_addr_lo = (sc->port.port_stx >> 2);
dmae->src_addr_hi = 0;
dmae->dst_addr_lo = U64_LO(BXE_SP_MAPPING(sc, port_stats));
dmae->dst_addr_hi = U64_HI(BXE_SP_MAPPING(sc, port_stats));
dmae->len = DMAE_LEN32_RD_MAX;
dmae->comp_addr_lo = (dmae_reg_go_c[loader_idx] >> 2);
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = bxe_dmae_opcode_add_comp(opcode, DMAE_COMP_PCI);
dmae->src_addr_lo = ((sc->port.port_stx >> 2) + DMAE_LEN32_RD_MAX);
dmae->src_addr_hi = 0;
dmae->dst_addr_lo = U64_LO(BXE_SP_MAPPING(sc, port_stats) +
DMAE_LEN32_RD_MAX * 4);
dmae->dst_addr_hi = U64_HI(BXE_SP_MAPPING(sc, port_stats) +
DMAE_LEN32_RD_MAX * 4);
dmae->len = (bxe_get_port_stats_dma_len(sc) - DMAE_LEN32_RD_MAX);
dmae->comp_addr_lo = U64_LO(BXE_SP_MAPPING(sc, stats_comp));
dmae->comp_addr_hi = U64_HI(BXE_SP_MAPPING(sc, stats_comp));
dmae->comp_val = DMAE_COMP_VAL;
*stats_comp = 0;
bxe_hw_stats_post(sc);
bxe_stats_comp(sc);
}
static void
bxe_port_stats_init(struct bxe_softc *sc)
{
struct dmae_command *dmae;
int port = SC_PORT(sc);
uint32_t opcode;
int loader_idx = PMF_DMAE_C(sc);
uint32_t mac_addr;
uint32_t *stats_comp = BXE_SP(sc, stats_comp);
/* sanity */
if (!sc->link_vars.link_up || !sc->port.pmf) {
BLOGE(sc, "BUG!\n");
return;
}
sc->executer_idx = 0;
/* MCP */
opcode = bxe_dmae_opcode(sc, DMAE_SRC_PCI, DMAE_DST_GRC,
TRUE, DMAE_COMP_GRC);
if (sc->port.port_stx) {
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = opcode;
dmae->src_addr_lo = U64_LO(BXE_SP_MAPPING(sc, port_stats));
dmae->src_addr_hi = U64_HI(BXE_SP_MAPPING(sc, port_stats));
dmae->dst_addr_lo = sc->port.port_stx >> 2;
dmae->dst_addr_hi = 0;
dmae->len = bxe_get_port_stats_dma_len(sc);
dmae->comp_addr_lo = dmae_reg_go_c[loader_idx] >> 2;
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
}
if (sc->func_stx) {
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = opcode;
dmae->src_addr_lo = U64_LO(BXE_SP_MAPPING(sc, func_stats));
dmae->src_addr_hi = U64_HI(BXE_SP_MAPPING(sc, func_stats));
dmae->dst_addr_lo = (sc->func_stx >> 2);
dmae->dst_addr_hi = 0;
dmae->len = (sizeof(struct host_func_stats) >> 2);
dmae->comp_addr_lo = (dmae_reg_go_c[loader_idx] >> 2);
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
}
/* MAC */
opcode = bxe_dmae_opcode(sc, DMAE_SRC_GRC, DMAE_DST_PCI,
TRUE, DMAE_COMP_GRC);
/* EMAC is special */
if (sc->link_vars.mac_type == ELINK_MAC_TYPE_EMAC) {
mac_addr = (port ? GRCBASE_EMAC1 : GRCBASE_EMAC0);
/* EMAC_REG_EMAC_RX_STAT_AC (EMAC_REG_EMAC_RX_STAT_AC_COUNT)*/
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = opcode;
dmae->src_addr_lo = (mac_addr + EMAC_REG_EMAC_RX_STAT_AC) >> 2;
dmae->src_addr_hi = 0;
dmae->dst_addr_lo = U64_LO(BXE_SP_MAPPING(sc, mac_stats));
dmae->dst_addr_hi = U64_HI(BXE_SP_MAPPING(sc, mac_stats));
dmae->len = EMAC_REG_EMAC_RX_STAT_AC_COUNT;
dmae->comp_addr_lo = (dmae_reg_go_c[loader_idx] >> 2);
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
/* EMAC_REG_EMAC_RX_STAT_AC_28 */
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = opcode;
dmae->src_addr_lo = ((mac_addr + EMAC_REG_EMAC_RX_STAT_AC_28) >> 2);
dmae->src_addr_hi = 0;
dmae->dst_addr_lo = U64_LO(BXE_SP_MAPPING(sc, mac_stats) +
offsetof(struct emac_stats,
rx_stat_falsecarriererrors));
dmae->dst_addr_hi = U64_HI(BXE_SP_MAPPING(sc, mac_stats) +
offsetof(struct emac_stats,
rx_stat_falsecarriererrors));
dmae->len = 1;
dmae->comp_addr_lo = (dmae_reg_go_c[loader_idx] >> 2);
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
/* EMAC_REG_EMAC_TX_STAT_AC (EMAC_REG_EMAC_TX_STAT_AC_COUNT)*/
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = opcode;
dmae->src_addr_lo = ((mac_addr + EMAC_REG_EMAC_TX_STAT_AC) >> 2);
dmae->src_addr_hi = 0;
dmae->dst_addr_lo = U64_LO(BXE_SP_MAPPING(sc, mac_stats) +
offsetof(struct emac_stats,
tx_stat_ifhcoutoctets));
dmae->dst_addr_hi = U64_HI(BXE_SP_MAPPING(sc, mac_stats) +
offsetof(struct emac_stats,
tx_stat_ifhcoutoctets));
dmae->len = EMAC_REG_EMAC_TX_STAT_AC_COUNT;
dmae->comp_addr_lo = (dmae_reg_go_c[loader_idx] >> 2);
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
} else {
uint32_t tx_src_addr_lo, rx_src_addr_lo;
uint16_t rx_len, tx_len;
/* configure the params according to MAC type */
switch (sc->link_vars.mac_type) {
case ELINK_MAC_TYPE_BMAC:
mac_addr = (port) ? NIG_REG_INGRESS_BMAC1_MEM :
NIG_REG_INGRESS_BMAC0_MEM;
/* BIGMAC_REGISTER_TX_STAT_GTPKT ..
BIGMAC_REGISTER_TX_STAT_GTBYT */
if (CHIP_IS_E1x(sc)) {
tx_src_addr_lo =
((mac_addr + BIGMAC_REGISTER_TX_STAT_GTPKT) >> 2);
tx_len = ((8 + BIGMAC_REGISTER_TX_STAT_GTBYT -
BIGMAC_REGISTER_TX_STAT_GTPKT) >> 2);
rx_src_addr_lo =
((mac_addr + BIGMAC_REGISTER_RX_STAT_GR64) >> 2);
rx_len = ((8 + BIGMAC_REGISTER_RX_STAT_GRIPJ -
BIGMAC_REGISTER_RX_STAT_GR64) >> 2);
} else {
tx_src_addr_lo =
((mac_addr + BIGMAC2_REGISTER_TX_STAT_GTPOK) >> 2);
tx_len = ((8 + BIGMAC2_REGISTER_TX_STAT_GTBYT -
BIGMAC2_REGISTER_TX_STAT_GTPOK) >> 2);
rx_src_addr_lo =
((mac_addr + BIGMAC2_REGISTER_RX_STAT_GR64) >> 2);
rx_len = ((8 + BIGMAC2_REGISTER_RX_STAT_GRIPJ -
BIGMAC2_REGISTER_RX_STAT_GR64) >> 2);
}
break;
case ELINK_MAC_TYPE_UMAC: /* handled by MSTAT */
case ELINK_MAC_TYPE_XMAC: /* handled by MSTAT */
default:
mac_addr = (port) ? GRCBASE_MSTAT1 : GRCBASE_MSTAT0;
tx_src_addr_lo = ((mac_addr + MSTAT_REG_TX_STAT_GTXPOK_LO) >> 2);
rx_src_addr_lo = ((mac_addr + MSTAT_REG_RX_STAT_GR64_LO) >> 2);
tx_len =
(sizeof(sc->sp->mac_stats.mstat_stats.stats_tx) >> 2);
rx_len =
(sizeof(sc->sp->mac_stats.mstat_stats.stats_rx) >> 2);
break;
}
/* TX stats */
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = opcode;
dmae->src_addr_lo = tx_src_addr_lo;
dmae->src_addr_hi = 0;
dmae->len = tx_len;
dmae->dst_addr_lo = U64_LO(BXE_SP_MAPPING(sc, mac_stats));
dmae->dst_addr_hi = U64_HI(BXE_SP_MAPPING(sc, mac_stats));
dmae->comp_addr_lo = dmae_reg_go_c[loader_idx] >> 2;
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
/* RX stats */
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = opcode;
dmae->src_addr_hi = 0;
dmae->src_addr_lo = rx_src_addr_lo;
dmae->dst_addr_lo =
U64_LO(BXE_SP_MAPPING(sc, mac_stats) + (tx_len << 2));
dmae->dst_addr_hi =
U64_HI(BXE_SP_MAPPING(sc, mac_stats) + (tx_len << 2));
dmae->len = rx_len;
dmae->comp_addr_lo = dmae_reg_go_c[loader_idx] >> 2;
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
}
/* NIG */
if (!CHIP_IS_E3(sc)) {
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = opcode;
dmae->src_addr_lo =
(port ? NIG_REG_STAT1_EGRESS_MAC_PKT0 :
NIG_REG_STAT0_EGRESS_MAC_PKT0) >> 2;
dmae->src_addr_hi = 0;
dmae->dst_addr_lo = U64_LO(BXE_SP_MAPPING(sc, nig_stats) +
offsetof(struct nig_stats,
egress_mac_pkt0_lo));
dmae->dst_addr_hi = U64_HI(BXE_SP_MAPPING(sc, nig_stats) +
offsetof(struct nig_stats,
egress_mac_pkt0_lo));
dmae->len = ((2 * sizeof(uint32_t)) >> 2);
dmae->comp_addr_lo = (dmae_reg_go_c[loader_idx] >> 2);
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = opcode;
dmae->src_addr_lo =
(port ? NIG_REG_STAT1_EGRESS_MAC_PKT1 :
NIG_REG_STAT0_EGRESS_MAC_PKT1) >> 2;
dmae->src_addr_hi = 0;
dmae->dst_addr_lo = U64_LO(BXE_SP_MAPPING(sc, nig_stats) +
offsetof(struct nig_stats,
egress_mac_pkt1_lo));
dmae->dst_addr_hi = U64_HI(BXE_SP_MAPPING(sc, nig_stats) +
offsetof(struct nig_stats,
egress_mac_pkt1_lo));
dmae->len = ((2 * sizeof(uint32_t)) >> 2);
dmae->comp_addr_lo = (dmae_reg_go_c[loader_idx] >> 2);
dmae->comp_addr_hi = 0;
dmae->comp_val = 1;
}
dmae = BXE_SP(sc, dmae[sc->executer_idx++]);
dmae->opcode = bxe_dmae_opcode(sc, DMAE_SRC_GRC, DMAE_DST_PCI,
TRUE, DMAE_COMP_PCI);
dmae->src_addr_lo =
(port ? NIG_REG_STAT1_BRB_DISCARD :
NIG_REG_STAT0_BRB_DISCARD) >> 2;
dmae->src_addr_hi = 0;
dmae->dst_addr_lo = U64_LO(BXE_SP_MAPPING(sc, nig_stats));
dmae->dst_addr_hi = U64_HI(BXE_SP_MAPPING(sc, nig_stats));
dmae->len = (sizeof(struct nig_stats) - 4*sizeof(uint32_t)) >> 2;
dmae->comp_addr_lo = U64_LO(BXE_SP_MAPPING(sc, stats_comp));
dmae->comp_addr_hi = U64_HI(BXE_SP_MAPPING(sc, stats_comp));
dmae->comp_val = DMAE_COMP_VAL;
*stats_comp = 0;
}
static void
bxe_func_stats_init(struct bxe_softc *sc)
{
struct dmae_command *dmae = &sc->stats_dmae;
uint32_t *stats_comp = BXE_SP(sc, stats_comp);
/* sanity */
if (!sc->func_stx) {
BLOGE(sc, "BUG!\n");
return;
}
sc->executer_idx = 0;
memset(dmae, 0, sizeof(struct dmae_command));
dmae->opcode = bxe_dmae_opcode(sc, DMAE_SRC_PCI, DMAE_DST_GRC,
TRUE, DMAE_COMP_PCI);
dmae->src_addr_lo = U64_LO(BXE_SP_MAPPING(sc, func_stats));
dmae->src_addr_hi = U64_HI(BXE_SP_MAPPING(sc, func_stats));
dmae->dst_addr_lo = (sc->func_stx >> 2);
dmae->dst_addr_hi = 0;
dmae->len = (sizeof(struct host_func_stats) >> 2);
dmae->comp_addr_lo = U64_LO(BXE_SP_MAPPING(sc, stats_comp));
dmae->comp_addr_hi = U64_HI(BXE_SP_MAPPING(sc, stats_comp));
dmae->comp_val = DMAE_COMP_VAL;
*stats_comp = 0;
}
static void
bxe_stats_start(struct bxe_softc *sc)
{
/*
* VFs travel through here as part of the statistics FSM, but no action
* is required
*/
if (IS_VF(sc)) {
return;
}
if (sc->port.pmf) {
bxe_port_stats_init(sc);
}
else if (sc->func_stx) {
bxe_func_stats_init(sc);
}
bxe_hw_stats_post(sc);
bxe_storm_stats_post(sc);
}
static void
bxe_stats_pmf_start(struct bxe_softc *sc)
{
bxe_stats_comp(sc);
bxe_stats_pmf_update(sc);
bxe_stats_start(sc);
}
static void
bxe_stats_restart(struct bxe_softc *sc)
{
/*
* VFs travel through here as part of the statistics FSM, but no action
* is required
*/
if (IS_VF(sc)) {
return;
}
bxe_stats_comp(sc);
bxe_stats_start(sc);
}
static void
bxe_bmac_stats_update(struct bxe_softc *sc)
{
struct host_port_stats *pstats = BXE_SP(sc, port_stats);
struct bxe_eth_stats *estats = &sc->eth_stats;
struct {
uint32_t lo;
uint32_t hi;
} diff;
if (CHIP_IS_E1x(sc)) {
struct bmac1_stats *new = BXE_SP(sc, mac_stats.bmac1_stats);
/* the macros below will use "bmac1_stats" type */
UPDATE_STAT64(rx_stat_grerb, rx_stat_ifhcinbadoctets);
UPDATE_STAT64(rx_stat_grfcs, rx_stat_dot3statsfcserrors);
UPDATE_STAT64(rx_stat_grund, rx_stat_etherstatsundersizepkts);
UPDATE_STAT64(rx_stat_grovr, rx_stat_dot3statsframestoolong);
UPDATE_STAT64(rx_stat_grfrg, rx_stat_etherstatsfragments);
UPDATE_STAT64(rx_stat_grjbr, rx_stat_etherstatsjabbers);
UPDATE_STAT64(rx_stat_grxcf, rx_stat_maccontrolframesreceived);
UPDATE_STAT64(rx_stat_grxpf, rx_stat_xoffstateentered);
UPDATE_STAT64(rx_stat_grxpf, rx_stat_mac_xpf);
UPDATE_STAT64(tx_stat_gtxpf, tx_stat_outxoffsent);
UPDATE_STAT64(tx_stat_gtxpf, tx_stat_flowcontroldone);
UPDATE_STAT64(tx_stat_gt64, tx_stat_etherstatspkts64octets);
UPDATE_STAT64(tx_stat_gt127,
tx_stat_etherstatspkts65octetsto127octets);
UPDATE_STAT64(tx_stat_gt255,
tx_stat_etherstatspkts128octetsto255octets);
UPDATE_STAT64(tx_stat_gt511,
tx_stat_etherstatspkts256octetsto511octets);
UPDATE_STAT64(tx_stat_gt1023,
tx_stat_etherstatspkts512octetsto1023octets);
UPDATE_STAT64(tx_stat_gt1518,
tx_stat_etherstatspkts1024octetsto1522octets);
UPDATE_STAT64(tx_stat_gt2047, tx_stat_mac_2047);
UPDATE_STAT64(tx_stat_gt4095, tx_stat_mac_4095);
UPDATE_STAT64(tx_stat_gt9216, tx_stat_mac_9216);
UPDATE_STAT64(tx_stat_gt16383, tx_stat_mac_16383);
UPDATE_STAT64(tx_stat_gterr,
tx_stat_dot3statsinternalmactransmiterrors);
UPDATE_STAT64(tx_stat_gtufl, tx_stat_mac_ufl);
} else {
struct bmac2_stats *new = BXE_SP(sc, mac_stats.bmac2_stats);
struct bxe_fw_port_stats_old *fwstats = &sc->fw_stats_old;
/* the macros below will use "bmac2_stats" type */
UPDATE_STAT64(rx_stat_grerb, rx_stat_ifhcinbadoctets);
UPDATE_STAT64(rx_stat_grfcs, rx_stat_dot3statsfcserrors);
UPDATE_STAT64(rx_stat_grund, rx_stat_etherstatsundersizepkts);
UPDATE_STAT64(rx_stat_grovr, rx_stat_dot3statsframestoolong);
UPDATE_STAT64(rx_stat_grfrg, rx_stat_etherstatsfragments);
UPDATE_STAT64(rx_stat_grjbr, rx_stat_etherstatsjabbers);
UPDATE_STAT64(rx_stat_grxcf, rx_stat_maccontrolframesreceived);
UPDATE_STAT64(rx_stat_grxpf, rx_stat_xoffstateentered);
UPDATE_STAT64(rx_stat_grxpf, rx_stat_mac_xpf);
UPDATE_STAT64(tx_stat_gtxpf, tx_stat_outxoffsent);
UPDATE_STAT64(tx_stat_gtxpf, tx_stat_flowcontroldone);
UPDATE_STAT64(tx_stat_gt64, tx_stat_etherstatspkts64octets);
UPDATE_STAT64(tx_stat_gt127,
tx_stat_etherstatspkts65octetsto127octets);
UPDATE_STAT64(tx_stat_gt255,
tx_stat_etherstatspkts128octetsto255octets);
UPDATE_STAT64(tx_stat_gt511,
tx_stat_etherstatspkts256octetsto511octets);
UPDATE_STAT64(tx_stat_gt1023,
tx_stat_etherstatspkts512octetsto1023octets);
UPDATE_STAT64(tx_stat_gt1518,
tx_stat_etherstatspkts1024octetsto1522octets);
UPDATE_STAT64(tx_stat_gt2047, tx_stat_mac_2047);
UPDATE_STAT64(tx_stat_gt4095, tx_stat_mac_4095);
UPDATE_STAT64(tx_stat_gt9216, tx_stat_mac_9216);
UPDATE_STAT64(tx_stat_gt16383, tx_stat_mac_16383);
UPDATE_STAT64(tx_stat_gterr,
tx_stat_dot3statsinternalmactransmiterrors);
UPDATE_STAT64(tx_stat_gtufl, tx_stat_mac_ufl);
/* collect PFC stats */
pstats->pfc_frames_tx_hi = new->tx_stat_gtpp_hi;
pstats->pfc_frames_tx_lo = new->tx_stat_gtpp_lo;
ADD_64(pstats->pfc_frames_tx_hi, fwstats->pfc_frames_tx_hi,
pstats->pfc_frames_tx_lo, fwstats->pfc_frames_tx_lo);
pstats->pfc_frames_rx_hi = new->rx_stat_grpp_hi;
pstats->pfc_frames_rx_lo = new->rx_stat_grpp_lo;
ADD_64(pstats->pfc_frames_rx_hi, fwstats->pfc_frames_rx_hi,
pstats->pfc_frames_rx_lo, fwstats->pfc_frames_rx_lo);
}
estats->pause_frames_received_hi = pstats->mac_stx[1].rx_stat_mac_xpf_hi;
estats->pause_frames_received_lo = pstats->mac_stx[1].rx_stat_mac_xpf_lo;
estats->pause_frames_sent_hi = pstats->mac_stx[1].tx_stat_outxoffsent_hi;
estats->pause_frames_sent_lo = pstats->mac_stx[1].tx_stat_outxoffsent_lo;
estats->pfc_frames_received_hi = pstats->pfc_frames_rx_hi;
estats->pfc_frames_received_lo = pstats->pfc_frames_rx_lo;
estats->pfc_frames_sent_hi = pstats->pfc_frames_tx_hi;
estats->pfc_frames_sent_lo = pstats->pfc_frames_tx_lo;
}
static void
bxe_mstat_stats_update(struct bxe_softc *sc)
{
struct host_port_stats *pstats = BXE_SP(sc, port_stats);
struct bxe_eth_stats *estats = &sc->eth_stats;
struct mstat_stats *new = BXE_SP(sc, mac_stats.mstat_stats);
ADD_STAT64(stats_rx.rx_grerb, rx_stat_ifhcinbadoctets);
ADD_STAT64(stats_rx.rx_grfcs, rx_stat_dot3statsfcserrors);
ADD_STAT64(stats_rx.rx_grund, rx_stat_etherstatsundersizepkts);
ADD_STAT64(stats_rx.rx_grovr, rx_stat_dot3statsframestoolong);
ADD_STAT64(stats_rx.rx_grfrg, rx_stat_etherstatsfragments);
ADD_STAT64(stats_rx.rx_grxcf, rx_stat_maccontrolframesreceived);
ADD_STAT64(stats_rx.rx_grxpf, rx_stat_xoffstateentered);
ADD_STAT64(stats_rx.rx_grxpf, rx_stat_mac_xpf);
ADD_STAT64(stats_tx.tx_gtxpf, tx_stat_outxoffsent);
ADD_STAT64(stats_tx.tx_gtxpf, tx_stat_flowcontroldone);
/* collect pfc stats */
ADD_64(pstats->pfc_frames_tx_hi, new->stats_tx.tx_gtxpp_hi,
pstats->pfc_frames_tx_lo, new->stats_tx.tx_gtxpp_lo);
ADD_64(pstats->pfc_frames_rx_hi, new->stats_rx.rx_grxpp_hi,
pstats->pfc_frames_rx_lo, new->stats_rx.rx_grxpp_lo);
ADD_STAT64(stats_tx.tx_gt64, tx_stat_etherstatspkts64octets);
ADD_STAT64(stats_tx.tx_gt127, tx_stat_etherstatspkts65octetsto127octets);
ADD_STAT64(stats_tx.tx_gt255, tx_stat_etherstatspkts128octetsto255octets);
ADD_STAT64(stats_tx.tx_gt511, tx_stat_etherstatspkts256octetsto511octets);
ADD_STAT64(stats_tx.tx_gt1023,
tx_stat_etherstatspkts512octetsto1023octets);
ADD_STAT64(stats_tx.tx_gt1518,
tx_stat_etherstatspkts1024octetsto1522octets);
ADD_STAT64(stats_tx.tx_gt2047, tx_stat_mac_2047);
ADD_STAT64(stats_tx.tx_gt4095, tx_stat_mac_4095);
ADD_STAT64(stats_tx.tx_gt9216, tx_stat_mac_9216);
ADD_STAT64(stats_tx.tx_gt16383, tx_stat_mac_16383);
ADD_STAT64(stats_tx.tx_gterr, tx_stat_dot3statsinternalmactransmiterrors);
ADD_STAT64(stats_tx.tx_gtufl, tx_stat_mac_ufl);
estats->etherstatspkts1024octetsto1522octets_hi =
pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_hi;
estats->etherstatspkts1024octetsto1522octets_lo =
pstats->mac_stx[1].tx_stat_etherstatspkts1024octetsto1522octets_lo;
estats->etherstatspktsover1522octets_hi =
pstats->mac_stx[1].tx_stat_mac_2047_hi;
estats->etherstatspktsover1522octets_lo =
pstats->mac_stx[1].tx_stat_mac_2047_lo;
ADD_64(estats->etherstatspktsover1522octets_hi,
pstats->mac_stx[1].tx_stat_mac_4095_hi,
estats->etherstatspktsover1522octets_lo,
pstats->mac_stx[1].tx_stat_mac_4095_lo);
ADD_64(estats->etherstatspktsover1522octets_hi,
pstats->mac_stx[1].tx_stat_mac_9216_hi,
estats->etherstatspktsover1522octets_lo,
pstats->mac_stx[1].tx_stat_mac_9216_lo);
ADD_64(estats->etherstatspktsover1522octets_hi,
pstats->mac_stx[1].tx_stat_mac_16383_hi,
estats->etherstatspktsover1522octets_lo,
pstats->mac_stx[1].tx_stat_mac_16383_lo);
estats->pause_frames_received_hi = pstats->mac_stx[1].rx_stat_mac_xpf_hi;
estats->pause_frames_received_lo = pstats->mac_stx[1].rx_stat_mac_xpf_lo;
estats->pause_frames_sent_hi = pstats->mac_stx[1].tx_stat_outxoffsent_hi;
estats->pause_frames_sent_lo = pstats->mac_stx[1].tx_stat_outxoffsent_lo;
estats->pfc_frames_received_hi = pstats->pfc_frames_rx_hi;
estats->pfc_frames_received_lo = pstats->pfc_frames_rx_lo;
estats->pfc_frames_sent_hi = pstats->pfc_frames_tx_hi;
estats->pfc_frames_sent_lo = pstats->pfc_frames_tx_lo;
}
static void
bxe_emac_stats_update(struct bxe_softc *sc)
{
struct emac_stats *new = BXE_SP(sc, mac_stats.emac_stats);
struct host_port_stats *pstats = BXE_SP(sc, port_stats);
struct bxe_eth_stats *estats = &sc->eth_stats;
UPDATE_EXTEND_STAT(rx_stat_ifhcinbadoctets);
UPDATE_EXTEND_STAT(tx_stat_ifhcoutbadoctets);
UPDATE_EXTEND_STAT(rx_stat_dot3statsfcserrors);
UPDATE_EXTEND_STAT(rx_stat_dot3statsalignmenterrors);
UPDATE_EXTEND_STAT(rx_stat_dot3statscarriersenseerrors);
UPDATE_EXTEND_STAT(rx_stat_falsecarriererrors);
UPDATE_EXTEND_STAT(rx_stat_etherstatsundersizepkts);
UPDATE_EXTEND_STAT(rx_stat_dot3statsframestoolong);
UPDATE_EXTEND_STAT(rx_stat_etherstatsfragments);
UPDATE_EXTEND_STAT(rx_stat_etherstatsjabbers);
UPDATE_EXTEND_STAT(rx_stat_maccontrolframesreceived);
UPDATE_EXTEND_STAT(rx_stat_xoffstateentered);
UPDATE_EXTEND_STAT(rx_stat_xonpauseframesreceived);
UPDATE_EXTEND_STAT(rx_stat_xoffpauseframesreceived);
UPDATE_EXTEND_STAT(tx_stat_outxonsent);
UPDATE_EXTEND_STAT(tx_stat_outxoffsent);
UPDATE_EXTEND_STAT(tx_stat_flowcontroldone);
UPDATE_EXTEND_STAT(tx_stat_etherstatscollisions);
UPDATE_EXTEND_STAT(tx_stat_dot3statssinglecollisionframes);
UPDATE_EXTEND_STAT(tx_stat_dot3statsmultiplecollisionframes);
UPDATE_EXTEND_STAT(tx_stat_dot3statsdeferredtransmissions);
UPDATE_EXTEND_STAT(tx_stat_dot3statsexcessivecollisions);
UPDATE_EXTEND_STAT(tx_stat_dot3statslatecollisions);
UPDATE_EXTEND_STAT(tx_stat_etherstatspkts64octets);
UPDATE_EXTEND_STAT(tx_stat_etherstatspkts65octetsto127octets);
UPDATE_EXTEND_STAT(tx_stat_etherstatspkts128octetsto255octets);
UPDATE_EXTEND_STAT(tx_stat_etherstatspkts256octetsto511octets);
UPDATE_EXTEND_STAT(tx_stat_etherstatspkts512octetsto1023octets);
UPDATE_EXTEND_STAT(tx_stat_etherstatspkts1024octetsto1522octets);
UPDATE_EXTEND_STAT(tx_stat_etherstatspktsover1522octets);
UPDATE_EXTEND_STAT(tx_stat_dot3statsinternalmactransmiterrors);
estats->pause_frames_received_hi =
pstats->mac_stx[1].rx_stat_xonpauseframesreceived_hi;
estats->pause_frames_received_lo =
pstats->mac_stx[1].rx_stat_xonpauseframesreceived_lo;
ADD_64(estats->pause_frames_received_hi,
pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_hi,
estats->pause_frames_received_lo,
pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_lo);
estats->pause_frames_sent_hi =
pstats->mac_stx[1].tx_stat_outxonsent_hi;
estats->pause_frames_sent_lo =
pstats->mac_stx[1].tx_stat_outxonsent_lo;
ADD_64(estats->pause_frames_sent_hi,
pstats->mac_stx[1].tx_stat_outxoffsent_hi,
estats->pause_frames_sent_lo,
pstats->mac_stx[1].tx_stat_outxoffsent_lo);
}
static int
bxe_hw_stats_update(struct bxe_softc *sc)
{
struct nig_stats *new = BXE_SP(sc, nig_stats);
struct nig_stats *old = &(sc->port.old_nig_stats);
struct host_port_stats *pstats = BXE_SP(sc, port_stats);
struct bxe_eth_stats *estats = &sc->eth_stats;
uint32_t lpi_reg, nig_timer_max;
struct {
uint32_t lo;
uint32_t hi;
} diff;
switch (sc->link_vars.mac_type) {
case ELINK_MAC_TYPE_BMAC:
bxe_bmac_stats_update(sc);
break;
case ELINK_MAC_TYPE_EMAC:
bxe_emac_stats_update(sc);
break;
case ELINK_MAC_TYPE_UMAC:
case ELINK_MAC_TYPE_XMAC:
bxe_mstat_stats_update(sc);
break;
case ELINK_MAC_TYPE_NONE: /* unreached */
BLOGD(sc, DBG_STATS,
"stats updated by DMAE but no MAC active\n");
return (-1);
default: /* unreached */
BLOGE(sc, "stats update failed, unknown MAC type\n");
}
ADD_EXTEND_64(pstats->brb_drop_hi, pstats->brb_drop_lo,
new->brb_discard - old->brb_discard);
ADD_EXTEND_64(estats->brb_truncate_hi, estats->brb_truncate_lo,
new->brb_truncate - old->brb_truncate);
if (!CHIP_IS_E3(sc)) {
UPDATE_STAT64_NIG(egress_mac_pkt0,
etherstatspkts1024octetsto1522octets);
UPDATE_STAT64_NIG(egress_mac_pkt1,
etherstatspktsover1522octets);
}
memcpy(old, new, sizeof(struct nig_stats));
memcpy(&(estats->rx_stat_ifhcinbadoctets_hi), &(pstats->mac_stx[1]),
sizeof(struct mac_stx));
estats->brb_drop_hi = pstats->brb_drop_hi;
estats->brb_drop_lo = pstats->brb_drop_lo;
pstats->host_port_stats_counter++;
if (CHIP_IS_E3(sc)) {
lpi_reg = (SC_PORT(sc)) ?
MISC_REG_CPMU_LP_SM_ENT_CNT_P1 :
MISC_REG_CPMU_LP_SM_ENT_CNT_P0;
estats->eee_tx_lpi += REG_RD(sc, lpi_reg);
}
if (!BXE_NOMCP(sc)) {
nig_timer_max = SHMEM_RD(sc, port_mb[SC_PORT(sc)].stat_nig_timer);
if (nig_timer_max != estats->nig_timer_max) {
estats->nig_timer_max = nig_timer_max;
BLOGE(sc, "invalid NIG timer max (%u)\n",
estats->nig_timer_max);
}
}
return (0);
}
static int
bxe_storm_stats_validate_counters(struct bxe_softc *sc)
{
struct stats_counter *counters = &sc->fw_stats_data->storm_counters;
uint16_t cur_stats_counter;
/*
* Make sure we use the value of the counter
* used for sending the last stats ramrod.
*/
BXE_STATS_LOCK(sc);
cur_stats_counter = (sc->stats_counter - 1);
BXE_STATS_UNLOCK(sc);
/* are storm stats valid? */
if (le16toh(counters->xstats_counter) != cur_stats_counter) {
BLOGD(sc, DBG_STATS,
"stats not updated by xstorm, "
"counter 0x%x != stats_counter 0x%x\n",
le16toh(counters->xstats_counter), sc->stats_counter);
return (-EAGAIN);
}
if (le16toh(counters->ustats_counter) != cur_stats_counter) {
BLOGD(sc, DBG_STATS,
"stats not updated by ustorm, "
"counter 0x%x != stats_counter 0x%x\n",
le16toh(counters->ustats_counter), sc->stats_counter);
return (-EAGAIN);
}
if (le16toh(counters->cstats_counter) != cur_stats_counter) {
BLOGD(sc, DBG_STATS,
"stats not updated by cstorm, "
"counter 0x%x != stats_counter 0x%x\n",
le16toh(counters->cstats_counter), sc->stats_counter);
return (-EAGAIN);
}
if (le16toh(counters->tstats_counter) != cur_stats_counter) {
BLOGD(sc, DBG_STATS,
"stats not updated by tstorm, "
"counter 0x%x != stats_counter 0x%x\n",
le16toh(counters->tstats_counter), sc->stats_counter);
return (-EAGAIN);
}
return (0);
}
static int
bxe_storm_stats_update(struct bxe_softc *sc)
{
struct tstorm_per_port_stats *tport =
&sc->fw_stats_data->port.tstorm_port_statistics;
struct tstorm_per_pf_stats *tfunc =
&sc->fw_stats_data->pf.tstorm_pf_statistics;
struct host_func_stats *fstats = &sc->func_stats;
struct bxe_eth_stats *estats = &sc->eth_stats;
struct bxe_eth_stats_old *estats_old = &sc->eth_stats_old;
int i;
/* vfs stat counter is managed by pf */
if (IS_PF(sc) && bxe_storm_stats_validate_counters(sc)) {
return (-EAGAIN);
}
estats->error_bytes_received_hi = 0;
estats->error_bytes_received_lo = 0;
for (i = 0; i < sc->num_queues; i++) {
struct bxe_fastpath *fp = &sc->fp[i];
struct tstorm_per_queue_stats *tclient =