···69697070#define SO_RXQ_OVFL 4071717272+#define SO_WIFI_STATUS 417373+#define SCM_WIFI_STATUS SO_WIFI_STATUS7474+7275/* O_NONBLOCK clashes with the bits used for socket types. Therefore we7376 * have to define SOCK_NONBLOCK to a different value here.7477 */
···61616262#define SO_RXQ_OVFL 0x402163636464+#define SO_WIFI_STATUS 0x40226565+#define SCM_WIFI_STATUS SO_WIFI_STATUS6666+6467/* O_NONBLOCK clashes with the bits used for socket types. Therefore we6568 * have to define SOCK_NONBLOCK to a different value here.6669 */
···25252626config ATH9K_PCI2727 bool "Atheros ath9k PCI/PCIe bus support"2828+ default y2829 depends on ATH9K && PCI2930 ---help---3031 This option enables the PCI bus support in ath9k.
···254254 int r;255255256256 sband = wiphy->bands[IEEE80211_BAND_2GHZ];257257+ if (!sband)258258+ return;257259258260 /*259261 * If no country IE has been received always enable active scan
+13-2
drivers/net/wireless/b43/xmit.c
···175175 }176176}177177178178+/* TODO: verify if needed for SSLPN or LCN */178179static u16 b43_generate_tx_phy_ctl1(struct b43_wldev *dev, u8 bitrate)179180{180181 const struct b43_phy *phy = &dev->phy;···257256 unsigned int plcp_fragment_len;258257 u32 mac_ctl = 0;259258 u16 phy_ctl = 0;259259+ bool fill_phy_ctl1 = (phy->type == B43_PHYTYPE_LP ||260260+ phy->type == B43_PHYTYPE_N ||261261+ phy->type == B43_PHYTYPE_HT);260262 u8 extra_ft = 0;261263 struct ieee80211_rate *txrate;262264 struct ieee80211_tx_rate *rates;···535531 extra_ft |= B43_TXH_EFT_RTSFB_CCK;536532537533 if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS &&538538- phy->type == B43_PHYTYPE_N) {534534+ fill_phy_ctl1) {539535 txhdr->phy_ctl1_rts = cpu_to_le16(540536 b43_generate_tx_phy_ctl1(dev, rts_rate));541537 txhdr->phy_ctl1_rts_fb = cpu_to_le16(···556552 break;557553 }558554559559- if (phy->type == B43_PHYTYPE_N) {555555+ if (fill_phy_ctl1) {560556 txhdr->phy_ctl1 =561557 cpu_to_le16(b43_generate_tx_phy_ctl1(dev, rate));562558 txhdr->phy_ctl1_fb =···740736741737 /* Link quality statistics */742738 switch (chanstat & B43_RX_CHAN_PHYTYPE) {739739+ case B43_PHYTYPE_HT:740740+ /* TODO: is max the right choice? */741741+ status.signal = max_t(__s8,742742+ max(rxhdr->phy_ht_power0, rxhdr->phy_ht_power1),743743+ rxhdr->phy_ht_power2);744744+ break;743745 case B43_PHYTYPE_N:746746+ /* Broadcom has code for min and avg, but always uses max */744747 if (rxhdr->power0 == 16 || rxhdr->power0 == 32)745748 status.signal = max(rxhdr->power1, rxhdr->power2);746749 else
+15-1
drivers/net/wireless/b43/xmit.h
···249249 } __packed;250250 } __packed;251251 union {252252+ /* HT-PHY */253253+ struct {254254+ PAD_BYTES(1);255255+ __s8 phy_ht_power0;256256+ } __packed;257257+252258 /* RSSI for N-PHYs */253259 struct {254260 __s8 power2;···263257264258 __le16 phy_status2; /* PHY RX Status 2 */265259 } __packed;266266- __le16 phy_status3; /* PHY RX Status 3 */260260+ union {261261+ /* HT-PHY */262262+ struct {263263+ __s8 phy_ht_power1;264264+ __s8 phy_ht_power2;265265+ } __packed;266266+267267+ __le16 phy_status3; /* PHY RX Status 3 */268268+ } __packed;267269 union {268270 /* Tested with 598.314, 644.1001 and 666.2 */269271 struct {
···1818#define _bcmchip_h_19192020/* bcm4329 */2121-/* SDIO device core, ID 0x829 */2222-#define BCM4329_CORE_BUS_BASE 0x180110002323-/* internal memory core, ID 0x80e */2424-#define BCM4329_CORE_SOCRAM_BASE 0x180030002525-/* ARM Cortex M3 core, ID 0x82a */2626-#define BCM4329_CORE_ARM_BASE 0x180020002727-#define BCM4329_RAMSIZE 0x480002821/* firmware name */2922#define BCM4329_FW_NAME "brcm/bcm4329-fullmac-4.bin"3023#define BCM4329_NV_NAME "brcm/bcm4329-fullmac-4.txt"
+5-13
drivers/net/wireless/brcm80211/brcmfmac/dhd.h
···8787#define TOE_TX_CSUM_OL 0x000000018888#define TOE_RX_CSUM_OL 0x0000000289899090-#define BRCMF_BSS_INFO_VERSION 108 /* current ver of brcmf_bss_info struct */9090+#define BRCMF_BSS_INFO_VERSION 108 /* curr ver of brcmf_bss_info_le struct */91919292/* size of brcmf_scan_params not including variable length array */9393#define BRCMF_SCAN_PARAMS_FIXED_SIZE 64···122122123123/* For supporting multiple interfaces */124124#define BRCMF_MAX_IFS 16125125-#define BRCMF_DEL_IF -0xe126126-#define BRCMF_BAD_IF -0xf127125128126#define DOT11_BSSTYPE_ANY 2129127#define DOT11_MAX_DEFAULT_KEYS 4···363365 * Applications MUST CHECK ie_offset field and length field to access IEs and364366 * next bss_info structure in a vector (in struct brcmf_scan_results)365367 */366366-struct brcmf_bss_info {368368+struct brcmf_bss_info_le {367369 __le32 version; /* version field */368370 __le32 length; /* byte length of data in this record,369371 * starting at version and including IEs···464466 u32 buflen;465467 u32 version;466468 u32 count;467467- struct brcmf_bss_info bss_info[1];469469+ struct brcmf_bss_info_le bss_info_le[];468470};469471470472struct brcmf_scan_results_le {471473 __le32 buflen;472474 __le32 version;473475 __le32 count;474474- struct brcmf_bss_info bss_info[1];475476};476477477478/* used for association with a specific BSSID and chanspec list */···490493 struct brcmf_assoc_params_le params_le;491494};492495493493-/* size of brcmf_scan_results not including variable length array */494494-#define BRCMF_SCAN_RESULTS_FIXED_SIZE \495495- (sizeof(struct brcmf_scan_results) - sizeof(struct brcmf_bss_info))496496-497496/* incremental scan results struct */498497struct brcmf_iscan_results {499498 union {···504511505512/* size of brcmf_iscan_results not including variable length array */506513#define BRCMF_ISCAN_RESULTS_FIXED_SIZE \507507- (BRCMF_SCAN_RESULTS_FIXED_SIZE + \514514+ (sizeof(struct brcmf_scan_results) + \508515 offsetof(struct brcmf_iscan_results, results))509516510517struct brcmf_wsec_key {···727734extern void brcmf_c_init(void);728735729736extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx,730730- struct net_device *ndev, char *name, u8 *mac_addr,731731- u32 flags, u8 bssidx);737737+ char *name, u8 *mac_addr);732738extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx);733739734740/* Send packet to dongle via data channel */
···3030#include "mac80211_if.h"3131#include "ucode_loader.h"3232#include "main.h"3333+#include "soc.h"33343435/*3536 * Indication for txflowcontrol that all priority bits in3637 * TXQ_STOP_FOR_PRIOFC_MASK are to be considered.3738 */3838-#define ALLPRIO -13939-4040-/*4141- * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.4242- */4343-#define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1)3939+#define ALLPRIO -144404541/* watchdog timer, in unit of ms */4646-#define TIMER_INTERVAL_WATCHDOG 10004242+#define TIMER_INTERVAL_WATCHDOG 10004743/* radio monitor timer, in unit of ms */4848-#define TIMER_INTERVAL_RADIOCHK 8004949-5050-/* Max MPC timeout, in unit of watchdog */5151-#ifndef BRCMS_MPC_MAX_DELAYCNT5252-#define BRCMS_MPC_MAX_DELAYCNT 105353-#endif5454-5555-/* Min MPC timeout, in unit of watchdog */5656-#define BRCMS_MPC_MIN_DELAYCNT 15757-#define BRCMS_MPC_THRESHOLD 3 /* MPC count threshold level */4444+#define TIMER_INTERVAL_RADIOCHK 80058455946/* beacon interval, in unit of 1024TU */6060-#define BEACON_INTERVAL_DEFAULT 1006161-/* DTIM interval, in unit of beacon interval */6262-#define DTIM_INTERVAL_DEFAULT 36363-6464-/* Scale down delays to accommodate QT slow speed */6565-/* beacon interval, in unit of 1024TU */6666-#define BEACON_INTERVAL_DEF_QT 206767-/* DTIM interval, in unit of beacon interval */6868-#define DTIM_INTERVAL_DEF_QT 16969-7070-#define TBTT_ALIGN_LEEWAY_US 100 /* min leeway before first TBTT in us */4747+#define BEACON_INTERVAL_DEFAULT 10071487249/* n-mode support capability */7350/* 2x2 includes both 1x1 & 2x2 devices···5578#define WL_11N_3x3 35679#define WL_11N_4x4 457805858-/* define 11n feature disable flags */5959-#define WLFEATURE_DISABLE_11N 0x000000016060-#define WLFEATURE_DISABLE_11N_STBC_TX 0x000000026161-#define WLFEATURE_DISABLE_11N_STBC_RX 0x000000046262-#define WLFEATURE_DISABLE_11N_SGI_TX 0x000000086363-#define WLFEATURE_DISABLE_11N_SGI_RX 0x000000106464-#define WLFEATURE_DISABLE_11N_AMPDU_TX 0x000000206565-#define WLFEATURE_DISABLE_11N_AMPDU_RX 0x000000406666-#define WLFEATURE_DISABLE_11N_GF 0x000000808181+#define EDCF_ACI_MASK 0x608282+#define EDCF_ACI_SHIFT 58383+#define EDCF_ECWMIN_MASK 0x0f8484+#define EDCF_ECWMAX_SHIFT 48585+#define EDCF_AIFSN_MASK 0x0f8686+#define EDCF_AIFSN_MAX 158787+#define EDCF_ECWMAX_MASK 0xf067886868-#define EDCF_ACI_MASK 0x606969-#define EDCF_ACI_SHIFT 57070-#define EDCF_ECWMIN_MASK 0x0f7171-#define EDCF_ECWMAX_SHIFT 47272-#define EDCF_AIFSN_MASK 0x0f7373-#define EDCF_AIFSN_MAX 157474-#define EDCF_ECWMAX_MASK 0xf08989+#define EDCF_AC_BE_TXOP_STA 0x00009090+#define EDCF_AC_BK_TXOP_STA 0x00009191+#define EDCF_AC_VO_ACI_STA 0x629292+#define EDCF_AC_VO_ECW_STA 0x329393+#define EDCF_AC_VI_ACI_STA 0x429494+#define EDCF_AC_VI_ECW_STA 0x439595+#define EDCF_AC_BK_ECW_STA 0xA49696+#define EDCF_AC_VI_TXOP_STA 0x005e9797+#define EDCF_AC_VO_TXOP_STA 0x002f9898+#define EDCF_AC_BE_ACI_STA 0x039999+#define EDCF_AC_BE_ECW_STA 0xA4100100+#define EDCF_AC_BK_ACI_STA 0x27101101+#define EDCF_AC_VO_TXOP_AP 0x002f751027676-#define EDCF_AC_BE_TXOP_STA 0x00007777-#define EDCF_AC_BK_TXOP_STA 0x00007878-#define EDCF_AC_VO_ACI_STA 0x627979-#define EDCF_AC_VO_ECW_STA 0x328080-#define EDCF_AC_VI_ACI_STA 0x428181-#define EDCF_AC_VI_ECW_STA 0x438282-#define EDCF_AC_BK_ECW_STA 0xA48383-#define EDCF_AC_VI_TXOP_STA 0x005e8484-#define EDCF_AC_VO_TXOP_STA 0x002f8585-#define EDCF_AC_BE_ACI_STA 0x038686-#define EDCF_AC_BE_ECW_STA 0xA48787-#define EDCF_AC_BK_ACI_STA 0x278888-#define EDCF_AC_VO_TXOP_AP 0x002f103103+#define EDCF_TXOP2USEC(txop) ((txop) << 5)104104+#define EDCF_ECW2CW(exp) ((1 << (exp)) - 1)891059090-#define EDCF_TXOP2USEC(txop) ((txop) << 5)9191-#define EDCF_ECW2CW(exp) ((1 << (exp)) - 1)106106+#define APHY_SYMBOL_TIME 4107107+#define APHY_PREAMBLE_TIME 16108108+#define APHY_SIGNAL_TIME 4109109+#define APHY_SIFS_TIME 16110110+#define APHY_SERVICE_NBITS 16111111+#define APHY_TAIL_NBITS 6112112+#define BPHY_SIFS_TIME 10113113+#define BPHY_PLCP_SHORT_TIME 96921149393-#define APHY_SYMBOL_TIME 49494-#define APHY_PREAMBLE_TIME 169595-#define APHY_SIGNAL_TIME 49696-#define APHY_SIFS_TIME 169797-#define APHY_SERVICE_NBITS 169898-#define APHY_TAIL_NBITS 69999-#define BPHY_SIFS_TIME 10100100-#define BPHY_PLCP_SHORT_TIME 96101101-102102-#define PREN_PREAMBLE 24103103-#define PREN_MM_EXT 12104104-#define PREN_PREAMBLE_EXT 4115115+#define PREN_PREAMBLE 24116116+#define PREN_MM_EXT 12117117+#define PREN_PREAMBLE_EXT 4105118106119#define DOT11_MAC_HDR_LEN 24107107-#define DOT11_ACK_LEN 10108108-#define DOT11_BA_LEN 4120120+#define DOT11_ACK_LEN 10121121+#define DOT11_BA_LEN 4109122#define DOT11_OFDM_SIGNAL_EXTENSION 6110123#define DOT11_MIN_FRAG_LEN 256111111-#define DOT11_RTS_LEN 16112112-#define DOT11_CTS_LEN 10124124+#define DOT11_RTS_LEN 16125125+#define DOT11_CTS_LEN 10113126#define DOT11_BA_BITMAP_LEN 128114127#define DOT11_MIN_BEACON_PERIOD 1115128#define DOT11_MAX_BEACON_PERIOD 0xFFFF116116-#define DOT11_MAXNUMFRAGS 16129129+#define DOT11_MAXNUMFRAGS 16117130#define DOT11_MAX_FRAG_LEN 2346118131119119-#define BPHY_PLCP_TIME 192120120-#define RIFS_11N_TIME 2132132+#define BPHY_PLCP_TIME 192133133+#define RIFS_11N_TIME 2121134122122-#define WME_VER 1123123-#define WME_SUBTYPE_PARAM_IE 1124124-#define WME_TYPE 2125125-#define WME_OUI "\x00\x50\xf2"126126-127127-#define AC_BE 0128128-#define AC_BK 1129129-#define AC_VI 2130130-#define AC_VO 3131131-132132-#define BCN_TMPL_LEN 512 /* length of the BCN template area */135135+/* length of the BCN template area */136136+#define BCN_TMPL_LEN 512133137134138/* brcms_bss_info flag bit values */135135-#define BRCMS_BSS_HT 0x0020 /* BSS is HT (MIMO) capable */139139+#define BRCMS_BSS_HT 0x0020 /* BSS is HT (MIMO) capable */136140137137-/* Flags used in brcms_c_txq_info.stopped */138138-/* per prio flow control bits */139139-#define TXQ_STOP_FOR_PRIOFC_MASK 0x000000FF140140-/* stop txq enqueue for packet drain */141141-#define TXQ_STOP_FOR_PKT_DRAIN 0x00000100142142-/* stop txq enqueue for ampdu flow control */143143-#define TXQ_STOP_FOR_AMPDU_FLOW_CNTRL 0x00000200144144-145145-#define BRCMS_HWRXOFF 38 /* chip rx buffer offset */146146-147147-/* Find basic rate for a given rate */148148-static u8 brcms_basic_rate(struct brcms_c_info *wlc, u32 rspec)149149-{150150- if (is_mcs_rate(rspec))151151- return wlc->band->basic_rate[mcs_table[rspec & RSPEC_RATE_MASK]152152- .leg_ofdm];153153- return wlc->band->basic_rate[rspec & RSPEC_RATE_MASK];154154-}155155-156156-static u16 frametype(u32 rspec, u8 mimoframe)157157-{158158- if (is_mcs_rate(rspec))159159- return mimoframe;160160- return is_cck_rate(rspec) ? FT_CCK : FT_OFDM;161161-}141141+/* chip rx buffer offset */142142+#define BRCMS_HWRXOFF 38162143163144/* rfdisable delay timer 500 ms, runs of ALP clock */164164-#define RFDISABLE_DEFAULT 10000000145145+#define RFDISABLE_DEFAULT 10000000165146166147#define BRCMS_TEMPSENSE_PERIOD 10 /* 10 second timeout */167148···129194 * These constants are used ONLY by wlc_prio2prec_map. Do not use them130195 * elsewhere.131196 */132132-#define _BRCMS_PREC_NONE 0 /* None = - */133133-#define _BRCMS_PREC_BK 2 /* BK - Background */134134-#define _BRCMS_PREC_BE 4 /* BE - Best-effort */135135-#define _BRCMS_PREC_EE 6 /* EE - Excellent-effort */136136-#define _BRCMS_PREC_CL 8 /* CL - Controlled Load */137137-#define _BRCMS_PREC_VI 10 /* Vi - Video */138138-#define _BRCMS_PREC_VO 12 /* Vo - Voice */139139-#define _BRCMS_PREC_NC 14 /* NC - Network Control */197197+#define _BRCMS_PREC_NONE 0 /* None = - */198198+#define _BRCMS_PREC_BK 2 /* BK - Background */199199+#define _BRCMS_PREC_BE 4 /* BE - Best-effort */200200+#define _BRCMS_PREC_EE 6 /* EE - Excellent-effort */201201+#define _BRCMS_PREC_CL 8 /* CL - Controlled Load */202202+#define _BRCMS_PREC_VI 10 /* Vi - Video */203203+#define _BRCMS_PREC_VO 12 /* Vo - Voice */204204+#define _BRCMS_PREC_NC 14 /* NC - Network Control */140205141141-/* The BSS is generating beacons in HW */142142-#define BRCMS_BSSCFG_HW_BCN 0x20206206+/* synthpu_dly times in us */207207+#define SYNTHPU_DLY_APHY_US 3700208208+#define SYNTHPU_DLY_BPHY_US 1050209209+#define SYNTHPU_DLY_NPHY_US 2048210210+#define SYNTHPU_DLY_LPPHY_US 300143211144144-#define SYNTHPU_DLY_APHY_US 3700 /* a phy synthpu_dly time in us */145145-#define SYNTHPU_DLY_BPHY_US 1050 /* b/g phy synthpu_dly time in us */146146-#define SYNTHPU_DLY_NPHY_US 2048 /* n phy REV3 synthpu_dly time in us */147147-#define SYNTHPU_DLY_LPPHY_US 300 /* lpphy synthpu_dly time in us */148148-149149-#define SYNTHPU_DLY_PHY_US_QT 100 /* QT synthpu_dly time in us */150150-151151-#define ANTCNT 10 /* vanilla M_MAX_ANTCNT value */212212+#define ANTCNT 10 /* vanilla M_MAX_ANTCNT val */152213153214/* Per-AC retry limit register definitions; uses defs.h bitfield macros */154154-#define EDCF_SHORT_S 0155155-#define EDCF_SFB_S 4156156-#define EDCF_LONG_S 8157157-#define EDCF_LFB_S 12158158-#define EDCF_SHORT_M BITFIELD_MASK(4)159159-#define EDCF_SFB_M BITFIELD_MASK(4)160160-#define EDCF_LONG_M BITFIELD_MASK(4)161161-#define EDCF_LFB_M BITFIELD_MASK(4)215215+#define EDCF_SHORT_S 0216216+#define EDCF_SFB_S 4217217+#define EDCF_LONG_S 8218218+#define EDCF_LFB_S 12219219+#define EDCF_SHORT_M BITFIELD_MASK(4)220220+#define EDCF_SFB_M BITFIELD_MASK(4)221221+#define EDCF_LONG_M BITFIELD_MASK(4)222222+#define EDCF_LFB_M BITFIELD_MASK(4)162223163163-#define RETRY_SHORT_DEF 7 /* Default Short retry Limit */164164-#define RETRY_SHORT_MAX 255 /* Maximum Short retry Limit */165165-#define RETRY_LONG_DEF 4 /* Default Long retry count */166166-#define RETRY_SHORT_FB 3 /* Short count for fallback rate */167167-#define RETRY_LONG_FB 2 /* Long count for fallback rate */224224+#define RETRY_SHORT_DEF 7 /* Default Short retry Limit */225225+#define RETRY_SHORT_MAX 255 /* Maximum Short retry Limit */226226+#define RETRY_LONG_DEF 4 /* Default Long retry count */227227+#define RETRY_SHORT_FB 3 /* Short count for fb rate */228228+#define RETRY_LONG_FB 2 /* Long count for fb rate */168229169169-#define APHY_CWMIN 15170170-#define PHY_CWMAX 1023230230+#define APHY_CWMIN 15231231+#define PHY_CWMAX 1023171232172172-#define EDCF_AIFSN_MIN 1233233+#define EDCF_AIFSN_MIN 1173234174174-#define FRAGNUM_MASK 0xF235235+#define FRAGNUM_MASK 0xF175236176176-#define APHY_SLOT_TIME 9177177-#define BPHY_SLOT_TIME 20237237+#define APHY_SLOT_TIME 9238238+#define BPHY_SLOT_TIME 20178239179179-#define WL_SPURAVOID_OFF 0180180-#define WL_SPURAVOID_ON1 1181181-#define WL_SPURAVOID_ON2 2240240+#define WL_SPURAVOID_OFF 0241241+#define WL_SPURAVOID_ON1 1242242+#define WL_SPURAVOID_ON2 2182243183244/* invalid core flags, use the saved coreflags */184184-#define BRCMS_USE_COREFLAGS 0xffffffff245245+#define BRCMS_USE_COREFLAGS 0xffffffff185246186247/* values for PLCPHdr_override */187187-#define BRCMS_PLCP_AUTO -1188188-#define BRCMS_PLCP_SHORT 0189189-#define BRCMS_PLCP_LONG 1248248+#define BRCMS_PLCP_AUTO -1249249+#define BRCMS_PLCP_SHORT 0250250+#define BRCMS_PLCP_LONG 1190251191252/* values for g_protection_override and n_protection_override */192253#define BRCMS_PROTECTION_AUTO -1193254#define BRCMS_PROTECTION_OFF 0194255#define BRCMS_PROTECTION_ON 1195256#define BRCMS_PROTECTION_MMHDR_ONLY 2196196-#define BRCMS_PROTECTION_CTS_ONLY 3257257+#define BRCMS_PROTECTION_CTS_ONLY 3197258198259/* values for g_protection_control and n_protection_control */199199-#define BRCMS_PROTECTION_CTL_OFF 0260260+#define BRCMS_PROTECTION_CTL_OFF 0200261#define BRCMS_PROTECTION_CTL_LOCAL 1201262#define BRCMS_PROTECTION_CTL_OVERLAP 2202263203264/* values for n_protection */204265#define BRCMS_N_PROTECTION_OFF 0205266#define BRCMS_N_PROTECTION_OPTIONAL 1206206-#define BRCMS_N_PROTECTION_20IN40 2267267+#define BRCMS_N_PROTECTION_20IN40 2207268#define BRCMS_N_PROTECTION_MIXEDMODE 3208269209270/* values for band specific 40MHz capabilities */210210-#define BRCMS_N_BW_20ALL 0211211-#define BRCMS_N_BW_40ALL 1212212-#define BRCMS_N_BW_20IN2G_40IN5G 2271271+#define BRCMS_N_BW_20ALL 0272272+#define BRCMS_N_BW_40ALL 1273273+#define BRCMS_N_BW_20IN2G_40IN5G 2213274214275/* bitflags for SGI support (sgi_rx iovar) */215276#define BRCMS_N_SGI_20 0x01···213282214283/* defines used by the nrate iovar */215284/* MSC in use,indicates b0-6 holds an mcs */216216-#define NRATE_MCS_INUSE 0x00000080285285+#define NRATE_MCS_INUSE 0x00000080217286/* rate/mcs value */218218-#define NRATE_RATE_MASK 0x0000007f287287+#define NRATE_RATE_MASK 0x0000007f219288/* stf mode mask: siso, cdd, stbc, sdm */220220-#define NRATE_STF_MASK 0x0000ff00289289+#define NRATE_STF_MASK 0x0000ff00221290/* stf mode shift */222222-#define NRATE_STF_SHIFT 8223223-/* bit indicates override both rate & mode */224224-#define NRATE_OVERRIDE 0x80000000291291+#define NRATE_STF_SHIFT 8225292/* bit indicate to override mcs only */226226-#define NRATE_OVERRIDE_MCS_ONLY 0x40000000227227-#define NRATE_SGI_MASK 0x00800000 /* sgi mode */228228-#define NRATE_SGI_SHIFT 23 /* sgi mode */229229-#define NRATE_LDPC_CODING 0x00400000 /* bit indicates adv coding in use */230230-#define NRATE_LDPC_SHIFT 22 /* ldpc shift */293293+#define NRATE_OVERRIDE_MCS_ONLY 0x40000000294294+#define NRATE_SGI_MASK 0x00800000 /* sgi mode */295295+#define NRATE_SGI_SHIFT 23 /* sgi mode */296296+#define NRATE_LDPC_CODING 0x00400000 /* adv coding in use */297297+#define NRATE_LDPC_SHIFT 22 /* ldpc shift */231298232232-#define NRATE_STF_SISO 0 /* stf mode SISO */233233-#define NRATE_STF_CDD 1 /* stf mode CDD */234234-#define NRATE_STF_STBC 2 /* stf mode STBC */235235-#define NRATE_STF_SDM 3 /* stf mode SDM */299299+#define NRATE_STF_SISO 0 /* stf mode SISO */300300+#define NRATE_STF_CDD 1 /* stf mode CDD */301301+#define NRATE_STF_STBC 2 /* stf mode STBC */302302+#define NRATE_STF_SDM 3 /* stf mode SDM */236303237237-#define MAX_DMA_SEGS 4304304+#define MAX_DMA_SEGS 4238305239306/* Max # of entries in Tx FIFO based on 4kb page size */240240-#define NTXD 256307307+#define NTXD 256241308/* Max # of entries in Rx FIFO based on 4kb page size */242242-#define NRXD 256309309+#define NRXD 256243310244311/* try to keep this # rbufs posted to the chip */245245-#define NRXBUFPOST 32312312+#define NRXBUFPOST 32246313247314/* data msg txq hiwat mark */248248-#define BRCMS_DATAHIWAT 50315315+#define BRCMS_DATAHIWAT 50249316250250-/* bounded rx loops */251251-#define RXBND 8 /* max # frames to process in brcms_c_recv() */252252-#define TXSBND 8 /* max # tx status to process in wlc_txstatus() */253253-254254-/*255255- * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.256256- */257257-#define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1)317317+/* max # frames to process in brcms_c_recv() */318318+#define RXBND 8319319+/* max # tx status to process in wlc_txstatus() */320320+#define TXSBND 8258321259322/* brcmu_format_flags() bit description structure */260323struct brcms_c_bit_desc {···300375#endif /* BCMDBG */301376302377/* TX FIFO number to WME/802.1E Access Category */303303-static const u8 wme_fifo2ac[] = { AC_BK, AC_BE, AC_VI, AC_VO, AC_BE, AC_BE };378378+static const u8 wme_fifo2ac[] = {379379+ IEEE80211_AC_BK,380380+ IEEE80211_AC_BE,381381+ IEEE80211_AC_VI,382382+ IEEE80211_AC_VO,383383+ IEEE80211_AC_BE,384384+ IEEE80211_AC_BE385385+};304386305305-/* WME/802.1E Access Category to TX FIFO number */306306-static const u8 wme_ac2fifo[] = { 1, 0, 2, 3 };387387+/* ieee80211 Access Category to TX FIFO number */388388+static const u8 wme_ac2fifo[] = {389389+ TX_AC_VO_FIFO,390390+ TX_AC_VI_FIFO,391391+ TX_AC_BE_FIFO,392392+ TX_AC_BK_FIFO393393+};307394308395/* 802.1D Priority to precedence queue mapping */309396const u8 wlc_prio2prec_map[] = {···342405 {9, 58, 22, 14, 14, 5},343406};344407345345-static const u8 acbitmap2maxprio[] = {346346- PRIO_8021D_BE, PRIO_8021D_BE, PRIO_8021D_BK, PRIO_8021D_BK,347347- PRIO_8021D_VI, PRIO_8021D_VI, PRIO_8021D_VI, PRIO_8021D_VI,348348- PRIO_8021D_VO, PRIO_8021D_VO, PRIO_8021D_VO, PRIO_8021D_VO,349349- PRIO_8021D_VO, PRIO_8021D_VO, PRIO_8021D_VO, PRIO_8021D_VO350350-};351351-352408#ifdef BCMDBG353409static const char * const fifo_names[] = {354410 "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };···353423/* pointer to most recently allocated wl/wlc */354424static struct brcms_c_info *wlc_info_dbg = (struct brcms_c_info *) (NULL);355425#endif426426+427427+/* Find basic rate for a given rate */428428+static u8 brcms_basic_rate(struct brcms_c_info *wlc, u32 rspec)429429+{430430+ if (is_mcs_rate(rspec))431431+ return wlc->band->basic_rate[mcs_table[rspec & RSPEC_RATE_MASK]432432+ .leg_ofdm];433433+ return wlc->band->basic_rate[rspec & RSPEC_RATE_MASK];434434+}435435+436436+static u16 frametype(u32 rspec, u8 mimoframe)437437+{438438+ if (is_mcs_rate(rspec))439439+ return mimoframe;440440+ return is_cck_rate(rspec) ? FT_CCK : FT_OFDM;441441+}356442357443/* currently the best mechanism for determining SIFS is the band in use */358444static u16 get_sifs(struct brcms_band *band)···414468 return BRCMS_20_MHZ;415469416470 return BRCMS_10_MHZ;417417-}418418-419419-/*420420- * return true if Minimum Power Consumption should421421- * be entered, false otherwise422422- */423423-static bool brcms_c_is_non_delay_mpc(struct brcms_c_info *wlc)424424-{425425- return false;426426-}427427-428428-static bool brcms_c_ismpc(struct brcms_c_info *wlc)429429-{430430- return (wlc->mpc_delay_off == 0) && (brcms_c_is_non_delay_mpc(wlc));431471}432472433473static void brcms_c_bsscfg_mfree(struct brcms_bss_cfg *cfg)···601669 * calculate frame duration of a given rate and length, return602670 * time in usec unit603671 */604604-uint605605-brcms_c_calc_frame_time(struct brcms_c_info *wlc, u32 ratespec,606606- u8 preamble_type, uint mac_len)672672+static uint brcms_c_calc_frame_time(struct brcms_c_info *wlc, u32 ratespec,673673+ u8 preamble_type, uint mac_len)607674{608675 uint nsyms, dur = 0, Ndps, kNdps;609676 uint rate = rspec2rate(ratespec);···900969 lfbl, /* Long Frame Rate Fallback Limit */901970 fbl;902971903903- if (queue < AC_COUNT) {972972+ if (queue < IEEE80211_NUM_ACS) {904973 sfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]],905974 EDCF_SFB);906975 lfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]],···9491018 tx_info->flags |= IEEE80211_TX_STAT_ACK;9501019 }9511020952952- totlen = brcmu_pkttotlen(p);10211021+ totlen = p->len;9531022 free_pdu = true;95410239551024 brcms_c_txfifo_complete(wlc, queue, 1);···22832352 wlc_phy_antsel_type_set(wlc_hw->band->pi, antsel_type);22842353}2285235422862286-static void brcms_c_fatal_error(struct brcms_c_info *wlc)22872287-{22882288- wiphy_err(wlc->wiphy, "wl%d: fatal error, reinitializing\n",22892289- wlc->pub->unit);22902290- brcms_init(wlc->wl);22912291-}22922292-22932355static void brcms_b_fifoerrors(struct brcms_hardware *wlc_hw)22942356{22952357 bool fatal = false;···23382414 }2339241523402416 if (fatal) {23412341- brcms_c_fatal_error(wlc_hw->wlc); /* big hammer */24172417+ brcms_fatal_error(wlc_hw->wlc->wl); /* big hammer */23422418 break;23432419 } else23442420 W_REG(®s->intctrlregs[idx].intstatus,···24032479 W_REG(&wlc_hw->regs->macintmask, wlc->macintmask);24042480}2405248124822482+/* assumes that the d11 MAC is enabled */24062483static void brcms_b_tx_fifo_suspend(struct brcms_hardware *wlc_hw,24072484 uint tx_fifo)24082485{···24602535 }24612536}2462253724632463-static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool on, u32 flags)25382538+/* precondition: requires the mac core to be enabled */25392539+static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool mute_tx)24642540{24652541 static const u8 null_ether_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};2466254224672467- if (on) {25432543+ if (mute_tx) {24682544 /* suspend tx fifos */24692545 brcms_b_tx_fifo_suspend(wlc_hw, TX_DATA_FIFO);24702546 brcms_b_tx_fifo_suspend(wlc_hw, TX_CTL_FIFO);···24872561 wlc_hw->etheraddr);24882562 }2489256324902490- wlc_phy_mute_upd(wlc_hw->band->pi, on, flags);25642564+ wlc_phy_mute_upd(wlc_hw->band->pi, mute_tx, 0);2491256524922492- if (on)25662566+ if (mute_tx)24932567 brcms_c_ucode_mute_override_set(wlc_hw);24942568 else24952569 brcms_c_ucode_mute_override_clear(wlc_hw);25702570+}25712571+25722572+void25732573+brcms_c_mute(struct brcms_c_info *wlc, bool mute_tx)25742574+{25752575+ brcms_b_mute(wlc->hw, mute_tx);24962576}2497257724982578/*···33693437}3370343833713439void33723372-static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec,33733373- bool mute) {34403440+static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) {33743441 u32 macintmask;33753442 bool fastclk;33763443 struct brcms_c_info *wlc = wlc_hw->wlc;···3393346233943463 /* core-specific initialization */33953464 brcms_b_coreinit(wlc);33963396-33973397- /* suspend the tx fifos and mute the phy for preism cac time */33983398- if (mute)33993399- brcms_b_mute(wlc_hw, ON, PHY_MUTE_FOR_PREISM);3400346534013466 /* band-specific inits */34023467 brcms_b_bsinit(wlc, chanspec);···35833656 brcms_c_set_phy_chanspec(wlc, chanspec);35843657}3585365835863586-static void brcms_c_mac_bcn_promisc(struct brcms_c_info *wlc)36593659+/*36603660+ * Set or clear maccontrol bits MCTL_PROMISC, MCTL_BCNS_PROMISC and36613661+ * MCTL_KEEPCONTROL36623662+ */36633663+static void brcms_c_mac_promisc(struct brcms_c_info *wlc)35873664{36653665+ u32 promisc_bits = 0;36663666+35883667 if (wlc->bcnmisc_monitor)35893589- brcms_b_mctrl(wlc->hw, MCTL_BCNS_PROMISC, MCTL_BCNS_PROMISC);35903590- else35913591- brcms_b_mctrl(wlc->hw, MCTL_BCNS_PROMISC, 0);36683668+ promisc_bits |= MCTL_BCNS_PROMISC;36693669+36703670+ if (wlc->monitor)36713671+ promisc_bits |=36723672+ MCTL_PROMISC | MCTL_BCNS_PROMISC | MCTL_KEEPCONTROL;36733673+36743674+ brcms_b_mctrl(wlc->hw,36753675+ MCTL_PROMISC | MCTL_BCNS_PROMISC | MCTL_KEEPCONTROL,36763676+ promisc_bits);35923677}3593367835943679void brcms_c_mac_bcn_promisc_change(struct brcms_c_info *wlc, bool promisc)35953680{35963681 wlc->bcnmisc_monitor = promisc;35973597- brcms_c_mac_bcn_promisc(wlc);35983598-}35993599-36003600-/* set or clear maccontrol bits MCTL_PROMISC and MCTL_KEEPCONTROL */36013601-static void brcms_c_mac_promisc(struct brcms_c_info *wlc)36023602-{36033603- u32 promisc_bits = 0;36043604-36053605- /*36063606- * promiscuous mode just sets MCTL_PROMISC36073607- * Note: APs get all BSS traffic without the need to set36083608- * the MCTL_PROMISC bit since all BSS data traffic is36093609- * directed at the AP36103610- */36113611- if (wlc->pub->promisc)36123612- promisc_bits |= MCTL_PROMISC;36133613-36143614- /* monitor mode needs both MCTL_PROMISC and MCTL_KEEPCONTROL36153615- * Note: monitor mode also needs MCTL_BCNS_PROMISC, but that is36163616- * handled in brcms_c_mac_bcn_promisc()36173617- */36183618- if (wlc->monitor)36193619- promisc_bits |= MCTL_PROMISC | MCTL_KEEPCONTROL;36203620-36213621- brcms_b_mctrl(wlc->hw, MCTL_PROMISC | MCTL_KEEPCONTROL, promisc_bits);36823682+ brcms_c_mac_promisc(wlc);36223683}3623368436243685/*···36383723 }3639372436403725 /* update the various promisc bits */36413641- brcms_c_mac_bcn_promisc(wlc);36423726 brcms_c_mac_promisc(wlc);36433727}36443728···3893397938943980void38953981brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec,38963896- bool mute, struct txpwr_limits *txpwr)39823982+ bool mute_tx, struct txpwr_limits *txpwr)38973983{38983984 uint bandunit;38993985···39194005 }39204006 }3921400739223922- wlc_phy_initcal_enable(wlc_hw->band->pi, !mute);40084008+ wlc_phy_initcal_enable(wlc_hw->band->pi, !mute_tx);3923400939244010 if (!wlc_hw->up) {39254011 if (wlc_hw->clk)···39314017 wlc_phy_txpower_limit_set(wlc_hw->band->pi, txpwr, chanspec);3932401839334019 /* Update muting of the channel */39343934- brcms_b_mute(wlc_hw, mute, 0);40204020+ brcms_b_mute(wlc_hw, mute_tx);39354021 }39364022}39374023···41194205 EDCF_TXOP2USEC(acp_shm.txop);41204206 acp_shm.aifs = (params->aifs & EDCF_AIFSN_MASK);4121420741224122- if (aci == AC_VI && acp_shm.txop == 042084208+ if (aci == IEEE80211_AC_VI && acp_shm.txop == 041234209 && acp_shm.aifs < EDCF_AIFSN_MAX)41244210 acp_shm.aifs++;41254211···41564242 }41574243}4158424441594159-void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)42454245+static void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)41604246{41614247 u16 aci;41624248 int i_ac;···41694255 }; /* ucode needs these parameters during its initialization */41704256 const struct edcf_acparam *edcf_acp = &default_edcf_acparams[0];4171425741724172- for (i_ac = 0; i_ac < AC_COUNT; i_ac++, edcf_acp++) {42584258+ for (i_ac = 0; i_ac < IEEE80211_NUM_ACS; i_ac++, edcf_acp++) {41734259 /* find out which ac this set of params applies to */41744260 aci = (edcf_acp->ACI & EDCF_ACI_MASK) >> EDCF_ACI_SHIFT;41754261···41914277 }41924278}4193427941944194-/* maintain LED behavior in down state */41954195-static void brcms_c_down_led_upd(struct brcms_c_info *wlc)41964196-{41974197- /*41984198- * maintain LEDs while in down state, turn on sbclk if41994199- * not available yet. Turn on sbclk if necessary42004200- */42014201- brcms_b_pllreq(wlc->hw, true, BRCMS_PLLREQ_FLIP);42024202- brcms_b_pllreq(wlc->hw, false, BRCMS_PLLREQ_FLIP);42034203-}42044204-42054280static void brcms_c_radio_monitor_start(struct brcms_c_info *wlc)42064281{42074282 /* Don't start the timer if HWRADIO feature is disabled */···42004297 wlc->radio_monitor = true;42014298 brcms_b_pllreq(wlc->hw, true, BRCMS_PLLREQ_RADIO_MON);42024299 brcms_add_timer(wlc->radio_timer, TIMER_INTERVAL_RADIOCHK, true);42034203-}42044204-42054205-static void brcms_c_radio_disable(struct brcms_c_info *wlc)42064206-{42074207- if (!wlc->pub->up) {42084208- brcms_c_down_led_upd(wlc);42094209- return;42104210- }42114211-42124212- brcms_c_radio_monitor_start(wlc);42134213- brcms_down(wlc->wl);42144214-}42154215-42164216-static void brcms_c_radio_enable(struct brcms_c_info *wlc)42174217-{42184218- if (wlc->pub->up)42194219- return;42204220-42214221- if (brcms_deviceremoved(wlc))42224222- return;42234223-42244224- brcms_up(wlc->wl);42254300}4226430142274302static bool brcms_c_radio_monitor_stop(struct brcms_c_info *wlc)···42244343 mboolclr(wlc->pub->radio_disabled, WL_RADIO_HW_DISABLE);42254344}4226434542274227-/*42284228- * centralized radio disable/enable function,42294229- * invoke radio enable/disable after updating hwradio status42304230- */42314231-static void brcms_c_radio_upd(struct brcms_c_info *wlc)42324232-{42334233- if (wlc->pub->radio_disabled)42344234- brcms_c_radio_disable(wlc);42354235- else42364236- brcms_c_radio_enable(wlc);42374237-}42384238-42394346/* update hwradio status and return it */42404347bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc)42414348{···42454376 return;42464377 }4247437842484248- /* cap mpc off count */42494249- if (wlc->mpc_offcnt < BRCMS_MPC_MAX_DELAYCNT)42504250- wlc->mpc_offcnt++;42514251-42524379 brcms_c_radio_hwdisable_upd(wlc);42534253- brcms_c_radio_upd(wlc);42544380}4255438142564382/* common low-level watchdog code */···42714407 wlc_phy_watchdog(wlc_hw->band->pi);42724408}4273440942744274-static void brcms_c_radio_mpc_upd(struct brcms_c_info *wlc)42754275-{42764276- bool mpc_radio, radio_state;42774277-42784278- /*42794279- * Clear the WL_RADIO_MPC_DISABLE bit when mpc feature is disabled42804280- * in case the WL_RADIO_MPC_DISABLE bit was set. Stop the radio42814281- * monitor also when WL_RADIO_MPC_DISABLE is the only reason that42824282- * the radio is going down.42834283- */42844284- if (!wlc->mpc) {42854285- if (!wlc->pub->radio_disabled)42864286- return;42874287- mboolclr(wlc->pub->radio_disabled, WL_RADIO_MPC_DISABLE);42884288- brcms_c_radio_upd(wlc);42894289- if (!wlc->pub->radio_disabled)42904290- brcms_c_radio_monitor_stop(wlc);42914291- return;42924292- }42934293-42944294- /*42954295- * sync ismpc logic with WL_RADIO_MPC_DISABLE bit in42964296- * wlc->pub->radio_disabled to go ON, always call radio_upd42974297- * synchronously to go OFF, postpone radio_upd to later when42984298- * context is safe(e.g. watchdog)42994299- */43004300- radio_state =43014301- (mboolisset(wlc->pub->radio_disabled, WL_RADIO_MPC_DISABLE) ? OFF :43024302- ON);43034303- mpc_radio = (brcms_c_ismpc(wlc) == true) ? OFF : ON;43044304-43054305- if (radio_state == ON && mpc_radio == OFF)43064306- wlc->mpc_delay_off = wlc->mpc_dlycnt;43074307- else if (radio_state == OFF && mpc_radio == ON) {43084308- mboolclr(wlc->pub->radio_disabled, WL_RADIO_MPC_DISABLE);43094309- brcms_c_radio_upd(wlc);43104310- if (wlc->mpc_offcnt < BRCMS_MPC_THRESHOLD)43114311- wlc->mpc_dlycnt = BRCMS_MPC_MAX_DELAYCNT;43124312- else43134313- wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT;43144314- }43154315- /*43164316- * Below logic is meant to capture the transition from mpc off43174317- * to mpc on for reasons other than wlc->mpc_delay_off keeping43184318- * the mpc off. In that case reset wlc->mpc_delay_off to43194319- * wlc->mpc_dlycnt, so that we restart the countdown of mpc_delay_off43204320- */43214321- if ((wlc->prev_non_delay_mpc == false) &&43224322- (brcms_c_is_non_delay_mpc(wlc) == true) && wlc->mpc_delay_off)43234323- wlc->mpc_delay_off = wlc->mpc_dlycnt;43244324-43254325- wlc->prev_non_delay_mpc = brcms_c_is_non_delay_mpc(wlc);43264326-}43274327-43284410/* common watchdog code */43294411static void brcms_c_watchdog(void *arg)43304412{···42914481 /* increment second count */42924482 wlc->pub->now++;4293448342944294- /* delay radio disable */42954295- if (wlc->mpc_delay_off) {42964296- if (--wlc->mpc_delay_off == 0) {42974297- mboolset(wlc->pub->radio_disabled,42984298- WL_RADIO_MPC_DISABLE);42994299- if (wlc->mpc && brcms_c_ismpc(wlc))43004300- wlc->mpc_offcnt = 0;43014301- }43024302- }43034303-43044304- /* mpc sync */43054305- brcms_c_radio_mpc_upd(wlc);43064306- /* radio sync: sw/hw/mpc --> radio_disable/radio_enable */43074484 brcms_c_radio_hwdisable_upd(wlc);43084308- brcms_c_radio_upd(wlc);43094485 /* if radio is disable, driver may be down, quit here */43104486 if (wlc->pub->radio_disabled)43114487 return;···43954599 /* WME QoS mode is Auto by default */43964600 wlc->pub->_ampdu = AMPDU_AGG_HOST;43974601 wlc->pub->bcmerror = 0;43984398-43994399- /* initialize mpc delay */44004400- wlc->mpc_delay_off = wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT;44014602}4402460344034604static uint brcms_c_attach_module(struct brcms_c_info *wlc)···50525259{50535260 /* STA-BSS; short capable */50545261 wlc->PLCPHdr_override = BRCMS_PLCP_SHORT;50555055-50565056- /* fixup mpc */50575057- wlc->mpc = true;50585262}5059526350605264/* Initialize just the hardware when coming out of POR or S3/S5 system states */···51665376 if (!wlc->clk)51675377 return;5168537851695169- for (ac = 0; ac < AC_COUNT; ac++)53795379+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)51705380 brcms_b_write_shm(wlc->hw, M_AC_TXLMT_ADDR(ac),51715381 wlc->wme_retries[ac]);51725382}···53655575 if (!wlc->pub->up)53665576 return callbacks;5367557753685368- /* in between, mpc could try to bring down again.. */53695578 wlc->going_down = true;5370557953715580 callbacks += brcms_b_bmac_down_prep(wlc->hw);···5641585256425853 brcms_b_retrylimit_upd(wlc->hw, wlc->SRL, wlc->LRL);5643585456445644- for (ac = 0; ac < AC_COUNT; ac++) {58555855+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {56455856 wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac],56465857 EDCF_SHORT, wlc->SRL);56475858 wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac],···5892610358936104 u8 *rtsph = txh->RTSPhyHeader;58946105 struct ieee80211_rts rts = txh->rts_frame;58955895- char hexbuf[256];5896610658976107 /* add plcp header along with txh descriptor */58986108 printk(KERN_DEBUG "Raw TxDesc + plcp header:\n");···59126124 printk(KERN_DEBUG "XtraFrameTypes: %04x ", xtraft);59136125 printk(KERN_DEBUG "\n");5914612659155915- brcmu_format_hex(hexbuf, iv, sizeof(txh->IV));59165916- printk(KERN_DEBUG "SecIV: %s\n", hexbuf);59175917- brcmu_format_hex(hexbuf, ra, sizeof(txh->TxFrameRA));59185918- printk(KERN_DEBUG "RA: %s\n", hexbuf);61276127+ print_hex_dump_bytes("SecIV:", DUMP_PREFIX_OFFSET, iv, sizeof(txh->IV));61286128+ print_hex_dump_bytes("RA:", DUMP_PREFIX_OFFSET,61296129+ ra, sizeof(txh->TxFrameRA));5919613059206131 printk(KERN_DEBUG "Fb FES Time: %04x ", tfestfb);59215921- brcmu_format_hex(hexbuf, rtspfb, sizeof(txh->RTSPLCPFallback));59225922- printk(KERN_DEBUG "RTS PLCP: %s ", hexbuf);61326132+ print_hex_dump_bytes("Fb RTS PLCP:", DUMP_PREFIX_OFFSET,61336133+ rtspfb, sizeof(txh->RTSPLCPFallback));59236134 printk(KERN_DEBUG "RTS DUR: %04x ", rtsdfb);59245924- brcmu_format_hex(hexbuf, fragpfb, sizeof(txh->FragPLCPFallback));59255925- printk(KERN_DEBUG "PLCP: %s ", hexbuf);61356135+ print_hex_dump_bytes("PLCP:", DUMP_PREFIX_OFFSET,61366136+ fragpfb, sizeof(txh->FragPLCPFallback));59266137 printk(KERN_DEBUG "DUR: %04x", fragdfb);59276138 printk(KERN_DEBUG "\n");59286139···59366149 printk(KERN_DEBUG "MaxAggbyte_fb: %04x\n", mabyte_f);59376150 printk(KERN_DEBUG "MinByte: %04x\n", mmbyte);5938615159395939- brcmu_format_hex(hexbuf, rtsph, sizeof(txh->RTSPhyHeader));59405940- printk(KERN_DEBUG "RTS PLCP: %s ", hexbuf);59415941- brcmu_format_hex(hexbuf, (u8 *) &rts, sizeof(txh->rts_frame));59425942- printk(KERN_DEBUG "RTS Frame: %s", hexbuf);61526152+ print_hex_dump_bytes("RTS PLCP:", DUMP_PREFIX_OFFSET,61536153+ rtsph, sizeof(txh->RTSPhyHeader));61546154+ print_hex_dump_bytes("RTS Frame:", DUMP_PREFIX_OFFSET,61556155+ (u8 *)&rts, sizeof(txh->rts_frame));59436156 printk(KERN_DEBUG "\n");59446157}59456158#endif /* defined(BCMDBG) */5946615959476160#if defined(BCMDBG)59485948-int61616161+static int59496162brcms_c_format_flags(const struct brcms_c_bit_desc *bd, u32 flags, char *buf,59505950- int len)61636163+ int len)59516164{59526165 int i;59536166 char *p = buf;···67036916 qos = ieee80211_is_data_qos(h->frame_control);6704691767056918 /* compute length of frame in bytes for use in PLCP computations */67066706- len = brcmu_pkttotlen(p);69196919+ len = p->len;67076920 phylen = len + FCS_LEN;6708692167096922 /* Get tx_info */···80408253 return (int)(qdbm / BRCMS_TXPWR_DB_FACTOR);80418254}8042825580438043-void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc)80448044-{80458045- wlc->mpc = mpc;80468046- brcms_c_radio_mpc_upd(wlc);80478047-}80488048-80498256/* Process received frames */80508257/*80518258 * Return true if more frames need to be processed. false otherwise.···81098328brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)81108329{81118330 struct sk_buff *p;81128112- struct sk_buff *head = NULL;81138113- struct sk_buff *tail = NULL;83318331+ struct sk_buff *next = NULL;83328332+ struct sk_buff_head recv_frames;83338333+81148334 uint n = 0;81158335 uint bound_limit = bound ? RXBND : -1;8116833681178337 BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit);81188118- /* gather received frames */81198119- while ((p = dma_rx(wlc_hw->di[fifo]))) {83388338+ skb_queue_head_init(&recv_frames);8120833981218121- if (!tail)81228122- head = tail = p;81238123- else {81248124- tail->prev = p;81258125- tail = p;81268126- }83408340+ /* gather received frames */83418341+ while (dma_rx(wlc_hw->di[fifo], &recv_frames)) {8127834281288343 /* !give others some time to run! */81298344 if (++n >= bound_limit)···81308353 dma_rxfill(wlc_hw->di[fifo]);8131835481328355 /* process each frame */81338133- while ((p = head) != NULL) {83568356+ skb_queue_walk_safe(&recv_frames, p, next) {81348357 struct d11rxhdr_le *rxh_le;81358358 struct d11rxhdr *rxh;81368136- head = head->prev;81378137- p->prev = NULL;8138835983608360+ skb_unlink(p, &recv_frames);81398361 rxh_le = (struct d11rxhdr_le *)p->data;81408362 rxh = (struct d11rxhdr *)p->data;81418363···82248448 printk_once("%s : PSM Watchdog, chipid 0x%x, chiprev 0x%x\n",82258449 __func__, wlc_hw->sih->chip,82268450 wlc_hw->sih->chiprev);82278227- /* big hammer */82288228- brcms_init(wlc->wl);84518451+ brcms_fatal_error(wlc_hw->wlc->wl);82298452 }8230845382318454 /* gptimer timeout */···82458470 return wlc->macintstatus != 0;8246847182478472 fatal:82488248- brcms_init(wlc->wl);84738473+ brcms_fatal_error(wlc_hw->wlc->wl);82498474 return wlc->macintstatus != 0;82508475}8251847682528252-void brcms_c_init(struct brcms_c_info *wlc)84778477+void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx)82538478{82548479 struct d11regs __iomem *regs;82558480 u16 chanspec;82568256- bool mute = false;8257848182588482 BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);82598483···82688494 else82698495 chanspec = brcms_c_init_chanspec(wlc);8270849682718271- brcms_b_init(wlc->hw, chanspec, mute);84978497+ brcms_b_init(wlc->hw, chanspec);8272849882738499 /* update beacon listen interval */82748500 brcms_c_bcn_li_upd(wlc);···83348560 /* ..now really unleash hell (allow the MAC out of suspend) */83358561 brcms_c_enable_mac(wlc);8336856285638563+ /* suspend the tx fifos and mute the phy for preism cac time */85648564+ if (mute_tx)85658565+ brcms_b_mute(wlc->hw, true);85668566+83378567 /* clear tx flow control */83388568 brcms_c_txflowcontrol_reset(wlc);8339856983408570 /* enable the RF Disable Delay timer */83418571 W_REG(&wlc->regs->rfdisabledly, RFDISABLE_DEFAULT);83428342-83438343- /* initialize mpc delay */83448344- wlc->mpc_delay_off = wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT;8345857283468573 /*83478574 * Initialize WME parameters; if they haven't been set by some other···83528577 /* Uninitialized; read from HW */83538578 int ac;8354857983558355- for (ac = 0; ac < AC_COUNT; ac++)85808580+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)83568581 wlc->wme_retries[ac] =83578582 brcms_b_read_shm(wlc->hw, M_AC_TXLMT_ADDR(ac));83588583 }···85298754 brcms_c_ht_update_sgi_rx(wlc, 0);85308755 }8531875685328532- /* initialize radio_mpc_disable according to wlc->mpc */85338533- brcms_c_radio_mpc_upd(wlc);85348757 brcms_b_antsel_set(wlc->hw, wlc->asi->antsel_avail);8535875885368759 if (perr)
+3-16
drivers/net/wireless/brcm80211/brcmsmac/main.h
···4444/* transmit buffer max headroom for protocol headers */4545#define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN)46464747-#define AC_COUNT 44848-4947/* Macros for doing definition and get/set of bitfields5048 * Usage example, e.g. a three-bit field (bits 4-6):5149 * #define <NAME>_M BITFIELD_MASK(3)···425427 * bandinit_pending: track band init in auto band.426428 * radio_monitor: radio timer is running.427429 * going_down: down path intermediate variable.428428- * mpc: enable minimum power consumption.429429- * mpc_dlycnt: # of watchdog cnt before turn disable radio.430430- * mpc_offcnt: # of watchdog cnt that radio is disabled.431431- * mpc_delay_off: delay radio disable by # of watchdog cnt.432432- * prev_non_delay_mpc: prev state brcms_c_is_non_delay_mpc.433430 * wdtimer: timer for watchdog routine.434431 * radio_timer: timer for hw radio button monitor routine.435432 * monitor: monitor (MPDU sniffing) mode.···434441 * bcn_li_dtim: beacon listen interval in # dtims.435442 * WDarmed: watchdog timer is armed.436443 * WDlast: last time wlc_watchdog() was called.437437- * edcf_txop[AC_COUNT]: current txop for each ac.444444+ * edcf_txop[IEEE80211_NUM_ACS]: current txop for each ac.438445 * wme_retries: per-AC retry limits.439446 * tx_prec_map: Precedence map based on HW FIFO space.440447 * fifo2prec_map[NFIFO]: pointer to fifo2_prec map based on WME.···515522 bool radio_monitor;516523 bool going_down;517524518518- bool mpc;519519- u8 mpc_dlycnt;520520- u8 mpc_offcnt;521521- u8 mpc_delay_off;522522- u8 prev_non_delay_mpc;523523-524525 struct brcms_timer *wdtimer;525526 struct brcms_timer *radio_timer;526527···533546 u32 WDlast;534547535548 /* WME */536536- u16 edcf_txop[AC_COUNT];549549+ u16 edcf_txop[IEEE80211_NUM_ACS];537550538538- u16 wme_retries[AC_COUNT];551551+ u16 wme_retries[IEEE80211_NUM_ACS];539552 u16 tx_prec_map;540553 u16 fifo2prec_map[NFIFO];541554
···6565#define ETHER_ADDR_STR_LEN 1866666767struct pktq_prec {6868- struct sk_buff *head; /* first packet to dequeue */6969- struct sk_buff *tail; /* last packet to dequeue */7070- u16 len; /* number of queued packets */6868+ struct sk_buff_head skblist;7169 u16 max; /* maximum number of queued packets */7270};7371···86888789static inline int pktq_plen(struct pktq *pq, int prec)8890{8989- return pq->q[prec].len;9191+ return pq->q[prec].skblist.qlen;9092}91939294static inline int pktq_pavail(struct pktq *pq, int prec)9395{9494- return pq->q[prec].max - pq->q[prec].len;9696+ return pq->q[prec].max - pq->q[prec].skblist.qlen;9597}96989799static inline bool pktq_pfull(struct pktq *pq, int prec)98100{9999- return pq->q[prec].len >= pq->q[prec].max;101101+ return pq->q[prec].skblist.qlen >= pq->q[prec].max;100102}101103102104static inline bool pktq_pempty(struct pktq *pq, int prec)103105{104104- return pq->q[prec].len == 0;106106+ return skb_queue_empty(&pq->q[prec].skblist);105107}106108107109static inline struct sk_buff *pktq_ppeek(struct pktq *pq, int prec)108110{109109- return pq->q[prec].head;111111+ return skb_peek(&pq->q[prec].skblist);110112}111113112114static inline struct sk_buff *pktq_ppeek_tail(struct pktq *pq, int prec)113115{114114- return pq->q[prec].tail;116116+ return skb_peek_tail(&pq->q[prec].skblist);115117}116118117119extern struct sk_buff *brcmu_pktq_penq(struct pktq *pq, int prec,···170172 bool (*fn)(struct sk_buff *, void *), void *arg);171173172174/* externs */173173-/* packet */174174-extern uint brcmu_pktfrombuf(struct sk_buff *p,175175- uint offset, int len, unsigned char *buf);176176-extern uint brcmu_pkttotlen(struct sk_buff *p);177177-178175/* ip address */179176struct ipv4_addr;180177178178+179179+/* externs */180180+/* format/print */181181#ifdef BCMDBG182182extern void brcmu_prpkt(const char *msg, struct sk_buff *p0);183183#else184184#define brcmu_prpkt(a, b)185185#endif /* BCMDBG */186186-187187-/* externs */188188-/* format/print */189189-#if defined(BCMDBG)190190-extern int brcmu_format_hex(char *str, const void *bytes, int len);191191-#endif192186193187#endif /* _BRCMU_UTILS_H_ */
-1
drivers/net/wireless/brcm80211/include/defs.h
···62626363#define WL_RADIO_SW_DISABLE (1<<0)6464#define WL_RADIO_HW_DISABLE (1<<1)6565-#define WL_RADIO_MPC_DISABLE (1<<2)6665/* some countries don't support any channel */6766#define WL_RADIO_COUNTRY_DISABLE (1<<3)6867
+10-2
drivers/net/wireless/brcm80211/include/soc.h
···7777#define DMEMS_CORE_ID 0x835 /* SDR/DDR1 memory controller core */7878#define DEF_SHIM_COMP 0x837 /* SHIM component in ubus/6362 */7979#define OOB_ROUTER_CORE_ID 0x367 /* OOB router core ID */8080-/* Default component, in ai chips it maps all unused address ranges */8181-#define DEF_AI_COMP 0xfff8080+#define DEF_AI_COMP 0xfff /* Default component, in ai chips it8181+ * maps all unused address ranges8282+ */82838384/* Common core control flags */8485#define SICF_BIST_EN 0x8000···8786#define SICF_CORE_BITS 0x3ffc8887#define SICF_FGC 0x00028988#define SICF_CLOCK_EN 0x00018989+9090+/* Common core status flags */9191+#define SISF_BIST_DONE 0x80009292+#define SISF_BIST_ERROR 0x40009393+#define SISF_GATED_CLK 0x20009494+#define SISF_DMA64 0x10009595+#define SISF_CORE_BITS 0x0fff90969197#endif /* _BRCM_SOC_H */
+8
drivers/net/wireless/ipw2x00/ipw2200.c
···131131#define ipw2200_bg_rates (ipw2200_rates + 0)132132#define ipw2200_num_bg_rates 12133133134134+/* Ugly macro to convert literal channel numbers into their mhz equivalents135135+ * There are certianly some conditions that will break this (like feeding it '30')136136+ * but they shouldn't arise since nothing talks on channel 30. */137137+#define ieee80211chan2mhz(x) \138138+ (((x) <= 14) ? \139139+ (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \140140+ ((x) + 1000) * 5)141141+134142#ifdef CONFIG_IPW2200_QOS135143static int qos_enable = 0;136144static int qos_burst_enable = 0;
···827827 case IEEE80211_SMPS_STATIC:828828 case IEEE80211_SMPS_DYNAMIC:829829 return IWL_NUM_IDLE_CHAINS_SINGLE;830830+ case IEEE80211_SMPS_AUTOMATIC:830831 case IEEE80211_SMPS_OFF:831832 return active_cnt;832833 default:···984983 list_del(&wait_entry->list);985984 spin_unlock_bh(&priv->notif_wait_lock);986985}986986+987987+#ifdef CONFIG_PM_SLEEP988988+static void iwlagn_convert_p1k(u16 *p1k, __le16 *out)989989+{990990+ int i;991991+992992+ for (i = 0; i < IWLAGN_P1K_SIZE; i++)993993+ out[i] = cpu_to_le16(p1k[i]);994994+}995995+996996+struct wowlan_key_data {997997+ struct iwl_rxon_context *ctx;998998+ struct iwlagn_wowlan_rsc_tsc_params_cmd *rsc_tsc;999999+ struct iwlagn_wowlan_tkip_params_cmd *tkip;10001000+ const u8 *bssid;10011001+ bool error, use_rsc_tsc, use_tkip;10021002+};10031003+10041004+10051005+static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw,10061006+ struct ieee80211_vif *vif,10071007+ struct ieee80211_sta *sta,10081008+ struct ieee80211_key_conf *key,10091009+ void *_data)10101010+{10111011+ struct iwl_priv *priv = hw->priv;10121012+ struct wowlan_key_data *data = _data;10131013+ struct iwl_rxon_context *ctx = data->ctx;10141014+ struct aes_sc *aes_sc, *aes_tx_sc = NULL;10151015+ struct tkip_sc *tkip_sc, *tkip_tx_sc = NULL;10161016+ struct iwlagn_p1k_cache *rx_p1ks;10171017+ u8 *rx_mic_key;10181018+ struct ieee80211_key_seq seq;10191019+ u32 cur_rx_iv32 = 0;10201020+ u16 p1k[IWLAGN_P1K_SIZE];10211021+ int ret, i;10221022+10231023+ mutex_lock(&priv->shrd->mutex);10241024+10251025+ if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 ||10261026+ key->cipher == WLAN_CIPHER_SUITE_WEP104) &&10271027+ !sta && !ctx->key_mapping_keys)10281028+ ret = iwl_set_default_wep_key(priv, ctx, key);10291029+ else10301030+ ret = iwl_set_dynamic_key(priv, ctx, key, sta);10311031+10321032+ if (ret) {10331033+ IWL_ERR(priv, "Error setting key during suspend!\n");10341034+ data->error = true;10351035+ }10361036+10371037+ switch (key->cipher) {10381038+ case WLAN_CIPHER_SUITE_TKIP:10391039+ if (sta) {10401040+ tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc;10411041+ tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc;10421042+10431043+ rx_p1ks = data->tkip->rx_uni;10441044+10451045+ ieee80211_get_key_tx_seq(key, &seq);10461046+ tkip_tx_sc->iv16 = cpu_to_le16(seq.tkip.iv16);10471047+ tkip_tx_sc->iv32 = cpu_to_le32(seq.tkip.iv32);10481048+10491049+ ieee80211_get_tkip_p1k_iv(key, seq.tkip.iv32, p1k);10501050+ iwlagn_convert_p1k(p1k, data->tkip->tx.p1k);10511051+10521052+ memcpy(data->tkip->mic_keys.tx,10531053+ &key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY],10541054+ IWLAGN_MIC_KEY_SIZE);10551055+10561056+ rx_mic_key = data->tkip->mic_keys.rx_unicast;10571057+ } else {10581058+ tkip_sc =10591059+ data->rsc_tsc->all_tsc_rsc.tkip.multicast_rsc;10601060+ rx_p1ks = data->tkip->rx_multi;10611061+ rx_mic_key = data->tkip->mic_keys.rx_mcast;10621062+ }10631063+10641064+ /*10651065+ * For non-QoS this relies on the fact that both the uCode and10661066+ * mac80211 use TID 0 (as they need to to avoid replay attacks)10671067+ * for checking the IV in the frames.10681068+ */10691069+ for (i = 0; i < IWLAGN_NUM_RSC; i++) {10701070+ ieee80211_get_key_rx_seq(key, i, &seq);10711071+ tkip_sc[i].iv16 = cpu_to_le16(seq.tkip.iv16);10721072+ tkip_sc[i].iv32 = cpu_to_le32(seq.tkip.iv32);10731073+ /* wrapping isn't allowed, AP must rekey */10741074+ if (seq.tkip.iv32 > cur_rx_iv32)10751075+ cur_rx_iv32 = seq.tkip.iv32;10761076+ }10771077+10781078+ ieee80211_get_tkip_rx_p1k(key, data->bssid, cur_rx_iv32, p1k);10791079+ iwlagn_convert_p1k(p1k, rx_p1ks[0].p1k);10801080+ ieee80211_get_tkip_rx_p1k(key, data->bssid,10811081+ cur_rx_iv32 + 1, p1k);10821082+ iwlagn_convert_p1k(p1k, rx_p1ks[1].p1k);10831083+10841084+ memcpy(rx_mic_key,10851085+ &key->key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY],10861086+ IWLAGN_MIC_KEY_SIZE);10871087+10881088+ data->use_tkip = true;10891089+ data->use_rsc_tsc = true;10901090+ break;10911091+ case WLAN_CIPHER_SUITE_CCMP:10921092+ if (sta) {10931093+ u8 *pn = seq.ccmp.pn;10941094+10951095+ aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc;10961096+ aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc;10971097+10981098+ ieee80211_get_key_tx_seq(key, &seq);10991099+ aes_tx_sc->pn = cpu_to_le64(11001100+ (u64)pn[5] |11011101+ ((u64)pn[4] << 8) |11021102+ ((u64)pn[3] << 16) |11031103+ ((u64)pn[2] << 24) |11041104+ ((u64)pn[1] << 32) |11051105+ ((u64)pn[0] << 40));11061106+ } else11071107+ aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc;11081108+11091109+ /*11101110+ * For non-QoS this relies on the fact that both the uCode and11111111+ * mac80211 use TID 0 for checking the IV in the frames.11121112+ */11131113+ for (i = 0; i < IWLAGN_NUM_RSC; i++) {11141114+ u8 *pn = seq.ccmp.pn;11151115+11161116+ ieee80211_get_key_rx_seq(key, i, &seq);11171117+ aes_sc->pn = cpu_to_le64(11181118+ (u64)pn[5] |11191119+ ((u64)pn[4] << 8) |11201120+ ((u64)pn[3] << 16) |11211121+ ((u64)pn[2] << 24) |11221122+ ((u64)pn[1] << 32) |11231123+ ((u64)pn[0] << 40));11241124+ }11251125+ data->use_rsc_tsc = true;11261126+ break;11271127+ }11281128+11291129+ mutex_unlock(&priv->shrd->mutex);11301130+}11311131+11321132+int iwlagn_send_patterns(struct iwl_priv *priv,11331133+ struct cfg80211_wowlan *wowlan)11341134+{11351135+ struct iwlagn_wowlan_patterns_cmd *pattern_cmd;11361136+ struct iwl_host_cmd cmd = {11371137+ .id = REPLY_WOWLAN_PATTERNS,11381138+ .dataflags[0] = IWL_HCMD_DFL_NOCOPY,11391139+ .flags = CMD_SYNC,11401140+ };11411141+ int i, err;11421142+11431143+ if (!wowlan->n_patterns)11441144+ return 0;11451145+11461146+ cmd.len[0] = sizeof(*pattern_cmd) +11471147+ wowlan->n_patterns * sizeof(struct iwlagn_wowlan_pattern);11481148+11491149+ pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL);11501150+ if (!pattern_cmd)11511151+ return -ENOMEM;11521152+11531153+ pattern_cmd->n_patterns = cpu_to_le32(wowlan->n_patterns);11541154+11551155+ for (i = 0; i < wowlan->n_patterns; i++) {11561156+ int mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8);11571157+11581158+ memcpy(&pattern_cmd->patterns[i].mask,11591159+ wowlan->patterns[i].mask, mask_len);11601160+ memcpy(&pattern_cmd->patterns[i].pattern,11611161+ wowlan->patterns[i].pattern,11621162+ wowlan->patterns[i].pattern_len);11631163+ pattern_cmd->patterns[i].mask_size = mask_len;11641164+ pattern_cmd->patterns[i].pattern_size =11651165+ wowlan->patterns[i].pattern_len;11661166+ }11671167+11681168+ cmd.data[0] = pattern_cmd;11691169+ err = iwl_trans_send_cmd(trans(priv), &cmd);11701170+ kfree(pattern_cmd);11711171+ return err;11721172+}11731173+11741174+int iwlagn_suspend(struct iwl_priv *priv,11751175+ struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)11761176+{11771177+ struct iwlagn_wowlan_wakeup_filter_cmd wakeup_filter_cmd;11781178+ struct iwl_rxon_cmd rxon;11791179+ struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];11801180+ struct iwlagn_wowlan_kek_kck_material_cmd kek_kck_cmd;11811181+ struct iwlagn_wowlan_tkip_params_cmd tkip_cmd = {};11821182+ struct iwlagn_d3_config_cmd d3_cfg_cmd = {};11831183+ struct wowlan_key_data key_data = {11841184+ .ctx = ctx,11851185+ .bssid = ctx->active.bssid_addr,11861186+ .use_rsc_tsc = false,11871187+ .tkip = &tkip_cmd,11881188+ .use_tkip = false,11891189+ };11901190+ int ret, i;11911191+ u16 seq;11921192+11931193+ key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL);11941194+ if (!key_data.rsc_tsc)11951195+ return -ENOMEM;11961196+11971197+ memset(&wakeup_filter_cmd, 0, sizeof(wakeup_filter_cmd));11981198+11991199+ /*12001200+ * We know the last used seqno, and the uCode expects to know that12011201+ * one, it will increment before TX.12021202+ */12031203+ seq = le16_to_cpu(priv->last_seq_ctl) & IEEE80211_SCTL_SEQ;12041204+ wakeup_filter_cmd.non_qos_seq = cpu_to_le16(seq);12051205+12061206+ /*12071207+ * For QoS counters, we store the one to use next, so subtract 0x1012081208+ * since the uCode will add 0x10 before using the value.12091209+ */12101210+ for (i = 0; i < 8; i++) {12111211+ seq = priv->shrd->tid_data[IWL_AP_ID][i].seq_number;12121212+ seq -= 0x10;12131213+ wakeup_filter_cmd.qos_seq[i] = cpu_to_le16(seq);12141214+ }12151215+12161216+ if (wowlan->disconnect)12171217+ wakeup_filter_cmd.enabled |=12181218+ cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_BEACON_MISS |12191219+ IWLAGN_WOWLAN_WAKEUP_LINK_CHANGE);12201220+ if (wowlan->magic_pkt)12211221+ wakeup_filter_cmd.enabled |=12221222+ cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_MAGIC_PACKET);12231223+ if (wowlan->gtk_rekey_failure)12241224+ wakeup_filter_cmd.enabled |=12251225+ cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_GTK_REKEY_FAIL);12261226+ if (wowlan->eap_identity_req)12271227+ wakeup_filter_cmd.enabled |=12281228+ cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_EAP_IDENT_REQ);12291229+ if (wowlan->four_way_handshake)12301230+ wakeup_filter_cmd.enabled |=12311231+ cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_4WAY_HANDSHAKE);12321232+ if (wowlan->n_patterns)12331233+ wakeup_filter_cmd.enabled |=12341234+ cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_PATTERN_MATCH);12351235+12361236+ if (wowlan->rfkill_release)12371237+ d3_cfg_cmd.wakeup_flags |=12381238+ cpu_to_le32(IWLAGN_D3_WAKEUP_RFKILL);12391239+12401240+ iwl_scan_cancel_timeout(priv, 200);12411241+12421242+ memcpy(&rxon, &ctx->active, sizeof(rxon));12431243+12441244+ iwl_trans_stop_device(trans(priv));12451245+12461246+ priv->shrd->wowlan = true;12471247+12481248+ ret = iwlagn_load_ucode_wait_alive(priv, IWL_UCODE_WOWLAN);12491249+ if (ret)12501250+ goto out;12511251+12521252+ /* now configure WoWLAN ucode */12531253+ ret = iwl_alive_start(priv);12541254+ if (ret)12551255+ goto out;12561256+12571257+ memcpy(&ctx->staging, &rxon, sizeof(rxon));12581258+ ret = iwlagn_commit_rxon(priv, ctx);12591259+ if (ret)12601260+ goto out;12611261+12621262+ ret = iwl_power_update_mode(priv, true);12631263+ if (ret)12641264+ goto out;12651265+12661266+ if (!iwlagn_mod_params.sw_crypto) {12671267+ /* mark all keys clear */12681268+ priv->ucode_key_table = 0;12691269+ ctx->key_mapping_keys = 0;12701270+12711271+ /*12721272+ * This needs to be unlocked due to lock ordering12731273+ * constraints. Since we're in the suspend path12741274+ * that isn't really a problem though.12751275+ */12761276+ mutex_unlock(&priv->shrd->mutex);12771277+ ieee80211_iter_keys(priv->hw, ctx->vif,12781278+ iwlagn_wowlan_program_keys,12791279+ &key_data);12801280+ mutex_lock(&priv->shrd->mutex);12811281+ if (key_data.error) {12821282+ ret = -EIO;12831283+ goto out;12841284+ }12851285+12861286+ if (key_data.use_rsc_tsc) {12871287+ struct iwl_host_cmd rsc_tsc_cmd = {12881288+ .id = REPLY_WOWLAN_TSC_RSC_PARAMS,12891289+ .flags = CMD_SYNC,12901290+ .data[0] = key_data.rsc_tsc,12911291+ .dataflags[0] = IWL_HCMD_DFL_NOCOPY,12921292+ .len[0] = sizeof(key_data.rsc_tsc),12931293+ };12941294+12951295+ ret = iwl_trans_send_cmd(trans(priv), &rsc_tsc_cmd);12961296+ if (ret)12971297+ goto out;12981298+ }12991299+13001300+ if (key_data.use_tkip) {13011301+ ret = iwl_trans_send_cmd_pdu(trans(priv),13021302+ REPLY_WOWLAN_TKIP_PARAMS,13031303+ CMD_SYNC, sizeof(tkip_cmd),13041304+ &tkip_cmd);13051305+ if (ret)13061306+ goto out;13071307+ }13081308+13091309+ if (priv->have_rekey_data) {13101310+ memset(&kek_kck_cmd, 0, sizeof(kek_kck_cmd));13111311+ memcpy(kek_kck_cmd.kck, priv->kck, NL80211_KCK_LEN);13121312+ kek_kck_cmd.kck_len = cpu_to_le16(NL80211_KCK_LEN);13131313+ memcpy(kek_kck_cmd.kek, priv->kek, NL80211_KEK_LEN);13141314+ kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN);13151315+ kek_kck_cmd.replay_ctr = priv->replay_ctr;13161316+13171317+ ret = iwl_trans_send_cmd_pdu(trans(priv),13181318+ REPLY_WOWLAN_KEK_KCK_MATERIAL,13191319+ CMD_SYNC, sizeof(kek_kck_cmd),13201320+ &kek_kck_cmd);13211321+ if (ret)13221322+ goto out;13231323+ }13241324+ }13251325+13261326+ ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_D3_CONFIG, CMD_SYNC,13271327+ sizeof(d3_cfg_cmd), &d3_cfg_cmd);13281328+ if (ret)13291329+ goto out;13301330+13311331+ ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_WOWLAN_WAKEUP_FILTER,13321332+ CMD_SYNC, sizeof(wakeup_filter_cmd),13331333+ &wakeup_filter_cmd);13341334+ if (ret)13351335+ goto out;13361336+13371337+ ret = iwlagn_send_patterns(priv, wowlan);13381338+ out:13391339+ kfree(key_data.rsc_tsc);13401340+ return ret;13411341+}13421342+#endif
+2-6
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
···14581458 break;14591459 case IWL_BT_COEX_TRAFFIC_LOAD_LOW:14601460 /* avoid antenna B unless MIMO */14611461- valid_tx_ant =14621462- first_antenna(hw_params(priv).valid_tx_ant);14631461 if (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2)14641464- tbl->action = IWL_LEGACY_SWITCH_ANTENNA1;14621462+ tbl->action = IWL_LEGACY_SWITCH_SISO;14651463 break;14661464 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:14671465 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:···16341636 break;16351637 case IWL_BT_COEX_TRAFFIC_LOAD_LOW:16361638 /* avoid antenna B unless MIMO */16371637- valid_tx_ant =16381638- first_antenna(hw_params(priv).valid_tx_ant);16391639 if (tbl->action == IWL_SISO_SWITCH_ANTENNA2)16401640- tbl->action = IWL_SISO_SWITCH_ANTENNA1;16401640+ tbl->action = IWL_SISO_SWITCH_MIMO2_AB;16411641 break;16421642 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:16431643 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
+48-1
drivers/net/wireless/iwlwifi/iwl-agn-rx.c
···800800 ctx->active.bssid_addr))801801 continue;802802 ctx->last_tx_rejected = false;803803- iwl_trans_wake_any_queue(trans(priv), ctx->ctxid);803803+ iwl_trans_wake_any_queue(trans(priv), ctx->ctxid,804804+ "channel got active");804805 }805806 }806807···10331032 return 0;10341033}1035103410351035+static int iwlagn_rx_noa_notification(struct iwl_priv *priv,10361036+ struct iwl_rx_mem_buffer *rxb,10371037+ struct iwl_device_cmd *cmd)10381038+{10391039+ struct iwl_wipan_noa_data *new_data, *old_data;10401040+ struct iwl_rx_packet *pkt = rxb_addr(rxb);10411041+ struct iwl_wipan_noa_notification *noa_notif = (void *)pkt->u.raw;10421042+10431043+ /* no condition -- we're in softirq */10441044+ old_data = rcu_dereference_protected(priv->noa_data, true);10451045+10461046+ if (noa_notif->noa_active) {10471047+ u32 len = le16_to_cpu(noa_notif->noa_attribute.length);10481048+ u32 copylen = len;10491049+10501050+ /* EID, len, OUI, subtype */10511051+ len += 1 + 1 + 3 + 1;10521052+ /* P2P id, P2P length */10531053+ len += 1 + 2;10541054+ copylen += 1 + 2;10551055+10561056+ new_data = kmalloc(sizeof(*new_data) + len, GFP_ATOMIC);10571057+ if (new_data) {10581058+ new_data->length = len;10591059+ new_data->data[0] = WLAN_EID_VENDOR_SPECIFIC;10601060+ new_data->data[1] = len - 2; /* not counting EID, len */10611061+ new_data->data[2] = (WLAN_OUI_WFA >> 16) & 0xff;10621062+ new_data->data[3] = (WLAN_OUI_WFA >> 8) & 0xff;10631063+ new_data->data[4] = (WLAN_OUI_WFA >> 0) & 0xff;10641064+ new_data->data[5] = WLAN_OUI_TYPE_WFA_P2P;10651065+ memcpy(&new_data->data[6], &noa_notif->noa_attribute,10661066+ copylen);10671067+ }10681068+ } else10691069+ new_data = NULL;10701070+10711071+ rcu_assign_pointer(priv->noa_data, new_data);10721072+10731073+ if (old_data)10741074+ kfree_rcu(old_data, rcu_head);10751075+10761076+ return 0;10771077+}10781078+10361079/**10371080 * iwl_setup_rx_handlers - Initialize Rx handler callbacks10381081 *···10991054 iwlagn_rx_pm_debug_statistics_notif;11001055 handlers[BEACON_NOTIFICATION] = iwlagn_rx_beacon_notif;11011056 handlers[REPLY_ADD_STA] = iwl_add_sta_callback;10571057+10581058+ handlers[REPLY_WIPAN_NOA_NOTIFICATION] = iwlagn_rx_noa_notification;1102105911031060 /*11041061 * The same handler is used for both the REPLY to a discrete
+9-4
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
···4545 send->filter_flags = old_filter;46464747 if (ret)4848- IWL_ERR(priv, "Error clearing ASSOC_MSK on BSS (%d)\n", ret);4848+ IWL_DEBUG_QUIET_RFKILL(priv,4949+ "Error clearing ASSOC_MSK on BSS (%d)\n", ret);49505051 return ret;5152}···117116 if (ctx->ht.enabled)118117 ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK;119118120120- IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n",119119+ IWL_DEBUG_INFO(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n",121120 ctx->qos_data.qos_active,122121 ctx->qos_data.def_qos_parm.qos_flags);123122···125124 sizeof(struct iwl_qosparam_cmd),126125 &ctx->qos_data.def_qos_parm);127126 if (ret)128128- IWL_ERR(priv, "Failed to update QoS\n");127127+ IWL_DEBUG_QUIET_RFKILL(priv, "Failed to update QoS\n");129128}130129131130static int iwlagn_update_beacon(struct iwl_priv *priv,···542541543542 mutex_lock(&priv->shrd->mutex);544543544544+ if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))545545+ goto out;546546+545547 if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) {546548 IWL_DEBUG_MAC80211(priv, "leave - scanning\n");547549 goto out;···844840 if (ctx->last_tx_rejected) {845841 ctx->last_tx_rejected = false;846842 iwl_trans_wake_any_queue(trans(priv),847847- ctx->ctxid);843843+ ctx->ctxid,844844+ "Disassoc: flush queue");848845 }849846 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;850847
···416416417417 if (!iwl_is_associated_ctx(ctx))418418 continue;419419+ if (ctx->staging.dev_type == RXON_DEV_TYPE_P2P)420420+ continue;419421 value = ctx->beacon_int;420422 if (!value)421423 value = IWL_PASSIVE_DWELL_BASE;···680678 priv->contexts[IWL_RXON_CTX_BSS].active.flags &681679 RXON_FLG_CHANNEL_MODE_MSK)682680 >> RXON_FLG_CHANNEL_MODE_POS;683683- if (chan_mod == CHANNEL_MODE_PURE_40) {681681+ if ((priv->scan_request && priv->scan_request->no_cck) ||682682+ chan_mod == CHANNEL_MODE_PURE_40) {684683 rate = IWL_RATE_6M_PLCP;685684 } else {686685 rate = IWL_RATE_1M_PLCP;···941938 return 0;942939}943940944944-int iwlagn_mac_hw_scan(struct ieee80211_hw *hw,945945- struct ieee80211_vif *vif,946946- struct cfg80211_scan_request *req)947947-{948948- struct iwl_priv *priv = hw->priv;949949- int ret;950950-951951- IWL_DEBUG_MAC80211(priv, "enter\n");952952-953953- if (req->n_channels == 0)954954- return -EINVAL;955955-956956- mutex_lock(&priv->shrd->mutex);957957-958958- /*959959- * If an internal scan is in progress, just set960960- * up the scan_request as per above.961961- */962962- if (priv->scan_type != IWL_SCAN_NORMAL) {963963- IWL_DEBUG_SCAN(priv,964964- "SCAN request during internal scan - defer\n");965965- priv->scan_request = req;966966- priv->scan_vif = vif;967967- ret = 0;968968- } else {969969- priv->scan_request = req;970970- priv->scan_vif = vif;971971- /*972972- * mac80211 will only ask for one band at a time973973- * so using channels[0] here is ok974974- */975975- ret = iwl_scan_initiate(priv, vif, IWL_SCAN_NORMAL,976976- req->channels[0]->band);977977- if (ret) {978978- priv->scan_request = NULL;979979- priv->scan_vif = NULL;980980- }981981- }982982-983983- IWL_DEBUG_MAC80211(priv, "leave\n");984984-985985- mutex_unlock(&priv->shrd->mutex);986986-987987- return ret;988988-}989941990942/*991943 * internal short scan, this function should only been called while associated.
+2-5
drivers/net/wireless/iwlwifi/iwl-sv-open.c
···396396 break;397397398398 case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW:399399- status = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init,400400- IWL_UCODE_INIT);399399+ status = iwlagn_load_ucode_wait_alive(priv, IWL_UCODE_INIT);401400 if (status)402401 IWL_DEBUG_INFO(priv,403402 "Error loading init ucode: %d\n", status);···408409 break;409410410411 case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:411411- status = iwlagn_load_ucode_wait_alive(priv,412412- &priv->ucode_rt,413413- IWL_UCODE_REGULAR);412412+ status = iwlagn_load_ucode_wait_alive(priv, IWL_UCODE_REGULAR);414413 if (status) {415414 IWL_DEBUG_INFO(priv,416415 "Error loading runtime ucode: %d\n", status);
+29-6
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
···355355}356356357357static inline void iwl_wake_queue(struct iwl_trans *trans,358358- struct iwl_tx_queue *txq)358358+ struct iwl_tx_queue *txq, const char *msg)359359{360360 u8 queue = txq->swq_id;361361 u8 ac = queue & 3;···363363 struct iwl_trans_pcie *trans_pcie =364364 IWL_TRANS_GET_PCIE_TRANS(trans);365365366366- if (test_and_clear_bit(hwq, trans_pcie->queue_stopped))367367- if (atomic_dec_return(&trans_pcie->queue_stop_count[ac]) <= 0)366366+ if (test_and_clear_bit(hwq, trans_pcie->queue_stopped)) {367367+ if (atomic_dec_return(&trans_pcie->queue_stop_count[ac]) <= 0) {368368 iwl_wake_sw_queue(priv(trans), ac);369369+ IWL_DEBUG_TX_QUEUES(trans, "Wake hwq %d ac %d. %s",370370+ hwq, ac, msg);371371+ } else {372372+ IWL_DEBUG_TX_QUEUES(trans, "Don't wake hwq %d ac %d"373373+ " stop count %d. %s",374374+ hwq, ac, atomic_read(&trans_pcie->375375+ queue_stop_count[ac]), msg);376376+ }377377+ }369378}370379371380static inline void iwl_stop_queue(struct iwl_trans *trans,372372- struct iwl_tx_queue *txq)381381+ struct iwl_tx_queue *txq, const char *msg)373382{374383 u8 queue = txq->swq_id;375384 u8 ac = queue & 3;···386377 struct iwl_trans_pcie *trans_pcie =387378 IWL_TRANS_GET_PCIE_TRANS(trans);388379389389- if (!test_and_set_bit(hwq, trans_pcie->queue_stopped))390390- if (atomic_inc_return(&trans_pcie->queue_stop_count[ac]) > 0)380380+ if (!test_and_set_bit(hwq, trans_pcie->queue_stopped)) {381381+ if (atomic_inc_return(&trans_pcie->queue_stop_count[ac]) > 0) {391382 iwl_stop_sw_queue(priv(trans), ac);383383+ IWL_DEBUG_TX_QUEUES(trans, "Stop hwq %d ac %d"384384+ " stop count %d. %s",385385+ hwq, ac, atomic_read(&trans_pcie->386386+ queue_stop_count[ac]), msg);387387+ } else {388388+ IWL_DEBUG_TX_QUEUES(trans, "Don't stop hwq %d ac %d"389389+ " stop count %d. %s",390390+ hwq, ac, atomic_read(&trans_pcie->391391+ queue_stop_count[ac]), msg);392392+ }393393+ } else {394394+ IWL_DEBUG_TX_QUEUES(trans, "stop hwq %d, but it is stopped/ %s",395395+ hwq, msg);396396+ }392397}393398394399#ifdef ieee80211_stop_queue
+1-1
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
···11081108 isr_stats->tx++;11091109 handled |= CSR_INT_BIT_FH_TX;11101110 /* Wake up uCode load routine, now that load is complete */11111111- priv(trans)->ucode_write_complete = 1;11111111+ trans->ucode_write_complete = 1;11121112 wake_up(&trans->shrd->wait_command_queue);11131113 }11141114
+29-23
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
···430430431431 txq->sched_retry = scd_retry;432432433433- IWL_DEBUG_INFO(trans, "%s %s Queue %d on FIFO %d\n",433433+ IWL_DEBUG_TX_QUEUES(trans, "%s %s Queue %d on FIFO %d\n",434434 active ? "Activate" : "Deactivate",435435 scd_retry ? "BA" : "AC/CMD", txq_id, tx_fifo_id);436436}···561561562562 tid_data = &trans->shrd->tid_data[sta_id][tid];563563 if (tid_data->tfds_in_queue == 0) {564564- IWL_DEBUG_HT(trans, "HW queue is empty\n");564564+ IWL_DEBUG_TX_QUEUES(trans, "HW queue is empty\n");565565 tid_data->agg.state = IWL_AGG_ON;566566 iwl_start_tx_ba_trans_ready(priv(trans), ctx, sta_id, tid);567567 } else {568568- IWL_DEBUG_HT(trans, "HW queue is NOT empty: %d packets in HW"569569- "queue\n", tid_data->tfds_in_queue);568568+ IWL_DEBUG_TX_QUEUES(trans,569569+ "HW queue is NOT empty: %d packets in HW"570570+ " queue\n", tid_data->tfds_in_queue);570571 tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA;571572 }572573 spin_unlock_irqrestore(&trans->shrd->sta_lock, flags);···644643645644 /* The queue is not empty */646645 if (write_ptr != read_ptr) {647647- IWL_DEBUG_HT(trans, "Stopping a non empty AGG HW QUEUE\n");646646+ IWL_DEBUG_TX_QUEUES(trans,647647+ "Stopping a non empty AGG HW QUEUE\n");648648 trans->shrd->tid_data[sta_id][tid].agg.state =649649 IWL_EMPTYING_HW_QUEUE_DELBA;650650 spin_unlock_irqrestore(&trans->shrd->sta_lock, flags);651651 return 0;652652 }653653654654- IWL_DEBUG_HT(trans, "HW queue is empty\n");654654+ IWL_DEBUG_TX_QUEUES(trans, "HW queue is empty\n");655655turn_off:656656 trans->shrd->tid_data[sta_id][tid].agg.state = IWL_AGG_OFF;657657···984982985983 ret = iwl_enqueue_hcmd(trans, cmd);986984 if (ret < 0) {987987- IWL_ERR(trans, "Error sending %s: enqueue_hcmd failed: %d\n",985985+ IWL_DEBUG_QUIET_RFKILL(trans,986986+ "Error sending %s: enqueue_hcmd failed: %d\n",988987 get_cmd_string(cmd->id), ret);989988 return ret;990989 }···10031000 IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n",10041001 get_cmd_string(cmd->id));1005100210031003+ if (test_bit(STATUS_EXIT_PENDING, &trans->shrd->status))10041004+ return -EBUSY;10051005+10061006+10071007+ if (test_bit(STATUS_RF_KILL_HW, &trans->shrd->status)) {10081008+ IWL_ERR(trans, "Command %s aborted: RF KILL Switch\n",10091009+ get_cmd_string(cmd->id));10101010+ return -ECANCELED;10111011+ }10121012+ if (test_bit(STATUS_FW_ERROR, &trans->shrd->status)) {10131013+ IWL_ERR(trans, "Command %s failed: FW Error\n",10141014+ get_cmd_string(cmd->id));10151015+ return -EIO;10161016+ }10061017 set_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status);10071018 IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n",10081019 get_cmd_string(cmd->id));···10251008 if (cmd_idx < 0) {10261009 ret = cmd_idx;10271010 clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status);10281028- IWL_ERR(trans, "Error sending %s: enqueue_hcmd failed: %d\n",10111011+ IWL_DEBUG_QUIET_RFKILL(trans,10121012+ "Error sending %s: enqueue_hcmd failed: %d\n",10291013 get_cmd_string(cmd->id), ret);10301014 return ret;10311015 }···10401022 &trans_pcie->txq[trans->shrd->cmd_queue];10411023 struct iwl_queue *q = &txq->q;1042102410431043- IWL_ERR(trans,10251025+ IWL_DEBUG_QUIET_RFKILL(trans,10441026 "Error sending %s: time out after %dms.\n",10451027 get_cmd_string(cmd->id),10461028 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));1047102910481048- IWL_ERR(trans,10301030+ IWL_DEBUG_QUIET_RFKILL(trans,10491031 "Current CMD queue read_ptr %d write_ptr %d\n",10501032 q->read_ptr, q->write_ptr);10511033···10571039 }10581040 }1059104110601060- if (test_bit(STATUS_RF_KILL_HW, &trans->shrd->status)) {10611061- IWL_ERR(trans, "Command %s aborted: RF KILL Switch\n",10621062- get_cmd_string(cmd->id));10631063- ret = -ECANCELED;10641064- goto fail;10651065- }10661066- if (test_bit(STATUS_FW_ERROR, &trans->shrd->status)) {10671067- IWL_ERR(trans, "Command %s failed: FW Error\n",10681068- get_cmd_string(cmd->id));10691069- ret = -EIO;10701070- goto fail;10711071- }10721042 if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) {10731043 IWL_ERR(trans, "Error: Response NULL in '%s'\n",10741044 get_cmd_string(cmd->id));···10771071 trans_pcie->txq[trans->shrd->cmd_queue].meta[cmd_idx].flags &=10781072 ~CMD_WANT_SKB;10791073 }10801080-fail:10741074+10811075 if (cmd->reply_page) {10821076 iwl_free_pages(trans->shrd, cmd->reply_page);10831077 cmd->reply_page = 0;
···559559 break;560560 }561561 /* Fail if SSID isn't present in the filters */562562- if (j == req->n_ssids) {562562+ if (j == cmd->n_ssids) {563563 ret = -EINVAL;564564 goto out_free;565565 }
···509509 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).510510 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.511511 *512512+ * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP513513+ * (or GO) interface (i.e. hostapd) to ask for unexpected frames to514514+ * implement sending deauth to stations that send unexpected class 3515515+ * frames. Also used as the event sent by the kernel when such a frame516516+ * is received.517517+ * For the event, the %NL80211_ATTR_MAC attribute carries the TA and518518+ * other attributes like the interface index are present.519519+ * If used as the command it must have an interface index and you can520520+ * only unsubscribe from the event by closing the socket. Subscription521521+ * is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events.522522+ *523523+ * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the524524+ * associated station identified by %NL80211_ATTR_MAC sent a 4addr frame525525+ * and wasn't already in a 4-addr VLAN. The event will be sent similarly526526+ * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener.527527+ *528528+ * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface529529+ * by sending a null data frame to it and reporting when the frame is530530+ * acknowleged. This is used to allow timing out inactive clients. Uses531531+ * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a532532+ * direct reply with an %NL80211_ATTR_COOKIE that is later used to match533533+ * up the event with the request. The event includes the same data and534534+ * has %NL80211_ATTR_ACK set if the frame was ACKed.535535+ *536536+ * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from537537+ * other BSSes when any interfaces are in AP mode. This helps implement538538+ * OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME539539+ * messages. Note that per PHY only one application may register.540540+ *512541 * @NL80211_CMD_MAX: highest used command number513542 * @__NL80211_CMD_AFTER_LAST: internal use514543 */···667638 NL80211_CMD_TDLS_OPER,668639 NL80211_CMD_TDLS_MGMT,669640641641+ NL80211_CMD_UNEXPECTED_FRAME,642642+643643+ NL80211_CMD_PROBE_CLIENT,644644+645645+ NL80211_CMD_REGISTER_BEACONS,646646+647647+ NL80211_CMD_UNEXPECTED_4ADDR_FRAME,648648+670649 /* add new commands above here */671650672651 /* used to define NL80211_CMD_MAX below */···694657#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE695658#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE696659#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT660660+661661+#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS697662698663/* source-level API compatibility */699664#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG···11481109 * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be11491110 * used for asking the driver to perform a TDLS operation.11501111 *11121112+ * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices11131113+ * that have AP support to indicate that they have the AP SME integrated11141114+ * with support for the features listed in this attribute, see11151115+ * &enum nl80211_ap_sme_features.11161116+ *11171117+ * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells11181118+ * the driver to not wait for an acknowledgement. Note that due to this,11191119+ * it will also not give a status callback nor return a cookie. This is11201120+ * mostly useful for probe responses to save airtime.11211121+ *11221122+ * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from11231123+ * &enum nl80211_feature_flags and is advertised in wiphy information.11241124+ * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe11251125+ *11261126+ * requests while operating in AP-mode.11271127+ * This attribute holds a bitmap of the supported protocols for11281128+ * offloading (see &enum nl80211_probe_resp_offload_support_attr).11291129+ *11301130+ * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire11311131+ * probe-response frame. The DA field in the 802.11 header is zero-ed out,11321132+ * to be filled by the FW.11331133+ *11511134 * @NL80211_ATTR_MAX: highest attribute number currently defined11521135 * @__NL80211_ATTR_AFTER_LAST: internal use11531136 */···13981337 NL80211_ATTR_TDLS_SUPPORT,13991338 NL80211_ATTR_TDLS_EXTERNAL_SETUP,1400133913401340+ NL80211_ATTR_DEVICE_AP_SME,13411341+13421342+ NL80211_ATTR_DONT_WAIT_FOR_ACK,13431343+13441344+ NL80211_ATTR_FEATURE_FLAGS,13451345+13461346+ NL80211_ATTR_PROBE_RESP_OFFLOAD,13471347+13481348+ NL80211_ATTR_PROBE_RESP,13491349+14011350 /* add attributes here, update the policy in nl80211.c */1402135114031352 __NL80211_ATTR_AFTER_LAST,···14421371#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES14431372#define NL80211_ATTR_KEY NL80211_ATTR_KEY14441373#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS13741374+#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS1445137514461376#define NL80211_MAX_SUPP_RATES 3214471377#define NL80211_MAX_SUPP_REG_RULES 32···27202648 NL80211_TDLS_TEARDOWN,27212649 NL80211_TDLS_ENABLE_LINK,27222650 NL80211_TDLS_DISABLE_LINK,26512651+};26522652+26532653+/*26542654+ * enum nl80211_ap_sme_features - device-integrated AP features26552655+ * Reserved for future use, no bits are defined in26562656+ * NL80211_ATTR_DEVICE_AP_SME yet.26572657+enum nl80211_ap_sme_features {26582658+};26592659+ */26602660+26612661+/**26622662+ * enum nl80211_feature_flags - device/driver features26632663+ * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back26642664+ * TX status to the socket error queue when requested with the26652665+ * socket option.26662666+ */26672667+enum nl80211_feature_flags {26682668+ NL80211_FEATURE_SK_TX_STATUS = 1 << 0,26692669+};26702670+26712671+/**26722672+ * enum nl80211_probe_resp_offload_support_attr - optional supported26732673+ * protocols for probe-response offloading by the driver/FW.26742674+ * To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute.26752675+ * Each enum value represents a bit in the bitmap of supported26762676+ * protocols. Typically a subset of probe-requests belonging to a26772677+ * supported protocol will be excluded from offload and uploaded26782678+ * to the host.26792679+ *26802680+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 126812681+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 226822682+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P26832683+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u26842684+ */26852685+enum nl80211_probe_resp_offload_support_attr {26862686+ NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0,26872687+ NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1,26882688+ NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2,26892689+ NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3,27232690};2724269127252692#endif /* __LINUX_NL80211_H */
+17-2
include/linux/skbuff.h
···218218219219 /* device driver supports TX zero-copy buffers */220220 SKBTX_DEV_ZEROCOPY = 1 << 4,221221+222222+ /* generate wifi status information (where possible) */223223+ SKBTX_WIFI_STATUS = 1 << 5,221224};222225223226/*···355352 * @ooo_okay: allow the mapping of a socket to a queue to be changed356353 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport357354 * ports.355355+ * @wifi_acked_valid: wifi_acked was set356356+ * @wifi_acked: whether frame was acked on wifi or not358357 * @dma_cookie: a cookie to one of several possible DMA operations359358 * done by skb DMA functions360359 * @secmark: security marking···450445#endif451446 __u8 ooo_okay:1;452447 __u8 l4_rxhash:1;448448+ __u8 wifi_acked_valid:1;449449+ __u8 wifi_acked:1;450450+ /* 10/12 bit hole (depending on ndisc_nodetype presence) */453451 kmemcheck_bitfield_end(flags2);454454-455455- /* 0/13 bit hole */456452457453#ifdef CONFIG_NET_DMA458454 dma_cookie_t dma_cookie;···22702264 skb_clone_tx_timestamp(skb);22712265 sw_tx_timestamp(skb);22722266}22672267+22682268+/**22692269+ * skb_complete_wifi_ack - deliver skb with wifi status22702270+ *22712271+ * @skb: the original outgoing packet22722272+ * @acked: ack status22732273+ *22742274+ */22752275+void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);2273227622742277extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);22752278extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
+28-1
include/net/bluetooth/bluetooth.h
···7777#define BT_POWER_FORCE_ACTIVE_OFF 07878#define BT_POWER_FORCE_ACTIVE_ON 179798080+#define BT_CHANNEL_POLICY 108181+8282+/* BR/EDR only (default policy)8383+ * AMP controllers cannot be used.8484+ * Channel move requests from the remote device are denied.8585+ * If the L2CAP channel is currently using AMP, move the channel to BR/EDR.8686+ */8787+#define BT_CHANNEL_POLICY_BREDR_ONLY 08888+8989+/* BR/EDR Preferred9090+ * Allow use of AMP controllers.9191+ * If the L2CAP channel is currently on AMP, move it to BR/EDR.9292+ * Channel move requests from the remote device are allowed.9393+ */9494+#define BT_CHANNEL_POLICY_BREDR_PREFERRED 19595+9696+/* AMP Preferred9797+ * Allow use of AMP controllers9898+ * If the L2CAP channel is currently on BR/EDR and AMP controller9999+ * resources are available, initiate a channel move to AMP.100100+ * Channel move requests from the remote device are allowed.101101+ * If the L2CAP socket has not been connected yet, try to create102102+ * and configure the channel directly on an AMP controller rather103103+ * than BR/EDR.104104+ */105105+#define BT_CHANNEL_POLICY_AMP_PREFERRED 2106106+80107__printf(2, 3)81108int bt_printk(const char *level, const char *fmt, ...);82109···185158 __u8 pkt_type;186159 __u8 incoming;187160 __u16 expect;188188- __u8 tx_seq;161161+ __u16 tx_seq;189162 __u8 retries;190163 __u8 sar;191164 unsigned short channel;
···391391 * @assocresp_ies: extra information element(s) to add into (Re)Association392392 * Response frames or %NULL393393 * @assocresp_ies_len: length of assocresp_ies in octets394394+ * @probe_resp_len: length of probe response template (@probe_resp)395395+ * @probe_resp: probe response template (AP mode only)394396 */395397struct beacon_parameters {396398 u8 *head, *tail;···410408 size_t proberesp_ies_len;411409 const u8 *assocresp_ies;412410 size_t assocresp_ies_len;411411+ int probe_resp_len;412412+ u8 *probe_resp;413413};414414415415/**···460456 * as the AC bitmap in the QoS info field461457 * @max_sp: max Service Period. same format as the MAX_SP in the462458 * QoS info field (but already shifted down)459459+ * @sta_modify_mask: bitmap indicating which parameters changed460460+ * (for those that don't have a natural "no change" value),461461+ * see &enum station_parameters_apply_mask463462 */464463struct station_parameters {465464 u8 *supported_rates;···622615 * user space MLME/SME implementation. The information is provided for623616 * the cfg80211_new_sta() calls to notify user space of the IEs.624617 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.618618+ * @sta_flags: station flags mask & values625619 */626620struct station_info {627621 u32 filled;···13461338 * doesn't verify much. Note, however, that the passed netdev may be13471339 * %NULL as well if the user requested changing the channel for the13481340 * device itself, or for a monitor interface.13411341+ * @get_channel: Get the current operating channel, should return %NULL if13421342+ * there's no single defined operating channel if for example the13431343+ * device implements channel hopping for multi-channel virtual interfaces.13491344 *13501345 * @scan: Request to do a scan. If returning zero, the scan request is given13511346 * the driver, and will be valid until passed to cfg80211_scan_done().···14391428 *14401429 * @tdls_mgmt: Transmit a TDLS management frame.14411430 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).14311431+ *14321432+ * @probe_client: probe an associated client, must return a cookie that it14331433+ * later passes to cfg80211_probe_status().14421434 */14431435struct cfg80211_ops {14441436 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);···15951581 enum nl80211_channel_type channel_type,15961582 bool channel_type_valid, unsigned int wait,15971583 const u8 *buf, size_t len, bool no_cck,15981598- u64 *cookie);15841584+ bool dont_wait_for_ack, u64 *cookie);15991585 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,16001586 struct net_device *dev,16011587 u64 cookie);···16311617 u16 status_code, const u8 *buf, size_t len);16321618 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,16331619 u8 *peer, enum nl80211_tdls_operation oper);16201620+16211621+ int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,16221622+ const u8 *peer, u64 *cookie);16231623+16241624+ struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);16341625};1635162616361627/*···16941675 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT16951676 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be16961677 * used for asking the driver/firmware to perform a TDLS operation.16781678+ * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME16791679+ * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes16801680+ * when there are virtual interfaces in AP mode by calling16811681+ * cfg80211_report_obss_beacon().16821682+ * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device16831683+ * responds to probe-requests in hardware.16971684 */16981685enum wiphy_flags {16991686 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0),···17181693 WIPHY_FLAG_AP_UAPSD = BIT(14),17191694 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),17201695 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),16961696+ WIPHY_FLAG_HAVE_AP_SME = BIT(17),16971697+ WIPHY_FLAG_REPORTS_OBSS = BIT(18),16981698+ WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),17211699};1722170017231701/**···18931865 * @software_iftypes: bitmask of software interface types, these are not18941866 * subject to any restrictions since they are purely managed in SW.18951867 * @flags: wiphy flags, see &enum wiphy_flags18681868+ * @features: features advertised to nl80211, see &enum nl80211_feature_flags.18961869 * @bss_priv_size: each BSS struct has private data allocated with it,18971870 * this variable determines its size18981871 * @max_scan_ssids: maximum number of SSIDs the device can scan for in···19321903 * may request, if implemented.19331904 *19341905 * @wowlan: WoWLAN support information19061906+ *19071907+ * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.19351908 */19361909struct wiphy {19371910 /* assign these fields before you register the wiphy */···19551924 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */19561925 u16 interface_modes;1957192619581958- u32 flags;19271927+ u32 flags, features;19281928+19291929+ u32 ap_sme_capa;1959193019601931 enum cfg80211_signal_type signal_type;19611932···1988195519891956 u32 available_antennas_tx;19901957 u32 available_antennas_rx;19581958+19591959+ /*19601960+ * Bitmap of supported protocols for probe response offloading19611961+ * see &enum nl80211_probe_resp_offload_support_attr. Only valid19621962+ * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.19631963+ */19641964+ u32 probe_resp_offload;1991196519921966 /* If multiple wiphys are registered and you're handed e.g.19931967 * a regular netdev with assigned ieee80211_ptr, you won't···22182178 int ps_timeout;2219217922202180 int beacon_interval;21812181+21822182+ u32 ap_unexpected_nlpid;2221218322222184#ifdef CONFIG_CFG80211_WEXT22232185 /* wext data */···26742632 *26752633 * This informs cfg80211 that BSS information was found and26762634 * the BSS should be updated/added.26352635+ *26362636+ * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!26772637 */26782678-struct cfg80211_bss*26382638+struct cfg80211_bss * __must_check26792639cfg80211_inform_bss_frame(struct wiphy *wiphy,26802640 struct ieee80211_channel *channel,26812641 struct ieee80211_mgmt *mgmt, size_t len,···26992655 *27002656 * This informs cfg80211 that BSS information was found and27012657 * the BSS should be updated/added.26582658+ *26592659+ * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!27022660 */27032703-struct cfg80211_bss*26612661+struct cfg80211_bss * __must_check27042662cfg80211_inform_bss(struct wiphy *wiphy,27052663 struct ieee80211_channel *channel,27062664 const u8 *bssid,···32303184 */32313185void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,32323186 const u8 *bssid, bool preauth, gfp_t gfp);31873187+31883188+/**31893189+ * cfg80211_rx_spurious_frame - inform userspace about a spurious frame31903190+ * @dev: The device the frame matched to31913191+ * @addr: the transmitter address31923192+ * @gfp: context flags31933193+ *31943194+ * This function is used in AP mode (only!) to inform userspace that31953195+ * a spurious class 3 frame was received, to be able to deauth the31963196+ * sender.31973197+ * Returns %true if the frame was passed to userspace (or this failed31983198+ * for a reason other than not having a subscription.)31993199+ */32003200+bool cfg80211_rx_spurious_frame(struct net_device *dev,32013201+ const u8 *addr, gfp_t gfp);32023202+32033203+/**32043204+ * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame32053205+ * @dev: The device the frame matched to32063206+ * @addr: the transmitter address32073207+ * @gfp: context flags32083208+ *32093209+ * This function is used in AP mode (only!) to inform userspace that32103210+ * an associated station sent a 4addr frame but that wasn't expected.32113211+ * It is allowed and desirable to send this event only once for each32123212+ * station to avoid event flooding.32133213+ * Returns %true if the frame was passed to userspace (or this failed32143214+ * for a reason other than not having a subscription.)32153215+ */32163216+bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,32173217+ const u8 *addr, gfp_t gfp);32183218+32193219+/**32203220+ * cfg80211_probe_status - notify userspace about probe status32213221+ * @dev: the device the probe was sent on32223222+ * @addr: the address of the peer32233223+ * @cookie: the cookie filled in @probe_client previously32243224+ * @acked: indicates whether probe was acked or not32253225+ * @gfp: allocation flags32263226+ */32273227+void cfg80211_probe_status(struct net_device *dev, const u8 *addr,32283228+ u64 cookie, bool acked, gfp_t gfp);32293229+32303230+/**32313231+ * cfg80211_report_obss_beacon - report beacon from other APs32323232+ * @wiphy: The wiphy that received the beacon32333233+ * @frame: the frame32343234+ * @len: length of the frame32353235+ * @freq: frequency the frame was received on32363236+ * @gfp: allocation flags32373237+ *32383238+ * Use this function to report to userspace when a beacon was32393239+ * received. It is not useful to call this when there is no32403240+ * netdev that is in AP/GO mode.32413241+ */32423242+void cfg80211_report_obss_beacon(struct wiphy *wiphy,32433243+ const u8 *frame, size_t len,32443244+ int freq, gfp_t gfp);3233324532343246/* Logging, debugging and troubleshooting/diagnostic helpers. */32353247
-8
include/net/ieee80211_radiotap.h
···271271#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10272272273273274274-/* Ugly macro to convert literal channel numbers into their mhz equivalents275275- * There are certianly some conditions that will break this (like feeding it '30')276276- * but they shouldn't arise since nothing talks on channel 30. */277277-#define ieee80211chan2mhz(x) \278278- (((x) <= 14) ? \279279- (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \280280- ((x) + 1000) * 5)281281-282274/* helpers */283275static inline int ieee80211_get_radiotap_len(unsigned char *data)284276{
+32-3
include/net/mac80211.h
···166166 * that it is only ever disabled for station mode.167167 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.168168 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode)169169+ * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)169170 */170171enum ieee80211_bss_change {171172 BSS_CHANGED_ASSOC = 1<<0,···185184 BSS_CHANGED_QOS = 1<<13,186185 BSS_CHANGED_IDLE = 1<<14,187186 BSS_CHANGED_SSID = 1<<15,187187+ BSS_CHANGED_AP_PROBE_RESP = 1<<16,188188189189 /* when adding here, make sure to change ieee80211_reconfig */190190};···520518 * @flags: transmit info flags, defined above521519 * @band: the band to transmit on (use for checking for races)522520 * @antenna_sel_tx: antenna to use, 0 for automatic diversity523523- * @pad: padding, ignore521521+ * @ack_frame_id: internal frame ID for TX status, used internally524522 * @control: union for control data525523 * @status: union for status data526524 * @driver_data: array of driver_data pointers···537535538536 u8 antenna_sel_tx;539537540540- /* 2 byte hole */541541- u8 pad[2];538538+ u16 ack_frame_id;542539543540 union {544541 struct {···902901 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a903902 * CCMP key if it requires CCMP encryption of management frames (MFP) to904903 * be done in software.904904+ * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver905905+ * for a CCMP key if space should be prepared for the IV, but the IV906906+ * itself should not be generated. Do not set together with907907+ * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key.905908 */906909enum ieee80211_key_flags {907910 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,···913908 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,914909 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,915910 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4,911911+ IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5,916912};917913918914/**···13081302 return NULL;13091303 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx];13101304}13051305+13061306+/**13071307+ * ieee80211_free_txskb - free TX skb13081308+ * @hw: the hardware13091309+ * @skb: the skb13101310+ *13111311+ * Free a transmit skb. Use this funtion when some failure13121312+ * to transmit happened and thus status cannot be reported.13131313+ */13141314+void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);1311131513121316/**13131317 * DOC: Hardware crypto acceleration···26752659{26762660 return ieee80211_beacon_get_tim(hw, vif, NULL, NULL);26772661}26622662+26632663+/**26642664+ * ieee80211_proberesp_get - retrieve a Probe Response template26652665+ * @hw: pointer obtained from ieee80211_alloc_hw().26662666+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.26672667+ *26682668+ * Creates a Probe Response template which can, for example, be uploaded to26692669+ * hardware. The destination address should be set by the caller.26702670+ *26712671+ * Can only be called in AP mode.26722672+ */26732673+struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,26742674+ struct ieee80211_vif *vif);2678267526792676/**26802677 * ieee80211_pspoll_get - retrieve a PS Poll template
···7878 memcpy(mgmt->da, da, ETH_ALEN);7979 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);8080 if (sdata->vif.type == NL80211_IFTYPE_AP ||8181- sdata->vif.type == NL80211_IFTYPE_AP_VLAN)8181+ sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||8282+ sdata->vif.type == NL80211_IFTYPE_MESH_POINT)8283 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);8384 else if (sdata->vif.type == NL80211_IFTYPE_STATION)8485 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);···373372 pubsta->addr, tid);374373#endif /* CONFIG_MAC80211_HT_DEBUG */375374376376- /*377377- * The aggregation code is not prepared to handle378378- * anything but STA/AP due to the BSSID handling.379379- * IBSS could work in the code but isn't supported380380- * by drivers or the standard.381381- */382375 if (sdata->vif.type != NL80211_IFTYPE_STATION &&376376+ sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&383377 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&384378 sdata->vif.type != NL80211_IFTYPE_AP)385379 return -EINVAL;
+156-11
net/mac80211/cfg.c
···411411 BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |412412 BIT(NL80211_STA_FLAG_WME) |413413 BIT(NL80211_STA_FLAG_MFP) |414414- BIT(NL80211_STA_FLAG_AUTHENTICATED);414414+ BIT(NL80211_STA_FLAG_AUTHENTICATED) |415415+ BIT(NL80211_STA_FLAG_TDLS_PEER);415416 if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))416417 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);417418 if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))···423422 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);424423 if (test_sta_flag(sta, WLAN_STA_AUTH))425424 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);425425+ if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))426426+ sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);426427}427428428429···491488 (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE);492489}493490491491+static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,492492+ u8 *resp, size_t resp_len)493493+{494494+ struct sk_buff *new, *old;495495+496496+ if (!resp || !resp_len)497497+ return -EINVAL;498498+499499+ old = sdata->u.ap.probe_resp;500500+501501+ new = dev_alloc_skb(resp_len);502502+ if (!new)503503+ return -ENOMEM;504504+505505+ memcpy(skb_put(new, resp_len), resp, resp_len);506506+507507+ rcu_assign_pointer(sdata->u.ap.probe_resp, new);508508+ synchronize_rcu();509509+510510+ if (old)511511+ dev_kfree_skb(old);512512+513513+ return 0;514514+}515515+494516/*495517 * This handles both adding a beacon and setting new beacon info496518 */···526498 int new_head_len, new_tail_len;527499 int size;528500 int err = -EINVAL;501501+ u32 changed = 0;529502530503 old = rtnl_dereference(sdata->u.ap.beacon);531504···610581611582 kfree(old);612583613613- ieee80211_config_ap_ssid(sdata, params);584584+ err = ieee80211_set_probe_resp(sdata, params->probe_resp,585585+ params->probe_resp_len);586586+ if (!err)587587+ changed |= BSS_CHANGED_AP_PROBE_RESP;614588615615- ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED |616616- BSS_CHANGED_BEACON |617617- BSS_CHANGED_SSID);589589+ ieee80211_config_ap_ssid(sdata, params);590590+ changed |= BSS_CHANGED_BEACON_ENABLED |591591+ BSS_CHANGED_BEACON |592592+ BSS_CHANGED_SSID;593593+594594+ ieee80211_bss_info_change_notify(sdata, changed);618595 return 0;619596}620597···629594{630595 struct ieee80211_sub_if_data *sdata;631596 struct beacon_data *old;597597+ struct ieee80211_sub_if_data *vlan;598598+ int ret;632599633600 sdata = IEEE80211_DEV_TO_SUB_IF(dev);634601···638601 if (old)639602 return -EALREADY;640603641641- return ieee80211_config_beacon(sdata, params);604604+ ret = ieee80211_config_beacon(sdata, params);605605+ if (ret)606606+ return ret;607607+608608+ /*609609+ * Apply control port protocol, this allows us to610610+ * not encrypt dynamic WEP control frames.611611+ */612612+ sdata->control_port_protocol = params->crypto.control_port_ethertype;613613+ sdata->control_port_no_encrypt = params->crypto.control_port_no_encrypt;614614+ list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {615615+ vlan->control_port_protocol =616616+ params->crypto.control_port_ethertype;617617+ vlan->control_port_no_encrypt =618618+ params->crypto.control_port_no_encrypt;619619+ }620620+621621+ return 0;642622}643623644624static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,···901847902848 sta_apply_parameters(local, sta, params);903849904904- rate_control_rate_init(sta);850850+ /*851851+ * for TDLS, rate control should be initialized only when supported852852+ * rates are known.853853+ */854854+ if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER))855855+ rate_control_rate_init(sta);905856906857 layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||907858 sdata->vif.type == NL80211_IFTYPE_AP;···989930 }990931991932 sta_apply_parameters(local, sta, params);933933+934934+ if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) && params->supported_rates)935935+ rate_control_rate_init(sta);992936993937 rcu_read_unlock();994938···14561394 (old_oper_type != local->_oper_channel_type))14571395 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);1458139614591459- if ((sdata && sdata->vif.type != NL80211_IFTYPE_MONITOR) &&13971397+ if (sdata && sdata->vif.type != NL80211_IFTYPE_MONITOR &&14601398 old_vif_oper_type != sdata->vif.bss_conf.channel_type)14611399 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT);14621400···19791917 enum nl80211_channel_type channel_type,19801918 bool channel_type_valid, unsigned int wait,19811919 const u8 *buf, size_t len, bool no_cck,19821982- u64 *cookie)19201920+ bool dont_wait_for_ack, u64 *cookie)19831921{19841922 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);19851923 struct ieee80211_local *local = sdata->local;···19871925 struct sta_info *sta;19881926 struct ieee80211_work *wk;19891927 const struct ieee80211_mgmt *mgmt = (void *)buf;19901990- u32 flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX |19911991- IEEE80211_TX_CTL_REQ_TX_STATUS;19281928+ u32 flags;19921929 bool is_offchan = false;19301930+19311931+ if (dont_wait_for_ack)19321932+ flags = IEEE80211_TX_CTL_NO_ACK;19331933+ else19341934+ flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX |19351935+ IEEE80211_TX_CTL_REQ_TX_STATUS;1993193619941937 /* Check that we are on the requested channel for transmission */19951938 if (chan != local->tmp_channel &&···25552488 return 0;25562489}2557249024912491+static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,24922492+ const u8 *peer, u64 *cookie)24932493+{24942494+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);24952495+ struct ieee80211_local *local = sdata->local;24962496+ struct ieee80211_qos_hdr *nullfunc;24972497+ struct sk_buff *skb;24982498+ int size = sizeof(*nullfunc);24992499+ __le16 fc;25002500+ bool qos;25012501+ struct ieee80211_tx_info *info;25022502+ struct sta_info *sta;25032503+25042504+ rcu_read_lock();25052505+ sta = sta_info_get(sdata, peer);25062506+ if (sta) {25072507+ qos = test_sta_flag(sta, WLAN_STA_WME);25082508+ rcu_read_unlock();25092509+ } else {25102510+ rcu_read_unlock();25112511+ return -ENOLINK;25122512+ }25132513+25142514+ if (qos) {25152515+ fc = cpu_to_le16(IEEE80211_FTYPE_DATA |25162516+ IEEE80211_STYPE_QOS_NULLFUNC |25172517+ IEEE80211_FCTL_FROMDS);25182518+ } else {25192519+ size -= 2;25202520+ fc = cpu_to_le16(IEEE80211_FTYPE_DATA |25212521+ IEEE80211_STYPE_NULLFUNC |25222522+ IEEE80211_FCTL_FROMDS);25232523+ }25242524+25252525+ skb = dev_alloc_skb(local->hw.extra_tx_headroom + size);25262526+ if (!skb)25272527+ return -ENOMEM;25282528+25292529+ skb->dev = dev;25302530+25312531+ skb_reserve(skb, local->hw.extra_tx_headroom);25322532+25332533+ nullfunc = (void *) skb_put(skb, size);25342534+ nullfunc->frame_control = fc;25352535+ nullfunc->duration_id = 0;25362536+ memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN);25372537+ memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN);25382538+ memcpy(nullfunc->addr3, sdata->vif.addr, ETH_ALEN);25392539+ nullfunc->seq_ctrl = 0;25402540+25412541+ info = IEEE80211_SKB_CB(skb);25422542+25432543+ info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS |25442544+ IEEE80211_TX_INTFL_NL80211_FRAME_TX;25452545+25462546+ skb_set_queue_mapping(skb, IEEE80211_AC_VO);25472547+ skb->priority = 7;25482548+ if (qos)25492549+ nullfunc->qos_ctrl = cpu_to_le16(7);25502550+25512551+ local_bh_disable();25522552+ ieee80211_xmit(sdata, skb);25532553+ local_bh_enable();25542554+25552555+ *cookie = (unsigned long) skb;25562556+ return 0;25572557+}25582558+25592559+static struct ieee80211_channel *25602560+ieee80211_wiphy_get_channel(struct wiphy *wiphy)25612561+{25622562+ struct ieee80211_local *local = wiphy_priv(wiphy);25632563+25642564+ return local->oper_channel;25652565+}25662566+25582567struct cfg80211_ops mac80211_config_ops = {25592568 .add_virtual_intf = ieee80211_add_iface,25602569 .del_virtual_intf = ieee80211_del_iface,···26962553 .set_rekey_data = ieee80211_set_rekey_data,26972554 .tdls_oper = ieee80211_tdls_oper,26982555 .tdls_mgmt = ieee80211_tdls_mgmt,25562556+ .probe_client = ieee80211_probe_client,25572557+ .get_channel = ieee80211_wiphy_get_channel,26992558};
+1-1
net/mac80211/debugfs.c
···190190 return -EFAULT;191191 buf[len] = '\0';192192193193- ret = strict_strtoul(buf, 0, &val);193193+ ret = kstrtoul(buf, 0, &val);194194195195 if (ret)196196 return -EINVAL;
+62-6
net/mac80211/driver-ops.h
···55#include "ieee80211_i.h"66#include "driver-trace.h"7788+static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)99+{1010+ WARN_ON(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER));1111+}1212+813static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb)914{1015 local->ops->tx(&local->hw, skb);···7469#endif75707671static inline int drv_add_interface(struct ieee80211_local *local,7777- struct ieee80211_vif *vif)7272+ struct ieee80211_sub_if_data *sdata)7873{7974 int ret;80758176 might_sleep();82778383- trace_drv_add_interface(local, vif_to_sdata(vif));8484- ret = local->ops->add_interface(&local->hw, vif);7878+ if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||7979+ sdata->vif.type == NL80211_IFTYPE_MONITOR))8080+ return -EINVAL;8181+8282+ trace_drv_add_interface(local, sdata);8383+ ret = local->ops->add_interface(&local->hw, &sdata->vif);8584 trace_drv_return_int(local, ret);8585+8686+ if (ret == 0)8787+ sdata->flags |= IEEE80211_SDATA_IN_DRIVER;8888+8689 return ret;8790}8891···1028910390 might_sleep();104919292+ check_sdata_in_driver(sdata);9393+10594 trace_drv_change_interface(local, sdata, type, p2p);10695 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);10796 trace_drv_return_int(local, ret);···11196}1129711398static inline void drv_remove_interface(struct ieee80211_local *local,114114- struct ieee80211_vif *vif)9999+ struct ieee80211_sub_if_data *sdata)115100{116101 might_sleep();117102118118- trace_drv_remove_interface(local, vif_to_sdata(vif));119119- local->ops->remove_interface(&local->hw, vif);103103+ check_sdata_in_driver(sdata);104104+105105+ trace_drv_remove_interface(local, sdata);106106+ local->ops->remove_interface(&local->hw, &sdata->vif);107107+ sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;120108 trace_drv_return_void(local);121109}122110···142124{143125 might_sleep();144126127127+ check_sdata_in_driver(sdata);128128+145129 trace_drv_bss_info_changed(local, sdata, info, changed);146130 if (local->ops->bss_info_changed)147131 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);···159139160140 might_sleep();161141142142+ check_sdata_in_driver(sdata);143143+162144 trace_drv_tx_sync(local, sdata, bssid, type);163145 if (local->ops->tx_sync)164146 ret = local->ops->tx_sync(&local->hw, &sdata->vif,···175153 enum ieee80211_tx_sync_type type)176154{177155 might_sleep();156156+157157+ check_sdata_in_driver(sdata);178158179159 trace_drv_finish_tx_sync(local, sdata, bssid, type);180160 if (local->ops->finish_tx_sync)···235211236212 might_sleep();237213214214+ check_sdata_in_driver(sdata);215215+238216 trace_drv_set_key(local, cmd, sdata, sta, key);239217 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);240218 trace_drv_return_int(local, ret);···254228 if (sta)255229 ista = &sta->sta;256230231231+ check_sdata_in_driver(sdata);232232+257233 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);258234 if (local->ops->update_tkip_key)259235 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,···271243272244 might_sleep();273245246246+ check_sdata_in_driver(sdata);247247+274248 trace_drv_hw_scan(local, sdata);275249 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);276250 trace_drv_return_int(local, ret);···283253 struct ieee80211_sub_if_data *sdata)284254{285255 might_sleep();256256+257257+ check_sdata_in_driver(sdata);286258287259 trace_drv_cancel_hw_scan(local, sdata);288260 local->ops->cancel_hw_scan(&local->hw, &sdata->vif);···301269302270 might_sleep();303271272272+ check_sdata_in_driver(sdata);273273+304274 trace_drv_sched_scan_start(local, sdata);305275 ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,306276 req, ies);···314280 struct ieee80211_sub_if_data *sdata)315281{316282 might_sleep();283283+284284+ check_sdata_in_driver(sdata);317285318286 trace_drv_sched_scan_stop(local, sdata);319287 local->ops->sched_scan_stop(&local->hw, &sdata->vif);···413377 enum sta_notify_cmd cmd,414378 struct ieee80211_sta *sta)415379{380380+ check_sdata_in_driver(sdata);381381+416382 trace_drv_sta_notify(local, sdata, cmd, sta);417383 if (local->ops->sta_notify)418384 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);···428390 int ret = 0;429391430392 might_sleep();393393+394394+ check_sdata_in_driver(sdata);431395432396 trace_drv_sta_add(local, sdata, sta);433397 if (local->ops->sta_add)···446406{447407 might_sleep();448408409409+ check_sdata_in_driver(sdata);410410+449411 trace_drv_sta_remove(local, sdata, sta);450412 if (local->ops->sta_remove)451413 local->ops->sta_remove(&local->hw, &sdata->vif, sta);···462420 int ret = -EOPNOTSUPP;463421464422 might_sleep();423423+424424+ check_sdata_in_driver(sdata);465425466426 trace_drv_conf_tx(local, sdata, queue, params);467427 if (local->ops->conf_tx)···480436481437 might_sleep();482438439439+ check_sdata_in_driver(sdata);440440+483441 trace_drv_get_tsf(local, sdata);484442 if (local->ops->get_tsf)485443 ret = local->ops->get_tsf(&local->hw, &sdata->vif);···495449{496450 might_sleep();497451452452+ check_sdata_in_driver(sdata);453453+498454 trace_drv_set_tsf(local, sdata, tsf);499455 if (local->ops->set_tsf)500456 local->ops->set_tsf(&local->hw, &sdata->vif, tsf);···507459 struct ieee80211_sub_if_data *sdata)508460{509461 might_sleep();462462+463463+ check_sdata_in_driver(sdata);510464511465 trace_drv_reset_tsf(local, sdata);512466 if (local->ops->reset_tsf)···538488 int ret = -EOPNOTSUPP;539489540490 might_sleep();491491+492492+ check_sdata_in_driver(sdata);541493542494 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);543495···696644697645 might_sleep();698646647647+ check_sdata_in_driver(sdata);648648+699649 trace_drv_set_bitrate_mask(local, sdata, mask);700650 if (local->ops->set_bitrate_mask)701651 ret = local->ops->set_bitrate_mask(&local->hw,···711657 struct ieee80211_sub_if_data *sdata,712658 struct cfg80211_gtk_rekey_data *data)713659{660660+ check_sdata_in_driver(sdata);661661+714662 trace_drv_set_rekey_data(local, sdata, data);715663 if (local->ops->set_rekey_data)716664 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
···9797 /* if merging, indicate to driver that we leave the old IBSS */9898 if (sdata->vif.bss_conf.ibss_joined) {9999 sdata->vif.bss_conf.ibss_joined = false;100100+ netif_carrier_off(sdata->dev);100101 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IBSS);101102 }102103···208207 bss = cfg80211_inform_bss_frame(local->hw.wiphy, local->hw.conf.channel,209208 mgmt, skb->len, 0, GFP_KERNEL);210209 cfg80211_put_bss(bss);210210+ netif_carrier_on(sdata->dev);211211 cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL);212212}213213···992990 }993991994992 sta_info_flush(sdata->local, sdata);993993+ netif_carrier_off(sdata->dev);995994996995 /* remove beacon */997996 kfree(sdata->u.ibss.ie);
+23-6
net/mac80211/ieee80211_i.h
···2424#include <linux/spinlock.h>2525#include <linux/etherdevice.h>2626#include <linux/leds.h>2727+#include <linux/idr.h>2728#include <net/ieee80211_radiotap.h>2829#include <net/cfg80211.h>2930#include <net/mac80211.h>···185184 * enum ieee80211_rx_flags - RX data flags186185 *187186 * @IEEE80211_RX_CMNTR: received on cooked monitor already187187+ * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported188188+ * to cfg80211_report_obss_beacon().188189 *189190 * These flags are used across handling multiple interfaces190191 * for a single frame.191192 */192193enum ieee80211_rx_flags {193194 IEEE80211_RX_CMNTR = BIT(0),195195+ IEEE80211_RX_BEACON_REPORTED = BIT(1),194196};195197196198struct ieee80211_rx_data {···232228233229struct ieee80211_if_ap {234230 struct beacon_data __rcu *beacon;231231+ struct sk_buff __rcu *probe_resp;235232236233 struct list_head vlans;237234···548543 * associated stations and deliver multicast frames both549544 * back to wireless media and to the local net stack.550545 * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.546546+ * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver551547 */552548enum ieee80211_sub_if_data_flags {553549 IEEE80211_SDATA_ALLMULTI = BIT(0),···556550 IEEE80211_SDATA_OPERATING_GMODE = BIT(2),557551 IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),558552 IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4),553553+ IEEE80211_SDATA_IN_DRIVER = BIT(5),559554};560555561556/**···729722 * operating channel730723 * @SCAN_SET_CHANNEL: Set the next channel to be scanned731724 * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses732732- * @SCAN_LEAVE_OPER_CHANNEL: Leave the operating channel, notify the AP733733- * about us leaving the channel and stop all associated STA interfaces734734- * @SCAN_ENTER_OPER_CHANNEL: Enter the operating channel again, notify the735735- * AP about us being back and restart all associated STA interfaces725725+ * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to726726+ * send out data727727+ * @SCAN_RESUME: Resume the scan and scan the next channel736728 */737729enum mac80211_scan_state {738730 SCAN_DECISION,739731 SCAN_SET_CHANNEL,740732 SCAN_SEND_PROBE,741741- SCAN_LEAVE_OPER_CHANNEL,742742- SCAN_ENTER_OPER_CHANNEL,733733+ SCAN_SUSPEND,734734+ SCAN_RESUME,743735};744736745737struct ieee80211_local {···10171011 unsigned int hw_roc_duration;10181012 u32 hw_roc_cookie;10191013 bool hw_roc_for_tx;10141014+10151015+ struct idr ack_status_frames;10161016+ spinlock_t ack_status_lock;1020101710211018 /* dummy netdev for use w/ NAPI */10221019 struct net_device napi_dev;···13431334size_t ieee80211_ie_split(const u8 *ies, size_t ielen,13441335 const u8 *ids, int n_ids, size_t offset);13451336size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);13371337+u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_supported_band *sband,13381338+ u16 cap);13391339+u8 *ieee80211_ie_build_ht_info(u8 *pos,13401340+ struct ieee80211_sta_ht_cap *ht_cap,13411341+ struct ieee80211_channel *channel,13421342+ enum nl80211_channel_type channel_type);1346134313471344/* internal work items */13481345void ieee80211_work_init(struct ieee80211_local *local);···13771362bool ieee80211_set_channel_type(struct ieee80211_local *local,13781363 struct ieee80211_sub_if_data *sdata,13791364 enum nl80211_channel_type chantype);13651365+enum nl80211_channel_type13661366+ieee80211_ht_info_to_channel_type(struct ieee80211_ht_info *ht_info);1380136713811368#ifdef CONFIG_MAC80211_NOINLINE13821369#define debug_noinline noinline
+30-14
net/mac80211/iface.c
···188188 if (!is_valid_ether_addr(sdata->u.wds.remote_addr))189189 return -ENOLINK;190190 break;191191- case NL80211_IFTYPE_AP_VLAN:191191+ case NL80211_IFTYPE_AP_VLAN: {192192+ struct ieee80211_sub_if_data *master;193193+192194 if (!sdata->bss)193195 return -ENOLINK;196196+194197 list_add(&sdata->u.vlan.list, &sdata->bss->vlans);198198+199199+ master = container_of(sdata->bss,200200+ struct ieee80211_sub_if_data, u.ap);201201+ sdata->control_port_protocol =202202+ master->control_port_protocol;203203+ sdata->control_port_no_encrypt =204204+ master->control_port_no_encrypt;195205 break;206206+ }196207 case NL80211_IFTYPE_AP:197208 sdata->bss = &sdata->u.ap;198209 break;···276265 break;277266 default:278267 if (coming_up) {279279- res = drv_add_interface(local, &sdata->vif);268268+ res = drv_add_interface(local, sdata);280269 if (res)281270 goto err_stop;282271 }···293282 changed |= ieee80211_reset_erp_info(sdata);294283 ieee80211_bss_info_change_notify(sdata, changed);295284296296- if (sdata->vif.type == NL80211_IFTYPE_STATION)285285+ if (sdata->vif.type == NL80211_IFTYPE_STATION ||286286+ sdata->vif.type == NL80211_IFTYPE_ADHOC)297287 netif_carrier_off(dev);298288 else299289 netif_carrier_on(dev);290290+291291+ /*292292+ * set default queue parameters so drivers don't293293+ * need to initialise the hardware if the hardware294294+ * doesn't start up with sane defaults295295+ */296296+ ieee80211_set_wmm_default(sdata);300297 }301298302299 set_bit(SDATA_STATE_RUNNING, &sdata->state);···348329 if (coming_up)349330 local->open_count++;350331351351- if (hw_reconf_flags) {332332+ if (hw_reconf_flags)352333 ieee80211_hw_config(local, hw_reconf_flags);353353- /*354354- * set default queue parameters so drivers don't355355- * need to initialise the hardware if the hardware356356- * doesn't start up with sane defaults357357- */358358- ieee80211_set_wmm_default(sdata);359359- }360334361335 ieee80211_recalc_ps(local, -1);362336···357345358346 return 0;359347 err_del_interface:360360- drv_remove_interface(local, &sdata->vif);348348+ drv_remove_interface(local, sdata);361349 err_stop:362350 if (!local->open_count)363351 drv_stop(local);···462450 struct ieee80211_sub_if_data *vlan, *tmpsdata;463451 struct beacon_data *old_beacon =464452 rtnl_dereference(sdata->u.ap.beacon);453453+ struct sk_buff *old_probe_resp =454454+ rtnl_dereference(sdata->u.ap.probe_resp);465455466456 /* sdata_running will return false, so this will disable */467457 ieee80211_bss_info_change_notify(sdata,468458 BSS_CHANGED_BEACON_ENABLED);469459470470- /* remove beacon */460460+ /* remove beacon and probe response */471461 RCU_INIT_POINTER(sdata->u.ap.beacon, NULL);462462+ RCU_INIT_POINTER(sdata->u.ap.probe_resp, NULL);472463 synchronize_rcu();473464 kfree(old_beacon);465465+ kfree(old_probe_resp);474466475467 /* down all dependent devices, that is VLANs */476468 list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans,···536520 ieee80211_free_keys(sdata);537521538522 if (going_down)539539- drv_remove_interface(local, &sdata->vif);523523+ drv_remove_interface(local, sdata);540524 }541525542526 sdata->bss = NULL;
···3131 * @MESH_PATH_FIXED: the mesh path has been manually set and should not be3232 * modified3333 * @MESH_PATH_RESOLVED: the mesh path can has been resolved3434+ * @MESH_PATH_REQ_QUEUED: there is an unsent path request for this destination3535+ * already queued up, waiting for the discovery process to start.3436 *3537 * MESH_PATH_RESOLVED is used by the mesh path timer to3638 * decide when to stop or cancel the mesh path discovery.···4341 MESH_PATH_SN_VALID = BIT(2),4442 MESH_PATH_FIXED = BIT(3),4543 MESH_PATH_RESOLVED = BIT(4),4444+ MESH_PATH_REQ_QUEUED = BIT(5),4645};47464847/**···215212 struct ieee80211_sub_if_data *sdata);216213int mesh_add_ds_params_ie(struct sk_buff *skb,217214 struct ieee80211_sub_if_data *sdata);215215+int mesh_add_ht_cap_ie(struct sk_buff *skb,216216+ struct ieee80211_sub_if_data *sdata);217217+int mesh_add_ht_info_ie(struct sk_buff *skb,218218+ struct ieee80211_sub_if_data *sdata);218219void mesh_rmc_free(struct ieee80211_sub_if_data *sdata);219220int mesh_rmc_init(struct ieee80211_sub_if_data *sdata);220221void ieee80211s_init(void);
+32-20
net/mac80211/mesh_hwmp.c
···113113 struct ieee80211_sub_if_data *sdata)114114{115115 struct ieee80211_local *local = sdata->local;116116- struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);116116+ struct sk_buff *skb;117117 struct ieee80211_mgmt *mgmt;118118- u8 *pos;119119- int ie_len;118118+ u8 *pos, ie_len;119119+ int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.mesh_action) +120120+ sizeof(mgmt->u.action.u.mesh_action);120121122122+ skb = dev_alloc_skb(local->hw.extra_tx_headroom +123123+ hdr_len +124124+ 2 + 37); /* max HWMP IE */121125 if (!skb)122126 return -1;123127 skb_reserve(skb, local->hw.extra_tx_headroom);124124- /* 25 is the size of the common mgmt part (24) plus the size of the125125- * common action part (1)126126- */127127- mgmt = (struct ieee80211_mgmt *)128128- skb_put(skb, 25 + sizeof(mgmt->u.action.u.mesh_action));129129- memset(mgmt, 0, 25 + sizeof(mgmt->u.action.u.mesh_action));128128+ mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);129129+ memset(mgmt, 0, hdr_len);130130 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |131131 IEEE80211_STYPE_ACTION);132132···240240 struct ieee80211_sub_if_data *sdata)241241{242242 struct ieee80211_local *local = sdata->local;243243- struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);243243+ struct sk_buff *skb;244244 struct ieee80211_mgmt *mgmt;245245- u8 *pos;246246- int ie_len;245245+ u8 *pos, ie_len;246246+ int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.mesh_action) +247247+ sizeof(mgmt->u.action.u.mesh_action);247248249249+ skb = dev_alloc_skb(local->hw.extra_tx_headroom +250250+ hdr_len +251251+ 2 + 15 /* PERR IE */);248252 if (!skb)249253 return -1;250254 skb_reserve(skb, local->tx_headroom + local->hw.extra_tx_headroom);251251- /* 25 is the size of the common mgmt part (24) plus the size of the252252- * common action part (1)253253- */254254- mgmt = (struct ieee80211_mgmt *)255255- skb_put(skb, 25 + sizeof(mgmt->u.action.u.mesh_action));256256- memset(mgmt, 0, 25 + sizeof(mgmt->u.action.u.mesh_action));255255+ mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);256256+ memset(mgmt, 0, hdr_len);257257 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |258258 IEEE80211_STYPE_ACTION);259259···867867 return;868868 }869869870870+ spin_lock_bh(&mpath->state_lock);871871+ if (mpath->flags & MESH_PATH_REQ_QUEUED) {872872+ spin_unlock_bh(&mpath->state_lock);873873+ spin_unlock_bh(&ifmsh->mesh_preq_queue_lock);874874+ return;875875+ }876876+870877 memcpy(preq_node->dst, mpath->dst, ETH_ALEN);871878 preq_node->flags = flags;879879+880880+ mpath->flags |= MESH_PATH_REQ_QUEUED;881881+ spin_unlock_bh(&mpath->state_lock);872882873883 list_add_tail(&preq_node->list, &ifmsh->preq_queue.list);874884 ++ifmsh->preq_queue_len;···931921 goto enddiscovery;932922933923 spin_lock_bh(&mpath->state_lock);924924+ mpath->flags &= ~MESH_PATH_REQ_QUEUED;934925 if (preq_node->flags & PREQ_Q_F_START) {935926 if (mpath->flags & MESH_PATH_RESOLVING) {936927 spin_unlock_bh(&mpath->state_lock);···10391028 mesh_queue_preq(mpath, PREQ_Q_F_START);10401029 }1041103010421042- if (skb_queue_len(&mpath->frame_queue) >=10431043- MESH_FRAME_QUEUE_LEN)10311031+ if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN)10441032 skb_to_free = skb_dequeue(&mpath->frame_queue);1045103310461034 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;10351035+ ieee80211_set_qos_hdr(sdata, skb);10471036 skb_queue_tail(&mpath->frame_queue, skb);10481037 if (skb_to_free)10491038 mesh_path_discard_frame(skb_to_free, sdata);···10721061 } else if (mpath->discovery_retries < max_preq_retries(sdata)) {10731062 ++mpath->discovery_retries;10741063 mpath->discovery_timeout *= 2;10641064+ mpath->flags &= ~MESH_PATH_REQ_QUEUED;10751065 spin_unlock_bh(&mpath->state_lock);10761066 mesh_queue_preq(mpath, 0);10771067 } else {
···8080 * on it in the lifecycle management section!8181 */8282static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,8383- u8 *hw_addr, u32 rates)8383+ u8 *hw_addr, u32 rates,8484+ struct ieee802_11_elems *elems)8485{8586 struct ieee80211_local *local = sdata->local;8787+ struct ieee80211_supported_band *sband;8688 struct sta_info *sta;8989+9090+ sband = local->hw.wiphy->bands[local->oper_channel->band];87918892 if (local->num_sta >= MESH_MAX_PLINKS)8993 return NULL;···10096 set_sta_flag(sta, WLAN_STA_AUTHORIZED);10197 set_sta_flag(sta, WLAN_STA_WME);10298 sta->sta.supp_rates[local->hw.conf.channel->band] = rates;9999+ if (elems->ht_cap_elem)100100+ ieee80211_ht_cap_ie_to_sta_ht_cap(sband, elems->ht_cap_elem,101101+ &sta->sta.ht_cap);103102 rate_control_rate_init(sta);104103105104 return sta;···160153 enum ieee80211_self_protected_actioncode action,161154 u8 *da, __le16 llid, __le16 plid, __le16 reason) {162155 struct ieee80211_local *local = sdata->local;163163- struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400 +164164- sdata->u.mesh.ie_len);156156+ struct sk_buff *skb;165157 struct ieee80211_mgmt *mgmt;166158 bool include_plid = false;167167- int ie_len = 4;168159 u16 peering_proto = 0;169169- u8 *pos;160160+ u8 *pos, ie_len = 4;161161+ int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) +162162+ sizeof(mgmt->u.action.u.self_prot);170163164164+ skb = dev_alloc_skb(local->hw.extra_tx_headroom +165165+ hdr_len +166166+ 2 + /* capability info */167167+ 2 + /* AID */168168+ 2 + 8 + /* supported rates */169169+ 2 + (IEEE80211_MAX_SUPP_RATES - 8) +170170+ 2 + sdata->u.mesh.mesh_id_len +171171+ 2 + sizeof(struct ieee80211_meshconf_ie) +172172+ 2 + sizeof(struct ieee80211_ht_cap) +173173+ 2 + sizeof(struct ieee80211_ht_info) +174174+ 2 + 8 + /* peering IE */175175+ sdata->u.mesh.ie_len);171176 if (!skb)172177 return -1;173178 skb_reserve(skb, local->hw.extra_tx_headroom);174174- /* 25 is the size of the common mgmt part (24) plus the size of the175175- * common action part (1)176176- */177177- mgmt = (struct ieee80211_mgmt *)178178- skb_put(skb, 25 + sizeof(mgmt->u.action.u.self_prot));179179- memset(mgmt, 0, 25 + sizeof(mgmt->u.action.u.self_prot));179179+ mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);180180+ memset(mgmt, 0, hdr_len);180181 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |181182 IEEE80211_STYPE_ACTION);182183 memcpy(mgmt->da, da, ETH_ALEN);···250235 memcpy(pos, &reason, 2);251236 pos += 2;252237 }238238+239239+ if (action != WLAN_SP_MESH_PEERING_CLOSE) {240240+ if (mesh_add_ht_cap_ie(skb, sdata) ||241241+ mesh_add_ht_info_ie(skb, sdata))242242+ return -1;243243+ }244244+253245 if (mesh_add_vendor_ies(skb, sdata))254246 return -1;255247···283261 elems->ie_start, elems->total_len,284262 GFP_KERNEL);285263 else286286- sta = mesh_plink_alloc(sdata, hw_addr, rates);264264+ sta = mesh_plink_alloc(sdata, hw_addr, rates, elems);287265 if (!sta)288266 return;289267 if (sta_info_insert_rcu(sta)) {···574552 }575553576554 rates = ieee80211_sta_get_rates(local, &elems, rx_status->band);577577- sta = mesh_plink_alloc(sdata, mgmt->sa, rates);555555+ sta = mesh_plink_alloc(sdata, mgmt->sa, rates, &elems);578556 if (!sta) {579557 mpl_dbg("Mesh plink error: plink table full\n");580558 return;
+58-31
net/mac80211/mlme.c
···14681468 return RX_MGMT_CFG80211_DISASSOC;14691469}1470147014711471+static void ieee80211_get_rates(struct ieee80211_supported_band *sband,14721472+ u8 *supp_rates, unsigned int supp_rates_len,14731473+ u32 *rates, u32 *basic_rates,14741474+ bool *have_higher_than_11mbit,14751475+ int *min_rate, int *min_rate_index)14761476+{14771477+ int i, j;14781478+14791479+ for (i = 0; i < supp_rates_len; i++) {14801480+ int rate = (supp_rates[i] & 0x7f) * 5;14811481+ bool is_basic = !!(supp_rates[i] & 0x80);14821482+14831483+ if (rate > 110)14841484+ *have_higher_than_11mbit = true;14851485+14861486+ /*14871487+ * BSS_MEMBERSHIP_SELECTOR_HT_PHY is defined in 802.11n-200914881488+ * 7.3.2.2 as a magic value instead of a rate. Hence, skip it.14891489+ *14901490+ * Note: Even through the membership selector and the basic14911491+ * rate flag share the same bit, they are not exactly14921492+ * the same.14931493+ */14941494+ if (!!(supp_rates[i] & 0x80) &&14951495+ (supp_rates[i] & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY)14961496+ continue;14971497+14981498+ for (j = 0; j < sband->n_bitrates; j++) {14991499+ if (sband->bitrates[j].bitrate == rate) {15001500+ *rates |= BIT(j);15011501+ if (is_basic)15021502+ *basic_rates |= BIT(j);15031503+ if (rate < *min_rate) {15041504+ *min_rate = rate;15051505+ *min_rate_index = j;15061506+ }15071507+ break;15081508+ }15091509+ }15101510+ }15111511+}1471151214721513static bool ieee80211_assoc_success(struct ieee80211_work *wk,14731514 struct ieee80211_mgmt *mgmt, size_t len)···15251484 struct ieee802_11_elems elems;15261485 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;15271486 u32 changed = 0;15281528- int i, j, err;14871487+ int err;15291488 bool have_higher_than_11mbit = false;15301489 u16 ap_ht_cap_flags;14901490+ int min_rate = INT_MAX, min_rate_index = -1;1531149115321492 /* AssocResp and ReassocResp have identical structure */15331493···15831541 basic_rates = 0;15841542 sband = local->hw.wiphy->bands[wk->chan->band];1585154315861586- for (i = 0; i < elems.supp_rates_len; i++) {15871587- int rate = (elems.supp_rates[i] & 0x7f) * 5;15881588- bool is_basic = !!(elems.supp_rates[i] & 0x80);15441544+ ieee80211_get_rates(sband, elems.supp_rates, elems.supp_rates_len,15451545+ &rates, &basic_rates, &have_higher_than_11mbit,15461546+ &min_rate, &min_rate_index);1589154715901590- if (rate > 110)15911591- have_higher_than_11mbit = true;15481548+ ieee80211_get_rates(sband, elems.ext_supp_rates,15491549+ elems.ext_supp_rates_len, &rates, &basic_rates,15501550+ &have_higher_than_11mbit,15511551+ &min_rate, &min_rate_index);1592155215931593- for (j = 0; j < sband->n_bitrates; j++) {15941594- if (sband->bitrates[j].bitrate == rate) {15951595- rates |= BIT(j);15961596- if (is_basic)15971597- basic_rates |= BIT(j);15981598- break;15991599- }16001600- }16011601- }16021602-16031603- for (i = 0; i < elems.ext_supp_rates_len; i++) {16041604- int rate = (elems.ext_supp_rates[i] & 0x7f) * 5;16051605- bool is_basic = !!(elems.ext_supp_rates[i] & 0x80);16061606-16071607- if (rate > 110)16081608- have_higher_than_11mbit = true;16091609-16101610- for (j = 0; j < sband->n_bitrates; j++) {16111611- if (sband->bitrates[j].bitrate == rate) {16121612- rates |= BIT(j);16131613- if (is_basic)16141614- basic_rates |= BIT(j);16151615- break;16161616- }16171617- }15531553+ /*15541554+ * some buggy APs don't advertise basic_rates. use the lowest15551555+ * supported rate instead.15561556+ */15571557+ if (unlikely(!basic_rates) && min_rate_index >= 0) {15581558+ printk(KERN_DEBUG "%s: No basic rates in AssocResp. "15591559+ "Using min supported rate instead.\n", sdata->name);15601560+ basic_rates = BIT(min_rate_index);16181561 }1619156216201563 sta->sta.supp_rates[wk->chan->band] = rates;
+1-1
net/mac80211/pm.c
···125125 ieee80211_bss_info_change_notify(sdata,126126 BSS_CHANGED_BEACON_ENABLED);127127128128- drv_remove_interface(local, &sdata->vif);128128+ drv_remove_interface(local, sdata);129129 }130130131131 /* stop hardware - this must stop RX */
+3-4
net/mac80211/rc80211_minstrel.c
···334334335335336336static void337337-calc_rate_durations(struct minstrel_sta_info *mi, struct ieee80211_local *local,338338- struct minstrel_rate *d, struct ieee80211_rate *rate)337337+calc_rate_durations(struct ieee80211_local *local, struct minstrel_rate *d,338338+ struct ieee80211_rate *rate)339339{340340 int erp = !!(rate->flags & IEEE80211_RATE_ERP_G);341341···402402403403 mr->rix = i;404404 mr->bitrate = sband->bitrates[i].bitrate / 5;405405- calc_rate_durations(mi, local, mr,406406- &sband->bitrates[i]);405405+ calc_rate_durations(local, mr, &sband->bitrates[i]);407406408407 /* calculate maximum number of retransmissions before409408 * fallback (based on maximum segment size) */
+56-17
net/mac80211/rx.c
···745745 struct ieee80211_local *local = rx->local;746746 struct ieee80211_hw *hw = &local->hw;747747 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;748748+ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);748749 struct sta_info *sta = rx->sta;749750 struct tid_ampdu_rx *tid_agg_rx;750751 u16 sc;751751- int tid;752752+ u8 tid, ack_policy;752753753754 if (!ieee80211_is_data_qos(hdr->frame_control))754755 goto dont_reorder;···762761 if (!sta)763762 goto dont_reorder;764763764764+ ack_policy = *ieee80211_get_qos_ctl(hdr) &765765+ IEEE80211_QOS_CTL_ACK_POLICY_MASK;765766 tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK;766767767768 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);···772769773770 /* qos null data frames are excluded */774771 if (unlikely(hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_NULLFUNC)))772772+ goto dont_reorder;773773+774774+ /* not part of a BA session */775775+ if (ack_policy != IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK &&776776+ ack_policy != IEEE80211_QOS_CTL_ACK_POLICY_NORMAL)777777+ goto dont_reorder;778778+779779+ /* not actually part of this BA session */780780+ if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))775781 goto dont_reorder;776782777783 /* new, potentially un-ordered, ampdu frame - process it */···867855 rx->sdata->control_port_protocol)868856 return RX_CONTINUE;869857 }858858+859859+ if (rx->sdata->vif.type == NL80211_IFTYPE_AP &&860860+ cfg80211_rx_spurious_frame(rx->sdata->dev,861861+ hdr->addr2,862862+ GFP_ATOMIC))863863+ return RX_DROP_UNUSABLE;864864+870865 return RX_DROP_MONITOR;871866 }872867···1343132413441325 /*13451326 * If we receive a 4-addr nullfunc frame from a STA13461346- * that was not moved to a 4-addr STA vlan yet, drop13471347- * the frame to the monitor interface, to make sure13481348- * that hostapd sees it13271327+ * that was not moved to a 4-addr STA vlan yet send13281328+ * the event to userspace and for older hostapd drop13291329+ * the frame to the monitor interface.13491330 */13501331 if (ieee80211_has_a4(hdr->frame_control) &&13511332 (rx->sdata->vif.type == NL80211_IFTYPE_AP ||13521333 (rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&13531353- !rx->sdata->u.vlan.sta)))13341334+ !rx->sdata->u.vlan.sta))) {13351335+ if (!test_and_set_sta_flag(sta, WLAN_STA_4ADDR_EVENT))13361336+ cfg80211_rx_unexpected_4addr_frame(13371337+ rx->sdata->dev, sta->sta.addr,13381338+ GFP_ATOMIC);13541339 return RX_DROP_MONITOR;13401340+ }13551341 /*13561342 * Update counter and free packet here to avoid13571343 * counting this as a dropped packed.···19541930 compare_ether_addr(sdata->vif.addr, hdr->addr3) == 0)19551931 return RX_CONTINUE;1956193219331933+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb));19571934 mesh_hdr->ttl--;1958193519591936 if (status->rx_flags & IEEE80211_RX_RA_MATCH) {···19791954 memset(info, 0, sizeof(*info));19801955 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;19811956 info->control.vif = &rx->sdata->vif;19571957+ info->control.jiffies = jiffies;19821958 if (is_multicast_ether_addr(fwd_hdr->addr1)) {19831959 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh,19841960 fwded_mcast);19851985- skb_set_queue_mapping(fwd_skb,19861986- ieee80211_select_queue(sdata, fwd_skb));19871987- ieee80211_set_qos_hdr(sdata, fwd_skb);19881961 } else {19891962 int err;19901963 /*···20342011 return RX_DROP_MONITOR;2035201220362013 /*20372037- * Allow the cooked monitor interface of an AP to see 4-addr frames so20382038- * that a 4-addr station can be detected and moved into a separate VLAN20142014+ * Send unexpected-4addr-frame event to hostapd. For older versions,20152015+ * also drop the frame to cooked monitor interfaces.20392016 */20402017 if (ieee80211_has_a4(hdr->frame_control) &&20412041- sdata->vif.type == NL80211_IFTYPE_AP)20182018+ sdata->vif.type == NL80211_IFTYPE_AP) {20192019+ if (rx->sta &&20202020+ !test_and_set_sta_flag(rx->sta, WLAN_STA_4ADDR_EVENT))20212021+ cfg80211_rx_unexpected_4addr_frame(20222022+ rx->sdata->dev, rx->sta->sta.addr, GFP_ATOMIC);20422023 return RX_DROP_MONITOR;20242024+ }2043202520442026 err = __ieee80211_data_to_8023(rx, &port_control);20452027 if (unlikely(err))···21992171 if (!ieee80211_is_mgmt(mgmt->frame_control))22002172 return RX_DROP_MONITOR;2201217321742174+ if (rx->sdata->vif.type == NL80211_IFTYPE_AP &&21752175+ ieee80211_is_beacon(mgmt->frame_control) &&21762176+ !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) {21772177+ struct ieee80211_rx_status *status;21782178+21792179+ status = IEEE80211_SKB_RXCB(rx->skb);21802180+ cfg80211_report_obss_beacon(rx->local->hw.wiphy,21812181+ rx->skb->data, rx->skb->len,21822182+ status->freq, GFP_ATOMIC);21832183+ rx->flags |= IEEE80211_RX_BEACON_REPORTED;21842184+ }21852185+22022186 if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))22032187 return RX_DROP_MONITOR;22042188···2244220422452205 switch (mgmt->u.action.category) {22462206 case WLAN_CATEGORY_BACK:22472247- /*22482248- * The aggregation code is not prepared to handle22492249- * anything but STA/AP due to the BSSID handling;22502250- * IBSS could work in the code but isn't supported22512251- * by drivers or the standard.22522252- */22532207 if (sdata->vif.type != NL80211_IFTYPE_STATION &&22082208+ sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&22542209 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&22552210 sdata->vif.type != NL80211_IFTYPE_AP)22562211 break;···25242489 if (rx->flags & IEEE80211_RX_CMNTR)25252490 goto out_free_skb;25262491 rx->flags |= IEEE80211_RX_CMNTR;24922492+24932493+ /* If there are no cooked monitor interfaces, just free the SKB */24942494+ if (!local->cooked_mntrs)24952495+ goto out_free_skb;2527249625282497 if (skb_headroom(skb) < sizeof(*rthdr) &&25292498 pskb_expand_head(skb, sizeof(*rthdr), 0, GFP_ATOMIC))
+78-123
net/mac80211/scan.c
···213213 if (bss)214214 ieee80211_rx_bss_put(sdata->local, bss);215215216216- /* If we are on-operating-channel, and this packet is for the217217- * current channel, pass the pkt on up the stack so that218218- * the rest of the stack can make use of it.219219- */220220- if (ieee80211_cfg_on_oper_channel(sdata->local)221221- && (channel == sdata->local->oper_channel))216216+ if (channel == sdata->local->oper_channel)222217 return RX_CONTINUE;223218224219 dev_kfree_skb(skb);···259264 bool was_hw_scan)260265{261266 struct ieee80211_local *local = hw_to_local(hw);262262- bool on_oper_chan;263263- bool enable_beacons = false;264267265268 lockdep_assert_held(&local->mtx);266269···291298 local->scanning = 0;292299 local->scan_channel = NULL;293300294294- on_oper_chan = ieee80211_cfg_on_oper_channel(local);295295-296296- if (was_hw_scan || !on_oper_chan)297297- ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);298298- else299299- /* Set power back to normal operating levels. */300300- ieee80211_hw_config(local, 0);301301+ /* Set power back to normal operating levels. */302302+ ieee80211_hw_config(local, 0);301303302304 if (!was_hw_scan) {303303- bool on_oper_chan2;304305 ieee80211_configure_filter(local);305306 drv_sw_scan_complete(local);306306- on_oper_chan2 = ieee80211_cfg_on_oper_channel(local);307307- /* We should always be on-channel at this point. */308308- WARN_ON(!on_oper_chan2);309309- if (on_oper_chan2 && (on_oper_chan != on_oper_chan2))310310- enable_beacons = true;311311-312312- ieee80211_offchannel_return(local, enable_beacons, true);307307+ ieee80211_offchannel_return(local, true, true);313308 }314309315310 ieee80211_recalc_idle(local);···342361 local->next_scan_state = SCAN_DECISION;343362 local->scan_channel_idx = 0;344363345345- /* We always want to use off-channel PS, even if we346346- * are not really leaving oper-channel. Don't347347- * tell the AP though, as long as we are on-channel.348348- */349349- ieee80211_offchannel_enable_all_ps(local, false);364364+ ieee80211_offchannel_stop_vifs(local, true);350365351366 ieee80211_configure_filter(local);352367···350373 ieee80211_hw_config(local, 0);351374352375 ieee80211_queue_delayed_work(&local->hw,353353- &local->scan_work,354354- IEEE80211_CHANNEL_TIME);376376+ &local->scan_work, 0);355377356378 return 0;357379}···486510487511 next_chan = local->scan_req->channels[local->scan_channel_idx];488512489489- if (ieee80211_cfg_on_oper_channel(local)) {490490- /* We're currently on operating channel. */491491- if (next_chan == local->oper_channel)492492- /* We don't need to move off of operating channel. */493493- local->next_scan_state = SCAN_SET_CHANNEL;494494- else495495- /*496496- * We do need to leave operating channel, as next497497- * scan is somewhere else.498498- */499499- local->next_scan_state = SCAN_LEAVE_OPER_CHANNEL;500500- } else {501501- /*502502- * we're currently scanning a different channel, let's503503- * see if we can scan another channel without interfering504504- * with the current traffic situation.505505- *506506- * Since we don't know if the AP has pending frames for us507507- * we can only check for our tx queues and use the current508508- * pm_qos requirements for rx. Hence, if no tx traffic occurs509509- * at all we will scan as many channels in a row as the pm_qos510510- * latency allows us to. Additionally we also check for the511511- * currently negotiated listen interval to prevent losing512512- * frames unnecessarily.513513- *514514- * Otherwise switch back to the operating channel.515515- */513513+ /*514514+ * we're currently scanning a different channel, let's515515+ * see if we can scan another channel without interfering516516+ * with the current traffic situation.517517+ *518518+ * Since we don't know if the AP has pending frames for us519519+ * we can only check for our tx queues and use the current520520+ * pm_qos requirements for rx. Hence, if no tx traffic occurs521521+ * at all we will scan as many channels in a row as the pm_qos522522+ * latency allows us to. Additionally we also check for the523523+ * currently negotiated listen interval to prevent losing524524+ * frames unnecessarily.525525+ *526526+ * Otherwise switch back to the operating channel.527527+ */516528517517- bad_latency = time_after(jiffies +518518- ieee80211_scan_get_channel_time(next_chan),519519- local->leave_oper_channel_time +520520- usecs_to_jiffies(pm_qos_request(PM_QOS_NETWORK_LATENCY)));529529+ bad_latency = time_after(jiffies +530530+ ieee80211_scan_get_channel_time(next_chan),531531+ local->leave_oper_channel_time +532532+ usecs_to_jiffies(pm_qos_request(PM_QOS_NETWORK_LATENCY)));521533522522- listen_int_exceeded = time_after(jiffies +523523- ieee80211_scan_get_channel_time(next_chan),524524- local->leave_oper_channel_time +525525- usecs_to_jiffies(min_beacon_int * 1024) *526526- local->hw.conf.listen_interval);534534+ listen_int_exceeded = time_after(jiffies +535535+ ieee80211_scan_get_channel_time(next_chan),536536+ local->leave_oper_channel_time +537537+ usecs_to_jiffies(min_beacon_int * 1024) *538538+ local->hw.conf.listen_interval);527539528528- if (associated && ( !tx_empty || bad_latency ||529529- listen_int_exceeded))530530- local->next_scan_state = SCAN_ENTER_OPER_CHANNEL;531531- else532532- local->next_scan_state = SCAN_SET_CHANNEL;533533- }540540+ if (associated && (!tx_empty || bad_latency || listen_int_exceeded))541541+ local->next_scan_state = SCAN_SUSPEND;542542+ else543543+ local->next_scan_state = SCAN_SET_CHANNEL;534544535545 *next_delay = 0;536536-}537537-538538-static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *local,539539- unsigned long *next_delay)540540-{541541- /* PS will already be in off-channel mode,542542- * we do that once at the beginning of scanning.543543- */544544- ieee80211_offchannel_stop_vifs(local, false);545545-546546- /*547547- * What if the nullfunc frames didn't arrive?548548- */549549- drv_flush(local, false);550550- if (local->ops->flush)551551- *next_delay = 0;552552- else553553- *next_delay = HZ / 10;554554-555555- /* remember when we left the operating channel */556556- local->leave_oper_channel_time = jiffies;557557-558558- /* advance to the next channel to be scanned */559559- local->next_scan_state = SCAN_SET_CHANNEL;560560-}561561-562562-static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *local,563563- unsigned long *next_delay)564564-{565565- /* switch back to the operating channel */566566- local->scan_channel = NULL;567567- if (!ieee80211_cfg_on_oper_channel(local))568568- ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);569569-570570- /*571571- * Re-enable vifs and beaconing. Leave PS572572- * in off-channel state..will put that back573573- * on-channel at the end of scanning.574574- */575575- ieee80211_offchannel_return(local, true, false);576576-577577- *next_delay = HZ / 5;578578- local->next_scan_state = SCAN_DECISION;579546}580547581548static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,···532613533614 local->scan_channel = chan;534615535535- /* Only call hw-config if we really need to change channels. */536536- if (chan != local->hw.conf.channel)537537- if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL))538538- skip = 1;616616+ if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL))617617+ skip = 1;539618540619 /* advance state machine to next channel/band */541620 local->scan_channel_idx++;···587670 * on the channel.588671 */589672 *next_delay = IEEE80211_CHANNEL_TIME;673673+ local->next_scan_state = SCAN_DECISION;674674+}675675+676676+static void ieee80211_scan_state_suspend(struct ieee80211_local *local,677677+ unsigned long *next_delay)678678+{679679+ /* switch back to the operating channel */680680+ local->scan_channel = NULL;681681+ ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);682682+683683+ /*684684+ * Re-enable vifs and beaconing. Leave PS685685+ * in off-channel state..will put that back686686+ * on-channel at the end of scanning.687687+ */688688+ ieee80211_offchannel_return(local, true, false);689689+690690+ *next_delay = HZ / 5;691691+ /* afterwards, resume scan & go to next channel */692692+ local->next_scan_state = SCAN_RESUME;693693+}694694+695695+static void ieee80211_scan_state_resume(struct ieee80211_local *local,696696+ unsigned long *next_delay)697697+{698698+ /* PS already is in off-channel mode */699699+ ieee80211_offchannel_stop_vifs(local, false);700700+701701+ if (local->ops->flush) {702702+ drv_flush(local, false);703703+ *next_delay = 0;704704+ } else705705+ *next_delay = HZ / 10;706706+707707+ /* remember when we left the operating channel */708708+ local->leave_oper_channel_time = jiffies;709709+710710+ /* advance to the next channel to be scanned */590711 local->next_scan_state = SCAN_DECISION;591712}592713···698743 case SCAN_SEND_PROBE:699744 ieee80211_scan_state_send_probe(local, &next_delay);700745 break;701701- case SCAN_LEAVE_OPER_CHANNEL:702702- ieee80211_scan_state_leave_oper_channel(local, &next_delay);746746+ case SCAN_SUSPEND:747747+ ieee80211_scan_state_suspend(local, &next_delay);703748 break;704704- case SCAN_ENTER_OPER_CHANNEL:705705- ieee80211_scan_state_enter_oper_channel(local, &next_delay);749749+ case SCAN_RESUME:750750+ ieee80211_scan_state_resume(local, &next_delay);706751 break;707752 }708753 } while (next_delay == 0);
+4-4
net/mac80211/sta_info.c
···13541354 * Use MoreData flag to indicate whether there are13551355 * more buffered frames for this STA13561356 */13571357- if (!more_data)13581358- hdr->frame_control &=13591359- cpu_to_le16(~IEEE80211_FCTL_MOREDATA);13601360- else13571357+ if (more_data || !skb_queue_empty(&frames))13611358 hdr->frame_control |=13621359 cpu_to_le16(IEEE80211_FCTL_MOREDATA);13601360+ else13611361+ hdr->frame_control &=13621362+ cpu_to_le16(~IEEE80211_FCTL_MOREDATA);1363136313641364 if (ieee80211_is_data_qos(hdr->frame_control) ||13651365 ieee80211_is_qos_nullfunc(hdr->frame_control))
+8
net/mac80211/sta_info.h
···5252 * unblocks the station.5353 * @WLAN_STA_SP: Station is in a service period, so don't try to5454 * reply to other uAPSD trigger frames or PS-Poll.5555+ * @WLAN_STA_4ADDR_EVENT: 4-addr event was already sent for this frame.5556 */5657enum ieee80211_sta_info_flags {5758 WLAN_STA_AUTH,···7271 WLAN_STA_TDLS_PEER_AUTH,7372 WLAN_STA_UAPSD,7473 WLAN_STA_SP,7474+ WLAN_STA_4ADDR_EVENT,7575};76767777#define STA_TID_NUM 16···390388 enum ieee80211_sta_info_flags flag)391389{392390 return test_and_clear_bit(flag, &sta->_flags);391391+}392392+393393+static inline int test_and_set_sta_flag(struct sta_info *sta,394394+ enum ieee80211_sta_info_flags flag)395395+{396396+ return test_and_set_bit(flag, &sta->_flags);393397}394398395399void ieee80211_assign_tid_tx(struct sta_info *sta, int tid,
+71-18
net/mac80211/status.c
···517517 }518518519519 if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) {520520- struct ieee80211_work *wk;521520 u64 cookie = (unsigned long)skb;522521523523- rcu_read_lock();524524- list_for_each_entry_rcu(wk, &local->work_list, list) {525525- if (wk->type != IEEE80211_WORK_OFFCHANNEL_TX)526526- continue;527527- if (wk->offchan_tx.frame != skb)528528- continue;529529- wk->offchan_tx.status = true;530530- break;531531- }532532- rcu_read_unlock();533533- if (local->hw_roc_skb_for_status == skb) {534534- cookie = local->hw_roc_cookie ^ 2;535535- local->hw_roc_skb_for_status = NULL;536536- }522522+ if (ieee80211_is_nullfunc(hdr->frame_control) ||523523+ ieee80211_is_qos_nullfunc(hdr->frame_control)) {524524+ bool acked = info->flags & IEEE80211_TX_STAT_ACK;525525+ cfg80211_probe_status(skb->dev, hdr->addr1,526526+ cookie, acked, GFP_ATOMIC);527527+ } else {528528+ struct ieee80211_work *wk;537529538538- cfg80211_mgmt_tx_status(539539- skb->dev, cookie, skb->data, skb->len,540540- !!(info->flags & IEEE80211_TX_STAT_ACK), GFP_ATOMIC);530530+ rcu_read_lock();531531+ list_for_each_entry_rcu(wk, &local->work_list, list) {532532+ if (wk->type != IEEE80211_WORK_OFFCHANNEL_TX)533533+ continue;534534+ if (wk->offchan_tx.frame != skb)535535+ continue;536536+ wk->offchan_tx.status = true;537537+ break;538538+ }539539+ rcu_read_unlock();540540+ if (local->hw_roc_skb_for_status == skb) {541541+ cookie = local->hw_roc_cookie ^ 2;542542+ local->hw_roc_skb_for_status = NULL;543543+ }544544+545545+ cfg80211_mgmt_tx_status(546546+ skb->dev, cookie, skb->data, skb->len,547547+ !!(info->flags & IEEE80211_TX_STAT_ACK),548548+ GFP_ATOMIC);549549+ }550550+ }551551+552552+ if (unlikely(info->ack_frame_id)) {553553+ struct sk_buff *ack_skb;554554+ unsigned long flags;555555+556556+ spin_lock_irqsave(&local->ack_status_lock, flags);557557+ ack_skb = idr_find(&local->ack_status_frames,558558+ info->ack_frame_id);559559+ if (ack_skb)560560+ idr_remove(&local->ack_status_frames,561561+ info->ack_frame_id);562562+ spin_unlock_irqrestore(&local->ack_status_lock, flags);563563+564564+ /* consumes ack_skb */565565+ if (ack_skb)566566+ skb_complete_wifi_ack(ack_skb,567567+ info->flags & IEEE80211_TX_STAT_ACK);541568 }542569543570 /* this was a transmitted frame, but now we want to reuse it */···637610 num_packets, GFP_ATOMIC);638611}639612EXPORT_SYMBOL(ieee80211_report_low_ack);613613+614614+void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb)615615+{616616+ struct ieee80211_local *local = hw_to_local(hw);617617+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);618618+619619+ if (unlikely(info->ack_frame_id)) {620620+ struct sk_buff *ack_skb;621621+ unsigned long flags;622622+623623+ spin_lock_irqsave(&local->ack_status_lock, flags);624624+ ack_skb = idr_find(&local->ack_status_frames,625625+ info->ack_frame_id);626626+ if (ack_skb)627627+ idr_remove(&local->ack_status_frames,628628+ info->ack_frame_id);629629+ spin_unlock_irqrestore(&local->ack_status_lock, flags);630630+631631+ /* consumes ack_skb */632632+ if (ack_skb)633633+ dev_kfree_skb_any(ack_skb);634634+ }635635+636636+ dev_kfree_skb_any(skb);637637+}638638+EXPORT_SYMBOL(ieee80211_free_txskb);
+101-9
net/mac80211/tx.c
···16851685 int nh_pos, h_pos;16861686 struct sta_info *sta = NULL;16871687 bool wme_sta = false, authorized = false, tdls_auth = false;16881688- struct sk_buff *tmp_skb;16891688 bool tdls_direct = false;16891689+ bool multicast;16901690+ u32 info_flags = 0;16911691+ u16 info_id = 0;1690169216911693 if (unlikely(skb->len < ETH_HLEN)) {16921694 ret = NETDEV_TX_OK;···18751873 * if it is a multicast address (which can only happen18761874 * in AP mode)18771875 */18781878- if (!is_multicast_ether_addr(hdr.addr1)) {18761876+ multicast = is_multicast_ether_addr(hdr.addr1);18771877+ if (!multicast) {18791878 rcu_read_lock();18801879 sta = sta_info_get(sdata, hdr.addr1);18811880 if (sta) {···19171914 goto fail;19181915 }1919191619171917+ if (unlikely(!multicast && skb->sk &&19181918+ skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) {19191919+ struct sk_buff *orig_skb = skb;19201920+19211921+ skb = skb_clone(skb, GFP_ATOMIC);19221922+ if (skb) {19231923+ unsigned long flags;19241924+ int id, r;19251925+19261926+ spin_lock_irqsave(&local->ack_status_lock, flags);19271927+ r = idr_get_new_above(&local->ack_status_frames,19281928+ orig_skb, 1, &id);19291929+ if (r == -EAGAIN) {19301930+ idr_pre_get(&local->ack_status_frames,19311931+ GFP_ATOMIC);19321932+ r = idr_get_new_above(&local->ack_status_frames,19331933+ orig_skb, 1, &id);19341934+ }19351935+ if (WARN_ON(!id) || id > 0xffff) {19361936+ idr_remove(&local->ack_status_frames, id);19371937+ r = -ERANGE;19381938+ }19391939+ spin_unlock_irqrestore(&local->ack_status_lock, flags);19401940+19411941+ if (!r) {19421942+ info_id = id;19431943+ info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;19441944+ } else if (skb_shared(skb)) {19451945+ kfree_skb(orig_skb);19461946+ } else {19471947+ kfree_skb(skb);19481948+ skb = orig_skb;19491949+ }19501950+ } else {19511951+ /* couldn't clone -- lose tx status ... */19521952+ skb = orig_skb;19531953+ }19541954+ }19551955+19201956 /*19211957 * If the skb is shared we need to obtain our own copy.19221958 */19231959 if (skb_shared(skb)) {19241924- tmp_skb = skb;19601960+ struct sk_buff *tmp_skb = skb;19611961+19621962+ /* can't happen -- skb is a clone if info_id != 0 */19631963+ WARN_ON(info_id);19641964+19251965 skb = skb_clone(skb, GFP_ATOMIC);19261966 kfree_skb(tmp_skb);19271967···20652019 memset(info, 0, sizeof(*info));2066202020672021 dev->trans_start = jiffies;20222022+20232023+ info->flags = info_flags;20242024+ info->ack_frame_id = info_id;20252025+20682026 ieee80211_xmit(sdata, skb);2069202720702028 return NETDEV_TX_OK;···23292279 } else if (ieee80211_vif_is_mesh(&sdata->vif)) {23302280 struct ieee80211_mgmt *mgmt;23312281 u8 *pos;22822282+ int hdr_len = offsetof(struct ieee80211_mgmt, u.beacon) +22832283+ sizeof(mgmt->u.beacon);2332228423332285#ifdef CONFIG_MAC80211_MESH23342286 if (!sdata->u.mesh.mesh_id_len)23352287 goto out;23362288#endif2337228923382338- /* headroom, head length, tail length and maximum TIM length */23392339- skb = dev_alloc_skb(local->tx_headroom + 400 +23402340- sdata->u.mesh.ie_len);22902290+ skb = dev_alloc_skb(local->tx_headroom +22912291+ hdr_len +22922292+ 2 + /* NULL SSID */22932293+ 2 + 8 + /* supported rates */22942294+ 2 + 3 + /* DS params */22952295+ 2 + (IEEE80211_MAX_SUPP_RATES - 8) +22962296+ 2 + sizeof(struct ieee80211_ht_cap) +22972297+ 2 + sizeof(struct ieee80211_ht_info) +22982298+ 2 + sdata->u.mesh.mesh_id_len +22992299+ 2 + sizeof(struct ieee80211_meshconf_ie) +23002300+ sdata->u.mesh.ie_len);23412301 if (!skb)23422302 goto out;2343230323442304 skb_reserve(skb, local->hw.extra_tx_headroom);23452345- mgmt = (struct ieee80211_mgmt *)23462346- skb_put(skb, 24 + sizeof(mgmt->u.beacon));23472347- memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon));23052305+ mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);23062306+ memset(mgmt, 0, hdr_len);23482307 mgmt->frame_control =23492308 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);23502309 memset(mgmt->da, 0xff, ETH_ALEN);···23722313 mesh_add_ds_params_ie(skb, sdata) ||23732314 ieee80211_add_ext_srates_ie(&sdata->vif, skb) ||23742315 mesh_add_rsn_ie(skb, sdata) ||23162316+ mesh_add_ht_cap_ie(skb, sdata) ||23172317+ mesh_add_ht_info_ie(skb, sdata) ||23752318 mesh_add_meshid_ie(skb, sdata) ||23762319 mesh_add_meshconf_ie(skb, sdata) ||23772320 mesh_add_vendor_ies(skb, sdata)) {···24152354 return skb;24162355}24172356EXPORT_SYMBOL(ieee80211_beacon_get_tim);23572357+23582358+struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,23592359+ struct ieee80211_vif *vif)23602360+{23612361+ struct ieee80211_if_ap *ap = NULL;23622362+ struct sk_buff *presp = NULL, *skb = NULL;23632363+ struct ieee80211_hdr *hdr;23642364+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);23652365+23662366+ if (sdata->vif.type != NL80211_IFTYPE_AP)23672367+ return NULL;23682368+23692369+ rcu_read_lock();23702370+23712371+ ap = &sdata->u.ap;23722372+ presp = rcu_dereference(ap->probe_resp);23732373+ if (!presp)23742374+ goto out;23752375+23762376+ skb = skb_copy(presp, GFP_ATOMIC);23772377+ if (!skb)23782378+ goto out;23792379+23802380+ hdr = (struct ieee80211_hdr *) skb->data;23812381+ memset(hdr->addr1, 0, sizeof(hdr->addr1));23822382+23832383+out:23842384+ rcu_read_unlock();23852385+ return skb;23862386+}23872387+EXPORT_SYMBOL(ieee80211_proberesp_get);2418238824192389struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,24202390 struct ieee80211_vif *vif)
+106-20
net/mac80211/util.c
···812812 offset = noffset;813813 }814814815815- if (sband->ht_cap.ht_supported) {816816- u16 cap = sband->ht_cap.cap;817817- __le16 tmp;818818-819819- *pos++ = WLAN_EID_HT_CAPABILITY;820820- *pos++ = sizeof(struct ieee80211_ht_cap);821821- memset(pos, 0, sizeof(struct ieee80211_ht_cap));822822- tmp = cpu_to_le16(cap);823823- memcpy(pos, &tmp, sizeof(u16));824824- pos += sizeof(u16);825825- *pos++ = sband->ht_cap.ampdu_factor |826826- (sband->ht_cap.ampdu_density <<827827- IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);828828- memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));829829- pos += sizeof(sband->ht_cap.mcs);830830- pos += 2 + 4 + 1; /* ext info, BF cap, antsel */831831- }815815+ if (sband->ht_cap.ht_supported)816816+ pos = ieee80211_ie_build_ht_cap(pos, sband, sband->ht_cap.cap);832817833818 /*834819 * If adding more here, adjust code in main.c···10071022 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&10081023 sdata->vif.type != NL80211_IFTYPE_MONITOR &&10091024 ieee80211_sdata_running(sdata))10101010- res = drv_add_interface(local, &sdata->vif);10251025+ res = drv_add_interface(local, sdata);10111026 }1012102710131028 /* add STAs back */···10581073 BSS_CHANGED_BEACON_INT |10591074 BSS_CHANGED_BSSID |10601075 BSS_CHANGED_CQM |10611061- BSS_CHANGED_QOS;10761076+ BSS_CHANGED_QOS |10771077+ BSS_CHANGED_IDLE;1062107810631079 switch (sdata->vif.type) {10641080 case NL80211_IFTYPE_STATION:···10721086 changed |= BSS_CHANGED_IBSS;10731087 /* fall through */10741088 case NL80211_IFTYPE_AP:10751075- changed |= BSS_CHANGED_SSID;10891089+ changed |= BSS_CHANGED_SSID |10901090+ BSS_CHANGED_AP_PROBE_RESP;10761091 /* fall through */10771092 case NL80211_IFTYPE_MESH_POINT:10781093 changed |= BSS_CHANGED_BEACON |···10941107 break;10951108 }10961109 }11101110+11111111+ ieee80211_recalc_ps(local, -1);1097111210981113 /*10991114 * Clear the WLAN_STA_BLOCK_BA flag so new aggregation···13511362 _ieee80211_enable_rssi_reports(sdata, 0, 0);13521363}13531364EXPORT_SYMBOL(ieee80211_disable_rssi_reports);13651365+13661366+u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_supported_band *sband,13671367+ u16 cap)13681368+{13691369+ __le16 tmp;13701370+13711371+ *pos++ = WLAN_EID_HT_CAPABILITY;13721372+ *pos++ = sizeof(struct ieee80211_ht_cap);13731373+ memset(pos, 0, sizeof(struct ieee80211_ht_cap));13741374+13751375+ /* capability flags */13761376+ tmp = cpu_to_le16(cap);13771377+ memcpy(pos, &tmp, sizeof(u16));13781378+ pos += sizeof(u16);13791379+13801380+ /* AMPDU parameters */13811381+ *pos++ = sband->ht_cap.ampdu_factor |13821382+ (sband->ht_cap.ampdu_density <<13831383+ IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);13841384+13851385+ /* MCS set */13861386+ memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));13871387+ pos += sizeof(sband->ht_cap.mcs);13881388+13891389+ /* extended capabilities */13901390+ pos += sizeof(__le16);13911391+13921392+ /* BF capabilities */13931393+ pos += sizeof(__le32);13941394+13951395+ /* antenna selection */13961396+ pos += sizeof(u8);13971397+13981398+ return pos;13991399+}14001400+14011401+u8 *ieee80211_ie_build_ht_info(u8 *pos,14021402+ struct ieee80211_sta_ht_cap *ht_cap,14031403+ struct ieee80211_channel *channel,14041404+ enum nl80211_channel_type channel_type)14051405+{14061406+ struct ieee80211_ht_info *ht_info;14071407+ /* Build HT Information */14081408+ *pos++ = WLAN_EID_HT_INFORMATION;14091409+ *pos++ = sizeof(struct ieee80211_ht_info);14101410+ ht_info = (struct ieee80211_ht_info *)pos;14111411+ ht_info->control_chan =14121412+ ieee80211_frequency_to_channel(channel->center_freq);14131413+ switch (channel_type) {14141414+ case NL80211_CHAN_HT40MINUS:14151415+ ht_info->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW;14161416+ break;14171417+ case NL80211_CHAN_HT40PLUS:14181418+ ht_info->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE;14191419+ break;14201420+ case NL80211_CHAN_HT20:14211421+ default:14221422+ ht_info->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE;14231423+ break;14241424+ }14251425+ if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)14261426+ ht_info->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY;14271427+ ht_info->operation_mode = 0x0000;14281428+ ht_info->stbc_param = 0x0000;14291429+14301430+ /* It seems that Basic MCS set and Supported MCS set14311431+ are identical for the first 10 bytes */14321432+ memset(&ht_info->basic_set, 0, 16);14331433+ memcpy(&ht_info->basic_set, &ht_cap->mcs, 10);14341434+14351435+ return pos + sizeof(struct ieee80211_ht_info);14361436+}14371437+14381438+enum nl80211_channel_type14391439+ieee80211_ht_info_to_channel_type(struct ieee80211_ht_info *ht_info)14401440+{14411441+ enum nl80211_channel_type channel_type;14421442+14431443+ if (!ht_info)14441444+ return NL80211_CHAN_NO_HT;14451445+14461446+ switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {14471447+ case IEEE80211_HT_PARAM_CHA_SEC_NONE:14481448+ channel_type = NL80211_CHAN_HT20;14491449+ break;14501450+ case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:14511451+ channel_type = NL80211_CHAN_HT40PLUS;14521452+ break;14531453+ case IEEE80211_HT_PARAM_CHA_SEC_BELOW:14541454+ channel_type = NL80211_CHAN_HT40MINUS;14551455+ break;14561456+ default:14571457+ channel_type = NL80211_CHAN_NO_HT;14581458+ }14591459+14601460+ return channel_type;14611461+}1354146213551463int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb)13561464{
+7-3
net/mac80211/wme.c
···8383 break;8484#ifdef CONFIG_MAC80211_MESH8585 case NL80211_IFTYPE_MESH_POINT:8686- ra = skb->data;8686+ qos = true;8787 break;8888#endif8989 case NL80211_IFTYPE_STATION:···143143 /* Fill in the QoS header if there is one. */144144 if (ieee80211_is_data_qos(hdr->frame_control)) {145145 u8 *p = ieee80211_get_qos_ctl(hdr);146146- u8 ack_policy = 0, tid;146146+ u8 ack_policy, tid;147147148148 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;149149150150- if (unlikely(sdata->local->wifi_wme_noack_test))150150+ /* preserve EOSP bit */151151+ ack_policy = *p & IEEE80211_QOS_CTL_EOSP;152152+153153+ if (unlikely(sdata->local->wifi_wme_noack_test) ||154154+ is_multicast_ether_addr(hdr->addr1))151155 ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;152156 /* qos header is 2 bytes */153157 *p++ = ack_policy | tid;
+4-42
net/mac80211/work.c
···103103 u8 *pos;104104 u32 flags = channel->flags;105105 u16 cap = sband->ht_cap.cap;106106- __le16 tmp;107106108107 if (!sband->ht_cap.ht_supported)109108 return;···153154 }154155155156 /* reserve and fill IE */156156-157157 pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2);158158- *pos++ = WLAN_EID_HT_CAPABILITY;159159- *pos++ = sizeof(struct ieee80211_ht_cap);160160- memset(pos, 0, sizeof(struct ieee80211_ht_cap));161161-162162- /* capability flags */163163- tmp = cpu_to_le16(cap);164164- memcpy(pos, &tmp, sizeof(u16));165165- pos += sizeof(u16);166166-167167- /* AMPDU parameters */168168- *pos++ = sband->ht_cap.ampdu_factor |169169- (sband->ht_cap.ampdu_density <<170170- IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);171171-172172- /* MCS set */173173- memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));174174- pos += sizeof(sband->ht_cap.mcs);175175-176176- /* extended capabilities */177177- pos += sizeof(__le16);178178-179179- /* BF capabilities */180180- pos += sizeof(__le32);181181-182182- /* antenna selection */183183- pos += sizeof(u8);158158+ ieee80211_ie_build_ht_cap(pos, sband, cap);184159}185160186161static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,···942969 }943970944971 if (!started && !local->tmp_channel) {945945- bool on_oper_chan;946946- bool tmp_chan_changed = false;947947- bool on_oper_chan2;972972+ bool on_oper_chan, on_oper_chan2;948973 enum nl80211_channel_type wk_ct;974974+949975 on_oper_chan = ieee80211_cfg_on_oper_channel(local);950976951977 /* Work with existing channel type if possible. */···952980 if (wk->chan == local->hw.conf.channel)953981 wk_ct = ieee80211_calc_ct(wk->chan_type,954982 local->hw.conf.channel_type);955955-956956- if (local->tmp_channel)957957- if ((local->tmp_channel != wk->chan) ||958958- (local->tmp_channel_type != wk_ct))959959- tmp_chan_changed = true;960983961984 local->tmp_channel = wk->chan;962985 local->tmp_channel_type = wk_ct;···9751008 true,9761009 false);9771010 }978978- } else if (tmp_chan_changed)979979- /* Still off-channel, but on some other980980- * channel, so update hardware.981981- * PS should already be off-channel.982982- */983983- ieee80211_hw_config(local, 0);10111011+ }98410129851013 started = true;9861014 wk->timeout = jiffies;
+8-1
net/mac80211/wpa.c
···390390 u8 scratch[6 * AES_BLOCK_SIZE];391391392392 if (info->control.hw_key &&393393- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {393393+ !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&394394+ !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {394395 /*395396 * hwaccel has no need for preallocated room for CCMP396397 * header or MIC fields···413412414413 pos = skb_push(skb, CCMP_HDR_LEN);415414 memmove(pos, pos + CCMP_HDR_LEN, hdrlen);415415+416416+ /* the HW only needs room for the IV, but not the actual IV */417417+ if (info->control.hw_key &&418418+ (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))419419+ return 0;420420+416421 hdr = (struct ieee80211_hdr *) pos;417422 pos += hdrlen;418423
+9-9
net/nfc/nci/core.c
···126126127127static void nci_reset_req(struct nci_dev *ndev, unsigned long opt)128128{129129- nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 0, NULL);129129+ struct nci_core_reset_cmd cmd;130130+131131+ cmd.reset_type = NCI_RESET_TYPE_RESET_CONFIG;132132+ nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 1, &cmd);130133}131134132135static void nci_init_req(struct nci_dev *ndev, unsigned long opt)···139136140137static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt)141138{142142- struct nci_core_conn_create_cmd conn_cmd;143139 struct nci_rf_disc_map_cmd cmd;144140 struct disc_map_config *cfg = cmd.mapping_configs;145141 __u8 *num = &cmd.num_mapping_configs;146142 int i;147147-148148- /* create static rf connection */149149- conn_cmd.target_handle = 0;150150- conn_cmd.num_target_specific_params = 0;151151- nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd);152143153144 /* set rf mapping configurations */154145 *num = 0;···467470 ndev->data_exchange_cb = cb;468471 ndev->data_exchange_cb_context = cb_context;469472470470- rc = nci_send_data(ndev, ndev->conn_id, skb);473473+ rc = nci_send_data(ndev, NCI_STATIC_RF_CONN_ID, skb);471474 if (rc)472475 clear_bit(NCI_DATA_EXCHANGE, &ndev->flags);473476···723726 if (!skb)724727 return;725728726726- atomic_dec(&ndev->credits_cnt);729729+ /* Check if data flow control is used */730730+ if (atomic_read(&ndev->credits_cnt) !=731731+ NCI_DATA_FLOW_CONTROL_NOT_USED)732732+ atomic_dec(&ndev->credits_cnt);727733728734 nfc_dbg("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d",729735 nci_pbf(skb->data),
+3-2
net/nfc/nci/data.c
···9595 __skb_queue_head_init(&frags_q);96969797 while (total_len) {9898- frag_len = min_t(int, total_len, ndev->max_pkt_payload_size);9898+ frag_len =9999+ min_t(int, total_len, ndev->max_data_pkt_payload_size);99100100101 skb_frag = nci_skb_alloc(ndev,101102 (NCI_DATA_HDR_SIZE + frag_len),···152151 nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len);153152154153 /* check if the packet need to be fragmented */155155- if (skb->len <= ndev->max_pkt_payload_size) {154154+ if (skb->len <= ndev->max_data_pkt_payload_size) {156155 /* no need to fragment packet */157156 nci_push_data_hdr(ndev, conn_id, skb, NCI_PBF_LAST);158157
+1-7
net/nfc/nci/lib.c
···4242 case NCI_STATUS_REJECTED:4343 return -EBUSY;44444545- case NCI_STATUS_MESSAGE_CORRUPTED:4545+ case NCI_STATUS_RF_FRAME_CORRUPTED:4646 return -EBADMSG;4747-4848- case NCI_STATUS_BUFFER_FULL:4949- return -ENOBUFS;50475148 case NCI_STATUS_NOT_INITIALIZED:5249 return -EHOSTDOWN;···7679 case NCI_STATUS_RF_TIMEOUT_ERROR:7780 case NCI_STATUS_NFCEE_TIMEOUT_ERROR:7881 return -ETIMEDOUT;7979-8080- case NCI_STATUS_RF_LINK_LOSS_ERROR:8181- return -ENOLINK;82828383 case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED:8484 return -EDQUOT;
···259259{260260 const u8 *ie1 = cfg80211_find_ie(num, ies1, len1);261261 const u8 *ie2 = cfg80211_find_ie(num, ies2, len2);262262- int r;263262263263+ /* equal if both missing */264264 if (!ie1 && !ie2)265265 return 0;266266- if (!ie1 || !ie2)266266+ /* sort missing IE before (left of) present IE */267267+ if (!ie1)267268 return -1;269269+ if (!ie2)270270+ return 1;268271269269- r = memcmp(ie1 + 2, ie2 + 2, min(ie1[1], ie2[1]));270270- if (r == 0 && ie1[1] != ie2[1])272272+ /* sort by length first, then by contents */273273+ if (ie1[1] != ie2[1])271274 return ie2[1] - ie1[1];272272- return r;275275+ return memcmp(ie1 + 2, ie2 + 2, ie1[1]);273276}274277275278static bool is_bss(struct cfg80211_bss *a,···355352 sizeof(struct ieee80211_meshconf_ie) - 2) == 0;356353}357354358358-static int cmp_bss(struct cfg80211_bss *a,359359- struct cfg80211_bss *b)355355+static int cmp_bss_core(struct cfg80211_bss *a,356356+ struct cfg80211_bss *b)360357{361358 int r;362359···378375 b->len_information_elements);379376 }380377381381- r = memcmp(a->bssid, b->bssid, ETH_ALEN);378378+ return memcmp(a->bssid, b->bssid, ETH_ALEN);379379+}380380+381381+static int cmp_bss(struct cfg80211_bss *a,382382+ struct cfg80211_bss *b)383383+{384384+ int r;385385+386386+ r = cmp_bss_core(a, b);382387 if (r)383388 return r;384389···395384 a->len_information_elements,396385 b->information_elements,397386 b->len_information_elements);387387+}388388+389389+static int cmp_hidden_bss(struct cfg80211_bss *a,390390+ struct cfg80211_bss *b)391391+{392392+ const u8 *ie1;393393+ const u8 *ie2;394394+ int i;395395+ int r;396396+397397+ r = cmp_bss_core(a, b);398398+ if (r)399399+ return r;400400+401401+ ie1 = cfg80211_find_ie(WLAN_EID_SSID,402402+ a->information_elements,403403+ a->len_information_elements);404404+ ie2 = cfg80211_find_ie(WLAN_EID_SSID,405405+ b->information_elements,406406+ b->len_information_elements);407407+408408+ /* Key comparator must use same algorithm in any rb-tree409409+ * search function (order is important), otherwise ordering410410+ * of items in the tree is broken and search gives incorrect411411+ * results. This code uses same order as cmp_ies() does. */412412+413413+ /* sort missing IE before (left of) present IE */414414+ if (!ie1)415415+ return -1;416416+ if (!ie2)417417+ return 1;418418+419419+ /* zero-size SSID is used as an indication of the hidden bss */420420+ if (!ie2[1])421421+ return 0;422422+423423+ /* sort by length first, then by contents */424424+ if (ie1[1] != ie2[1])425425+ return ie2[1] - ie1[1];426426+427427+ /* zeroed SSID ie is another indication of a hidden bss */428428+ for (i = 0; i < ie2[1]; i++)429429+ if (ie2[i + 2])430430+ return -1;431431+432432+ return 0;398433}399434400435struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,···559502}560503561504static struct cfg80211_internal_bss *505505+rb_find_hidden_bss(struct cfg80211_registered_device *dev,506506+ struct cfg80211_internal_bss *res)507507+{508508+ struct rb_node *n = dev->bss_tree.rb_node;509509+ struct cfg80211_internal_bss *bss;510510+ int r;511511+512512+ while (n) {513513+ bss = rb_entry(n, struct cfg80211_internal_bss, rbn);514514+ r = cmp_hidden_bss(&res->pub, &bss->pub);515515+516516+ if (r == 0)517517+ return bss;518518+ else if (r < 0)519519+ n = n->rb_left;520520+ else521521+ n = n->rb_right;522522+ }523523+524524+ return NULL;525525+}526526+527527+static void528528+copy_hidden_ies(struct cfg80211_internal_bss *res,529529+ struct cfg80211_internal_bss *hidden)530530+{531531+ if (unlikely(res->pub.beacon_ies))532532+ return;533533+ if (WARN_ON(!hidden->pub.beacon_ies))534534+ return;535535+536536+ res->pub.beacon_ies = kmalloc(hidden->pub.len_beacon_ies, GFP_ATOMIC);537537+ if (unlikely(!res->pub.beacon_ies))538538+ return;539539+540540+ res->beacon_ies_allocated = true;541541+ res->pub.len_beacon_ies = hidden->pub.len_beacon_ies;542542+ memcpy(res->pub.beacon_ies, hidden->pub.beacon_ies,543543+ res->pub.len_beacon_ies);544544+}545545+546546+static struct cfg80211_internal_bss *562547cfg80211_bss_update(struct cfg80211_registered_device *dev,563548 struct cfg80211_internal_bss *res)564549{···703604704605 kref_put(&res->ref, bss_release);705606 } else {607607+ struct cfg80211_internal_bss *hidden;608608+609609+ /* First check if the beacon is a probe response from610610+ * a hidden bss. If so, copy beacon ies (with nullified611611+ * ssid) into the probe response bss entry (with real ssid).612612+ * It is required basically for PSM implementation613613+ * (probe responses do not contain tim ie) */614614+615615+ /* TODO: The code is not trying to update existing probe616616+ * response bss entries when beacon ies are617617+ * getting changed. */618618+ hidden = rb_find_hidden_bss(dev, res);619619+ if (hidden)620620+ copy_hidden_ies(res, hidden);621621+706622 /* this "consumes" the reference */707623 list_add_tail(&res->list, &dev->bss_list);708624 rb_insert_bss(dev, res);