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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
|
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
rtmp.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Paul Lin 2002-08-01 created
James Tan 2002-09-06 modified (Revise NTCRegTable)
John Chang 2004-09-06 modified for RT2600
Justin P. Mattock 11/07/2010 Fix some typos
*/
#ifndef __RTMP_H__
#define __RTMP_H__
#include "spectrum_def.h"
#include "rtmp_dot11.h"
#include "rtmp_chip.h"
struct rt_rtmp_adapter;
/*#define DBG 1 */
/*#define DBG_DIAGNOSE 1 */
/*+++Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */
#define MAX_DATAMM_RETRY 3
#define MGMT_USE_QUEUE_FLAG 0x80
/*---Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */
#define MAXSEQ (0xFFF)
extern unsigned char SNAP_AIRONET[];
extern unsigned char CISCO_OUI[];
extern u8 BaSizeArray[4];
extern u8 BROADCAST_ADDR[MAC_ADDR_LEN];
extern u8 ZERO_MAC_ADDR[MAC_ADDR_LEN];
extern unsigned long BIT32[32];
extern u8 BIT8[8];
extern char *CipherName[];
extern char *MCSToMbps[];
extern u8 RxwiMCSToOfdmRate[12];
extern u8 SNAP_802_1H[6];
extern u8 SNAP_BRIDGE_TUNNEL[6];
extern u8 SNAP_AIRONET[8];
extern u8 CKIP_LLC_SNAP[8];
extern u8 EAPOL_LLC_SNAP[8];
extern u8 EAPOL[2];
extern u8 IPX[2];
extern u8 APPLE_TALK[2];
extern u8 RateIdToPlcpSignal[12]; /* see IEEE802.11a-1999 p.14 */
extern u8 OfdmRateToRxwiMCS[];
extern u8 OfdmSignalToRateId[16];
extern u8 default_cwmin[4];
extern u8 default_cwmax[4];
extern u8 default_sta_aifsn[4];
extern u8 MapUserPriorityToAccessCategory[8];
extern u16 RateUpPER[];
extern u16 RateDownPER[];
extern u8 Phy11BNextRateDownward[];
extern u8 Phy11BNextRateUpward[];
extern u8 Phy11BGNextRateDownward[];
extern u8 Phy11BGNextRateUpward[];
extern u8 Phy11ANextRateDownward[];
extern u8 Phy11ANextRateUpward[];
extern char RssiSafeLevelForTxRate[];
extern u8 RateIdToMbps[];
extern u16 RateIdTo500Kbps[];
extern u8 CipherSuiteWpaNoneTkip[];
extern u8 CipherSuiteWpaNoneTkipLen;
extern u8 CipherSuiteWpaNoneAes[];
extern u8 CipherSuiteWpaNoneAesLen;
extern u8 SsidIe;
extern u8 SupRateIe;
extern u8 ExtRateIe;
extern u8 HtCapIe;
extern u8 AddHtInfoIe;
extern u8 NewExtChanIe;
extern u8 ErpIe;
extern u8 DsIe;
extern u8 TimIe;
extern u8 WpaIe;
extern u8 Wpa2Ie;
extern u8 IbssIe;
extern u8 Ccx2Ie;
extern u8 WapiIe;
extern u8 WPA_OUI[];
extern u8 RSN_OUI[];
extern u8 WAPI_OUI[];
extern u8 WME_INFO_ELEM[];
extern u8 WME_PARM_ELEM[];
extern u8 Ccx2QosInfo[];
extern u8 Ccx2IeInfo[];
extern u8 RALINK_OUI[];
extern u8 PowerConstraintIE[];
extern u8 RateSwitchTable[];
extern u8 RateSwitchTable11B[];
extern u8 RateSwitchTable11G[];
extern u8 RateSwitchTable11BG[];
extern u8 RateSwitchTable11BGN1S[];
extern u8 RateSwitchTable11BGN2S[];
extern u8 RateSwitchTable11BGN2SForABand[];
extern u8 RateSwitchTable11N1S[];
extern u8 RateSwitchTable11N2S[];
extern u8 RateSwitchTable11N2SForABand[];
extern u8 PRE_N_HT_OUI[];
struct rt_rssi_sample {
char LastRssi0; /* last received RSSI */
char LastRssi1; /* last received RSSI */
char LastRssi2; /* last received RSSI */
char AvgRssi0;
char AvgRssi1;
char AvgRssi2;
short AvgRssi0X8;
short AvgRssi1X8;
short AvgRssi2X8;
};
/* */
/* Queue structure and macros */
/* */
struct rt_queue_entry;
struct rt_queue_entry {
struct rt_queue_entry *Next;
};
/* Queue structure */
struct rt_queue_header {
struct rt_queue_entry *Head;
struct rt_queue_entry *Tail;
unsigned long Number;
};
#define InitializeQueueHeader(QueueHeader) \
{ \
(QueueHeader)->Head = (QueueHeader)->Tail = NULL; \
(QueueHeader)->Number = 0; \
}
#define RemoveHeadQueue(QueueHeader) \
(QueueHeader)->Head; \
{ \
struct rt_queue_entry *pNext; \
if ((QueueHeader)->Head != NULL) { \
pNext = (QueueHeader)->Head->Next; \
(QueueHeader)->Head->Next = NULL; \
(QueueHeader)->Head = pNext; \
if (pNext == NULL) \
(QueueHeader)->Tail = NULL; \
(QueueHeader)->Number--; \
} \
}
#define InsertHeadQueue(QueueHeader, QueueEntry) \
{ \
((struct rt_queue_entry *)QueueEntry)->Next = (QueueHeader)->Head; \
(QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \
if ((QueueHeader)->Tail == NULL) \
(QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \
(QueueHeader)->Number++; \
}
#define InsertTailQueue(QueueHeader, QueueEntry) \
{ \
((struct rt_queue_entry *)QueueEntry)->Next = NULL; \
if ((QueueHeader)->Tail) \
(QueueHeader)->Tail->Next = (struct rt_queue_entry *)(QueueEntry); \
else \
(QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \
(QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \
(QueueHeader)->Number++; \
}
#define InsertTailQueueAc(pAd, pEntry, QueueHeader, QueueEntry) \
{ \
((struct rt_queue_entry *)QueueEntry)->Next = NULL; \
if ((QueueHeader)->Tail) \
(QueueHeader)->Tail->Next = (struct rt_queue_entry *)(QueueEntry); \
else \
(QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \
(QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \
(QueueHeader)->Number++; \
}
/* */
/* Macros for flag and ref count operations */
/* */
#define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
#define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
#define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0)
#define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
#define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
/* Macro for power save flag. */
#define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F))
#define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F))
#define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0)
#define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0)
#define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F))
#define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F))
#define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F))
#define OPSTATUS_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.OpStatusFlags & (_F)) != 0)
#define CLIENT_STATUS_SET_FLAG(_pEntry, _F) ((_pEntry)->ClientStatusFlags |= (_F))
#define CLIENT_STATUS_CLEAR_FLAG(_pEntry, _F) ((_pEntry)->ClientStatusFlags &= ~(_F))
#define CLIENT_STATUS_TEST_FLAG(_pEntry, _F) (((_pEntry)->ClientStatusFlags & (_F)) != 0)
#define RX_FILTER_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter |= (_F))
#define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F))
#define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0)
#define STA_NO_SECURITY_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11EncryptionDisabled)
#define STA_WEP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption1Enabled)
#define STA_TKIP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption2Enabled)
#define STA_AES_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)
#define STA_TGN_WIFI_ON(_p) (_p->StaCfg.bTGnWifiTest == TRUE)
#define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
#define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE))
#define INC_RING_INDEX(_idx, _RingSize) \
{ \
(_idx) = (_idx+1) % (_RingSize); \
}
/* StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here. */
#define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \
{ \
_pAd->StaActive.SupportedHtPhy.ChannelWidth = _pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth; \
_pAd->StaActive.SupportedHtPhy.MimoPs = _pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs; \
_pAd->StaActive.SupportedHtPhy.GF = _pAd->MlmeAux.HtCapability.HtCapInfo.GF; \
_pAd->StaActive.SupportedHtPhy.ShortGIfor20 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20; \
_pAd->StaActive.SupportedHtPhy.ShortGIfor40 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40; \
_pAd->StaActive.SupportedHtPhy.TxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC; \
_pAd->StaActive.SupportedHtPhy.RxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC; \
_pAd->StaActive.SupportedHtPhy.ExtChanOffset = _pAd->MlmeAux.AddHtInfo.AddHtInfo.ExtChanOffset; \
_pAd->StaActive.SupportedHtPhy.RecomWidth = _pAd->MlmeAux.AddHtInfo.AddHtInfo.RecomWidth; \
_pAd->StaActive.SupportedHtPhy.OperaionMode = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode; \
_pAd->StaActive.SupportedHtPhy.NonGfPresent = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent; \
NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(u8) * 16);\
}
#define COPY_AP_HTSETTINGS_FROM_BEACON(_pAd, _pHtCapability) \
{ \
_pAd->MacTab.Content[BSSID_WCID].AMsduSize = (u8)(_pHtCapability->HtCapInfo.AMsduSize); \
_pAd->MacTab.Content[BSSID_WCID].MmpsMode = (u8)(_pHtCapability->HtCapInfo.MimoPs); \
_pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (u8)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \
}
/* */
/* MACRO for 32-bit PCI register read / write */
/* */
/* Usage : RTMP_IO_READ32( */
/* struct rt_rtmp_adapter *pAd, */
/* unsigned long Register_Offset, */
/* unsigned long * pValue) */
/* */
/* RTMP_IO_WRITE32( */
/* struct rt_rtmp_adapter *pAd, */
/* unsigned long Register_Offset, */
/* unsigned long Value) */
/* */
/* */
/* Common fragment list structure - Identical to the scatter gather frag list structure */
/* */
/*#define struct rt_rtmp_sg_element SCATTER_GATHER_ELEMENT */
/*#define struct rt_rtmp_sg_element *PSCATTER_GATHER_ELEMENT */
#define NIC_MAX_PHYS_BUF_COUNT 8
struct rt_rtmp_sg_element {
void *Address;
unsigned long Length;
unsigned long *Reserved;
};
struct rt_rtmp_sg_list {
unsigned long NumberOfElements;
unsigned long *Reserved;
struct rt_rtmp_sg_element Elements[NIC_MAX_PHYS_BUF_COUNT];
};
/* */
/* Some utility macros */
/* */
#define GET_LNA_GAIN(_pAd) ((_pAd->LatchRfRegs.Channel <= 14) ? (_pAd->BLNAGain) : ((_pAd->LatchRfRegs.Channel <= 64) ? (_pAd->ALNAGain0) : ((_pAd->LatchRfRegs.Channel <= 128) ? (_pAd->ALNAGain1) : (_pAd->ALNAGain2))))
#define INC_COUNTER64(Val) (Val.QuadPart++)
#define INFRA_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_INFRA_ON))
#define ADHOC_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_ADHOC_ON))
#define MONITOR_ON(_p) (((_p)->StaCfg.BssType) == BSS_MONITOR)
#define IDLE_ON(_p) (!INFRA_ON(_p) && !ADHOC_ON(_p))
/* Check LEAP & CCKM flags */
#define LEAP_ON(_p) (((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP)
#define LEAP_CCKM_ON(_p) ((((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg.LeapAuthInfo.CCKM == TRUE))
/* if original Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required */
#define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \
{ \
if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) { \
_pExtraLlcSnapEncap = SNAP_802_1H; \
if (NdisEqualMemory(IPX, _pBufVA + 12, 2) || \
NdisEqualMemory(APPLE_TALK, _pBufVA + 12, 2)) { \
_pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
} \
} \
else { \
_pExtraLlcSnapEncap = NULL; \
} \
}
/* New Define for new Tx Path. */
#define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \
{ \
if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) { \
_pExtraLlcSnapEncap = SNAP_802_1H; \
if (NdisEqualMemory(IPX, _pBufVA, 2) || \
NdisEqualMemory(APPLE_TALK, _pBufVA, 2)) { \
_pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \
} \
} \
else { \
_pExtraLlcSnapEncap = NULL; \
} \
}
#define MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType) \
{ \
NdisMoveMemory(_p, _pMac1, MAC_ADDR_LEN); \
NdisMoveMemory((_p + MAC_ADDR_LEN), _pMac2, MAC_ADDR_LEN); \
NdisMoveMemory((_p + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \
}
/* if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way. */
/* else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field */
/* else remove the LLC/SNAP field from the result Ethernet frame */
/* Patch for WHQL only, which did not turn on Netbios but use IPX within its payload */
/* Note: */
/* _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO */
/* _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed */
#define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \
{ \
char LLC_Len[2]; \
\
_pRemovedLLCSNAP = NULL; \
if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \
NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) { \
u8 *pProto = _pData + 6; \
\
if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \
NdisEqualMemory(SNAP_802_1H, _pData, 6)) { \
LLC_Len[0] = (u8)(_DataSize / 256); \
LLC_Len[1] = (u8)(_DataSize % 256); \
MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
} \
else { \
MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \
_pRemovedLLCSNAP = _pData; \
_DataSize -= LENGTH_802_1_H; \
_pData += LENGTH_802_1_H; \
} \
} \
else { \
LLC_Len[0] = (u8)(_DataSize / 256); \
LLC_Len[1] = (u8)(_DataSize % 256); \
MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \
} \
}
/* Enqueue this frame to MLME engine */
/* We need to enqueue the whole frame because MLME need to pass data type */
/* information from 802.11 header */
#ifdef RTMP_MAC_PCI
#define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
{ \
u32 High32TSF, Low32TSF; \
RTMP_IO_READ32(_pAd, TSF_TIMER_DW1, &High32TSF); \
RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \
MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (u8)_Rssi0, (u8)_Rssi1, (u8)_Rssi2, _FrameSize, _pFrame, (u8)_PlcpSignal); \
}
#endif /* RTMP_MAC_PCI // */
#ifdef RTMP_MAC_USB
#define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \
{ \
u32 High32TSF = 0, Low32TSF = 0; \
MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (u8)_Rssi0, (u8)_Rssi1, (u8)_Rssi2, _FrameSize, _pFrame, (u8)_PlcpSignal); \
}
#endif /* RTMP_MAC_USB // */
#define MAC_ADDR_EQUAL(pAddr1, pAddr2) RTMPEqualMemory((void *)(pAddr1), (void *)(pAddr2), MAC_ADDR_LEN)
#define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1 == len2) && (RTMPEqualMemory(ssid1, ssid2, len1)))
/* */
/* Check if it is Japan W53(ch52,56,60,64) channel. */
/* */
#define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64))
#define STA_EXTRA_SETTING(_pAd)
#define STA_PORT_SECURED(_pAd) \
{ \
BOOLEAN Cancelled; \
(_pAd)->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \
NdisAcquireSpinLock(&((_pAd)->MacTabLock)); \
(_pAd)->MacTab.Content[BSSID_WCID].PortSecured = (_pAd)->StaCfg.PortSecured; \
(_pAd)->MacTab.Content[BSSID_WCID].PrivacyFilter = Ndis802_11PrivFilterAcceptAll;\
NdisReleaseSpinLock(&(_pAd)->MacTabLock); \
RTMPCancelTimer(&((_pAd)->Mlme.LinkDownTimer), &Cancelled);\
STA_EXTRA_SETTING(_pAd); \
}
/* */
/* Data buffer for DMA operation, the buffer must be contiguous physical memory */
/* Both DMA to / from CPU use the same structure. */
/* */
struct rt_rtmp_dmabuf {
unsigned long AllocSize;
void *AllocVa; /* TxBuf virtual address */
dma_addr_t AllocPa; /* TxBuf physical address */
};
/* */
/* Control block (Descriptor) for all ring descriptor DMA operation, buffer must be */
/* contiguous physical memory. char stored the binding Rx packet descriptor */
/* which won't be released, driver has to wait until upper layer return the packet */
/* before giving up this rx ring descriptor to ASIC. NDIS_BUFFER is associated pair */
/* to describe the packet buffer. For Tx, char stored the tx packet descriptor */
/* which driver should ACK upper layer when the tx is physically done or failed. */
/* */
struct rt_rtmp_dmacb {
unsigned long AllocSize; /* Control block size */
void *AllocVa; /* Control block virtual address */
dma_addr_t AllocPa; /* Control block physical address */
void *pNdisPacket;
void *pNextNdisPacket;
struct rt_rtmp_dmabuf DmaBuf; /* Associated DMA buffer structure */
};
struct rt_rtmp_tx_ring {
struct rt_rtmp_dmacb Cell[TX_RING_SIZE];
u32 TxCpuIdx;
u32 TxDmaIdx;
u32 TxSwFreeIdx; /* software next free tx index */
};
struct rt_rtmp_rx_ring {
struct rt_rtmp_dmacb Cell[RX_RING_SIZE];
u32 RxCpuIdx;
u32 RxDmaIdx;
int RxSwReadIdx; /* software next read index */
};
struct rt_rtmp_mgmt_ring {
struct rt_rtmp_dmacb Cell[MGMT_RING_SIZE];
u32 TxCpuIdx;
u32 TxDmaIdx;
u32 TxSwFreeIdx; /* software next free tx index */
};
/* */
/* Statistic counter structure */
/* */
struct rt_counter_802_3 {
/* General Stats */
unsigned long GoodTransmits;
unsigned long GoodReceives;
unsigned long TxErrors;
unsigned long RxErrors;
unsigned long RxNoBuffer;
/* Ethernet Stats */
unsigned long RcvAlignmentErrors;
unsigned long OneCollision;
unsigned long MoreCollisions;
};
struct rt_counter_802_11 {
unsigned long Length;
LARGE_INTEGER LastTransmittedFragmentCount;
LARGE_INTEGER TransmittedFragmentCount;
LARGE_INTEGER MulticastTransmittedFrameCount;
LARGE_INTEGER FailedCount;
LARGE_INTEGER RetryCount;
LARGE_INTEGER MultipleRetryCount;
LARGE_INTEGER RTSSuccessCount;
LARGE_INTEGER RTSFailureCount;
LARGE_INTEGER ACKFailureCount;
LARGE_INTEGER FrameDuplicateCount;
LARGE_INTEGER ReceivedFragmentCount;
LARGE_INTEGER MulticastReceivedFrameCount;
LARGE_INTEGER FCSErrorCount;
};
struct rt_counter_ralink {
unsigned long TransmittedByteCount; /* both successful and failure, used to calculate TX throughput */
unsigned long ReceivedByteCount; /* both CRC okay and CRC error, used to calculate RX throughput */
unsigned long BeenDisassociatedCount;
unsigned long BadCQIAutoRecoveryCount;
unsigned long PoorCQIRoamingCount;
unsigned long MgmtRingFullCount;
unsigned long RxCountSinceLastNULL;
unsigned long RxCount;
unsigned long RxRingErrCount;
unsigned long KickTxCount;
unsigned long TxRingErrCount;
LARGE_INTEGER RealFcsErrCount;
unsigned long PendingNdisPacketCount;
unsigned long OneSecOsTxCount[NUM_OF_TX_RING];
unsigned long OneSecDmaDoneCount[NUM_OF_TX_RING];
u32 OneSecTxDoneCount;
unsigned long OneSecRxCount;
u32 OneSecTxAggregationCount;
u32 OneSecRxAggregationCount;
u32 OneSecReceivedByteCount;
u32 OneSecFrameDuplicateCount;
u32 OneSecTransmittedByteCount; /* both successful and failure, used to calculate TX throughput */
u32 OneSecTxNoRetryOkCount;
u32 OneSecTxRetryOkCount;
u32 OneSecTxFailCount;
u32 OneSecFalseCCACnt; /* CCA error count, for debug purpose, might move to global counter */
u32 OneSecRxOkCnt; /* RX without error */
u32 OneSecRxOkDataCnt; /* unicast-to-me DATA frame count */
u32 OneSecRxFcsErrCnt; /* CRC error */
u32 OneSecBeaconSentCnt;
u32 LastOneSecTotalTxCount; /* OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount */
u32 LastOneSecRxOkDataCnt; /* OneSecRxOkDataCnt */
unsigned long DuplicateRcv;
unsigned long TxAggCount;
unsigned long TxNonAggCount;
unsigned long TxAgg1MPDUCount;
unsigned long TxAgg2MPDUCount;
unsigned long TxAgg3MPDUCount;
unsigned long TxAgg4MPDUCount;
unsigned long TxAgg5MPDUCount;
unsigned long TxAgg6MPDUCount;
unsigned long TxAgg7MPDUCount;
unsigned long TxAgg8MPDUCount;
unsigned long TxAgg9MPDUCount;
unsigned long TxAgg10MPDUCount;
unsigned long TxAgg11MPDUCount;
unsigned long TxAgg12MPDUCount;
unsigned long TxAgg13MPDUCount;
unsigned long TxAgg14MPDUCount;
unsigned long TxAgg15MPDUCount;
unsigned long TxAgg16MPDUCount;
LARGE_INTEGER TransmittedOctetsInAMSDU;
LARGE_INTEGER TransmittedAMSDUCount;
LARGE_INTEGER ReceivedOctesInAMSDUCount;
LARGE_INTEGER ReceivedAMSDUCount;
LARGE_INTEGER TransmittedAMPDUCount;
LARGE_INTEGER TransmittedMPDUsInAMPDUCount;
LARGE_INTEGER TransmittedOctetsInAMPDUCount;
LARGE_INTEGER MPDUInReceivedAMPDUCount;
};
struct rt_counter_drs {
/* record each TX rate's quality. 0 is best, the bigger the worse. */
u16 TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
u8 PER[MAX_STEP_OF_TX_RATE_SWITCH];
u8 TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */
unsigned long CurrTxRateStableTime; /* # of second in current TX rate */
BOOLEAN fNoisyEnvironment;
BOOLEAN fLastSecAccordingRSSI;
u8 LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */
u8 LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */
unsigned long LastTxOkCount;
};
/***************************************************************************
* security key related data structure
**************************************************************************/
struct rt_cipher_key {
u8 Key[16]; /* right now we implement 4 keys, 128 bits max */
u8 RxMic[8]; /* make alignment */
u8 TxMic[8];
u8 TxTsc[6]; /* 48bit TSC value */
u8 RxTsc[6]; /* 48bit TSC value */
u8 CipherAlg; /* 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 */
u8 KeyLen;
u8 BssId[6];
/* Key length for each key, 0: entry is invalid */
u8 Type; /* Indicate Pairwise/Group when reporting MIC error */
};
/* structure to define WPA Group Key Rekey Interval */
struct PACKED rt_802_11_wpa_rekey {
unsigned long ReKeyMethod; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */
unsigned long ReKeyInterval; /* time-based: seconds, packet-based: kilo-packets */
};
#ifdef RTMP_MAC_USB
/***************************************************************************
* RTUSB I/O related data structure
**************************************************************************/
struct rt_set_asic_wcid {
unsigned long WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */
unsigned long SetTid; /* time-based: seconds, packet-based: kilo-packets */
unsigned long DeleteTid; /* time-based: seconds, packet-based: kilo-packets */
u8 Addr[MAC_ADDR_LEN]; /* avoid in interrupt when write key */
};
struct rt_set_asic_wcid_attri {
unsigned long WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */
unsigned long Cipher; /* ASIC Cipher definition */
u8 Addr[ETH_LENGTH_OF_ADDRESS];
};
/* for USB interface, avoid in interrupt when write key */
struct rt_add_pairwise_key_entry {
u8 MacAddr[6];
u16 MacTabMatchWCID; /* ASIC */
struct rt_cipher_key CipherKey;
};
/* Cipher suite type for mixed mode group cipher, P802.11i-2004 */
typedef enum _RT_802_11_CIPHER_SUITE_TYPE {
Cipher_Type_NONE,
Cipher_Type_WEP40,
Cipher_Type_TKIP,
Cipher_Type_RSVD,
Cipher_Type_CCMP,
Cipher_Type_WEP104
} RT_802_11_CIPHER_SUITE_TYPE, *PRT_802_11_CIPHER_SUITE_TYPE;
#endif /* RTMP_MAC_USB // */
struct rt_rogueap_entry {
u8 Addr[MAC_ADDR_LEN];
u8 ErrorCode[2]; /*00 01-Invalid authentication type */
/*00 02-Authentication timeout */
/*00 03-Challenge from AP failed */
/*00 04-Challenge to AP failed */
BOOLEAN Reported;
};
struct rt_rogueap_table {
u8 RogueApNr;
struct rt_rogueap_entry RogueApEntry[MAX_LEN_OF_BSS_TABLE];
};
/* */
/* Cisco IAPP format */
/* */
struct rt_cisco_iapp_content {
u16 Length; /*IAPP Length */
u8 MessageType; /*IAPP type */
u8 FunctionCode; /*IAPP function type */
u8 DestinaionMAC[MAC_ADDR_LEN];
u8 SourceMAC[MAC_ADDR_LEN];
u16 Tag; /*Tag(element IE) - Adjacent AP report */
u16 TagLength; /*Length of element not including 4 byte header */
u8 OUI[4]; /*0x00, 0x40, 0x96, 0x00 */
u8 PreviousAP[MAC_ADDR_LEN]; /*MAC Address of access point */
u16 Channel;
u16 SsidLen;
u8 Ssid[MAX_LEN_OF_SSID];
u16 Seconds; /*Seconds that the client has been disassociated. */
};
/*
* Fragment Frame structure
*/
struct rt_fragment_frame {
void *pFragPacket;
unsigned long RxSize;
u16 Sequence;
u16 LastFrag;
unsigned long Flags; /* Some extra frame information. bit 0: LLC presented */
};
/* */
/* Packet information for NdisQueryPacket */
/* */
struct rt_packet_info {
u32 PhysicalBufferCount; /* Physical breaks of buffer descriptor chained */
u32 BufferCount; /* Number of Buffer descriptor chained */
u32 TotalPacketLength; /* Self explained */
char *pFirstBuffer; /* Pointer to first buffer descriptor */
};
/* */
/* Arcfour Structure Added by PaulWu */
/* */
struct rt_arcfourcontext {
u32 X;
u32 Y;
u8 STATE[256];
};
/* */
/* Tkip Key structure which RC4 key & MIC calculation */
/* */
struct rt_tkip_key_info {
u32 nBytesInM; /* # bytes in M for MICKEY */
unsigned long IV16;
unsigned long IV32;
unsigned long K0; /* for MICKEY Low */
unsigned long K1; /* for MICKEY Hig */
unsigned long L; /* Current state for MICKEY */
unsigned long R; /* Current state for MICKEY */
unsigned long M; /* Message accumulator for MICKEY */
u8 RC4KEY[16];
u8 MIC[8];
};
/* */
/* Private / Misc data, counters for driver internal use */
/* */
struct rt_private {
u32 SystemResetCnt; /* System reset counter */
u32 TxRingFullCnt; /* Tx ring full occurrance number */
u32 PhyRxErrCnt; /* PHY Rx error count, for debug purpose, might move to global counter */
/* Variables for WEP encryption / decryption in rtmp_wep.c */
u32 FCSCRC32;
struct rt_arcfourcontext WEPCONTEXT;
/* Tkip stuff */
struct rt_tkip_key_info Tx;
struct rt_tkip_key_info Rx;
};
/***************************************************************************
* Channel and BBP related data structures
**************************************************************************/
/* structure to tune BBP R66 (BBP TUNING) */
struct rt_bbp_r66_tuning {
BOOLEAN bEnable;
u16 FalseCcaLowerThreshold; /* default 100 */
u16 FalseCcaUpperThreshold; /* default 512 */
u8 R66Delta;
u8 R66CurrentValue;
BOOLEAN R66LowerUpperSelect; /*Before LinkUp, Used LowerBound or UpperBound as R66 value. */
};
/* structure to store channel TX power */
struct rt_channel_tx_power {
u16 RemainingTimeForUse; /*unit: sec */
u8 Channel;
char Power;
char Power2;
u8 MaxTxPwr;
u8 DfsReq;
};
/* structure to store 802.11j channel TX power */
struct rt_channel_11j_tx_power {
u8 Channel;
u8 BW; /* BW_10 or BW_20 */
char Power;
char Power2;
u16 RemainingTimeForUse; /*unit: sec */
};
struct rt_soft_rx_ant_diversity {
u8 EvaluatePeriod; /* 0:not evalute status, 1: evaluate status, 2: switching status */
u8 EvaluateStableCnt;
u8 Pair1PrimaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */
u8 Pair1SecondaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */
u8 Pair2PrimaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */
u8 Pair2SecondaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */
short Pair1AvgRssi[2]; /* AvgRssi[0]:E1, AvgRssi[1]:E2 */
short Pair2AvgRssi[2]; /* AvgRssi[0]:E3, AvgRssi[1]:E4 */
short Pair1LastAvgRssi; /* */
short Pair2LastAvgRssi; /* */
unsigned long RcvPktNumWhenEvaluate;
BOOLEAN FirstPktArrivedWhenEvaluate;
struct rt_ralink_timer RxAntDiversityTimer;
};
/***************************************************************************
* structure for radar detection and channel switch
**************************************************************************/
struct rt_radar_detect {
/*BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h */
u8 CSCount; /*Channel switch counter */
u8 CSPeriod; /*Channel switch period (beacon count) */
u8 RDCount; /*Radar detection counter */
u8 RDMode; /*Radar Detection mode */
u8 RDDurRegion; /*Radar detection duration region */
u8 BBPR16;
u8 BBPR17;
u8 BBPR18;
u8 BBPR21;
u8 BBPR22;
u8 BBPR64;
unsigned long InServiceMonitorCount; /* unit: sec */
u8 DfsSessionTime;
BOOLEAN bFastDfs;
u8 ChMovingTime;
u8 LongPulseRadarTh;
};
typedef enum _ABGBAND_STATE_ {
UNKNOWN_BAND,
BG_BAND,
A_BAND,
} ABGBAND_STATE;
#ifdef RTMP_MAC_PCI
/* Power save method control */
typedef union _PS_CONTROL {
struct {
unsigned long EnablePSinIdle:1; /* Enable radio off when not connected to AP. radio on only when sitesurvey, */
unsigned long EnableNewPS:1; /* Enable new Chip power save function . New method can only be applied in chip version after 2872. and PCIe. */
unsigned long rt30xxPowerMode:2; /* Power Level Mode for rt30xx chip */
unsigned long rt30xxFollowHostASPM:1; /* Card Follows Host's setting for rt30xx chip. */
unsigned long rt30xxForceASPMTest:1; /* Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. */
unsigned long rsv:26; /* Radio Measurement Enable */
} field;
unsigned long word;
} PS_CONTROL, *PPS_CONTROL;
#endif /* RTMP_MAC_PCI // */
/***************************************************************************
* structure for MLME state machine
**************************************************************************/
struct rt_mlme {
/* STA state machines */
struct rt_state_machine CntlMachine;
struct rt_state_machine AssocMachine;
struct rt_state_machine AuthMachine;
struct rt_state_machine AuthRspMachine;
struct rt_state_machine SyncMachine;
struct rt_state_machine WpaPskMachine;
struct rt_state_machine LeapMachine;
STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE];
STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE];
STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE];
STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE];
STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE];
/* Action */
struct rt_state_machine ActMachine;
/* common WPA state machine */
struct rt_state_machine WpaMachine;
STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE];
unsigned long ChannelQuality; /* 0..100, Channel Quality Indication for Roaming */
unsigned long Now32; /* latch the value of NdisGetSystemUpTime() */
unsigned long LastSendNULLpsmTime;
BOOLEAN bRunning;
spinlock_t TaskLock;
struct rt_mlme_queue Queue;
u32 ShiftReg;
struct rt_ralink_timer PeriodicTimer;
struct rt_ralink_timer APSDPeriodicTimer;
struct rt_ralink_timer LinkDownTimer;
struct rt_ralink_timer LinkUpTimer;
#ifdef RTMP_MAC_PCI
u8 bPsPollTimerRunning;
struct rt_ralink_timer PsPollTimer;
struct rt_ralink_timer RadioOnOffTimer;
#endif /* RTMP_MAC_PCI // */
unsigned long PeriodicRound;
unsigned long OneSecPeriodicRound;
u8 RealRxPath;
BOOLEAN bLowThroughput;
BOOLEAN bEnableAutoAntennaCheck;
struct rt_ralink_timer RxAntEvalTimer;
#ifdef RT30xx
u8 CaliBW40RfR24;
u8 CaliBW20RfR24;
#endif /* RT30xx // */
#ifdef RTMP_MAC_USB
struct rt_ralink_timer AutoWakeupTimer;
BOOLEAN AutoWakeupTimerRunning;
#endif /* RTMP_MAC_USB // */
};
/***************************************************************************
* 802.11 N related data structures
**************************************************************************/
struct reordering_mpdu {
struct reordering_mpdu *next;
void *pPacket; /* coverted to 802.3 frame */
int Sequence; /* sequence number of MPDU */
BOOLEAN bAMSDU;
};
struct reordering_list {
struct reordering_mpdu *next;
int qlen;
};
struct reordering_mpdu_pool {
void *mem;
spinlock_t lock;
struct reordering_list freelist;
};
typedef enum _REC_BLOCKACK_STATUS {
Recipient_NONE = 0,
Recipient_USED,
Recipient_HandleRes,
Recipient_Accept
} REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS;
typedef enum _ORI_BLOCKACK_STATUS {
Originator_NONE = 0,
Originator_USED,
Originator_WaitRes,
Originator_Done
} ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS;
struct rt_ba_ori_entry {
u8 Wcid;
u8 TID;
u8 BAWinSize;
u8 Token;
/* Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header. */
u16 Sequence;
u16 TimeOutValue;
ORI_BLOCKACK_STATUS ORI_BA_Status;
struct rt_ralink_timer ORIBATimer;
void *pAdapter;
};
struct rt_ba_rec_entry {
u8 Wcid;
u8 TID;
u8 BAWinSize; /* 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. */
/*u8 NumOfRxPkt; */
/*u8 Curindidx; // the head in the RX reordering buffer */
u16 LastIndSeq;
/* u16 LastIndSeqAtTimer; */
u16 TimeOutValue;
struct rt_ralink_timer RECBATimer;
unsigned long LastIndSeqAtTimer;
unsigned long nDropPacket;
unsigned long rcvSeq;
REC_BLOCKACK_STATUS REC_BA_Status;
/* u8 RxBufIdxUsed; */
/* corresponding virtual address for RX reordering packet storage. */
/*RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; */
spinlock_t RxReRingLock; /* Rx Ring spinlock */
/* struct _BA_REC_ENTRY *pNext; */
void *pAdapter;
struct reordering_list list;
};
struct rt_ba_table {
unsigned long numAsRecipient; /* I am recipient of numAsRecipient clients. These client are in the BARecEntry[] */
unsigned long numAsOriginator; /* I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] */
unsigned long numDoneOriginator; /* count Done Originator sessions */
struct rt_ba_ori_entry BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE];
struct rt_ba_rec_entry BARecEntry[MAX_LEN_OF_BA_REC_TABLE];
};
/*For QureyBATableOID use; */
struct PACKED rt_oid_ba_rec_entry {
u8 MACAddr[MAC_ADDR_LEN];
u8 BaBitmap; /* if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize */
u8 rsv;
u8 BufSize[8];
REC_BLOCKACK_STATUS REC_BA_Status[8];
};
/*For QureyBATableOID use; */
struct PACKED rt_oid_ba_ori_entry {
u8 MACAddr[MAC_ADDR_LEN];
u8 BaBitmap; /* if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize, read ORI_BA_Status[TID] for status */
u8 rsv;
u8 BufSize[8];
ORI_BLOCKACK_STATUS ORI_BA_Status[8];
};
struct rt_queryba_table {
struct rt_oid_ba_ori_entry BAOriEntry[32];
struct rt_oid_ba_rec_entry BARecEntry[32];
u8 OriNum; /* Number of below BAOriEntry */
u8 RecNum; /* Number of below BARecEntry */
};
typedef union _BACAP_STRUC {
struct {
u32 RxBAWinLimit:8;
u32 TxBAWinLimit:8;
u32 AutoBA:1; /* automatically BA */
u32 Policy:2; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use */
u32 MpduDensity:3;
u32 AmsduEnable:1; /*Enable AMSDU transmisstion */
u32 AmsduSize:1; /* 0:3839, 1:7935 bytes. u32 MSDUSizeToBytes[] = { 3839, 7935}; */
u32 MMPSmode:2; /* MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable */
u32 bHtAdhoc:1; /* adhoc can use ht rate. */
u32 b2040CoexistScanSup:1; /*As Sta, support do 2040 coexistence scan for AP. As Ap, support monitor trigger event to check if can use BW 40MHz. */
u32: 4;
} field;
u32 word;
} BACAP_STRUC, *PBACAP_STRUC;
struct rt_oid_add_ba_entry {
BOOLEAN IsRecipient;
u8 MACAddr[MAC_ADDR_LEN];
u8 TID;
u8 nMSDU;
u16 TimeOut;
BOOLEAN bAllTid; /* If True, delete all TID for BA sessions with this MACaddr. */
};
#define IS_HT_STA(_pMacEntry) \
(_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX)
#define IS_HT_RATE(_pMacEntry) \
(_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
#define PEER_IS_HT_RATE(_pMacEntry) \
(_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX)
/*This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) */
struct rt_iot {
u8 Threshold[2];
u8 ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; /* compare with threshold[0] */
u8 RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; /* compare with threshold[1] */
unsigned long OneSecInWindowCount;
unsigned long OneSecFrameDuplicateCount;
unsigned long OneSecOutWindowCount;
u8 DelOriAct;
u8 DelRecAct;
u8 RTSShortProt;
u8 RTSLongProt;
BOOLEAN bRTSLongProtOn;
BOOLEAN bLastAtheros;
BOOLEAN bCurrentAtheros;
BOOLEAN bNowAtherosBurstOn;
BOOLEAN bNextDisableRxBA;
BOOLEAN bToggle;
};
/* This is the registry setting for 802.11n transmit setting. Used in advanced page. */
typedef union _REG_TRANSMIT_SETTING {
struct {
/*u32 PhyMode:4; */
/*u32 MCS:7; // MCS */
u32 rsv0:10;
u32 TxBF:1;
u32 BW:1; /*channel bandwidth 20MHz or 40 MHz */
u32 ShortGI:1;
u32 STBC:1; /*SPACE */
u32 TRANSNO:2;
u32 HTMODE:1;
u32 EXTCHA:2;
u32 rsv:13;
} field;
u32 word;
} REG_TRANSMIT_SETTING, *PREG_TRANSMIT_SETTING;
typedef union _DESIRED_TRANSMIT_SETTING {
struct {
u16 MCS:7; /* MCS */
u16 PhyMode:4;
u16 FixedTxMode:2; /* If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. */
u16 rsv:3;
} field;
u16 word;
} DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING;
#ifdef RTMP_MAC_USB
/***************************************************************************
* USB-based chip Beacon related data structures
**************************************************************************/
#define BEACON_BITMAP_MASK 0xff
struct rt_beacon_sync {
u8 BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET];
u8 BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE];
unsigned long TimIELocationInBeacon[HW_BEACON_MAX_COUNT];
unsigned long CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT];
BOOLEAN EnableBeacon; /* trigger to enable beacon transmission. */
u8 BeaconBitMap; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter needs to change. */
u8 DtimBitOn; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter needs to change. */
};
#endif /* RTMP_MAC_USB // */
/***************************************************************************
* Multiple SSID related data structures
**************************************************************************/
#define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */
#define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */
/* clear bcmc TIM bit */
#define WLAN_MR_TIM_BCMC_CLEAR(apidx) \
pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] &= ~BIT8[0];
/* set bcmc TIM bit */
#define WLAN_MR_TIM_BCMC_SET(apidx) \
pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] |= BIT8[0];
/* clear a station PS TIM bit */
#define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, wcid) \
{ u8 tim_offset = wcid >> 3; \
u8 bit_offset = wcid & 0x7; \
ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); }
/* set a station PS TIM bit */
#define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \
{ u8 tim_offset = wcid >> 3; \
u8 bit_offset = wcid & 0x7; \
ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; }
/* configuration common to OPMODE_AP as well as OPMODE_STA */
struct rt_common_config {
BOOLEAN bCountryFlag;
u8 CountryCode[3];
u8 Geography;
u8 CountryRegion; /* Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel */
u8 CountryRegionForABand; /* Enum of country region for A band */
u8 PhyMode; /* PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED */
u16 Dsifs; /* in units of usec */
unsigned long PacketFilter; /* Packet filter for receiving */
u8 RegulatoryClass;
char Ssid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */
u8 SsidLen; /* the actual ssid length in used */
u8 LastSsidLen; /* the actual ssid length in used */
char LastSsid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */
u8 LastBssid[MAC_ADDR_LEN];
u8 Bssid[MAC_ADDR_LEN];
u16 BeaconPeriod;
u8 Channel;
u8 CentralChannel; /* Central Channel when using 40MHz is indicating. not real channel. */
u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES];
u8 SupRateLen;
u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
u8 ExtRateLen;
u8 DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; /* OID_802_11_DESIRED_RATES */
u8 MaxDesiredRate;
u8 ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES];
unsigned long BasicRateBitmap; /* backup basic ratebitmap */
BOOLEAN bAPSDCapable;
BOOLEAN bInServicePeriod;
BOOLEAN bAPSDAC_BE;
BOOLEAN bAPSDAC_BK;
BOOLEAN bAPSDAC_VI;
BOOLEAN bAPSDAC_VO;
/* because TSPEC can modify the APSD flag, we need to keep the APSD flag
requested in association stage from the station;
we need to recover the APSD flag after the TSPEC is deleted. */
BOOLEAN bACMAPSDBackup[4]; /* for delivery-enabled & trigger-enabled both */
BOOLEAN bACMAPSDTr[4]; /* no use */
BOOLEAN bNeedSendTriggerFrame;
BOOLEAN bAPSDForcePowerSave; /* Force power save mode, should only use in APSD-STAUT */
unsigned long TriggerTimerCount;
u8 MaxSPLength;
u8 BBPCurrentBW; /* BW_10, BW_20, BW_40 */
/* move to MULTISSID_STRUCT for MBSS */
/*HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. */
REG_TRANSMIT_SETTING RegTransmitSetting; /*registry transmit setting. this is for reading registry setting only. not useful. */
/*u8 FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode */
u8 TxRate; /* Same value to fill in TXD. TxRate is 6-bit */
u8 MaxTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */
u8 TxRateIndex; /* Tx rate index in RateSwitchTable */
u8 TxRateTableSize; /* Valid Tx rate table size in RateSwitchTable */
/*BOOLEAN bAutoTxRateSwitch; */
u8 MinTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */
u8 RtsRate; /* RATE_xxx */
HTTRANSMIT_SETTING MlmeTransmit; /* MGMT frame PHY rate setting when operation at Ht rate. */
u8 MlmeRate; /* RATE_xxx, used to send MLME frames */
u8 BasicMlmeRate; /* Default Rate for sending MLME frames */
u16 RtsThreshold; /* in unit of BYTE */
u16 FragmentThreshold; /* in unit of BYTE */
u8 TxPower; /* in unit of mW */
unsigned long TxPowerPercentage; /* 0~100 % */
unsigned long TxPowerDefault; /* keep for TxPowerPercentage */
u8 PwrConstraint;
BACAP_STRUC BACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */
BACAP_STRUC REGBACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */
struct rt_iot IOTestParm; /* 802.11n InterOpbility Test Parameter; */
unsigned long TxPreamble; /* Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto */
BOOLEAN bUseZeroToDisableFragment; /* Microsoft use 0 as disable */
unsigned long UseBGProtection; /* 0: auto, 1: always use, 2: always not use */
BOOLEAN bUseShortSlotTime; /* 0: disable, 1 - use short slot (9us) */
BOOLEAN bEnableTxBurst; /* 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST */
BOOLEAN bAggregationCapable; /* 1: enable TX aggregation when the peer supports it */
BOOLEAN bPiggyBackCapable; /* 1: enable TX piggy-back according MAC's version */
BOOLEAN bIEEE80211H; /* 1: enable IEEE802.11h spec. */
unsigned long DisableOLBCDetect; /* 0: enable OLBC detect; 1 disable OLBC detect */
BOOLEAN bRdg;
BOOLEAN bWmmCapable; /* 0:disable WMM, 1:enable WMM */
struct rt_qos_capability_parm APQosCapability; /* QOS capability of the current associated AP */
struct rt_edca_parm APEdcaParm; /* EDCA parameters of the current associated AP */
struct rt_qbss_load_parm APQbssLoad; /* QBSS load of the current associated AP */
u8 AckPolicy[4]; /* ACK policy of the specified AC. see ACK_xxx */
BOOLEAN bDLSCapable; /* 0:disable DLS, 1:enable DLS */
/* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */
/* BOOLEAN control, either ON or OFF. These flags should always be accessed via */
/* OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. */
/* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition */
unsigned long OpStatusFlags;
BOOLEAN NdisRadioStateOff; /*For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. */
ABGBAND_STATE BandState; /* For setting BBP used on B/G or A mode. */
/* IEEE802.11H--DFS. */
struct rt_radar_detect RadarDetect;
/* HT */
u8 BASize; /* USer desired BAWindowSize. Should not exceed our max capability */
/*struct rt_ht_capability SupportedHtPhy; */
struct rt_ht_capability DesiredHtPhy;
struct rt_ht_capability_ie HtCapability;
struct rt_add_ht_info_ie AddHTInfo; /* Useful as AP. */
/*This IE is used with channel switch announcement element when changing to a new 40MHz. */
/*This IE is included in channel switch announcement frames 7.4.1.5, beacons, probe Rsp. */
struct rt_new_ext_chan_ie NewExtChanOffset; /*7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present */
BOOLEAN bHTProtect;
BOOLEAN bMIMOPSEnable;
BOOLEAN bBADecline;
/*2008/11/05: KH add to support Antenna power-saving of AP<-- */
BOOLEAN bGreenAPEnable;
/*2008/11/05: KH add to support Antenna power-saving of AP--> */
BOOLEAN bDisableReordering;
BOOLEAN bForty_Mhz_Intolerant;
BOOLEAN bExtChannelSwitchAnnouncement;
BOOLEAN bRcvBSSWidthTriggerEvents;
unsigned long LastRcvBSSWidthTriggerEventsTime;
u8 TxBASize;
/* Enable wireless event */
BOOLEAN bWirelessEvent;
BOOLEAN bWiFiTest; /* Enable this parameter for WiFi test */
/* Tx & Rx Stream number selection */
u8 TxStream;
u8 RxStream;
BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */
#ifdef RTMP_MAC_USB
BOOLEAN bMultipleIRP; /* Multiple Bulk IN flag */
u8 NumOfBulkInIRP; /* if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 */
struct rt_ht_capability SupportedHtPhy;
unsigned long MaxPktOneTxBulk;
u8 TxBulkFactor;
u8 RxBulkFactor;
BOOLEAN IsUpdateBeacon;
struct rt_beacon_sync *pBeaconSync;
struct rt_ralink_timer BeaconUpdateTimer;
u32 BeaconAdjust;
u32 BeaconFactor;
u32 BeaconRemain;
#endif /* RTMP_MAC_USB // */
spinlock_t MeasureReqTabLock;
struct rt_measure_req_tab *pMeasureReqTab;
spinlock_t TpcReqTabLock;
struct rt_tpc_req_tab *pTpcReqTab;
BOOLEAN PSPXlink; /* 0: Disable. 1: Enable */
#if defined(RT305x) || defined(RT30xx)
/* request by Gary, for High Power issue */
u8 HighPowerPatchDisabled;
#endif
BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */
};
/* Modified by Wu Xi-Kun 4/21/2006 */
/* STA configuration and status */
struct rt_sta_admin_config {
/* GROUP 1 - */
/* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */
/* the user intended configuration, but not necessary fully equal to the final */
/* settings in ACTIVE BSS after negotiation/compromise with the BSS holder (either */
/* AP or IBSS holder). */
/* Once initialized, user configuration can only be changed via OID_xxx */
u8 BssType; /* BSS_INFRA or BSS_ADHOC */
u16 AtimWin; /* used when starting a new IBSS */
/* GROUP 2 - */
/* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */
/* the user intended configuration, and should be always applied to the final */
/* settings in ACTIVE BSS without compromising with the BSS holder. */
/* Once initialized, user configuration can only be changed via OID_xxx */
u8 RssiTrigger;
u8 RssiTriggerMode; /* RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD */
u16 DefaultListenCount; /* default listen count; */
unsigned long WindowsPowerMode; /* Power mode for AC power */
unsigned long WindowsBatteryPowerMode; /* Power mode for battery if exists */
BOOLEAN bWindowsACCAMEnable; /* Enable CAM power mode when AC on */
BOOLEAN bAutoReconnect; /* Set to TRUE when setting OID_802_11_SSID with no matching BSSID */
unsigned long WindowsPowerProfile; /* Windows power profile, for NDIS5.1 PnP */
/* MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1) */
u16 Psm; /* power management mode (PWR_ACTIVE|PWR_SAVE) */
u16 DisassocReason;
u8 DisassocSta[MAC_ADDR_LEN];
u16 DeauthReason;
u8 DeauthSta[MAC_ADDR_LEN];
u16 AuthFailReason;
u8 AuthFailSta[MAC_ADDR_LEN];
NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */
NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */
NDIS_802_11_WEP_STATUS WepStatus;
NDIS_802_11_WEP_STATUS OrigWepStatus; /* Original wep status set from OID */
/* Add to support different cipher suite for WPA2/WPA mode */
NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Multicast cipher suite */
NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher suite */
BOOLEAN bMixCipher; /* Indicate current Pair & Group use different cipher suites */
u16 RsnCapability;
NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
u8 WpaPassPhrase[64]; /* WPA PSK pass phrase */
u32 WpaPassPhraseLen; /* the length of WPA PSK pass phrase */
u8 PMK[32]; /* WPA PSK mode PMK */
u8 PTK[64]; /* WPA PSK mode PTK */
u8 GTK[32]; /* GTK from authenticator */
struct rt_bssid_info SavedPMK[PMKID_NO];
u32 SavedPMKNum; /* Saved PMKID number */
u8 DefaultKeyId;
/* WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED */
u8 PortSecured;
/* For WPA countermeasures */
unsigned long LastMicErrorTime; /* record last MIC error time */
unsigned long MicErrCnt; /* Should be 0, 1, 2, then reset to zero (after disassociation). */
BOOLEAN bBlockAssoc; /* Block associate attempt for 60 seconds after counter measure occurred. */
/* For WPA-PSK supplicant state */
WPA_STATE WpaState; /* Default is SS_NOTUSE and handled by microsoft 802.1x */
u8 ReplayCounter[8];
u8 ANonce[32]; /* ANonce for WPA-PSK from auhenticator */
u8 SNonce[32]; /* SNonce for WPA-PSK */
u8 LastSNR0; /* last received BEACON's SNR */
u8 LastSNR1; /* last received BEACON's SNR for 2nd antenna */
struct rt_rssi_sample RssiSample;
unsigned long NumOfAvgRssiSample;
unsigned long LastBeaconRxTime; /* OS's timestamp of the last BEACON RX time */
unsigned long Last11bBeaconRxTime; /* OS's timestamp of the last 11B BEACON RX time */
unsigned long Last11gBeaconRxTime; /* OS's timestamp of the last 11G BEACON RX time */
unsigned long Last20NBeaconRxTime; /* OS's timestamp of the last 20MHz N BEACON RX time */
unsigned long LastScanTime; /* Record last scan time for issue BSSID_SCAN_LIST */
unsigned long ScanCnt; /* Scan counts since most recent SSID, BSSID, SCAN OID request */
BOOLEAN bSwRadio; /* Software controlled Radio On/Off, TRUE: On */
BOOLEAN bHwRadio; /* Hardware controlled Radio On/Off, TRUE: On */
BOOLEAN bRadio; /* Radio state, And of Sw & Hw radio state */
BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */
BOOLEAN bShowHiddenSSID; /* Show all known SSID in SSID list get operation */
/* New for WPA, windows want us to keep association information and */
/* Fixed IEs from last association response */
struct rt_ndis_802_11_association_information AssocInfo;
u16 ReqVarIELen; /* Length of next VIE include EID & Length */
u8 ReqVarIEs[MAX_VIE_LEN]; /* The content saved here should be little-endian format. */
u16 ResVarIELen; /* Length of next VIE include EID & Length */
u8 ResVarIEs[MAX_VIE_LEN];
u8 RSNIE_Len;
u8 RSN_IE[MAX_LEN_OF_RSNIE]; /* The content saved here should be little-endian format. */
unsigned long CLBusyBytes; /* Save the total bytes received during channel load scan time */
u16 RPIDensity[8]; /* Array for RPI density collection */
u8 RMReqCnt; /* Number of measurement request saved. */
u8 CurrentRMReqIdx; /* Number of measurement request saved. */
BOOLEAN ParallelReq; /* Parallel measurement, only one request performed, */
/* It must be the same channel with maximum duration */
u16 ParallelDuration; /* Maximum duration for parallel measurement */
u8 ParallelChannel; /* Only one channel with parallel measurement */
u16 IAPPToken; /* IAPP dialog token */
/* Hack for channel load and noise histogram parameters */
u8 NHFactor; /* Parameter for Noise histogram */
u8 CLFactor; /* Parameter for channel load */
struct rt_ralink_timer StaQuickResponeForRateUpTimer;
BOOLEAN StaQuickResponeForRateUpTimerRunning;
u8 DtimCount; /* 0.. DtimPeriod-1 */
u8 DtimPeriod; /* default = 3 */
/*////////////////////////////////////////////////////////////////////////////////////// */
/* This is only for WHQL test. */
BOOLEAN WhqlTest;
/*////////////////////////////////////////////////////////////////////////////////////// */
struct rt_ralink_timer WpaDisassocAndBlockAssocTimer;
/* Fast Roaming */
BOOLEAN bAutoRoaming; /* 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI */
char dBmToRoam; /* the condition to roam when receiving Rssi less than this value. It's negative value. */
BOOLEAN IEEE8021X;
BOOLEAN IEEE8021x_required_keys;
struct rt_cipher_key DesireSharedKey[4]; /* Record user desired WEP keys */
u8 DesireSharedKeyId;
/* 0: driver ignores wpa_supplicant */
/* 1: wpa_supplicant initiates scanning and AP selection */
/* 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters */
u8 WpaSupplicantUP;
u8 WpaSupplicantScanCount;
BOOLEAN bRSN_IE_FromWpaSupplicant;
char dev_name[16];
u16 OriDevType;
BOOLEAN bTGnWifiTest;
BOOLEAN bScanReqIsFromWebUI;
HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */
DESIRED_TRANSMIT_SETTING DesiredTransmitSetting;
struct rt_ht_phy_info DesiredHtPhyInfo;
BOOLEAN bAutoTxRateSwitch;
#ifdef RTMP_MAC_PCI
u8 BBPR3;
/* PS Control has 2 meanings for advanced power save function. */
/* 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. */
/* 2. EnableNewPS : will save more current in sleep or radio off mode. */
PS_CONTROL PSControl;
#endif /* RTMP_MAC_PCI // */
BOOLEAN bAutoConnectByBssid;
unsigned long BeaconLostTime; /* seconds */
BOOLEAN bForceTxBurst; /* 1: force enble TX PACKET BURST, 0: disable */
};
/* This data structure keeps the current active BSS/IBSS's configuration that this STA */
/* had agreed upon joining the network. Which means these parameters are usually decided */
/* by the BSS/IBSS creator instead of user configuration. Data in this data structure */
/* is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE. */
/* Normally, after SCAN or failed roaming attempts, we need to recover back to */
/* the current active settings. */
struct rt_sta_active_config {
u16 Aid;
u16 AtimWin; /* in kusec; IBSS parameter set element */
u16 CapabilityInfo;
u16 CfpMaxDuration;
u16 CfpPeriod;
/* Copy supported rate from desired AP's beacon. We are trying to match */
/* AP's supported and extended rate settings. */
u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES];
u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
u8 SupRateLen;
u8 ExtRateLen;
/* Copy supported ht from desired AP's beacon. We are trying to match */
struct rt_ht_phy_info SupportedPhyInfo;
struct rt_ht_capability SupportedHtPhy;
};
struct rt_mac_table_entry;
struct rt_mac_table_entry {
/*Choose 1 from ValidAsWDS and ValidAsCLI to validize. */
BOOLEAN ValidAsCLI; /* Sta mode, set this TRUE after Linkup,too. */
BOOLEAN ValidAsWDS; /* This is WDS Entry. only for AP mode. */
BOOLEAN ValidAsApCli; /* This is a AP-Client entry, only for AP mode which enable AP-Client functions. */
BOOLEAN ValidAsMesh;
BOOLEAN ValidAsDls; /* This is DLS Entry. only for STA mode. */
BOOLEAN isCached;
BOOLEAN bIAmBadAtheros; /* Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. */
u8 EnqueueEapolStartTimerRunning; /* Enqueue EAPoL-Start for triggering EAP SM */
/*jan for wpa */
/* record which entry revoke MIC Failure, if it leaves the BSS itself, AP won't update aMICFailTime MIB */
u8 CMTimerRunning;
u8 apidx; /* MBSS number */
u8 RSNIE_Len;
u8 RSN_IE[MAX_LEN_OF_RSNIE];
u8 ANonce[LEN_KEY_DESC_NONCE];
u8 SNonce[LEN_KEY_DESC_NONCE];
u8 R_Counter[LEN_KEY_DESC_REPLAY];
u8 PTK[64];
u8 ReTryCounter;
struct rt_ralink_timer RetryTimer;
struct rt_ralink_timer EnqueueStartForPSKTimer; /* A timer which enqueue EAPoL-Start for triggering PSK SM */
NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */
NDIS_802_11_WEP_STATUS WepStatus;
NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
AP_WPA_STATE WpaState;
GTK_STATE GTKState;
u16 PortSecured;
NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */
struct rt_cipher_key PairwiseKey;
void *pAd;
int PMKID_CacheIdx;
u8 PMKID[LEN_PMKID];
u8 Addr[MAC_ADDR_LEN];
u8 PsMode;
SST Sst;
AUTH_STATE AuthState; /* for SHARED KEY authentication state machine used only */
BOOLEAN IsReassocSta; /* Indicate whether this is a reassociation procedure */
u16 Aid;
u16 CapabilityInfo;
u8 LastRssi;
unsigned long NoDataIdleCount;
u16 StationKeepAliveCount; /* unit: second */
unsigned long PsQIdleCount;
struct rt_queue_header PsQueue;
u32 StaConnectTime; /* the live time of this station since associated with AP */
BOOLEAN bSendBAR;
u16 NoBADataCountDown;
u32 CachedBuf[16]; /* u32 (4 bytes) for alignment */
u32 TxBFCount; /* 3*3 */
u32 FIFOCount;
u32 DebugFIFOCount;
u32 DebugTxCount;
BOOLEAN bDlsInit;
/*==================================================== */
/*WDS entry needs these */
/* if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab */
u32 MatchWDSTabIdx;
u8 MaxSupportedRate;
u8 CurrTxRate;
u8 CurrTxRateIndex;
/* to record the each TX rate's quality. 0 is best, the bigger the worse. */
u16 TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
/* u16 OneSecTxOkCount; */
u32 OneSecTxNoRetryOkCount;
u32 OneSecTxRetryOkCount;
u32 OneSecTxFailCount;
u32 ContinueTxFailCnt;
u32 CurrTxRateStableTime; /* # of second in current TX rate */
u8 TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */
/*==================================================== */
BOOLEAN fNoisyEnvironment;
BOOLEAN fLastSecAccordingRSSI;
u8 LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */
char LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */
unsigned long LastTxOkCount;
u8 PER[MAX_STEP_OF_TX_RATE_SWITCH];
/* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */
/* BOOLEAN control, either ON or OFF. These flags should always be accessed via */
/* CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. */
/* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED */
unsigned long ClientStatusFlags;
HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */
/* HT EWC MIMO-N used parameters */
u16 RXBAbitmap; /* fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format */
u16 TXBAbitmap; /* This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI */
u16 TXAutoBAbitmap;
u16 BADeclineBitmap;
u16 BARecWcidArray[NUM_OF_TID]; /* The mapping wcid of recipient session. if RXBAbitmap bit is masked */
u16 BAOriWcidArray[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */
u16 BAOriSequence[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */
/* 802.11n features. */
u8 MpduDensity;
u8 MaxRAmpduFactor;
u8 AMsduSize;
u8 MmpsMode; /* MIMO power save more. */
struct rt_ht_capability_ie HTCapability;
BOOLEAN bAutoTxRateSwitch;
u8 RateLen;
struct rt_mac_table_entry *pNext;
u16 TxSeq[NUM_OF_TID];
u16 NonQosDataSeq;
struct rt_rssi_sample RssiSample;
u32 TXMCSExpected[16];
u32 TXMCSSuccessful[16];
u32 TXMCSFailed[16];
u32 TXMCSAutoFallBack[16][16];
unsigned long LastBeaconRxTime;
unsigned long AssocDeadLine;
};
struct rt_mac_table {
u16 Size;
struct rt_mac_table_entry *Hash[HASH_TABLE_SIZE];
struct rt_mac_table_entry Content[MAX_LEN_OF_MAC_TABLE];
struct rt_queue_header McastPsQueue;
unsigned long PsQIdleCount;
BOOLEAN fAnyStationInPsm;
BOOLEAN fAnyStationBadAtheros; /* Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. */
BOOLEAN fAnyTxOPForceDisable; /* Check if it is necessary to disable BE TxOP */
BOOLEAN fAllStationAsRalink; /* Check if all stations are ralink-chipset */
BOOLEAN fAnyStationIsLegacy; /* Check if I use legacy rate to transmit to my BSS Station/ */
BOOLEAN fAnyStationNonGF; /* Check if any Station can't support GF. */
BOOLEAN fAnyStation20Only; /* Check if any Station can't support GF. */
BOOLEAN fAnyStationMIMOPSDynamic; /* Check if any Station is MIMO Dynamic */
BOOLEAN fAnyBASession; /* Check if there is BA session. Force turn on RTS/CTS */
/*2008/10/28: KH add to support Antenna power-saving of AP<-- */
/*2008/10/28: KH add to support Antenna power-saving of AP--> */
};
struct wificonf {
BOOLEAN bShortGI;
BOOLEAN bGreenField;
};
struct rt_rtmp_dev_info {
u8 chipName[16];
RTMP_INF_TYPE infType;
};
struct rt_rtmp_chip_op {
/* Calibration access related callback functions */
int (*eeinit) (struct rt_rtmp_adapter *pAd); /* int (*eeinit)(struct rt_rtmp_adapter *pAd); */
int (*eeread) (struct rt_rtmp_adapter *pAd, u16 offset, u16 *pValue); /* int (*eeread)(struct rt_rtmp_adapter *pAd, int offset, u16 *pValue); */
/* MCU related callback functions */
int (*loadFirmware) (struct rt_rtmp_adapter *pAd); /* int (*loadFirmware)(struct rt_rtmp_adapter *pAd); */
int (*eraseFirmware) (struct rt_rtmp_adapter *pAd); /* int (*eraseFirmware)(struct rt_rtmp_adapter *pAd); */
int (*sendCommandToMcu) (struct rt_rtmp_adapter *pAd, u8 cmd, u8 token, u8 arg0, u8 arg1);; /* int (*sendCommandToMcu)(struct rt_rtmp_adapter *pAd, u8 cmd, u8 token, u8 arg0, u8 arg1); */
/* RF access related callback functions */
struct rt_reg_pair *pRFRegTable;
void (*AsicRfInit) (struct rt_rtmp_adapter *pAd);
void (*AsicRfTurnOn) (struct rt_rtmp_adapter *pAd);
void (*AsicRfTurnOff) (struct rt_rtmp_adapter *pAd);
void (*AsicReverseRfFromSleepMode) (struct rt_rtmp_adapter *pAd);
void (*AsicHaltAction) (struct rt_rtmp_adapter *pAd);
};
/* */
/* The miniport adapter structure */
/* */
struct rt_rtmp_adapter {
void *OS_Cookie; /* save specific structure relative to OS */
struct net_device *net_dev;
unsigned long VirtualIfCnt;
const struct firmware *firmware;
struct rt_rtmp_chip_op chipOps;
u16 ThisTbttNumToNextWakeUp;
#ifdef RTMP_MAC_PCI
/*****************************************************************************************/
/* PCI related parameters */
/*****************************************************************************************/
u8 *CSRBaseAddress; /* PCI MMIO Base Address, all access will use */
unsigned int irq_num;
u16 LnkCtrlBitMask;
u16 RLnkCtrlConfiguration;
u16 RLnkCtrlOffset;
u16 HostLnkCtrlConfiguration;
u16 HostLnkCtrlOffset;
u16 PCIePowerSaveLevel;
unsigned long Rt3xxHostLinkCtrl; /* USed for 3090F chip */
unsigned long Rt3xxRalinkLinkCtrl; /* USed for 3090F chip */
u16 DeviceID; /* Read from PCI config */
unsigned long AccessBBPFailCount;
BOOLEAN bPCIclkOff; /* flag that indicates if the PICE power status in Configuration Space.. */
BOOLEAN bPCIclkOffDisableTx; /* */
BOOLEAN brt30xxBanMcuCmd; /*when = 0xff means all commands are ok to set . */
BOOLEAN b3090ESpecialChip; /*3090E special chip that write EEPROM 0x24=0x9280. */
unsigned long CheckDmaBusyCount; /* Check Interrupt Status Register Count. */
u32 int_enable_reg;
u32 int_disable_mask;
u32 int_pending;
struct rt_rtmp_dmabuf TxBufSpace[NUM_OF_TX_RING]; /* Shared memory of all 1st pre-allocated TxBuf associated with each TXD */
struct rt_rtmp_dmabuf RxDescRing; /* Shared memory for RX descriptors */
struct rt_rtmp_dmabuf TxDescRing[NUM_OF_TX_RING]; /* Shared memory for Tx descriptors */
struct rt_rtmp_tx_ring TxRing[NUM_OF_TX_RING]; /* AC0~4 + HCCA */
#endif /* RTMP_MAC_PCI // */
spinlock_t irq_lock;
u8 irq_disabled;
#ifdef RTMP_MAC_USB
/*****************************************************************************************/
/* USB related parameters */
/*****************************************************************************************/
struct usb_config_descriptor *config;
u32 BulkInEpAddr; /* bulk-in endpoint address */
u32 BulkOutEpAddr[6]; /* bulk-out endpoint address */
u32 NumberOfPipes;
u16 BulkOutMaxPacketSize;
u16 BulkInMaxPacketSize;
/*======Control Flags */
long PendingIoCount;
unsigned long BulkFlags;
BOOLEAN bUsbTxBulkAggre; /* Flags for bulk out data priority */
/*======Cmd Thread */
struct rt_cmdq CmdQ;
spinlock_t CmdQLock; /* CmdQLock spinlock */
struct rt_rtmp_os_task cmdQTask;
/*======Semaphores (event) */
struct semaphore UsbVendorReq_semaphore;
void *UsbVendorReqBuf;
wait_queue_head_t *wait;
#endif /* RTMP_MAC_USB // */
/*****************************************************************************************/
/* RBUS related parameters */
/*****************************************************************************************/
/*****************************************************************************************/
/* Both PCI/USB related parameters */
/*****************************************************************************************/
/*struct rt_rtmp_dev_info chipInfo; */
RTMP_INF_TYPE infType;
/*****************************************************************************************/
/* Driver Mgmt related parameters */
/*****************************************************************************************/
struct rt_rtmp_os_task mlmeTask;
#ifdef RTMP_TIMER_TASK_SUPPORT
/* If you want use timer task to handle the timer related jobs, enable this. */
struct rt_rtmp_timer_task_queue TimerQ;
spinlock_t TimerQLock;
struct rt_rtmp_os_task timerTask;
#endif /* RTMP_TIMER_TASK_SUPPORT // */
/*****************************************************************************************/
/* Tx related parameters */
/*****************************************************************************************/
BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; /* for ensuring RTUSBDeQueuePacket get call once */
spinlock_t DeQueueLock[NUM_OF_TX_RING];
#ifdef RTMP_MAC_USB
/* Data related context and AC specified, 4 AC supported */
spinlock_t BulkOutLock[6]; /* BulkOut spinlock for 4 ACs */
spinlock_t MLMEBulkOutLock; /* MLME BulkOut lock */
struct rt_ht_tx_context TxContext[NUM_OF_TX_RING];
spinlock_t TxContextQueueLock[NUM_OF_TX_RING]; /* TxContextQueue spinlock */
/* 4 sets of Bulk Out index and pending flag */
u8 NextBulkOutIndex[4]; /* only used for 4 EDCA bulkout pipe */
BOOLEAN BulkOutPending[6]; /* used for total 6 bulkout pipe */
u8 bulkResetPipeid;
BOOLEAN MgmtBulkPending;
unsigned long bulkResetReq[6];
#endif /* RTMP_MAC_USB // */
/* resource for software backlog queues */
struct rt_queue_header TxSwQueue[NUM_OF_TX_RING]; /* 4 AC + 1 HCCA */
spinlock_t TxSwQueueLock[NUM_OF_TX_RING]; /* TxSwQueue spinlock */
struct rt_rtmp_dmabuf MgmtDescRing; /* Shared memory for MGMT descriptors */
struct rt_rtmp_mgmt_ring MgmtRing;
spinlock_t MgmtRingLock; /* Prio Ring spinlock */
/*****************************************************************************************/
/* Rx related parameters */
/*****************************************************************************************/
#ifdef RTMP_MAC_PCI
struct rt_rtmp_rx_ring RxRing;
spinlock_t RxRingLock; /* Rx Ring spinlock */
#ifdef RT3090
spinlock_t McuCmdLock; /*MCU Command Queue spinlock */
#endif /* RT3090 // */
#endif /* RTMP_MAC_PCI // */
#ifdef RTMP_MAC_USB
struct rt_rx_context RxContext[RX_RING_SIZE]; /* 1 for redundant multiple IRP bulk in. */
spinlock_t BulkInLock; /* BulkIn spinlock for 4 ACs */
u8 PendingRx; /* The Maximum pending Rx value should be RX_RING_SIZE. */
u8 NextRxBulkInIndex; /* Indicate the current RxContext Index which hold by Host controller. */
u8 NextRxBulkInReadIndex; /* Indicate the current RxContext Index which driver can read & process it. */
unsigned long NextRxBulkInPosition; /* Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. */
unsigned long TransferBufferLength; /* current length of the packet buffer */
unsigned long ReadPosition; /* current read position in a packet buffer */
#endif /* RTMP_MAC_USB // */
/*****************************************************************************************/
/* ASIC related parameters */
/*****************************************************************************************/
u32 MACVersion; /* MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. */
/* --------------------------- */
/* E2PROM */
/* --------------------------- */
unsigned long EepromVersion; /* byte 0: version, byte 1: revision, byte 2~3: unused */
unsigned long FirmwareVersion; /* byte 0: Minor version, byte 1: Major version, otherwise unused. */
u16 EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS];
u8 EEPROMAddressNum; /* 93c46=6 93c66=8 */
BOOLEAN EepromAccess;
u8 EFuseTag;
/* --------------------------- */
/* BBP Control */
/* --------------------------- */
u8 BbpWriteLatch[140]; /* record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID */
char BbpRssiToDbmDelta; /* change from u8 to char for high power */
struct rt_bbp_r66_tuning BbpTuning;
/* ---------------------------- */
/* RFIC control */
/* ---------------------------- */
u8 RfIcType; /* RFIC_xxx */
unsigned long RfFreqOffset; /* Frequency offset for channel switching */
struct rt_rtmp_rf_regs LatchRfRegs; /* latch the latest RF programming value since RF IC doesn't support READ */
EEPROM_ANTENNA_STRUC Antenna; /* Since Antenna definition is different for a & g. We need to save it for future reference. */
EEPROM_NIC_CONFIG2_STRUC NicConfig2;
/* This soft Rx Antenna Diversity mechanism is used only when user set */
/* RX Antenna = DIVERSITY ON */
struct rt_soft_rx_ant_diversity RxAnt;
u8 RFProgSeq;
struct rt_channel_tx_power TxPower[MAX_NUM_OF_CHANNELS]; /* Store Tx power value for all channels. */
struct rt_channel_tx_power ChannelList[MAX_NUM_OF_CHANNELS]; /* list all supported channels for site survey */
struct rt_channel_11j_tx_power TxPower11J[MAX_NUM_OF_11JCHANNELS]; /* 802.11j channel and bw */
struct rt_channel_11j_tx_power ChannelList11J[MAX_NUM_OF_11JCHANNELS]; /* list all supported channels for site survey */
u8 ChannelListNum; /* number of channel in ChannelList[] */
u8 Bbp94;
BOOLEAN BbpForCCK;
unsigned long Tx20MPwrCfgABand[5];
unsigned long Tx20MPwrCfgGBand[5];
unsigned long Tx40MPwrCfgABand[5];
unsigned long Tx40MPwrCfgGBand[5];
BOOLEAN bAutoTxAgcA; /* Enable driver auto Tx Agc control */
u8 TssiRefA; /* Store Tssi reference value as 25 temperature. */
u8 TssiPlusBoundaryA[5]; /* Tssi boundary for increase Tx power to compensate. */
u8 TssiMinusBoundaryA[5]; /* Tssi boundary for decrease Tx power to compensate. */
u8 TxAgcStepA; /* Store Tx TSSI delta increment / decrement value */
char TxAgcCompensateA; /* Store the compensation (TxAgcStep * (idx-1)) */
BOOLEAN bAutoTxAgcG; /* Enable driver auto Tx Agc control */
u8 TssiRefG; /* Store Tssi reference value as 25 temperature. */
u8 TssiPlusBoundaryG[5]; /* Tssi boundary for increase Tx power to compensate. */
u8 TssiMinusBoundaryG[5]; /* Tssi boundary for decrease Tx power to compensate. */
u8 TxAgcStepG; /* Store Tx TSSI delta increment / decrement value */
char TxAgcCompensateG; /* Store the compensation (TxAgcStep * (idx-1)) */
char BGRssiOffset0; /* Store B/G RSSI#0 Offset value on EEPROM 0x46h */
char BGRssiOffset1; /* Store B/G RSSI#1 Offset value */
char BGRssiOffset2; /* Store B/G RSSI#2 Offset value */
char ARssiOffset0; /* Store A RSSI#0 Offset value on EEPROM 0x4Ah */
char ARssiOffset1; /* Store A RSSI#1 Offset value */
char ARssiOffset2; /* Store A RSSI#2 Offset value */
char BLNAGain; /* Store B/G external LNA#0 value on EEPROM 0x44h */
char ALNAGain0; /* Store A external LNA#0 value for ch36~64 */
char ALNAGain1; /* Store A external LNA#1 value for ch100~128 */
char ALNAGain2; /* Store A external LNA#2 value for ch132~165 */
#ifdef RT30xx
/* for 3572 */
u8 Bbp25;
u8 Bbp26;
u8 TxMixerGain24G; /* Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G */
u8 TxMixerGain5G;
#endif /* RT30xx // */
/* ---------------------------- */
/* LED control */
/* ---------------------------- */
MCU_LEDCS_STRUC LedCntl;
u16 Led1; /* read from EEPROM 0x3c */
u16 Led2; /* EEPROM 0x3e */
u16 Led3; /* EEPROM 0x40 */
u8 LedIndicatorStrength;
u8 RssiSingalstrengthOffet;
BOOLEAN bLedOnScanning;
u8 LedStatus;
/*****************************************************************************************/
/* 802.11 related parameters */
/*****************************************************************************************/
/* outgoing BEACON frame buffer and corresponding TXD */
struct rt_txwi BeaconTxWI;
u8 *BeaconBuf;
u16 BeaconOffset[HW_BEACON_MAX_COUNT];
/* pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. */
struct rt_pspoll_frame PsPollFrame;
struct rt_header_802_11 NullFrame;
#ifdef RTMP_MAC_USB
struct rt_tx_context BeaconContext[BEACON_RING_SIZE];
struct rt_tx_context NullContext;
struct rt_tx_context PsPollContext;
struct rt_tx_context RTSContext;
#endif /* RTMP_MAC_USB // */
/*=========AP=========== */
/*=======STA=========== */
/* ----------------------------------------------- */
/* STA specific configuration & operation status */
/* used only when pAd->OpMode == OPMODE_STA */
/* ----------------------------------------------- */
struct rt_sta_admin_config StaCfg; /* user desired settings */
struct rt_sta_active_config StaActive; /* valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) */
char nickname[IW_ESSID_MAX_SIZE + 1]; /* nickname, only used in the iwconfig i/f */
int PreMediaState;
/*=======Common=========== */
/* OP mode: either AP or STA */
u8 OpMode; /* OPMODE_STA, OPMODE_AP */
int IndicateMediaState; /* Base on Indication state, default is NdisMediaStateDisConnected */
/* MAT related parameters */
/* configuration: read from Registry & E2PROM */
BOOLEAN bLocalAdminMAC; /* Use user changed MAC */
u8 PermanentAddress[MAC_ADDR_LEN]; /* Factory default MAC address */
u8 CurrentAddress[MAC_ADDR_LEN]; /* User changed MAC address */
/* ------------------------------------------------------ */
/* common configuration to both OPMODE_STA and OPMODE_AP */
/* ------------------------------------------------------ */
struct rt_common_config CommonCfg;
struct rt_mlme Mlme;
/* AP needs those variables for site survey feature. */
struct rt_mlme_aux MlmeAux; /* temporary settings used during MLME state machine */
struct rt_bss_table ScanTab; /* store the latest SCAN result */
/*About MacTab, the sta driver will use #0 and #1 for multicast and AP. */
struct rt_mac_table MacTab; /* ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. */
spinlock_t MacTabLock;
struct rt_ba_table BATable;
spinlock_t BATabLock;
struct rt_ralink_timer RECBATimer;
/* encryption/decryption KEY tables */
struct rt_cipher_key SharedKey[MAX_MBSSID_NUM][4]; /* STA always use SharedKey[BSS0][0..3] */
/* RX re-assembly buffer for fragmentation */
struct rt_fragment_frame FragFrame; /* Frame storage for fragment frame */
/* various Counters */
struct rt_counter_802_3 Counters8023; /* 802.3 counters */
struct rt_counter_802_11 WlanCounters; /* 802.11 MIB counters */
struct rt_counter_ralink RalinkCounters; /* Ralink proprietary counters */
struct rt_counter_drs DrsCounters; /* counters for Dynamic TX Rate Switching */
struct rt_private PrivateInfo; /* Private information & counters */
/* flags, see fRTMP_ADAPTER_xxx flags */
unsigned long Flags; /* Represent current device status */
unsigned long PSFlags; /* Power Save operation flag. */
/* current TX sequence # */
u16 Sequence;
/* Control disconnect / connect event generation */
/*+++Not used anymore */
unsigned long LinkDownTime;
/*--- */
unsigned long LastRxRate;
unsigned long LastTxRate;
/*+++Used only for Station */
BOOLEAN bConfigChanged; /* Config Change flag for the same SSID setting */
/*--- */
unsigned long ExtraInfo; /* Extra information for displaying status */
unsigned long SystemErrorBitmap; /* b0: E2PROM version error */
/*+++Not used anymore */
unsigned long MacIcVersion; /* MAC/BBP serial interface issue solved after ver.D */
/*--- */
/* --------------------------- */
/* System event log */
/* --------------------------- */
struct rt_802_11_event_table EventTab;
BOOLEAN HTCEnable;
/*****************************************************************************************/
/* Statistic related parameters */
/*****************************************************************************************/
#ifdef RTMP_MAC_USB
unsigned long BulkOutDataOneSecCount;
unsigned long BulkInDataOneSecCount;
unsigned long BulkLastOneSecCount; /* BulkOutDataOneSecCount + BulkInDataOneSecCount */
unsigned long watchDogRxCnt;
unsigned long watchDogRxOverFlowCnt;
unsigned long watchDogTxPendingCnt[NUM_OF_TX_RING];
int TransferedLength[NUM_OF_TX_RING];
#endif /* RTMP_MAC_USB // */
BOOLEAN bUpdateBcnCntDone;
unsigned long watchDogMacDeadlock; /* prevent MAC/BBP into deadlock condition */
/* ---------------------------- */
/* DEBUG paramerts */
/* ---------------------------- */
/*unsigned long DebugSetting[4]; */
BOOLEAN bBanAllBaSetup;
BOOLEAN bPromiscuous;
/* ---------------------------- */
/* rt2860c emulation-use Parameters */
/* ---------------------------- */
/*unsigned long rtsaccu[30]; */
/*unsigned long ctsaccu[30]; */
/*unsigned long cfendaccu[30]; */
/*unsigned long bacontent[16]; */
/*unsigned long rxint[RX_RING_SIZE+1]; */
/*u8 rcvba[60]; */
BOOLEAN bLinkAdapt;
BOOLEAN bForcePrintTX;
BOOLEAN bForcePrintRX;
/*BOOLEAN bDisablescanning; //defined in RT2870 USB */
BOOLEAN bStaFifoTest;
BOOLEAN bProtectionTest;
BOOLEAN bBroadComHT;
/*+++Following add from RT2870 USB. */
unsigned long BulkOutReq;
unsigned long BulkOutComplete;
unsigned long BulkOutCompleteOther;
unsigned long BulkOutCompleteCancel; /* seems not used now? */
unsigned long BulkInReq;
unsigned long BulkInComplete;
unsigned long BulkInCompleteFail;
/*--- */
struct wificonf WIFItestbed;
struct reordering_mpdu_pool mpdu_blk_pool;
unsigned long OneSecondnonBEpackets; /* record non BE packets per second */
#ifdef LINUX
struct iw_statistics iw_stats;
struct net_device_stats stats;
#endif /* LINUX // */
unsigned long TbttTickCount;
#ifdef PCI_MSI_SUPPORT
BOOLEAN HaveMsi;
#endif /* PCI_MSI_SUPPORT // */
u8 is_on;
#define TIME_BASE (1000000/OS_HZ)
#define TIME_ONE_SECOND (1000000/TIME_BASE)
u8 flg_be_adjust;
unsigned long be_adjust_last_time;
u8 FlgCtsEnabled;
u8 PM_FlgSuspend;
#ifdef RT30xx
#ifdef RTMP_EFUSE_SUPPORT
BOOLEAN bUseEfuse;
u8 EEPROMImage[1024];
#endif /* RTMP_EFUSE_SUPPORT // */
#endif /* RT30xx // */
};
#define DELAYINTMASK 0x0003fffb
#define INTMASK 0x0003fffb
#define IndMask 0x0003fffc
#define RxINT 0x00000005 /* Delayed Rx or indivi rx */
#define TxDataInt 0x000000fa /* Delayed Tx or indivi tx */
#define TxMgmtInt 0x00000102 /* Delayed Tx or indivi tx */
#define TxCoherent 0x00020000 /* tx coherent */
#define RxCoherent 0x00010000 /* rx coherent */
#define McuCommand 0x00000200 /* mcu */
#define PreTBTTInt 0x00001000 /* Pre-TBTT interrupt */
#define TBTTInt 0x00000800 /* TBTT interrupt */
#define GPTimeOutInt 0x00008000 /* GPtimeout interrupt */
#define AutoWakeupInt 0x00004000 /* AutoWakeupInt interrupt */
#define FifoStaFullInt 0x00002000 /* fifo statistics full interrupt */
/***************************************************************************
* Rx Path software control block related data structures
**************************************************************************/
struct rt_rx_blk {
RT28XX_RXD_STRUC RxD;
struct rt_rxwi *pRxWI;
struct rt_header_802_11 *pHeader;
void *pRxPacket;
u8 *pData;
u16 DataSize;
u16 Flags;
u8 UserPriority; /* for calculate TKIP MIC using */
};
#define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag)
#define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag)
#define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag))
#define fRX_WDS 0x0001
#define fRX_AMSDU 0x0002
#define fRX_ARALINK 0x0004
#define fRX_HTC 0x0008
#define fRX_PAD 0x0010
#define fRX_AMPDU 0x0020
#define fRX_QOS 0x0040
#define fRX_INFRA 0x0080
#define fRX_EAP 0x0100
#define fRX_MESH 0x0200
#define fRX_APCLI 0x0400
#define fRX_DLS 0x0800
#define fRX_WPI 0x1000
#define LENGTH_AMSDU_SUBFRAMEHEAD 14
#define LENGTH_ARALINK_SUBFRAMEHEAD 14
#define LENGTH_ARALINK_HEADER_FIELD 2
/***************************************************************************
* Tx Path software control block related data structures
**************************************************************************/
#define TX_UNKOWN_FRAME 0x00
#define TX_MCAST_FRAME 0x01
#define TX_LEGACY_FRAME 0x02
#define TX_AMPDU_FRAME 0x04
#define TX_AMSDU_FRAME 0x08
#define TX_RALINK_FRAME 0x10
#define TX_FRAG_FRAME 0x20
/* Currently the sizeof(struct rt_tx_blk) is 148 bytes. */
struct rt_tx_blk {
u8 QueIdx;
u8 TxFrameType; /* Indicate the Transmission type of the all frames in one batch */
u8 TotalFrameNum; /* Total frame number that wants to send-out in one batch */
u16 TotalFragNum; /* Total frame fragments required in one batch */
u16 TotalFrameLen; /* Total length of all frames that wants to send-out in one batch */
struct rt_queue_header TxPacketList;
struct rt_mac_table_entry *pMacEntry; /* NULL: packet with 802.11 RA field is multicast/broadcast address */
HTTRANSMIT_SETTING *pTransmit;
/* Following structure used for the characteristics of a specific packet. */
void *pPacket;
u8 *pSrcBufHeader; /* Reference to the head of sk_buff->data */
u8 *pSrcBufData; /* Reference to the sk_buff->data, will change depending on the handling progresss */
u32 SrcBufLen; /* Length of packet payload which not including Layer 2 header */
u8 *pExtraLlcSnapEncap; /* NULL means no extra LLC/SNAP is required */
u8 HeaderBuf[128]; /* TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP */
/*RT2870 2.1.0.0 uses only 80 bytes */
/*RT3070 2.1.1.0 uses only 96 bytes */
/*RT3090 2.1.0.0 uses only 96 bytes */
u8 MpduHeaderLen; /* 802.11 header length NOT including the padding */
u8 HdrPadLen; /* recording Header Padding Length; */
u8 apidx; /* The interface associated to this packet */
u8 Wcid; /* The MAC entry associated to this packet */
u8 UserPriority; /* priority class of packet */
u8 FrameGap; /* what kind of IFS does this packet use */
u8 MpduReqNum; /* number of fragments of this frame */
u8 TxRate; /* TODO: Obsoleted? Should change to MCS? */
u8 CipherAlg; /* cipher alogrithm */
struct rt_cipher_key *pKey;
u16 Flags; /*See following definitions for detail. */
/*YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. */
unsigned long Priv; /* Hardware specific value saved in here. */
};
#define fTX_bRtsRequired 0x0001 /* Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. */
#define fTX_bAckRequired 0x0002 /* the packet need ack response */
#define fTX_bPiggyBack 0x0004 /* Legacy device use Piggback or not */
#define fTX_bHTRate 0x0008 /* allow to use HT rate */
#define fTX_bForceNonQoS 0x0010 /* force to transmit frame without WMM-QoS in HT mode */
#define fTX_bAllowFrag 0x0020 /* allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment */
#define fTX_bMoreData 0x0040 /* there are more data packets in PowerSave Queue */
#define fTX_bWMM 0x0080 /* QOS Data */
#define fTX_bClearEAPFrame 0x0100
#define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag)
#define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0)
#define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag))
/***************************************************************************
* Other static inline function definitions
**************************************************************************/
static inline void ConvertMulticastIP2MAC(u8 *pIpAddr,
u8 **ppMacAddr,
u16 ProtoType)
{
if (pIpAddr == NULL)
return;
if (ppMacAddr == NULL || *ppMacAddr == NULL)
return;
switch (ProtoType) {
case ETH_P_IPV6:
/* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */
*(*ppMacAddr) = 0x33;
*(*ppMacAddr + 1) = 0x33;
*(*ppMacAddr + 2) = pIpAddr[12];
*(*ppMacAddr + 3) = pIpAddr[13];
*(*ppMacAddr + 4) = pIpAddr[14];
*(*ppMacAddr + 5) = pIpAddr[15];
break;
case ETH_P_IP:
default:
/* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */
*(*ppMacAddr) = 0x01;
*(*ppMacAddr + 1) = 0x00;
*(*ppMacAddr + 2) = 0x5e;
*(*ppMacAddr + 3) = pIpAddr[1] & 0x7f;
*(*ppMacAddr + 4) = pIpAddr[2];
*(*ppMacAddr + 5) = pIpAddr[3];
break;
}
return;
}
char *GetPhyMode(int Mode);
char *GetBW(int BW);
/* */
/* Private routines in rtmp_init.c */
/* */
int RTMPAllocAdapterBlock(void *handle,
struct rt_rtmp_adapter **ppAdapter);
int RTMPAllocTxRxRingMemory(struct rt_rtmp_adapter *pAd);
void RTMPFreeAdapter(struct rt_rtmp_adapter *pAd);
int NICReadRegParameters(struct rt_rtmp_adapter *pAd,
void *WrapperConfigurationContext);
#ifdef RTMP_RF_RW_SUPPORT
void NICInitRFRegisters(struct rt_rtmp_adapter *pAd);
void RtmpChipOpsRFHook(struct rt_rtmp_adapter *pAd);
int RT30xxWriteRFRegister(struct rt_rtmp_adapter *pAd,
u8 regID, u8 value);
int RT30xxReadRFRegister(struct rt_rtmp_adapter *pAd,
u8 regID, u8 *pValue);
#endif /* RTMP_RF_RW_SUPPORT // */
void NICReadEEPROMParameters(struct rt_rtmp_adapter *pAd, u8 *mac_addr);
void NICInitAsicFromEEPROM(struct rt_rtmp_adapter *pAd);
int NICInitializeAdapter(struct rt_rtmp_adapter *pAd, IN BOOLEAN bHardReset);
int NICInitializeAsic(struct rt_rtmp_adapter *pAd, IN BOOLEAN bHardReset);
void NICIssueReset(struct rt_rtmp_adapter *pAd);
void RTMPRingCleanUp(struct rt_rtmp_adapter *pAd, u8 RingType);
void UserCfgInit(struct rt_rtmp_adapter *pAd);
void NICResetFromError(struct rt_rtmp_adapter *pAd);
int NICLoadFirmware(struct rt_rtmp_adapter *pAd);
void NICEraseFirmware(struct rt_rtmp_adapter *pAd);
int NICLoadRateSwitchingParams(struct rt_rtmp_adapter *pAd);
BOOLEAN NICCheckForHang(struct rt_rtmp_adapter *pAd);
void NICUpdateFifoStaCounters(struct rt_rtmp_adapter *pAd);
void NICUpdateRawCounters(struct rt_rtmp_adapter *pAd);
void RTMPZeroMemory(void *pSrc, unsigned long Length);
unsigned long RTMPCompareMemory(void *pSrc1, void *pSrc2, unsigned long Length);
void RTMPMoveMemory(void *pDest, void *pSrc, unsigned long Length);
void AtoH(char *src, u8 *dest, int destlen);
void RTMPPatchMacBbpBug(struct rt_rtmp_adapter *pAd);
void RTMPInitTimer(struct rt_rtmp_adapter *pAd,
struct rt_ralink_timer *pTimer,
void *pTimerFunc, void *pData, IN BOOLEAN Repeat);
void RTMPSetTimer(struct rt_ralink_timer *pTimer, unsigned long Value);
void RTMPModTimer(struct rt_ralink_timer *pTimer, unsigned long Value);
void RTMPCancelTimer(struct rt_ralink_timer *pTimer, OUT BOOLEAN * pCancelled);
void RTMPSetLED(struct rt_rtmp_adapter *pAd, u8 Status);
void RTMPSetSignalLED(struct rt_rtmp_adapter *pAd, IN NDIS_802_11_RSSI Dbm);
void RTMPEnableRxTx(struct rt_rtmp_adapter *pAd);
/* */
/* prototype in action.c */
/* */
void ActionStateMachineInit(struct rt_rtmp_adapter *pAd,
struct rt_state_machine *S,
OUT STATE_MACHINE_FUNC Trans[]);
void MlmeADDBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void MlmeDELBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void MlmeDLSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void MlmeInvalidAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void MlmeQOSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerAddBAReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerAddBARspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerDelBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void SendPSMPAction(struct rt_rtmp_adapter *pAd, u8 Wcid, u8 Psmp);
void PeerRMAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerPublicAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerHTAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerQOSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void RECBATimerTimeout(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void ORIBATimerTimeout(struct rt_rtmp_adapter *pAd);
void SendRefreshBAR(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry);
void ActHeaderInit(struct rt_rtmp_adapter *pAd,
struct rt_header_802_11 *pHdr80211,
u8 *Addr1, u8 *Addr2, u8 *Addr3);
void BarHeaderInit(struct rt_rtmp_adapter *pAd,
struct rt_frame_bar *pCntlBar, u8 *pDA, u8 *pSA);
void InsertActField(struct rt_rtmp_adapter *pAd,
u8 *pFrameBuf,
unsigned long *pFrameLen, u8 Category, u8 ActCode);
BOOLEAN CntlEnqueueForRecv(struct rt_rtmp_adapter *pAd,
unsigned long Wcid,
unsigned long MsgLen, struct rt_frame_ba_req *pMsg);
/* */
/* Private routines in rtmp_data.c */
/* */
BOOLEAN RTMPHandleRxDoneInterrupt(struct rt_rtmp_adapter *pAd);
BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(struct rt_rtmp_adapter *pAd,
INT_SOURCE_CSR_STRUC TxRingBitmap);
void RTMPHandleMgmtRingDmaDoneInterrupt(struct rt_rtmp_adapter *pAd);
void RTMPHandleTBTTInterrupt(struct rt_rtmp_adapter *pAd);
void RTMPHandlePreTBTTInterrupt(struct rt_rtmp_adapter *pAd);
void RTMPHandleTwakeupInterrupt(struct rt_rtmp_adapter *pAd);
void RTMPHandleRxCoherentInterrupt(struct rt_rtmp_adapter *pAd);
BOOLEAN TxFrameIsAggregatible(struct rt_rtmp_adapter *pAd,
u8 *pPrevAddr1, u8 *p8023hdr);
BOOLEAN PeerIsAggreOn(struct rt_rtmp_adapter *pAd,
unsigned long TxRate, struct rt_mac_table_entry *pMacEntry);
int Sniff2BytesFromNdisBuffer(char *pFirstBuffer,
u8 DesiredOffset,
u8 *pByte0, u8 *pByte1);
int STASendPacket(struct rt_rtmp_adapter *pAd, void *pPacket);
void STASendPackets(void *MiniportAdapterContext,
void **ppPacketArray, u32 NumberOfPackets);
void RTMPDeQueuePacket(struct rt_rtmp_adapter *pAd,
IN BOOLEAN bIntContext,
u8 QueIdx, u8 Max_Tx_Packets);
int RTMPHardTransmit(struct rt_rtmp_adapter *pAd,
void *pPacket,
u8 QueIdx, unsigned long *pFreeTXDLeft);
int STAHardTransmit(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk, u8 QueIdx);
void STARxEAPOLFrameIndicate(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry,
struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID);
int RTMPFreeTXDRequest(struct rt_rtmp_adapter *pAd,
u8 RingType,
u8 NumberRequired, u8 *FreeNumberIs);
int MlmeHardTransmit(struct rt_rtmp_adapter *pAd,
u8 QueIdx, void *pPacket);
int MlmeHardTransmitMgmtRing(struct rt_rtmp_adapter *pAd,
u8 QueIdx, void *pPacket);
#ifdef RTMP_MAC_PCI
int MlmeHardTransmitTxRing(struct rt_rtmp_adapter *pAd,
u8 QueIdx, void *pPacket);
int MlmeDataHardTransmit(struct rt_rtmp_adapter *pAd,
u8 QueIdx, void *pPacket);
void RTMPWriteTxDescriptor(struct rt_rtmp_adapter *pAd,
struct rt_txd *pTxD, IN BOOLEAN bWIV, u8 QSEL);
#endif /* RTMP_MAC_PCI // */
u16 RTMPCalcDuration(struct rt_rtmp_adapter *pAd, u8 Rate, unsigned long Size);
void RTMPWriteTxWI(struct rt_rtmp_adapter *pAd, struct rt_txwi * pTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */
u8 BASize,
u8 WCID,
unsigned long Length,
u8 PID,
u8 TID,
u8 TxRate,
u8 Txopmode,
IN BOOLEAN CfAck, IN HTTRANSMIT_SETTING *pTransmit);
void RTMPWriteTxWI_Data(struct rt_rtmp_adapter *pAd,
struct rt_txwi *pTxWI, struct rt_tx_blk *pTxBlk);
void RTMPWriteTxWI_Cache(struct rt_rtmp_adapter *pAd,
struct rt_txwi *pTxWI, struct rt_tx_blk *pTxBlk);
void RTMPSuspendMsduTransmission(struct rt_rtmp_adapter *pAd);
void RTMPResumeMsduTransmission(struct rt_rtmp_adapter *pAd);
int MiniportMMRequest(struct rt_rtmp_adapter *pAd,
u8 QueIdx, u8 *pData, u32 Length);
/*+++mark by shiang, now this function merge to MiniportMMRequest() */
/*---mark by shiang, now this function merge to MiniportMMRequest() */
void RTMPSendNullFrame(struct rt_rtmp_adapter *pAd,
u8 TxRate, IN BOOLEAN bQosNull);
void RTMPSendDisassociationFrame(struct rt_rtmp_adapter *pAd);
void RTMPSendRTSFrame(struct rt_rtmp_adapter *pAd,
u8 *pDA,
IN unsigned int NextMpduSize,
u8 TxRate,
u8 RTSRate,
u16 AckDuration,
u8 QueIdx, u8 FrameGap);
struct rt_queue_header *RTMPCheckTxSwQueue(struct rt_rtmp_adapter *pAd, u8 * QueIdx);
void RTMPReportMicError(struct rt_rtmp_adapter *pAd, struct rt_cipher_key *pWpaKey);
void WpaMicFailureReportFrame(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void WpaDisassocApAndBlockAssoc(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2,
void *SystemSpecific3);
void WpaStaPairwiseKeySetting(struct rt_rtmp_adapter *pAd);
void WpaStaGroupKeySetting(struct rt_rtmp_adapter *pAd);
int RTMPCloneNdisPacket(struct rt_rtmp_adapter *pAd,
IN BOOLEAN pInsAMSDUHdr,
void *pInPacket,
void **ppOutPacket);
int RTMPAllocateNdisPacket(struct rt_rtmp_adapter *pAd,
void **pPacket,
u8 *pHeader,
u32 HeaderLen,
u8 *pData, u32 DataLen);
void RTMPFreeNdisPacket(struct rt_rtmp_adapter *pAd, void *pPacket);
BOOLEAN RTMPFreeTXDUponTxDmaDone(struct rt_rtmp_adapter *pAd, u8 QueIdx);
BOOLEAN RTMPCheckDHCPFrame(struct rt_rtmp_adapter *pAd, void *pPacket);
BOOLEAN RTMPCheckEtherType(struct rt_rtmp_adapter *pAd, void *pPacket);
/* */
/* Private routines in rtmp_wep.c */
/* */
void RTMPInitWepEngine(struct rt_rtmp_adapter *pAd,
u8 *pKey,
u8 KeyId, u8 KeyLen, u8 *pDest);
void RTMPEncryptData(struct rt_rtmp_adapter *pAd,
u8 *pSrc, u8 *pDest, u32 Len);
BOOLEAN RTMPSoftDecryptWEP(struct rt_rtmp_adapter *pAd,
u8 *pData,
unsigned long DataByteCnt, struct rt_cipher_key *pGroupKey);
void RTMPSetICV(struct rt_rtmp_adapter *pAd, u8 *pDest);
void ARCFOUR_INIT(struct rt_arcfourcontext *Ctx, u8 *pKey, u32 KeyLen);
u8 ARCFOUR_BYTE(struct rt_arcfourcontext *Ctx);
void ARCFOUR_DECRYPT(struct rt_arcfourcontext *Ctx,
u8 *pDest, u8 *pSrc, u32 Len);
void ARCFOUR_ENCRYPT(struct rt_arcfourcontext *Ctx,
u8 *pDest, u8 *pSrc, u32 Len);
void WPAARCFOUR_ENCRYPT(struct rt_arcfourcontext *Ctx,
u8 *pDest, u8 *pSrc, u32 Len);
u32 RTMP_CALC_FCS32(u32 Fcs, u8 *Cp, int Len);
/* */
/* MLME routines */
/* */
/* Asic/RF/BBP related functions */
void AsicAdjustTxPower(struct rt_rtmp_adapter *pAd);
void AsicUpdateProtect(struct rt_rtmp_adapter *pAd,
u16 OperaionMode,
u8 SetMask,
IN BOOLEAN bDisableBGProtect, IN BOOLEAN bNonGFExist);
void AsicSwitchChannel(struct rt_rtmp_adapter *pAd,
u8 Channel, IN BOOLEAN bScan);
void AsicLockChannel(struct rt_rtmp_adapter *pAd, u8 Channel);
void AsicRfTuningExec(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void AsicResetBBPAgent(struct rt_rtmp_adapter *pAd);
void AsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd,
u16 TbttNumToNextWakeUp);
void AsicForceSleep(struct rt_rtmp_adapter *pAd);
void AsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx);
void AsicSetBssid(struct rt_rtmp_adapter *pAd, u8 *pBssid);
void AsicSetMcastWC(struct rt_rtmp_adapter *pAd);
void AsicDelWcidTab(struct rt_rtmp_adapter *pAd, u8 Wcid);
void AsicEnableRDG(struct rt_rtmp_adapter *pAd);
void AsicDisableRDG(struct rt_rtmp_adapter *pAd);
void AsicDisableSync(struct rt_rtmp_adapter *pAd);
void AsicEnableBssSync(struct rt_rtmp_adapter *pAd);
void AsicEnableIbssSync(struct rt_rtmp_adapter *pAd);
void AsicSetEdcaParm(struct rt_rtmp_adapter *pAd, struct rt_edca_parm *pEdcaParm);
void AsicSetSlotTime(struct rt_rtmp_adapter *pAd, IN BOOLEAN bUseShortSlotTime);
void AsicAddSharedKeyEntry(struct rt_rtmp_adapter *pAd,
u8 BssIndex,
u8 KeyIdx,
u8 CipherAlg,
u8 *pKey, u8 *pTxMic, u8 *pRxMic);
void AsicRemoveSharedKeyEntry(struct rt_rtmp_adapter *pAd,
u8 BssIndex, u8 KeyIdx);
void AsicUpdateWCIDAttribute(struct rt_rtmp_adapter *pAd,
u16 WCID,
u8 BssIndex,
u8 CipherAlg,
IN BOOLEAN bUsePairewiseKeyTable);
void AsicUpdateWCIDIVEIV(struct rt_rtmp_adapter *pAd,
u16 WCID, unsigned long uIV, unsigned long uEIV);
void AsicUpdateRxWCIDTable(struct rt_rtmp_adapter *pAd,
u16 WCID, u8 *pAddr);
void AsicAddKeyEntry(struct rt_rtmp_adapter *pAd,
u16 WCID,
u8 BssIndex,
u8 KeyIdx,
struct rt_cipher_key *pCipherKey,
IN BOOLEAN bUsePairewiseKeyTable, IN BOOLEAN bTxKey);
void AsicAddPairwiseKeyEntry(struct rt_rtmp_adapter *pAd,
u8 *pAddr,
u8 WCID, struct rt_cipher_key *pCipherKey);
void AsicRemovePairwiseKeyEntry(struct rt_rtmp_adapter *pAd,
u8 BssIdx, u8 Wcid);
BOOLEAN AsicSendCommandToMcu(struct rt_rtmp_adapter *pAd,
u8 Command,
u8 Token, u8 Arg0, u8 Arg1);
#ifdef RTMP_MAC_PCI
BOOLEAN AsicCheckCommanOk(struct rt_rtmp_adapter *pAd, u8 Command);
#endif /* RTMP_MAC_PCI // */
void MacAddrRandomBssid(struct rt_rtmp_adapter *pAd, u8 *pAddr);
void MgtMacHeaderInit(struct rt_rtmp_adapter *pAd,
struct rt_header_802_11 *pHdr80211,
u8 SubType,
u8 ToDs, u8 *pDA, u8 *pBssid);
void MlmeRadioOff(struct rt_rtmp_adapter *pAd);
void MlmeRadioOn(struct rt_rtmp_adapter *pAd);
void BssTableInit(struct rt_bss_table *Tab);
void BATableInit(struct rt_rtmp_adapter *pAd, struct rt_ba_table *Tab);
unsigned long BssTableSearch(struct rt_bss_table *Tab, u8 *pBssid, u8 Channel);
unsigned long BssSsidTableSearch(struct rt_bss_table *Tab,
u8 *pBssid,
u8 *pSsid, u8 SsidLen, u8 Channel);
unsigned long BssTableSearchWithSSID(struct rt_bss_table *Tab,
u8 *Bssid,
u8 *pSsid,
u8 SsidLen, u8 Channel);
unsigned long BssSsidTableSearchBySSID(struct rt_bss_table *Tab,
u8 *pSsid, u8 SsidLen);
void BssTableDeleteEntry(struct rt_bss_table *pTab,
u8 *pBssid, u8 Channel);
void BATableDeleteORIEntry(struct rt_rtmp_adapter *pAd,
struct rt_ba_ori_entry *pBAORIEntry);
void BssEntrySet(struct rt_rtmp_adapter *pAd, struct rt_bss_entry *pBss, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, struct rt_cf_parm * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, struct rt_ht_capability_ie * pHtCapability, struct rt_add_ht_info_ie * pAddHtInfo, /* AP might use this additional ht info IE */
u8 HtCapabilityLen,
u8 AddHtInfoLen,
u8 NewExtChanOffset,
u8 Channel,
char Rssi,
IN LARGE_INTEGER TimeStamp,
u8 CkipFlag,
struct rt_edca_parm *pEdcaParm,
struct rt_qos_capability_parm *pQosCapability,
struct rt_qbss_load_parm *pQbssLoad,
u16 LengthVIE, struct rt_ndis_802_11_variable_ies *pVIE);
unsigned long BssTableSetEntry(struct rt_rtmp_adapter *pAd, struct rt_bss_table *pTab, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, struct rt_cf_parm * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, struct rt_ht_capability_ie * pHtCapability, struct rt_add_ht_info_ie * pAddHtInfo, /* AP might use this additional ht info IE */
u8 HtCapabilityLen,
u8 AddHtInfoLen,
u8 NewExtChanOffset,
u8 Channel,
char Rssi,
IN LARGE_INTEGER TimeStamp,
u8 CkipFlag,
struct rt_edca_parm *pEdcaParm,
struct rt_qos_capability_parm *pQosCapability,
struct rt_qbss_load_parm *pQbssLoad,
u16 LengthVIE, struct rt_ndis_802_11_variable_ies *pVIE);
void BATableInsertEntry(struct rt_rtmp_adapter *pAd,
u16 Aid,
u16 TimeOutValue,
u16 StartingSeq,
u8 TID,
u8 BAWinSize,
u8 OriginatorStatus, IN BOOLEAN IsRecipient);
void BssTableSsidSort(struct rt_rtmp_adapter *pAd,
struct rt_bss_table *OutTab, char Ssid[], u8 SsidLen);
void BssTableSortByRssi(struct rt_bss_table *OutTab);
void BssCipherParse(struct rt_bss_entry *pBss);
int MlmeQueueInit(struct rt_mlme_queue *Queue);
void MlmeQueueDestroy(struct rt_mlme_queue *Queue);
BOOLEAN MlmeEnqueue(struct rt_rtmp_adapter *pAd,
unsigned long Machine,
unsigned long MsgType, unsigned long MsgLen, void *Msg);
BOOLEAN MlmeEnqueueForRecv(struct rt_rtmp_adapter *pAd,
unsigned long Wcid,
unsigned long TimeStampHigh,
unsigned long TimeStampLow,
u8 Rssi0,
u8 Rssi1,
u8 Rssi2,
unsigned long MsgLen, void *Msg, u8 Signal);
BOOLEAN MlmeDequeue(struct rt_mlme_queue *Queue, struct rt_mlme_queue_elem **Elem);
void MlmeRestartStateMachine(struct rt_rtmp_adapter *pAd);
BOOLEAN MlmeQueueEmpty(struct rt_mlme_queue *Queue);
BOOLEAN MlmeQueueFull(struct rt_mlme_queue *Queue);
BOOLEAN MsgTypeSubst(struct rt_rtmp_adapter *pAd,
struct rt_frame_802_11 *pFrame,
int *Machine, int *MsgType);
void StateMachineInit(struct rt_state_machine *Sm,
IN STATE_MACHINE_FUNC Trans[],
unsigned long StNr,
unsigned long MsgNr,
IN STATE_MACHINE_FUNC DefFunc,
unsigned long InitState, unsigned long Base);
void StateMachineSetAction(struct rt_state_machine *S,
unsigned long St, unsigned long Msg, IN STATE_MACHINE_FUNC F);
void StateMachinePerformAction(struct rt_rtmp_adapter *pAd,
struct rt_state_machine *S, struct rt_mlme_queue_elem *Elem);
void Drop(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void AssocStateMachineInit(struct rt_rtmp_adapter *pAd,
struct rt_state_machine *Sm,
OUT STATE_MACHINE_FUNC Trans[]);
void ReassocTimeout(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void AssocTimeout(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void DisassocTimeout(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
/*---------------------------------------------- */
void MlmeAssocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void MlmeReassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void MlmeDisassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerAssocRspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerReassocRspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerDisassocAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void DisassocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void AssocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void ReassocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void Cls3errAction(struct rt_rtmp_adapter *pAd, u8 *pAddr);
void InvalidStateWhenAssoc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void InvalidStateWhenReassoc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void InvalidStateWhenDisassociate(struct rt_rtmp_adapter *pAd,
struct rt_mlme_queue_elem *Elem);
#ifdef RTMP_MAC_USB
void MlmeCntlConfirm(struct rt_rtmp_adapter *pAd, unsigned long MsgType, u16 Msg);
#endif /* RTMP_MAC_USB // */
void ComposePsPoll(struct rt_rtmp_adapter *pAd);
void ComposeNullFrame(struct rt_rtmp_adapter *pAd);
void AssocPostProc(struct rt_rtmp_adapter *pAd,
u8 *pAddr2,
u16 CapabilityInfo,
u16 Aid,
u8 SupRate[],
u8 SupRateLen,
u8 ExtRate[],
u8 ExtRateLen,
struct rt_edca_parm *pEdcaParm,
struct rt_ht_capability_ie *pHtCapability,
u8 HtCapabilityLen, struct rt_add_ht_info_ie *pAddHtInfo);
void AuthStateMachineInit(struct rt_rtmp_adapter *pAd,
struct rt_state_machine *sm, OUT STATE_MACHINE_FUNC Trans[]);
void AuthTimeout(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void MlmeAuthReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerAuthRspAtSeq2Action(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerAuthRspAtSeq4Action(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void AuthTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void Cls2errAction(struct rt_rtmp_adapter *pAd, u8 *pAddr);
void MlmeDeauthReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void InvalidStateWhenAuth(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
/*============================================= */
void AuthRspStateMachineInit(struct rt_rtmp_adapter *pAd,
struct rt_state_machine *Sm,
IN STATE_MACHINE_FUNC Trans[]);
void PeerDeauthAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerAuthSimpleRspGenAndSend(struct rt_rtmp_adapter *pAd,
struct rt_header_802_11 *pHdr80211,
u16 Alg,
u16 Seq,
u16 Reason, u16 Status);
/* */
/* Private routines in dls.c */
/* */
/*======================================== */
void SyncStateMachineInit(struct rt_rtmp_adapter *pAd,
struct rt_state_machine *Sm,
OUT STATE_MACHINE_FUNC Trans[]);
void BeaconTimeout(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void ScanTimeout(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void InvalidStateWhenScan(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void InvalidStateWhenJoin(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void InvalidStateWhenStart(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void EnqueueProbeRequest(struct rt_rtmp_adapter *pAd);
BOOLEAN ScanRunning(struct rt_rtmp_adapter *pAd);
/*========================================= */
void MlmeCntlInit(struct rt_rtmp_adapter *pAd,
struct rt_state_machine *S, OUT STATE_MACHINE_FUNC Trans[]);
void MlmeCntlMachinePerformAction(struct rt_rtmp_adapter *pAd,
struct rt_state_machine *S,
struct rt_mlme_queue_elem *Elem);
void CntlIdleProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlOidScanProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlOidSsidProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlOidRTBssidProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlMlmeRoamingProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlWaitDisassocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlWaitJoinProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlWaitReassocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlWaitStartProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlWaitAuthProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlWaitAuthProc2(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void CntlWaitAssocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType);
void LinkDown(struct rt_rtmp_adapter *pAd, IN BOOLEAN IsReqFromAP);
void IterateOnBssTab(struct rt_rtmp_adapter *pAd);
void IterateOnBssTab2(struct rt_rtmp_adapter *pAd);
void JoinParmFill(struct rt_rtmp_adapter *pAd,
struct rt_mlme_join_req *JoinReq, unsigned long BssIdx);
void AssocParmFill(struct rt_rtmp_adapter *pAd,
struct rt_mlme_assoc_req *AssocReq,
u8 *pAddr,
u16 CapabilityInfo,
unsigned long Timeout, u16 ListenIntv);
void ScanParmFill(struct rt_rtmp_adapter *pAd,
struct rt_mlme_scan_req *ScanReq,
char Ssid[],
u8 SsidLen, u8 BssType, u8 ScanType);
void DisassocParmFill(struct rt_rtmp_adapter *pAd,
struct rt_mlme_disassoc_req *DisassocReq,
u8 *pAddr, u16 Reason);
void StartParmFill(struct rt_rtmp_adapter *pAd,
struct rt_mlme_start_req *StartReq,
char Ssid[], u8 SsidLen);
void AuthParmFill(struct rt_rtmp_adapter *pAd,
struct rt_mlme_auth_req *AuthReq,
u8 *pAddr, u16 Alg);
void EnqueuePsPoll(struct rt_rtmp_adapter *pAd);
void EnqueueBeaconFrame(struct rt_rtmp_adapter *pAd);
void MlmeJoinReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void MlmeScanReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void MlmeStartReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void ScanTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void BeaconTimeoutAtJoinAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerBeaconAtScanAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerBeaconAtJoinAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerBeacon(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void PeerProbeReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem);
void ScanNextChannel(struct rt_rtmp_adapter *pAd);
unsigned long MakeIbssBeacon(struct rt_rtmp_adapter *pAd);
BOOLEAN MlmeScanReqSanity(struct rt_rtmp_adapter *pAd,
void *Msg,
unsigned long MsgLen,
u8 *BssType,
char ssid[],
u8 *SsidLen, u8 *ScanType);
BOOLEAN PeerBeaconAndProbeRspSanity(struct rt_rtmp_adapter *pAd,
void *Msg,
unsigned long MsgLen,
u8 MsgChannel,
u8 *pAddr2,
u8 *pBssid,
char Ssid[],
u8 *pSsidLen,
u8 *pBssType,
u16 *pBeaconPeriod,
u8 *pChannel,
u8 *pNewChannel,
OUT LARGE_INTEGER *pTimestamp,
struct rt_cf_parm *pCfParm,
u16 *pAtimWin,
u16 *pCapabilityInfo,
u8 *pErp,
u8 *pDtimCount,
u8 *pDtimPeriod,
u8 *pBcastFlag,
u8 *pMessageToMe,
u8 SupRate[],
u8 *pSupRateLen,
u8 ExtRate[],
u8 *pExtRateLen,
u8 *pCkipFlag,
u8 *pAironetCellPowerLimit,
struct rt_edca_parm *pEdcaParm,
struct rt_qbss_load_parm *pQbssLoad,
struct rt_qos_capability_parm *pQosCapability,
unsigned long *pRalinkIe,
u8 *pHtCapabilityLen,
u8 *pPreNHtCapabilityLen,
struct rt_ht_capability_ie *pHtCapability,
u8 *AddHtInfoLen,
struct rt_add_ht_info_ie *AddHtInfo,
u8 *NewExtChannel,
u16 *LengthVIE,
struct rt_ndis_802_11_variable_ies *pVIE);
BOOLEAN PeerAddBAReqActionSanity(struct rt_rtmp_adapter *pAd,
void *pMsg,
unsigned long MsgLen, u8 *pAddr2);
BOOLEAN PeerAddBARspActionSanity(struct rt_rtmp_adapter *pAd,
void *pMsg, unsigned long MsgLen);
BOOLEAN PeerDelBAActionSanity(struct rt_rtmp_adapter *pAd,
u8 Wcid, void *pMsg, unsigned long MsgLen);
BOOLEAN MlmeAssocReqSanity(struct rt_rtmp_adapter *pAd,
void *Msg,
unsigned long MsgLen,
u8 *pApAddr,
u16 *CapabilityInfo,
unsigned long *Timeout, u16 *ListenIntv);
BOOLEAN MlmeAuthReqSanity(struct rt_rtmp_adapter *pAd,
void *Msg,
unsigned long MsgLen,
u8 *pAddr,
unsigned long *Timeout, u16 *Alg);
BOOLEAN MlmeStartReqSanity(struct rt_rtmp_adapter *pAd,
void *Msg,
unsigned long MsgLen,
char Ssid[], u8 *Ssidlen);
BOOLEAN PeerAuthSanity(struct rt_rtmp_adapter *pAd,
void *Msg,
unsigned long MsgLen,
u8 *pAddr,
u16 *Alg,
u16 *Seq,
u16 *Status, char ChlgText[]);
BOOLEAN PeerAssocRspSanity(struct rt_rtmp_adapter *pAd, void *pMsg, unsigned long MsgLen, u8 *pAddr2, u16 *pCapabilityInfo, u16 *pStatus, u16 *pAid, u8 SupRate[], u8 *pSupRateLen, u8 ExtRate[], u8 *pExtRateLen, struct rt_ht_capability_ie *pHtCapability, struct rt_add_ht_info_ie *pAddHtInfo, /* AP might use this additional ht info IE */
u8 *pHtCapabilityLen,
u8 *pAddHtInfoLen,
u8 *pNewExtChannelOffset,
struct rt_edca_parm *pEdcaParm, u8 *pCkipFlag);
BOOLEAN PeerDisassocSanity(struct rt_rtmp_adapter *pAd,
void *Msg,
unsigned long MsgLen,
u8 *pAddr2, u16 *Reason);
BOOLEAN PeerWpaMessageSanity(struct rt_rtmp_adapter *pAd,
struct rt_eapol_packet *pMsg,
unsigned long MsgLen,
u8 MsgType, struct rt_mac_table_entry *pEntry);
BOOLEAN PeerDeauthSanity(struct rt_rtmp_adapter *pAd,
void *Msg,
unsigned long MsgLen,
u8 *pAddr2, u16 *Reason);
BOOLEAN PeerProbeReqSanity(struct rt_rtmp_adapter *pAd,
void *Msg,
unsigned long MsgLen,
u8 *pAddr2,
char Ssid[], u8 *pSsidLen);
BOOLEAN GetTimBit(char *Ptr,
u16 Aid,
u8 *TimLen,
u8 *BcastFlag,
u8 *DtimCount,
u8 *DtimPeriod, u8 *MessageToMe);
u8 ChannelSanity(struct rt_rtmp_adapter *pAd, u8 channel);
NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(struct rt_bss_entry *pBss);
BOOLEAN MlmeDelBAReqSanity(struct rt_rtmp_adapter *pAd,
void *Msg, unsigned long MsgLen);
BOOLEAN MlmeAddBAReqSanity(struct rt_rtmp_adapter *pAd,
void *Msg, unsigned long MsgLen, u8 *pAddr2);
unsigned long MakeOutgoingFrame(u8 *Buffer, unsigned long *Length, ...);
void LfsrInit(struct rt_rtmp_adapter *pAd, unsigned long Seed);
u8 RandomByte(struct rt_rtmp_adapter *pAd);
void AsicUpdateAutoFallBackTable(struct rt_rtmp_adapter *pAd, u8 *pTxRate);
void MlmePeriodicExec(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void LinkDownExec(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void STAMlmePeriodicExec(struct rt_rtmp_adapter *pAd);
void MlmeAutoScan(struct rt_rtmp_adapter *pAd);
void MlmeAutoReconnectLastSSID(struct rt_rtmp_adapter *pAd);
BOOLEAN MlmeValidateSSID(u8 *pSsid, u8 SsidLen);
void MlmeCheckForRoaming(struct rt_rtmp_adapter *pAd, unsigned long Now32);
BOOLEAN MlmeCheckForFastRoaming(struct rt_rtmp_adapter *pAd);
void MlmeDynamicTxRateSwitching(struct rt_rtmp_adapter *pAd);
void MlmeSetTxRate(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry, struct rt_rtmp_tx_rate_switch * pTxRate);
void MlmeSelectTxRateTable(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry,
u8 **ppTable,
u8 *pTableSize, u8 *pInitTxRateIdx);
void MlmeCalculateChannelQuality(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pMacEntry, unsigned long Now);
void MlmeCheckPsmChange(struct rt_rtmp_adapter *pAd, unsigned long Now32);
void MlmeSetPsmBit(struct rt_rtmp_adapter *pAd, u16 psm);
void MlmeSetTxPreamble(struct rt_rtmp_adapter *pAd, u16 TxPreamble);
void UpdateBasicRateBitmap(struct rt_rtmp_adapter *pAd);
void MlmeUpdateTxRates(struct rt_rtmp_adapter *pAd,
IN BOOLEAN bLinkUp, u8 apidx);
void MlmeUpdateHtTxRates(struct rt_rtmp_adapter *pAd, u8 apidx);
void RTMPCheckRates(struct rt_rtmp_adapter *pAd,
IN u8 SupRate[], IN u8 *SupRateLen);
BOOLEAN RTMPCheckChannel(struct rt_rtmp_adapter *pAd,
u8 CentralChannel, u8 Channel);
BOOLEAN RTMPCheckHt(struct rt_rtmp_adapter *pAd,
u8 Wcid,
struct rt_ht_capability_ie *pHtCapability,
struct rt_add_ht_info_ie *pAddHtInfo);
void StaQuickResponeForRateUpExec(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2,
void *SystemSpecific3);
void RTMPUpdateMlmeRate(struct rt_rtmp_adapter *pAd);
char RTMPMaxRssi(struct rt_rtmp_adapter *pAd,
char Rssi0, char Rssi1, char Rssi2);
#ifdef RT30xx
void AsicSetRxAnt(struct rt_rtmp_adapter *pAd, u8 Ant);
void RTMPFilterCalibration(struct rt_rtmp_adapter *pAd);
#ifdef RTMP_EFUSE_SUPPORT
/*2008/09/11:KH add to support efuse<-- */
int set_eFuseGetFreeBlockCount_Proc(struct rt_rtmp_adapter *pAd, char *arg);
int set_eFusedump_Proc(struct rt_rtmp_adapter *pAd, char *arg);
void eFusePhysicalReadRegisters(struct rt_rtmp_adapter *pAd,
u16 Offset,
u16 Length, u16 *pData);
int RtmpEfuseSupportCheck(struct rt_rtmp_adapter *pAd);
void eFuseGetFreeBlockCount(struct rt_rtmp_adapter *pAd, u32 *EfuseFreeBlock);
int eFuse_init(struct rt_rtmp_adapter *pAd);
/*2008/09/11:KH add to support efuse--> */
#endif /* RTMP_EFUSE_SUPPORT // */
/* add by johnli, RF power sequence setup */
void RT30xxLoadRFNormalModeSetup(struct rt_rtmp_adapter *pAd);
void RT30xxLoadRFSleepModeSetup(struct rt_rtmp_adapter *pAd);
void RT30xxReverseRFSleepModeSetup(struct rt_rtmp_adapter *pAd);
/* end johnli */
#ifdef RT3070
void NICInitRT3070RFRegisters(struct rt_rtmp_adapter *pAd);
#endif /* RT3070 // */
#ifdef RT3090
void NICInitRT3090RFRegisters(struct rt_rtmp_adapter *pAd);
#endif /* RT3090 // */
void RT30xxHaltAction(struct rt_rtmp_adapter *pAd);
void RT30xxSetRxAnt(struct rt_rtmp_adapter *pAd, u8 Ant);
#endif /* RT30xx // */
void AsicEvaluateRxAnt(struct rt_rtmp_adapter *pAd);
void AsicRxAntEvalTimeout(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void APSDPeriodicExec(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry);
u8 RTMPStaFixedTxMode(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry);
void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode, struct rt_mac_table_entry *pEntry);
BOOLEAN RTMPAutoRateSwitchCheck(struct rt_rtmp_adapter *pAd);
int MlmeInit(struct rt_rtmp_adapter *pAd);
void MlmeHandler(struct rt_rtmp_adapter *pAd);
void MlmeHalt(struct rt_rtmp_adapter *pAd);
void MlmeResetRalinkCounters(struct rt_rtmp_adapter *pAd);
void BuildChannelList(struct rt_rtmp_adapter *pAd);
u8 FirstChannel(struct rt_rtmp_adapter *pAd);
u8 NextChannel(struct rt_rtmp_adapter *pAd, u8 channel);
void ChangeToCellPowerLimit(struct rt_rtmp_adapter *pAd,
u8 AironetCellPowerLimit);
/* */
/* Prototypes of function definition in rtmp_tkip.c */
/* */
void RTMPInitTkipEngine(struct rt_rtmp_adapter *pAd,
u8 *pTKey,
u8 KeyId,
u8 *pTA,
u8 *pMICKey,
u8 *pTSC, unsigned long *pIV16, unsigned long *pIV32);
void RTMPInitMICEngine(struct rt_rtmp_adapter *pAd,
u8 *pKey,
u8 *pDA,
u8 *pSA, u8 UserPriority, u8 *pMICKey);
BOOLEAN RTMPTkipCompareMICValue(struct rt_rtmp_adapter *pAd,
u8 *pSrc,
u8 *pDA,
u8 *pSA,
u8 *pMICKey,
u8 UserPriority, u32 Len);
void RTMPCalculateMICValue(struct rt_rtmp_adapter *pAd,
void *pPacket,
u8 *pEncap,
struct rt_cipher_key *pKey, u8 apidx);
void RTMPTkipAppendByte(struct rt_tkip_key_info *pTkip, u8 uChar);
void RTMPTkipAppend(struct rt_tkip_key_info *pTkip, u8 *pSrc, u32 nBytes);
void RTMPTkipGetMIC(struct rt_tkip_key_info *pTkip);
BOOLEAN RTMPSoftDecryptTKIP(struct rt_rtmp_adapter *pAd,
u8 *pData,
unsigned long DataByteCnt,
u8 UserPriority, struct rt_cipher_key *pWpaKey);
BOOLEAN RTMPSoftDecryptAES(struct rt_rtmp_adapter *pAd,
u8 *pData,
unsigned long DataByteCnt, struct rt_cipher_key *pWpaKey);
/* */
/* Prototypes of function definition in cmm_info.c */
/* */
int RT_CfgSetCountryRegion(struct rt_rtmp_adapter *pAd, char *arg, int band);
int RT_CfgSetWirelessMode(struct rt_rtmp_adapter *pAd, char *arg);
int RT_CfgSetShortSlot(struct rt_rtmp_adapter *pAd, char *arg);
int RT_CfgSetWepKey(struct rt_rtmp_adapter *pAd,
char *keyString,
struct rt_cipher_key *pSharedKey, int keyIdx);
int RT_CfgSetWPAPSKKey(struct rt_rtmp_adapter *pAd,
char *keyString,
u8 *pHashStr,
int hashStrLen, u8 *pPMKBuf);
/* */
/* Prototypes of function definition in cmm_info.c */
/* */
void RTMPWPARemoveAllKeys(struct rt_rtmp_adapter *pAd);
void RTMPSetPhyMode(struct rt_rtmp_adapter *pAd, unsigned long phymode);
void RTMPUpdateHTIE(struct rt_ht_capability *pRtHt,
u8 *pMcsSet,
struct rt_ht_capability_ie *pHtCapability,
struct rt_add_ht_info_ie *pAddHtInfo);
void RTMPAddWcidAttributeEntry(struct rt_rtmp_adapter *pAd,
u8 BssIdx,
u8 KeyIdx,
u8 CipherAlg, struct rt_mac_table_entry *pEntry);
char *GetEncryptType(char enc);
char *GetAuthMode(char auth);
void RTMPSetHT(struct rt_rtmp_adapter *pAd, struct rt_oid_set_ht_phymode *pHTPhyMode);
void RTMPSetIndividualHT(struct rt_rtmp_adapter *pAd, u8 apidx);
void RTMPSendWirelessEvent(struct rt_rtmp_adapter *pAd,
u16 Event_flag,
u8 *pAddr, u8 BssIdx, char Rssi);
char ConvertToRssi(struct rt_rtmp_adapter *pAd, char Rssi, u8 RssiNumber);
/*===================================
Function prototype in cmm_wpa.c
=================================== */
void RTMPToWirelessSta(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry,
u8 *pHeader802_3,
u32 HdrLen,
u8 *pData,
u32 DataLen, IN BOOLEAN bClearFrame);
void WpaDerivePTK(struct rt_rtmp_adapter *pAd,
u8 *PMK,
u8 *ANonce,
u8 *AA,
u8 *SNonce,
u8 *SA, u8 *output, u32 len);
void GenRandom(struct rt_rtmp_adapter *pAd, u8 *macAddr, u8 *random);
BOOLEAN RTMPCheckWPAframe(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry,
u8 *pData,
unsigned long DataByteCount, u8 FromWhichBSSID);
void AES_GTK_KEY_UNWRAP(u8 *key,
u8 *plaintext,
u32 c_len, u8 *ciphertext);
BOOLEAN RTMPParseEapolKeyData(struct rt_rtmp_adapter *pAd,
u8 *pKeyData,
u8 KeyDataLen,
u8 GroupKeyIndex,
u8 MsgType,
IN BOOLEAN bWPA2, struct rt_mac_table_entry *pEntry);
void ConstructEapolMsg(struct rt_mac_table_entry *pEntry,
u8 GroupKeyWepStatus,
u8 MsgType,
u8 DefaultKeyIdx,
u8 *KeyNonce,
u8 *TxRSC,
u8 *GTK,
u8 *RSNIE,
u8 RSNIE_Len, struct rt_eapol_packet *pMsg);
int RTMPSoftDecryptBroadCastData(struct rt_rtmp_adapter *pAd,
struct rt_rx_blk *pRxBlk,
IN NDIS_802_11_ENCRYPTION_STATUS
GroupCipher,
struct rt_cipher_key *pShard_key);
void RTMPMakeRSNIE(struct rt_rtmp_adapter *pAd,
u32 AuthMode, u32 WepStatus, u8 apidx);
/* */
/* function prototype in ap_wpa.c */
/* */
void RTMPGetTxTscFromAsic(struct rt_rtmp_adapter *pAd,
u8 apidx, u8 *pTxTsc);
void APInstallPairwiseKey(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry);
u32 APValidateRSNIE(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry,
u8 *pRsnIe, u8 rsnie_len);
void HandleCounterMeasure(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry);
void WPAStart4WayHS(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry, unsigned long TimeInterval);
void WPAStart2WayGroupHS(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry);
void PeerPairMsg1Action(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem);
void PeerPairMsg2Action(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem);
void PeerPairMsg3Action(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem);
void PeerPairMsg4Action(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem);
void PeerGroupMsg1Action(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem);
void PeerGroupMsg2Action(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry,
void *Msg, u32 MsgLen);
void WpaDeriveGTK(u8 *PMK,
u8 *GNonce,
u8 *AA, u8 *output, u32 len);
void AES_GTK_KEY_WRAP(u8 *key,
u8 *plaintext,
u32 p_len, u8 *ciphertext);
/*typedef void (*TIMER_FUNCTION)(unsigned long); */
/* timeout -- ms */
void RTMP_SetPeriodicTimer(struct timer_list *pTimer,
IN unsigned long timeout);
void RTMP_OS_Init_Timer(struct rt_rtmp_adapter *pAd,
struct timer_list *pTimer,
IN TIMER_FUNCTION function, void *data);
void RTMP_OS_Add_Timer(struct timer_list *pTimer,
IN unsigned long timeout);
void RTMP_OS_Mod_Timer(struct timer_list *pTimer,
IN unsigned long timeout);
void RTMP_OS_Del_Timer(struct timer_list *pTimer,
OUT BOOLEAN *pCancelled);
void RTMP_OS_Release_Packet(struct rt_rtmp_adapter *pAd, struct rt_queue_entry *pEntry);
void RTMPusecDelay(unsigned long usec);
int os_alloc_mem(struct rt_rtmp_adapter *pAd,
u8 **mem, unsigned long size);
int os_free_mem(struct rt_rtmp_adapter *pAd, void *mem);
void RTMP_AllocateSharedMemory(struct rt_rtmp_adapter *pAd,
unsigned long Length,
IN BOOLEAN Cached,
void **VirtualAddress,
dma_addr_t *PhysicalAddress);
void RTMPFreeTxRxRingMemory(struct rt_rtmp_adapter *pAd);
int AdapterBlockAllocateMemory(void *handle, void **ppAd);
void RTMP_AllocateTxDescMemory(struct rt_rtmp_adapter *pAd,
u32 Index,
unsigned long Length,
IN BOOLEAN Cached,
void **VirtualAddress,
dma_addr_t *PhysicalAddress);
void RTMP_AllocateFirstTxBuffer(struct rt_rtmp_adapter *pAd,
u32 Index,
unsigned long Length,
IN BOOLEAN Cached,
void **VirtualAddress,
dma_addr_t *PhysicalAddress);
void RTMP_FreeFirstTxBuffer(struct rt_rtmp_adapter *pAd,
unsigned long Length,
IN BOOLEAN Cached,
void *VirtualAddress,
dma_addr_t PhysicalAddress);
void RTMP_AllocateMgmtDescMemory(struct rt_rtmp_adapter *pAd,
unsigned long Length,
IN BOOLEAN Cached,
void **VirtualAddress,
dma_addr_t *PhysicalAddress);
void RTMP_AllocateRxDescMemory(struct rt_rtmp_adapter *pAd,
unsigned long Length,
IN BOOLEAN Cached,
void **VirtualAddress,
dma_addr_t *PhysicalAddress);
void RTMP_FreeDescMemory(struct rt_rtmp_adapter *pAd,
unsigned long Length,
void *VirtualAddress,
dma_addr_t PhysicalAddress);
void *RtmpOSNetPktAlloc(struct rt_rtmp_adapter *pAd, IN int size);
void *RTMP_AllocateRxPacketBuffer(struct rt_rtmp_adapter *pAd,
unsigned long Length,
IN BOOLEAN Cached,
void **VirtualAddress,
OUT dma_addr_t *PhysicalAddress);
void *RTMP_AllocateTxPacketBuffer(struct rt_rtmp_adapter *pAd,
unsigned long Length,
IN BOOLEAN Cached,
void **VirtualAddress);
void *RTMP_AllocateFragPacketBuffer(struct rt_rtmp_adapter *pAd,
unsigned long Length);
void RTMP_QueryPacketInfo(void *pPacket,
struct rt_packet_info *pPacketInfo,
u8 **pSrcBufVA, u32 *pSrcBufLen);
void RTMP_QueryNextPacketInfo(void **ppPacket,
struct rt_packet_info *pPacketInfo,
u8 **pSrcBufVA, u32 *pSrcBufLen);
BOOLEAN RTMP_FillTxBlkInfo(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk);
struct rt_rtmp_sg_list *rt_get_sg_list_from_packet(void *pPacket,
struct rt_rtmp_sg_list *sg);
void announce_802_3_packet(struct rt_rtmp_adapter *pAd, void *pPacket);
u32 BA_Reorder_AMSDU_Announce(struct rt_rtmp_adapter *pAd, void *pPacket);
struct net_device *get_netdev_from_bssid(struct rt_rtmp_adapter *pAd, u8 FromWhichBSSID);
void *duplicate_pkt(struct rt_rtmp_adapter *pAd,
u8 *pHeader802_3,
u32 HdrLen,
u8 *pData,
unsigned long DataSize, u8 FromWhichBSSID);
void *duplicate_pkt_with_TKIP_MIC(struct rt_rtmp_adapter *pAd,
void *pOldPkt);
void ba_flush_reordering_timeout_mpdus(struct rt_rtmp_adapter *pAd,
struct rt_ba_rec_entry *pBAEntry,
unsigned long Now32);
void BAOriSessionSetUp(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry,
u8 TID,
u16 TimeOut,
unsigned long DelayTime, IN BOOLEAN isForced);
void BASessionTearDownALL(struct rt_rtmp_adapter *pAd, u8 Wcid);
BOOLEAN OS_Need_Clone_Packet(void);
void build_tx_packet(struct rt_rtmp_adapter *pAd,
void *pPacket,
u8 *pFrame, unsigned long FrameLen);
void BAOriSessionTearDown(struct rt_rtmp_adapter *pAd,
u8 Wcid,
u8 TID,
IN BOOLEAN bPassive, IN BOOLEAN bForceSend);
void BARecSessionTearDown(struct rt_rtmp_adapter *pAd,
u8 Wcid, u8 TID, IN BOOLEAN bPassive);
BOOLEAN ba_reordering_resource_init(struct rt_rtmp_adapter *pAd, int num);
void ba_reordering_resource_release(struct rt_rtmp_adapter *pAd);
char *rstrtok(char *s, IN const char *ct);
/*//////// common ioctl functions ////////// */
int SetCommonHT(struct rt_rtmp_adapter *pAd);
int WpaCheckEapCode(struct rt_rtmp_adapter *pAd,
u8 *pFrame, u16 FrameLen, u16 OffSet);
void WpaSendMicFailureToWpaSupplicant(struct rt_rtmp_adapter *pAd,
IN BOOLEAN bUnicast);
int wext_notify_event_assoc(struct rt_rtmp_adapter *pAd);
BOOLEAN STARxDoneInterruptHandle(struct rt_rtmp_adapter *pAd, IN BOOLEAN argc);
/* AMPDU packet indication */
void Indicate_AMPDU_Packet(struct rt_rtmp_adapter *pAd,
struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID);
/* AMSDU packet indication */
void Indicate_AMSDU_Packet(struct rt_rtmp_adapter *pAd,
struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID);
/* Normal legacy Rx packet indication */
void Indicate_Legacy_Packet(struct rt_rtmp_adapter *pAd,
struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID);
void Indicate_EAPOL_Packet(struct rt_rtmp_adapter *pAd,
struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID);
void update_os_packet_info(struct rt_rtmp_adapter *pAd,
struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID);
void wlan_802_11_to_802_3_packet(struct rt_rtmp_adapter *pAd,
struct rt_rx_blk *pRxBlk,
u8 *pHeader802_3,
u8 FromWhichBSSID);
/* remove LLC and get 802_3 Header */
#define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \
{ \
u8 *_pRemovedLLCSNAP = NULL, *_pDA, *_pSA; \
\
if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) { \
_pDA = _pRxBlk->pHeader->Addr3; \
_pSA = (u8 *)_pRxBlk->pHeader + sizeof(struct rt_header_802_11); \
} \
else {\
if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_INFRA)) {\
_pDA = _pRxBlk->pHeader->Addr1; \
if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_DLS)) \
_pSA = _pRxBlk->pHeader->Addr2; \
else \
_pSA = _pRxBlk->pHeader->Addr3; \
} \
else { \
_pDA = _pRxBlk->pHeader->Addr1; \
_pSA = _pRxBlk->pHeader->Addr2; \
} \
} \
\
CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \
_pRxBlk->DataSize, _pRemovedLLCSNAP); \
}
void Sta_Announce_or_Forward_802_3_Packet(struct rt_rtmp_adapter *pAd,
void *pPacket,
u8 FromWhichBSSID);
#define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\
Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS);
/*announce_802_3_packet(_pAd, _pPacket); */
void *DuplicatePacket(struct rt_rtmp_adapter *pAd,
void *pPacket, u8 FromWhichBSSID);
void *ClonePacket(struct rt_rtmp_adapter *pAd,
void *pPacket,
u8 *pData, unsigned long DataSize);
/* Normal, AMPDU or AMSDU */
void CmmRxnonRalinkFrameIndicate(struct rt_rtmp_adapter *pAd,
struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID);
void CmmRxRalinkFrameIndicate(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry,
struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID);
void Update_Rssi_Sample(struct rt_rtmp_adapter *pAd,
struct rt_rssi_sample *pRssi, struct rt_rxwi * pRxWI);
void *GetPacketFromRxRing(struct rt_rtmp_adapter *pAd,
OUT PRT28XX_RXD_STRUC pSaveRxD,
OUT BOOLEAN *pbReschedule,
IN u32 *pRxPending);
void *RTMPDeFragmentDataFrame(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk);
enum {
DIDmsg_lnxind_wlansniffrm = 0x00000044,
DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044,
DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044,
DIDmsg_lnxind_wlansniffrm_channel = 0x00030044,
DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044,
DIDmsg_lnxind_wlansniffrm_sq = 0x00050044,
DIDmsg_lnxind_wlansniffrm_signal = 0x00060044,
DIDmsg_lnxind_wlansniffrm_noise = 0x00070044,
DIDmsg_lnxind_wlansniffrm_rate = 0x00080044,
DIDmsg_lnxind_wlansniffrm_istx = 0x00090044,
DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044
};
enum {
P80211ENUM_msgitem_status_no_value = 0x00
};
enum {
P80211ENUM_truth_false = 0x00,
P80211ENUM_truth_true = 0x01
};
/* Definition from madwifi */
struct rt_p80211item_uint32 {
u32 did;
u16 status;
u16 len;
u32 data;
};
struct rt_wlan_ng_prism2_header {
u32 msgcode;
u32 msglen;
#define WLAN_DEVNAMELEN_MAX 16
u8 devname[WLAN_DEVNAMELEN_MAX];
struct rt_p80211item_uint32 hosttime;
struct rt_p80211item_uint32 mactime;
struct rt_p80211item_uint32 channel;
struct rt_p80211item_uint32 rssi;
struct rt_p80211item_uint32 sq;
struct rt_p80211item_uint32 signal;
struct rt_p80211item_uint32 noise;
struct rt_p80211item_uint32 rate;
struct rt_p80211item_uint32 istx;
struct rt_p80211item_uint32 frmlen;
};
/* The radio capture header precedes the 802.11 header. */
struct PACKED rt_ieee80211_radiotap_header {
u8 it_version; /* Version 0. Only increases
* for drastic changes,
* introduction of compatible
* new fields does not count.
*/
u8 it_pad;
u16 it_len; /* length of the whole
* header in bytes, including
* it_version, it_pad,
* it_len, and data fields.
*/
u32 it_present; /* A bitmap telling which
* fields are present. Set bit 31
* (0x80000000) to extend the
* bitmap by another 32 bits.
* Additional extensions are made
* by setting bit 31.
*/
};
enum ieee80211_radiotap_type {
IEEE80211_RADIOTAP_TSFT = 0,
IEEE80211_RADIOTAP_FLAGS = 1,
IEEE80211_RADIOTAP_RATE = 2,
IEEE80211_RADIOTAP_CHANNEL = 3,
IEEE80211_RADIOTAP_FHSS = 4,
IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
IEEE80211_RADIOTAP_ANTENNA = 11,
IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
IEEE80211_RADIOTAP_DB_ANTNOISE = 13
};
#define WLAN_RADIOTAP_PRESENT ( \
(1 << IEEE80211_RADIOTAP_TSFT) | \
(1 << IEEE80211_RADIOTAP_FLAGS) | \
(1 << IEEE80211_RADIOTAP_RATE) | \
0)
struct rt_wlan_radiotap_header {
struct rt_ieee80211_radiotap_header wt_ihdr;
long long wt_tsft;
u8 wt_flags;
u8 wt_rate;
};
/* Definition from madwifi */
void send_monitor_packets(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk);
void RTMPSetDesiredRates(struct rt_rtmp_adapter *pAdapter, long Rates);
int Set_FixedTxMode_Proc(struct rt_rtmp_adapter *pAd, char *arg);
BOOLEAN RT28XXChipsetCheck(IN void *_dev_p);
void RT28XXDMADisable(struct rt_rtmp_adapter *pAd);
void RT28XXDMAEnable(struct rt_rtmp_adapter *pAd);
void RT28xx_UpdateBeaconToAsic(struct rt_rtmp_adapter *pAd,
int apidx,
unsigned long BeaconLen, unsigned long UpdatePos);
int rt28xx_init(struct rt_rtmp_adapter *pAd,
char *pDefaultMac, char *pHostName);
int RtmpNetTaskInit(struct rt_rtmp_adapter *pAd);
void RtmpNetTaskExit(struct rt_rtmp_adapter *pAd);
int RtmpMgmtTaskInit(struct rt_rtmp_adapter *pAd);
void RtmpMgmtTaskExit(struct rt_rtmp_adapter *pAd);
void tbtt_tasklet(unsigned long data);
struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd,
struct rt_rtmp_os_netdev_op_hook *pNetHook);
BOOLEAN RtmpPhyNetDevExit(struct rt_rtmp_adapter *pAd, struct net_device *net_dev);
int RtmpRaDevCtrlInit(struct rt_rtmp_adapter *pAd, IN RTMP_INF_TYPE infType);
BOOLEAN RtmpRaDevCtrlExit(struct rt_rtmp_adapter *pAd);
#ifdef RTMP_MAC_PCI
/* */
/* Function Prototype in cmm_data_pci.c */
/* */
u16 RtmpPCI_WriteTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
IN BOOLEAN bIsLast, u16 *FreeNumber);
u16 RtmpPCI_WriteSingleTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
IN BOOLEAN bIsLast,
u16 *FreeNumber);
u16 RtmpPCI_WriteMultiTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
u8 frameNum, u16 *FreeNumber);
u16 RtmpPCI_WriteFragTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
u8 fragNum, u16 *FreeNumber);
u16 RtmpPCI_WriteSubTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
IN BOOLEAN bIsLast, u16 *FreeNumber);
void RtmpPCI_FinalWriteTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
u16 totalMPDUSize,
u16 FirstTxIdx);
void RtmpPCIDataLastTxIdx(struct rt_rtmp_adapter *pAd,
u8 QueIdx, u16 LastTxIdx);
void RtmpPCIDataKickOut(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk, u8 QueIdx);
int RtmpPCIMgmtKickOut(struct rt_rtmp_adapter *pAd,
u8 QueIdx,
void *pPacket,
u8 *pSrcBufVA, u32 SrcBufLen);
int RTMPCheckRxError(struct rt_rtmp_adapter *pAd,
struct rt_header_802_11 *pHeader,
struct rt_rxwi *pRxWI, IN PRT28XX_RXD_STRUC pRxD);
BOOLEAN RT28xxPciAsicRadioOff(struct rt_rtmp_adapter *pAd,
u8 Level, u16 TbttNumToNextWakeUp);
BOOLEAN RT28xxPciAsicRadioOn(struct rt_rtmp_adapter *pAd, u8 Level);
void RTMPInitPCIeLinkCtrlValue(struct rt_rtmp_adapter *pAd);
void RTMPFindHostPCIDev(struct rt_rtmp_adapter *pAd);
void RTMPPCIeLinkCtrlValueRestore(struct rt_rtmp_adapter *pAd, u8 Level);
void RTMPPCIeLinkCtrlSetting(struct rt_rtmp_adapter *pAd, u16 Max);
void RTMPrt3xSetPCIePowerLinkCtrl(struct rt_rtmp_adapter *pAd);
void PsPollWakeExec(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void RadioOnExec(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2, void *SystemSpecific3);
void RT28xxPciStaAsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx);
void RT28xxPciStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd,
u16 TbttNumToNextWakeUp);
void RT28xxPciMlmeRadioOn(struct rt_rtmp_adapter *pAd);
void RT28xxPciMlmeRadioOFF(struct rt_rtmp_adapter *pAd);
#endif /* RTMP_MAC_PCI // */
#ifdef RTMP_MAC_USB
/* */
/* Function Prototype in rtusb_bulk.c */
/* */
void RTUSBInitTxDesc(struct rt_rtmp_adapter *pAd,
struct rt_tx_context *pTxContext,
u8 BulkOutPipeId, IN usb_complete_t Func);
void RTUSBInitHTTxDesc(struct rt_rtmp_adapter *pAd,
struct rt_ht_tx_context *pTxContext,
u8 BulkOutPipeId,
unsigned long BulkOutSize, IN usb_complete_t Func);
void RTUSBInitRxDesc(struct rt_rtmp_adapter *pAd, struct rt_rx_context *pRxContext);
void RTUSBCleanUpDataBulkOutQueue(struct rt_rtmp_adapter *pAd);
void RTUSBCancelPendingBulkOutIRP(struct rt_rtmp_adapter *pAd);
void RTUSBBulkOutDataPacket(struct rt_rtmp_adapter *pAd,
u8 BulkOutPipeId, u8 Index);
void RTUSBBulkOutNullFrame(struct rt_rtmp_adapter *pAd);
void RTUSBBulkOutRTSFrame(struct rt_rtmp_adapter *pAd);
void RTUSBCancelPendingBulkInIRP(struct rt_rtmp_adapter *pAd);
void RTUSBCancelPendingIRPs(struct rt_rtmp_adapter *pAd);
void RTUSBBulkOutMLMEPacket(struct rt_rtmp_adapter *pAd, u8 Index);
void RTUSBBulkOutPsPoll(struct rt_rtmp_adapter *pAd);
void RTUSBCleanUpMLMEBulkOutQueue(struct rt_rtmp_adapter *pAd);
void RTUSBKickBulkOut(struct rt_rtmp_adapter *pAd);
void RTUSBBulkReceive(struct rt_rtmp_adapter *pAd);
void DoBulkIn(struct rt_rtmp_adapter *pAd);
void RTUSBInitRxDesc(struct rt_rtmp_adapter *pAd, struct rt_rx_context *pRxContext);
void RTUSBBulkRxHandle(IN unsigned long data);
/* */
/* Function Prototype in rtusb_io.c */
/* */
int RTUSBMultiRead(struct rt_rtmp_adapter *pAd,
u16 Offset, u8 *pData, u16 length);
int RTUSBMultiWrite(struct rt_rtmp_adapter *pAd,
u16 Offset, const u8 *pData, u16 length);
int RTUSBMultiWrite_OneByte(struct rt_rtmp_adapter *pAd,
u16 Offset, const u8 *pData);
int RTUSBReadBBPRegister(struct rt_rtmp_adapter *pAd,
u8 Id, u8 *pValue);
int RTUSBWriteBBPRegister(struct rt_rtmp_adapter *pAd,
u8 Id, u8 Value);
int RTUSBWriteRFRegister(struct rt_rtmp_adapter *pAd, u32 Value);
int RTUSB_VendorRequest(struct rt_rtmp_adapter *pAd,
u32 TransferFlags,
u8 ReservedBits,
u8 Request,
u16 Value,
u16 Index,
void *TransferBuffer,
u32 TransferBufferLength);
int RTUSBReadEEPROM(struct rt_rtmp_adapter *pAd,
u16 Offset, u8 *pData, u16 length);
int RTUSBWriteEEPROM(struct rt_rtmp_adapter *pAd,
u16 Offset, u8 *pData, u16 length);
void RTUSBPutToSleep(struct rt_rtmp_adapter *pAd);
int RTUSBWakeUp(struct rt_rtmp_adapter *pAd);
void RTUSBInitializeCmdQ(struct rt_cmdq *cmdq);
int RTUSBEnqueueCmdFromNdis(struct rt_rtmp_adapter *pAd,
IN NDIS_OID Oid,
IN BOOLEAN SetInformation,
void *pInformationBuffer,
u32 InformationBufferLength);
int RTUSBEnqueueInternalCmd(struct rt_rtmp_adapter *pAd,
IN NDIS_OID Oid,
void *pInformationBuffer,
u32 InformationBufferLength);
void RTUSBDequeueCmd(struct rt_cmdq *cmdq, struct rt_cmdqelmt * * pcmdqelmt);
int RTUSBCmdThread(IN void *Context);
void RTUSBBssBeaconExit(struct rt_rtmp_adapter *pAd);
void RTUSBBssBeaconStop(struct rt_rtmp_adapter *pAd);
void RTUSBBssBeaconStart(struct rt_rtmp_adapter *pAd);
void RTUSBBssBeaconInit(struct rt_rtmp_adapter *pAd);
void RTUSBWatchDog(struct rt_rtmp_adapter *pAd);
int RTUSBWriteMACRegister(struct rt_rtmp_adapter *pAd,
u16 Offset, u32 Value);
int RTUSBReadMACRegister(struct rt_rtmp_adapter *pAd,
u16 Offset, u32 *pValue);
int RTUSBSingleWrite(struct rt_rtmp_adapter *pAd,
u16 Offset, u16 Value);
int RTUSBFirmwareWrite(struct rt_rtmp_adapter *pAd,
const u8 *pFwImage, unsigned long FwLen);
int RTUSBVenderReset(struct rt_rtmp_adapter *pAd);
int RTUSBSetHardWareRegister(struct rt_rtmp_adapter *pAdapter, void *pBuf);
int RTUSBQueryHardWareRegister(struct rt_rtmp_adapter *pAdapter,
void *pBuf);
void CMDHandler(struct rt_rtmp_adapter *pAd);
int RTUSBWriteHWMACAddress(struct rt_rtmp_adapter *pAdapter);
void MacTableInitialize(struct rt_rtmp_adapter *pAd);
void MlmeSetPsm(struct rt_rtmp_adapter *pAd, u16 psm);
int RTMPWPAAddKeyProc(struct rt_rtmp_adapter *pAd, void *pBuf);
void AsicRxAntEvalAction(struct rt_rtmp_adapter *pAd);
void append_pkt(struct rt_rtmp_adapter *pAd,
u8 *pHeader802_3,
u32 HdrLen,
u8 *pData,
unsigned long DataSize, void **ppPacket);
u32 deaggregate_AMSDU_announce(struct rt_rtmp_adapter *pAd,
void *pPacket,
u8 *pData, unsigned long DataSize);
int RTMPCheckRxError(struct rt_rtmp_adapter *pAd,
struct rt_header_802_11 *pHeader,
struct rt_rxwi *pRxWI,
IN PRT28XX_RXD_STRUC pRxINFO);
void RTUSBMlmeHardTransmit(struct rt_rtmp_adapter *pAd, struct rt_mgmt *pMgmt);
int MlmeThread(void *Context);
/* */
/* Function Prototype in rtusb_data.c */
/* */
int RTUSBFreeDescriptorRequest(struct rt_rtmp_adapter *pAd,
u8 BulkOutPipeId,
u32 NumberRequired);
BOOLEAN RTUSBNeedQueueBackForAgg(struct rt_rtmp_adapter *pAd, u8 BulkOutPipeId);
void RTMPWriteTxInfo(struct rt_rtmp_adapter *pAd,
struct rt_txinfo *pTxInfo,
u16 USBDMApktLen,
IN BOOLEAN bWiv,
u8 QueueSel, u8 NextValid, u8 TxBurst);
/* */
/* Function Prototype in cmm_data_usb.c */
/* */
u16 RtmpUSB_WriteSubTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
IN BOOLEAN bIsLast, u16 *FreeNumber);
u16 RtmpUSB_WriteSingleTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
IN BOOLEAN bIsLast,
u16 *FreeNumber);
u16 RtmpUSB_WriteFragTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
u8 fragNum, u16 *FreeNumber);
u16 RtmpUSB_WriteMultiTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
u8 frameNum, u16 *FreeNumber);
void RtmpUSB_FinalWriteTxResource(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk,
u16 totalMPDUSize, u16 TxIdx);
void RtmpUSBDataLastTxIdx(struct rt_rtmp_adapter *pAd,
u8 QueIdx, u16 TxIdx);
void RtmpUSBDataKickOut(struct rt_rtmp_adapter *pAd,
struct rt_tx_blk *pTxBlk, u8 QueIdx);
int RtmpUSBMgmtKickOut(struct rt_rtmp_adapter *pAd,
u8 QueIdx,
void *pPacket,
u8 *pSrcBufVA, u32 SrcBufLen);
void RtmpUSBNullFrameKickOut(struct rt_rtmp_adapter *pAd,
u8 QueIdx,
u8 *pNullFrame, u32 frameLen);
void RtmpUsbStaAsicForceWakeupTimeout(void *SystemSpecific1,
void *FunctionContext,
void *SystemSpecific2,
void *SystemSpecific3);
void RT28xxUsbStaAsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx);
void RT28xxUsbStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd,
u16 TbttNumToNextWakeUp);
void RT28xxUsbMlmeRadioOn(struct rt_rtmp_adapter *pAd);
void RT28xxUsbMlmeRadioOFF(struct rt_rtmp_adapter *pAd);
#endif /* RTMP_MAC_USB // */
void AsicTurnOffRFClk(struct rt_rtmp_adapter *pAd, u8 Channel);
void AsicTurnOnRFClk(struct rt_rtmp_adapter *pAd, u8 Channel);
#ifdef RTMP_TIMER_TASK_SUPPORT
int RtmpTimerQThread(IN void *Context);
struct rt_rtmp_timer_task_entry *RtmpTimerQInsert(struct rt_rtmp_adapter *pAd,
struct rt_ralink_timer *pTimer);
BOOLEAN RtmpTimerQRemove(struct rt_rtmp_adapter *pAd,
struct rt_ralink_timer *pTimer);
void RtmpTimerQExit(struct rt_rtmp_adapter *pAd);
void RtmpTimerQInit(struct rt_rtmp_adapter *pAd);
#endif /* RTMP_TIMER_TASK_SUPPORT // */
void AsicStaBbpTuning(struct rt_rtmp_adapter *pAd);
BOOLEAN StaAddMacTableEntry(struct rt_rtmp_adapter *pAd,
struct rt_mac_table_entry *pEntry,
u8 MaxSupportedRateIn500Kbps,
struct rt_ht_capability_ie *pHtCapability,
u8 HtCapabilityLen,
struct rt_add_ht_info_ie *pAddHtInfo,
u8 AddHtInfoLen, u16 CapabilityInfo);
BOOLEAN AUTH_ReqSend(struct rt_rtmp_adapter *pAd,
struct rt_mlme_queue_elem *pElem,
struct rt_ralink_timer *pAuthTimer,
char *pSMName,
u16 SeqNo,
u8 *pNewElement, unsigned long ElementLen);
void RTMP_IndicateMediaState(struct rt_rtmp_adapter *pAd);
void ReSyncBeaconTime(struct rt_rtmp_adapter *pAd);
void RTMPSetAGCInitValue(struct rt_rtmp_adapter *pAd, u8 BandWidth);
int rt28xx_close(struct net_device *dev);
int rt28xx_open(struct net_device *dev);
#define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++)
#define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--)
#define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt)
#ifdef LINUX
__inline int VIRTUAL_IF_UP(struct rt_rtmp_adapter *pAd)
{
if (VIRTUAL_IF_NUM(pAd) == 0) {
if (rt28xx_open(pAd->net_dev) != 0) {
DBGPRINT(RT_DEBUG_TRACE,
("rt28xx_open return fail!\n"));
return -1;
}
} else {
}
VIRTUAL_IF_INC(pAd);
return 0;
}
__inline void VIRTUAL_IF_DOWN(struct rt_rtmp_adapter *pAd)
{
VIRTUAL_IF_DEC(pAd);
if (VIRTUAL_IF_NUM(pAd) == 0)
rt28xx_close(pAd->net_dev);
return;
}
#endif /* LINUX // */
/*
OS Related funciton prototype definitions.
TODO: Maybe we need to move these function prototypes to other proper place.
*/
int RtmpOSWrielessEventSend(struct rt_rtmp_adapter *pAd,
u32 eventType,
int flags,
u8 *pSrcMac,
u8 *pData, u32 dataLen);
int RtmpOSNetDevAddrSet(struct net_device *pNetDev, u8 *pMacAddr);
int RtmpOSNetDevAttach(struct net_device *pNetDev,
struct rt_rtmp_os_netdev_op_hook *pDevOpHook);
void RtmpOSNetDevClose(struct net_device *pNetDev);
void RtmpOSNetDevDetach(struct net_device *pNetDev);
int RtmpOSNetDevAlloc(struct net_device **pNewNetDev, u32 privDataSize);
void RtmpOSNetDevFree(struct net_device *pNetDev);
struct net_device *RtmpOSNetDevGetByName(struct net_device *pNetDev, char *pDevName);
void RtmpOSNetDeviceRefPut(struct net_device *pNetDev);
struct net_device *RtmpOSNetDevCreate(struct rt_rtmp_adapter *pAd,
int devType,
int devNum,
int privMemSize, char *pNamePrefix);
/*
Task operation related function prototypes
*/
void RtmpOSTaskCustomize(struct rt_rtmp_os_task *pTask);
int RtmpOSTaskNotifyToExit(struct rt_rtmp_os_task *pTask);
int RtmpOSTaskKill(struct rt_rtmp_os_task *pTask);
int RtmpOSTaskInit(struct rt_rtmp_os_task *pTask,
char *pTaskName, void * pPriv);
int RtmpOSTaskAttach(struct rt_rtmp_os_task *pTask,
IN int (*fn) (void *), IN void *arg);
/*
File operation related function prototypes
*/
struct file *RtmpOSFileOpen(IN char *pPath, IN int flag, IN int mode);
int RtmpOSFileClose(struct file *osfd);
void RtmpOSFileSeek(struct file *osfd, IN int offset);
int RtmpOSFileRead(struct file *osfd, IN char *pDataPtr, IN int readLen);
int RtmpOSFileWrite(struct file *osfd, IN char *pDataPtr, IN int writeLen);
#endif /* __RTMP_H__ */
|