.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11 |
---|
3 | 4 | * remains copyright by the original authors |
---|
.. | .. |
---|
15 | 16 | * |
---|
16 | 17 | * Modified for Realtek's wi-fi cards by Andrea Merello |
---|
17 | 18 | * <andrea.merello@gmail.com> |
---|
18 | | - * |
---|
19 | | - * This program is free software; you can redistribute it and/or modify |
---|
20 | | - * it under the terms of the GNU General Public License version 2 as |
---|
21 | | - * published by the Free Software Foundation. See README and COPYING for |
---|
22 | | - * more details. |
---|
23 | 19 | */ |
---|
24 | 20 | #ifndef IEEE80211_H |
---|
25 | 21 | #define IEEE80211_H |
---|
.. | .. |
---|
173 | 169 | #define MGN_MCS14 0x8e |
---|
174 | 170 | #define MGN_MCS15 0x8f |
---|
175 | 171 | |
---|
176 | | -#define aSifsTime ((priv->ieee80211->current_network.mode == IEEE_A || \ |
---|
| 172 | +#define aSifsTime ((priv->ieee80211->current_network.mode == IEEE_A || \ |
---|
177 | 173 | priv->ieee80211->current_network.mode == IEEE_N_24G || \ |
---|
178 | | - priv->ieee80211->current_network.mode == IEEE_N_5G) ? \ |
---|
| 174 | + priv->ieee80211->current_network.mode == IEEE_N_5G) ? \ |
---|
179 | 175 | 16 : 10) |
---|
180 | 176 | |
---|
181 | 177 | #define MGMT_QUEUE_NUM 5 |
---|
.. | .. |
---|
296 | 292 | #define ieee80211_wx_get_encode_ext ieee80211_wx_get_encode_ext_rsl |
---|
297 | 293 | |
---|
298 | 294 | |
---|
299 | | -typedef struct ieee_param { |
---|
| 295 | +struct ieee_param { |
---|
300 | 296 | u32 cmd; |
---|
301 | 297 | u8 sta_addr[ETH_ALEN]; |
---|
302 | 298 | union { |
---|
.. | .. |
---|
323 | 319 | u8 key[0]; |
---|
324 | 320 | } crypt; |
---|
325 | 321 | } u; |
---|
326 | | -} ieee_param; |
---|
| 322 | +}; |
---|
327 | 323 | |
---|
328 | 324 | |
---|
329 | 325 | // linux under 2.6.9 release may not support it, so modify it for common use |
---|
.. | .. |
---|
391 | 387 | #define IEEE80211_STYPE_ACK 0x00D0 |
---|
392 | 388 | #define IEEE80211_STYPE_CFEND 0x00E0 |
---|
393 | 389 | #define IEEE80211_STYPE_CFENDACK 0x00F0 |
---|
394 | | -#define IEEE80211_STYPE_BLOCKACK 0x0094 |
---|
| 390 | +#define IEEE80211_STYPE_BLOCKACK 0x0094 |
---|
395 | 391 | |
---|
396 | 392 | /* data */ |
---|
397 | 393 | #define IEEE80211_STYPE_DATA 0x0000 |
---|
.. | .. |
---|
456 | 452 | printk(KERN_DEBUG "ieee80211: " fmt, ## args); } while (0) |
---|
457 | 453 | //wb added to debug out data buf |
---|
458 | 454 | //if you want print DATA buffer related BA, please set ieee80211_debug_level to DATA|BA |
---|
459 | | -#define IEEE80211_DEBUG_DATA(level, data, datalen) \ |
---|
460 | | - do { if ((ieee80211_debug_level & (level)) == (level)) \ |
---|
461 | | - { \ |
---|
462 | | - int i; \ |
---|
463 | | - u8 *pdata = (u8 *) data; \ |
---|
464 | | - printk(KERN_DEBUG "ieee80211: %s()\n", __func__); \ |
---|
465 | | - for (i = 0; i < (int)(datalen); i++) \ |
---|
466 | | - { \ |
---|
467 | | - printk("%2x ", pdata[i]); \ |
---|
468 | | - if ((i + 1) % 16 == 0) printk("\n"); \ |
---|
469 | | - } \ |
---|
470 | | - printk("\n"); \ |
---|
471 | | - } \ |
---|
| 455 | +#define IEEE80211_DEBUG_DATA(level, data, datalen) \ |
---|
| 456 | + do { if ((ieee80211_debug_level & (level)) == (level)) \ |
---|
| 457 | + { \ |
---|
| 458 | + int i; \ |
---|
| 459 | + u8 *pdata = (u8 *)data; \ |
---|
| 460 | + printk(KERN_DEBUG "ieee80211: %s()\n", __func__); \ |
---|
| 461 | + for (i = 0; i < (int)(datalen); i++) { \ |
---|
| 462 | + printk("%2x ", pdata[i]); \ |
---|
| 463 | + if ((i + 1) % 16 == 0) \ |
---|
| 464 | + printk("\n"); \ |
---|
| 465 | + } \ |
---|
| 466 | + printk("\n"); \ |
---|
| 467 | + } \ |
---|
472 | 468 | } while (0) |
---|
473 | 469 | #else |
---|
474 | 470 | #define IEEE80211_DEBUG (level, fmt, args...) do {} while (0) |
---|
475 | | -#define IEEE80211_DEBUG_DATA (level, data, datalen) do {} while(0) |
---|
| 471 | +#define IEEE80211_DEBUG_DATA (level, data, datalen) do {} while (0) |
---|
476 | 472 | #endif /* CONFIG_IEEE80211_DEBUG */ |
---|
477 | 473 | |
---|
478 | 474 | /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ |
---|
.. | .. |
---|
890 | 886 | struct rtl_80211_hdr { |
---|
891 | 887 | __le16 frame_ctl; |
---|
892 | 888 | __le16 duration_id; |
---|
893 | | - u8 payload[0]; |
---|
| 889 | + u8 payload[]; |
---|
894 | 890 | } __packed; |
---|
895 | 891 | |
---|
896 | 892 | struct rtl_80211_hdr_1addr { |
---|
897 | 893 | __le16 frame_ctl; |
---|
898 | 894 | __le16 duration_id; |
---|
899 | 895 | u8 addr1[ETH_ALEN]; |
---|
900 | | - u8 payload[0]; |
---|
| 896 | + u8 payload[]; |
---|
901 | 897 | } __packed; |
---|
902 | 898 | |
---|
903 | 899 | struct rtl_80211_hdr_2addr { |
---|
.. | .. |
---|
905 | 901 | __le16 duration_id; |
---|
906 | 902 | u8 addr1[ETH_ALEN]; |
---|
907 | 903 | u8 addr2[ETH_ALEN]; |
---|
908 | | - u8 payload[0]; |
---|
| 904 | + u8 payload[]; |
---|
909 | 905 | } __packed; |
---|
910 | 906 | |
---|
911 | 907 | struct rtl_80211_hdr_3addr { |
---|
.. | .. |
---|
915 | 911 | u8 addr2[ETH_ALEN]; |
---|
916 | 912 | u8 addr3[ETH_ALEN]; |
---|
917 | 913 | __le16 seq_ctl; |
---|
918 | | - u8 payload[0]; |
---|
| 914 | + u8 payload[]; |
---|
919 | 915 | } __packed; |
---|
920 | 916 | |
---|
921 | 917 | struct rtl_80211_hdr_4addr { |
---|
.. | .. |
---|
926 | 922 | u8 addr3[ETH_ALEN]; |
---|
927 | 923 | __le16 seq_ctl; |
---|
928 | 924 | u8 addr4[ETH_ALEN]; |
---|
929 | | - u8 payload[0]; |
---|
| 925 | + u8 payload[]; |
---|
930 | 926 | } __packed; |
---|
931 | 927 | |
---|
932 | 928 | struct rtl_80211_hdr_3addrqos { |
---|
.. | .. |
---|
955 | 951 | struct ieee80211_info_element { |
---|
956 | 952 | u8 id; |
---|
957 | 953 | u8 len; |
---|
958 | | - u8 data[0]; |
---|
| 954 | + u8 data[]; |
---|
959 | 955 | } __packed; |
---|
960 | 956 | |
---|
961 | 957 | struct ieee80211_authentication { |
---|
.. | .. |
---|
964 | 960 | __le16 transaction; |
---|
965 | 961 | __le16 status; |
---|
966 | 962 | /*challenge*/ |
---|
967 | | - struct ieee80211_info_element info_element[0]; |
---|
| 963 | + struct ieee80211_info_element info_element[]; |
---|
968 | 964 | } __packed; |
---|
969 | 965 | |
---|
970 | 966 | struct ieee80211_disassoc { |
---|
.. | .. |
---|
975 | 971 | struct ieee80211_probe_request { |
---|
976 | 972 | struct rtl_80211_hdr_3addr header; |
---|
977 | 973 | /* SSID, supported rates */ |
---|
978 | | - struct ieee80211_info_element info_element[0]; |
---|
| 974 | + struct ieee80211_info_element info_element[]; |
---|
979 | 975 | } __packed; |
---|
980 | 976 | |
---|
981 | 977 | struct ieee80211_probe_response { |
---|
.. | .. |
---|
986 | 982 | /* SSID, supported rates, FH params, DS params, |
---|
987 | 983 | * CF params, IBSS params, TIM (if beacon), RSN |
---|
988 | 984 | */ |
---|
989 | | - struct ieee80211_info_element info_element[0]; |
---|
| 985 | + struct ieee80211_info_element info_element[]; |
---|
990 | 986 | } __packed; |
---|
991 | 987 | |
---|
992 | 988 | /* Alias beacon for probe_response */ |
---|
.. | .. |
---|
997 | 993 | __le16 capability; |
---|
998 | 994 | __le16 listen_interval; |
---|
999 | 995 | /* SSID, supported rates, RSN */ |
---|
1000 | | - struct ieee80211_info_element info_element[0]; |
---|
| 996 | + struct ieee80211_info_element info_element[]; |
---|
1001 | 997 | } __packed; |
---|
1002 | 998 | |
---|
1003 | 999 | struct ieee80211_reassoc_request_frame { |
---|
.. | .. |
---|
1006 | 1002 | __le16 listen_interval; |
---|
1007 | 1003 | u8 current_ap[ETH_ALEN]; |
---|
1008 | 1004 | /* SSID, supported rates, RSN */ |
---|
1009 | | - struct ieee80211_info_element info_element[0]; |
---|
| 1005 | + struct ieee80211_info_element info_element[]; |
---|
1010 | 1006 | } __packed; |
---|
1011 | 1007 | |
---|
1012 | 1008 | struct ieee80211_assoc_response_frame { |
---|
.. | .. |
---|
1014 | 1010 | __le16 capability; |
---|
1015 | 1011 | __le16 status; |
---|
1016 | 1012 | __le16 aid; |
---|
1017 | | - struct ieee80211_info_element info_element[0]; /* supported rates */ |
---|
| 1013 | + struct ieee80211_info_element info_element[]; /* supported rates */ |
---|
1018 | 1014 | } __packed; |
---|
1019 | 1015 | |
---|
1020 | 1016 | struct ieee80211_txb { |
---|
.. | .. |
---|
1025 | 1021 | u16 reserved; |
---|
1026 | 1022 | __le16 frag_size; |
---|
1027 | 1023 | __le16 payload_size; |
---|
1028 | | - struct sk_buff *fragments[0]; |
---|
| 1024 | + struct sk_buff *fragments[]; |
---|
1029 | 1025 | }; |
---|
1030 | 1026 | |
---|
1031 | 1027 | #define MAX_TX_AGG_COUNT 16 |
---|
.. | .. |
---|
1329 | 1325 | |
---|
1330 | 1326 | struct ieee80211_network { |
---|
1331 | 1327 | /* These entries are used to identify a unique network */ |
---|
1332 | | - u8 bssid[ETH_ALEN]; |
---|
| 1328 | + u8 bssid[ETH_ALEN]; /* u16 aligned! */ |
---|
1333 | 1329 | u8 channel; |
---|
| 1330 | + |
---|
| 1331 | + // CCXv4 S59, MBSSID. |
---|
| 1332 | + bool bMBssidValid; |
---|
| 1333 | + u8 MBssid[ETH_ALEN]; /* u16 aligned! */ |
---|
| 1334 | + u8 MBssidMask; |
---|
1334 | 1335 | /* Ensure null-terminated for any debug msgs */ |
---|
1335 | 1336 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
---|
1336 | 1337 | u8 ssid_len; |
---|
.. | .. |
---|
1341 | 1342 | bool bCkipSupported; |
---|
1342 | 1343 | bool bCcxRmEnable; |
---|
1343 | 1344 | u16 CcxRmState[2]; |
---|
1344 | | - // CCXv4 S59, MBSSID. |
---|
1345 | | - bool bMBssidValid; |
---|
1346 | | - u8 MBssidMask; |
---|
1347 | | - u8 MBssid[6]; |
---|
1348 | 1345 | // CCX 2 S38, WLAN Device Version Number element. Annie, 2006-08-20. |
---|
1349 | 1346 | bool bWithCcxVerNum; |
---|
1350 | 1347 | u8 BssCcxVerNumber; |
---|
.. | .. |
---|
1461 | 1458 | struct ieee80211_txb *txb; |
---|
1462 | 1459 | }; |
---|
1463 | 1460 | |
---|
1464 | | -typedef struct _bandwidth_autoswitch { |
---|
| 1461 | +struct bandwidth_autoswitch { |
---|
1465 | 1462 | long threshold_20Mhzto40Mhz; |
---|
1466 | 1463 | long threshold_40Mhzto20Mhz; |
---|
1467 | 1464 | bool bforced_tx20Mhz; |
---|
1468 | 1465 | bool bautoswitch_enable; |
---|
1469 | | -} bandwidth_autoswitch, *pbandwidth_autoswitch; |
---|
| 1466 | +}; |
---|
1470 | 1467 | |
---|
1471 | 1468 | |
---|
1472 | 1469 | //added by amy for order |
---|
1473 | 1470 | |
---|
1474 | 1471 | #define REORDER_WIN_SIZE 128 |
---|
1475 | 1472 | #define REORDER_ENTRY_NUM 128 |
---|
1476 | | -typedef struct _RX_REORDER_ENTRY { |
---|
| 1473 | +struct rx_reorder_entry { |
---|
1477 | 1474 | struct list_head List; |
---|
1478 | 1475 | u16 SeqNum; |
---|
1479 | 1476 | struct ieee80211_rxb *prxb; |
---|
1480 | | -} RX_REORDER_ENTRY, *PRX_REORDER_ENTRY; |
---|
| 1477 | +}; |
---|
1481 | 1478 | //added by amy for order |
---|
1482 | 1479 | typedef enum _Fsync_State { |
---|
1483 | 1480 | Default_Fsync, |
---|
.. | .. |
---|
1505 | 1502 | RT_NO_ACTION = 4, |
---|
1506 | 1503 | } RT_JOIN_ACTION; |
---|
1507 | 1504 | |
---|
1508 | | -typedef struct _IbssParms { |
---|
| 1505 | +struct ibss_parms { |
---|
1509 | 1506 | u16 atimWin; |
---|
1510 | | -} IbssParms, *PIbssParms; |
---|
| 1507 | +}; |
---|
1511 | 1508 | #define MAX_NUM_RATES 264 // Max num of support rates element: 8, Max num of ext. support rate: 255. 061122, by rcnjko. |
---|
1512 | 1509 | |
---|
1513 | 1510 | // RF state. |
---|
.. | .. |
---|
1517 | 1514 | eRfOff |
---|
1518 | 1515 | } RT_RF_POWER_STATE; |
---|
1519 | 1516 | |
---|
1520 | | -typedef struct _RT_POWER_SAVE_CONTROL { |
---|
| 1517 | +struct rt_power_save_control { |
---|
1521 | 1518 | |
---|
1522 | 1519 | // |
---|
1523 | 1520 | // Inactive Power Save(IPS) : Disable RF when disconnected |
---|
.. | .. |
---|
1553 | 1550 | struct octet_string tmpSuppRateSet; |
---|
1554 | 1551 | u8 tmpSuppRateBuf[MAX_NUM_RATES]; |
---|
1555 | 1552 | bool bTmpSuppRate; |
---|
1556 | | - IbssParms tmpIbpm; |
---|
| 1553 | + struct ibss_parms tmpIbpm; |
---|
1557 | 1554 | bool bTmpIbpm; |
---|
1558 | 1555 | |
---|
1559 | 1556 | // |
---|
.. | .. |
---|
1561 | 1558 | // |
---|
1562 | 1559 | bool bLeisurePs; |
---|
1563 | 1560 | |
---|
1564 | | -} RT_POWER_SAVE_CONTROL, *PRT_POWER_SAVE_CONTROL; |
---|
| 1561 | +}; |
---|
1565 | 1562 | |
---|
1566 | 1563 | typedef u32 RT_RF_CHANGE_SOURCE; |
---|
1567 | 1564 | #define RF_CHANGE_BY_SW BIT(31) |
---|
.. | .. |
---|
1585 | 1582 | } country_code_type_t; |
---|
1586 | 1583 | |
---|
1587 | 1584 | #define RT_MAX_LD_SLOT_NUM 10 |
---|
1588 | | -typedef struct _RT_LINK_DETECT_T { |
---|
| 1585 | +struct rt_link_detect { |
---|
1589 | 1586 | |
---|
1590 | 1587 | u32 NumRecvBcnInPeriod; |
---|
1591 | 1588 | u32 NumRecvDataInPeriod; |
---|
.. | .. |
---|
1598 | 1595 | u32 NumTxOkInPeriod; |
---|
1599 | 1596 | u32 NumRxOkInPeriod; |
---|
1600 | 1597 | bool bBusyTraffic; |
---|
1601 | | -} RT_LINK_DETECT_T, *PRT_LINK_DETECT_T; |
---|
| 1598 | +}; |
---|
1602 | 1599 | |
---|
1603 | 1600 | |
---|
1604 | 1601 | struct ieee80211_device { |
---|
.. | .. |
---|
1652 | 1649 | struct list_head Rx_TS_Pending_List; |
---|
1653 | 1650 | struct list_head Rx_TS_Unused_List; |
---|
1654 | 1651 | struct rx_ts_record RxTsRecord[TOTAL_TS_NUM]; |
---|
1655 | | -//#ifdef TO_DO_LIST |
---|
1656 | | - RX_REORDER_ENTRY RxReorderEntry[128]; |
---|
| 1652 | + struct rx_reorder_entry RxReorderEntry[128]; |
---|
1657 | 1653 | struct list_head RxReorder_Unused_List; |
---|
1658 | | -//#endif |
---|
1659 | 1654 | // Qos related. Added by Annie, 2005-11-01. |
---|
1660 | 1655 | // PSTA_QOS pStaQos; |
---|
1661 | 1656 | u8 ForcedPriority; // Force per-packet priority 1~7. (default: 0, not to force it.) |
---|
.. | .. |
---|
1771 | 1766 | |
---|
1772 | 1767 | /* map of allowed channels. 0 is dummy */ |
---|
1773 | 1768 | // FIXME: remember to default to a basic channel plan depending of the PHY type |
---|
1774 | | - void *pDot11dInfo; |
---|
| 1769 | + void *dot11d_info; |
---|
1775 | 1770 | bool bGlobalDomain; |
---|
1776 | 1771 | int rate; /* current rate */ |
---|
1777 | 1772 | int basic_rate; |
---|
.. | .. |
---|
1870 | 1865 | Fsync_State fsync_state; |
---|
1871 | 1866 | bool bis_any_nonbepkts; |
---|
1872 | 1867 | //20Mhz 40Mhz AutoSwitch Threshold |
---|
1873 | | - bandwidth_autoswitch bandwidth_auto_switch; |
---|
| 1868 | + struct bandwidth_autoswitch bandwidth_auto_switch; |
---|
1874 | 1869 | //for txpower tracking |
---|
1875 | 1870 | bool FwRWRF; |
---|
1876 | 1871 | |
---|
1877 | 1872 | //added by amy for AP roaming |
---|
1878 | | - RT_LINK_DETECT_T LinkDetectInfo; |
---|
| 1873 | + struct rt_link_detect LinkDetectInfo; |
---|
1879 | 1874 | //added by amy for ps |
---|
1880 | | - RT_POWER_SAVE_CONTROL PowerSaveControl; |
---|
| 1875 | + struct rt_power_save_control PowerSaveControl; |
---|
1881 | 1876 | //} |
---|
1882 | 1877 | /* used if IEEE_SOFTMAC_TX_QUEUE is set */ |
---|
1883 | 1878 | struct tx_pending tx_pending; |
---|
.. | .. |
---|
2012 | 2007 | /* This must be the last item so that it points to the data |
---|
2013 | 2008 | * allocated beyond this structure by alloc_ieee80211 |
---|
2014 | 2009 | */ |
---|
2015 | | - u8 priv[0]; |
---|
| 2010 | + u8 priv[]; |
---|
2016 | 2011 | }; |
---|
2017 | 2012 | |
---|
2018 | 2013 | #define IEEE_A (1<<0) |
---|
2019 | 2014 | #define IEEE_B (1<<1) |
---|
2020 | 2015 | #define IEEE_G (1<<2) |
---|
2021 | | -#define IEEE_N_24G (1<<4) |
---|
2022 | | -#define IEEE_N_5G (1<<5) |
---|
| 2016 | +#define IEEE_N_24G (1<<4) |
---|
| 2017 | +#define IEEE_N_5G (1<<5) |
---|
2023 | 2018 | #define IEEE_MODE_MASK (IEEE_A | IEEE_B | IEEE_G) |
---|
2024 | 2019 | |
---|
2025 | 2020 | /* Generate a 802.11 header */ |
---|
.. | .. |
---|
2378 | 2373 | extern u8 MCS_FILTER_ALL[]; |
---|
2379 | 2374 | extern u16 MCS_DATA_RATE[2][2][77]; |
---|
2380 | 2375 | u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame); |
---|
2381 | | -//extern void HTSetConnectBwModeCallback(unsigned long data); |
---|
2382 | 2376 | void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo); |
---|
2383 | 2377 | bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee); |
---|
2384 | | -u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); |
---|
2385 | | -u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); |
---|
2386 | 2378 | u16 TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate); |
---|
2387 | 2379 | //function in BAPROC.c |
---|
2388 | 2380 | int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb); |
---|
.. | .. |
---|
2395 | 2387 | void BaSetupTimeOut(struct timer_list *t); |
---|
2396 | 2388 | void TxBaInactTimeout(struct timer_list *t); |
---|
2397 | 2389 | void RxBaInactTimeout(struct timer_list *t); |
---|
2398 | | -void ResetBaEntry(PBA_RECORD pBA); |
---|
| 2390 | +void ResetBaEntry(struct ba_record *pBA); |
---|
2399 | 2391 | //function in TS.c |
---|
2400 | 2392 | bool GetTs( |
---|
2401 | 2393 | struct ieee80211_device *ieee, |
---|
.. | .. |
---|
2432 | 2424 | return escaped; |
---|
2433 | 2425 | } |
---|
2434 | 2426 | |
---|
2435 | | - snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid); |
---|
| 2427 | + snprintf(escaped, sizeof(escaped), "%*pE", essid_len, essid); |
---|
2436 | 2428 | return escaped; |
---|
2437 | 2429 | } |
---|
2438 | 2430 | |
---|