/
7036-vrx518-ppe-tc.patch
17841 lines (17840 loc) · 517 KB
/
7036-vrx518-ppe-tc.patch
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
# HG changeset patch
# Parent 0308a003084c31bc3134aad8b33443c72ad9e439
diff --git a/drivers/net/ethernet/intel/vrx518/tc/Kconfig b/drivers/net/ethernet/intel/vrx518/tc/Kconfig
new file mode 100644
--- /dev/null
+++ b/drivers/net/ethernet/intel/vrx518/tc/Kconfig
@@ -0,0 +1,36 @@
+#
+# Intel VRX518 TC driver configuration
+#
+choice
+ prompt "SoC Platform Selection"
+ depends on VRX518_TC
+ default VRX518_GRX500
+
+ config VRX518_GRX500
+ depends on SOC_GRX500_A21
+ bool "GRX500"
+ ---help---
+ This selection works on intel GRX5XX SoC platform
+ It requests datapath library, DMA driver, CBM driver and
+ UMT driver support.
+ It works without DC_DP function.
+
+ config VRX518_DC_DP
+ depends on LTQ_DIRECTCONNECT_DP
+ bool "DC_DP"
+ ---help---
+ This selection works on any platform which has DC_DP lib.
+ It should be able to work on any one of below mode:
+ 1. fast path
+ 2. directpath
+ 3. CPU path
+
+ config VRX518_CPU
+ bool "CPU path"
+ ---help---
+ This selection works on any platform.
+ It has no dependency on any other library/function except linux kernel.
+
+ It still requires Intel MEI driver to make VRX518 DSL working.
+
+endchoice
diff --git a/drivers/net/ethernet/intel/vrx518/tc/Makefile b/drivers/net/ethernet/intel/vrx518/tc/Makefile
new file mode 100644
--- /dev/null
+++ b/drivers/net/ethernet/intel/vrx518/tc/Makefile
@@ -0,0 +1,32 @@
+################################################################################
+#
+# Intel SmartPHY DSL PCIe TC driver
+# Copyright(c) 2016 Intel Corporation.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms and conditions of the GNU General Public License,
+# version 2, as published by the Free Software Foundation.
+#
+# This program is distributed in the hope it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# The full GNU General Public License is included in this distribution in
+# the file called "COPYING".
+#
+################################################################################
+
+#
+# Makefile for the Intel(R) SmartPHY TC driver
+#
+
+obj-$(CONFIG_VRX518_TC) += vrx518_tc.o
+vrx518_tc-objs := ptm_tc.o atm_tc.o tc_api.o tc_proc.o tc_main.o
+ifneq ($(CONFIG_VRX518_GRX500),)
+ vrx518_tc-objs += platform/grx500_plat.o
+endif
diff --git a/drivers/net/ethernet/intel/vrx518/tc/atm_tc.c b/drivers/net/ethernet/intel/vrx518/tc/atm_tc.c
new file mode 100644
--- /dev/null
+++ b/drivers/net/ethernet/intel/vrx518/tc/atm_tc.c
@@ -0,0 +1,3610 @@
+/*******************************************************************************
+
+ Intel SmartPHY DSL PCIe TC driver
+ Copyright(c) 2016 Intel Corporation.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms and conditions of the GNU General Public License,
+ version 2, as published by the Free Software Foundation.
+
+ This program is distributed in the hope it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+ The full GNU General Public License is included in this distribution in
+ the file called "COPYING".
+
+*******************************************************************************/
+
+/* Supported functions */
+#define DEBUG
+#define pr_fmt(fmt) KBUILD_MODNAME ":%s : " fmt, __func__
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/atomic.h>
+#include <linux/uaccess.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/errno.h>
+#include <linux/proc_fs.h>
+#include <linux/interrupt.h>
+#include <linux/dma-mapping.h>
+#include <linux/wait.h>
+#include <linux/seq_file.h>
+#include <linux/printk.h>
+#include <linux/etherdevice.h>
+#include <linux/atmdev.h>
+#include <linux/atmioc.h>
+#include <linux/skbuff.h>
+#include <net/dsl_tc.h>
+#include <net/datapath_proc_api.h>
+#include <linux/atm.h>
+#include <net/datapath_api.h>
+#include "inc/tc_main.h"
+#include "inc/reg_addr.h"
+#include "inc/tc_common.h"
+#include "inc/tc_api.h"
+#include "inc/reg_addr.h"
+#include "inc/atm_tc.h"
+#include "inc/tc_proc.h"
+#include "inc/fw/unified_qos_ds_base_vrx518_be.h"
+#include "inc/fw/vrx518_a1plus_addr_def.h"
+#include "inc/fw/vrx518_ds_be.h"
+#include "inc/fw/vrx518_ppe_fw.h"
+#include "inc/platform.h"
+#include <net/dc_ep.h>
+
+static void do_oam_tasklet(unsigned long);
+static DECLARE_TASKLET(g_oam_tasklet, do_oam_tasklet, 0);
+static struct atm_priv *g_atm_tc;
+static const char *g_atm_dev_name = "atm-device-0";
+/* tracking the number of ATM devices */
+#define CGU_BASE 0x3000
+#define CGU_CLKFSR (CGU_BASE + 0x10)
+#define MAX_DATA_LEN (DMA_PACKET_SZ - 32)
+
+
+static inline unsigned int pvc_num(void)
+{
+ return ATM_PVC_NUMBER;
+}
+
+/*Note: FW RXQ number is 16, TXQ number is 15 */
+static inline unsigned int txq_num(void)
+{
+ return ATM_PRIO_Q_NUM;
+}
+
+/* QSB in VRX518 is fixed as System CLK */
+static u32 get_qsb_clk(struct atm_priv *priv)
+{
+ u32 fpi_dvsn;
+ u32 sys_clk, ppe_clk;
+
+ fpi_dvsn = (tc_r32(CGU_CLKFSR) >> 28) & 0x03;
+ priv->ep->hw_ops->clk_get(priv->ep, &sys_clk, &ppe_clk);
+ sys_clk = sys_clk >> fpi_dvsn;
+
+ return sys_clk;
+}
+
+static void set_qsb_clk(struct atm_priv *priv, u32 div)
+{
+ u32 clk_val;
+ u32 divisor = 0;
+
+ if (div > 8) {
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "QSB CLK divisor invailid: %d\n", div);
+ return;
+ }
+
+ clk_val = tc_r32(CGU_CLKFSR);
+ for (; div > 1; div >>= 1)
+ divisor += 1;
+
+ clk_val |= divisor << 28;
+ tc_w32(clk_val, CGU_CLKFSR);
+}
+
+static void atm_free_tx_skb_vcc(struct sk_buff *skb)
+{
+ struct atm_vcc *vcc;
+
+ vcc = ATM_SKB(skb)->vcc;
+
+ if (vcc != NULL && vcc->pop != NULL)
+ vcc->pop(vcc, skb);
+ else
+ dev_kfree_skb_any(skb);
+}
+
+/* Description:
+ * Enable/Disable HTU entries to capture OAM cell.
+ * Input:
+ * none
+ * Output:
+ * none
+ */
+static void validate_oam_htu_entry(struct atm_priv *priv, int en)
+{
+ struct htu_entry entry;
+ int i;
+
+ for (i = OAM_F4_SEG_HTU_ENTRY; i <= OAM_F5_HTU_ENTRY; i++) {
+ tc_mem_read(priv, &entry, fpi_addr(HTU_ENTRY_TBL(i)),
+ sizeof(entry));
+ entry.vld = en;
+ tc_mem_write(priv, fpi_addr(HTU_ENTRY_TBL(i)), &entry,
+ sizeof(entry));
+ }
+ /* idle for a while to finish running HTU search */
+ udelay(10);
+}
+
+/* Description:
+ * Remove one entry from HTU table.
+ * Input:
+ * conn --- unsigned int, connection ID
+ * Output:
+ * none
+ */
+static void clear_htu_entry(struct atm_priv *priv, unsigned int conn)
+{
+ struct htu_entry entry;
+
+ tc_mem_read(priv, &entry,
+ fpi_addr(HTU_ENTRY_TBL(conn + OAM_HTU_ENTRY_NUMBER)),
+ sizeof(entry));
+ entry.vld = 0;
+ tc_mem_write(priv, fpi_addr(HTU_ENTRY_TBL(conn + OAM_HTU_ENTRY_NUMBER)),
+ &entry, sizeof(entry));
+}
+
+/**
+ * valid- return 1
+ * invalid - return 0
+ */
+int conn_valid(unsigned int conn)
+{
+ if (conn < pvc_num())
+ return 1;
+ else
+ return 0;
+}
+
+/**
+ * Description:
+ * Loop up for connection ID with virtual path ID.
+ * Input:
+ * vpi --- unsigned int, virtual path ID
+ * Output:
+ * total number of PVC: failed
+ * connection ID: Success
+ */
+unsigned int find_vpi(unsigned int vpi)
+{
+ unsigned int i;
+ struct atm_pvc *conn = g_atm_tc->conn;
+ unsigned int max_pvc = pvc_num();
+
+ for (i = 0; i < max_pvc; i++)
+ if ((g_atm_tc->pvc_tbl & (1 << i)) != 0
+ && conn[i].vcc != NULL
+ && vpi == conn[i].vcc->vpi)
+ return i;
+
+ return max_pvc;
+}
+/**
+ * Description:
+ * Loop up for vpi and vci from given queue id.
+ * Input:
+ * vpi --- unsigned int, virtual path ID
+ * vci --- unsigned int, virtual channel ID
+ * Output:
+ * success: 0
+ * failed: -1
+ */
+unsigned int find_vpivci_from_queue_id(
+ unsigned int queue_id,
+ unsigned int *vpi,
+ unsigned int *vci)
+{
+ unsigned int i;
+ struct atm_pvc *conn = g_atm_tc->conn;
+ unsigned int max_pvc = pvc_num();
+
+ for (i = 0; i < max_pvc; i++)
+ if ((g_atm_tc->pvc_tbl & BIT(i))
+ && conn[i].vcc != NULL &&
+ conn[i].sw_txq_tbl == BIT(queue_id)) {
+ *vpi = conn[i].vcc->vpi;
+ *vci = conn[i].vcc->vci;
+ return 0;
+ }
+ return -1;
+}
+/**
+ * Description:
+ * Loop up for connection ID with virtual path ID and virtual channel ID.
+ * Input:
+ * vpi --- unsigned int, virtual path ID
+ * vci --- unsigned int, virtual channel ID
+ * Output:
+ * total number of PVC: failed
+ * connection ID: Success
+ */
+unsigned int find_vpivci(unsigned int vpi, unsigned int vci)
+{
+ unsigned int i;
+ struct atm_pvc *conn = g_atm_tc->conn;
+ unsigned int max_pvc = pvc_num();
+
+ for (i = 0; i < max_pvc; i++)
+ if ((g_atm_tc->pvc_tbl & BIT(i))
+ && conn[i].vcc != NULL
+ && vpi == conn[i].vcc->vpi
+ && vci == conn[i].vcc->vci)
+ return i;
+
+ return max_pvc;
+}
+
+/* Description:
+ * Loop up for connection ID with atm_vcc structure.
+ * Input:
+ * vcc --- struct atm_vcc *, atm_vcc structure of opened connection
+ * Output:
+ * total number of PVC: failed
+ * connection ID: Success
+ */
+static int find_vcc(struct atm_vcc *vcc)
+{
+ unsigned int i;
+ struct atm_priv *priv;
+ struct atm_pvc *conn;
+ unsigned int max_pvc = pvc_num();
+
+ if (!vcc) {
+ pr_err("%s : Invalid argument\n", __func__);
+ return max_pvc;
+ }
+
+ priv = g_atm_tc;
+ conn = priv->conn;
+
+ for (i = 0; i < max_pvc; i++)
+ if ((priv->pvc_tbl & (1 << i))
+ && conn[i].vcc == vcc)
+ return i;
+
+ return max_pvc;
+}
+
+static inline void qsb_param_dbg(struct atm_priv *priv,
+ unsigned int qsb_clk,
+ union qsb_queue_parameter_table *q_parm_tbl,
+ union qsb_queue_vbr_parameter_table *q_vbr_parm_tbl)
+{
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "qsb_clk = %lu\n", (unsigned long)qsb_clk);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "qsb_queue_parameter_table.bit.tp = %d\n",
+ (int)q_parm_tbl->bit.tp);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "qsb_queue_parameter_table.bit.wfqf = %d (0x%08X)\n",
+ (int)q_parm_tbl->bit.wfqf,
+ (int)q_parm_tbl->bit.wfqf);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "qsb_queue_parameter_table.bit.vbr = %d\n",
+ (int)q_parm_tbl->bit.vbr);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "qsb_queue_parameter_table.dword = 0x%08X\n",
+ (int)q_parm_tbl->dword);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "qsb_queue_vbr_parameter_table.bit.ts = %d\n",
+ (int)q_vbr_parm_tbl->bit.ts);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "qsb_queue_vbr_parameter_table.bit.taus = %d\n",
+ (int)q_vbr_parm_tbl->bit.taus);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "qsb_queue_vbr_parameter_table.dword = 0x%08X\n",
+ (int)q_vbr_parm_tbl->dword);
+}
+
+/* Description:
+ * Setup QSB queue.
+ * Input:
+ * vcc --- struct atm_vcc *, structure of an opened connection
+ * qos --- struct atm_qos *, QoS parameter of the connection
+ * connection --- unsigned int, QSB queue ID, which is same as connection ID
+ * Output:
+ * none
+ */
+static void set_qsb(struct atm_priv *priv, struct atm_vcc *vcc,
+ struct atm_qos *qos, unsigned int conn)
+{
+ union qsb_queue_parameter_table q_parm_tbl = { { 0 } };
+ union qsb_queue_vbr_parameter_table q_vbr_parm_tbl = { { 0 } };
+ unsigned int tmp, reg_val;
+ unsigned int qsb_clk;
+ struct tc_param *param;
+ int port;
+ unsigned int max_pcr;
+
+ if (!priv || !vcc || !qos) {
+ pr_err("%s : Invalid VCC/QoS/priv\n", __func__);
+ return;
+ }
+
+ qsb_clk = get_qsb_clk(priv);
+ param = &priv->tc_priv->param;
+ /* QSB cell delay variation due to concurrency */
+ param->qsb_tau = 1;
+ /* QSB scheduler burst length */
+ param->qsb_srvm = 0x0F;
+ param->qsb_tstep = 4;
+ tc_dbg(priv->tc_priv, MSG_INIT, "%s\n", __func__);
+ /* qsb_qos_dbg(qos); */
+ conn += QSB_QUEUE_NUMBER_BASE; /* qsb qid = firmware qid + 1 */
+
+ /* Peak Cell Rate (PCR) Limiter */
+ if (qos->txtp.max_pcr == 0)
+ q_parm_tbl.bit.tp = 0; /* disable PCR limiter */
+ else {
+ /* peak cell rate would be slightly lower than requested
+ [maximum_rate / pcr = (qsb_clock / 8) * (time_step / 4) / pcr]
+ */
+ tmp = ((qsb_clk * param->qsb_tstep) >> 5) / qos->txtp.max_pcr
+ + 1;
+ /* check if overflow takes place */
+ q_parm_tbl.bit.tp
+ = tmp > QSB_TP_TS_MAX ? QSB_TP_TS_MAX : tmp;
+ }
+
+ /* A funny issue. Create two PVCs, one UBR and one UBR with max_pcr.
+ * Send packets to these two PVCs at same time,
+ * it triggers strange behavior.
+ * In A1, RAM from 0x80000000 to 0x0x8007FFFF was corrupted
+ * with fixed pattern 0x00000000 0x40000000.
+ * In A4, PPE firmware keep emiting unknown cell
+ * and no more response to driver.
+ * To work around, create UBR always with max_pcr.
+ * If user want to create UBR without max_pcr,
+ * we give a default one larger than line-rate.
+ */
+ if (qos->txtp.traffic_class == ATM_UBR &&
+ q_parm_tbl.bit.tp == 0) {
+ port = priv->conn[conn - QSB_QUEUE_NUMBER_BASE].port;
+ max_pcr = priv->port[port].tx_max_cell_rate + 1000;
+
+ tmp = ((qsb_clk * param->qsb_tstep) >> 5) / max_pcr + 1;
+ if (tmp > QSB_TP_TS_MAX)
+ tmp = QSB_TP_TS_MAX;
+ else if (tmp < 1)
+ tmp = 1;
+ q_parm_tbl.bit.tp = tmp;
+ }
+
+ /* Weighted Fair Queueing Factor (WFQF) */
+ switch (qos->txtp.traffic_class) {
+ case ATM_CBR:
+ case ATM_VBR_RT:
+ /* real time queue gets weighted fair queueing bypass */
+ q_parm_tbl.bit.wfqf = 0;
+ break;
+ case ATM_VBR_NRT:
+ case ATM_UBR_PLUS:
+ /* WFQF calculation here is based on virtual cell rates,
+ to reduce granularity for high rates
+ */
+ /* WFQF is maximum cell rate / garenteed cell rate */
+ /* wfqf = qsb_minimum_cell_rate * QSB_WFQ_NONUBR_MAX /
+ requested_minimum_peak_cell_rate
+ */
+ if (qos->txtp.min_pcr == 0)
+ q_parm_tbl.bit.wfqf = QSB_WFQ_NONUBR_MAX;
+ else {
+ tmp = QSB_GCR_MIN * QSB_WFQ_NONUBR_MAX /
+ qos->txtp.min_pcr;
+ if (tmp == 0)
+ q_parm_tbl.bit.wfqf = 1;
+ else if (tmp > QSB_WFQ_NONUBR_MAX)
+ q_parm_tbl.bit.wfqf
+ = QSB_WFQ_NONUBR_MAX;
+ else
+ q_parm_tbl.bit.wfqf = tmp;
+ }
+ break;
+
+ case ATM_UBR:
+ default:
+ q_parm_tbl.bit.wfqf = QSB_WFQ_UBR_BYPASS;
+ break;
+ }
+
+ /* Sustained Cell Rate (SCR) Leaky Bucket Shaper VBR.0/VBR.1 */
+ if (qos->txtp.traffic_class == ATM_VBR_RT ||
+ qos->txtp.traffic_class == ATM_VBR_NRT) {
+ if (qos->txtp.scr == 0) {
+ /* disable shaper */
+ q_vbr_parm_tbl.bit.taus = 0;
+ q_vbr_parm_tbl.bit.ts = 0;
+ } else {
+ /* Cell Loss Priority (CLP) */
+ if ((vcc->atm_options & ATM_ATMOPT_CLP))
+ /* CLP1 */
+ q_parm_tbl.bit.vbr = 1;
+ else
+ /* CLP0 */
+ q_parm_tbl.bit.vbr = 0;
+ /* Rate Shaper Parameter (TS) and
+ Burst Tolerance Parameter for SCR (tauS)
+ */
+ tmp = ((qsb_clk * param->qsb_tstep) >> 5) /
+ qos->txtp.scr + 1;
+ q_vbr_parm_tbl.bit.ts
+ = tmp > QSB_TP_TS_MAX ? QSB_TP_TS_MAX : tmp;
+ tmp = (qos->txtp.mbs - 1) *
+ (q_vbr_parm_tbl.bit.ts -
+ q_parm_tbl.bit.tp) / 64;
+ if (tmp == 0)
+ q_vbr_parm_tbl.bit.taus = 1;
+ else if (tmp > QSB_TAUS_MAX)
+ q_vbr_parm_tbl.bit.taus
+ = QSB_TAUS_MAX;
+ else
+ q_vbr_parm_tbl.bit.taus = tmp;
+ }
+ } else {
+ q_vbr_parm_tbl.bit.taus = 0;
+ q_vbr_parm_tbl.bit.ts = 0;
+ }
+
+ /* Queue Parameter Table (QPT) */
+ tc_w32(QSB_QPT_SET_MASK, QSB_RTM);
+ tc_w32(q_parm_tbl.dword, QSB_RTD);
+ reg_val = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) |
+ QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_QPT) |
+ QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) |
+ QSB_RAMAC_TESEL_SET(conn);
+ tc_w32(reg_val, QSB_RAMAC);
+
+ /* Queue VBR Paramter Table (QVPT) */
+ tc_w32(QSB_QVPT_SET_MASK, QSB_RTM);
+ tc_w32(q_vbr_parm_tbl.dword, QSB_RTD);
+ reg_val = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) |
+ QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_VBR) |
+ QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) |
+ QSB_RAMAC_TESEL_SET(conn);
+ tc_w32(reg_val, QSB_RAMAC);
+
+ qsb_param_dbg(priv, qsb_clk, &q_parm_tbl, &q_vbr_parm_tbl);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "QSB setting for conn: %d is done\n", conn - 1);
+}
+
+static void do_oam_tasklet(unsigned long arg)
+{
+ unsigned long sys_flag;
+ rx_descriptor_t desc;
+ struct uni_cell_header *header;
+ int ep_id;
+ struct atm_vcc *vcc;
+ desq_cfg_ctxt_t ds_oam_cfg_ctxt, local_oam_cfg_ctxt;
+ dma_addr_t phy_addr;
+ struct atm_priv *priv;
+ u32 conn, ds_oam_dbase, oam_idx, oam_max_num;
+ u32 mbox1_ier, rx_cnt, dq_cnt, *oam_dlist;
+
+ priv = g_atm_tc;
+ if (!priv) {
+ pr_err("%s : Invalid argument\n", __func__);
+ return;
+ }
+ ep_id = priv->ep_id;
+ oam_dlist = priv->oam_llst.oam_des_list;
+ oam_idx = priv->oam_llst.oam_idx;
+ oam_max_num = priv->oam_llst.oam_num;
+
+ tc_mem_read(priv, &ds_oam_cfg_ctxt,
+ fpi_addr(__DS_OAM_DESQ_CFG_CTXT), sizeof(ds_oam_cfg_ctxt));
+ ds_oam_dbase = ds_oam_cfg_ctxt.des_base_addr;
+ rx_cnt = ds_oam_cfg_ctxt.enq_pkt_cnt;
+ dq_cnt = ds_oam_cfg_ctxt.deq_pkt_cnt;
+
+ while (1) {
+ tc_mem_read(priv, &desc, fpi_addr(ds_oam_dbase + oam_idx * 2),
+ sizeof(desc));
+ if (desc.own == DS_OAM_DES_OWN) { /* desc not belong to CPU */
+ /* Update idx as will exit loop */
+ priv->oam_llst.oam_idx = oam_idx;
+ /* probe if there's still availble oam packet */
+ tc_mem_read(priv, &ds_oam_cfg_ctxt,
+ fpi_addr(__DS_OAM_DESQ_CFG_CTXT),
+ sizeof(ds_oam_cfg_ctxt));
+ tc_mem_write(priv,
+ fpi_addr(__DS_OAM_DESQ_CFG_CTXT +
+ offsetof(desq_cfg_ctxt_t,
+ deq_pkt_cnt) / sizeof(u32)),
+ &dq_cnt, sizeof(dq_cnt));
+ tc_mem_read(priv, &local_oam_cfg_ctxt,
+ fpi_addr(__DS_TC_OAM_LOCAL_Q_CFG_CTXT),
+ sizeof(local_oam_cfg_ctxt));
+ if ((local_oam_cfg_ctxt.enq_pkt_cnt !=
+ ds_oam_cfg_ctxt.enq_pkt_cnt) ||
+ (ds_oam_cfg_ctxt.enq_pkt_cnt !=
+ ds_oam_cfg_ctxt.deq_pkt_cnt))
+ tasklet_schedule(&g_oam_tasklet);
+ else {
+ /* No more oam pkt, should enable irq again */
+ spin_lock_irqsave(&priv->oam_lock, sys_flag);
+ mbox1_ier = tc_r32(MBOX_IGU_IER(MBOX_IGU1));
+ mbox_set_ier(priv, MBOX_IGU1,
+ mbox1_ier | MBOX_OAM_RX);
+ spin_unlock_irqrestore(&priv->oam_lock,
+ sys_flag);
+ }
+ break;
+ }
+
+ phy_addr = dma_map_single(priv->pdev,
+ (void *)oam_dlist[oam_idx],
+ ATM_OAM_SIZE, DMA_FROM_DEVICE);
+
+ dma_unmap_single(priv->pdev, phy_addr,
+ ATM_OAM_SIZE, DMA_FROM_DEVICE);
+
+ header = (struct uni_cell_header *)oam_dlist[oam_idx];
+
+ if (header->pti == ATM_PTI_SEGF5 ||
+ header->pti == ATM_PTI_E2EF5)
+ conn = find_vpivci(header->vpi, header->vci);
+ else if (header->vci == 0x03 || header->vci == 0x04)
+ conn = find_vpi(header->vpi);
+ else
+ conn = -1; /* invalid */
+
+ if (conn_valid(conn) && priv->conn[conn].vcc != NULL) {
+ vcc = priv->conn[conn].vcc;
+ priv->conn[conn].access_time = current_kernel_time();
+
+ tc_dbg(priv->tc_priv, MSG_OAM_RX, "conn=%d, vpi: %d, vci:%d\n",
+ conn, header->vpi, header->vci);
+ /* dump_oam_cell(header, 1); */
+ if (vcc->push_oam != NULL)
+ vcc->push_oam(vcc, header);
+ else {
+ #if IS_ENABLED(CONFIG_LTQ_OAM)
+ ifx_push_oam((unsigned char *)header);
+ #else
+ tc_dbg(priv->tc_priv, MSG_OAM_RX,
+ "Receive OAM packet\n");
+ #endif
+ }
+ priv->conn[conn].stats.oam_rx_pkts++;
+ priv->conn[conn].stats.oam_rx_bytes
+ += desc.data_len;
+ priv->stats.oam_rx_pkts++;
+ priv->stats.oam_rx_bytes += desc.data_len;
+ } else {
+ priv->stats.oam_rx_errors++;
+ }
+
+ /* update desc */
+ desc.c = 0;
+ desc.own = DS_OAM_DES_OWN;
+ desc.data_len = ATM_OAM_SIZE;
+ tc_mem_write(priv, fpi_addr(ds_oam_dbase + oam_idx * 2), &desc,
+ sizeof(desc));
+
+ oam_idx = (oam_idx + 1) % oam_max_num;
+ dq_cnt++;
+ }
+}
+
+static void atm_umt_start(struct atm_priv *priv)
+{
+ priv->tc_priv->tc_ops.umt_start(0);
+}
+
+static void atm_aca_init(struct atm_priv *priv)
+{
+ struct aca_param param;
+ struct aca_modem_param mdm;
+ struct aca_cfg_param *txin;
+ struct aca_cfg_param *txout;
+ struct aca_cfg_param *rxout;
+ struct soc_cfg *cfg;
+ u32 phybase = priv->ep->phy_membase;
+ u32 stop;
+
+ memset(¶m, 0, sizeof(param));
+ priv->tc_priv->tc_ops.soc_cfg_get(&priv->tc_priv->cfg, 0);
+ cfg = &priv->tc_priv->cfg;
+
+ txin = ¶m.aca_txin;
+ txin->byteswap = 1;
+ txin->hd_size_in_dw = cfg->desc_dw_sz;
+ txin->pd_desc_base = SB_XBAR_ADDR(__ACA_TX_IN_PD_LIST_BASE);
+ txin->pd_desc_num = __ACA_TX_IN_PD_LIST_NUM;
+ txin->pd_size_in_dw = DESC_DWSZ;
+ txin->soc_desc_base = cfg->txin_dbase;
+ txin->soc_desc_num = cfg->txin_dnum;
+ txin->pp_buf_desc_num = ACA_TXIN_HD_DESC_NUM;
+
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "txin: bswp: %d, hdsz:%d, pd: dbase(0x%x), dnum(%d)\n",
+ txin->byteswap, txin->hd_size_in_dw, txin->pd_desc_base,
+ txin->pd_desc_num);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "\t\tsz_indw(%d), soc_dbase:0x%x, soc_dnum:0x%x\n",
+ txin->pd_size_in_dw, txin->soc_desc_base, txin->soc_desc_num);
+ txout = ¶m.aca_txout;
+ txout->byteswap = 1;
+ txout->hd_size_in_dw = 1;
+ txout->pd_desc_base = SB_XBAR_ADDR(__ACA_TX_OUT_PD_LIST_BASE);
+ txout->pd_desc_num = __ACA_TX_OUT_PD_LIST_NUM;
+ txout->pd_size_in_dw = DESC_DWSZ;
+ txout->soc_desc_base = cfg->txout_dbase;
+ txout->soc_desc_num = cfg->txout_dnum;
+ txout->pp_buf_desc_num = ACA_TXOUT_HD_DESC_NUM;
+
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "txout: bswp: %d, hdsz:%d, pd: dbase(0x%x), dnum(%d)\n",
+ txout->byteswap, txout->hd_size_in_dw, txout->pd_desc_base,
+ txout->pd_desc_num);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "\tsz_indw(%d), soc_dbase:0x%x, soc_dnum:0x%x\n",
+ txout->pd_size_in_dw, txout->soc_desc_base,
+ txout->soc_desc_num);
+ rxout = ¶m.aca_rxout;
+ rxout->byteswap = 1;
+ rxout->hd_size_in_dw = cfg->desc_dw_sz;
+ rxout->pd_desc_base = SB_XBAR_ADDR(__ACA_RX_OUT_PD_LIST_BASE);
+ rxout->pd_desc_num = __ACA_RX_OUT_PD_LIST_NUM;
+ rxout->pd_size_in_dw = DESC_DWSZ;
+ rxout->soc_desc_base = cfg->rxout_dbase;
+ rxout->soc_desc_num = cfg->rxout_dnum;
+ rxout->pp_buf_desc_num = ACA_RXOUT_HD_DESC_NUM;
+
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "rxout: bswp: %d, hdsz:%d, pd: dbase(0x%x), dnum(%d)\n",
+ rxout->byteswap, rxout->hd_size_in_dw, rxout->pd_desc_base,
+ rxout->pd_desc_num);
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "\tsz_indw(%d), soc_dbase:0x%x, soc_dnum:0x%x\n",
+ rxout->pd_size_in_dw,
+ rxout->soc_desc_base, rxout->soc_desc_num);
+
+ mdm.mdm_txout.stat
+ = SB_XBAR_ADDR(__TX_OUT_ACA_ACCUM_STATUS) | phybase;
+ mdm.mdm_txout.pd
+ = SB_XBAR_ADDR(__TX_OUT_QUEUE_PD_BASE_ADDR_OFFSET) | phybase;
+ mdm.mdm_txout.acc_cnt
+ = SB_XBAR_ADDR(__TX_OUT_ACA_ACCUM_COUNT) | phybase;
+
+ mdm.mdm_rxout.stat
+ = SB_XBAR_ADDR(__RX_OUT_ACA_ACCUM_STATUS) | phybase;
+ mdm.mdm_rxout.pd
+ = SB_XBAR_ADDR(__RX_OUT_QUEUE_PD_BASE_ADDR_OFFSET) | phybase;
+ mdm.mdm_rxout.acc_cnt
+ = SB_XBAR_ADDR(__RX_OUT_ACA_ACCUM_COUNT) | phybase;
+
+ mdm.mdm_rxin.stat
+ = SB_XBAR_ADDR(__RX_IN_ACA_ACCUM_STATUS) | phybase;
+ mdm.mdm_rxin.pd
+ = SB_XBAR_ADDR(__RX_IN_QUEUE_PD_BASE_ADDR_OFFSET) | phybase;
+ mdm.mdm_rxin.acc_cnt
+ = SB_XBAR_ADDR(__RX_IN_ACA_ACCUM_COUNT) | phybase;
+
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "txout: (stat:0x%x, pd: 0x%x, cnt: 0x%x)\n",
+ mdm.mdm_txout.stat, mdm.mdm_txout.pd, mdm.mdm_txout.acc_cnt);
+
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "rxout: (stat:0x%x, pd: 0x%x, cnt: 0x%x)\n",
+ mdm.mdm_rxout.stat, mdm.mdm_rxout.pd, mdm.mdm_rxout.acc_cnt);
+
+ tc_dbg(priv->tc_priv, MSG_INIT,
+ "rxin: (stat:0x%x, pd: 0x%x, cnt: 0x%x)\n",
+ mdm.mdm_rxin.stat, mdm.mdm_rxin.pd, mdm.mdm_rxin.acc_cnt);
+
+ priv->ep->hw_ops->aca_init(priv->ep, ¶m, &mdm);
+ stop = ACA_ALL_EN; /* ACA FW started all by default */
+ priv->ep->hw_ops->aca_stop(priv->ep, &stop, 0);
+ priv->ep->hw_ops->aca_start(priv->ep,
+ ACA_TXOUT_EN | ACA_RXIN_EN | ACA_RXOUT_EN, 1);
+}
+
+static int print_datetime(char *buffer, const struct timespec *datetime)
+{
+ struct timeval tv;
+ struct tm nowtm;
+ char tmbuf[64];
+ s64 nsec;
+
+ if (buffer == NULL || datetime == NULL) {
+ pr_err("%s : Invalid arguments\n", __func__);
+ return -1;
+ }
+ nsec = timespec_to_ns(datetime);
+ tv = ns_to_timeval(nsec);
+ time_to_tm(tv.tv_sec, 0, &nowtm);
+ memset(tmbuf, 0, 64);
+
+ snprintf(tmbuf, sizeof(tmbuf), "%ld-%d-%d %d:%d:%d",
+ 1900 + nowtm.tm_year,
+ 1 + nowtm.tm_mon,
+ nowtm.tm_mday,
+ nowtm.tm_hour,
+ nowtm.tm_min,
+ nowtm.tm_sec);
+ snprintf(buffer, sizeof(buffer), "%s.%06d", tmbuf, (int)tv.tv_usec);
+
+ return 0;
+}
+
+void print_stat_mib(struct seq_file *seq, struct atm_stats *stat)
+{
+ seq_printf(seq, "AAL5 RX PKTs:\t\t %llu\n", stat->aal5_rx_pkts);
+ seq_printf(seq, "AAL5 RX Bytes:\t\t %llu\n", stat->aal5_rx_bytes);
+ seq_printf(seq, "AAL5 RX Err:\t\t %llu\n", stat->aal5_rx_errors);
+ seq_printf(seq, "AAL5 RX Drop:\t\t %llu\n", stat->aal5_rx_dropped);
+
+ seq_printf(seq, "OAM RX PKTs:\t\t %llu\n", stat->oam_rx_pkts);
+ seq_printf(seq, "OAM RX Bytes:\t\t %llu\n", stat->oam_rx_bytes);
+ seq_printf(seq, "OAM RX Err:\t\t %llu\n", stat->oam_rx_errors);
+ seq_printf(seq, "OAM RX Drop:\t\t %llu\n", stat->oam_rx_dropped);
+
+ seq_printf(seq, "AAL5 TX PKTs:\t\t %llu\n", stat->aal5_tx_pkts);
+ seq_printf(seq, "AAL5 TX Bytes:\t\t %llu\n", stat->aal5_tx_bytes);
+ seq_printf(seq, "AAL5 TX Err:\t\t %llu\n", stat->aal5_tx_errors);
+ seq_printf(seq, "AAL5 TX Drop:\t\t %llu\n", stat->aal5_tx_dropped);
+
+ seq_printf(seq, "OAM TX PKTs:\t\t %llu\n", stat->oam_tx_pkts);
+ seq_printf(seq, "OAM TX Bytes:\t\t %llu\n", stat->oam_tx_bytes);
+ seq_printf(seq, "OAM TX Err:\t\t %llu\n", stat->oam_tx_errors);
+ seq_printf(seq, "OAM TX Drop:\t\t %llu\n\n", stat->oam_tx_dropped);
+}
+
+void print_drv_mib(struct seq_file *seq, struct atm_priv *priv)
+{
+ seq_puts(seq, "Driver Total MIB:\n");
+ print_stat_mib(seq, &(priv->stats));
+}
+static int atm_tc_stats(struct atm_priv *priv,
+ struct intel_tc_stats *stats
+)
+{
+ int i, vpi, vci;
+ struct intel_tc_atm_stats *atm_stats32;
+ if (!priv) {
+ pr_err("priv pointer is NULL!!!\n");
+ return -EINVAL;
+ }
+ atm_stats32 = &(stats->stats.atm_tc_stats);
+ stats->tc_info = TC_ATM_SL_MODE;
+ atm_stats32->wrx_drophtu_cell = sb_r32(__WRX_DROPHTU_CELL);
+ atm_stats32->wrx_dropdes_pdu = sb_r32(__WRX_DROPDES_PDU);
+ atm_stats32->wrx_correct_pdu = sb_r32(__WRX_CORRECT_PDU);
+ atm_stats32->wrx_err_pdu = sb_r32(__WRX_ERR_PDU);
+ atm_stats32->wrx_dropdes_cell = sb_r32(__WRX_DROPDES_CELL);
+ atm_stats32->wrx_correct_cell = sb_r32(__WRX_CORRECT_CELL);
+ atm_stats32->wrx_err_cell = sb_r32(__WRX_ERR_CELL);
+ atm_stats32->wrx_total_byte = sb_r32(__WRX_TOTAL_BYTE);
+ atm_stats32->wtx_total_pdu = sb_r32(__WTX_TOTAL_PDU);
+ atm_stats32->wtx_total_cell = sb_r32(__WTX_TOTAL_CELL);
+ atm_stats32->wtx_total_byte = sb_r32(__WTX_TOTAL_BYTE);
+ for (i = 0; i < txq_num(); i++) {
+ atm_stats32->rx_mib[i].valid =
+ priv->sw_txq_tbl & BIT(i);
+ if (atm_stats32->rx_mib[i].valid)
+ if (find_vpivci_from_queue_id(
+ i,
+ &vpi,
+ &vci) == 0) {
+ atm_stats32->rx_mib[i].vpi = vpi;
+ atm_stats32->rx_mib[i].vci = vci;
+ }
+
+ atm_stats32->rx_mib[i].idx = i;
+ atm_stats32->rx_mib[i].pdu = sb_r32(DSL_Q_RX_MIB_TBL(i));
+ atm_stats32->rx_mib[i].bytes =
+ sb_r32(DSL_Q_RX_MIB_TBL(i) + 1);
+ }
+ for (i = 0; i < txq_num(); i++) {
+ atm_stats32->tx_mib[i].valid =
+ priv->sw_txq_tbl & BIT(i);
+ if (atm_stats32->tx_mib[i].valid)
+ if (find_vpivci_from_queue_id(
+ i,
+ &vpi,
+ &vci) == 0) {
+ atm_stats32->tx_mib[i].vpi = vpi;
+ atm_stats32->tx_mib[i].vci = vci;
+ }
+ atm_stats32->tx_mib[i].idx = i;
+ atm_stats32->tx_mib[i].pdu = sb_r32(DSL_Q_TX_MIB_TBL(i));
+ atm_stats32->tx_mib[i].bytes =
+ sb_r32(DSL_Q_TX_MIB_TBL(i) + 1);
+ }
+
+ atm_stats32->aal5_rx_pkts = priv->stats.aal5_rx_pkts;
+ atm_stats32->aal5_rx_bytes = priv->stats.aal5_rx_bytes;
+ atm_stats32->aal5_rx_errors = priv->stats.aal5_rx_errors;
+ atm_stats32->aal5_rx_dropped = priv->stats.aal5_rx_dropped;
+ atm_stats32->oam_rx_pkts = priv->stats.oam_rx_pkts;
+ atm_stats32->oam_rx_bytes = priv->stats.oam_rx_bytes;
+ atm_stats32->oam_rx_errors = priv->stats.oam_rx_errors;
+ atm_stats32->oam_rx_dropped = priv->stats.oam_rx_dropped;
+ atm_stats32->aal5_tx_pkts = priv->stats.aal5_tx_pkts;
+ atm_stats32->aal5_tx_bytes = priv->stats.aal5_tx_bytes;
+ atm_stats32->aal5_tx_errors = priv->stats.aal5_tx_errors;
+ atm_stats32->aal5_tx_dropped = priv->stats.aal5_tx_dropped;
+ atm_stats32->oam_tx_pkts = priv->stats.oam_tx_pkts;
+ atm_stats32->oam_tx_bytes = priv->stats.oam_tx_bytes;
+ atm_stats32->oam_tx_errors = priv->stats.oam_tx_errors;
+ atm_stats32->oam_tx_dropped = priv->stats.oam_tx_dropped;
+ return 0;
+}
+int proc_read_atm_wanmib(struct seq_file *seq, void *v)
+{
+ struct intel_tc_stats stats;
+ struct intel_tc_atm_stats *atm_stat;
+ struct atm_priv *priv = (struct atm_priv *)seq->private;
+ int i;
+
+ if (!priv) {
+ pr_err("priv pointer is NULL!!!\n");
+ return -EINVAL;
+ }
+ atm_tc_stats(priv, &stats);
+ atm_stat = &(stats.stats.atm_tc_stats);
+ seq_puts(seq, "DSL WAN MIB:\n");
+ seq_printf(seq, " wrx_drophtu_cell: %u\n", atm_stat->wrx_drophtu_cell);
+ seq_printf(seq, " wrx_dropdes_pdu: %u\n", atm_stat->wrx_dropdes_pdu);
+ seq_printf(seq, " wrx_correct_pdu: %u\n", atm_stat->wrx_correct_pdu);
+ seq_printf(seq, " wrx_err_pdu: %u\n", atm_stat->wrx_err_pdu);
+ seq_printf(seq, " wrx_dropdes_cell: %u\n", atm_stat->wrx_dropdes_cell);
+ seq_printf(seq, " wrx_correct_cell: %u\n", atm_stat->wrx_correct_cell);
+ seq_printf(seq, " wrx_err_cell: %u\n", atm_stat->wrx_err_cell);
+ seq_printf(seq, " wrx_total_byte: %u\n", atm_stat->wrx_total_byte);
+ seq_printf(seq, " wtx_total_pdu: %u\n", atm_stat->wtx_total_pdu);
+ seq_printf(seq, " wtx_total_cell: %u\n", atm_stat->wtx_total_cell);
+ seq_printf(seq, " wtx_total_byte: %u\n", atm_stat->wtx_total_byte);
+ seq_puts(seq, "DSL RX QUEUE MIB:\n");
+ seq_puts(seq, " idx pdu bytes\n");
+ for (i = 0; i < txq_num(); i++)
+ seq_printf(seq, " %2d %10u %10u\n",
+ atm_stat->rx_mib[i].idx,
+ atm_stat->rx_mib[i].pdu,
+ atm_stat->rx_mib[i].bytes);
+
+ seq_puts(seq, "DSL TX QUEUE MIB:\n");
+ seq_puts(seq, " idx pdu bytes\n");
+
+ for (i = 0; i < txq_num(); i++)
+ seq_printf(seq, " %2d %10u %10u\n",
+ atm_stat->tx_mib[i].idx,
+ atm_stat->tx_mib[i].pdu,
+ atm_stat->tx_mib[i].bytes
+ );
+
+ print_drv_mib(seq, priv);
+
+ return 0;
+}
+
+int proc_clear_atm_wanmib(struct atm_priv *priv)
+{
+ int i, ep_id;
+
+ if (!priv) {
+ pr_err("<%s>: priv pointer is NULL!!!\n", __func__);
+ return -EINVAL;
+ }