Merge ath-next from ath.git
authorKalle Valo <kvalo@codeaurora.org>
Tue, 26 Apr 2016 11:13:59 +0000 (14:13 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 26 Apr 2016 11:13:59 +0000 (14:13 +0300)
ath.git patches for 4.7. Major changes:

ath10k

* implement set_tsf() for 10.2.4 branch
* remove rare MSI range support
* remove deprecated firmware API 1 support

ath9k

* add module parameter to invert LED polarity

wcn36xx

* fixes to get the driver properly working on Dragonboard 410c

370 files changed:
Documentation/DocBook/80211.tmpl
Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt [new file with mode: 0644]
Documentation/networking/dsa/bcm_sf2.txt
Documentation/networking/dsa/dsa.txt
Documentation/networking/ip-sysctl.txt
MAINTAINERS
drivers/bluetooth/hci_bcm.c
drivers/bluetooth/hci_bcsp.c
drivers/bluetooth/hci_ldisc.c
drivers/bluetooth/hci_uart.h
drivers/bluetooth/hci_vhci.c
drivers/net/dsa/bcm_sf2.c
drivers/net/dsa/mv88e6060.c
drivers/net/dsa/mv88e6060.h
drivers/net/dsa/mv88e6123.c
drivers/net/dsa/mv88e6131.c
drivers/net/dsa/mv88e6171.c
drivers/net/dsa/mv88e6352.c
drivers/net/dsa/mv88e6xxx.c
drivers/net/dsa/mv88e6xxx.h
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/jme.c
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/mediatek/mtk_eth_soc.h
drivers/net/ethernet/qlogic/qed/qed.h
drivers/net/ethernet/qlogic/qed/qed_l2.c
drivers/net/ethernet/qlogic/qed/qed_main.c
drivers/net/ethernet/qlogic/qede/qede.h
drivers/net/ethernet/qlogic/qede/qede_ethtool.c
drivers/net/ethernet/qlogic/qede/qede_main.c
drivers/net/ethernet/renesas/ravb.h
drivers/net/ethernet/renesas/ravb_main.c
drivers/net/ethernet/renesas/ravb_ptp.c
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
drivers/net/ethernet/ti/cpsw.c
drivers/net/fjes/fjes_main.c
drivers/net/ieee802154/adf7242.c
drivers/net/phy/mdio-mux.c
drivers/net/phy/mdio_bus.c
drivers/net/vxlan.c
drivers/net/wireless/admtek/adm8211.c
drivers/net/wireless/ath/ar5523/ar5523.c
drivers/net/wireless/ath/ath.h
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/htt_rx.c
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/ath/ath10k/wmi.c
drivers/net/wireless/ath/ath5k/ani.c
drivers/net/wireless/ath/ath5k/ath5k.h
drivers/net/wireless/ath/ath5k/attach.c
drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath5k/debug.c
drivers/net/wireless/ath/ath5k/pcu.c
drivers/net/wireless/ath/ath5k/phy.c
drivers/net/wireless/ath/ath5k/qcu.c
drivers/net/wireless/ath/ath5k/reset.c
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/ath6kl/core.h
drivers/net/wireless/ath/ath6kl/wmi.c
drivers/net/wireless/ath/ath6kl/wmi.h
drivers/net/wireless/ath/ath9k/calib.c
drivers/net/wireless/ath/ath9k/channel.c
drivers/net/wireless/ath/ath9k/common-init.c
drivers/net/wireless/ath/ath9k/common.c
drivers/net/wireless/ath/ath9k/debug_sta.c
drivers/net/wireless/ath/ath9k/dynack.c
drivers/net/wireless/ath/ath9k/htc_drv_init.c
drivers/net/wireless/ath/ath9k/htc_drv_main.c
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/xmit.c
drivers/net/wireless/ath/carl9170/mac.c
drivers/net/wireless/ath/carl9170/main.c
drivers/net/wireless/ath/carl9170/phy.c
drivers/net/wireless/ath/carl9170/rx.c
drivers/net/wireless/ath/carl9170/tx.c
drivers/net/wireless/ath/regd.c
drivers/net/wireless/ath/regd.h
drivers/net/wireless/ath/wcn36xx/main.c
drivers/net/wireless/ath/wcn36xx/smd.c
drivers/net/wireless/ath/wcn36xx/txrx.c
drivers/net/wireless/ath/wil6210/cfg80211.c
drivers/net/wireless/ath/wil6210/netdev.c
drivers/net/wireless/ath/wil6210/wmi.c
drivers/net/wireless/atmel/at76c50x-usb.c
drivers/net/wireless/atmel/atmel.c
drivers/net/wireless/broadcom/b43/b43.h
drivers/net/wireless/broadcom/b43/main.c
drivers/net/wireless/broadcom/b43/phy_ac.c
drivers/net/wireless/broadcom/b43/phy_common.c
drivers/net/wireless/broadcom/b43/phy_ht.c
drivers/net/wireless/broadcom/b43/phy_lcn.c
drivers/net/wireless/broadcom/b43/phy_lp.c
drivers/net/wireless/broadcom/b43/phy_n.c
drivers/net/wireless/broadcom/b43/tables_lpphy.c
drivers/net/wireless/broadcom/b43/tables_nphy.c
drivers/net/wireless/broadcom/b43/tables_phy_lcn.c
drivers/net/wireless/broadcom/b43/xmit.c
drivers/net/wireless/broadcom/b43legacy/main.c
drivers/net/wireless/broadcom/b43legacy/xmit.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c
drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c
drivers/net/wireless/cisco/airo.c
drivers/net/wireless/intel/ipw2x00/ipw2100.c
drivers/net/wireless/intel/ipw2x00/ipw2200.c
drivers/net/wireless/intel/iwlegacy/3945-mac.c
drivers/net/wireless/intel/iwlegacy/3945-rs.c
drivers/net/wireless/intel/iwlegacy/3945.c
drivers/net/wireless/intel/iwlegacy/4965-mac.c
drivers/net/wireless/intel/iwlegacy/4965-rs.c
drivers/net/wireless/intel/iwlegacy/4965.c
drivers/net/wireless/intel/iwlegacy/4965.h
drivers/net/wireless/intel/iwlegacy/common.c
drivers/net/wireless/intel/iwlegacy/common.h
drivers/net/wireless/intel/iwlegacy/debug.c
drivers/net/wireless/intel/iwlwifi/dvm/agn.h
drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
drivers/net/wireless/intel/iwlwifi/dvm/dev.h
drivers/net/wireless/intel/iwlwifi/dvm/devices.c
drivers/net/wireless/intel/iwlwifi/dvm/lib.c
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/dvm/main.c
drivers/net/wireless/intel/iwlwifi/dvm/rs.c
drivers/net/wireless/intel/iwlwifi/dvm/rs.h
drivers/net/wireless/intel/iwlwifi/dvm/rx.c
drivers/net/wireless/intel/iwlwifi/dvm/rxon.c
drivers/net/wireless/intel/iwlwifi/dvm/scan.c
drivers/net/wireless/intel/iwlwifi/dvm/sta.c
drivers/net/wireless/intel/iwlwifi/dvm/tx.c
drivers/net/wireless/intel/iwlwifi/iwl-1000.c
drivers/net/wireless/intel/iwlwifi/iwl-2000.c
drivers/net/wireless/intel/iwlwifi/iwl-5000.c
drivers/net/wireless/intel/iwlwifi/iwl-6000.c
drivers/net/wireless/intel/iwlwifi/iwl-7000.c
drivers/net/wireless/intel/iwlwifi/iwl-8000.c
drivers/net/wireless/intel/iwlwifi/iwl-9000.c
drivers/net/wireless/intel/iwlwifi/iwl-config.h
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c
drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.h
drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
drivers/net/wireless/intel/iwlwifi/mvm/coex.c
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/rs.c
drivers/net/wireless/intel/iwlwifi/mvm/rs.h
drivers/net/wireless/intel/iwlwifi/mvm/rx.c
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c
drivers/net/wireless/intel/iwlwifi/mvm/tx.c
drivers/net/wireless/intel/iwlwifi/mvm/utils.c
drivers/net/wireless/intersil/orinoco/cfg.c
drivers/net/wireless/intersil/orinoco/hw.c
drivers/net/wireless/intersil/orinoco/scan.c
drivers/net/wireless/intersil/p54/eeprom.c
drivers/net/wireless/intersil/p54/main.c
drivers/net/wireless/intersil/p54/p54.h
drivers/net/wireless/intersil/p54/txrx.c
drivers/net/wireless/intersil/prism54/isl_38xx.c
drivers/net/wireless/mac80211_hwsim.c
drivers/net/wireless/marvell/libertas/cfg.c
drivers/net/wireless/marvell/libertas/cmd.c
drivers/net/wireless/marvell/libertas_tf/main.c
drivers/net/wireless/marvell/mwifiex/cfg80211.c
drivers/net/wireless/marvell/mwifiex/cfp.c
drivers/net/wireless/marvell/mwifiex/cmdevt.c
drivers/net/wireless/marvell/mwifiex/main.c
drivers/net/wireless/marvell/mwifiex/main.h
drivers/net/wireless/marvell/mwifiex/pcie.c
drivers/net/wireless/marvell/mwifiex/pcie.h
drivers/net/wireless/marvell/mwifiex/scan.c
drivers/net/wireless/marvell/mwifiex/sdio.c
drivers/net/wireless/marvell/mwifiex/sdio.h
drivers/net/wireless/marvell/mwifiex/sta_cmd.c
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
drivers/net/wireless/marvell/mwifiex/uap_cmd.c
drivers/net/wireless/marvell/mwifiex/usb.c
drivers/net/wireless/marvell/mwl8k.c
drivers/net/wireless/mediatek/mt7601u/init.c
drivers/net/wireless/ralink/rt2x00/rt2800lib.c
drivers/net/wireless/ralink/rt2x00/rt2x00.h
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
drivers/net/wireless/ralink/rt2x00/rt61pci.c
drivers/net/wireless/ralink/rt2x00/rt73usb.c
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h
drivers/net/wireless/realtek/rtlwifi/base.c
drivers/net/wireless/realtek/rtlwifi/regd.c
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
drivers/net/wireless/realtek/rtlwifi/wifi.h
drivers/net/wireless/rndis_wlan.c
drivers/net/wireless/rsi/rsi_91x_mac80211.c
drivers/net/wireless/rsi/rsi_91x_mgmt.c
drivers/net/wireless/rsi/rsi_91x_pkt.c
drivers/net/wireless/rsi/rsi_main.h
drivers/net/wireless/st/cw1200/main.c
drivers/net/wireless/st/cw1200/scan.c
drivers/net/wireless/st/cw1200/sta.c
drivers/net/wireless/st/cw1200/txrx.c
drivers/net/wireless/st/cw1200/wsm.c
drivers/net/wireless/ti/wl1251/main.c
drivers/net/wireless/ti/wl1251/rx.c
drivers/net/wireless/ti/wl12xx/main.c
drivers/net/wireless/ti/wl12xx/scan.c
drivers/net/wireless/ti/wl18xx/cmd.c
drivers/net/wireless/ti/wl18xx/event.c
drivers/net/wireless/ti/wl18xx/main.c
drivers/net/wireless/ti/wl18xx/scan.c
drivers/net/wireless/ti/wl18xx/tx.c
drivers/net/wireless/ti/wlcore/cmd.c
drivers/net/wireless/ti/wlcore/cmd.h
drivers/net/wireless/ti/wlcore/main.c
drivers/net/wireless/ti/wlcore/ps.c
drivers/net/wireless/ti/wlcore/rx.c
drivers/net/wireless/ti/wlcore/rx.h
drivers/net/wireless/ti/wlcore/scan.c
drivers/net/wireless/ti/wlcore/tx.c
drivers/net/wireless/ti/wlcore/tx.h
drivers/net/wireless/ti/wlcore/wlcore.h
drivers/net/wireless/ti/wlcore/wlcore_i.h
drivers/net/wireless/wl3501_cs.c
drivers/net/wireless/zydas/zd1211rw/zd_mac.c
drivers/staging/rtl8723au/core/rtw_mlme_ext.c
drivers/staging/rtl8723au/include/ieee80211.h
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
drivers/staging/vt6655/channel.c
drivers/staging/vt6655/device_main.c
drivers/staging/vt6655/rxtx.c
drivers/staging/vt6656/channel.c
drivers/staging/vt6656/int.c
drivers/staging/vt6656/main_usb.c
drivers/staging/vt6656/rxtx.c
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
drivers/staging/wlan-ng/cfg80211.c
drivers/target/iscsi/iscsi_target_util.c
fs/afs/rxrpc.c
fs/cifs/connect.c
include/linux/mdio.h
include/linux/net.h
include/linux/netdevice.h
include/linux/qed/qed_eth_if.h
include/linux/qed/qed_if.h
include/net/af_rxrpc.h
include/net/cfg80211.h
include/net/dsa.h
include/net/ip_tunnels.h
include/net/mac80211.h
include/net/netfilter/nf_conntrack_ecache.h
include/net/netns/ipv4.h
include/net/sctp/structs.h
include/net/sock.h
include/rxrpc/packet.h
include/uapi/linux/netfilter/nfnetlink_queue.h
include/uapi/linux/nl80211.h
net/6lowpan/iphc.c
net/bluetooth/af_bluetooth.c
net/bluetooth/hci_event.c
net/bluetooth/hci_request.c
net/bluetooth/l2cap_sock.c
net/bridge/br_ioctl.c
net/bridge/br_sysfs_br.c
net/bridge/br_sysfs_if.c
net/bridge/br_vlan.c
net/bridge/netfilter/nf_tables_bridge.c
net/core/dev.c
net/dsa/dsa.c
net/ipv4/fib_semantics.c
net/ipv4/ip_sockglue.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/udp.c
net/ipv6/addrconf.c
net/ipv6/netfilter/ip6t_SYNPROXY.c
net/ipv6/netfilter/nf_reject_ipv6.c
net/llc/llc_proc.c
net/mac80211/cfg.c
net/mac80211/debugfs_netdev.c
net/mac80211/ibss.c
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/main.c
net/mac80211/mesh.c
net/mac80211/mesh_plink.c
net/mac80211/mlme.c
net/mac80211/rate.c
net/mac80211/rc80211_minstrel.c
net/mac80211/rc80211_minstrel_ht.c
net/mac80211/rx.c
net/mac80211/scan.c
net/mac80211/spectmgmt.c
net/mac80211/tdls.c
net/mac80211/trace.h
net/mac80211/tx.c
net/mac80211/util.c
net/mac80211/vht.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_ecache.c
net/netfilter/nfnetlink_queue.c
net/rxrpc/Kconfig
net/rxrpc/Makefile
net/rxrpc/af_rxrpc.c
net/rxrpc/ar-accept.c
net/rxrpc/ar-ack.c
net/rxrpc/ar-call.c
net/rxrpc/ar-connection.c
net/rxrpc/ar-connevent.c
net/rxrpc/ar-input.c
net/rxrpc/ar-internal.h
net/rxrpc/ar-output.c
net/rxrpc/ar-proc.c
net/rxrpc/ar-recvmsg.c
net/rxrpc/ar-security.c
net/rxrpc/insecure.c [new file with mode: 0644]
net/rxrpc/misc.c [new file with mode: 0644]
net/rxrpc/rxkad.c
net/sched/em_meta.c
net/sctp/sm_sideeffect.c
net/sctp/ulpqueue.c
net/socket.c
net/sunrpc/socklib.c
net/sunrpc/svcsock.c
net/sunrpc/xprtsock.c
net/tipc/bearer.h
net/wireless/chan.c
net/wireless/core.c
net/wireless/debugfs.c
net/wireless/ibss.c
net/wireless/mesh.c
net/wireless/mlme.c
net/wireless/nl80211.c
net/wireless/rdev-ops.h
net/wireless/reg.c
net/wireless/reg.h
net/wireless/scan.c
net/wireless/sme.c
net/wireless/trace.h
net/wireless/util.c
net/wireless/wext-compat.c

index f9b9ad7..f2a312b 100644 (file)
@@ -75,7 +75,6 @@
       <chapter>
       <title>Device registration</title>
 !Pinclude/net/cfg80211.h Device registration
-!Finclude/net/cfg80211.h ieee80211_band
 !Finclude/net/cfg80211.h ieee80211_channel_flags
 !Finclude/net/cfg80211.h ieee80211_channel
 !Finclude/net/cfg80211.h ieee80211_rate_flags
diff --git a/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt b/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt
new file mode 100644 (file)
index 0000000..c421aba
--- /dev/null
@@ -0,0 +1,63 @@
+Marvell 8897/8997 (sd8897/sd8997) SDIO devices
+------
+
+This node provides properties for controlling the marvell sdio wireless device.
+The node is expected to be specified as a child node to the SDIO controller that
+connects the device to the system.
+
+Required properties:
+
+  - compatible : should be one of the following:
+       * "marvell,sd8897"
+       * "marvell,sd8997"
+
+Optional properties:
+
+  - marvell,caldata* : A series of properties with marvell,caldata prefix,
+                     represent calibration data downloaded to the device during
+                     initialization. This is an array of unsigned 8-bit values.
+                     the properties should follow below property name and
+                     corresponding array length:
+       "marvell,caldata-txpwrlimit-2g" (length = 566).
+       "marvell,caldata-txpwrlimit-5g-sub0" (length = 502).
+       "marvell,caldata-txpwrlimit-5g-sub1" (length = 688).
+       "marvell,caldata-txpwrlimit-5g-sub2" (length = 750).
+       "marvell,caldata-txpwrlimit-5g-sub3" (length = 502).
+  - marvell,wakeup-pin : a wakeup pin number of wifi chip which will be configured
+                     to firmware. Firmware will wakeup the host using this pin
+                     during suspend/resume.
+  - interrupt-parent: phandle of the parent interrupt controller
+  - interrupts : interrupt pin number to the cpu. driver will request an irq based on
+                this interrupt number. during system suspend, the irq will be enabled
+                so that the wifi chip can wakeup host platform under certain condition.
+                during system resume, the irq will be disabled to make sure
+                unnecessary interrupt is not received.
+
+Example:
+
+Tx power limit calibration data is configured in below example.
+The calibration data is an array of unsigned values, the length
+can vary between hw versions.
+IRQ pin 38 is used as system wakeup source interrupt. wakeup pin 3 is configured
+so that firmware can wakeup host using this device side pin.
+
+&mmc3 {
+       status = "okay";
+       vmmc-supply = <&wlan_en_reg>;
+       bus-width = <4>;
+       cap-power-off-card;
+       keep-power-in-suspend;
+
+       #address-cells = <1>;
+       #size-cells = <0>;
+       mwifiex: wifi@1 {
+               compatible = "marvell,sd8897";
+               reg = <1>;
+               interrupt-parent = <&pio>;
+               interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
+
+               marvell,caldata_00_txpwrlimit_2g_cfg_set = /bits/ 8 <
+       0x01 0x00 0x06 0x00 0x08 0x02 0x89 0x01>;
+               marvell,wakeup-pin = <3>;
+       };
+};
index d999d0c..eba3a24 100644 (file)
@@ -38,7 +38,7 @@ Implementation details
 ======================
 
 The driver is located in drivers/net/dsa/bcm_sf2.c and is implemented as a DSA
-driver; see Documentation/networking/dsa/dsa.txt for details on the subsytem
+driver; see Documentation/networking/dsa/dsa.txt for details on the subsystem
 and what it provides.
 
 The SF2 switch is configured to enable a Broadcom specific 4-bytes switch tag
index ba698c5..631b0f7 100644 (file)
@@ -334,7 +334,7 @@ more specifically with its VLAN filtering portion when configuring VLANs on top
 of per-port slave network devices. Since DSA primarily deals with
 MDIO-connected switches, although not exclusively, SWITCHDEV's
 prepare/abort/commit phases are often simplified into a prepare phase which
-checks whether the operation is supporte by the DSA switch driver, and a commit
+checks whether the operation is supported by the DSA switch driver, and a commit
 phase which applies the changes.
 
 As of today, the only SWITCHDEV objects supported by DSA are the FDB and VLAN
index b183e2b..6c7f365 100644 (file)
@@ -63,6 +63,16 @@ fwmark_reflect - BOOLEAN
        fwmark of the packet they are replying to.
        Default: 0
 
+fib_multipath_use_neigh - BOOLEAN
+       Use status of existing neighbor entry when determining nexthop for
+       multipath routes. If disabled, neighbor information is not used and
+       packets could be directed to a failed nexthop. Only valid for kernels
+       built with CONFIG_IP_ROUTE_MULTIPATH enabled.
+       Default: 0 (disabled)
+       Possible values:
+       0 - disabled
+       1 - enabled
+
 route/max_size - INTEGER
        Maximum number of routes allowed in the kernel.  Increase
        this when using large numbers of interfaces and/or routes.
index 4851f02..6ac970b 100644 (file)
@@ -9490,7 +9490,7 @@ F:        drivers/net/wireless/realtek/rtlwifi/rtl8192ce/
 RTL8XXXU WIRELESS DRIVER (rtl8xxxu)
 M:     Jes Sorensen <Jes.Sorensen@redhat.com>
 L:     linux-wireless@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/jes/linux.git rtl8723au-mac80211
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/jes/linux.git rtl8xxxu-devel
 S:     Maintained
 F:     drivers/net/wireless/realtek/rtl8xxxu/
 
index d8881dc..1c97eda 100644 (file)
@@ -825,6 +825,7 @@ static const struct acpi_device_id bcm_acpi_match[] = {
        { "BCM2E64", 0 },
        { "BCM2E65", 0 },
        { "BCM2E67", 0 },
+       { "BCM2E71", 0 },
        { "BCM2E7B", 0 },
        { "BCM2E7C", 0 },
        { },
index 064f2fe..d7d23ce 100644 (file)
@@ -102,13 +102,12 @@ static const u16 crc_table[] = {
 /* Initialise the crc calculator */
 #define BCSP_CRC_INIT(x) x = 0xffff
 
-/*
-   Update crc with next data byte
-
-   Implementation note
-        The data byte is treated as two nibbles.  The crc is generated
-        in reverse, i.e., bits are fed into the register from the top.
-*/
+/* Update crc with next data byte
+ *
+ * Implementation note
+ *     The data byte is treated as two nibbles.  The crc is generated
+ *     in reverse, i.e., bits are fed into the register from the top.
+ */
 static void bcsp_crc_update(u16 *crc, u8 d)
 {
        u16 reg = *crc;
@@ -223,9 +222,10 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
        }
 
        /* Max len of packet: (original len +4(bcsp hdr) +2(crc))*2
-          (because bytes 0xc0 and 0xdb are escaped, worst case is
-          when the packet is all made of 0xc0 and 0xdb :) )
-          + 2 (0xc0 delimiters at start and end). */
+        * (because bytes 0xc0 and 0xdb are escaped, worst case is
+        * when the packet is all made of 0xc0 and 0xdb :) )
+        * + 2 (0xc0 delimiters at start and end).
+        */
 
        nskb = alloc_skb((len + 6) * 2 + 2, GFP_ATOMIC);
        if (!nskb)
@@ -285,7 +285,7 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
        struct bcsp_struct *bcsp = hu->priv;
        unsigned long flags;
        struct sk_buff *skb;
-       
+
        /* First of all, check for unreliable messages in the queue,
           since they have priority */
 
@@ -305,8 +305,9 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
        }
 
        /* Now, try to send a reliable pkt. We can only send a
-          reliable packet if the number of packets sent but not yet ack'ed
-          is < than the winsize */
+        * reliable packet if the number of packets sent but not yet ack'ed
+        * is < than the winsize
+        */
 
        spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
 
@@ -332,12 +333,14 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
        spin_unlock_irqrestore(&bcsp->unack.lock, flags);
 
        /* We could not send a reliable packet, either because there are
-          none or because there are too many unack'ed pkts. Did we receive
-          any packets we have not acknowledged yet ? */
+        * none or because there are too many unack'ed pkts. Did we receive
+        * any packets we have not acknowledged yet ?
+        */
 
        if (bcsp->txack_req) {
                /* if so, craft an empty ACK pkt and send it on BCSP unreliable
-                  channel 0 */
+                * channel 0
+                */
                struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, NULL, 0, BCSP_ACK_PKT);
                return nskb;
        }
@@ -399,8 +402,9 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
 }
 
 /* Handle BCSP link-establishment packets. When we
-   detect a "sync" packet, symptom that the BT module has reset,
-   we do nothing :) (yet) */
+ * detect a "sync" packet, symptom that the BT module has reset,
+ * we do nothing :) (yet)
+ */
 static void bcsp_handle_le_pkt(struct hci_uart *hu)
 {
        struct bcsp_struct *bcsp = hu->priv;
@@ -462,7 +466,7 @@ static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned char
                case 0xdd:
                        memcpy(skb_put(bcsp->rx_skb, 1), &db, 1);
                        if ((bcsp->rx_skb->data[0] & 0x40) != 0 &&
-                                       bcsp->rx_state != BCSP_W4_CRC) 
+                                       bcsp->rx_state != BCSP_W4_CRC)
                                bcsp_crc_update(&bcsp->message_crc, 0xdb);
                        bcsp->rx_esc_state = BCSP_ESCSTATE_NOESC;
                        bcsp->rx_count--;
@@ -534,7 +538,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
                        } else {
                                BT_ERR("Packet for unknown channel (%u %s)",
                                        bcsp->rx_skb->data[1] & 0x0f,
-                                       bcsp->rx_skb->data[0] & 0x80 ? 
+                                       bcsp->rx_skb->data[0] & 0x80 ?
                                        "reliable" : "unreliable");
                                kfree_skb(bcsp->rx_skb);
                        }
@@ -562,7 +566,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
        struct bcsp_struct *bcsp = hu->priv;
        const unsigned char *ptr;
 
-       BT_DBG("hu %p count %d rx_state %d rx_count %ld", 
+       BT_DBG("hu %p count %d rx_state %d rx_count %ld",
                hu, count, bcsp->rx_state, bcsp->rx_count);
 
        ptr = data;
@@ -591,7 +595,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
                                continue;
                        }
                        if (bcsp->rx_skb->data[0] & 0x80        /* reliable pkt */
-                                       && (bcsp->rx_skb->data[0] & 0x07) != bcsp->rxseq_txack) {
+                                               && (bcsp->rx_skb->data[0] & 0x07) != bcsp->rxseq_txack) {
                                BT_ERR("Out-of-order packet arrived, got %u expected %u",
                                        bcsp->rx_skb->data[0] & 0x07, bcsp->rxseq_txack);
 
@@ -601,7 +605,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
                                continue;
                        }
                        bcsp->rx_state = BCSP_W4_DATA;
-                       bcsp->rx_count = (bcsp->rx_skb->data[1] >> 4) + 
+                       bcsp->rx_count = (bcsp->rx_skb->data[1] >> 4) +
                                        (bcsp->rx_skb->data[2] << 4);   /* May be 0 */
                        continue;
 
@@ -615,7 +619,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
 
                case BCSP_W4_CRC:
                        if (bitrev16(bcsp->message_crc) != bscp_get_crc(bcsp)) {
-                               BT_ERR ("Checksum failed: computed %04x received %04x",
+                               BT_ERR("Checksum failed: computed %04x received %04x",
                                        bitrev16(bcsp->message_crc),
                                        bscp_get_crc(bcsp));
 
@@ -653,8 +657,9 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
                                BCSP_CRC_INIT(bcsp->message_crc);
 
                                /* Do not increment ptr or decrement count
-                                * Allocate packet. Max len of a BCSP pkt= 
-                                * 0xFFF (payload) +4 (header) +2 (crc) */
+                                * Allocate packet. Max len of a BCSP pkt=
+                                * 0xFFF (payload) +4 (header) +2 (crc)
+                                */
 
                                bcsp->rx_skb = bt_skb_alloc(0x1005, GFP_ATOMIC);
                                if (!bcsp->rx_skb) {
index c00168a..49b3e1e 100644 (file)
@@ -227,7 +227,7 @@ static int hci_uart_flush(struct hci_dev *hdev)
        tty_ldisc_flush(tty);
        tty_driver_flush_buffer(tty);
 
-       if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
+       if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
                hu->proto->flush(hu);
 
        return 0;
@@ -492,7 +492,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)
 
        cancel_work_sync(&hu->write_work);
 
-       if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
+       if (test_and_clear_bit(HCI_UART_PROTO_READY, &hu->flags)) {
                if (hdev) {
                        if (test_bit(HCI_UART_REGISTERED, &hu->flags))
                                hci_unregister_dev(hdev);
@@ -500,6 +500,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)
                }
                hu->proto->close(hu);
        }
+       clear_bit(HCI_UART_PROTO_SET, &hu->flags);
 
        kfree(hu);
 }
@@ -526,7 +527,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
        if (tty != hu->tty)
                return;
 
-       if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
+       if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
                hci_uart_tx_wakeup(hu);
 }
 
@@ -550,7 +551,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
        if (!hu || tty != hu->tty)
                return;
 
-       if (!test_bit(HCI_UART_PROTO_SET, &hu->flags))
+       if (!test_bit(HCI_UART_PROTO_READY, &hu->flags))
                return;
 
        /* It does not need a lock here as it is already protected by a mutex in
@@ -638,9 +639,11 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id)
                return err;
 
        hu->proto = p;
+       set_bit(HCI_UART_PROTO_READY, &hu->flags);
 
        err = hci_uart_register_dev(hu);
        if (err) {
+               clear_bit(HCI_UART_PROTO_READY, &hu->flags);
                p->close(hu);
                return err;
        }
index 4814ff0..839bad1 100644 (file)
@@ -95,6 +95,7 @@ struct hci_uart {
 /* HCI_UART proto flag bits */
 #define HCI_UART_PROTO_SET     0
 #define HCI_UART_REGISTERED    1
+#define HCI_UART_PROTO_READY   2
 
 /* TX states  */
 #define HCI_UART_SENDING       1
index 80783dc..f67ea1c 100644 (file)
@@ -189,13 +189,13 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
                break;
 
        case HCI_VENDOR_PKT:
+               cancel_delayed_work_sync(&data->open_timeout);
+
                if (data->hdev) {
                        kfree_skb(skb);
                        return -EBADFD;
                }
 
-               cancel_delayed_work_sync(&data->open_timeout);
-
                opcode = *((__u8 *) skb->data);
                skb_pull(skb, 1);
 
@@ -333,15 +333,18 @@ static int vhci_open(struct inode *inode, struct file *file)
 static int vhci_release(struct inode *inode, struct file *file)
 {
        struct vhci_data *data = file->private_data;
-       struct hci_dev *hdev = data->hdev;
+       struct hci_dev *hdev;
 
        cancel_delayed_work_sync(&data->open_timeout);
 
+       hdev = data->hdev;
+
        if (hdev) {
                hci_unregister_dev(hdev);
                hci_free_dev(hdev);
        }
 
+       skb_queue_purge(&data->readq);
        file->private_data = NULL;
        kfree(data);
 
index 780f228..7a5f0ef 100644 (file)
@@ -135,8 +135,17 @@ static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds)
        return BCM_SF2_STATS_SIZE;
 }
 
-static char *bcm_sf2_sw_probe(struct device *host_dev, int sw_addr)
+static char *bcm_sf2_sw_drv_probe(struct device *dsa_dev,
+                                 struct device *host_dev,
+                                 int sw_addr, void **_priv)
 {
+       struct bcm_sf2_priv *priv;
+
+       priv = devm_kzalloc(dsa_dev, sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return NULL;
+       *_priv = priv;
+
        return "Broadcom Starfighter 2";
 }
 
@@ -151,7 +160,7 @@ static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
         * the same VLAN.
         */
        for (i = 0; i < priv->hw_params.num_ports; i++) {
-               if (!((1 << i) & ds->phys_port_mask))
+               if (!((1 << i) & ds->enabled_port_mask))
                        continue;
 
                reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(i));
@@ -1000,7 +1009,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
        /* Enable all valid ports and disable those unused */
        for (port = 0; port < priv->hw_params.num_ports; port++) {
                /* IMP port receives special treatment */
-               if ((1 << port) & ds->phys_port_mask)
+               if ((1 << port) & ds->enabled_port_mask)
                        bcm_sf2_port_setup(ds, port, NULL);
                else if (dsa_is_cpu_port(ds, port))
                        bcm_sf2_imp_setup(ds, port);
@@ -1013,11 +1022,12 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
         * 7445D0, since 7445E0 disconnects the internal switch pseudo-PHY such
         * that we can use the regular SWITCH_MDIO master controller instead.
         *
-        * By default, DSA initializes ds->phys_mii_mask to ds->phys_port_mask
-        * to have a 1:1 mapping between Port address and PHY address in order
-        * to utilize the slave_mii_bus instance to read from Port PHYs. This is
-        * not what we want here, so we initialize phys_mii_mask 0 to always
-        * utilize the "master" MDIO bus backed by the "mdio-unimac" driver.
+        * By default, DSA initializes ds->phys_mii_mask to
+        * ds->enabled_port_mask to have a 1:1 mapping between Port address
+        * and PHY address in order to utilize the slave_mii_bus instance to
+        * read from Port PHYs. This is not what we want here, so we
+        * initialize phys_mii_mask 0 to always utilize the "master" MDIO
+        * bus backed by the "mdio-unimac" driver.
         */
        if (of_machine_is_compatible("brcm,bcm7445d0"))
                ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0));
@@ -1275,7 +1285,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds)
         * bcm_sf2_sw_setup
         */
        for (port = 0; port < DSA_MAX_PORTS; port++) {
-               if ((1 << port) & ds->phys_port_mask ||
+               if ((1 << port) & ds->enabled_port_mask ||
                    dsa_is_cpu_port(ds, port))
                        bcm_sf2_port_disable(ds, port, NULL);
        }
@@ -1299,7 +1309,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
                bcm_sf2_gphy_enable_set(ds, true);
 
        for (port = 0; port < DSA_MAX_PORTS; port++) {
-               if ((1 << port) & ds->phys_port_mask)
+               if ((1 << port) & ds->enabled_port_mask)
                        bcm_sf2_port_setup(ds, port, NULL);
                else if (dsa_is_cpu_port(ds, port))
                        bcm_sf2_imp_setup(ds, port);
@@ -1362,8 +1372,7 @@ static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,
 
 static struct dsa_switch_driver bcm_sf2_switch_driver = {
        .tag_protocol           = DSA_TAG_PROTO_BRCM,
-       .priv_size              = sizeof(struct bcm_sf2_priv),
-       .probe                  = bcm_sf2_sw_probe,
+       .probe                  = bcm_sf2_sw_drv_probe,
        .setup                  = bcm_sf2_sw_setup,
        .set_addr               = bcm_sf2_sw_set_addr,
        .get_phy_flags          = bcm_sf2_sw_get_phy_flags,
index 0527f48..92cebab 100644 (file)
 
 static int reg_read(struct dsa_switch *ds, int addr, int reg)
 {
-       struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->master_dev);
+       struct mv88e6060_priv *priv = ds_to_priv(ds);
 
-       if (bus == NULL)
-               return -EINVAL;
-
-       return mdiobus_read_nested(bus, ds->pd->sw_addr + addr, reg);
+       return mdiobus_read_nested(priv->bus, priv->sw_addr + addr, reg);
 }
 
 #define REG_READ(addr, reg)                                    \
@@ -40,12 +37,9 @@ static int reg_read(struct dsa_switch *ds, int addr, int reg)
 
 static int reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
 {
-       struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->master_dev);
-
-       if (bus == NULL)
-               return -EINVAL;
+       struct mv88e6060_priv *priv = ds_to_priv(ds);
 
-       return mdiobus_write_nested(bus, ds->pd->sw_addr + addr, reg, val);
+       return mdiobus_write_nested(priv->bus, priv->sw_addr + addr, reg, val);
 }
 
 #define REG_WRITE(addr, reg, val)                              \
@@ -57,14 +51,10 @@ static int reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
                        return __ret;                           \
        })
 
-static char *mv88e6060_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
 {
-       struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev);
        int ret;
 
-       if (bus == NULL)
-               return NULL;
-
        ret = mdiobus_read(bus, sw_addr + REG_PORT(0), PORT_SWITCH_ID);
        if (ret >= 0) {
                if (ret == PORT_SWITCH_ID_6060)
@@ -79,6 +69,27 @@ static char *mv88e6060_probe(struct device *host_dev, int sw_addr)
        return NULL;
 }
 
+static char *mv88e6060_drv_probe(struct device *dsa_dev,
+                                struct device *host_dev,
+                                int sw_addr, void **_priv)
+{
+       struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev);
+       struct mv88e6060_priv *priv;
+       char *name;
+
+       name = mv88e6060_get_name(bus, sw_addr);
+       if (name) {
+               priv = devm_kzalloc(dsa_dev, sizeof(*priv), GFP_KERNEL);
+               if (!priv)
+                       return NULL;
+               *_priv = priv;
+               priv->bus = bus;
+               priv->sw_addr = sw_addr;
+       }
+
+       return name;
+}
+
 static int mv88e6060_switch_reset(struct dsa_switch *ds)
 {
        int i;
@@ -159,7 +170,7 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
        REG_WRITE(addr, PORT_VLAN_MAP,
                  ((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
                   (dsa_is_cpu_port(ds, p) ?
-                       ds->phys_port_mask :
+                       ds->enabled_port_mask :
                        BIT(ds->dst->cpu_port)));
 
        /* Port Association Vector: when learning source addresses
@@ -174,8 +185,8 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
 
 static int mv88e6060_setup(struct dsa_switch *ds)
 {
-       int i;
        int ret;
+       int i;
 
        ret = mv88e6060_switch_reset(ds);
        if (ret < 0)
@@ -238,7 +249,7 @@ mv88e6060_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
 
 static struct dsa_switch_driver mv88e6060_switch_driver = {
        .tag_protocol   = DSA_TAG_PROTO_TRAILER,
-       .probe          = mv88e6060_probe,
+       .probe          = mv88e6060_drv_probe,
        .setup          = mv88e6060_setup,
        .set_addr       = mv88e6060_set_addr,
        .phy_read       = mv88e6060_phy_read,
index cc9b2ed..10249bd 100644 (file)
 #define GLOBAL_ATU_MAC_23      0x0e
 #define GLOBAL_ATU_MAC_45      0x0f
 
+struct mv88e6060_priv {
+       /* MDIO bus and address on bus to use. When in single chip
+        * mode, address is 0, and the switch uses multiple addresses
+        * on the bus.  When in multi-chip mode, the switch uses a
+        * single address which contains two registers used for
+        * indirect access to more registers.
+        */
+       struct mii_bus *bus;
+       int sw_addr;
+};
+
 #endif
index 69a6f79..c34283d 100644 (file)
@@ -29,10 +29,13 @@ static const struct mv88e6xxx_switch_id mv88e6123_table[] = {
        { PORT_SWITCH_ID_6165_A2, "Marvell 88e6165 (A2)" },
 };
 
-static char *mv88e6123_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6123_drv_probe(struct device *dsa_dev,
+                                struct device *host_dev,
+                                int sw_addr, void **priv)
 {
-       return mv88e6xxx_lookup_name(host_dev, sw_addr, mv88e6123_table,
-                                    ARRAY_SIZE(mv88e6123_table));
+       return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv,
+                                  mv88e6123_table,
+                                  ARRAY_SIZE(mv88e6123_table));
 }
 
 static int mv88e6123_setup_global(struct dsa_switch *ds)
@@ -73,6 +76,8 @@ static int mv88e6123_setup(struct dsa_switch *ds)
        struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
        int ret;
 
+       ps->ds = ds;
+
        ret = mv88e6xxx_setup_common(ds);
        if (ret < 0)
                return ret;
@@ -102,8 +107,7 @@ static int mv88e6123_setup(struct dsa_switch *ds)
 
 struct dsa_switch_driver mv88e6123_switch_driver = {
        .tag_protocol           = DSA_TAG_PROTO_EDSA,
-       .priv_size              = sizeof(struct mv88e6xxx_priv_state),
-       .probe                  = mv88e6123_probe,
+       .probe                  = mv88e6123_drv_probe,
        .setup                  = mv88e6123_setup,
        .set_addr               = mv88e6xxx_set_addr_indirect,
        .phy_read               = mv88e6xxx_phy_read,
index 2407028..f5d75fc 100644 (file)
@@ -25,10 +25,13 @@ static const struct mv88e6xxx_switch_id mv88e6131_table[] = {
        { PORT_SWITCH_ID_6185, "Marvell 88E6185" },
 };
 
-static char *mv88e6131_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6131_drv_probe(struct device *dsa_dev,
+                                struct device *host_dev,
+                                int sw_addr, void **priv)
 {
-       return mv88e6xxx_lookup_name(host_dev, sw_addr, mv88e6131_table,
-                                    ARRAY_SIZE(mv88e6131_table));
+       return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv,
+                                  mv88e6131_table,
+                                  ARRAY_SIZE(mv88e6131_table));
 }
 
 static int mv88e6131_setup_global(struct dsa_switch *ds)
@@ -91,6 +94,8 @@ static int mv88e6131_setup(struct dsa_switch *ds)
        struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
        int ret;
 
+       ps->ds = ds;
+
        ret = mv88e6xxx_setup_common(ds);
        if (ret < 0)
                return ret;
@@ -159,8 +164,7 @@ mv88e6131_phy_write(struct dsa_switch *ds,
 
 struct dsa_switch_driver mv88e6131_switch_driver = {
        .tag_protocol           = DSA_TAG_PROTO_DSA,
-       .priv_size              = sizeof(struct mv88e6xxx_priv_state),
-       .probe                  = mv88e6131_probe,
+       .probe                  = mv88e6131_drv_probe,
        .setup                  = mv88e6131_setup,
        .set_addr               = mv88e6xxx_set_addr_direct,
        .phy_read               = mv88e6131_phy_read,
index 0e62f3b..f562250 100644 (file)
@@ -24,10 +24,13 @@ static const struct mv88e6xxx_switch_id mv88e6171_table[] = {
        { PORT_SWITCH_ID_6351, "Marvell 88E6351" },
 };
 
-static char *mv88e6171_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6171_drv_probe(struct device *dsa_dev,
+                                struct device *host_dev,
+                                int sw_addr, void **priv)
 {
-       return mv88e6xxx_lookup_name(host_dev, sw_addr, mv88e6171_table,
-                                    ARRAY_SIZE(mv88e6171_table));
+       return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv,
+                                  mv88e6171_table,
+                                  ARRAY_SIZE(mv88e6171_table));
 }
 
 static int mv88e6171_setup_global(struct dsa_switch *ds)
@@ -69,6 +72,8 @@ static int mv88e6171_setup(struct dsa_switch *ds)
        struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
        int ret;
 
+       ps->ds = ds;
+
        ret = mv88e6xxx_setup_common(ds);
        if (ret < 0)
                return ret;
@@ -88,8 +93,7 @@ static int mv88e6171_setup(struct dsa_switch *ds)
 
 struct dsa_switch_driver mv88e6171_switch_driver = {
        .tag_protocol           = DSA_TAG_PROTO_EDSA,
-       .priv_size              = sizeof(struct mv88e6xxx_priv_state),
-       .probe                  = mv88e6171_probe,
+       .probe                  = mv88e6171_drv_probe,
        .setup                  = mv88e6171_setup,
        .set_addr               = mv88e6xxx_set_addr_indirect,
        .phy_read               = mv88e6xxx_phy_read_indirect,
index 7f452e4..e54ee27 100644 (file)
@@ -37,10 +37,13 @@ static const struct mv88e6xxx_switch_id mv88e6352_table[] = {
        { PORT_SWITCH_ID_6352_A1, "Marvell 88E6352 (A1)" },
 };
 
-static char *mv88e6352_probe(struct device *host_dev, int sw_addr)
+static char *mv88e6352_drv_probe(struct device *dsa_dev,
+                                struct device *host_dev,
+                                int sw_addr, void **priv)
 {
-       return mv88e6xxx_lookup_name(host_dev, sw_addr, mv88e6352_table,
-                                    ARRAY_SIZE(mv88e6352_table));
+       return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv,
+                                  mv88e6352_table,
+                                  ARRAY_SIZE(mv88e6352_table));
 }
 
 static int mv88e6352_setup_global(struct dsa_switch *ds)
@@ -81,6 +84,8 @@ static int mv88e6352_setup(struct dsa_switch *ds)
        struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
        int ret;
 
+       ps->ds = ds;
+
        ret = mv88e6xxx_setup_common(ds);
        if (ret < 0)
                return ret;
@@ -302,8 +307,7 @@ static int mv88e6352_set_eeprom(struct dsa_switch *ds,
 
 struct dsa_switch_driver mv88e6352_switch_driver = {
        .tag_protocol           = DSA_TAG_PROTO_EDSA,
-       .priv_size              = sizeof(struct mv88e6xxx_priv_state),
-       .probe                  = mv88e6352_probe,
+       .probe                  = mv88e6352_drv_probe,
        .setup                  = mv88e6352_setup,
        .set_addr               = mv88e6xxx_set_addr_indirect,
        .phy_read               = mv88e6xxx_phy_read_indirect,
index 62320fc..9985a0c 100644 (file)
@@ -94,15 +94,12 @@ static int __mv88e6xxx_reg_read(struct mii_bus *bus, int sw_addr, int addr,
 
 static int _mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg)
 {
-       struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->master_dev);
+       struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
        int ret;
 
        assert_smi_lock(ds);
 
-       if (bus == NULL)
-               return -EINVAL;
-
-       ret = __mv88e6xxx_reg_read(bus, ds->pd->sw_addr, addr, reg);
+       ret = __mv88e6xxx_reg_read(ps->bus, ps->sw_addr, addr, reg);
        if (ret < 0)
                return ret;
 
@@ -159,17 +156,14 @@ static int __mv88e6xxx_reg_write(struct mii_bus *bus, int sw_addr, int addr,
 static int _mv88e6xxx_reg_write(struct dsa_switch *ds, int addr, int reg,
                                u16 val)
 {
-       struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->master_dev);
+       struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
 
        assert_smi_lock(ds);
 
-       if (bus == NULL)
-               return -EINVAL;
-
        dev_dbg(ds->master_dev, "-> addr: 0x%.2x reg: 0x%.2x val: 0x%.4x\n",
                addr, reg, val);
 
-       return __mv88e6xxx_reg_write(bus, ds->pd->sw_addr, addr, reg, val);
+       return __mv88e6xxx_reg_write(ps->bus, ps->sw_addr, addr, reg, val);
 }
 
 int mv88e6xxx_reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
@@ -281,7 +275,7 @@ static void mv88e6xxx_ppu_reenable_work(struct work_struct *ugly)
 
        ps = container_of(ugly, struct mv88e6xxx_priv_state, ppu_work);
        if (mutex_trylock(&ps->ppu_mutex)) {
-               struct dsa_switch *ds = ((struct dsa_switch *)ps) - 1;
+               struct dsa_switch *ds = ps->ds;
 
                if (mv88e6xxx_ppu_enable(ds) == 0)
                        ps->ppu_disabled = 0;
@@ -2322,7 +2316,7 @@ static void mv88e6xxx_bridge_work(struct work_struct *work)
        int port;
 
        ps = container_of(work, struct mv88e6xxx_priv_state, bridge_work);
-       ds = ((struct dsa_switch *)ps) - 1;
+       ds = ps->ds;
 
        mutex_lock(&ps->smi_mutex);
 
@@ -2670,6 +2664,7 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds)
 {
        struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
 
+       ps->ds = ds;
        mutex_init(&ps->smi_mutex);
 
        ps->id = REG_READ(REG_PORT(0), PORT_SWITCH_ID) & 0xfff0;
@@ -3073,11 +3068,10 @@ int mv88e6xxx_get_temp_alarm(struct dsa_switch *ds, bool *alarm)
 }
 #endif /* CONFIG_NET_DSA_HWMON */
 
-char *mv88e6xxx_lookup_name(struct device *host_dev, int sw_addr,
-                           const struct mv88e6xxx_switch_id *table,
-                           unsigned int num)
+static char *mv88e6xxx_lookup_name(struct mii_bus *bus, int sw_addr,
+                                  const struct mv88e6xxx_switch_id *table,
+                                  unsigned int num)
 {
-       struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev);
        int i, ret;
 
        if (!bus)
@@ -3095,7 +3089,8 @@ char *mv88e6xxx_lookup_name(struct device *host_dev, int sw_addr,
        /* Look up only the product number */
        for (i = 0; i < num; ++i) {
                if (table[i].id == (ret & PORT_SWITCH_ID_PROD_NUM_MASK)) {
-                       dev_warn(host_dev, "unknown revision %d, using base switch 0x%x\n",
+                       dev_warn(&bus->dev,
+                                "unknown revision %d, using base switch 0x%x\n",
                                 ret & PORT_SWITCH_ID_REV_MASK,
                                 ret & PORT_SWITCH_ID_PROD_NUM_MASK);
                        return table[i].name;
@@ -3105,6 +3100,32 @@ char *mv88e6xxx_lookup_name(struct device *host_dev, int sw_addr,
        return NULL;
 }
 
+char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev,
+                         int sw_addr, void **priv,
+                         const struct mv88e6xxx_switch_id *table,
+                         unsigned int num)
+{
+       struct mv88e6xxx_priv_state *ps;
+       struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev);
+       char *name;
+
+       if (!bus)
+               return NULL;
+
+       name = mv88e6xxx_lookup_name(bus, sw_addr, table, num);
+       if (name) {
+               ps = devm_kzalloc(dsa_dev, sizeof(*ps), GFP_KERNEL);
+               if (!ps)
+                       return NULL;
+               *priv = ps;
+               ps->bus = dsa_host_dev_to_mii_bus(host_dev);
+               if (!ps->bus)
+                       return NULL;
+               ps->sw_addr = sw_addr;
+       }
+       return name;
+}
+
 static int __init mv88e6xxx_init(void)
 {
 #if IS_ENABLED(CONFIG_NET_DSA_MV88E6131)
index 236bcaa..5d27dec 100644 (file)
@@ -397,12 +397,21 @@ struct mv88e6xxx_priv_port {
 };
 
 struct mv88e6xxx_priv_state {
+       /* The dsa_switch this private structure is related to */
+       struct dsa_switch *ds;
+
        /* When using multi-chip addressing, this mutex protects
         * access to the indirect access registers.  (In single-chip
         * mode, this mutex is effectively useless.)
         */
        struct mutex    smi_mutex;
 
+       /* The MII bus and the address on the bus that is used to
+        * communication with the switch
+        */
+       struct mii_bus *bus;
+       int sw_addr;
+
 #ifdef CONFIG_NET_DSA_MV88E6XXX_NEED_PPU
        /* Handles automatic disabling and re-enabling of the PHY
         * polling unit.
@@ -453,9 +462,11 @@ struct mv88e6xxx_hw_stat {
 };
 
 int mv88e6xxx_switch_reset(struct dsa_switch *ds, bool ppu_active);
-char *mv88e6xxx_lookup_name(struct device *host_dev, int sw_addr,
-                           const struct mv88e6xxx_switch_id *table,
-                           unsigned int num);
+char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev,
+                         int sw_addr, void **priv,
+                         const struct mv88e6xxx_switch_id *table,
+                         unsigned int num);
+
 int mv88e6xxx_setup_ports(struct dsa_switch *ds);
 int mv88e6xxx_setup_common(struct dsa_switch *ds);
 int mv88e6xxx_setup_global(struct dsa_switch *ds);
index 597e472..4645c44 100644 (file)
@@ -122,6 +122,7 @@ static const u16 bnxt_async_events_arr[] = {
        HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE,
        HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD,
        HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED,
+       HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE,
 };
 
 static bool bnxt_vf_pciid(enum board_idx idx)
@@ -1257,6 +1258,21 @@ static int bnxt_async_event_process(struct bnxt *bp,
 
        /* TODO CHIMP_FW: Define event id's for link change, error etc */
        switch (event_id) {
+       case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE: {
+               u32 data1 = le32_to_cpu(cmpl->event_data1);
+               struct bnxt_link_info *link_info = &bp->link_info;
+
+               if (BNXT_VF(bp))
+                       goto async_event_process_exit;
+               if (data1 & 0x20000) {
+                       u16 fw_speed = link_info->force_link_speed;
+                       u32 speed = bnxt_fw_to_ethtool_speed(fw_speed);
+
+                       netdev_warn(bp->dev, "Link speed %d no longer supported\n",
+                                   speed);
+               }
+               /* fall thru */
+       }
        case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
                set_bit(BNXT_LINK_CHNG_SP_EVENT, &bp->sp_event);
                break;
@@ -4611,6 +4627,7 @@ static int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
        link_info->phy_ver[1] = resp->phy_min;
        link_info->phy_ver[2] = resp->phy_bld;
        link_info->media_type = resp->media_type;
+       link_info->phy_type = resp->phy_type;
        link_info->transceiver = resp->xcvr_pkg_type;
        link_info->phy_addr = resp->eee_config_phy_addr &
                              PORT_PHY_QCFG_RESP_PHY_ADDR_MASK;
@@ -4789,6 +4806,21 @@ int bnxt_hwrm_set_link_setting(struct bnxt *bp, bool set_pause, bool set_eee)
        return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
 }
 
+static int bnxt_hwrm_shutdown_link(struct bnxt *bp)
+{
+       struct hwrm_port_phy_cfg_input req = {0};
+
+       if (BNXT_VF(bp))
+               return 0;
+
+       if (pci_num_vf(bp->pdev))
+               return 0;
+
+       bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_PORT_PHY_CFG, -1, -1);
+       req.flags = cpu_to_le32(PORT_PHY_CFG_REQ_FLAGS_FORCE_LINK_DOWN);
+       return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+}
+
 static bool bnxt_eee_config_ok(struct bnxt *bp)
 {
        struct ethtool_eee *eee = &bp->eee;
@@ -5043,6 +5075,7 @@ static int bnxt_close(struct net_device *dev)
        struct bnxt *bp = netdev_priv(dev);
 
        bnxt_close_nic(bp, true, true);
+       bnxt_hwrm_shutdown_link(bp);
        return 0;
 }
 
@@ -5679,10 +5712,9 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p)
        if (!is_valid_ether_addr(addr->sa_data))
                return -EADDRNOTAVAIL;
 
-#ifdef CONFIG_BNXT_SRIOV
-       if (BNXT_VF(bp) && is_valid_ether_addr(bp->vf.mac_addr))
-               return -EADDRNOTAVAIL;
-#endif
+       rc = bnxt_approve_mac(bp, addr->sa_data);
+       if (rc)
+               return rc;
 
        if (ether_addr_equal(addr->sa_data, dev->dev_addr))
                return 0;
index cc8e38a..26dac2f 100644 (file)
@@ -759,6 +759,7 @@ struct bnxt_ntuple_filter {
 };
 
 struct bnxt_link_info {
+       u8                      phy_type;
        u8                      media_type;
        u8                      transceiver;
        u8                      phy_addr;
index a2e9324..d6e41f2 100644 (file)
@@ -850,7 +850,15 @@ static int bnxt_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                set_pause = true;
        } else {
                u16 fw_speed;
+               u8 phy_type = link_info->phy_type;
 
+               if (phy_type == PORT_PHY_QCFG_RESP_PHY_TYPE_BASET  ||
+                   phy_type == PORT_PHY_QCFG_RESP_PHY_TYPE_BASETE ||
+                   link_info->media_type == PORT_PHY_QCFG_RESP_MEDIA_TYPE_TP) {
+                       netdev_err(dev, "10GBase-T devices must autoneg\n");
+                       rc = -EINVAL;
+                       goto set_setting_exit;
+               }
                /* TODO: currently don't support half duplex */
                if (cmd->duplex == DUPLEX_HALF) {
                        netdev_err(dev, "HALF DUPLEX is not supported!\n");
index 8457850..363884d 100644 (file)
@@ -865,6 +865,31 @@ update_vf_mac_exit:
        mutex_unlock(&bp->hwrm_cmd_lock);
 }
 
+int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
+{
+       struct hwrm_func_vf_cfg_input req = {0};
+       int rc = 0;
+
+       if (!BNXT_VF(bp))
+               return 0;
+
+       if (bp->hwrm_spec_code < 0x10202) {
+               if (is_valid_ether_addr(bp->vf.mac_addr))
+                       rc = -EADDRNOTAVAIL;
+               goto mac_done;
+       }
+       bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_VF_CFG, -1, -1);
+       req.enables = cpu_to_le32(FUNC_VF_CFG_REQ_ENABLES_DFLT_MAC_ADDR);
+       memcpy(req.dflt_mac_addr, mac, ETH_ALEN);
+       rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+mac_done:
+       if (rc) {
+               rc = -EADDRNOTAVAIL;
+               netdev_warn(bp->dev, "VF MAC address %pM not approved by the PF\n",
+                           mac);
+       }
+       return rc;
+}
 #else
 
 void bnxt_sriov_disable(struct bnxt *bp)
@@ -879,4 +904,9 @@ void bnxt_hwrm_exec_fwd_req(struct bnxt *bp)
 void bnxt_update_vf_mac(struct bnxt *bp)
 {
 }
+
+int bnxt_approve_mac(struct bnxt *bp, u8 *mac)
+{
+       return 0;
+}
 #endif
index 3f08354..0392670 100644 (file)
@@ -20,4 +20,5 @@ int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs);
 void bnxt_sriov_disable(struct bnxt *);
 void bnxt_hwrm_exec_fwd_req(struct bnxt *);
 void bnxt_update_vf_mac(struct bnxt *);
+int bnxt_approve_mac(struct bnxt *, u8 *);
 #endif
index f7b42b9..8150c74 100644 (file)
@@ -1221,8 +1221,10 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
        dev->stats.tx_packets += pkts_compl;
        dev->stats.tx_bytes += bytes_compl;
 
+       txq = netdev_get_tx_queue(dev, ring->queue);
+       netdev_tx_completed_queue(txq, pkts_compl, bytes_compl);
+
        if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
-               txq = netdev_get_tx_queue(dev, ring->queue);
                if (netif_tx_queue_stopped(txq))
                        netif_tx_wake_queue(txq);
        }
@@ -1516,6 +1518,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
        ring->prod_index += nr_frags + 1;
        ring->prod_index &= DMA_P_INDEX_MASK;
 
+       netdev_tx_sent_queue(txq, GENET_CB(skb)->bytes_sent);
+
        if (ring->free_bds <= (MAX_SKB_FRAGS + 1))
                netif_tx_stop_queue(txq);
 
@@ -1735,7 +1739,7 @@ static int bcmgenet_rx_poll(struct napi_struct *napi, int budget)
        work_done = bcmgenet_desc_rx(ring, budget);
 
        if (work_done < budget) {
-               napi_complete(napi);
+               napi_complete_done(napi, work_done);
                ring->int_enable(ring);
        }
 
@@ -2364,6 +2368,7 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv)
 static void bcmgenet_fini_dma(struct bcmgenet_priv *priv)
 {
        int i;
+       struct netdev_queue *txq;
 
        bcmgenet_fini_rx_napi(priv);
        bcmgenet_fini_tx_napi(priv);
@@ -2378,6 +2383,14 @@ static void bcmgenet_fini_dma(struct bcmgenet_priv *priv)
                }
        }
 
+       for (i = 0; i < priv->hw_params->tx_queues; i++) {
+               txq = netdev_get_tx_queue(priv->dev, priv->tx_rings[i].queue);
+               netdev_tx_reset_queue(txq);
+       }
+
+       txq = netdev_get_tx_queue(priv->dev, priv->tx_rings[DESC_INDEX].queue);
+       netdev_tx_reset_queue(txq);
+
        bcmgenet_free_rx_buffers(priv);
        kfree(priv->rx_cbs);
        kfree(priv->tx_cbs);
@@ -2493,7 +2506,7 @@ static irqreturn_t bcmgenet_isr1(int irq, void *dev_id)
 
                if (likely(napi_schedule_prep(&rx_ring->napi))) {
                        rx_ring->int_disable(rx_ring);
-                       __napi_schedule(&rx_ring->napi);
+                       __napi_schedule_irqoff(&rx_ring->napi);
                }
        }
 
@@ -2506,7 +2519,7 @@ static irqreturn_t bcmgenet_isr1(int irq, void *dev_id)
 
                if (likely(napi_schedule_prep(&tx_ring->napi))) {
                        tx_ring->int_disable(tx_ring);
-                       __napi_schedule(&tx_ring->napi);
+                       __napi_schedule_irqoff(&tx_ring->napi);
                }
        }
 
@@ -2536,7 +2549,7 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id)
 
                if (likely(napi_schedule_prep(&rx_ring->napi))) {
                        rx_ring->int_disable(rx_ring);
-                       __napi_schedule(&rx_ring->napi);
+                       __napi_schedule_irqoff(&rx_ring->napi);
                }
        }
 
@@ -2545,7 +2558,7 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id)
 
                if (likely(napi_schedule_prep(&tx_ring->napi))) {
                        tx_ring->int_disable(tx_ring);
-                       __napi_schedule(&tx_ring->napi);
+                       __napi_schedule_irqoff(&tx_ring->napi);
                }
        }
 
index 3ddf657..836ebd8 100644 (file)
@@ -222,7 +222,7 @@ jme_clear_ghc_reset(struct jme_adapter *jme)
        jwrite32f(jme, JME_GHC, jme->reg_ghc);
 }
 
-static inline void
+static void
 jme_reset_mac_processor(struct jme_adapter *jme)
 {
        static const u32 mask[WAKEUP_FRAME_MASK_DWNR] = {0, 0, 0, 0};
index e0b68af..c984462 100644 (file)
@@ -536,7 +536,6 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
        struct mtk_eth *eth = mac->hw;
        struct mtk_tx_dma *itxd, *txd;
        struct mtk_tx_buf *tx_buf;
-       unsigned long flags;
        dma_addr_t mapped_addr;
        unsigned int nr_frags;
        int i, n_desc = 1;
@@ -568,11 +567,6 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
        if (unlikely(dma_mapping_error(&dev->dev, mapped_addr)))
                return -ENOMEM;
 
-       /* normally we can rely on the stack not calling this more than once,
-        * however we have 2 queues running ont he same ring so we need to lock
-        * the ring access
-        */
-       spin_lock_irqsave(&eth->page_lock, flags);
        WRITE_ONCE(itxd->txd1, mapped_addr);
        tx_buf->flags |= MTK_TX_FLAGS_SINGLE0;
        dma_unmap_addr_set(tx_buf, dma_addr0, mapped_addr);
@@ -609,8 +603,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
                        WRITE_ONCE(txd->txd1, mapped_addr);
                        WRITE_ONCE(txd->txd3, (TX_DMA_SWC |
                                               TX_DMA_PLEN0(frag_map_size) |
-                                              last_frag * TX_DMA_LS0) |
-                                              mac->id);
+                                              last_frag * TX_DMA_LS0));
                        WRITE_ONCE(txd->txd4, 0);
 
                        tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC;
@@ -632,8 +625,6 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
        WRITE_ONCE(itxd->txd3, (TX_DMA_SWC | TX_DMA_PLEN0(skb_headlen(skb)) |
                                (!nr_frags * TX_DMA_LS0)));
 
-       spin_unlock_irqrestore(&eth->page_lock, flags);
-
        netdev_sent_queue(dev, skb->len);
        skb_tx_timestamp(skb);
 
@@ -661,8 +652,6 @@ err_dma:
                itxd = mtk_qdma_phys_to_virt(ring, itxd->txd2);
        } while (itxd != txd);
 
-       spin_unlock_irqrestore(&eth->page_lock, flags);
-
        return -ENOMEM;
 }
 
@@ -681,7 +670,29 @@ static inline int mtk_cal_txd_req(struct sk_buff *skb)
                nfrags += skb_shinfo(skb)->nr_frags;
        }
 
-       return DIV_ROUND_UP(nfrags, 2);
+       return nfrags;
+}
+
+static void mtk_wake_queue(struct mtk_eth *eth)
+{
+       int i;
+
+       for (i = 0; i < MTK_MAC_COUNT; i++) {
+               if (!eth->netdev[i])
+                       continue;
+               netif_wake_queue(eth->netdev[i]);
+       }
+}
+
+static void mtk_stop_queue(struct mtk_eth *eth)
+{
+       int i;
+
+       for (i = 0; i < MTK_MAC_COUNT; i++) {
+               if (!eth->netdev[i])
+                       continue;
+               netif_stop_queue(eth->netdev[i]);
+       }
 }
 
 static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -690,14 +701,22 @@ static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
        struct mtk_eth *eth = mac->hw;
        struct mtk_tx_ring *ring = &eth->tx_ring;
        struct net_device_stats *stats = &dev->stats;
+       unsigned long flags;
        bool gso = false;
        int tx_num;
 
+       /* normally we can rely on the stack not calling this more than once,
+        * however we have 2 queues running on the same ring so we need to lock
+        * the ring access
+        */
+       spin_lock_irqsave(&eth->page_lock, flags);
+
        tx_num = mtk_cal_txd_req(skb);
        if (unlikely(atomic_read(&ring->free_count) <= tx_num)) {
-               netif_stop_queue(dev);
+               mtk_stop_queue(eth);
                netif_err(eth, tx_queued, dev,
                          "Tx Ring full when queue awake!\n");
+               spin_unlock_irqrestore(&eth->page_lock, flags);
                return NETDEV_TX_BUSY;
        }
 
@@ -720,15 +739,17 @@ static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
                goto drop;
 
        if (unlikely(atomic_read(&ring->free_count) <= ring->thresh)) {
-               netif_stop_queue(dev);
+               mtk_stop_queue(eth);
                if (unlikely(atomic_read(&ring->free_count) >
                             ring->thresh))
-                       netif_wake_queue(dev);
+                       mtk_wake_queue(eth);
        }
+       spin_unlock_irqrestore(&eth->page_lock, flags);
 
        return NETDEV_TX_OK;
 
 drop:
+       spin_unlock_irqrestore(&eth->page_lock, flags);
        stats->tx_dropped++;
        dev_kfree_skb(skb);
        return NETDEV_TX_OK;
@@ -897,13 +918,8 @@ static int mtk_poll_tx(struct mtk_eth *eth, int budget, bool *tx_again)
        if (!total)
                return 0;
 
-       for (i = 0; i < MTK_MAC_COUNT; i++) {
-               if (!eth->netdev[i] ||
-                   unlikely(!netif_queue_stopped(eth->netdev[i])))
-                       continue;
-               if (atomic_read(&ring->free_count) > ring->thresh)
-                       netif_wake_queue(eth->netdev[i]);
-       }
+       if (atomic_read(&ring->free_count) > ring->thresh)
+               mtk_wake_queue(eth);
 
        return total;
 }
@@ -1176,7 +1192,7 @@ static void mtk_tx_timeout(struct net_device *dev)
        eth->netdev[mac->id]->stats.tx_errors++;
        netif_err(eth, tx_err, dev,
                  "transmit timed out\n");
-       schedule_work(&mac->pending_work);
+       schedule_work(&eth->pending_work);
 }
 
 static irqreturn_t mtk_handle_irq(int irq, void *_eth)
@@ -1413,19 +1429,30 @@ static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
 static void mtk_pending_work(struct work_struct *work)
 {
-       struct mtk_mac *mac = container_of(work, struct mtk_mac, pending_work);
-       struct mtk_eth *eth = mac->hw;
-       struct net_device *dev = eth->netdev[mac->id];
-       int err;
+       struct mtk_eth *eth = container_of(work, struct mtk_eth, pending_work);
+       int err, i;
+       unsigned long restart = 0;
 
        rtnl_lock();
-       mtk_stop(dev);
 
-       err = mtk_open(dev);
-       if (err) {
-               netif_alert(eth, ifup, dev,
-                           "Driver up/down cycle failed, closing device.\n");
-               dev_close(dev);
+       /* stop all devices to make sure that dma is properly shut down */
+       for (i = 0; i < MTK_MAC_COUNT; i++) {
+               if (!eth->netdev[i])
+                       continue;
+               mtk_stop(eth->netdev[i]);
+               __set_bit(i, &restart);
+       }
+
+       /* restart DMA and enable IRQs */
+       for (i = 0; i < MTK_MAC_COUNT; i++) {
+               if (!test_bit(i, &restart))
+                       continue;
+               err = mtk_open(eth->netdev[i]);
+               if (err) {
+                       netif_alert(eth, ifup, eth->netdev[i],
+                             "Driver up/down cycle failed, closing device.\n");
+                       dev_close(eth->netdev[i]);
+               }
        }
        rtnl_unlock();
 }
@@ -1435,15 +1462,13 @@ static int mtk_cleanup(struct mtk_eth *eth)
        int i;
 
        for (i = 0; i < MTK_MAC_COUNT; i++) {
-               struct mtk_mac *mac = netdev_priv(eth->netdev[i]);
-
                if (!eth->netdev[i])
                        continue;
 
                unregister_netdev(eth->netdev[i]);
                free_netdev(eth->netdev[i]);
-               cancel_work_sync(&mac->pending_work);
        }
+       cancel_work_sync(&eth->pending_work);
 
        return 0;
 }
@@ -1631,7 +1656,6 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
        mac->id = id;
        mac->hw = eth;
        mac->of_node = np;
-       INIT_WORK(&mac->pending_work, mtk_pending_work);
 
        mac->hw_stats = devm_kzalloc(eth->dev,
                                     sizeof(*mac->hw_stats),
@@ -1645,6 +1669,7 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
        mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET;
 
        SET_NETDEV_DEV(eth->netdev[id], eth->dev);
+       eth->netdev[id]->watchdog_timeo = HZ;
        eth->netdev[id]->netdev_ops = &mtk_netdev_ops;
        eth->netdev[id]->base_addr = (unsigned long)eth->base;
        eth->netdev[id]->vlan_features = MTK_HW_FEATURES &
@@ -1678,10 +1703,6 @@ static int mtk_probe(struct platform_device *pdev)
        struct mtk_eth *eth;
        int err;
 
-       err = device_reset(&pdev->dev);
-       if (err)
-               return err;
-
        match = of_match_device(of_mtk_match, &pdev->dev);
        soc = (struct mtk_soc_data *)match->data;
 
@@ -1736,6 +1757,7 @@ static int mtk_probe(struct platform_device *pdev)
 
        eth->dev = &pdev->dev;
        eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE);
+       INIT_WORK(&eth->pending_work, mtk_pending_work);
 
        err = mtk_hw_init(eth);
        if (err)
index 48a5292..eed626d 100644 (file)
@@ -363,6 +363,7 @@ struct mtk_rx_ring {
  * @clk_gp1:           The gmac1 clock
  * @clk_gp2:           The gmac2 clock
  * @mii_bus:           If there is a bus we need to create an instance for it
+ * @pending_work:      The workqueue used to reset the dma ring
  */
 
 struct mtk_eth {
@@ -389,6 +390,7 @@ struct mtk_eth {
        struct clk                      *clk_gp1;
        struct clk                      *clk_gp2;
        struct mii_bus                  *mii_bus;
+       struct work_struct              pending_work;
 };
 
 /* struct mtk_mac -    the structure that holds the info about the MACs of the
@@ -398,7 +400,6 @@ struct mtk_eth {
  * @hw:                        Backpointer to our main datastruture
  * @hw_stats:          Packet statistics counter
  * @phy_dev:           The attached PHY if available
- * @pending_work:      The workqueue used to reset the dma ring
  */
 struct mtk_mac {
        int                             id;
@@ -406,7 +407,6 @@ struct mtk_mac {
        struct mtk_eth                  *hw;
        struct mtk_hw_stats             *hw_stats;
        struct phy_device               *phy_dev;
-       struct work_struct              pending_work;
 };
 
 /* the struct describing the SoC. these are declared in the soc_xyz.c files */
index fcb8e9b..0f0d2d1 100644 (file)
@@ -26,7 +26,7 @@
 #include "qed_hsi.h"
 
 extern const struct qed_common_ops qed_common_ops_pass;
-#define DRV_MODULE_VERSION "8.7.0.0"
+#define DRV_MODULE_VERSION "8.7.1.20"
 
 #define MAX_HWFNS_PER_DEVICE    (4)
 #define NAME_SIZE 16
@@ -507,6 +507,4 @@ u32 qed_unzip_data(struct qed_hwfn *p_hwfn,
 
 int qed_slowpath_irq_req(struct qed_hwfn *hwfn);
 
-#define QED_ETH_INTERFACE_VERSION       300
-
 #endif /* _QED_H */
index 3f35c6c..5005497 100644 (file)
 #include "qed_reg_addr.h"
 #include "qed_sp.h"
 
-enum qed_rss_caps {
-       QED_RSS_IPV4            = 0x1,
-       QED_RSS_IPV6            = 0x2,
-       QED_RSS_IPV4_TCP        = 0x4,
-       QED_RSS_IPV6_TCP        = 0x8,
-       QED_RSS_IPV4_UDP        = 0x10,
-       QED_RSS_IPV6_UDP        = 0x20,
-};
-
-/* Should be the same as ETH_RSS_IND_TABLE_ENTRIES_NUM */
-#define QED_RSS_IND_TABLE_SIZE 128
-#define QED_RSS_KEY_SIZE 10 /* size in 32b chunks */
-
 struct qed_rss_params {
        u8      update_rss_config;
        u8      rss_enable;
@@ -1744,9 +1731,7 @@ static int qed_update_vport(struct qed_dev *cdev,
                sp_rss_params.update_rss_capabilities = 1;
                sp_rss_params.update_rss_ind_table = 1;
                sp_rss_params.update_rss_key = 1;
-               sp_rss_params.rss_caps = QED_RSS_IPV4 |
-                                        QED_RSS_IPV6 |
-                                        QED_RSS_IPV4_TCP | QED_RSS_IPV6_TCP;
+               sp_rss_params.rss_caps = params->rss_params.rss_caps;
                sp_rss_params.rss_table_size_log = 7; /* 2^7 = 128 */
                memcpy(sp_rss_params.rss_ind_table,
                       params->rss_params.rss_ind_table,
@@ -2043,14 +2028,8 @@ static const struct qed_eth_ops qed_eth_ops_pass = {
        .get_vport_stats = &qed_get_vport_stats,
 };
 
-const struct qed_eth_ops *qed_get_eth_ops(u32 version)
+const struct qed_eth_ops *qed_get_eth_ops(void)
 {
-       if (version != QED_ETH_INTERFACE_VERSION) {
-               pr_notice("Cannot supply ethtool operations [%08x != %08x]\n",
-                         version, QED_ETH_INTERFACE_VERSION);
-               return NULL;
-       }
-
        return &qed_eth_ops_pass;
 }
 EXPORT_SYMBOL(qed_get_eth_ops);
index 26d40db..c31d485 100644 (file)
@@ -1172,14 +1172,3 @@ const struct qed_common_ops qed_common_ops_pass = {
        .chain_free = &qed_chain_free,
        .set_led = &qed_set_led,
 };
-
-u32 qed_get_protocol_version(enum qed_protocol protocol)
-{
-       switch (protocol) {
-       case QED_PROTOCOL_ETH:
-               return QED_ETH_INTERFACE_VERSION;
-       default:
-               return 0;
-       }
-}
-EXPORT_SYMBOL(qed_get_protocol_version);
index d023251..41c4189 100644 (file)
 
 #define QEDE_MAJOR_VERSION             8
 #define QEDE_MINOR_VERSION             7
-#define QEDE_REVISION_VERSION          0
-#define QEDE_ENGINEERING_VERSION       0
+#define QEDE_REVISION_VERSION          1
+#define QEDE_ENGINEERING_VERSION       20
 #define DRV_MODULE_VERSION __stringify(QEDE_MAJOR_VERSION) "." \
                __stringify(QEDE_MINOR_VERSION) "."             \
                __stringify(QEDE_REVISION_VERSION) "."          \
                __stringify(QEDE_ENGINEERING_VERSION)
 
-#define QEDE_ETH_INTERFACE_VERSION     300
-
 #define DRV_MODULE_SYM         qede
 
 struct qede_stats {
@@ -156,6 +154,10 @@ struct qede_dev {
              SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
 
        struct qede_stats               stats;
+#define QEDE_RSS_INDIR_INITED  BIT(0)
+#define QEDE_RSS_KEY_INITED    BIT(1)
+#define QEDE_RSS_CAPS_INITED   BIT(2)
+       u32 rss_params_inited; /* bit-field to track initialized rss params */
        struct qed_update_vport_rss_params      rss_params;
        u16                     q_num_rx_buffers; /* Must be a power of two */
        u16                     q_num_tx_buffers; /* Must be a power of two */
index c49dc10..f0982f1 100644 (file)
@@ -569,6 +569,236 @@ static int qede_set_phys_id(struct net_device *dev,
        return 0;
 }
 
+static int qede_get_rss_flags(struct qede_dev *edev, struct ethtool_rxnfc *info)
+{
+       info->data = RXH_IP_SRC | RXH_IP_DST;
+
+       switch (info->flow_type) {
+       case TCP_V4_FLOW:
+       case TCP_V6_FLOW:
+               info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
+               break;
+       case UDP_V4_FLOW:
+               if (edev->rss_params.rss_caps & QED_RSS_IPV4_UDP)
+                       info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
+               break;
+       case UDP_V6_FLOW:
+               if (edev->rss_params.rss_caps & QED_RSS_IPV6_UDP)
+                       info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
+               break;
+       case IPV4_FLOW:
+       case IPV6_FLOW:
+               break;
+       default:
+               info->data = 0;
+               break;
+       }
+
+       return 0;
+}
+
+static int qede_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
+                         u32 *rules __always_unused)
+{
+       struct qede_dev *edev = netdev_priv(dev);
+
+       switch (info->cmd) {
+       case ETHTOOL_GRXRINGS:
+               info->data = edev->num_rss;
+               return 0;
+       case ETHTOOL_GRXFH:
+               return qede_get_rss_flags(edev, info);
+       default:
+               DP_ERR(edev, "Command parameters not supported\n");
+               return -EOPNOTSUPP;
+       }
+}
+
+static int qede_set_rss_flags(struct qede_dev *edev, struct ethtool_rxnfc *info)
+{
+       struct qed_update_vport_params vport_update_params;
+       u8 set_caps = 0, clr_caps = 0;
+
+       DP_VERBOSE(edev, QED_MSG_DEBUG,
+                  "Set rss flags command parameters: flow type = %d, data = %llu\n",
+                  info->flow_type, info->data);
+
+       switch (info->flow_type) {
+       case TCP_V4_FLOW:
+       case TCP_V6_FLOW:
+               /* For TCP only 4-tuple hash is supported */
+               if (info->data ^ (RXH_IP_SRC | RXH_IP_DST |
+                                 RXH_L4_B_0_1 | RXH_L4_B_2_3)) {
+                       DP_INFO(edev, "Command parameters not supported\n");
+                       return -EINVAL;
+               }
+               return 0;
+       case UDP_V4_FLOW:
+               /* For UDP either 2-tuple hash or 4-tuple hash is supported */
+               if (info->data == (RXH_IP_SRC | RXH_IP_DST |
+                                  RXH_L4_B_0_1 | RXH_L4_B_2_3)) {
+                       set_caps = QED_RSS_IPV4_UDP;
+                       DP_VERBOSE(edev, QED_MSG_DEBUG,
+                                  "UDP 4-tuple enabled\n");
+               } else if (info->data == (RXH_IP_SRC | RXH_IP_DST)) {
+                       clr_caps = QED_RSS_IPV4_UDP;
+                       DP_VERBOSE(edev, QED_MSG_DEBUG,
+                                  "UDP 4-tuple disabled\n");
+               } else {
+                       return -EINVAL;
+               }
+               break;
+       case UDP_V6_FLOW:
+               /* For UDP either 2-tuple hash or 4-tuple hash is supported */
+               if (info->data == (RXH_IP_SRC | RXH_IP_DST |
+                                  RXH_L4_B_0_1 | RXH_L4_B_2_3)) {
+                       set_caps = QED_RSS_IPV6_UDP;
+                       DP_VERBOSE(edev, QED_MSG_DEBUG,
+                                  "UDP 4-tuple enabled\n");
+               } else if (info->data == (RXH_IP_SRC | RXH_IP_DST)) {
+                       clr_caps = QED_RSS_IPV6_UDP;
+                       DP_VERBOSE(edev, QED_MSG_DEBUG,
+                                  "UDP 4-tuple disabled\n");
+               } else {
+                       return -EINVAL;
+               }
+               break;
+       case IPV4_FLOW:
+       case IPV6_FLOW:
+               /* For IP only 2-tuple hash is supported */
+               if (info->data ^ (RXH_IP_SRC | RXH_IP_DST)) {
+                       DP_INFO(edev, "Command parameters not supported\n");
+                       return -EINVAL;
+               }
+               return 0;
+       case SCTP_V4_FLOW:
+       case AH_ESP_V4_FLOW:
+       case AH_V4_FLOW:
+       case ESP_V4_FLOW:
+       case SCTP_V6_FLOW:
+       case AH_ESP_V6_FLOW:
+       case AH_V6_FLOW:
+       case ESP_V6_FLOW:
+       case IP_USER_FLOW:
+       case ETHER_FLOW:
+               /* RSS is not supported for these protocols */
+               if (info->data) {
+                       DP_INFO(edev, "Command parameters not supported\n");
+                       return -EINVAL;
+               }
+               return 0;
+       default:
+               return -EINVAL;
+       }
+
+       /* No action is needed if there is no change in the rss capability */
+       if (edev->rss_params.rss_caps == ((edev->rss_params.rss_caps &
+                                          ~clr_caps) | set_caps))
+               return 0;
+
+       /* Update internal configuration */
+       edev->rss_params.rss_caps = (edev->rss_params.rss_caps & ~clr_caps) |
+                                   set_caps;
+       edev->rss_params_inited |= QEDE_RSS_CAPS_INITED;
+
+       /* Re-configure if possible */
+       if (netif_running(edev->ndev)) {
+               memset(&vport_update_params, 0, sizeof(vport_update_params));
+               vport_update_params.update_rss_flg = 1;
+               vport_update_params.vport_id = 0;
+               memcpy(&vport_update_params.rss_params, &edev->rss_params,
+                      sizeof(vport_update_params.rss_params));
+               return edev->ops->vport_update(edev->cdev,
+                                              &vport_update_params);
+       }
+
+       return 0;
+}
+
+static int qede_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info)
+{
+       struct qede_dev *edev = netdev_priv(dev);
+
+       switch (info->cmd) {
+       case ETHTOOL_SRXFH:
+               return qede_set_rss_flags(edev, info);
+       default:
+               DP_INFO(edev, "Command parameters not supported\n");
+               return -EOPNOTSUPP;
+       }
+}
+
+static u32 qede_get_rxfh_indir_size(struct net_device *dev)
+{
+       return QED_RSS_IND_TABLE_SIZE;
+}
+
+static u32 qede_get_rxfh_key_size(struct net_device *dev)
+{
+       struct qede_dev *edev = netdev_priv(dev);
+
+       return sizeof(edev->rss_params.rss_key);
+}
+
+static int qede_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, u8 *hfunc)
+{
+       struct qede_dev *edev = netdev_priv(dev);
+       int i;
+
+       if (hfunc)
+               *hfunc = ETH_RSS_HASH_TOP;
+
+       if (!indir)
+               return 0;
+
+       for (i = 0; i < QED_RSS_IND_TABLE_SIZE; i++)
+               indir[i] = edev->rss_params.rss_ind_table[i];
+
+       if (key)
+               memcpy(key, edev->rss_params.rss_key,
+                      qede_get_rxfh_key_size(dev));
+
+       return 0;
+}
+
+static int qede_set_rxfh(struct net_device *dev, const u32 *indir,
+                        const u8 *key, const u8 hfunc)
+{
+       struct qed_update_vport_params vport_update_params;
+       struct qede_dev *edev = netdev_priv(dev);
+       int i;
+
+       if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
+               return -EOPNOTSUPP;
+
+       if (!indir && !key)
+               return 0;
+
+       if (indir) {
+               for (i = 0; i < QED_RSS_IND_TABLE_SIZE; i++)
+                       edev->rss_params.rss_ind_table[i] = indir[i];
+               edev->rss_params_inited |= QEDE_RSS_INDIR_INITED;
+       }
+
+       if (key) {
+               memcpy(&edev->rss_params.rss_key, key,
+                      qede_get_rxfh_key_size(dev));
+               edev->rss_params_inited |= QEDE_RSS_KEY_INITED;
+       }
+
+       if (netif_running(edev->ndev)) {
+               memset(&vport_update_params, 0, sizeof(vport_update_params));
+               vport_update_params.update_rss_flg = 1;
+               vport_update_params.vport_id = 0;
+               memcpy(&vport_update_params.rss_params, &edev->rss_params,
+                      sizeof(vport_update_params.rss_params));
+               return edev->ops->vport_update(edev->cdev,
+                                              &vport_update_params);
+       }
+
+       return 0;
+}
+
 static const struct ethtool_ops qede_ethtool_ops = {
        .get_settings = qede_get_settings,
        .set_settings = qede_set_settings,
@@ -585,7 +815,12 @@ static const struct ethtool_ops qede_ethtool_ops = {
        .set_phys_id = qede_set_phys_id,
        .get_ethtool_stats = qede_get_ethtool_stats,
        .get_sset_count = qede_get_sset_count,
-
+       .get_rxnfc = qede_get_rxnfc,
+       .set_rxnfc = qede_set_rxnfc,
+       .get_rxfh_indir_size = qede_get_rxfh_indir_size,
+       .get_rxfh_key_size = qede_get_rxfh_key_size,
+       .get_rxfh = qede_get_rxfh,
+       .set_rxfh = qede_set_rxfh,
        .get_channels = qede_get_channels,
        .set_channels = qede_set_channels,
 };
index 518af32..457caad 100644 (file)
@@ -141,19 +141,10 @@ static
 int __init qede_init(void)
 {
        int ret;
-       u32 qed_ver;
 
        pr_notice("qede_init: %s\n", version);
 
-       qed_ver = qed_get_protocol_version(QED_PROTOCOL_ETH);
-       if (qed_ver !=  QEDE_ETH_INTERFACE_VERSION) {
-               pr_notice("Version mismatch [%08x != %08x]\n",
-                         qed_ver,
-                         QEDE_ETH_INTERFACE_VERSION);
-               return -EINVAL;
-       }
-
-       qed_ops = qed_get_eth_ops(QEDE_ETH_INTERFACE_VERSION);
+       qed_ops = qed_get_eth_ops();
        if (!qed_ops) {
                pr_notice("Failed to get qed ethtool operations\n");
                return -EINVAL;
@@ -2835,10 +2826,10 @@ static int qede_start_queues(struct qede_dev *edev)
        int rc, tc, i;
        int vlan_removal_en = 1;
        struct qed_dev *cdev = edev->cdev;
-       struct qed_update_vport_rss_params *rss_params = &edev->rss_params;
        struct qed_update_vport_params vport_update_params;
        struct qed_queue_start_common_params q_params;
        struct qed_start_vport_params start = {0};
+       bool reset_rss_indir = false;
 
        if (!edev->num_rss) {
                DP_ERR(edev,
@@ -2933,16 +2924,50 @@ static int qede_start_queues(struct qede_dev *edev)
        /* Fill struct with RSS params */
        if (QEDE_RSS_CNT(edev) > 1) {
                vport_update_params.update_rss_flg = 1;
-               for (i = 0; i < 128; i++)
-                       rss_params->rss_ind_table[i] =
-                       ethtool_rxfh_indir_default(i, QEDE_RSS_CNT(edev));
-               netdev_rss_key_fill(rss_params->rss_key,
-                                   sizeof(rss_params->rss_key));
+
+               /* Need to validate current RSS config uses valid entries */
+               for (i = 0; i < QED_RSS_IND_TABLE_SIZE; i++) {
+                       if (edev->rss_params.rss_ind_table[i] >=
+                           edev->num_rss) {
+                               reset_rss_indir = true;
+                               break;
+                       }
+               }
+
+               if (!(edev->rss_params_inited & QEDE_RSS_INDIR_INITED) ||
+                   reset_rss_indir) {
+                       u16 val;
+
+                       for (i = 0; i < QED_RSS_IND_TABLE_SIZE; i++) {
+                               u16 indir_val;
+
+                               val = QEDE_RSS_CNT(edev);
+                               indir_val = ethtool_rxfh_indir_default(i, val);
+                               edev->rss_params.rss_ind_table[i] = indir_val;
+                       }
+                       edev->rss_params_inited |= QEDE_RSS_INDIR_INITED;
+               }
+
+               if (!(edev->rss_params_inited & QEDE_RSS_KEY_INITED)) {
+                       netdev_rss_key_fill(edev->rss_params.rss_key,
+                                           sizeof(edev->rss_params.rss_key));
+                       edev->rss_params_inited |= QEDE_RSS_KEY_INITED;
+               }
+
+               if (!(edev->rss_params_inited & QEDE_RSS_CAPS_INITED)) {
+                       edev->rss_params.rss_caps = QED_RSS_IPV4 |
+                                                   QED_RSS_IPV6 |
+                                                   QED_RSS_IPV4_TCP |
+                                                   QED_RSS_IPV6_TCP;
+                       edev->rss_params_inited |= QEDE_RSS_CAPS_INITED;
+               }
+
+               memcpy(&vport_update_params.rss_params, &edev->rss_params,
+                      sizeof(vport_update_params.rss_params));
        } else {
-               memset(rss_params, 0, sizeof(*rss_params));
+               memset(&vport_update_params.rss_params, 0,
+                      sizeof(vport_update_params.rss_params));
        }
-       memcpy(&vport_update_params.rss_params, rss_params,
-              sizeof(*rss_params));
 
        rc = edev->ops->vport_update(cdev, &vport_update_params);
        if (rc) {
index 5c16241..4e5d5e9 100644 (file)
@@ -1045,7 +1045,7 @@ void ravb_modify(struct net_device *ndev, enum ravb_reg reg, u32 clear,
                 u32 set);
 int ravb_wait(struct net_device *ndev, enum ravb_reg reg, u32 mask, u32 value);
 
-irqreturn_t ravb_ptp_interrupt(struct net_device *ndev);
+void ravb_ptp_interrupt(struct net_device *ndev);
 void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev);
 void ravb_ptp_stop(struct net_device *ndev);
 
index 4b71951..0f1b314 100644 (file)
@@ -807,8 +807,10 @@ static irqreturn_t ravb_interrupt(int irq, void *dev_id)
        }
 
        /* gPTP interrupt status summary */
-       if ((iss & ISS_CGIS) && ravb_ptp_interrupt(ndev) == IRQ_HANDLED)
+       if (iss & ISS_CGIS) {
+               ravb_ptp_interrupt(ndev);
                result = IRQ_HANDLED;
+       }
 
        mmiowb();
        spin_unlock(&priv->lock);
@@ -838,8 +840,10 @@ static irqreturn_t ravb_multi_interrupt(int irq, void *dev_id)
        }
 
        /* gPTP interrupt status summary */
-       if ((iss & ISS_CGIS) && ravb_ptp_interrupt(ndev) == IRQ_HANDLED)
+       if (iss & ISS_CGIS) {
+               ravb_ptp_interrupt(ndev);
                result = IRQ_HANDLED;
+       }
 
        mmiowb();
        spin_unlock(&priv->lock);
index f1b2cbb..eede70e 100644 (file)
@@ -296,7 +296,7 @@ static const struct ptp_clock_info ravb_ptp_info = {
 };
 
 /* Caller must hold the lock */
-irqreturn_t ravb_ptp_interrupt(struct net_device *ndev)
+void ravb_ptp_interrupt(struct net_device *ndev)
 {
        struct ravb_private *priv = netdev_priv(ndev);
        u32 gis = ravb_read(ndev, GIS);
@@ -319,12 +319,7 @@ irqreturn_t ravb_ptp_interrupt(struct net_device *ndev)
                }
        }
 
-       if (gis) {
-               ravb_write(ndev, ~gis, GIS);
-               return IRQ_HANDLED;
-       }
-
-       return IRQ_NONE;
+       ravb_write(ndev, ~gis, GIS);
 }
 
 void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev)
index d4952c7..4ec7397 100644 (file)
@@ -254,14 +254,7 @@ static void dwmac4_rd_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
 {
        unsigned int tdes3 = p->des3;
 
-       if (unlikely(len > BUF_SIZE_16KiB)) {
-               p->des2 |= (((len - BUF_SIZE_16KiB) <<
-                            TDES2_BUFFER2_SIZE_MASK_SHIFT)
-                           & TDES2_BUFFER2_SIZE_MASK)
-                           | (BUF_SIZE_16KiB & TDES2_BUFFER1_SIZE_MASK);
-       } else {
-               p->des2 |= (len & TDES2_BUFFER1_SIZE_MASK);
-       }
+       p->des2 |= (len & TDES2_BUFFER1_SIZE_MASK);
 
        if (is_fs)
                tdes3 |= TDES3_FIRST_DESCRIPTOR;
index 42fdfd4..54bcc38 100644 (file)
@@ -381,7 +381,6 @@ struct cpsw_priv {
        u32                             coal_intvl;
        u32                             bus_freq_mhz;
        int                             rx_packet_max;
-       int                             host_port;
        struct clk                      *clk;
        u8                              mac_addr[ETH_ALEN];
        struct cpsw_slave               *slaves;
@@ -531,21 +530,18 @@ static const struct cpsw_stats cpsw_gstrings_stats[] = {
                        int slave_port = cpsw_get_slave_port(priv,      \
                                                slave->slave_num);      \
                        cpsw_ale_add_mcast(priv->ale, addr,             \
-                               1 << slave_port | 1 << priv->host_port, \
+                               1 << slave_port | ALE_PORT_HOST,        \
                                ALE_VLAN, slave->port_vlan, 0);         \
                } else {                                                \
                        cpsw_ale_add_mcast(priv->ale, addr,             \
-                               ALE_ALL_PORTS << priv->host_port,       \
+                               ALE_ALL_PORTS,                          \
                                0, 0, 0);                               \
                }                                                       \
        } while (0)
 
 static inline int cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num)
 {
-       if (priv->host_port == 0)
-               return slave_num + 1;
-       else
-               return slave_num;
+       return slave_num + 1;
 }
 
 static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
@@ -602,8 +598,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
                        cpsw_ale_control_set(ale, 0, ALE_AGEOUT, 1);
 
                        /* Clear all mcast from ALE */
-                       cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS <<
-                                                priv->host_port, -1);
+                       cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS, -1);
 
                        /* Flood All Unicast Packets to Host port */
                        cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1);
@@ -648,8 +643,7 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
        cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI);
 
        /* Clear all mcast from ALE */
-       cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port,
-                                vid);
+       cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS, vid);
 
        if (!netdev_mc_empty(ndev)) {
                struct netdev_hw_addr *ha;
@@ -1092,7 +1086,7 @@ static inline void cpsw_add_dual_emac_def_ale_entries(
                struct cpsw_priv *priv, struct cpsw_slave *slave,
                u32 slave_port)
 {
-       u32 port_mask = 1 << slave_port | 1 << priv->host_port;
+       u32 port_mask = 1 << slave_port | ALE_PORT_HOST;
 
        if (priv->version == CPSW_VERSION_1)
                slave_write(slave, slave->port_vlan, CPSW1_PORT_VLAN);
@@ -1103,7 +1097,7 @@ static inline void cpsw_add_dual_emac_def_ale_entries(
        cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
                           port_mask, ALE_VLAN, slave->port_vlan, 0);
        cpsw_ale_add_ucast(priv->ale, priv->mac_addr,
-               priv->host_port, ALE_VLAN | ALE_SECURE, slave->port_vlan);
+               HOST_PORT_NUM, ALE_VLAN | ALE_SECURE, slave->port_vlan);
 }
 
 static void soft_reset_slave(struct cpsw_slave *slave)
@@ -1172,7 +1166,6 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
 static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)
 {
        const int vlan = priv->data.default_vlan;
-       const int port = priv->host_port;
        u32 reg;
        int i;
        int unreg_mcast_mask;
@@ -1190,9 +1183,9 @@ static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)
        else
                unreg_mcast_mask = ALE_PORT_1 | ALE_PORT_2;
 
-       cpsw_ale_add_vlan(priv->ale, vlan, ALE_ALL_PORTS << port,
-                         ALE_ALL_PORTS << port, ALE_ALL_PORTS << port,
-                         unreg_mcast_mask << port);
+       cpsw_ale_add_vlan(priv->ale, vlan, ALE_ALL_PORTS,
+                         ALE_ALL_PORTS, ALE_ALL_PORTS,
+                         unreg_mcast_mask);
 }
 
 static void cpsw_init_host_port(struct cpsw_priv *priv)
@@ -1205,7 +1198,7 @@ static void cpsw_init_host_port(struct cpsw_priv *priv)
        cpsw_ale_start(priv->ale);
 
        /* switch to vlan unaware mode */
-       cpsw_ale_control_set(priv->ale, priv->host_port, ALE_VLAN_AWARE,
+       cpsw_ale_control_set(priv->ale, HOST_PORT_NUM, ALE_VLAN_AWARE,
                             CPSW_ALE_VLAN_AWARE);
        control_reg = readl(&priv->regs->control);
        control_reg |= CPSW_VLAN_AWARE;
@@ -1219,14 +1212,14 @@ static void cpsw_init_host_port(struct cpsw_priv *priv)
                     &priv->host_port_regs->cpdma_tx_pri_map);
        __raw_writel(0, &priv->host_port_regs->cpdma_rx_chan_map);
 
-       cpsw_ale_control_set(priv->ale, priv->host_port,
+       cpsw_ale_control_set(priv->ale, HOST_PORT_NUM,
                             ALE_PORT_STATE, ALE_PORT_STATE_FORWARD);
 
        if (!priv->data.dual_emac) {
-               cpsw_ale_add_ucast(priv->ale, priv->mac_addr, priv->host_port,
+               cpsw_ale_add_ucast(priv->ale, priv->mac_addr, HOST_PORT_NUM,
                                   0, 0);
                cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
-                                  1 << priv->host_port, 0, 0, ALE_MCAST_FWD_2);
+                                  ALE_PORT_HOST, 0, 0, ALE_MCAST_FWD_2);
        }
 }
 
@@ -1273,8 +1266,7 @@ static int cpsw_ndo_open(struct net_device *ndev)
                cpsw_add_default_vlan(priv);
        else
                cpsw_ale_add_vlan(priv->ale, priv->data.default_vlan,
-                                 ALE_ALL_PORTS << priv->host_port,
-                                 ALE_ALL_PORTS << priv->host_port, 0, 0);
+                                 ALE_ALL_PORTS, ALE_ALL_PORTS, 0, 0);
 
        if (!cpsw_common_res_usage_state(priv)) {
                struct cpsw_priv *priv_sl0 = cpsw_get_slave_priv(priv, 0);
@@ -1620,9 +1612,9 @@ static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p)
                flags = ALE_VLAN;
        }
 
-       cpsw_ale_del_ucast(priv->ale, priv->mac_addr, priv->host_port,
+       cpsw_ale_del_ucast(priv->ale, priv->mac_addr, HOST_PORT_NUM,
                           flags, vid);
-       cpsw_ale_add_ucast(priv->ale, addr->sa_data, priv->host_port,
+       cpsw_ale_add_ucast(priv->ale, addr->sa_data, HOST_PORT_NUM,
                           flags, vid);
 
        memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN);
@@ -1666,12 +1658,12 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv,
        }
 
        ret = cpsw_ale_add_vlan(priv->ale, vid, port_mask, 0, port_mask,
-                               unreg_mcast_mask << priv->host_port);
+                               unreg_mcast_mask);
        if (ret != 0)
                return ret;
 
        ret = cpsw_ale_add_ucast(priv->ale, priv->mac_addr,
-                                priv->host_port, ALE_VLAN, vid);
+                                HOST_PORT_NUM, ALE_VLAN, vid);
        if (ret != 0)
                goto clean_vid;
 
@@ -1683,7 +1675,7 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv,
 
 clean_vlan_ucast:
        cpsw_ale_del_ucast(priv->ale, priv->mac_addr,
-                           priv->host_port, ALE_VLAN, vid);
+                          HOST_PORT_NUM, ALE_VLAN, vid);
 clean_vid:
        cpsw_ale_del_vlan(priv->ale, vid, 0);
        return ret;
@@ -1738,7 +1730,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
                return ret;
 
        ret = cpsw_ale_del_ucast(priv->ale, priv->mac_addr,
-                                priv->host_port, ALE_VLAN, vid);
+                                HOST_PORT_NUM, ALE_VLAN, vid);
        if (ret != 0)
                return ret;
 
@@ -2152,7 +2144,6 @@ static int cpsw_probe_dual_emac(struct platform_device *pdev,
        priv_sl2->bus_freq_mhz = priv->bus_freq_mhz;
 
        priv_sl2->regs = priv->regs;
-       priv_sl2->host_port = priv->host_port;
        priv_sl2->host_port_regs = priv->host_port_regs;
        priv_sl2->wr_regs = priv->wr_regs;
        priv_sl2->hw_stats = priv->hw_stats;
@@ -2321,7 +2312,6 @@ static int cpsw_probe(struct platform_device *pdev)
                goto clean_runtime_disable_ret;
        }
        priv->regs = ss_regs;
-       priv->host_port = HOST_PORT_NUM;
 
        /* Need to enable clocks with runtime PM api to access module
         * registers
index 0ddb54f..061b4af 100644 (file)
@@ -1129,7 +1129,7 @@ static int fjes_probe(struct platform_device *plat_dev)
 
        res = platform_get_resource(plat_dev, IORESOURCE_MEM, 0);
        hw->hw_res.start = res->start;
-       hw->hw_res.size = res->end - res->start + 1;
+       hw->hw_res.size = resource_size(res);
        hw->hw_res.irq = platform_get_irq(plat_dev, 0);
        err = fjes_hw_init(&adapter->hw);
        if (err)
index 89154c0..b82e39d 100644 (file)
@@ -1030,6 +1030,7 @@ static int adf7242_hw_init(struct adf7242_local *lp)
        if (ret) {
                dev_err(&lp->spi->dev,
                        "upload firmware failed with %d\n", ret);
+               release_firmware(fw);
                return ret;
        }
 
@@ -1037,6 +1038,7 @@ static int adf7242_hw_init(struct adf7242_local *lp)
        if (ret) {
                dev_err(&lp->spi->dev,
                        "verify firmware failed with %d\n", ret);
+               release_firmware(fw);
                return ret;
        }
 
index 308ade0..5c81d6f 100644 (file)
@@ -45,13 +45,7 @@ static int mdio_mux_read(struct mii_bus *bus, int phy_id, int regnum)
        struct mdio_mux_parent_bus *pb = cb->parent;
        int r;
 
-       /* In theory multiple mdio_mux could be stacked, thus creating
-        * more than a single level of nesting.  But in practice,
-        * SINGLE_DEPTH_NESTING will cover the vast majority of use
-        * cases.  We use it, instead of trying to handle the general
-        * case.
-        */
-       mutex_lock_nested(&pb->mii_bus->mdio_lock, SINGLE_DEPTH_NESTING);
+       mutex_lock_nested(&pb->mii_bus->mdio_lock, MDIO_MUTEX_MUX);
        r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data);
        if (r)
                goto out;
@@ -76,7 +70,7 @@ static int mdio_mux_write(struct mii_bus *bus, int phy_id,
 
        int r;
 
-       mutex_lock_nested(&pb->mii_bus->mdio_lock, SINGLE_DEPTH_NESTING);
+       mutex_lock_nested(&pb->mii_bus->mdio_lock, MDIO_MUTEX_MUX);
        r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data);
        if (r)
                goto out;
index 0cba64f..751202a 100644 (file)
@@ -457,7 +457,7 @@ int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum)
 
        BUG_ON(in_interrupt());
 
-       mutex_lock_nested(&bus->mdio_lock, SINGLE_DEPTH_NESTING);
+       mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
        retval = bus->read(bus, addr, regnum);
        mutex_unlock(&bus->mdio_lock);
 
@@ -509,7 +509,7 @@ int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val)
 
        BUG_ON(in_interrupt());
 
-       mutex_lock_nested(&bus->mdio_lock, SINGLE_DEPTH_NESTING);
+       mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
        err = bus->write(bus, addr, regnum, val);
        mutex_unlock(&bus->mdio_lock);
 
index 9f36340..7f697a3 100644 (file)
@@ -1181,7 +1181,7 @@ out:
 }
 
 static bool vxlan_parse_gpe_hdr(struct vxlanhdr *unparsed,
-                               __be32 *protocol,
+                               __be16 *protocol,
                                struct sk_buff *skb, u32 vxflags)
 {
        struct vxlanhdr_gpe *gpe = (struct vxlanhdr_gpe *)unparsed;
@@ -1284,7 +1284,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
        struct vxlanhdr unparsed;
        struct vxlan_metadata _md;
        struct vxlan_metadata *md = &_md;
-       __be32 protocol = htons(ETH_P_TEB);
+       __be16 protocol = htons(ETH_P_TEB);
        bool raw_proto = false;
        void *oiph;
 
index 15f057e..70ecd82 100644 (file)
@@ -440,7 +440,7 @@ static void adm8211_interrupt_rci(struct ieee80211_hw *dev)
                        rx_status.rate_idx = rate;
 
                        rx_status.freq = adm8211_channels[priv->channel - 1].center_freq;
-                       rx_status.band = IEEE80211_BAND_2GHZ;
+                       rx_status.band = NL80211_BAND_2GHZ;
 
                        memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
                        ieee80211_rx_irqsafe(dev, skb);
@@ -1894,7 +1894,7 @@ static int adm8211_probe(struct pci_dev *pdev,
 
        priv->channel = 1;
 
-       dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+       dev->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
 
        err = ieee80211_register_hw(dev);
        if (err) {
index 3b343c6..8aded24 100644 (file)
@@ -1471,12 +1471,12 @@ static int ar5523_init_modes(struct ar5523 *ar)
        memcpy(ar->channels, ar5523_channels, sizeof(ar5523_channels));
        memcpy(ar->rates, ar5523_rates, sizeof(ar5523_rates));
 
-       ar->band.band = IEEE80211_BAND_2GHZ;
+       ar->band.band = NL80211_BAND_2GHZ;
        ar->band.channels = ar->channels;
        ar->band.n_channels = ARRAY_SIZE(ar5523_channels);
        ar->band.bitrates = ar->rates;
        ar->band.n_bitrates = ARRAY_SIZE(ar5523_rates);
-       ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &ar->band;
+       ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = &ar->band;
        return 0;
 }
 
index 65ef483..da7a7c8 100644 (file)
@@ -185,7 +185,7 @@ struct ath_common {
        bool bt_ant_diversity;
 
        int last_rssi;
-       struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
 };
 
 static inline const struct ath_ps_ops *ath_ps_ops(struct ath_common *common)
index f3553dc..1379054 100644 (file)
@@ -782,7 +782,7 @@ struct ath10k {
        } scan;
 
        struct {
-               struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
+               struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
        } mac;
 
        /* should never be NULL; needed for regular htt rx */
index 5b777c2..cc979a4 100644 (file)
@@ -2182,9 +2182,9 @@ static void ath10k_htt_rx_tx_mode_switch_ind(struct ath10k *ar,
        ath10k_mac_tx_push_pending(ar);
 }
 
-static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)
+static inline enum nl80211_band phy_mode_to_band(u32 phy_mode)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        switch (phy_mode) {
        case MODE_11A:
@@ -2193,7 +2193,7 @@ static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)
        case MODE_11AC_VHT20:
        case MODE_11AC_VHT40:
        case MODE_11AC_VHT80:
-               band = IEEE80211_BAND_5GHZ;
+               band = NL80211_BAND_5GHZ;
                break;
        case MODE_11G:
        case MODE_11B:
@@ -2204,7 +2204,7 @@ static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)
        case MODE_11AC_VHT40_2G:
        case MODE_11AC_VHT80_2G:
        default:
-               band = IEEE80211_BAND_2GHZ;
+               band = NL80211_BAND_2GHZ;
        }
 
        return band;
index 67cf004..0e24f9e 100644 (file)
@@ -502,7 +502,7 @@ chan_to_phymode(const struct cfg80211_chan_def *chandef)
        enum wmi_phy_mode phymode = MODE_UNKNOWN;
 
        switch (chandef->chan->band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                switch (chandef->width) {
                case NL80211_CHAN_WIDTH_20_NOHT:
                        if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM)
@@ -525,7 +525,7 @@ chan_to_phymode(const struct cfg80211_chan_def *chandef)
                        break;
                }
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                switch (chandef->width) {
                case NL80211_CHAN_WIDTH_20_NOHT:
                        phymode = MODE_11A;
@@ -2076,7 +2076,7 @@ static void ath10k_peer_assoc_h_rates(struct ath10k *ar,
        struct cfg80211_chan_def def;
        const struct ieee80211_supported_band *sband;
        const struct ieee80211_rate *rates;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u32 ratemask;
        u8 rate;
        int i;
@@ -2136,7 +2136,7 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
        const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
        struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
        struct cfg80211_chan_def def;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        const u8 *ht_mcs_mask;
        const u16 *vht_mcs_mask;
        int i, n;
@@ -2360,7 +2360,7 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
        const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
        struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
        struct cfg80211_chan_def def;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        const u16 *vht_mcs_mask;
        u8 ampdu_factor;
 
@@ -2378,7 +2378,7 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
 
        arg->peer_flags |= ar->wmi.peer_flags->vht;
 
-       if (def.chan->band == IEEE80211_BAND_2GHZ)
+       if (def.chan->band == NL80211_BAND_2GHZ)
                arg->peer_flags |= ar->wmi.peer_flags->vht_2g;
 
        arg->peer_vht_caps = vht_cap->cap;
@@ -2447,7 +2447,7 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
 
 static bool ath10k_mac_sta_has_ofdm_only(struct ieee80211_sta *sta)
 {
-       return sta->supp_rates[IEEE80211_BAND_2GHZ] >>
+       return sta->supp_rates[NL80211_BAND_2GHZ] >>
               ATH10K_MAC_FIRST_OFDM_RATE_IDX;
 }
 
@@ -2458,7 +2458,7 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
 {
        struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
        struct cfg80211_chan_def def;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        const u8 *ht_mcs_mask;
        const u16 *vht_mcs_mask;
        enum wmi_phy_mode phymode = MODE_UNKNOWN;
@@ -2471,7 +2471,7 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
        vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs;
 
        switch (band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                if (sta->vht_cap.vht_supported &&
                    !ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) {
                        if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
@@ -2491,7 +2491,7 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
                }
 
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                /*
                 * Check VHT first.
                 */
@@ -2869,7 +2869,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
 {
        struct ieee80211_hw *hw = ar->hw;
        struct ieee80211_supported_band **bands;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_channel *channel;
        struct wmi_scan_chan_list_arg arg = {0};
        struct wmi_channel_arg *ch;
@@ -2881,7 +2881,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
        lockdep_assert_held(&ar->conf_mutex);
 
        bands = hw->wiphy->bands;
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                if (!bands[band])
                        continue;
 
@@ -2900,7 +2900,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
                return -ENOMEM;
 
        ch = arg.channels;
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                if (!bands[band])
                        continue;
 
@@ -2938,7 +2938,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
                        /* FIXME: why use only legacy modes, why not any
                         * HT/VHT modes? Would that even make any
                         * difference? */
-                       if (channel->band == IEEE80211_BAND_2GHZ)
+                       if (channel->band == NL80211_BAND_2GHZ)
                                ch->mode = MODE_11G;
                        else
                                ch->mode = MODE_11A;
@@ -4276,14 +4276,14 @@ static void ath10k_mac_setup_ht_vht_cap(struct ath10k *ar)
        vht_cap = ath10k_create_vht_cap(ar);
 
        if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
-               band = &ar->mac.sbands[IEEE80211_BAND_2GHZ];
+               band = &ar->mac.sbands[NL80211_BAND_2GHZ];
                band->ht_cap = ht_cap;
 
                /* Enable the VHT support at 2.4 GHz */
                band->vht_cap = vht_cap;
        }
        if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
-               band = &ar->mac.sbands[IEEE80211_BAND_5GHZ];
+               band = &ar->mac.sbands[NL80211_BAND_5GHZ];
                band->ht_cap = ht_cap;
                band->vht_cap = vht_cap;
        }
@@ -5618,7 +5618,7 @@ static void ath10k_sta_rc_update_wk(struct work_struct *wk)
        struct ath10k_sta *arsta;
        struct ieee80211_sta *sta;
        struct cfg80211_chan_def def;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        const u8 *ht_mcs_mask;
        const u16 *vht_mcs_mask;
        u32 changed, bw, nss, smps;
@@ -6417,14 +6417,14 @@ static int ath10k_get_survey(struct ieee80211_hw *hw, int idx,
 
        mutex_lock(&ar->conf_mutex);
 
-       sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ];
+       sband = hw->wiphy->bands[NL80211_BAND_2GHZ];
        if (sband && idx >= sband->n_channels) {
                idx -= sband->n_channels;
                sband = NULL;
        }
 
        if (!sband)
-               sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ];
+               sband = hw->wiphy->bands[NL80211_BAND_5GHZ];
 
        if (!sband || idx >= sband->n_channels) {
                ret = -ENOENT;
@@ -6447,7 +6447,7 @@ exit:
 
 static bool
 ath10k_mac_bitrate_mask_has_single_rate(struct ath10k *ar,
-                                       enum ieee80211_band band,
+                                       enum nl80211_band band,
                                        const struct cfg80211_bitrate_mask *mask)
 {
        int num_rates = 0;
@@ -6466,7 +6466,7 @@ ath10k_mac_bitrate_mask_has_single_rate(struct ath10k *ar,
 
 static bool
 ath10k_mac_bitrate_mask_get_single_nss(struct ath10k *ar,
-                                      enum ieee80211_band band,
+                                      enum nl80211_band band,
                                       const struct cfg80211_bitrate_mask *mask,
                                       int *nss)
 {
@@ -6515,7 +6515,7 @@ ath10k_mac_bitrate_mask_get_single_nss(struct ath10k *ar,
 
 static int
 ath10k_mac_bitrate_mask_get_single_rate(struct ath10k *ar,
-                                       enum ieee80211_band band,
+                                       enum nl80211_band band,
                                        const struct cfg80211_bitrate_mask *mask,
                                        u8 *rate, u8 *nss)
 {
@@ -6616,7 +6616,7 @@ static int ath10k_mac_set_fixed_rate_params(struct ath10k_vif *arvif,
 
 static bool
 ath10k_mac_can_set_bitrate_mask(struct ath10k *ar,
-                               enum ieee80211_band band,
+                               enum nl80211_band band,
                                const struct cfg80211_bitrate_mask *mask)
 {
        int i;
@@ -6668,7 +6668,7 @@ static int ath10k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
        struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
        struct cfg80211_chan_def def;
        struct ath10k *ar = arvif->ar;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        const u8 *ht_mcs_mask;
        const u16 *vht_mcs_mask;
        u8 rate;
@@ -7331,7 +7331,7 @@ static const struct ieee80211_ops ath10k_ops = {
 };
 
 #define CHAN2G(_channel, _freq, _flags) { \
-       .band                   = IEEE80211_BAND_2GHZ, \
+       .band                   = NL80211_BAND_2GHZ, \
        .hw_value               = (_channel), \
        .center_freq            = (_freq), \
        .flags                  = (_flags), \
@@ -7340,7 +7340,7 @@ static const struct ieee80211_ops ath10k_ops = {
 }
 
 #define CHAN5G(_channel, _freq, _flags) { \
-       .band                   = IEEE80211_BAND_5GHZ, \
+       .band                   = NL80211_BAND_5GHZ, \
        .hw_value               = (_channel), \
        .center_freq            = (_freq), \
        .flags                  = (_flags), \
@@ -7660,13 +7660,13 @@ int ath10k_mac_register(struct ath10k *ar)
                        goto err_free;
                }
 
-               band = &ar->mac.sbands[IEEE80211_BAND_2GHZ];
+               band = &ar->mac.sbands[NL80211_BAND_2GHZ];
                band->n_channels = ARRAY_SIZE(ath10k_2ghz_channels);
                band->channels = channels;
                band->n_bitrates = ath10k_g_rates_size;
                band->bitrates = ath10k_g_rates;
 
-               ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = band;
+               ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band;
        }
 
        if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
@@ -7678,12 +7678,12 @@ int ath10k_mac_register(struct ath10k *ar)
                        goto err_free;
                }
 
-               band = &ar->mac.sbands[IEEE80211_BAND_5GHZ];
+               band = &ar->mac.sbands[NL80211_BAND_5GHZ];
                band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
                band->channels = channels;
                band->n_bitrates = ath10k_a_rates_size;
                band->bitrates = ath10k_a_rates;
-               ar->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = band;
+               ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band;
        }
 
        ath10k_mac_setup_ht_vht_cap(ar);
@@ -7871,8 +7871,8 @@ err_dfs_detector_exit:
                ar->dfs_detector->exit(ar->dfs_detector);
 
 err_free:
-       kfree(ar->mac.sbands[IEEE80211_BAND_2GHZ].channels);
-       kfree(ar->mac.sbands[IEEE80211_BAND_5GHZ].channels);
+       kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
+       kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);
 
        SET_IEEE80211_DEV(ar->hw, NULL);
        return ret;
@@ -7885,8 +7885,8 @@ void ath10k_mac_unregister(struct ath10k *ar)
        if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector)
                ar->dfs_detector->exit(ar->dfs_detector);
 
-       kfree(ar->mac.sbands[IEEE80211_BAND_2GHZ].channels);
-       kfree(ar->mac.sbands[IEEE80211_BAND_5GHZ].channels);
+       kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
+       kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);
 
        SET_IEEE80211_DEV(ar->hw, NULL);
 }
index a1afb2e..621019f 100644 (file)
@@ -2286,9 +2286,9 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
         * of mgmt rx.
         */
        if (channel >= 1 && channel <= 14) {
-               status->band = IEEE80211_BAND_2GHZ;
+               status->band = NL80211_BAND_2GHZ;
        } else if (channel >= 36 && channel <= 165) {
-               status->band = IEEE80211_BAND_5GHZ;
+               status->band = NL80211_BAND_5GHZ;
        } else {
                /* Shouldn't happen unless list of advertised channels to
                 * mac80211 has been changed.
@@ -2298,7 +2298,7 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
                return 0;
        }
 
-       if (phy_mode == MODE_11B && status->band == IEEE80211_BAND_5GHZ)
+       if (phy_mode == MODE_11B && status->band == NL80211_BAND_5GHZ)
                ath10k_dbg(ar, ATH10K_DBG_MGMT, "wmi mgmt rx 11b (CCK) on 5GHz\n");
 
        sband = &ar->mac.sbands[status->band];
@@ -2357,7 +2357,7 @@ static int freq_to_idx(struct ath10k *ar, int freq)
        struct ieee80211_supported_band *sband;
        int band, ch, idx = 0;
 
-       for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
                sband = ar->hw->wiphy->bands[band];
                if (!sband)
                        continue;
index 38be270..0624333 100644 (file)
@@ -279,7 +279,7 @@ ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,
                if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL)
                        ath5k_ani_set_firstep_level(ah, as->firstep_level + 1);
                return;
-       } else if (ah->ah_current_channel->band == IEEE80211_BAND_2GHZ) {
+       } else if (ah->ah_current_channel->band == NL80211_BAND_2GHZ) {
                /* beacon RSSI is low. in B/G mode turn of OFDM weak signal
                 * detect and zero firstep level to maximize CCK sensitivity */
                ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
index ba12f7f..67fedb6 100644 (file)
@@ -1265,10 +1265,10 @@ struct ath5k_hw {
        void __iomem            *iobase;        /* address of the device */
        struct mutex            lock;           /* dev-level lock */
        struct ieee80211_hw     *hw;            /* IEEE 802.11 common */
-       struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
        struct ieee80211_channel channels[ATH_CHAN_MAX];
-       struct ieee80211_rate   rates[IEEE80211_NUM_BANDS][AR5K_MAX_RATES];
-       s8                      rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_RATES];
+       struct ieee80211_rate   rates[NUM_NL80211_BANDS][AR5K_MAX_RATES];
+       s8                      rate_idx[NUM_NL80211_BANDS][AR5K_MAX_RATES];
        enum nl80211_iftype     opmode;
 
 #ifdef CONFIG_ATH5K_DEBUG
@@ -1532,7 +1532,7 @@ int ath5k_eeprom_mode_from_channel(struct ath5k_hw *ah,
 
 /* Protocol Control Unit Functions */
 /* Helpers */
-int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum ieee80211_band band,
+int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum nl80211_band band,
                int len, struct ieee80211_rate *rate, bool shortpre);
 unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah);
 unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah);
@@ -1611,7 +1611,7 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel);
 
 /* PHY functions */
 /* Misc PHY functions */
-u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, enum ieee80211_band band);
+u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, enum nl80211_band band);
 int ath5k_hw_phy_disable(struct ath5k_hw *ah);
 /* Gain_F optimization */
 enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah);
index 66b6366..233054b 100644 (file)
@@ -152,7 +152,7 @@ int ath5k_hw_init(struct ath5k_hw *ah)
        ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
                        0xffffffff;
        ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
-                       IEEE80211_BAND_5GHZ);
+                       NL80211_BAND_5GHZ);
 
        /* Try to identify radio chip based on its srev */
        switch (ah->ah_radio_5ghz_revision & 0xf0) {
@@ -160,14 +160,14 @@ int ath5k_hw_init(struct ath5k_hw *ah)
                ah->ah_radio = AR5K_RF5111;
                ah->ah_single_chip = false;
                ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
-                                                       IEEE80211_BAND_2GHZ);
+                                                       NL80211_BAND_2GHZ);
                break;
        case AR5K_SREV_RAD_5112:
        case AR5K_SREV_RAD_2112:
                ah->ah_radio = AR5K_RF5112;
                ah->ah_single_chip = false;
                ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
-                                                       IEEE80211_BAND_2GHZ);
+                                                       NL80211_BAND_2GHZ);
                break;
        case AR5K_SREV_RAD_2413:
                ah->ah_radio = AR5K_RF2413;
@@ -204,7 +204,7 @@ int ath5k_hw_init(struct ath5k_hw *ah)
                        ah->ah_radio = AR5K_RF5111;
                        ah->ah_single_chip = false;
                        ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
-                                                       IEEE80211_BAND_2GHZ);
+                                                       NL80211_BAND_2GHZ);
                } else if (ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4) ||
                           ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4) ||
                           ah->ah_phy_revision == AR5K_SREV_PHY_2425) {
index 3d946d8..d98fd42 100644 (file)
@@ -268,15 +268,15 @@ static void ath5k_reg_notifier(struct wiphy *wiphy,
  * Returns true for the channel numbers used.
  */
 #ifdef CONFIG_ATH5K_TEST_CHANNELS
-static bool ath5k_is_standard_channel(short chan, enum ieee80211_band band)
+static bool ath5k_is_standard_channel(short chan, enum nl80211_band band)
 {
        return true;
 }
 
 #else
-static bool ath5k_is_standard_channel(short chan, enum ieee80211_band band)
+static bool ath5k_is_standard_channel(short chan, enum nl80211_band band)
 {
-       if (band == IEEE80211_BAND_2GHZ && chan <= 14)
+       if (band == NL80211_BAND_2GHZ && chan <= 14)
                return true;
 
        return  /* UNII 1,2 */
@@ -297,18 +297,18 @@ ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,
                unsigned int mode, unsigned int max)
 {
        unsigned int count, size, freq, ch;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        switch (mode) {
        case AR5K_MODE_11A:
                /* 1..220, but 2GHz frequencies are filtered by check_channel */
                size = 220;
-               band = IEEE80211_BAND_5GHZ;
+               band = NL80211_BAND_5GHZ;
                break;
        case AR5K_MODE_11B:
        case AR5K_MODE_11G:
                size = 26;
-               band = IEEE80211_BAND_2GHZ;
+               band = NL80211_BAND_2GHZ;
                break;
        default:
                ATH5K_WARN(ah, "bad mode, not copying channels\n");
@@ -363,13 +363,13 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
        int max_c, count_c = 0;
        int i;
 
-       BUILD_BUG_ON(ARRAY_SIZE(ah->sbands) < IEEE80211_NUM_BANDS);
+       BUILD_BUG_ON(ARRAY_SIZE(ah->sbands) < NUM_NL80211_BANDS);
        max_c = ARRAY_SIZE(ah->channels);
 
        /* 2GHz band */
-       sband = &ah->sbands[IEEE80211_BAND_2GHZ];
-       sband->band = IEEE80211_BAND_2GHZ;
-       sband->bitrates = &ah->rates[IEEE80211_BAND_2GHZ][0];
+       sband = &ah->sbands[NL80211_BAND_2GHZ];
+       sband->band = NL80211_BAND_2GHZ;
+       sband->bitrates = &ah->rates[NL80211_BAND_2GHZ][0];
 
        if (test_bit(AR5K_MODE_11G, ah->ah_capabilities.cap_mode)) {
                /* G mode */
@@ -381,7 +381,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
                sband->n_channels = ath5k_setup_channels(ah, sband->channels,
                                        AR5K_MODE_11G, max_c);
 
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
+               hw->wiphy->bands[NL80211_BAND_2GHZ] = sband;
                count_c = sband->n_channels;
                max_c -= count_c;
        } else if (test_bit(AR5K_MODE_11B, ah->ah_capabilities.cap_mode)) {
@@ -407,7 +407,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
                sband->n_channels = ath5k_setup_channels(ah, sband->channels,
                                        AR5K_MODE_11B, max_c);
 
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
+               hw->wiphy->bands[NL80211_BAND_2GHZ] = sband;
                count_c = sband->n_channels;
                max_c -= count_c;
        }
@@ -415,9 +415,9 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
 
        /* 5GHz band, A mode */
        if (test_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode)) {
-               sband = &ah->sbands[IEEE80211_BAND_5GHZ];
-               sband->band = IEEE80211_BAND_5GHZ;
-               sband->bitrates = &ah->rates[IEEE80211_BAND_5GHZ][0];
+               sband = &ah->sbands[NL80211_BAND_5GHZ];
+               sband->band = NL80211_BAND_5GHZ;
+               sband->bitrates = &ah->rates[NL80211_BAND_5GHZ][0];
 
                memcpy(sband->bitrates, &ath5k_rates[4],
                       sizeof(struct ieee80211_rate) * 8);
@@ -427,7 +427,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
                sband->n_channels = ath5k_setup_channels(ah, sband->channels,
                                        AR5K_MODE_11A, max_c);
 
-               hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
+               hw->wiphy->bands[NL80211_BAND_5GHZ] = sband;
        }
        ath5k_setup_rate_idx(ah, sband);
 
index 654a1e3..929d7cc 100644 (file)
@@ -1043,14 +1043,14 @@ ath5k_debug_dump_bands(struct ath5k_hw *ah)
 
        BUG_ON(!ah->sbands);
 
-       for (b = 0; b < IEEE80211_NUM_BANDS; b++) {
+       for (b = 0; b < NUM_NL80211_BANDS; b++) {
                struct ieee80211_supported_band *band = &ah->sbands[b];
                char bname[6];
                switch (band->band) {
-               case IEEE80211_BAND_2GHZ:
+               case NL80211_BAND_2GHZ:
                        strcpy(bname, "2 GHz");
                        break;
-               case IEEE80211_BAND_5GHZ:
+               case NL80211_BAND_5GHZ:
                        strcpy(bname, "5 GHz");
                        break;
                default:
index bf29da5..fc47b70 100644 (file)
@@ -110,7 +110,7 @@ static const unsigned int ack_rates_high[] =
  * bwmodes.
  */
 int
-ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum ieee80211_band band,
+ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum nl80211_band band,
                int len, struct ieee80211_rate *rate, bool shortpre)
 {
        int sifs, preamble, plcp_bits, sym_time;
@@ -221,7 +221,7 @@ ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
        case AR5K_BWMODE_DEFAULT:
                sifs = AR5K_INIT_SIFS_DEFAULT_BG;
        default:
-               if (channel->band == IEEE80211_BAND_5GHZ)
+               if (channel->band == NL80211_BAND_5GHZ)
                        sifs = AR5K_INIT_SIFS_DEFAULT_A;
                break;
        }
@@ -279,7 +279,7 @@ ath5k_hw_write_rate_duration(struct ath5k_hw *ah)
        struct ieee80211_rate *rate;
        unsigned int i;
        /* 802.11g covers both OFDM and CCK */
-       u8 band = IEEE80211_BAND_2GHZ;
+       u8 band = NL80211_BAND_2GHZ;
 
        /* Write rate duration table */
        for (i = 0; i < ah->sbands[band].n_bitrates; i++) {
index 98ee854..641b13a 100644 (file)
 /**
  * ath5k_hw_radio_revision() - Get the PHY Chip revision
  * @ah: The &struct ath5k_hw
- * @band: One of enum ieee80211_band
+ * @band: One of enum nl80211_band
  *
  * Returns the revision number of a 2GHz, 5GHz or single chip
  * radio.
  */
 u16
-ath5k_hw_radio_revision(struct ath5k_hw *ah, enum ieee80211_band band)
+ath5k_hw_radio_revision(struct ath5k_hw *ah, enum nl80211_band band)
 {
        unsigned int i;
        u32 srev;
@@ -91,10 +91,10 @@ ath5k_hw_radio_revision(struct ath5k_hw *ah, enum ieee80211_band band)
         * Set the radio chip access register
         */
        switch (band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_2GHZ, AR5K_PHY(0));
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0));
                break;
        default:
@@ -138,11 +138,11 @@ ath5k_channel_ok(struct ath5k_hw *ah, struct ieee80211_channel *channel)
        u16 freq = channel->center_freq;
 
        /* Check if the channel is in our supported range */
-       if (channel->band == IEEE80211_BAND_2GHZ) {
+       if (channel->band == NL80211_BAND_2GHZ) {
                if ((freq >= ah->ah_capabilities.cap_range.range_2ghz_min) &&
                    (freq <= ah->ah_capabilities.cap_range.range_2ghz_max))
                        return true;
-       } else if (channel->band == IEEE80211_BAND_5GHZ)
+       } else if (channel->band == NL80211_BAND_5GHZ)
                if ((freq >= ah->ah_capabilities.cap_range.range_5ghz_min) &&
                    (freq <= ah->ah_capabilities.cap_range.range_5ghz_max))
                        return true;
@@ -743,7 +743,7 @@ done:
 /**
  * ath5k_hw_rfgain_init() - Write initial RF gain settings to hw
  * @ah: The &struct ath5k_hw
- * @band: One of enum ieee80211_band
+ * @band: One of enum nl80211_band
  *
  * Write initial RF gain table to set the RF sensitivity.
  *
@@ -751,7 +751,7 @@ done:
  * with Gain_F calibration
  */
 static int
-ath5k_hw_rfgain_init(struct ath5k_hw *ah, enum ieee80211_band band)
+ath5k_hw_rfgain_init(struct ath5k_hw *ah, enum nl80211_band band)
 {
        const struct ath5k_ini_rfgain *ath5k_rfg;
        unsigned int i, size, index;
@@ -786,7 +786,7 @@ ath5k_hw_rfgain_init(struct ath5k_hw *ah, enum ieee80211_band band)
                return -EINVAL;
        }
 
-       index = (band == IEEE80211_BAND_2GHZ) ? 1 : 0;
+       index = (band == NL80211_BAND_2GHZ) ? 1 : 0;
 
        for (i = 0; i < size; i++) {
                AR5K_REG_WAIT(i);
@@ -917,7 +917,7 @@ ath5k_hw_rfregs_init(struct ath5k_hw *ah,
        }
 
        /* Set Output and Driver bias current (OB/DB) */
-       if (channel->band == IEEE80211_BAND_2GHZ) {
+       if (channel->band == NL80211_BAND_2GHZ) {
 
                if (channel->hw_value == AR5K_MODE_11B)
                        ee_mode = AR5K_EEPROM_MODE_11B;
@@ -944,7 +944,7 @@ ath5k_hw_rfregs_init(struct ath5k_hw *ah,
                                                AR5K_RF_DB_2GHZ, true);
 
        /* RF5111 always needs OB/DB for 5GHz, even if we use 2GHz */
-       } else if ((channel->band == IEEE80211_BAND_5GHZ) ||
+       } else if ((channel->band == NL80211_BAND_5GHZ) ||
                        (ah->ah_radio == AR5K_RF5111)) {
 
                /* For 11a, Turbo and XR we need to choose
@@ -1145,7 +1145,7 @@ ath5k_hw_rfregs_init(struct ath5k_hw *ah,
        }
 
        if (ah->ah_radio == AR5K_RF5413 &&
-       channel->band == IEEE80211_BAND_2GHZ) {
+       channel->band == NL80211_BAND_2GHZ) {
 
                ath5k_hw_rfb_op(ah, rf_regs, 1, AR5K_RF_DERBY_CHAN_SEL_MODE,
                                                                        true);
@@ -1270,7 +1270,7 @@ ath5k_hw_rf5111_channel(struct ath5k_hw *ah,
         */
        data0 = data1 = 0;
 
-       if (channel->band == IEEE80211_BAND_2GHZ) {
+       if (channel->band == NL80211_BAND_2GHZ) {
                /* Map 2GHz channel to 5GHz Atheros channel ID */
                ret = ath5k_hw_rf5111_chan2athchan(
                        ieee80211_frequency_to_channel(channel->center_freq),
@@ -1919,7 +1919,7 @@ ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah,
        /* Convert current frequency to fbin value (the same way channels
         * are stored on EEPROM, check out ath5k_eeprom_bin2freq) and scale
         * up by 2 so we can compare it later */
-       if (channel->band == IEEE80211_BAND_2GHZ) {
+       if (channel->band == NL80211_BAND_2GHZ) {
                chan_fbin = (channel->center_freq - 2300) * 10;
                freq_band = AR5K_EEPROM_BAND_2GHZ;
        } else {
@@ -1983,7 +1983,7 @@ ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah,
                        symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 4;
                        break;
                default:
-                       if (channel->band == IEEE80211_BAND_5GHZ) {
+                       if (channel->band == NL80211_BAND_5GHZ) {
                                /* Both sample_freq and chip_freq are 40MHz */
                                spur_delta_phase = (spur_offset << 17) / 25;
                                spur_freq_sigma_delta =
index ddaad71..beda11c 100644 (file)
@@ -559,7 +559,7 @@ ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
 int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time)
 {
        struct ieee80211_channel *channel = ah->ah_current_channel;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        struct ieee80211_rate *rate;
        u32 ack_tx_time, eifs, eifs_clock, sifs, sifs_clock;
@@ -596,10 +596,10 @@ int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time)
         *
         * Also we have different lowest rate for 802.11a
         */
-       if (channel->band == IEEE80211_BAND_5GHZ)
-               band = IEEE80211_BAND_5GHZ;
+       if (channel->band == NL80211_BAND_5GHZ)
+               band = NL80211_BAND_5GHZ;
        else
-               band = IEEE80211_BAND_2GHZ;
+               band = NL80211_BAND_2GHZ;
 
        switch (ah->ah_bwmode) {
        case AR5K_BWMODE_5MHZ:
index 4b1c87f..56d7925 100644 (file)
@@ -752,7 +752,7 @@ ath5k_hw_nic_wakeup(struct ath5k_hw *ah, struct ieee80211_channel *channel)
                        clock = AR5K_PHY_PLL_RF5111;            /*Zero*/
                }
 
-               if (channel->band == IEEE80211_BAND_2GHZ) {
+               if (channel->band == NL80211_BAND_2GHZ) {
                        mode |= AR5K_PHY_MODE_FREQ_2GHZ;
                        clock |= AR5K_PHY_PLL_44MHZ;
 
@@ -771,7 +771,7 @@ ath5k_hw_nic_wakeup(struct ath5k_hw *ah, struct ieee80211_channel *channel)
                                else
                                        mode |= AR5K_PHY_MODE_MOD_DYN;
                        }
-               } else if (channel->band == IEEE80211_BAND_5GHZ) {
+               } else if (channel->band == NL80211_BAND_5GHZ) {
                        mode |= (AR5K_PHY_MODE_FREQ_5GHZ |
                                 AR5K_PHY_MODE_MOD_OFDM);
 
@@ -906,7 +906,7 @@ ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
                u32 data;
                ath5k_hw_reg_write(ah, AR5K_PHY_CCKTXCTL_WORLD,
                                AR5K_PHY_CCKTXCTL);
-               if (channel->band == IEEE80211_BAND_5GHZ)
+               if (channel->band == NL80211_BAND_5GHZ)
                        data = 0xffb81020;
                else
                        data = 0xffb80d20;
index 7f3f94f..4e11ba0 100644 (file)
@@ -34,7 +34,7 @@
 }
 
 #define CHAN2G(_channel, _freq, _flags) {   \
-       .band           = IEEE80211_BAND_2GHZ,  \
+       .band           = NL80211_BAND_2GHZ,  \
        .hw_value       = (_channel),           \
        .center_freq    = (_freq),              \
        .flags          = (_flags),             \
@@ -43,7 +43,7 @@
 }
 
 #define CHAN5G(_channel, _flags) {                 \
-       .band           = IEEE80211_BAND_5GHZ,      \
+       .band           = NL80211_BAND_5GHZ,      \
        .hw_value       = (_channel),               \
        .center_freq    = 5000 + (5 * (_channel)),  \
        .flags          = (_flags),                 \
@@ -2583,7 +2583,7 @@ void ath6kl_check_wow_status(struct ath6kl *ar)
 }
 #endif
 
-static int ath6kl_set_htcap(struct ath6kl_vif *vif, enum ieee80211_band band,
+static int ath6kl_set_htcap(struct ath6kl_vif *vif, enum nl80211_band band,
                            bool ht_enable)
 {
        struct ath6kl_htcap *htcap = &vif->htcap[band];
@@ -2594,7 +2594,7 @@ static int ath6kl_set_htcap(struct ath6kl_vif *vif, enum ieee80211_band band,
        if (ht_enable) {
                /* Set default ht capabilities */
                htcap->ht_enable = true;
-               htcap->cap_info = (band == IEEE80211_BAND_2GHZ) ?
+               htcap->cap_info = (band == NL80211_BAND_2GHZ) ?
                                   ath6kl_g_htcap : ath6kl_a_htcap;
                htcap->ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K;
        } else /* Disable ht */
@@ -2609,7 +2609,7 @@ static int ath6kl_restore_htcap(struct ath6kl_vif *vif)
        struct wiphy *wiphy = vif->ar->wiphy;
        int band, ret = 0;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                if (!wiphy->bands[band])
                        continue;
 
@@ -3530,7 +3530,7 @@ static void ath6kl_cfg80211_reg_notify(struct wiphy *wiphy,
                                       struct regulatory_request *request)
 {
        struct ath6kl *ar = wiphy_priv(wiphy);
-       u32 rates[IEEE80211_NUM_BANDS];
+       u32 rates[NUM_NL80211_BANDS];
        int ret, i;
 
        ath6kl_dbg(ATH6KL_DBG_WLAN_CFG,
@@ -3555,7 +3555,7 @@ static void ath6kl_cfg80211_reg_notify(struct wiphy *wiphy,
         * changed.
         */
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++)
+       for (i = 0; i < NUM_NL80211_BANDS; i++)
                if (wiphy->bands[i])
                        rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
 
@@ -3791,8 +3791,8 @@ struct wireless_dev *ath6kl_interface_add(struct ath6kl *ar, const char *name,
        vif->listen_intvl_t = ATH6KL_DEFAULT_LISTEN_INTVAL;
        vif->bmiss_time_t = ATH6KL_DEFAULT_BMISS_TIME;
        vif->bg_scan_period = 0;
-       vif->htcap[IEEE80211_BAND_2GHZ].ht_enable = true;
-       vif->htcap[IEEE80211_BAND_5GHZ].ht_enable = true;
+       vif->htcap[NL80211_BAND_2GHZ].ht_enable = true;
+       vif->htcap[NL80211_BAND_5GHZ].ht_enable = true;
 
        memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN);
        if (fw_vif_idx != 0) {
@@ -3943,9 +3943,9 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
        wiphy->available_antennas_rx = ar->hw.rx_ant;
 
        if (band_2gig)
-               wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz;
+               wiphy->bands[NL80211_BAND_2GHZ] = &ath6kl_band_2ghz;
        if (band_5gig)
-               wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz;
+               wiphy->bands[NL80211_BAND_5GHZ] = &ath6kl_band_5ghz;
 
        wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
 
index 5f3acfe..713a571 100644 (file)
@@ -623,7 +623,7 @@ struct ath6kl_vif {
        struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1];
        struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1];
        struct aggr_info *aggr_cntxt;
-       struct ath6kl_htcap htcap[IEEE80211_NUM_BANDS];
+       struct ath6kl_htcap htcap[NUM_NL80211_BANDS];
 
        struct timer_list disconnect_timer;
        struct timer_list sched_scan_timer;
index 0b3e9c0..631c3a0 100644 (file)
@@ -2048,7 +2048,7 @@ int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx,
        sc->no_cck = cpu_to_le32(no_cck);
        sc->num_ch = num_chan;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                sband = ar->wiphy->bands[band];
 
                if (!sband)
@@ -2770,10 +2770,10 @@ static int ath6kl_set_bitrate_mask64(struct wmi *wmi, u8 if_idx,
        memset(&ratemask, 0, sizeof(ratemask));
 
        /* only check 2.4 and 5 GHz bands, skip the rest */
-       for (band = 0; band <= IEEE80211_BAND_5GHZ; band++) {
+       for (band = 0; band <= NL80211_BAND_5GHZ; band++) {
                /* copy legacy rate mask */
                ratemask[band] = mask->control[band].legacy;
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        ratemask[band] =
                                mask->control[band].legacy << 4;
 
@@ -2799,9 +2799,9 @@ static int ath6kl_set_bitrate_mask64(struct wmi *wmi, u8 if_idx,
                if (mode == WMI_RATES_MODE_11A ||
                    mode == WMI_RATES_MODE_11A_HT20 ||
                    mode == WMI_RATES_MODE_11A_HT40)
-                       band = IEEE80211_BAND_5GHZ;
+                       band = NL80211_BAND_5GHZ;
                else
-                       band = IEEE80211_BAND_2GHZ;
+                       band = NL80211_BAND_2GHZ;
                cmd->ratemask[mode] = cpu_to_le64(ratemask[band]);
        }
 
@@ -2822,10 +2822,10 @@ static int ath6kl_set_bitrate_mask32(struct wmi *wmi, u8 if_idx,
        memset(&ratemask, 0, sizeof(ratemask));
 
        /* only check 2.4 and 5 GHz bands, skip the rest */
-       for (band = 0; band <= IEEE80211_BAND_5GHZ; band++) {
+       for (band = 0; band <= NL80211_BAND_5GHZ; band++) {
                /* copy legacy rate mask */
                ratemask[band] = mask->control[band].legacy;
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        ratemask[band] =
                                mask->control[band].legacy << 4;
 
@@ -2849,9 +2849,9 @@ static int ath6kl_set_bitrate_mask32(struct wmi *wmi, u8 if_idx,
                if (mode == WMI_RATES_MODE_11A ||
                    mode == WMI_RATES_MODE_11A_HT20 ||
                    mode == WMI_RATES_MODE_11A_HT40)
-                       band = IEEE80211_BAND_5GHZ;
+                       band = NL80211_BAND_5GHZ;
                else
-                       band = IEEE80211_BAND_2GHZ;
+                       band = NL80211_BAND_2GHZ;
                cmd->ratemask[mode] = cpu_to_le32(ratemask[band]);
        }
 
@@ -3174,7 +3174,7 @@ int ath6kl_wmi_set_keepalive_cmd(struct wmi *wmi, u8 if_idx,
 }
 
 int ath6kl_wmi_set_htcap_cmd(struct wmi *wmi, u8 if_idx,
-                            enum ieee80211_band band,
+                            enum nl80211_band band,
                             struct ath6kl_htcap *htcap)
 {
        struct sk_buff *skb;
@@ -3187,7 +3187,7 @@ int ath6kl_wmi_set_htcap_cmd(struct wmi *wmi, u8 if_idx,
        cmd = (struct wmi_set_htcap_cmd *) skb->data;
 
        /*
-        * NOTE: Band in firmware matches enum ieee80211_band, it is unlikely
+        * NOTE: Band in firmware matches enum nl80211_band, it is unlikely
         * this will be changed in firmware. If at all there is any change in
         * band value, the host needs to be fixed.
         */
index 05d25a9..3af464a 100644 (file)
@@ -2628,7 +2628,7 @@ int ath6kl_wmi_set_wmm_txop(struct wmi *wmi, u8 if_idx, enum wmi_txop_cfg cfg);
 int ath6kl_wmi_set_keepalive_cmd(struct wmi *wmi, u8 if_idx,
                                 u8 keep_alive_intvl);
 int ath6kl_wmi_set_htcap_cmd(struct wmi *wmi, u8 if_idx,
-                            enum ieee80211_band band,
+                            enum nl80211_band band,
                             struct ath6kl_htcap *htcap);
 int ath6kl_wmi_test_cmd(struct wmi *wmi, void *buf, size_t len);
 
index 37f6d66..0f71146 100644 (file)
@@ -145,14 +145,14 @@ static void ath9k_hw_update_nfcal_hist_buffer(struct ath_hw *ah,
 }
 
 static bool ath9k_hw_get_nf_thresh(struct ath_hw *ah,
-                                  enum ieee80211_band band,
+                                  enum nl80211_band band,
                                   int16_t *nft)
 {
        switch (band) {
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_5);
                break;
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_2);
                break;
        default:
index 319cb5f..e56bafc 100644 (file)
@@ -107,9 +107,9 @@ void ath_chanctx_init(struct ath_softc *sc)
        struct ieee80211_channel *chan;
        int i, j;
 
-       sband = &common->sbands[IEEE80211_BAND_2GHZ];
+       sband = &common->sbands[NL80211_BAND_2GHZ];
        if (!sband->n_channels)
-               sband = &common->sbands[IEEE80211_BAND_5GHZ];
+               sband = &common->sbands[NL80211_BAND_5GHZ];
 
        chan = &sband->channels[0];
        for (i = 0; i < ATH9K_NUM_CHANCTX; i++) {
@@ -1333,9 +1333,9 @@ void ath9k_offchannel_init(struct ath_softc *sc)
        struct ieee80211_channel *chan;
        int i;
 
-       sband = &common->sbands[IEEE80211_BAND_2GHZ];
+       sband = &common->sbands[NL80211_BAND_2GHZ];
        if (!sband->n_channels)
-               sband = &common->sbands[IEEE80211_BAND_5GHZ];
+               sband = &common->sbands[NL80211_BAND_5GHZ];
 
        chan = &sband->channels[0];
 
index a006c14..8b4f7fd 100644 (file)
 #include "common.h"
 
 #define CHAN2G(_freq, _idx)  { \
-       .band = IEEE80211_BAND_2GHZ, \
+       .band = NL80211_BAND_2GHZ, \
        .center_freq = (_freq), \
        .hw_value = (_idx), \
        .max_power = 20, \
 }
 
 #define CHAN5G(_freq, _idx) { \
-       .band = IEEE80211_BAND_5GHZ, \
+       .band = NL80211_BAND_5GHZ, \
        .center_freq = (_freq), \
        .hw_value = (_idx), \
        .max_power = 20, \
@@ -139,12 +139,12 @@ int ath9k_cmn_init_channels_rates(struct ath_common *common)
 
                memcpy(channels, ath9k_2ghz_chantable,
                       sizeof(ath9k_2ghz_chantable));
-               common->sbands[IEEE80211_BAND_2GHZ].channels = channels;
-               common->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ;
-               common->sbands[IEEE80211_BAND_2GHZ].n_channels =
+               common->sbands[NL80211_BAND_2GHZ].channels = channels;
+               common->sbands[NL80211_BAND_2GHZ].band = NL80211_BAND_2GHZ;
+               common->sbands[NL80211_BAND_2GHZ].n_channels =
                        ARRAY_SIZE(ath9k_2ghz_chantable);
-               common->sbands[IEEE80211_BAND_2GHZ].bitrates = ath9k_legacy_rates;
-               common->sbands[IEEE80211_BAND_2GHZ].n_bitrates =
+               common->sbands[NL80211_BAND_2GHZ].bitrates = ath9k_legacy_rates;
+               common->sbands[NL80211_BAND_2GHZ].n_bitrates =
                        ARRAY_SIZE(ath9k_legacy_rates);
        }
 
@@ -156,13 +156,13 @@ int ath9k_cmn_init_channels_rates(struct ath_common *common)
 
                memcpy(channels, ath9k_5ghz_chantable,
                       sizeof(ath9k_5ghz_chantable));
-               common->sbands[IEEE80211_BAND_5GHZ].channels = channels;
-               common->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ;
-               common->sbands[IEEE80211_BAND_5GHZ].n_channels =
+               common->sbands[NL80211_BAND_5GHZ].channels = channels;
+               common->sbands[NL80211_BAND_5GHZ].band = NL80211_BAND_5GHZ;
+               common->sbands[NL80211_BAND_5GHZ].n_channels =
                        ARRAY_SIZE(ath9k_5ghz_chantable);
-               common->sbands[IEEE80211_BAND_5GHZ].bitrates =
+               common->sbands[NL80211_BAND_5GHZ].bitrates =
                        ath9k_legacy_rates + 4;
-               common->sbands[IEEE80211_BAND_5GHZ].n_bitrates =
+               common->sbands[NL80211_BAND_5GHZ].n_bitrates =
                        ARRAY_SIZE(ath9k_legacy_rates) - 4;
        }
        return 0;
@@ -236,9 +236,9 @@ void ath9k_cmn_reload_chainmask(struct ath_hw *ah)
 
        if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
                ath9k_cmn_setup_ht_cap(ah,
-                       &common->sbands[IEEE80211_BAND_2GHZ].ht_cap);
+                       &common->sbands[NL80211_BAND_2GHZ].ht_cap);
        if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
                ath9k_cmn_setup_ht_cap(ah,
-                       &common->sbands[IEEE80211_BAND_5GHZ].ht_cap);
+                       &common->sbands[NL80211_BAND_5GHZ].ht_cap);
 }
 EXPORT_SYMBOL(ath9k_cmn_reload_chainmask);
index e8c6994..b80e08b 100644 (file)
@@ -173,7 +173,7 @@ int ath9k_cmn_process_rate(struct ath_common *common,
                           struct ieee80211_rx_status *rxs)
 {
        struct ieee80211_supported_band *sband;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        unsigned int i = 0;
        struct ath_hw *ah = common->ah;
 
@@ -305,7 +305,7 @@ static void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
        ichan->channel = chan->center_freq;
        ichan->chan = chan;
 
-       if (chan->band == IEEE80211_BAND_5GHZ)
+       if (chan->band == NL80211_BAND_5GHZ)
                flags |= CHANNEL_5GHZ;
 
        switch (chandef->width) {
index c2ca57a..b66cfa9 100644 (file)
@@ -139,7 +139,7 @@ void ath_debug_rate_stats(struct ath_softc *sc,
        }
 
        if (IS_OFDM_RATE(rs->rs_rate)) {
-               if (ah->curchan->chan->band == IEEE80211_BAND_2GHZ)
+               if (ah->curchan->chan->band == NL80211_BAND_2GHZ)
                        rstats->ofdm_stats[rxs->rate_idx - 4].ofdm_cnt++;
                else
                        rstats->ofdm_stats[rxs->rate_idx].ofdm_cnt++;
@@ -173,7 +173,7 @@ static ssize_t read_file_node_recv(struct file *file, char __user *user_buf,
        struct ath_hw *ah = sc->sc_ah;
        struct ath_rx_rate_stats *rstats;
        struct ieee80211_sta *sta = an->sta;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u32 len = 0, size = 4096;
        char *buf;
        size_t retval;
@@ -206,7 +206,7 @@ static ssize_t read_file_node_recv(struct file *file, char __user *user_buf,
        len += scnprintf(buf + len, size - len, "\n");
 
 legacy:
-       if (band == IEEE80211_BAND_2GHZ) {
+       if (band == NL80211_BAND_2GHZ) {
                PRINT_CCK_RATE("CCK-1M/LP", 0, false);
                PRINT_CCK_RATE("CCK-2M/LP", 1, false);
                PRINT_CCK_RATE("CCK-5.5M/LP", 2, false);
index 22b3cc4..d2ff0fc 100644 (file)
@@ -212,7 +212,7 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
                struct ieee80211_tx_rate *rates = info->status.rates;
 
                rate = &common->sbands[info->band].bitrates[rates[ridx].idx];
-               if (info->band == IEEE80211_BAND_2GHZ &&
+               if (info->band == NL80211_BAND_2GHZ &&
                    !(rate->flags & IEEE80211_RATE_ERP_G))
                        phy = WLAN_RC_PHY_CCK;
                else
index c2249ad..c148c6c 100644 (file)
@@ -765,11 +765,11 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
                sizeof(struct htc_frame_hdr) + 4;
 
        if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                       &common->sbands[IEEE80211_BAND_2GHZ];
+               hw->wiphy->bands[NL80211_BAND_2GHZ] =
+                       &common->sbands[NL80211_BAND_2GHZ];
        if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
-               hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                       &common->sbands[IEEE80211_BAND_5GHZ];
+               hw->wiphy->bands[NL80211_BAND_5GHZ] =
+                       &common->sbands[NL80211_BAND_5GHZ];
 
        ath9k_cmn_reload_chainmask(ah);
 
index 6c5047c..a553c91 100644 (file)
@@ -1767,8 +1767,8 @@ static int ath9k_htc_set_bitrate_mask(struct ieee80211_hw *hw,
        memset(&tmask, 0, sizeof(struct ath9k_htc_target_rate_mask));
 
        tmask.vif_index = avp->index;
-       tmask.band = IEEE80211_BAND_2GHZ;
-       tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_2GHZ].legacy);
+       tmask.band = NL80211_BAND_2GHZ;
+       tmask.mask = cpu_to_be32(mask->control[NL80211_BAND_2GHZ].legacy);
 
        WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask);
        if (ret) {
@@ -1778,8 +1778,8 @@ static int ath9k_htc_set_bitrate_mask(struct ieee80211_hw *hw,
                goto out;
        }
 
-       tmask.band = IEEE80211_BAND_5GHZ;
-       tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_5GHZ].legacy);
+       tmask.band = NL80211_BAND_5GHZ;
+       tmask.mask = cpu_to_be32(mask->control[NL80211_BAND_5GHZ].legacy);
 
        WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask);
        if (ret) {
@@ -1790,8 +1790,8 @@ static int ath9k_htc_set_bitrate_mask(struct ieee80211_hw *hw,
        }
 
        ath_dbg(common, CONFIG, "Set bitrate masks: 0x%x, 0x%x\n",
-               mask->control[IEEE80211_BAND_2GHZ].legacy,
-               mask->control[IEEE80211_BAND_5GHZ].legacy);
+               mask->control[NL80211_BAND_2GHZ].legacy,
+               mask->control[NL80211_BAND_5GHZ].legacy);
 out:
        return ret;
 }
index cc9648f..f333ef1 100644 (file)
@@ -494,7 +494,7 @@ static void ath9k_htc_tx_process(struct ath9k_htc_priv *priv,
                if (txs->ts_flags & ATH9K_HTC_TXSTAT_SGI)
                        rate->flags |= IEEE80211_TX_RC_SHORT_GI;
        } else {
-               if (cur_conf->chandef.chan->band == IEEE80211_BAND_5GHZ)
+               if (cur_conf->chandef.chan->band == NL80211_BAND_5GHZ)
                        rate->idx += 4; /* No CCK rates */
        }
 
index 535b164..2ee8624 100644 (file)
@@ -712,9 +712,9 @@ static void ath9k_init_txpower_limits(struct ath_softc *sc)
        struct ath9k_channel *curchan = ah->curchan;
 
        if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
-               ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ);
+               ath9k_init_band_txpower(sc, NL80211_BAND_2GHZ);
        if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
-               ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
+               ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
 
        ah->curchan = curchan;
 }
@@ -886,11 +886,11 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
        sc->ant_tx = hw->wiphy->available_antennas_tx;
 
        if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                       &common->sbands[IEEE80211_BAND_2GHZ];
+               hw->wiphy->bands[NL80211_BAND_2GHZ] =
+                       &common->sbands[NL80211_BAND_2GHZ];
        if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
-               hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                       &common->sbands[IEEE80211_BAND_5GHZ];
+               hw->wiphy->bands[NL80211_BAND_5GHZ] =
+                       &common->sbands[NL80211_BAND_5GHZ];
 
 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
        ath9k_set_mcc_capab(sc, hw);
index 50ec4c9..8b63988 100644 (file)
@@ -1933,14 +1933,14 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
        if (idx == 0)
                ath_update_survey_stats(sc);
 
-       sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ];
+       sband = hw->wiphy->bands[NL80211_BAND_2GHZ];
        if (sband && idx >= sband->n_channels) {
                idx -= sband->n_channels;
                sband = NULL;
        }
 
        if (!sband)
-               sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ];
+               sband = hw->wiphy->bands[NL80211_BAND_5GHZ];
 
        if (!sband || idx >= sband->n_channels) {
                spin_unlock_bh(&common->cc_lock);
index fe795fc..8ddd604 100644 (file)
@@ -1112,7 +1112,7 @@ static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf,
                                bool is_2ghz;
                                struct modal_eep_header *pmodal;
 
-                               is_2ghz = info->band == IEEE80211_BAND_2GHZ;
+                               is_2ghz = info->band == NL80211_BAND_2GHZ;
                                pmodal = &eep->modalHeader[is_2ghz];
                                power_ht40delta = pmodal->ht40PowerIncForPdadc;
                        } else {
@@ -1236,7 +1236,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
 
                /* legacy rates */
                rate = &common->sbands[tx_info->band].bitrates[rates[i].idx];
-               if ((tx_info->band == IEEE80211_BAND_2GHZ) &&
+               if ((tx_info->band == NL80211_BAND_2GHZ) &&
                    !(rate->flags & IEEE80211_RATE_ERP_G))
                        phy = WLAN_RC_PHY_CCK;
                else
index a2f0057..7d4a72d 100644 (file)
@@ -48,7 +48,7 @@ int carl9170_set_dyn_sifs_ack(struct ar9170 *ar)
        if (conf_is_ht40(&ar->hw->conf))
                val = 0x010a;
        else {
-               if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
+               if (ar->hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
                        val = 0x105;
                else
                        val = 0x104;
@@ -66,7 +66,7 @@ int carl9170_set_rts_cts_rate(struct ar9170 *ar)
                rts_rate = 0x1da;
                cts_rate = 0x10a;
        } else {
-               if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) {
+               if (ar->hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) {
                        /* 11 mbit CCK */
                        rts_rate = 033;
                        cts_rate = 003;
@@ -93,7 +93,7 @@ int carl9170_set_slot_time(struct ar9170 *ar)
                return 0;
        }
 
-       if ((ar->hw->conf.chandef.chan->band == IEEE80211_BAND_5GHZ) ||
+       if ((ar->hw->conf.chandef.chan->band == NL80211_BAND_5GHZ) ||
            vif->bss_conf.use_short_slot)
                slottime = 9;
 
@@ -120,7 +120,7 @@ int carl9170_set_mac_rates(struct ar9170 *ar)
        basic |= (vif->bss_conf.basic_rates & 0xff0) << 4;
        rcu_read_unlock();
 
-       if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_5GHZ)
+       if (ar->hw->conf.chandef.chan->band == NL80211_BAND_5GHZ)
                mandatory = 0xff00; /* OFDM 6/9/12/18/24/36/48/54 */
        else
                mandatory = 0xff0f; /* OFDM (6/9../54) + CCK (1/2/5.5/11) */
@@ -512,10 +512,10 @@ int carl9170_set_mac_tpc(struct ar9170 *ar, struct ieee80211_channel *channel)
                chains = AR9170_TX_PHY_TXCHAIN_1;
 
        switch (channel->band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                power = ar->power_2G_ofdm[0] & 0x3f;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                power = ar->power_5G_leg[0] & 0x3f;
                break;
        default:
index 4d1527a..ffb22a0 100644 (file)
@@ -1666,7 +1666,7 @@ static int carl9170_op_get_survey(struct ieee80211_hw *hw, int idx,
                        return err;
        }
 
-       for (b = 0; b < IEEE80211_NUM_BANDS; b++) {
+       for (b = 0; b < NUM_NL80211_BANDS; b++) {
                band = ar->hw->wiphy->bands[b];
 
                if (!band)
@@ -1941,13 +1941,13 @@ static int carl9170_parse_eeprom(struct ar9170 *ar)
        }
 
        if (ar->eeprom.operating_flags & AR9170_OPFLAG_2GHZ) {
-               ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+               ar->hw->wiphy->bands[NL80211_BAND_2GHZ] =
                        &carl9170_band_2GHz;
                chans += carl9170_band_2GHz.n_channels;
                bands++;
        }
        if (ar->eeprom.operating_flags & AR9170_OPFLAG_5GHZ) {
-               ar->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
+               ar->hw->wiphy->bands[NL80211_BAND_5GHZ] =
                        &carl9170_band_5GHz;
                chans += carl9170_band_5GHz.n_channels;
                bands++;
index dca6df1..34d9fd7 100644 (file)
@@ -540,11 +540,11 @@ static int carl9170_init_phy_from_eeprom(struct ar9170 *ar,
        return carl9170_regwrite_result();
 }
 
-static int carl9170_init_phy(struct ar9170 *ar, enum ieee80211_band band)
+static int carl9170_init_phy(struct ar9170 *ar, enum nl80211_band band)
 {
        int i, err;
        u32 val;
-       bool is_2ghz = band == IEEE80211_BAND_2GHZ;
+       bool is_2ghz = band == NL80211_BAND_2GHZ;
        bool is_40mhz = conf_is_ht40(&ar->hw->conf);
 
        carl9170_regwrite_begin(ar);
@@ -1125,13 +1125,13 @@ static int carl9170_set_freq_cal_data(struct ar9170 *ar,
        u8 f, tmp;
 
        switch (channel->band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                f = channel->center_freq - 2300;
                cal_freq_pier = ar->eeprom.cal_freq_pier_2G;
                i = AR5416_NUM_2G_CAL_PIERS - 1;
                break;
 
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                f = (channel->center_freq - 4800) / 5;
                cal_freq_pier = ar->eeprom.cal_freq_pier_5G;
                i = AR5416_NUM_5G_CAL_PIERS - 1;
@@ -1158,12 +1158,12 @@ static int carl9170_set_freq_cal_data(struct ar9170 *ar,
                        int j;
 
                        switch (channel->band) {
-                       case IEEE80211_BAND_2GHZ:
+                       case NL80211_BAND_2GHZ:
                                cal_pier_data = &ar->eeprom.
                                        cal_pier_data_2G[chain][idx];
                                break;
 
-                       case IEEE80211_BAND_5GHZ:
+                       case NL80211_BAND_5GHZ:
                                cal_pier_data = &ar->eeprom.
                                        cal_pier_data_5G[chain][idx];
                                break;
@@ -1340,7 +1340,7 @@ static void carl9170_calc_ctl(struct ar9170 *ar, u32 freq, enum carl9170_bw bw)
                /* skip CTL and heavy clip for CTL_MKK and CTL_ETSI */
                return;
 
-       if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) {
+       if (ar->hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) {
                modes = mode_list_2ghz;
                nr_modes = ARRAY_SIZE(mode_list_2ghz);
        } else {
@@ -1607,7 +1607,7 @@ int carl9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel,
                return err;
 
        err = carl9170_init_rf_banks_0_7(ar,
-                                        channel->band == IEEE80211_BAND_5GHZ);
+                                        channel->band == NL80211_BAND_5GHZ);
        if (err)
                return err;
 
@@ -1621,7 +1621,7 @@ int carl9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel,
                return err;
 
        err = carl9170_init_rf_bank4_pwr(ar,
-                                        channel->band == IEEE80211_BAND_5GHZ,
+                                        channel->band == NL80211_BAND_5GHZ,
                                         channel->center_freq, bw);
        if (err)
                return err;
index d66533c..0c34c87 100644 (file)
@@ -417,7 +417,7 @@ static int carl9170_rx_mac_status(struct ar9170 *ar,
 
                        return -EINVAL;
                }
-               if (status->band == IEEE80211_BAND_2GHZ)
+               if (status->band == NL80211_BAND_2GHZ)
                        status->rate_idx += 4;
                break;
 
index ae86a60..2bf04c9 100644 (file)
@@ -720,12 +720,12 @@ static void carl9170_tx_rate_tpc_chains(struct ar9170 *ar,
                        /* +1 dBm for HT40 */
                        *tpc += 2;
 
-                       if (info->band == IEEE80211_BAND_2GHZ)
+                       if (info->band == NL80211_BAND_2GHZ)
                                txpower = ar->power_2G_ht40;
                        else
                                txpower = ar->power_5G_ht40;
                } else {
-                       if (info->band == IEEE80211_BAND_2GHZ)
+                       if (info->band == NL80211_BAND_2GHZ)
                                txpower = ar->power_2G_ht20;
                        else
                                txpower = ar->power_5G_ht20;
@@ -734,7 +734,7 @@ static void carl9170_tx_rate_tpc_chains(struct ar9170 *ar,
                *phyrate = txrate->idx;
                *tpc += txpower[idx & 7];
        } else {
-               if (info->band == IEEE80211_BAND_2GHZ) {
+               if (info->band == NL80211_BAND_2GHZ) {
                        if (idx < 4)
                                txpower = ar->power_2G_cck;
                        else
@@ -797,7 +797,7 @@ static __le32 carl9170_tx_physet(struct ar9170 *ar,
                 * tmp |= cpu_to_le32(AR9170_TX_PHY_GREENFIELD);
                 */
        } else {
-               if (info->band == IEEE80211_BAND_2GHZ) {
+               if (info->band == NL80211_BAND_2GHZ) {
                        if (txrate->idx <= AR9170_TX_PHY_RATE_CCK_11M)
                                tmp |= cpu_to_le32(AR9170_TX_PHY_MOD_CCK);
                        else
index 06ea6cc..7e15ed9 100644 (file)
@@ -336,12 +336,12 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
                              struct ath_regulatory *reg,
                              enum nl80211_reg_initiator initiator)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *ch;
        unsigned int i;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                if (!wiphy->bands[band])
                        continue;
                sband = wiphy->bands[band];
@@ -374,7 +374,7 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy,
 {
        struct ieee80211_supported_band *sband;
 
-       sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+       sband = wiphy->bands[NL80211_BAND_2GHZ];
        if (!sband)
                return;
 
@@ -402,10 +402,10 @@ static void ath_reg_apply_radar_flags(struct wiphy *wiphy)
        struct ieee80211_channel *ch;
        unsigned int i;
 
-       if (!wiphy->bands[IEEE80211_BAND_5GHZ])
+       if (!wiphy->bands[NL80211_BAND_5GHZ])
                return;
 
-       sband = wiphy->bands[IEEE80211_BAND_5GHZ];
+       sband = wiphy->bands[NL80211_BAND_5GHZ];
 
        for (i = 0; i < sband->n_channels; i++) {
                ch = &sband->channels[i];
@@ -772,7 +772,7 @@ ath_regd_init(struct ath_regulatory *reg,
 EXPORT_SYMBOL(ath_regd_init);
 
 u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
-                         enum ieee80211_band band)
+                         enum nl80211_band band)
 {
        if (!reg->regpair ||
            (reg->country_code == CTRY_DEFAULT &&
@@ -794,9 +794,9 @@ u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
        }
 
        switch (band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                return reg->regpair->reg_2ghz_ctl;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                return reg->regpair->reg_5ghz_ctl;
        default:
                return NO_CTL;
index 37f53bd..565d307 100644 (file)
@@ -255,7 +255,7 @@ int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
                  void (*reg_notifier)(struct wiphy *wiphy,
                                       struct regulatory_request *request));
 u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
-                         enum ieee80211_band band);
+                         enum nl80211_band band);
 void ath_reg_notifier_apply(struct wiphy *wiphy,
                            struct regulatory_request *request,
                            struct ath_regulatory *reg);
index fe81b2a..a920d70 100644 (file)
@@ -26,14 +26,14 @@ module_param_named(debug_mask, wcn36xx_dbg_mask, uint, 0644);
 MODULE_PARM_DESC(debug_mask, "Debugging mask");
 
 #define CHAN2G(_freq, _idx) { \
-       .band = IEEE80211_BAND_2GHZ, \
+       .band = NL80211_BAND_2GHZ, \
        .center_freq = (_freq), \
        .hw_value = (_idx), \
        .max_power = 25, \
 }
 
 #define CHAN5G(_freq, _idx) { \
-       .band = IEEE80211_BAND_5GHZ, \
+       .band = NL80211_BAND_5GHZ, \
        .center_freq = (_freq), \
        .hw_value = (_idx), \
        .max_power = 25, \
@@ -596,7 +596,7 @@ static void wcn36xx_sw_scan_complete(struct ieee80211_hw *hw,
 }
 
 static void wcn36xx_update_allowed_rates(struct ieee80211_sta *sta,
-                                        enum ieee80211_band band)
+                                        enum nl80211_band band)
 {
        int i, size;
        u16 *rates_table;
@@ -609,7 +609,7 @@ static void wcn36xx_update_allowed_rates(struct ieee80211_sta *sta,
 
        size = ARRAY_SIZE(sta_priv->supported_rates.dsss_rates);
        rates_table = sta_priv->supported_rates.dsss_rates;
-       if (band == IEEE80211_BAND_2GHZ) {
+       if (band == NL80211_BAND_2GHZ) {
                for (i = 0; i < size; i++) {
                        if (rates & 0x01) {
                                rates_table[i] = wcn_2ghz_rates[i].hw_value;
@@ -1037,8 +1037,8 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
                BIT(NL80211_IFTYPE_ADHOC) |
                BIT(NL80211_IFTYPE_MESH_POINT);
 
-       wcn->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wcn_band_2ghz;
-       wcn->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wcn_band_5ghz;
+       wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = &wcn_band_2ghz;
+       wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = &wcn_band_5ghz;
 
        wcn->hw->wiphy->cipher_suites = cipher_suites;
        wcn->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
index 5f6ca31..e8b630c 100644 (file)
@@ -104,11 +104,11 @@ static void wcn36xx_smd_set_bss_nw_type(struct wcn36xx *wcn,
                struct ieee80211_sta *sta,
                struct wcn36xx_hal_config_bss_params *bss_params)
 {
-       if (IEEE80211_BAND_5GHZ == WCN36XX_BAND(wcn))
+       if (NL80211_BAND_5GHZ == WCN36XX_BAND(wcn))
                bss_params->nw_type = WCN36XX_HAL_11A_NW_TYPE;
        else if (sta && sta->ht_cap.ht_supported)
                bss_params->nw_type = WCN36XX_HAL_11N_NW_TYPE;
-       else if (sta && (sta->supp_rates[IEEE80211_BAND_2GHZ] & 0x7f))
+       else if (sta && (sta->supp_rates[NL80211_BAND_2GHZ] & 0x7f))
                bss_params->nw_type = WCN36XX_HAL_11G_NW_TYPE;
        else
                bss_params->nw_type = WCN36XX_HAL_11B_NW_TYPE;
index b12c89b..1f34c2e 100644 (file)
@@ -221,7 +221,7 @@ static void wcn36xx_set_tx_mgmt(struct wcn36xx_tx_bd *bd,
 
        /* default rate for unicast */
        if (ieee80211_is_mgmt(hdr->frame_control))
-               bd->bd_rate = (WCN36XX_BAND(wcn) == IEEE80211_BAND_5GHZ) ?
+               bd->bd_rate = (WCN36XX_BAND(wcn) == NL80211_BAND_5GHZ) ?
                        WCN36XX_BD_RATE_CTRL :
                        WCN36XX_BD_RATE_MGMT;
        else if (ieee80211_is_ctl(hdr->frame_control))
index 12cae3c..0fb3a79 100644 (file)
@@ -21,7 +21,7 @@
 #define WIL_MAX_ROC_DURATION_MS 5000
 
 #define CHAN60G(_channel, _flags) {                            \
-       .band                   = IEEE80211_BAND_60GHZ,         \
+       .band                   = NL80211_BAND_60GHZ,           \
        .center_freq            = 56160 + (2160 * (_channel)),  \
        .hw_value               = (_channel),                   \
        .flags                  = (_flags),                     \
@@ -1411,7 +1411,7 @@ static void wil_wiphy_init(struct wiphy *wiphy)
                NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 |
                NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P;
 
-       wiphy->bands[IEEE80211_BAND_60GHZ] = &wil_band_60ghz;
+       wiphy->bands[NL80211_BAND_60GHZ] = &wil_band_60ghz;
 
        /* TODO: figure this out */
        wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
index 3bc0e26..0984097 100644 (file)
@@ -157,7 +157,7 @@ void *wil_if_alloc(struct device *dev)
 
        wdev->iftype = NL80211_IFTYPE_STATION; /* TODO */
        /* default monitor channel */
-       ch = wdev->wiphy->bands[IEEE80211_BAND_60GHZ]->channels;
+       ch = wdev->wiphy->bands[NL80211_BAND_60GHZ]->channels;
        cfg80211_chandef_create(&wdev->preset_chandef, ch, NL80211_CHAN_NO_HT);
 
        ndev = alloc_netdev(0, "wlan%d", NET_NAME_UNKNOWN, wil_dev_setup);
index 3cc4462..6ca28c3 100644 (file)
@@ -333,7 +333,7 @@ static void wmi_evt_rx_mgmt(struct wil6210_priv *wil, int id, void *d, int len)
        }
 
        ch_no = data->info.channel + 1;
-       freq = ieee80211_channel_to_frequency(ch_no, IEEE80211_BAND_60GHZ);
+       freq = ieee80211_channel_to_frequency(ch_no, NL80211_BAND_60GHZ);
        channel = ieee80211_get_channel(wiphy, freq);
        signal = data->info.sqi;
        d_status = le16_to_cpu(data->info.status);
index 1efb1d6..7c10804 100644 (file)
@@ -1547,7 +1547,7 @@ static inline int at76_guess_freq(struct at76_priv *priv)
                channel = el[2];
 
 exit:
-       return ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+       return ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
 }
 
 static void at76_rx_tasklet(unsigned long param)
@@ -1590,7 +1590,7 @@ static void at76_rx_tasklet(unsigned long param)
        rx_status.signal = buf->rssi;
        rx_status.flag |= RX_FLAG_DECRYPTED;
        rx_status.flag |= RX_FLAG_IV_STRIPPED;
-       rx_status.band = IEEE80211_BAND_2GHZ;
+       rx_status.band = NL80211_BAND_2GHZ;
        rx_status.freq = at76_guess_freq(priv);
 
        at76_dbg(DBG_MAC80211, "calling ieee80211_rx_irqsafe(): %d/%d",
@@ -2359,7 +2359,7 @@ static int at76_init_new_device(struct at76_priv *priv,
        priv->hw->wiphy->max_scan_ssids = 1;
        priv->hw->wiphy->max_scan_ie_len = 0;
        priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
-       priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &at76_supported_band;
+       priv->hw->wiphy->bands[NL80211_BAND_2GHZ] = &at76_supported_band;
        ieee80211_hw_set(priv->hw, RX_INCLUDES_FCS);
        ieee80211_hw_set(priv->hw, SIGNAL_UNSPEC);
        priv->hw->max_signal = 100;
index 6a1f03c..8f8f37f 100644 (file)
@@ -2434,7 +2434,7 @@ static int atmel_get_range(struct net_device *dev,
 
                        /* Values in MHz -> * 10^5 * 10 */
                        range->freq[k].m = 100000 *
-                        ieee80211_channel_to_frequency(i, IEEE80211_BAND_2GHZ);
+                        ieee80211_channel_to_frequency(i, NL80211_BAND_2GHZ);
                        range->freq[k++].e = 1;
                }
                range->num_frequency = k;
index 0365524..d7d42f0 100644 (file)
@@ -992,9 +992,9 @@ static inline int b43_is_mode(struct b43_wl *wl, int type)
 
 /**
  * b43_current_band - Returns the currently used band.
- * Returns one of IEEE80211_BAND_2GHZ and IEEE80211_BAND_5GHZ.
+ * Returns one of NL80211_BAND_2GHZ and NL80211_BAND_5GHZ.
  */
-static inline enum ieee80211_band b43_current_band(struct b43_wl *wl)
+static inline enum nl80211_band b43_current_band(struct b43_wl *wl)
 {
        return wl->hw->conf.chandef.chan->band;
 }
index b0603e7..4ee5c58 100644 (file)
@@ -187,7 +187,7 @@ static struct ieee80211_rate __b43_ratetable[] = {
 #define b43_g_ratetable_size   12
 
 #define CHAN2G(_channel, _freq, _flags) {                      \
-       .band                   = IEEE80211_BAND_2GHZ,          \
+       .band                   = NL80211_BAND_2GHZ,            \
        .center_freq            = (_freq),                      \
        .hw_value               = (_channel),                   \
        .flags                  = (_flags),                     \
@@ -216,7 +216,7 @@ static struct ieee80211_channel b43_2ghz_chantable[] = {
 #undef CHAN2G
 
 #define CHAN4G(_channel, _flags) {                             \
-       .band                   = IEEE80211_BAND_5GHZ,          \
+       .band                   = NL80211_BAND_5GHZ,            \
        .center_freq            = 4000 + (5 * (_channel)),      \
        .hw_value               = (_channel),                   \
        .flags                  = (_flags),                     \
@@ -224,7 +224,7 @@ static struct ieee80211_channel b43_2ghz_chantable[] = {
        .max_power              = 30,                           \
 }
 #define CHAN5G(_channel, _flags) {                             \
-       .band                   = IEEE80211_BAND_5GHZ,          \
+       .band                   = NL80211_BAND_5GHZ,            \
        .center_freq            = 5000 + (5 * (_channel)),      \
        .hw_value               = (_channel),                   \
        .flags                  = (_flags),                     \
@@ -323,7 +323,7 @@ static struct ieee80211_channel b43_5ghz_aphy_chantable[] = {
 #undef CHAN5G
 
 static struct ieee80211_supported_band b43_band_5GHz_nphy = {
-       .band           = IEEE80211_BAND_5GHZ,
+       .band           = NL80211_BAND_5GHZ,
        .channels       = b43_5ghz_nphy_chantable,
        .n_channels     = ARRAY_SIZE(b43_5ghz_nphy_chantable),
        .bitrates       = b43_a_ratetable,
@@ -331,7 +331,7 @@ static struct ieee80211_supported_band b43_band_5GHz_nphy = {
 };
 
 static struct ieee80211_supported_band b43_band_5GHz_nphy_limited = {
-       .band           = IEEE80211_BAND_5GHZ,
+       .band           = NL80211_BAND_5GHZ,
        .channels       = b43_5ghz_nphy_chantable_limited,
        .n_channels     = ARRAY_SIZE(b43_5ghz_nphy_chantable_limited),
        .bitrates       = b43_a_ratetable,
@@ -339,7 +339,7 @@ static struct ieee80211_supported_band b43_band_5GHz_nphy_limited = {
 };
 
 static struct ieee80211_supported_band b43_band_5GHz_aphy = {
-       .band           = IEEE80211_BAND_5GHZ,
+       .band           = NL80211_BAND_5GHZ,
        .channels       = b43_5ghz_aphy_chantable,
        .n_channels     = ARRAY_SIZE(b43_5ghz_aphy_chantable),
        .bitrates       = b43_a_ratetable,
@@ -347,7 +347,7 @@ static struct ieee80211_supported_band b43_band_5GHz_aphy = {
 };
 
 static struct ieee80211_supported_band b43_band_2GHz = {
-       .band           = IEEE80211_BAND_2GHZ,
+       .band           = NL80211_BAND_2GHZ,
        .channels       = b43_2ghz_chantable,
        .n_channels     = ARRAY_SIZE(b43_2ghz_chantable),
        .bitrates       = b43_g_ratetable,
@@ -355,7 +355,7 @@ static struct ieee80211_supported_band b43_band_2GHz = {
 };
 
 static struct ieee80211_supported_band b43_band_2ghz_limited = {
-       .band           = IEEE80211_BAND_2GHZ,
+       .band           = NL80211_BAND_2GHZ,
        .channels       = b43_2ghz_chantable,
        .n_channels     = b43_2ghz_chantable_limited_size,
        .bitrates       = b43_g_ratetable,
@@ -717,7 +717,7 @@ static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time)
 {
        /* slot_time is in usec. */
        /* This test used to exit for all but a G PHY. */
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                return;
        b43_write16(dev, B43_MMIO_IFSSLOT, 510 + slot_time);
        /* Shared memory location 0x0010 is the slot time and should be
@@ -3880,12 +3880,12 @@ static void b43_op_set_tsf(struct ieee80211_hw *hw,
        mutex_unlock(&wl->mutex);
 }
 
-static const char *band_to_string(enum ieee80211_band band)
+static const char *band_to_string(enum nl80211_band band)
 {
        switch (band) {
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                return "5";
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                return "2.4";
        default:
                break;
@@ -3903,10 +3903,10 @@ static int b43_switch_band(struct b43_wldev *dev,
        u32 tmp;
 
        switch (chan->band) {
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                gmode = false;
                break;
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                gmode = true;
                break;
        default:
@@ -5294,16 +5294,16 @@ static int b43_setup_bands(struct b43_wldev *dev,
                     phy->radio_rev == 9;
 
        if (have_2ghz_phy)
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] = limited_2g ?
+               hw->wiphy->bands[NL80211_BAND_2GHZ] = limited_2g ?
                        &b43_band_2ghz_limited : &b43_band_2GHz;
        if (dev->phy.type == B43_PHYTYPE_N) {
                if (have_5ghz_phy)
-                       hw->wiphy->bands[IEEE80211_BAND_5GHZ] = limited_5g ?
+                       hw->wiphy->bands[NL80211_BAND_5GHZ] = limited_5g ?
                                &b43_band_5GHz_nphy_limited :
                                &b43_band_5GHz_nphy;
        } else {
                if (have_5ghz_phy)
-                       hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &b43_band_5GHz_aphy;
+                       hw->wiphy->bands[NL80211_BAND_5GHZ] = &b43_band_5GHz_aphy;
        }
 
        dev->phy.supports_2ghz = have_2ghz_phy;
index e75633d..52f8aba 100644 (file)
@@ -61,7 +61,7 @@ static void b43_phy_ac_op_radio_write(struct b43_wldev *dev, u16 reg,
 
 static unsigned int b43_phy_ac_op_get_default_chan(struct b43_wldev *dev)
 {
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                return 11;
        return 36;
 }
index ec2b9c5..85f2ca9 100644 (file)
@@ -436,7 +436,7 @@ int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel)
         * firmware from sending ghost packets.
         */
        channelcookie = new_channel;
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                channelcookie |= B43_SHM_SH_CHAN_5GHZ;
        /* FIXME: set 40Mhz flag if required */
        if (0)
index bd68945..718c90e 100644 (file)
@@ -568,7 +568,7 @@ static void b43_phy_ht_tx_power_ctl(struct b43_wldev *dev, bool enable)
        } else {
                b43_phy_set(dev, B43_PHY_HT_TXPCTL_CMD_C1, en_bits);
 
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                        for (i = 0; i < 3; i++)
                                b43_phy_write(dev, cmd_regs[i], 0x32);
                }
@@ -643,7 +643,7 @@ static void b43_phy_ht_tx_power_ctl_setup(struct b43_wldev *dev)
        u16 freq = dev->phy.chandef->chan->center_freq;
        int i, c;
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                for (c = 0; c < 3; c++) {
                        target[c] = sprom->core_pwr_info[c].maxpwr_2g;
                        a1[c] = sprom->core_pwr_info[c].pa_2g[0];
@@ -777,7 +777,7 @@ static void b43_phy_ht_channel_setup(struct b43_wldev *dev,
                                const struct b43_phy_ht_channeltab_e_phy *e,
                                struct ieee80211_channel *new_channel)
 {
-       if (new_channel->band == IEEE80211_BAND_5GHZ) {
+       if (new_channel->band == NL80211_BAND_5GHZ) {
                /* Switch to 2 GHz for a moment to access B-PHY regs */
                b43_phy_mask(dev, B43_PHY_HT_BANDCTL, ~B43_PHY_HT_BANDCTL_5GHZ);
 
@@ -805,7 +805,7 @@ static void b43_phy_ht_channel_setup(struct b43_wldev *dev,
        } else {
                b43_phy_ht_classifier(dev, B43_PHY_HT_CLASS_CTL_OFDM_EN,
                                      B43_PHY_HT_CLASS_CTL_OFDM_EN);
-               if (new_channel->band == IEEE80211_BAND_2GHZ)
+               if (new_channel->band == NL80211_BAND_2GHZ)
                        b43_phy_mask(dev, B43_PHY_HT_TEST, ~0x840);
        }
 
@@ -916,7 +916,7 @@ static int b43_phy_ht_op_init(struct b43_wldev *dev)
        if (0) /* TODO: condition */
                ; /* TODO: PHY op on reg 0x217 */
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                b43_phy_ht_classifier(dev, B43_PHY_HT_CLASS_CTL_CCK_EN, 0);
        else
                b43_phy_ht_classifier(dev, B43_PHY_HT_CLASS_CTL_CCK_EN,
@@ -1005,7 +1005,7 @@ static int b43_phy_ht_op_init(struct b43_wldev *dev)
        b43_phy_ht_classifier(dev, 0, 0);
        b43_phy_ht_read_clip_detection(dev, clip_state);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                b43_phy_ht_bphy_init(dev);
 
        b43_httab_write_bulk(dev, B43_HTTAB32(0x1a, 0xc0),
@@ -1077,7 +1077,7 @@ static int b43_phy_ht_op_switch_channel(struct b43_wldev *dev,
        enum nl80211_channel_type channel_type =
                cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                if ((new_channel < 1) || (new_channel > 14))
                        return -EINVAL;
        } else {
@@ -1089,7 +1089,7 @@ static int b43_phy_ht_op_switch_channel(struct b43_wldev *dev,
 
 static unsigned int b43_phy_ht_op_get_default_chan(struct b43_wldev *dev)
 {
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                return 11;
        return 36;
 }
index 97461cc..63bd29f 100644 (file)
@@ -108,7 +108,7 @@ static void b43_radio_2064_channel_setup(struct b43_wldev *dev)
 /* wlc_radio_2064_init */
 static void b43_radio_2064_init(struct b43_wldev *dev)
 {
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                b43_radio_write(dev, 0x09c, 0x0020);
                b43_radio_write(dev, 0x105, 0x0008);
        } else {
@@ -535,7 +535,7 @@ static void b43_phy_lcn_tx_pwr_ctl_init(struct b43_wldev *dev)
        b43_mac_suspend(dev);
 
        if (!dev->phy.lcn->hw_pwr_ctl_capable) {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        tx_gains.gm_gain = 4;
                        tx_gains.pga_gain = 12;
                        tx_gains.pad_gain = 12;
@@ -720,7 +720,7 @@ static int b43_phy_lcn_op_init(struct b43_wldev *dev)
        else
                B43_WARN_ON(1);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                b43_phy_lcn_tx_pwr_ctl_init(dev);
 
        b43_switch_channel(dev, dev->phy.channel);
@@ -779,7 +779,7 @@ static int b43_phy_lcn_op_switch_channel(struct b43_wldev *dev,
        enum nl80211_channel_type channel_type =
                cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                if ((new_channel < 1) || (new_channel > 14))
                        return -EINVAL;
        } else {
@@ -791,7 +791,7 @@ static int b43_phy_lcn_op_switch_channel(struct b43_wldev *dev,
 
 static unsigned int b43_phy_lcn_op_get_default_chan(struct b43_wldev *dev)
 {
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                return 1;
        return 36;
 }
index 058a9f2..6922cbb 100644 (file)
@@ -46,7 +46,7 @@ static inline u16 channel2freq_lp(u8 channel)
 
 static unsigned int b43_lpphy_op_get_default_chan(struct b43_wldev *dev)
 {
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                return 1;
        return 36;
 }
@@ -91,7 +91,7 @@ static void lpphy_read_band_sprom(struct b43_wldev *dev)
        u32 ofdmpo;
        int i;
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                lpphy->tx_isolation_med_band = sprom->tri2g;
                lpphy->bx_arch = sprom->bxa2g;
                lpphy->rx_pwr_offset = sprom->rxpo2g;
@@ -174,7 +174,7 @@ static void lpphy_adjust_gain_table(struct b43_wldev *dev, u32 freq)
 
        B43_WARN_ON(dev->phy.rev >= 2);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                isolation = lpphy->tx_isolation_med_band;
        else if (freq <= 5320)
                isolation = lpphy->tx_isolation_low_band;
@@ -238,7 +238,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
        b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB,
                        0xFF00, lpphy->rx_pwr_offset);
        if ((sprom->boardflags_lo & B43_BFL_FEM) &&
-          ((b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ||
+          ((b43_current_band(dev->wl) == NL80211_BAND_5GHZ) ||
           (sprom->boardflags_hi & B43_BFH_PAREF))) {
                ssb_pmu_set_ldo_voltage(&bus->chipco, LDO_PAREF, 0x28);
                ssb_pmu_set_ldo_paref(&bus->chipco, true);
@@ -280,7 +280,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
                b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xC0FF, 0x0900);
                b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xFFC0, 0x000A);
                b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xC0FF, 0x0B00);
-       } else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ ||
+       } else if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ ||
                   (dev->dev->board_type == SSB_BOARD_BU4312) ||
                   (dev->phy.rev == 0 && (sprom->boardflags_lo & B43_BFL_FEM))) {
                b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0001);
@@ -326,7 +326,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
                //FIXME the Broadcom driver caches & delays this HF write!
                b43_hf_write(dev, b43_hf_read(dev) | B43_HF_PR45960W);
        }
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                b43_phy_set(dev, B43_LPPHY_LP_PHY_CTL, 0x8000);
                b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0040);
                b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0x00FF, 0xA400);
@@ -466,7 +466,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
                b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40);
        }
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x40);
                b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xF0FF, 0xB00);
                b43_phy_maskset(dev, B43_LPPHY_SYNCPEAKCNT, 0xFFF8, 0x6);
@@ -547,7 +547,7 @@ static void lpphy_2062_init(struct b43_wldev *dev)
                b43_radio_write(dev, B2062_S_BG_CTL1,
                        (b43_radio_read(dev, B2062_N_COMM2) >> 1) | 0x80);
        }
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                b43_radio_set(dev, B2062_N_TSSI_CTL0, 0x1);
        else
                b43_radio_mask(dev, B2062_N_TSSI_CTL0, ~0x1);
@@ -746,7 +746,7 @@ static void lpphy_clear_deaf(struct b43_wldev *dev, bool user)
                lpphy->crs_sys_disable = false;
 
        if (!lpphy->crs_usr_disable && !lpphy->crs_sys_disable) {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                        b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL,
                                        0xFF1F, 0x60);
                else
@@ -807,7 +807,7 @@ static void lpphy_disable_rx_gain_override(struct b43_wldev *dev)
        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFBF);
        if (dev->phy.rev >= 2) {
                b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFEFF);
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFBFF);
                        b43_phy_mask(dev, B43_PHY_OFDM(0xE5), 0xFFF7);
                }
@@ -823,7 +823,7 @@ static void lpphy_enable_rx_gain_override(struct b43_wldev *dev)
        b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x40);
        if (dev->phy.rev >= 2) {
                b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x100);
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x400);
                        b43_phy_set(dev, B43_PHY_OFDM(0xE5), 0x8);
                }
@@ -951,7 +951,7 @@ static void lpphy_rev2plus_set_rx_gain(struct b43_wldev *dev, u32 gain)
                        0xFBFF, ext_lna << 10);
        b43_phy_write(dev, B43_LPPHY_RX_GAIN_CTL_OVERRIDE_VAL, low_gain);
        b43_phy_maskset(dev, B43_LPPHY_AFE_DDFS, 0xFFF0, high_gain);
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                tmp = (gain >> 2) & 0x3;
                b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2_VAL,
                                0xE7FF, tmp<<11);
@@ -1344,7 +1344,7 @@ static void lpphy_calibrate_rc(struct b43_wldev *dev)
        if (dev->phy.rev >= 2) {
                lpphy_rev2plus_rc_calib(dev);
        } else if (!lpphy->rc_cap) {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                        lpphy_rev0_1_rc_calib(dev);
        } else {
                lpphy_set_rc_cap(dev);
@@ -1548,7 +1548,7 @@ static void lpphy_tx_pctl_init_sw(struct b43_wldev *dev)
 {
        struct lpphy_tx_gains gains;
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                gains.gm = 4;
                gains.pad = 12;
                gains.pga = 12;
@@ -1902,7 +1902,7 @@ static int lpphy_rx_iq_cal(struct b43_wldev *dev, bool noise, bool tx,
 
        lpphy_set_trsw_over(dev, tx, rx);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x8);
                b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0,
                                0xFFF7, pa << 3);
index 9f0bcf3..a5557d7 100644 (file)
@@ -105,9 +105,9 @@ enum n_rail_type {
 
 static inline bool b43_nphy_ipa(struct b43_wldev *dev)
 {
-       enum ieee80211_band band = b43_current_band(dev->wl);
-       return ((dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) ||
-               (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ));
+       enum nl80211_band band = b43_current_band(dev->wl);
+       return ((dev->phy.n->ipa2g_on && band == NL80211_BAND_2GHZ) ||
+               (dev->phy.n->ipa5g_on && band == NL80211_BAND_5GHZ));
 }
 
 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreGetState */
@@ -357,7 +357,7 @@ static void b43_nphy_rf_ctl_intc_override_rev7(struct b43_wldev *dev,
                        break;
                case N_INTC_OVERRIDE_PA:
                        tmp = 0x0030;
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+                       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                                val = value << 5;
                        else
                                val = value << 4;
@@ -365,7 +365,7 @@ static void b43_nphy_rf_ctl_intc_override_rev7(struct b43_wldev *dev,
                        b43_phy_set(dev, reg, 0x1000);
                        break;
                case N_INTC_OVERRIDE_EXT_LNA_PU:
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+                       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                                tmp = 0x0001;
                                tmp2 = 0x0004;
                                val = value;
@@ -378,7 +378,7 @@ static void b43_nphy_rf_ctl_intc_override_rev7(struct b43_wldev *dev,
                        b43_phy_mask(dev, reg, ~tmp2);
                        break;
                case N_INTC_OVERRIDE_EXT_LNA_GAIN:
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+                       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                                tmp = 0x0002;
                                tmp2 = 0x0008;
                                val = value << 1;
@@ -465,7 +465,7 @@ static void b43_nphy_rf_ctl_intc_override(struct b43_wldev *dev,
                        }
                        break;
                case N_INTC_OVERRIDE_PA:
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+                       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                                tmp = 0x0020;
                                val = value << 5;
                        } else {
@@ -475,7 +475,7 @@ static void b43_nphy_rf_ctl_intc_override(struct b43_wldev *dev,
                        b43_phy_maskset(dev, reg, ~tmp, val);
                        break;
                case N_INTC_OVERRIDE_EXT_LNA_PU:
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+                       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                                tmp = 0x0001;
                                val = value;
                        } else {
@@ -485,7 +485,7 @@ static void b43_nphy_rf_ctl_intc_override(struct b43_wldev *dev,
                        b43_phy_maskset(dev, reg, ~tmp, val);
                        break;
                case N_INTC_OVERRIDE_EXT_LNA_GAIN:
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+                       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                                tmp = 0x0002;
                                val = value << 1;
                        } else {
@@ -600,7 +600,7 @@ static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev)
                b43_nphy_stay_in_carrier_search(dev, 1);
 
        if (nphy->gain_boost) {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        gain[0] = 6;
                        gain[1] = 6;
                } else {
@@ -736,7 +736,7 @@ static void b43_radio_2057_setup(struct b43_wldev *dev,
        switch (phy->radio_rev) {
        case 0 ... 4:
        case 6:
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        b43_radio_write(dev, R2057_RFPLL_LOOPFILTER_R1, 0x3f);
                        b43_radio_write(dev, R2057_CP_KPD_IDAC, 0x3f);
                        b43_radio_write(dev, R2057_RFPLL_LOOPFILTER_C1, 0x8);
@@ -751,7 +751,7 @@ static void b43_radio_2057_setup(struct b43_wldev *dev,
        case 9: /* e.g. PHY rev 16 */
                b43_radio_write(dev, R2057_LOGEN_PTAT_RESETS, 0x20);
                b43_radio_write(dev, R2057_VCOBUF_IDACS, 0x18);
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                        b43_radio_write(dev, R2057_LOGEN_PTAT_RESETS, 0x38);
                        b43_radio_write(dev, R2057_VCOBUF_IDACS, 0x0f);
 
@@ -775,7 +775,7 @@ static void b43_radio_2057_setup(struct b43_wldev *dev,
                break;
        }
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                u16 txmix2g_tune_boost_pu = 0;
                u16 pad2g_tune_pus = 0;
 
@@ -1135,7 +1135,7 @@ static void b43_radio_2056_setup(struct b43_wldev *dev,
 {
        struct b43_phy *phy = &dev->phy;
        struct ssb_sprom *sprom = dev->dev->bus_sprom;
-       enum ieee80211_band band = b43_current_band(dev->wl);
+       enum nl80211_band band = b43_current_band(dev->wl);
        u16 offset;
        u8 i;
        u16 bias, cbias;
@@ -1152,10 +1152,10 @@ static void b43_radio_2056_setup(struct b43_wldev *dev,
                 dev->dev->chip_pkg == BCMA_PKG_ID_BCM43224_FAB_SMIC);
 
        b43_chantab_radio_2056_upload(dev, e);
-       b2056_upload_syn_pll_cp2(dev, band == IEEE80211_BAND_5GHZ);
+       b2056_upload_syn_pll_cp2(dev, band == NL80211_BAND_5GHZ);
 
        if (sprom->boardflags2_lo & B43_BFL2_GPLL_WAR &&
-           b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+           b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F);
                b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1F);
                if (dev->dev->chip_id == BCMA_CHIP_ID_BCM4716 ||
@@ -1168,21 +1168,21 @@ static void b43_radio_2056_setup(struct b43_wldev *dev,
                }
        }
        if (sprom->boardflags2_hi & B43_BFH2_GPLL_WAR2 &&
-           b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+           b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1f);
                b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1f);
                b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x0b);
                b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x20);
        }
        if (sprom->boardflags2_lo & B43_BFL2_APLL_WAR &&
-           b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+           b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F);
                b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1F);
                b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x05);
                b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x0C);
        }
 
-       if (dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) {
+       if (dev->phy.n->ipa2g_on && band == NL80211_BAND_2GHZ) {
                for (i = 0; i < 2; i++) {
                        offset = i ? B2056_TX1 : B2056_TX0;
                        if (dev->phy.rev >= 5) {
@@ -1244,7 +1244,7 @@ static void b43_radio_2056_setup(struct b43_wldev *dev,
                        }
                        b43_radio_write(dev, offset | B2056_TX_PA_SPARE1, 0xee);
                }
-       } else if (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ) {
+       } else if (dev->phy.n->ipa5g_on && band == NL80211_BAND_5GHZ) {
                u16 freq = phy->chandef->chan->center_freq;
                if (freq < 5100) {
                        paa_boost = 0xA;
@@ -1501,7 +1501,7 @@ static void b43_radio_init2055(struct b43_wldev *dev)
                /* Follow wl, not specs. Do not force uploading all regs */
                b2055_upload_inittab(dev, 0, 0);
        } else {
-               bool ghz5 = b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ;
+               bool ghz5 = b43_current_band(dev->wl) == NL80211_BAND_5GHZ;
                b2055_upload_inittab(dev, ghz5, 0);
        }
        b43_radio_init2055_post(dev);
@@ -1785,7 +1785,7 @@ static void b43_nphy_rev3_rssi_select(struct b43_wldev *dev, u8 code,
                                b43_phy_maskset(dev, reg, 0xFFC3, 0);
 
                                if (rssi_type == N_RSSI_W1)
-                                       val = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? 4 : 8;
+                                       val = (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) ? 4 : 8;
                                else if (rssi_type == N_RSSI_W2)
                                        val = 16;
                                else
@@ -1813,12 +1813,12 @@ static void b43_nphy_rev3_rssi_select(struct b43_wldev *dev, u8 code,
 
                                if (rssi_type != N_RSSI_IQ &&
                                    rssi_type != N_RSSI_TBD) {
-                                       enum ieee80211_band band =
+                                       enum nl80211_band band =
                                                b43_current_band(dev->wl);
 
                                        if (dev->phy.rev < 7) {
                                                if (b43_nphy_ipa(dev))
-                                                       val = (band == IEEE80211_BAND_5GHZ) ? 0xC : 0xE;
+                                                       val = (band == NL80211_BAND_5GHZ) ? 0xC : 0xE;
                                                else
                                                        val = 0x11;
                                                reg = (i == 0) ? B2056_TX0 : B2056_TX1;
@@ -2120,7 +2120,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
                                                     1, 0, false);
                b43_nphy_rf_ctl_override_rev7(dev, 0x80, 1, 0, false, 0);
                b43_nphy_rf_ctl_override_rev7(dev, 0x40, 1, 0, false, 0);
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                        b43_nphy_rf_ctl_override_rev7(dev, 0x20, 0, 0, false,
                                                      0);
                        b43_nphy_rf_ctl_override_rev7(dev, 0x10, 1, 0, false,
@@ -2136,7 +2136,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
                b43_nphy_rf_ctl_override(dev, 0x2, 1, 0, false);
                b43_nphy_rf_ctl_override(dev, 0x80, 1, 0, false);
                b43_nphy_rf_ctl_override(dev, 0x40, 1, 0, false);
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                        b43_nphy_rf_ctl_override(dev, 0x20, 0, 0, false);
                        b43_nphy_rf_ctl_override(dev, 0x10, 1, 0, false);
                } else {
@@ -2257,7 +2257,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
                b43_phy_write(dev, regs_to_store[i], saved_regs_phy[i]);
 
        /* Store for future configuration */
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G;
                rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G;
        } else {
@@ -2289,7 +2289,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
        rssical_phy_regs[11] = b43_phy_read(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y);
 
        /* Remember for which channel we store configuration */
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                nphy->rssical_chanspec_2G.center_freq = phy->chandef->chan->center_freq;
        else
                nphy->rssical_chanspec_5G.center_freq = phy->chandef->chan->center_freq;
@@ -2336,7 +2336,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, enum n_rssi_type type)
        b43_nphy_read_clip_detection(dev, clip_state);
        b43_nphy_write_clip_detection(dev, clip_off);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                override = 0x140;
        else
                override = 0x110;
@@ -2629,7 +2629,7 @@ static void b43_nphy_gain_ctl_workarounds_rev1_2(struct b43_wldev *dev)
        b43_phy_write(dev, B43_NPHY_CCK_SHIFTB_REF, 0x809C);
 
        if (nphy->gain_boost) {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ &&
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ &&
                    b43_is_40mhz(dev))
                        code = 4;
                else
@@ -2688,7 +2688,7 @@ static void b43_nphy_gain_ctl_workarounds_rev1_2(struct b43_wldev *dev)
                ~B43_NPHY_OVER_DGAIN_CCKDGECV & 0xFFFF,
                0x5A << B43_NPHY_OVER_DGAIN_CCKDGECV_SHIFT);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                b43_phy_maskset(dev, B43_PHY_N(0xC5D), 0xFF80, 4);
 }
 
@@ -2803,7 +2803,7 @@ static void b43_nphy_workarounds_rev7plus(struct b43_wldev *dev)
        scap_val = b43_radio_read(dev, R2057_RCCAL_SCAP_VAL);
 
        if (b43_nphy_ipa(dev)) {
-               bool ghz2 = b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ;
+               bool ghz2 = b43_current_band(dev->wl) == NL80211_BAND_2GHZ;
 
                switch (phy->radio_rev) {
                case 5:
@@ -2831,7 +2831,7 @@ static void b43_nphy_workarounds_rev7plus(struct b43_wldev *dev)
                                bcap_val_11b[core] = bcap_val;
                                lpf_ofdm_20mhz[core] = 4;
                                lpf_11b[core] = 1;
-                               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+                               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                                        scap_val_11n_20[core] = 0xc;
                                        bcap_val_11n_20[core] = 0xc;
                                        scap_val_11n_40[core] = 0xa;
@@ -2982,7 +2982,7 @@ static void b43_nphy_workarounds_rev7plus(struct b43_wldev *dev)
                        conv = 0x7f;
                        filt = 0xee;
                }
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        for (core = 0; core < 2; core++) {
                                if (core == 0) {
                                        b43_radio_write(dev, 0x5F, bias);
@@ -2998,7 +2998,7 @@ static void b43_nphy_workarounds_rev7plus(struct b43_wldev *dev)
        }
 
        if (b43_nphy_ipa(dev)) {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        if (phy->radio_rev == 3 || phy->radio_rev == 4 ||
                            phy->radio_rev == 6) {
                                for (core = 0; core < 2; core++) {
@@ -3221,7 +3221,7 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)
                                         ARRAY_SIZE(rx2tx_events));
        }
 
-       tmp16 = (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) ?
+       tmp16 = (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) ?
                0x2 : 0x9C40;
        b43_phy_write(dev, B43_NPHY_ENDROP_TLEN, tmp16);
 
@@ -3240,7 +3240,7 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)
        b43_ntab_write(dev, B43_NTAB16(8, 0), 2);
        b43_ntab_write(dev, B43_NTAB16(8, 16), 2);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                pdet_range = sprom->fem.ghz2.pdet_range;
        else
                pdet_range = sprom->fem.ghz5.pdet_range;
@@ -3249,7 +3249,7 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)
        switch (pdet_range) {
        case 3:
                if (!(dev->phy.rev >= 4 &&
-                     b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ))
+                     b43_current_band(dev->wl) == NL80211_BAND_2GHZ))
                        break;
                /* FALL THROUGH */
        case 0:
@@ -3261,7 +3261,7 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)
                break;
        case 2:
                if (dev->phy.rev >= 6) {
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+                       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                                vmid[3] = 0x94;
                        else
                                vmid[3] = 0x8e;
@@ -3277,7 +3277,7 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)
                break;
        case 4:
        case 5:
-               if (b43_current_band(dev->wl) != IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) != NL80211_BAND_2GHZ) {
                        if (pdet_range == 4) {
                                vmid[3] = 0x8e;
                                tmp16 = 0x96;
@@ -3322,9 +3322,9 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)
        /* N PHY WAR TX Chain Update with hw_phytxchain as argument */
 
        if ((sprom->boardflags2_lo & B43_BFL2_APLL_WAR &&
-            b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ||
+            b43_current_band(dev->wl) == NL80211_BAND_5GHZ) ||
            (sprom->boardflags2_lo & B43_BFL2_GPLL_WAR &&
-            b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ))
+            b43_current_band(dev->wl) == NL80211_BAND_2GHZ))
                tmp32 = 0x00088888;
        else
                tmp32 = 0x88888888;
@@ -3333,7 +3333,7 @@ static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev)
        b43_ntab_write(dev, B43_NTAB32(30, 3), tmp32);
 
        if (dev->phy.rev == 4 &&
-           b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+           b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                b43_radio_write(dev, B2056_TX0 | B2056_TX_GMBB_IDAC,
                                0x70);
                b43_radio_write(dev, B2056_TX1 | B2056_TX_GMBB_IDAC,
@@ -3376,7 +3376,7 @@ static void b43_nphy_workarounds_rev1_2(struct b43_wldev *dev)
                delays1[5] = 0x14;
        }
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ &&
+       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ &&
            nphy->band5g_pwrgain) {
                b43_radio_mask(dev, B2055_C1_TX_RF_SPARE, ~0x8);
                b43_radio_mask(dev, B2055_C2_TX_RF_SPARE, ~0x8);
@@ -3451,7 +3451,7 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
        struct b43_phy *phy = &dev->phy;
        struct b43_phy_n *nphy = phy->n;
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                b43_nphy_classifier(dev, 1, 0);
        else
                b43_nphy_classifier(dev, 1, 1);
@@ -3586,7 +3586,7 @@ static void b43_nphy_iq_cal_gain_params(struct b43_wldev *dev, u16 core,
                gain = (target.pad[core]) | (target.pga[core] << 4) |
                        (target.txgm[core] << 8);
 
-               indx = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ?
+               indx = (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) ?
                        1 : 0;
                for (i = 0; i < 9; i++)
                        if (tbl_iqcal_gainparams[indx][i][0] == gain)
@@ -3614,7 +3614,7 @@ static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable)
        struct b43_phy_n *nphy = dev->phy.n;
        u8 i;
        u16 bmask, val, tmp;
-       enum ieee80211_band band = b43_current_band(dev->wl);
+       enum nl80211_band band = b43_current_band(dev->wl);
 
        if (nphy->hang_avoid)
                b43_nphy_stay_in_carrier_search(dev, 1);
@@ -3679,7 +3679,7 @@ static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable)
                }
                b43_phy_maskset(dev, B43_NPHY_TXPCTL_CMD, ~(bmask), val);
 
-               if (band == IEEE80211_BAND_5GHZ) {
+               if (band == NL80211_BAND_5GHZ) {
                        if (phy->rev >= 19) {
                                /* TODO */
                        } else if (phy->rev >= 7) {
@@ -3770,7 +3770,7 @@ static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
                txpi[0] = 72;
                txpi[1] = 72;
        } else {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        txpi[0] = sprom->txpid2g[0];
                        txpi[1] = sprom->txpid2g[1];
                } else if (freq >= 4900 && freq < 5100) {
@@ -3868,7 +3868,7 @@ static void b43_nphy_ipa_internal_tssi_setup(struct b43_wldev *dev)
        } else if (phy->rev >= 7) {
                for (core = 0; core < 2; core++) {
                        r = core ? 0x190 : 0x170;
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+                       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                                b43_radio_write(dev, r + 0x5, 0x5);
                                b43_radio_write(dev, r + 0x9, 0xE);
                                if (phy->rev != 5)
@@ -3892,7 +3892,7 @@ static void b43_nphy_ipa_internal_tssi_setup(struct b43_wldev *dev)
                        b43_radio_write(dev, r + 0xC, 0);
                }
        } else {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                        b43_radio_write(dev, B2056_SYN_RESERVED_ADDR31, 0x128);
                else
                        b43_radio_write(dev, B2056_SYN_RESERVED_ADDR31, 0x80);
@@ -3909,7 +3909,7 @@ static void b43_nphy_ipa_internal_tssi_setup(struct b43_wldev *dev)
                        b43_radio_write(dev, r | B2056_TX_TSSI_MISC1, 8);
                        b43_radio_write(dev, r | B2056_TX_TSSI_MISC2, 0);
                        b43_radio_write(dev, r | B2056_TX_TSSI_MISC3, 0);
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+                       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                                b43_radio_write(dev, r | B2056_TX_TX_SSI_MASTER,
                                                0x5);
                                if (phy->rev != 5)
@@ -4098,7 +4098,7 @@ static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev)
                b0[0] = b0[1] = 5612;
                b1[0] = b1[1] = -1393;
        } else {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        for (c = 0; c < 2; c++) {
                                idle[c] = nphy->pwr_ctl_info[c].idle_tssi_2g;
                                target[c] = sprom->core_pwr_info[c].maxpwr_2g;
@@ -4153,11 +4153,11 @@ static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev)
                        for (c = 0; c < 2; c++) {
                                r = c ? 0x190 : 0x170;
                                if (b43_nphy_ipa(dev))
-                                       b43_radio_write(dev, r + 0x9, (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) ? 0xE : 0xC);
+                                       b43_radio_write(dev, r + 0x9, (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) ? 0xE : 0xC);
                        }
                } else {
                        if (b43_nphy_ipa(dev)) {
-                               tmp = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? 0xC : 0xE;
+                               tmp = (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) ? 0xC : 0xE;
                                b43_radio_write(dev,
                                        B2056_TX0 | B2056_TX_TX_SSI_MUX, tmp);
                                b43_radio_write(dev,
@@ -4267,13 +4267,13 @@ static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev)
                } else if (phy->rev >= 7) {
                        pga_gain = (table[i] >> 24) & 0xf;
                        pad_gain = (table[i] >> 19) & 0x1f;
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+                       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                                rfpwr_offset = rf_pwr_offset_table[pad_gain];
                        else
                                rfpwr_offset = rf_pwr_offset_table[pga_gain];
                } else {
                        pga_gain = (table[i] >> 24) & 0xF;
-                       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+                       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                                rfpwr_offset = b43_ntab_papd_pga_gain_delta_ipa_2g[pga_gain];
                        else
                                rfpwr_offset = 0; /* FIXME */
@@ -4288,7 +4288,7 @@ static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev)
 static void b43_nphy_pa_override(struct b43_wldev *dev, bool enable)
 {
        struct b43_phy_n *nphy = dev->phy.n;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u16 tmp;
 
        if (!enable) {
@@ -4300,12 +4300,12 @@ static void b43_nphy_pa_override(struct b43_wldev *dev, bool enable)
                if (dev->phy.rev >= 7) {
                        tmp = 0x1480;
                } else if (dev->phy.rev >= 3) {
-                       if (band == IEEE80211_BAND_5GHZ)
+                       if (band == NL80211_BAND_5GHZ)
                                tmp = 0x600;
                        else
                                tmp = 0x480;
                } else {
-                       if (band == IEEE80211_BAND_5GHZ)
+                       if (band == NL80211_BAND_5GHZ)
                                tmp = 0x180;
                        else
                                tmp = 0x120;
@@ -4734,7 +4734,7 @@ static void b43_nphy_restore_rssi_cal(struct b43_wldev *dev)
        u16 *rssical_radio_regs = NULL;
        u16 *rssical_phy_regs = NULL;
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                if (!nphy->rssical_chanspec_2G.center_freq)
                        return;
                rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G;
@@ -4804,7 +4804,7 @@ static void b43_nphy_tx_cal_radio_setup_rev7(struct b43_wldev *dev)
                save[off + 7] = b43_radio_read(dev, r + R2057_TX0_TSSIG);
                save[off + 8] = b43_radio_read(dev, r + R2057_TX0_TSSI_MISC1);
 
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                        b43_radio_write(dev, r + R2057_TX0_TX_SSI_MASTER, 0xA);
                        b43_radio_write(dev, r + R2057_TX0_IQCAL_VCM_HG, 0x43);
                        b43_radio_write(dev, r + R2057_TX0_IQCAL_IDAC, 0x55);
@@ -4864,7 +4864,7 @@ static void b43_nphy_tx_cal_radio_setup(struct b43_wldev *dev)
                save[offset + 9] = b43_radio_read(dev, B2055_XOMISC);
                save[offset + 10] = b43_radio_read(dev, B2055_PLL_LFC1);
 
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                        b43_radio_write(dev, tmp | B2055_CAL_RVARCTL, 0x0A);
                        b43_radio_write(dev, tmp | B2055_CAL_LPOCTL, 0x40);
                        b43_radio_write(dev, tmp | B2055_CAL_TS, 0x55);
@@ -5005,7 +5005,7 @@ static void b43_nphy_int_pa_set_tx_dig_filters(struct b43_wldev *dev)
                b43_nphy_pa_set_tx_dig_filter(dev, 0x186,
                                              tbl_tx_filter_coef_rev4[3]);
        } else {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                        b43_nphy_pa_set_tx_dig_filter(dev, 0x186,
                                                      tbl_tx_filter_coef_rev4[5]);
                if (dev->phy.channel == 14)
@@ -5185,7 +5185,7 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
                                                              false, 0);
                        } else if (phy->rev == 7) {
                                b43_radio_maskset(dev, R2057_OVR_REG0, 1 << 4, 1 << 4);
-                               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+                               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                                        b43_radio_maskset(dev, R2057_PAD2G_TUNE_PUS_CORE0, ~1, 0);
                                        b43_radio_maskset(dev, R2057_PAD2G_TUNE_PUS_CORE1, ~1, 0);
                                } else {
@@ -5210,7 +5210,7 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
                b43_ntab_write(dev, B43_NTAB16(8, 18), tmp);
                regs[5] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
                regs[6] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                        tmp = 0x0180;
                else
                        tmp = 0x0120;
@@ -5233,7 +5233,7 @@ static void b43_nphy_save_cal(struct b43_wldev *dev)
        if (nphy->hang_avoid)
                b43_nphy_stay_in_carrier_search(dev, 1);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G;
                txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G;
                iqcal_chanspec = &nphy->iqcal_chanspec_2G;
@@ -5304,7 +5304,7 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev)
        u16 *txcal_radio_regs = NULL;
        struct b43_phy_n_iq_comp *rxcal_coeffs = NULL;
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                if (!nphy->iqcal_chanspec_2G.center_freq)
                        return;
                table = nphy->cal_cache.txcal_coeffs_2G;
@@ -5332,7 +5332,7 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev)
        if (dev->phy.rev < 2)
                b43_nphy_tx_iq_workaround(dev);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G;
                rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G;
        } else {
@@ -5422,7 +5422,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
 
        phy6or5x = dev->phy.rev >= 6 ||
                (dev->phy.rev == 5 && nphy->ipa2g_on &&
-               b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ);
+               b43_current_band(dev->wl) == NL80211_BAND_2GHZ);
        if (phy6or5x) {
                if (b43_is_40mhz(dev)) {
                        b43_ntab_write_bulk(dev, B43_NTAB16(15, 0), 18,
@@ -5657,7 +5657,7 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
        u16 tmp[6];
        u16 uninitialized_var(cur_hpf1), uninitialized_var(cur_hpf2), cur_lna;
        u32 real, imag;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        u8 use;
        u16 cur_hpf;
@@ -5712,18 +5712,18 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
                band = b43_current_band(dev->wl);
 
                if (nphy->rxcalparams & 0xFF000000) {
-                       if (band == IEEE80211_BAND_5GHZ)
+                       if (band == NL80211_BAND_5GHZ)
                                b43_phy_write(dev, rfctl[0], 0x140);
                        else
                                b43_phy_write(dev, rfctl[0], 0x110);
                } else {
-                       if (band == IEEE80211_BAND_5GHZ)
+                       if (band == NL80211_BAND_5GHZ)
                                b43_phy_write(dev, rfctl[0], 0x180);
                        else
                                b43_phy_write(dev, rfctl[0], 0x120);
                }
 
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        b43_phy_write(dev, rfctl[1], 0x148);
                else
                        b43_phy_write(dev, rfctl[1], 0x114);
@@ -5919,7 +5919,7 @@ static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev,
 #if 0
        /* Some extra gains */
        hw_gain = 6; /* N-PHY specific */
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                hw_gain += sprom->antenna_gain.a0;
        else
                hw_gain += sprom->antenna_gain.a1;
@@ -6043,7 +6043,7 @@ static int b43_phy_initn(struct b43_wldev *dev)
        u8 tx_pwr_state;
        struct nphy_txgains target;
        u16 tmp;
-       enum ieee80211_band tmp2;
+       enum nl80211_band tmp2;
        bool do_rssi_cal;
 
        u16 clip[2];
@@ -6051,7 +6051,7 @@ static int b43_phy_initn(struct b43_wldev *dev)
 
        if ((dev->phy.rev >= 3) &&
           (sprom->boardflags_lo & B43_BFL_EXTLNA) &&
-          (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) {
+          (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)) {
                switch (dev->dev->bus_type) {
 #ifdef CONFIG_B43_BCMA
                case B43_BUS_BCMA:
@@ -6170,7 +6170,7 @@ static int b43_phy_initn(struct b43_wldev *dev)
 
        b43_nphy_classifier(dev, 0, 0);
        b43_nphy_read_clip_detection(dev, clip);
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                b43_nphy_bphy_init(dev);
 
        tx_pwr_state = nphy->txpwrctrl;
@@ -6187,7 +6187,7 @@ static int b43_phy_initn(struct b43_wldev *dev)
 
        do_rssi_cal = false;
        if (phy->rev >= 3) {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                        do_rssi_cal = !nphy->rssical_chanspec_2G.center_freq;
                else
                        do_rssi_cal = !nphy->rssical_chanspec_5G.center_freq;
@@ -6201,7 +6201,7 @@ static int b43_phy_initn(struct b43_wldev *dev)
        }
 
        if (!((nphy->measure_hold & 0x6) != 0)) {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                        do_cal = !nphy->iqcal_chanspec_2G.center_freq;
                else
                        do_cal = !nphy->iqcal_chanspec_5G.center_freq;
@@ -6291,7 +6291,7 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev,
        int ch = new_channel->hw_value;
        u16 tmp16;
 
-       if (new_channel->band == IEEE80211_BAND_5GHZ) {
+       if (new_channel->band == NL80211_BAND_5GHZ) {
                /* Switch to 2 GHz for a moment to access B43_PHY_B_BBCFG */
                b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
 
@@ -6302,7 +6302,7 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev,
                            B43_PHY_B_BBCFG_RSTCCA | B43_PHY_B_BBCFG_RSTRX);
                b43_write16(dev, B43_MMIO_PSM_PHY_HDR, tmp16);
                b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
-       } else if (new_channel->band == IEEE80211_BAND_2GHZ) {
+       } else if (new_channel->band == NL80211_BAND_2GHZ) {
                b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
                tmp16 = b43_read16(dev, B43_MMIO_PSM_PHY_HDR);
                b43_write16(dev, B43_MMIO_PSM_PHY_HDR, tmp16 | 4);
@@ -6319,7 +6319,7 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev,
                b43_phy_set(dev, B43_PHY_B_TEST, 0x0800);
        } else {
                b43_nphy_classifier(dev, 2, 2);
-               if (new_channel->band == IEEE80211_BAND_2GHZ)
+               if (new_channel->band == NL80211_BAND_2GHZ)
                        b43_phy_mask(dev, B43_PHY_B_TEST, ~0x840);
        }
 
@@ -6449,7 +6449,7 @@ static int b43_nphy_set_channel(struct b43_wldev *dev,
                        &(tabent_r7->phy_regs) : &(tabent_r7_2g->phy_regs);
 
                if (phy->radio_rev <= 4 || phy->radio_rev == 6) {
-                       tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 2 : 0;
+                       tmp = (channel->band == NL80211_BAND_5GHZ) ? 2 : 0;
                        b43_radio_maskset(dev, R2057_TIA_CONFIG_CORE0, ~2, tmp);
                        b43_radio_maskset(dev, R2057_TIA_CONFIG_CORE1, ~2, tmp);
                }
@@ -6457,12 +6457,12 @@ static int b43_nphy_set_channel(struct b43_wldev *dev,
                b43_radio_2057_setup(dev, tabent_r7, tabent_r7_2g);
                b43_nphy_channel_setup(dev, phy_regs, channel);
        } else if (phy->rev >= 3) {
-               tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 4 : 0;
+               tmp = (channel->band == NL80211_BAND_5GHZ) ? 4 : 0;
                b43_radio_maskset(dev, 0x08, 0xFFFB, tmp);
                b43_radio_2056_setup(dev, tabent_r3);
                b43_nphy_channel_setup(dev, &(tabent_r3->phy_regs), channel);
        } else {
-               tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 0x0020 : 0x0050;
+               tmp = (channel->band == NL80211_BAND_5GHZ) ? 0x0020 : 0x0050;
                b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp);
                b43_radio_2055_setup(dev, tabent_r2);
                b43_nphy_channel_setup(dev, &(tabent_r2->phy_regs), channel);
@@ -6692,7 +6692,7 @@ static int b43_nphy_op_switch_channel(struct b43_wldev *dev,
        enum nl80211_channel_type channel_type =
                cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                if ((new_channel < 1) || (new_channel > 14))
                        return -EINVAL;
        } else {
@@ -6705,7 +6705,7 @@ static int b43_nphy_op_switch_channel(struct b43_wldev *dev,
 
 static unsigned int b43_nphy_op_get_default_chan(struct b43_wldev *dev)
 {
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                return 1;
        return 36;
 }
index cff187c..ce01e16 100644 (file)
@@ -560,7 +560,7 @@ void b2062_upload_init_table(struct b43_wldev *dev)
 
        for (i = 0; i < ARRAY_SIZE(b2062_init_tab); i++) {
                e = &b2062_init_tab[i];
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        if (!(e->flags & B206X_FLAG_G))
                                continue;
                        b43_radio_write(dev, e->offset, e->value_g);
@@ -579,7 +579,7 @@ void b2063_upload_init_table(struct b43_wldev *dev)
 
        for (i = 0; i < ARRAY_SIZE(b2063_init_tab); i++) {
                e = &b2063_init_tab[i];
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                        if (!(e->flags & B206X_FLAG_G))
                                continue;
                        b43_radio_write(dev, e->offset, e->value_g);
@@ -2379,12 +2379,12 @@ static void lpphy_rev2plus_write_gain_table(struct b43_wldev *dev, int offset,
        tmp |= data.pga << 8;
        tmp |= data.gm;
        if (dev->phy.rev >= 3) {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                        tmp |= 0x10 << 24;
                else
                        tmp |= 0x70 << 24;
        } else {
-               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+               if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                        tmp |= 0x14 << 24;
                else
                        tmp |= 0x7F << 24;
@@ -2423,7 +2423,7 @@ void lpphy_init_tx_gain_table(struct b43_wldev *dev)
                    (sprom->boardflags_lo & B43_BFL_HGPA))
                        lpphy_write_gain_table_bulk(dev, 0, 128,
                                        lpphy_rev0_nopa_tx_gain_table);
-               else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               else if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                        lpphy_write_gain_table_bulk(dev, 0, 128,
                                        lpphy_rev0_2ghz_tx_gain_table);
                else
@@ -2435,7 +2435,7 @@ void lpphy_init_tx_gain_table(struct b43_wldev *dev)
                    (sprom->boardflags_lo & B43_BFL_HGPA))
                        lpphy_write_gain_table_bulk(dev, 0, 128,
                                        lpphy_rev1_nopa_tx_gain_table);
-               else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               else if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                        lpphy_write_gain_table_bulk(dev, 0, 128,
                                        lpphy_rev1_2ghz_tx_gain_table);
                else
@@ -2446,7 +2446,7 @@ void lpphy_init_tx_gain_table(struct b43_wldev *dev)
                if (sprom->boardflags_hi & B43_BFH_NOPA)
                        lpphy_write_gain_table_bulk(dev, 0, 128,
                                        lpphy_rev2_nopa_tx_gain_table);
-               else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               else if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
                        lpphy_write_gain_table_bulk(dev, 0, 128,
                                        lpphy_rev2_2ghz_tx_gain_table);
                else
index b2f0d24..44e0957 100644 (file)
@@ -3502,7 +3502,7 @@ static void b43_nphy_tables_init_rev7_volatile(struct b43_wldev *dev)
                { 0x2, 0x18, 0x2 }, /* Core 1 */
        };
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                antswlut = sprom->fem.ghz5.antswlut;
        else
                antswlut = sprom->fem.ghz2.antswlut;
@@ -3566,7 +3566,7 @@ static void b43_nphy_tables_init_rev3(struct b43_wldev *dev)
        struct ssb_sprom *sprom = dev->dev->bus_sprom;
        u8 antswlut;
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
+       if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ)
                antswlut = sprom->fem.ghz5.antswlut;
        else
                antswlut = sprom->fem.ghz2.antswlut;
@@ -3651,7 +3651,7 @@ static const u32 *b43_nphy_get_ipa_gain_table(struct b43_wldev *dev)
 {
        struct b43_phy *phy = &dev->phy;
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                switch (phy->rev) {
                case 17:
                        if (phy->radio_rev == 14)
@@ -3698,17 +3698,17 @@ static const u32 *b43_nphy_get_ipa_gain_table(struct b43_wldev *dev)
 const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev)
 {
        struct b43_phy *phy = &dev->phy;
-       enum ieee80211_band band = b43_current_band(dev->wl);
+       enum nl80211_band band = b43_current_band(dev->wl);
        struct ssb_sprom *sprom = dev->dev->bus_sprom;
 
        if (dev->phy.rev < 3)
                return b43_ntab_tx_gain_rev0_1_2;
 
        /* rev 3+ */
-       if ((dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) ||
-           (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ)) {
+       if ((dev->phy.n->ipa2g_on && band == NL80211_BAND_2GHZ) ||
+           (dev->phy.n->ipa5g_on && band == NL80211_BAND_5GHZ)) {
                return b43_nphy_get_ipa_gain_table(dev);
-       } else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+       } else if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) {
                switch (phy->rev) {
                case 6:
                case 5:
@@ -3746,7 +3746,7 @@ const s16 *b43_ntab_get_rf_pwr_offset_table(struct b43_wldev *dev)
 {
        struct b43_phy *phy = &dev->phy;
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                switch (phy->rev) {
                case 17:
                        if (phy->radio_rev == 14)
index e347b8d..704ef1b 100644 (file)
@@ -701,7 +701,7 @@ void b43_phy_lcn_tables_init(struct b43_wldev *dev)
 
        b43_phy_lcn_upload_static_tables(dev);
 
-       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+       if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) {
                if (sprom->boardflags_lo & B43_BFL_FEM)
                        b43_phy_lcn_load_tx_gain_tab(dev,
                                b43_lcntab_tx_gain_tbl_2ghz_ext_pa_rev0);
index 426dc13..f620126 100644 (file)
@@ -803,7 +803,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
        chanid = (chanstat & B43_RX_CHAN_ID) >> B43_RX_CHAN_ID_SHIFT;
        switch (chanstat & B43_RX_CHAN_PHYTYPE) {
        case B43_PHYTYPE_A:
-               status.band = IEEE80211_BAND_5GHZ;
+               status.band = NL80211_BAND_5GHZ;
                B43_WARN_ON(1);
                /* FIXME: We don't really know which value the "chanid" contains.
                 *        So the following assignment might be wrong. */
@@ -811,7 +811,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
                        ieee80211_channel_to_frequency(chanid, status.band);
                break;
        case B43_PHYTYPE_G:
-               status.band = IEEE80211_BAND_2GHZ;
+               status.band = NL80211_BAND_2GHZ;
                /* Somewhere between 478.104 and 508.1084 firmware for G-PHY
                 * has been modified to be compatible with N-PHY and others.
                 */
@@ -826,9 +826,9 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
                /* chanid is the SHM channel cookie. Which is the plain
                 * channel number in b43. */
                if (chanstat & B43_RX_CHAN_5GHZ)
-                       status.band = IEEE80211_BAND_5GHZ;
+                       status.band = NL80211_BAND_5GHZ;
                else
-                       status.band = IEEE80211_BAND_2GHZ;
+                       status.band = NL80211_BAND_2GHZ;
                status.freq =
                        ieee80211_channel_to_frequency(chanid, status.band);
                break;
index afc1fb3..83770d2 100644 (file)
@@ -1056,7 +1056,7 @@ static void b43legacy_write_probe_resp_plcp(struct b43legacy_wldev *dev,
        b43legacy_generate_plcp_hdr(&plcp, size + FCS_LEN, rate->hw_value);
        dur = ieee80211_generic_frame_duration(dev->wl->hw,
                                               dev->wl->vif,
-                                              IEEE80211_BAND_2GHZ,
+                                              NL80211_BAND_2GHZ,
                                               size,
                                               rate);
        /* Write PLCP in two parts and timing for packet transfer */
@@ -1122,7 +1122,7 @@ static const u8 *b43legacy_generate_probe_resp(struct b43legacy_wldev *dev,
                                         IEEE80211_STYPE_PROBE_RESP);
        dur = ieee80211_generic_frame_duration(dev->wl->hw,
                                               dev->wl->vif,
-                                              IEEE80211_BAND_2GHZ,
+                                              NL80211_BAND_2GHZ,
                                               *dest_size,
                                               rate);
        hdr->duration_id = dur;
@@ -2719,7 +2719,7 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
 
        /* Switch the PHY mode (if necessary). */
        switch (conf->chandef.chan->band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                if (phy->type == B43legacy_PHYTYPE_B)
                        new_phymode = B43legacy_PHYMODE_B;
                else
@@ -2792,7 +2792,7 @@ out_unlock_mutex:
 static void b43legacy_update_basic_rates(struct b43legacy_wldev *dev, u32 brates)
 {
        struct ieee80211_supported_band *sband =
-               dev->wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ];
+               dev->wl->hw->wiphy->bands[NL80211_BAND_2GHZ];
        struct ieee80211_rate *rate;
        int i;
        u16 basic, direct, offset, basic_offset, rateptr;
@@ -3630,13 +3630,13 @@ static int b43legacy_setup_modes(struct b43legacy_wldev *dev,
 
        phy->possible_phymodes = 0;
        if (have_bphy) {
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+               hw->wiphy->bands[NL80211_BAND_2GHZ] =
                        &b43legacy_band_2GHz_BPHY;
                phy->possible_phymodes |= B43legacy_PHYMODE_B;
        }
 
        if (have_gphy) {
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+               hw->wiphy->bands[NL80211_BAND_2GHZ] =
                        &b43legacy_band_2GHz_GPHY;
                phy->possible_phymodes |= B43legacy_PHYMODE_G;
        }
index 34bf3f0..35ccf40 100644 (file)
@@ -565,7 +565,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
        switch (chanstat & B43legacy_RX_CHAN_PHYTYPE) {
        case B43legacy_PHYTYPE_B:
        case B43legacy_PHYTYPE_G:
-               status.band = IEEE80211_BAND_2GHZ;
+               status.band = NL80211_BAND_2GHZ;
                status.freq = chanid + 2400;
                break;
        default:
index 6af658e..d1bc51f 100644 (file)
@@ -321,7 +321,8 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
        if (pktbuf->len == 0)
                return -ENODATA;
 
-       *ifp = tmp_if;
+       if (ifp != NULL)
+               *ifp = tmp_if;
        return 0;
 }
 
@@ -351,6 +352,12 @@ brcmf_proto_bcdc_add_tdls_peer(struct brcmf_pub *drvr, int ifidx,
 {
 }
 
+static void brcmf_proto_bcdc_rxreorder(struct brcmf_if *ifp,
+                                      struct sk_buff *skb)
+{
+       brcmf_fws_rxreorder(ifp, skb);
+}
+
 int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
 {
        struct brcmf_bcdc *bcdc;
@@ -372,6 +379,7 @@ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
        drvr->proto->configure_addr_mode = brcmf_proto_bcdc_configure_addr_mode;
        drvr->proto->delete_peer = brcmf_proto_bcdc_delete_peer;
        drvr->proto->add_tdls_peer = brcmf_proto_bcdc_add_tdls_peer;
+       drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder;
        drvr->proto->pd = bcdc;
 
        drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES;
index 8e02a47..2b24654 100644 (file)
@@ -216,7 +216,9 @@ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, struct sk_buff *pkt,
                      int prec);
 
 /* Receive frame for delivery to OS.  Callee disposes of rxp. */
-void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp);
+void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_event);
+/* Receive async event packet from firmware. Callee disposes of rxp. */
+void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
 
 /* Indication from bus module regarding presence/insertion of dongle. */
 int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings);
index d5c2a27..d0631b6 100644 (file)
@@ -144,7 +144,7 @@ static struct ieee80211_rate __wl_rates[] = {
 #define wl_a_rates_size                (wl_g_rates_size - 4)
 
 #define CHAN2G(_channel, _freq) {                              \
-       .band                   = IEEE80211_BAND_2GHZ,          \
+       .band                   = NL80211_BAND_2GHZ,            \
        .center_freq            = (_freq),                      \
        .hw_value               = (_channel),                   \
        .flags                  = IEEE80211_CHAN_DISABLED,      \
@@ -153,7 +153,7 @@ static struct ieee80211_rate __wl_rates[] = {
 }
 
 #define CHAN5G(_channel) {                                     \
-       .band                   = IEEE80211_BAND_5GHZ,          \
+       .band                   = NL80211_BAND_5GHZ,            \
        .center_freq            = 5000 + (5 * (_channel)),      \
        .hw_value               = (_channel),                   \
        .flags                  = IEEE80211_CHAN_DISABLED,      \
@@ -181,13 +181,13 @@ static struct ieee80211_channel __wl_5ghz_channels[] = {
  * above is added to the band during setup.
  */
 static const struct ieee80211_supported_band __wl_band_2ghz = {
-       .band = IEEE80211_BAND_2GHZ,
+       .band = NL80211_BAND_2GHZ,
        .bitrates = wl_g_rates,
        .n_bitrates = wl_g_rates_size,
 };
 
 static const struct ieee80211_supported_band __wl_band_5ghz = {
-       .band = IEEE80211_BAND_5GHZ,
+       .band = NL80211_BAND_5GHZ,
        .bitrates = wl_a_rates,
        .n_bitrates = wl_a_rates_size,
 };
@@ -250,6 +250,20 @@ struct parsed_vndr_ies {
        struct parsed_vndr_ie_info ie_info[VNDR_IE_PARSE_LIMIT];
 };
 
+static u8 nl80211_band_to_fwil(enum nl80211_band band)
+{
+       switch (band) {
+       case NL80211_BAND_2GHZ:
+               return WLC_BAND_2G;
+       case NL80211_BAND_5GHZ:
+               return WLC_BAND_5G;
+       default:
+               WARN_ON(1);
+               break;
+       }
+       return 0;
+}
+
 static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
                               struct cfg80211_chan_def *ch)
 {
@@ -292,13 +306,13 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
                WARN_ON_ONCE(1);
        }
        switch (ch->chan->band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                ch_inf.band = BRCMU_CHAN_BAND_2G;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                ch_inf.band = BRCMU_CHAN_BAND_5G;
                break;
-       case IEEE80211_BAND_60GHZ:
+       case NL80211_BAND_60GHZ:
        default:
                WARN_ON_ONCE(1);
        }
@@ -1796,6 +1810,50 @@ enum nl80211_auth_type brcmf_war_auth_type(struct brcmf_if *ifp,
        return type;
 }
 
+static void brcmf_set_join_pref(struct brcmf_if *ifp,
+                               struct cfg80211_bss_selection *bss_select)
+{
+       struct brcmf_join_pref_params join_pref_params[2];
+       enum nl80211_band band;
+       int err, i = 0;
+
+       join_pref_params[i].len = 2;
+       join_pref_params[i].rssi_gain = 0;
+
+       if (bss_select->behaviour != NL80211_BSS_SELECT_ATTR_BAND_PREF)
+               brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_ASSOC_PREFER, WLC_BAND_AUTO);
+
+       switch (bss_select->behaviour) {
+       case __NL80211_BSS_SELECT_ATTR_INVALID:
+               brcmf_c_set_joinpref_default(ifp);
+               return;
+       case NL80211_BSS_SELECT_ATTR_BAND_PREF:
+               join_pref_params[i].type = BRCMF_JOIN_PREF_BAND;
+               band = bss_select->param.band_pref;
+               join_pref_params[i].band = nl80211_band_to_fwil(band);
+               i++;
+               break;
+       case NL80211_BSS_SELECT_ATTR_RSSI_ADJUST:
+               join_pref_params[i].type = BRCMF_JOIN_PREF_RSSI_DELTA;
+               band = bss_select->param.adjust.band;
+               join_pref_params[i].band = nl80211_band_to_fwil(band);
+               join_pref_params[i].rssi_gain = bss_select->param.adjust.delta;
+               i++;
+               break;
+       case NL80211_BSS_SELECT_ATTR_RSSI:
+       default:
+               break;
+       }
+       join_pref_params[i].type = BRCMF_JOIN_PREF_RSSI;
+       join_pref_params[i].len = 2;
+       join_pref_params[i].rssi_gain = 0;
+       join_pref_params[i].band = 0;
+       err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
+                                      sizeof(join_pref_params));
+       if (err)
+               brcmf_err("Set join_pref error (%d)\n", err);
+}
+
 static s32
 brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
                       struct cfg80211_connect_params *sme)
@@ -1952,6 +2010,8 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
                ext_join_params->scan_le.nprobes = cpu_to_le32(-1);
        }
 
+       brcmf_set_join_pref(ifp, &sme->bss_select);
+
        err  = brcmf_fil_bsscfg_data_set(ifp, "join", ext_join_params,
                                         join_params_size);
        kfree(ext_join_params);
@@ -2679,9 +2739,9 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
        channel = bi->ctl_ch;
 
        if (channel <= CH_MAX_2G_CHANNEL)
-               band = wiphy->bands[IEEE80211_BAND_2GHZ];
+               band = wiphy->bands[NL80211_BAND_2GHZ];
        else
-               band = wiphy->bands[IEEE80211_BAND_5GHZ];
+               band = wiphy->bands[NL80211_BAND_5GHZ];
 
        freq = ieee80211_channel_to_frequency(channel, band->band);
        notify_channel = ieee80211_get_channel(wiphy, freq);
@@ -2788,9 +2848,9 @@ static s32 brcmf_inform_ibss(struct brcmf_cfg80211_info *cfg,
        cfg->d11inf.decchspec(&ch);
 
        if (ch.band == BRCMU_CHAN_BAND_2G)
-               band = wiphy->bands[IEEE80211_BAND_2GHZ];
+               band = wiphy->bands[NL80211_BAND_2GHZ];
        else
-               band = wiphy->bands[IEEE80211_BAND_5GHZ];
+               band = wiphy->bands[NL80211_BAND_5GHZ];
 
        freq = ieee80211_channel_to_frequency(ch.chnum, band->band);
        cfg->channel = freq;
@@ -3608,7 +3668,8 @@ static void brcmf_configure_wowl(struct brcmf_cfg80211_info *cfg,
        if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
                wowl_config |= BRCMF_WOWL_UNASSOC;
 
-       brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", strlen("clear"));
+       brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear",
+                                sizeof(struct brcmf_wowl_wakeind_le));
        brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
        brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
        brcmf_bus_wowl_config(cfg->pub->bus_if, true);
@@ -5215,9 +5276,9 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
        cfg->d11inf.decchspec(&ch);
 
        if (ch.band == BRCMU_CHAN_BAND_2G)
-               band = wiphy->bands[IEEE80211_BAND_2GHZ];
+               band = wiphy->bands[NL80211_BAND_2GHZ];
        else
-               band = wiphy->bands[IEEE80211_BAND_5GHZ];
+               band = wiphy->bands[NL80211_BAND_5GHZ];
 
        freq = ieee80211_channel_to_frequency(ch.chnum, band->band);
        notify_channel = ieee80211_get_channel(wiphy, freq);
@@ -5707,11 +5768,11 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
        }
 
        wiphy = cfg_to_wiphy(cfg);
-       band = wiphy->bands[IEEE80211_BAND_2GHZ];
+       band = wiphy->bands[NL80211_BAND_2GHZ];
        if (band)
                for (i = 0; i < band->n_channels; i++)
                        band->channels[i].flags = IEEE80211_CHAN_DISABLED;
-       band = wiphy->bands[IEEE80211_BAND_5GHZ];
+       band = wiphy->bands[NL80211_BAND_5GHZ];
        if (band)
                for (i = 0; i < band->n_channels; i++)
                        band->channels[i].flags = IEEE80211_CHAN_DISABLED;
@@ -5722,9 +5783,9 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
                cfg->d11inf.decchspec(&ch);
 
                if (ch.band == BRCMU_CHAN_BAND_2G) {
-                       band = wiphy->bands[IEEE80211_BAND_2GHZ];
+                       band = wiphy->bands[NL80211_BAND_2GHZ];
                } else if (ch.band == BRCMU_CHAN_BAND_5G) {
-                       band = wiphy->bands[IEEE80211_BAND_5GHZ];
+                       band = wiphy->bands[NL80211_BAND_5GHZ];
                } else {
                        brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
                        continue;
@@ -5839,7 +5900,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
                        return err;
                }
 
-               band = cfg_to_wiphy(cfg)->bands[IEEE80211_BAND_2GHZ];
+               band = cfg_to_wiphy(cfg)->bands[NL80211_BAND_2GHZ];
                list = (struct brcmf_chanspec_list *)pbuf;
                num_chan = le32_to_cpu(list->count);
                for (i = 0; i < num_chan; i++) {
@@ -5871,11 +5932,11 @@ static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
        band = WLC_BAND_2G;
        err = brcmf_fil_iovar_int_get(ifp, "bw_cap", &band);
        if (!err) {
-               bw_cap[IEEE80211_BAND_2GHZ] = band;
+               bw_cap[NL80211_BAND_2GHZ] = band;
                band = WLC_BAND_5G;
                err = brcmf_fil_iovar_int_get(ifp, "bw_cap", &band);
                if (!err) {
-                       bw_cap[IEEE80211_BAND_5GHZ] = band;
+                       bw_cap[NL80211_BAND_5GHZ] = band;
                        return;
                }
                WARN_ON(1);
@@ -5890,14 +5951,14 @@ static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
 
        switch (mimo_bwcap) {
        case WLC_N_BW_40ALL:
-               bw_cap[IEEE80211_BAND_2GHZ] |= WLC_BW_40MHZ_BIT;
+               bw_cap[NL80211_BAND_2GHZ] |= WLC_BW_40MHZ_BIT;
                /* fall-thru */
        case WLC_N_BW_20IN2G_40IN5G:
-               bw_cap[IEEE80211_BAND_5GHZ] |= WLC_BW_40MHZ_BIT;
+               bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_40MHZ_BIT;
                /* fall-thru */
        case WLC_N_BW_20ALL:
-               bw_cap[IEEE80211_BAND_2GHZ] |= WLC_BW_20MHZ_BIT;
-               bw_cap[IEEE80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
+               bw_cap[NL80211_BAND_2GHZ] |= WLC_BW_20MHZ_BIT;
+               bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
                break;
        default:
                brcmf_err("invalid mimo_bw_cap value\n");
@@ -5938,7 +5999,7 @@ static void brcmf_update_vht_cap(struct ieee80211_supported_band *band,
        __le16 mcs_map;
 
        /* not allowed in 2.4G band */
-       if (band->band == IEEE80211_BAND_2GHZ)
+       if (band->band == NL80211_BAND_2GHZ)
                return;
 
        band->vht_cap.vht_supported = true;
@@ -5997,8 +6058,8 @@ static int brcmf_setup_wiphybands(struct wiphy *wiphy)
                brcmf_get_bwcap(ifp, bw_cap);
        }
        brcmf_dbg(INFO, "nmode=%d, vhtmode=%d, bw_cap=(%d, %d)\n",
-                 nmode, vhtmode, bw_cap[IEEE80211_BAND_2GHZ],
-                 bw_cap[IEEE80211_BAND_5GHZ]);
+                 nmode, vhtmode, bw_cap[NL80211_BAND_2GHZ],
+                 bw_cap[NL80211_BAND_5GHZ]);
 
        err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
        if (err) {
@@ -6279,6 +6340,10 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
        wiphy->n_cipher_suites = ARRAY_SIZE(brcmf_cipher_suites);
        if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
                wiphy->n_cipher_suites--;
+       wiphy->bss_select_support = BIT(NL80211_BSS_SELECT_ATTR_RSSI) |
+                                   BIT(NL80211_BSS_SELECT_ATTR_BAND_PREF) |
+                                   BIT(NL80211_BSS_SELECT_ATTR_RSSI_ADJUST);
+
        wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT |
                        WIPHY_FLAG_OFFCHAN_TX |
                        WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
@@ -6321,7 +6386,7 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
                        }
 
                        band->n_channels = ARRAY_SIZE(__wl_2ghz_channels);
-                       wiphy->bands[IEEE80211_BAND_2GHZ] = band;
+                       wiphy->bands[NL80211_BAND_2GHZ] = band;
                }
                if (bandlist[i] == cpu_to_le32(WLC_BAND_5G)) {
                        band = kmemdup(&__wl_band_5ghz, sizeof(__wl_band_5ghz),
@@ -6338,7 +6403,7 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
                        }
 
                        band->n_channels = ARRAY_SIZE(__wl_5ghz_channels);
-                       wiphy->bands[IEEE80211_BAND_5GHZ] = band;
+                       wiphy->bands[NL80211_BAND_5GHZ] = band;
                }
        }
        err = brcmf_setup_wiphybands(wiphy);
@@ -6604,13 +6669,13 @@ static void brcmf_free_wiphy(struct wiphy *wiphy)
                        kfree(wiphy->iface_combinations[i].limits);
        }
        kfree(wiphy->iface_combinations);
-       if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
-               kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
-               kfree(wiphy->bands[IEEE80211_BAND_2GHZ]);
+       if (wiphy->bands[NL80211_BAND_2GHZ]) {
+               kfree(wiphy->bands[NL80211_BAND_2GHZ]->channels);
+               kfree(wiphy->bands[NL80211_BAND_2GHZ]);
        }
-       if (wiphy->bands[IEEE80211_BAND_5GHZ]) {
-               kfree(wiphy->bands[IEEE80211_BAND_5GHZ]->channels);
-               kfree(wiphy->bands[IEEE80211_BAND_5GHZ]);
+       if (wiphy->bands[NL80211_BAND_5GHZ]) {
+               kfree(wiphy->bands[NL80211_BAND_5GHZ]->channels);
+               kfree(wiphy->bands[NL80211_BAND_5GHZ]);
        }
        wiphy_free(wiphy);
 }
@@ -6698,8 +6763,8 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
         * cfg80211 here that we do and have it decide we can enable
         * it. But first check if device does support 2G operation.
         */
-       if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
-               cap = &wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap.cap;
+       if (wiphy->bands[NL80211_BAND_2GHZ]) {
+               cap = &wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap;
                *cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
        }
        err = wiphy_register(wiphy);
index 9e909e3..3e15d64 100644 (file)
@@ -38,7 +38,7 @@ const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME        40
 #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME        40
 
-/* boost value for RSSI_DELTA in preferred join selection */
+/* default boost value for RSSI_DELTA in preferred join selection */
 #define BRCMF_JOIN_PREF_RSSI_BOOST     8
 
 #define BRCMF_DEFAULT_TXGLOM_SIZE      32  /* max tx frames in glom chain */
@@ -83,11 +83,31 @@ MODULE_PARM_DESC(ignore_probe_fail, "always succeed probe for debugging");
 static struct brcmfmac_platform_data *brcmfmac_pdata;
 struct brcmf_mp_global_t brcmf_mp_global;
 
+void brcmf_c_set_joinpref_default(struct brcmf_if *ifp)
+{
+       struct brcmf_join_pref_params join_pref_params[2];
+       int err;
+
+       /* Setup join_pref to select target by RSSI (boost on 5GHz) */
+       join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA;
+       join_pref_params[0].len = 2;
+       join_pref_params[0].rssi_gain = BRCMF_JOIN_PREF_RSSI_BOOST;
+       join_pref_params[0].band = WLC_BAND_5G;
+
+       join_pref_params[1].type = BRCMF_JOIN_PREF_RSSI;
+       join_pref_params[1].len = 2;
+       join_pref_params[1].rssi_gain = 0;
+       join_pref_params[1].band = 0;
+       err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
+                                      sizeof(join_pref_params));
+       if (err)
+               brcmf_err("Set join_pref error (%d)\n", err);
+}
+
 int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
 {
        s8 eventmask[BRCMF_EVENTING_MASK_LEN];
        u8 buf[BRCMF_DCMD_SMLEN];
-       struct brcmf_join_pref_params join_pref_params[2];
        struct brcmf_rev_info_le revinfo;
        struct brcmf_rev_info *ri;
        char *ptr;
@@ -154,19 +174,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
                goto done;
        }
 
-       /* Setup join_pref to select target by RSSI(with boost on 5GHz) */
-       join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA;
-       join_pref_params[0].len = 2;
-       join_pref_params[0].rssi_gain = BRCMF_JOIN_PREF_RSSI_BOOST;
-       join_pref_params[0].band = WLC_BAND_5G;
-       join_pref_params[1].type = BRCMF_JOIN_PREF_RSSI;
-       join_pref_params[1].len = 2;
-       join_pref_params[1].rssi_gain = 0;
-       join_pref_params[1].band = 0;
-       err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
-                                      sizeof(join_pref_params));
-       if (err)
-               brcmf_err("Set join_pref error (%d)\n", err);
+       brcmf_c_set_joinpref_default(ifp);
 
        /* Setup event_msgs, enable E_IF */
        err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask,
index ff825cd..b590499 100644 (file)
 
 #define MAX_WAIT_FOR_8021X_TX                  msecs_to_jiffies(950)
 
-/* AMPDU rx reordering definitions */
-#define BRCMF_RXREORDER_FLOWID_OFFSET          0
-#define BRCMF_RXREORDER_MAXIDX_OFFSET          2
-#define BRCMF_RXREORDER_FLAGS_OFFSET           4
-#define BRCMF_RXREORDER_CURIDX_OFFSET          6
-#define BRCMF_RXREORDER_EXPIDX_OFFSET          8
-
-#define BRCMF_RXREORDER_DEL_FLOW               0x01
-#define BRCMF_RXREORDER_FLUSH_ALL              0x02
-#define BRCMF_RXREORDER_CURIDX_VALID           0x04
-#define BRCMF_RXREORDER_EXPIDX_VALID           0x08
-#define BRCMF_RXREORDER_NEW_HOLE               0x10
-
 #define BRCMF_BSSIDX_INVALID                   -1
 
 char *brcmf_ifname(struct brcmf_if *ifp)
@@ -313,15 +300,9 @@ void brcmf_txflowblock(struct device *dev, bool state)
 
 void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
 {
-       skb->dev = ifp->ndev;
-       skb->protocol = eth_type_trans(skb, skb->dev);
-
        if (skb->pkt_type == PACKET_MULTICAST)
                ifp->stats.multicast++;
 
-       /* Process special event packets */
-       brcmf_fweh_process_skb(ifp->drvr, skb);
-
        if (!(ifp->ndev->flags & IFF_UP)) {
                brcmu_pkt_buf_free_skb(skb);
                return;
@@ -341,226 +322,60 @@ void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
                netif_rx_ni(skb);
 }
 
-static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi,
-                                        u8 start, u8 end,
-                                        struct sk_buff_head *skb_list)
+static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, struct sk_buff *skb,
+                           struct brcmf_if **ifp)
 {
-       /* initialize return list */
-       __skb_queue_head_init(skb_list);
+       int ret;
 
-       if (rfi->pend_pkts == 0) {
-               brcmf_dbg(INFO, "no packets in reorder queue\n");
-               return;
+       /* process and remove protocol-specific header */
+       ret = brcmf_proto_hdrpull(drvr, true, skb, ifp);
+
+       if (ret || !(*ifp) || !(*ifp)->ndev) {
+               if (ret != -ENODATA && *ifp)
+                       (*ifp)->stats.rx_errors++;
+               brcmu_pkt_buf_free_skb(skb);
+               return -ENODATA;
        }
 
-       do {
-               if (rfi->pktslots[start]) {
-                       __skb_queue_tail(skb_list, rfi->pktslots[start]);
-                       rfi->pktslots[start] = NULL;
-               }
-               start++;
-               if (start > rfi->max_idx)
-                       start = 0;
-       } while (start != end);
-       rfi->pend_pkts -= skb_queue_len(skb_list);
+       skb->protocol = eth_type_trans(skb, (*ifp)->ndev);
+       return 0;
 }
 
-static void brcmf_rxreorder_process_info(struct brcmf_if *ifp, u8 *reorder_data,
-                                        struct sk_buff *pkt)
+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
 {
-       u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
-       struct brcmf_ampdu_rx_reorder *rfi;
-       struct sk_buff_head reorder_list;
-       struct sk_buff *pnext;
-       u8 flags;
-       u32 buf_size;
-
-       flow_id = reorder_data[BRCMF_RXREORDER_FLOWID_OFFSET];
-       flags = reorder_data[BRCMF_RXREORDER_FLAGS_OFFSET];
-
-       /* validate flags and flow id */
-       if (flags == 0xFF) {
-               brcmf_err("invalid flags...so ignore this packet\n");
-               brcmf_netif_rx(ifp, pkt);
-               return;
-       }
-
-       rfi = ifp->drvr->reorder_flows[flow_id];
-       if (flags & BRCMF_RXREORDER_DEL_FLOW) {
-               brcmf_dbg(INFO, "flow-%d: delete\n",
-                         flow_id);
+       struct brcmf_if *ifp;
+       struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+       struct brcmf_pub *drvr = bus_if->drvr;
 
-               if (rfi == NULL) {
-                       brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
-                                 flow_id);
-                       brcmf_netif_rx(ifp, pkt);
-                       return;
-               }
+       brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
 
-               brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, rfi->exp_idx,
-                                            &reorder_list);
-               /* add the last packet */
-               __skb_queue_tail(&reorder_list, pkt);
-               kfree(rfi);
-               ifp->drvr->reorder_flows[flow_id] = NULL;
-               goto netif_rx;
-       }
-       /* from here on we need a flow reorder instance */
-       if (rfi == NULL) {
-               buf_size = sizeof(*rfi);
-               max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
-
-               buf_size += (max_idx + 1) * sizeof(pkt);
-
-               /* allocate space for flow reorder info */
-               brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n",
-                         flow_id, max_idx);
-               rfi = kzalloc(buf_size, GFP_ATOMIC);
-               if (rfi == NULL) {
-                       brcmf_err("failed to alloc buffer\n");
-                       brcmf_netif_rx(ifp, pkt);
-                       return;
-               }
+       if (brcmf_rx_hdrpull(drvr, skb, &ifp))
+               return;
 
-               ifp->drvr->reorder_flows[flow_id] = rfi;
-               rfi->pktslots = (struct sk_buff **)(rfi+1);
-               rfi->max_idx = max_idx;
-       }
-       if (flags & BRCMF_RXREORDER_NEW_HOLE)  {
-               if (rfi->pend_pkts) {
-                       brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx,
-                                                    rfi->exp_idx,
-                                                    &reorder_list);
-                       WARN_ON(rfi->pend_pkts);
-               } else {
-                       __skb_queue_head_init(&reorder_list);
-               }
-               rfi->cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
-               rfi->exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
-               rfi->max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
-               rfi->pktslots[rfi->cur_idx] = pkt;
-               rfi->pend_pkts++;
-               brcmf_dbg(DATA, "flow-%d: new hole %d (%d), pending %d\n",
-                         flow_id, rfi->cur_idx, rfi->exp_idx, rfi->pend_pkts);
-       } else if (flags & BRCMF_RXREORDER_CURIDX_VALID) {
-               cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
-               exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
-
-               if ((exp_idx == rfi->exp_idx) && (cur_idx != rfi->exp_idx)) {
-                       /* still in the current hole */
-                       /* enqueue the current on the buffer chain */
-                       if (rfi->pktslots[cur_idx] != NULL) {
-                               brcmf_dbg(INFO, "HOLE: ERROR buffer pending..free it\n");
-                               brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
-                               rfi->pktslots[cur_idx] = NULL;
-                       }
-                       rfi->pktslots[cur_idx] = pkt;
-                       rfi->pend_pkts++;
-                       rfi->cur_idx = cur_idx;
-                       brcmf_dbg(DATA, "flow-%d: store pkt %d (%d), pending %d\n",
-                                 flow_id, cur_idx, exp_idx, rfi->pend_pkts);
-
-                       /* can return now as there is no reorder
-                        * list to process.
-                        */
-                       return;
-               }
-               if (rfi->exp_idx == cur_idx) {
-                       if (rfi->pktslots[cur_idx] != NULL) {
-                               brcmf_dbg(INFO, "error buffer pending..free it\n");
-                               brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
-                               rfi->pktslots[cur_idx] = NULL;
-                       }
-                       rfi->pktslots[cur_idx] = pkt;
-                       rfi->pend_pkts++;
-
-                       /* got the expected one. flush from current to expected
-                        * and update expected
-                        */
-                       brcmf_dbg(DATA, "flow-%d: expected %d (%d), pending %d\n",
-                                 flow_id, cur_idx, exp_idx, rfi->pend_pkts);
-
-                       rfi->cur_idx = cur_idx;
-                       rfi->exp_idx = exp_idx;
-
-                       brcmf_rxreorder_get_skb_list(rfi, cur_idx, exp_idx,
-                                                    &reorder_list);
-                       brcmf_dbg(DATA, "flow-%d: freeing buffers %d, pending %d\n",
-                                 flow_id, skb_queue_len(&reorder_list),
-                                 rfi->pend_pkts);
-               } else {
-                       u8 end_idx;
-
-                       brcmf_dbg(DATA, "flow-%d (0x%x): both moved, old %d/%d, new %d/%d\n",
-                                 flow_id, flags, rfi->cur_idx, rfi->exp_idx,
-                                 cur_idx, exp_idx);
-                       if (flags & BRCMF_RXREORDER_FLUSH_ALL)
-                               end_idx = rfi->exp_idx;
-                       else
-                               end_idx = exp_idx;
-
-                       /* flush pkts first */
-                       brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
-                                                    &reorder_list);
-
-                       if (exp_idx == ((cur_idx + 1) % (rfi->max_idx + 1))) {
-                               __skb_queue_tail(&reorder_list, pkt);
-                       } else {
-                               rfi->pktslots[cur_idx] = pkt;
-                               rfi->pend_pkts++;
-                       }
-                       rfi->exp_idx = exp_idx;
-                       rfi->cur_idx = cur_idx;
-               }
+       if (brcmf_proto_is_reorder_skb(skb)) {
+               brcmf_proto_rxreorder(ifp, skb);
        } else {
-               /* explicity window move updating the expected index */
-               exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
-
-               brcmf_dbg(DATA, "flow-%d (0x%x): change expected: %d -> %d\n",
-                         flow_id, flags, rfi->exp_idx, exp_idx);
-               if (flags & BRCMF_RXREORDER_FLUSH_ALL)
-                       end_idx =  rfi->exp_idx;
-               else
-                       end_idx =  exp_idx;
+               /* Process special event packets */
+               if (handle_event)
+                       brcmf_fweh_process_skb(ifp->drvr, skb);
 
-               brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
-                                            &reorder_list);
-               __skb_queue_tail(&reorder_list, pkt);
-               /* set the new expected idx */
-               rfi->exp_idx = exp_idx;
-       }
-netif_rx:
-       skb_queue_walk_safe(&reorder_list, pkt, pnext) {
-               __skb_unlink(pkt, &reorder_list);
-               brcmf_netif_rx(ifp, pkt);
+               brcmf_netif_rx(ifp, skb);
        }
 }
 
-void brcmf_rx_frame(struct device *dev, struct sk_buff *skb)
+void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
 {
        struct brcmf_if *ifp;
        struct brcmf_bus *bus_if = dev_get_drvdata(dev);
        struct brcmf_pub *drvr = bus_if->drvr;
-       struct brcmf_skb_reorder_data *rd;
-       int ret;
 
-       brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
-
-       /* process and remove protocol-specific header */
-       ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
+       brcmf_dbg(EVENT, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
 
-       if (ret || !ifp || !ifp->ndev) {
-               if (ret != -ENODATA && ifp)
-                       ifp->stats.rx_errors++;
-               brcmu_pkt_buf_free_skb(skb);
+       if (brcmf_rx_hdrpull(drvr, skb, &ifp))
                return;
-       }
 
-       rd = (struct brcmf_skb_reorder_data *)skb->cb;
-       if (rd->reorder)
-               brcmf_rxreorder_process_info(ifp, rd->reorder, skb);
-       else
-               brcmf_netif_rx(ifp, skb);
+       brcmf_fweh_process_skb(ifp->drvr, skb);
+       brcmu_pkt_buf_free_skb(skb);
 }
 
 void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
index 7bdb6fe..647d3cc 100644 (file)
@@ -208,10 +208,6 @@ struct brcmf_if {
        u8 ipv6addr_idx;
 };
 
-struct brcmf_skb_reorder_data {
-       u8 *reorder;
-};
-
 int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
 
 /* Return pointer to interface name */
@@ -227,6 +223,7 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp,
 void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
 void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
 void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
+void brcmf_c_set_joinpref_default(struct brcmf_if *ifp);
 int __init brcmf_core_init(void);
 void __exit brcmf_core_exit(void);
 
index 7269056..c7c1e99 100644 (file)
@@ -29,6 +29,7 @@
 #define BRCMF_FW_MAX_NVRAM_SIZE                        64000
 #define BRCMF_FW_NVRAM_DEVPATH_LEN             19      /* devpath0=pcie/1/4/ */
 #define BRCMF_FW_NVRAM_PCIEDEV_LEN             10      /* pcie/1/4/ + \0 */
+#define BRCMF_FW_DEFAULT_BOARDREV              "boardrev=0xff"
 
 enum nvram_parser_state {
        IDLE,
@@ -51,6 +52,7 @@ enum nvram_parser_state {
  * @entry: start position of key,value entry.
  * @multi_dev_v1: detect pcie multi device v1 (compressed).
  * @multi_dev_v2: detect pcie multi device v2.
+ * @boardrev_found: nvram contains boardrev information.
  */
 struct nvram_parser {
        enum nvram_parser_state state;
@@ -63,6 +65,7 @@ struct nvram_parser {
        u32 entry;
        bool multi_dev_v1;
        bool multi_dev_v2;
+       bool boardrev_found;
 };
 
 /**
@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvram_handle_key(struct nvram_parser *nvp)
                        nvp->multi_dev_v1 = true;
                if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
                        nvp->multi_dev_v2 = true;
+               if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
+                       nvp->boardrev_found = true;
        } else if (!is_nvram_char(c) || c == ' ') {
                brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
                          nvp->line, nvp->column);
@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
        while (i < nvp->nvram_len) {
                if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
                        i += 2;
+                       if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
+                               nvp->boardrev_found = true;
                        while (nvp->nvram[i] != 0) {
                                nvram[j] = nvp->nvram[i];
                                i++;
@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
        while (i < nvp->nvram_len - len) {
                if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
                        i += len;
+                       if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
+                               nvp->boardrev_found = true;
                        while (nvp->nvram[i] != 0) {
                                nvram[j] = nvp->nvram[i];
                                i++;
@@ -356,6 +365,18 @@ fail:
        nvp->nvram_len = 0;
 }
 
+static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
+{
+       if (nvp->boardrev_found)
+               return;
+
+       memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV,
+              strlen(BRCMF_FW_DEFAULT_BOARDREV));
+       nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV);
+       nvp->nvram[nvp->nvram_len] = '\0';
+       nvp->nvram_len++;
+}
+
 /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const u8 *data, size_t data_len,
                if (nvp.state == END)
                        break;
        }
-       if (nvp.multi_dev_v1)
+       if (nvp.multi_dev_v1) {
+               nvp.boardrev_found = false;
                brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
-       else if (nvp.multi_dev_v2)
+       } else if (nvp.multi_dev_v2) {
+               nvp.boardrev_found = false;
                brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
+       }
 
        if (nvp.nvram_len == 0) {
                kfree(nvp.nvram);
                return NULL;
        }
 
+       brcmf_fw_add_defaults(&nvp);
+
        pad = nvp.nvram_len;
        *new_length = roundup(nvp.nvram_len + 1, 4);
        while (pad != *new_length) {
index d414fbb..b390561 100644 (file)
@@ -371,6 +371,7 @@ int brcmf_fweh_activate_events(struct brcmf_if *ifp)
        int i, err;
        s8 eventmask[BRCMF_EVENTING_MASK_LEN];
 
+       memset(eventmask, 0, sizeof(eventmask));
        for (i = 0; i < BRCMF_E_LAST; i++) {
                if (ifp->drvr->fweh.evt_handler[i]) {
                        brcmf_dbg(EVENT, "enable event %s\n",
index 6b72df1..3a9a76d 100644 (file)
@@ -78,6 +78,7 @@
 #define BRCMF_C_SET_SCAN_CHANNEL_TIME          185
 #define BRCMF_C_SET_SCAN_UNASSOC_TIME          187
 #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON  201
+#define BRCMF_C_SET_ASSOC_PREFER               205
 #define BRCMF_C_GET_VALID_CHANNELS             217
 #define BRCMF_C_GET_KEY_PRIMARY                        235
 #define BRCMF_C_SET_KEY_PRIMARY                        236
index f82c9ab..5b30922 100644 (file)
@@ -92,6 +92,19 @@ enum brcmf_fws_tlv_len {
 };
 #undef BRCMF_FWS_TLV_DEF
 
+/* AMPDU rx reordering definitions */
+#define BRCMF_RXREORDER_FLOWID_OFFSET          0
+#define BRCMF_RXREORDER_MAXIDX_OFFSET          2
+#define BRCMF_RXREORDER_FLAGS_OFFSET           4
+#define BRCMF_RXREORDER_CURIDX_OFFSET          6
+#define BRCMF_RXREORDER_EXPIDX_OFFSET          8
+
+#define BRCMF_RXREORDER_DEL_FLOW               0x01
+#define BRCMF_RXREORDER_FLUSH_ALL              0x02
+#define BRCMF_RXREORDER_CURIDX_VALID           0x04
+#define BRCMF_RXREORDER_EXPIDX_VALID           0x08
+#define BRCMF_RXREORDER_NEW_HOLE               0x10
+
 #ifdef DEBUG
 /*
  * brcmf_fws_tlv_names - array of tlv names.
@@ -1614,6 +1627,202 @@ static int brcmf_fws_notify_bcmc_credit_support(struct brcmf_if *ifp,
        return 0;
 }
 
+static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi,
+                                        u8 start, u8 end,
+                                        struct sk_buff_head *skb_list)
+{
+       /* initialize return list */
+       __skb_queue_head_init(skb_list);
+
+       if (rfi->pend_pkts == 0) {
+               brcmf_dbg(INFO, "no packets in reorder queue\n");
+               return;
+       }
+
+       do {
+               if (rfi->pktslots[start]) {
+                       __skb_queue_tail(skb_list, rfi->pktslots[start]);
+                       rfi->pktslots[start] = NULL;
+               }
+               start++;
+               if (start > rfi->max_idx)
+                       start = 0;
+       } while (start != end);
+       rfi->pend_pkts -= skb_queue_len(skb_list);
+}
+
+void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
+{
+       u8 *reorder_data;
+       u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
+       struct brcmf_ampdu_rx_reorder *rfi;
+       struct sk_buff_head reorder_list;
+       struct sk_buff *pnext;
+       u8 flags;
+       u32 buf_size;
+
+       reorder_data = ((struct brcmf_skb_reorder_data *)pkt->cb)->reorder;
+       flow_id = reorder_data[BRCMF_RXREORDER_FLOWID_OFFSET];
+       flags = reorder_data[BRCMF_RXREORDER_FLAGS_OFFSET];
+
+       /* validate flags and flow id */
+       if (flags == 0xFF) {
+               brcmf_err("invalid flags...so ignore this packet\n");
+               brcmf_netif_rx(ifp, pkt);
+               return;
+       }
+
+       rfi = ifp->drvr->reorder_flows[flow_id];
+       if (flags & BRCMF_RXREORDER_DEL_FLOW) {
+               brcmf_dbg(INFO, "flow-%d: delete\n",
+                         flow_id);
+
+               if (rfi == NULL) {
+                       brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
+                                 flow_id);
+                       brcmf_netif_rx(ifp, pkt);
+                       return;
+               }
+
+               brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, rfi->exp_idx,
+                                            &reorder_list);
+               /* add the last packet */
+               __skb_queue_tail(&reorder_list, pkt);
+               kfree(rfi);
+               ifp->drvr->reorder_flows[flow_id] = NULL;
+               goto netif_rx;
+       }
+       /* from here on we need a flow reorder instance */
+       if (rfi == NULL) {
+               buf_size = sizeof(*rfi);
+               max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
+
+               buf_size += (max_idx + 1) * sizeof(pkt);
+
+               /* allocate space for flow reorder info */
+               brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n",
+                         flow_id, max_idx);
+               rfi = kzalloc(buf_size, GFP_ATOMIC);
+               if (rfi == NULL) {
+                       brcmf_err("failed to alloc buffer\n");
+                       brcmf_netif_rx(ifp, pkt);
+                       return;
+               }
+
+               ifp->drvr->reorder_flows[flow_id] = rfi;
+               rfi->pktslots = (struct sk_buff **)(rfi + 1);
+               rfi->max_idx = max_idx;
+       }
+       if (flags & BRCMF_RXREORDER_NEW_HOLE)  {
+               if (rfi->pend_pkts) {
+                       brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx,
+                                                    rfi->exp_idx,
+                                                    &reorder_list);
+                       WARN_ON(rfi->pend_pkts);
+               } else {
+                       __skb_queue_head_init(&reorder_list);
+               }
+               rfi->cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
+               rfi->exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
+               rfi->max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
+               rfi->pktslots[rfi->cur_idx] = pkt;
+               rfi->pend_pkts++;
+               brcmf_dbg(DATA, "flow-%d: new hole %d (%d), pending %d\n",
+                         flow_id, rfi->cur_idx, rfi->exp_idx, rfi->pend_pkts);
+       } else if (flags & BRCMF_RXREORDER_CURIDX_VALID) {
+               cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
+               exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
+
+               if ((exp_idx == rfi->exp_idx) && (cur_idx != rfi->exp_idx)) {
+                       /* still in the current hole */
+                       /* enqueue the current on the buffer chain */
+                       if (rfi->pktslots[cur_idx] != NULL) {
+                               brcmf_dbg(INFO, "HOLE: ERROR buffer pending..free it\n");
+                               brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
+                               rfi->pktslots[cur_idx] = NULL;
+                       }
+                       rfi->pktslots[cur_idx] = pkt;
+                       rfi->pend_pkts++;
+                       rfi->cur_idx = cur_idx;
+                       brcmf_dbg(DATA, "flow-%d: store pkt %d (%d), pending %d\n",
+                                 flow_id, cur_idx, exp_idx, rfi->pend_pkts);
+
+                       /* can return now as there is no reorder
+                        * list to process.
+                        */
+                       return;
+               }
+               if (rfi->exp_idx == cur_idx) {
+                       if (rfi->pktslots[cur_idx] != NULL) {
+                               brcmf_dbg(INFO, "error buffer pending..free it\n");
+                               brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
+                               rfi->pktslots[cur_idx] = NULL;
+                       }
+                       rfi->pktslots[cur_idx] = pkt;
+                       rfi->pend_pkts++;
+
+                       /* got the expected one. flush from current to expected
+                        * and update expected
+                        */
+                       brcmf_dbg(DATA, "flow-%d: expected %d (%d), pending %d\n",
+                                 flow_id, cur_idx, exp_idx, rfi->pend_pkts);
+
+                       rfi->cur_idx = cur_idx;
+                       rfi->exp_idx = exp_idx;
+
+                       brcmf_rxreorder_get_skb_list(rfi, cur_idx, exp_idx,
+                                                    &reorder_list);
+                       brcmf_dbg(DATA, "flow-%d: freeing buffers %d, pending %d\n",
+                                 flow_id, skb_queue_len(&reorder_list),
+                                 rfi->pend_pkts);
+               } else {
+                       u8 end_idx;
+
+                       brcmf_dbg(DATA, "flow-%d (0x%x): both moved, old %d/%d, new %d/%d\n",
+                                 flow_id, flags, rfi->cur_idx, rfi->exp_idx,
+                                 cur_idx, exp_idx);
+                       if (flags & BRCMF_RXREORDER_FLUSH_ALL)
+                               end_idx = rfi->exp_idx;
+                       else
+                               end_idx = exp_idx;
+
+                       /* flush pkts first */
+                       brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
+                                                    &reorder_list);
+
+                       if (exp_idx == ((cur_idx + 1) % (rfi->max_idx + 1))) {
+                               __skb_queue_tail(&reorder_list, pkt);
+                       } else {
+                               rfi->pktslots[cur_idx] = pkt;
+                               rfi->pend_pkts++;
+                       }
+                       rfi->exp_idx = exp_idx;
+                       rfi->cur_idx = cur_idx;
+               }
+       } else {
+               /* explicity window move updating the expected index */
+               exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
+
+               brcmf_dbg(DATA, "flow-%d (0x%x): change expected: %d -> %d\n",
+                         flow_id, flags, rfi->exp_idx, exp_idx);
+               if (flags & BRCMF_RXREORDER_FLUSH_ALL)
+                       end_idx =  rfi->exp_idx;
+               else
+                       end_idx =  exp_idx;
+
+               brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
+                                            &reorder_list);
+               __skb_queue_tail(&reorder_list, pkt);
+               /* set the new expected idx */
+               rfi->exp_idx = exp_idx;
+       }
+netif_rx:
+       skb_queue_walk_safe(&reorder_list, pkt, pnext) {
+               __skb_unlink(pkt, &reorder_list);
+               brcmf_netif_rx(ifp, pkt);
+       }
+}
+
 void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
 {
        struct brcmf_skb_reorder_data *rd;
index a36bac1..ef0ad85 100644 (file)
@@ -29,5 +29,6 @@ void brcmf_fws_add_interface(struct brcmf_if *ifp);
 void brcmf_fws_del_interface(struct brcmf_if *ifp);
 void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb);
 void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked);
+void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb);
 
 #endif /* FWSIGNAL_H_ */
index 9229667..68f1ce0 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/types.h>
 #include <linux/netdevice.h>
+#include <linux/etherdevice.h>
 
 #include <brcmu_utils.h>
 #include <brcmu_wifi.h>
@@ -526,6 +527,9 @@ static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
        return -ENODEV;
 }
 
+static void brcmf_msgbuf_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
+{
+}
 
 static void
 brcmf_msgbuf_remove_flowring(struct brcmf_msgbuf *msgbuf, u16 flowid)
@@ -1075,28 +1079,13 @@ static void brcmf_msgbuf_rxbuf_event_post(struct brcmf_msgbuf *msgbuf)
 }
 
 
-static void
-brcmf_msgbuf_rx_skb(struct brcmf_msgbuf *msgbuf, struct sk_buff *skb,
-                   u8 ifidx)
-{
-       struct brcmf_if *ifp;
-
-       ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
-       if (!ifp || !ifp->ndev) {
-               brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
-               brcmu_pkt_buf_free_skb(skb);
-               return;
-       }
-       brcmf_netif_rx(ifp, skb);
-}
-
-
 static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
 {
        struct msgbuf_rx_event *event;
        u32 idx;
        u16 buflen;
        struct sk_buff *skb;
+       struct brcmf_if *ifp;
 
        event = (struct msgbuf_rx_event *)buf;
        idx = le32_to_cpu(event->msg.request_id);
@@ -1116,7 +1105,19 @@ static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
 
        skb_trim(skb, buflen);
 
-       brcmf_msgbuf_rx_skb(msgbuf, skb, event->msg.ifidx);
+       ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx);
+       if (!ifp || !ifp->ndev) {
+               brcmf_err("Received pkt for invalid ifidx %d\n",
+                         event->msg.ifidx);
+               goto exit;
+       }
+
+       skb->protocol = eth_type_trans(skb, ifp->ndev);
+
+       brcmf_fweh_process_skb(ifp->drvr, skb);
+
+exit:
+       brcmu_pkt_buf_free_skb(skb);
 }
 
 
@@ -1128,6 +1129,7 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
        u16 data_offset;
        u16 buflen;
        u32 idx;
+       struct brcmf_if *ifp;
 
        brcmf_msgbuf_update_rxbufpost_count(msgbuf, 1);
 
@@ -1148,7 +1150,14 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
 
        skb_trim(skb, buflen);
 
-       brcmf_msgbuf_rx_skb(msgbuf, skb, rx_complete->msg.ifidx);
+       ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx);
+       if (!ifp || !ifp->ndev) {
+               brcmf_err("Received pkt for invalid ifidx %d\n",
+                         rx_complete->msg.ifidx);
+               brcmu_pkt_buf_free_skb(skb);
+               return;
+       }
+       brcmf_netif_rx(ifp, skb);
 }
 
 
@@ -1460,6 +1469,7 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
        drvr->proto->configure_addr_mode = brcmf_msgbuf_configure_addr_mode;
        drvr->proto->delete_peer = brcmf_msgbuf_delete_peer;
        drvr->proto->add_tdls_peer = brcmf_msgbuf_add_tdls_peer;
+       drvr->proto->rxreorder = brcmf_msgbuf_rxreorder;
        drvr->proto->pd = msgbuf;
 
        init_waitqueue_head(&msgbuf->ioctl_resp_wait);
index b5a49e5..a70cda6 100644 (file)
@@ -1266,7 +1266,7 @@ static void
 brcmf_p2p_stop_wait_next_action_frame(struct brcmf_cfg80211_info *cfg)
 {
        struct brcmf_p2p_info *p2p = &cfg->p2p;
-       struct brcmf_if *ifp = cfg->escan_info.ifp;
+       struct brcmf_if *ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
 
        if (test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status) &&
            (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status) ||
@@ -1430,8 +1430,8 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
 
        freq = ieee80211_channel_to_frequency(ch.chnum,
                                              ch.band == BRCMU_CHAN_BAND_2G ?
-                                             IEEE80211_BAND_2GHZ :
-                                             IEEE80211_BAND_5GHZ);
+                                             NL80211_BAND_2GHZ :
+                                             NL80211_BAND_5GHZ);
 
        wdev = &ifp->vif->wdev;
        cfg80211_rx_mgmt(wdev, freq, 0, (u8 *)mgmt_frame, mgmt_frame_len, 0);
@@ -1900,8 +1900,8 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,
        mgmt_frame_len = e->datalen - sizeof(*rxframe);
        freq = ieee80211_channel_to_frequency(ch.chnum,
                                              ch.band == BRCMU_CHAN_BAND_2G ?
-                                             IEEE80211_BAND_2GHZ :
-                                             IEEE80211_BAND_5GHZ);
+                                             NL80211_BAND_2GHZ :
+                                             NL80211_BAND_5GHZ);
 
        cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len, 0);
 
index d55119d..57531f4 100644 (file)
@@ -22,6 +22,9 @@ enum proto_addr_mode {
        ADDR_DIRECT
 };
 
+struct brcmf_skb_reorder_data {
+       u8 *reorder;
+};
 
 struct brcmf_proto {
        int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
@@ -38,6 +41,7 @@ struct brcmf_proto {
                            u8 peer[ETH_ALEN]);
        void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
                              u8 peer[ETH_ALEN]);
+       void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
        void *pd;
 };
 
@@ -91,6 +95,18 @@ brcmf_proto_add_tdls_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
 {
        drvr->proto->add_tdls_peer(drvr, ifidx, peer);
 }
+static inline bool brcmf_proto_is_reorder_skb(struct sk_buff *skb)
+{
+       struct brcmf_skb_reorder_data *rd;
+
+       rd = (struct brcmf_skb_reorder_data *)skb->cb;
+       return !!rd->reorder;
+}
 
+static inline void
+brcmf_proto_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
+{
+       ifp->drvr->proto->rxreorder(ifp, skb);
+}
 
 #endif /* BRCMFMAC_PROTO_H */
index 48d7467..4252fa8 100644 (file)
@@ -1294,6 +1294,17 @@ static inline u8 brcmf_sdio_getdatoffset(u8 *swheader)
        return (u8)((hdrvalue & SDPCM_DOFFSET_MASK) >> SDPCM_DOFFSET_SHIFT);
 }
 
+static inline bool brcmf_sdio_fromevntchan(u8 *swheader)
+{
+       u32 hdrvalue;
+       u8 ret;
+
+       hdrvalue = *(u32 *)swheader;
+       ret = (u8)((hdrvalue & SDPCM_CHANNEL_MASK) >> SDPCM_CHANNEL_SHIFT);
+
+       return (ret == SDPCM_EVENT_CHANNEL);
+}
+
 static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header,
                              struct brcmf_sdio_hdrinfo *rd,
                              enum brcmf_sdio_frmtype type)
@@ -1641,7 +1652,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf_sdio *bus, u8 rxseq)
                                           pfirst->len, pfirst->next,
                                           pfirst->prev);
                        skb_unlink(pfirst, &bus->glom);
-                       brcmf_rx_frame(bus->sdiodev->dev, pfirst);
+                       if (brcmf_sdio_fromevntchan(pfirst->data))
+                               brcmf_rx_event(bus->sdiodev->dev, pfirst);
+                       else
+                               brcmf_rx_frame(bus->sdiodev->dev, pfirst,
+                                              false);
                        bus->sdcnt.rxglompkts++;
                }
 
@@ -1967,18 +1982,19 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
                __skb_trim(pkt, rd->len);
                skb_pull(pkt, rd->dat_offset);
 
+               if (pkt->len == 0)
+                       brcmu_pkt_buf_free_skb(pkt);
+               else if (rd->channel == SDPCM_EVENT_CHANNEL)
+                       brcmf_rx_event(bus->sdiodev->dev, pkt);
+               else
+                       brcmf_rx_frame(bus->sdiodev->dev, pkt,
+                                      false);
+
                /* prepare the descriptor for the next read */
                rd->len = rd->len_nxtfrm << 4;
                rd->len_nxtfrm = 0;
                /* treat all packet as event if we don't know */
                rd->channel = SDPCM_EVENT_CHANNEL;
-
-               if (pkt->len == 0) {
-                       brcmu_pkt_buf_free_skb(pkt);
-                       continue;
-               }
-
-               brcmf_rx_frame(bus->sdiodev->dev, pkt);
        }
 
        rxcount = maxframes - rxleft;
index 869eb82..aa0b2a1 100644 (file)
@@ -514,7 +514,7 @@ static void brcmf_usb_rx_complete(struct urb *urb)
 
        if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) {
                skb_put(skb, urb->actual_length);
-               brcmf_rx_frame(devinfo->dev, skb);
+               brcmf_rx_frame(devinfo->dev, skb, true);
                brcmf_usb_rx_refill(devinfo, req);
        } else {
                brcmu_pkt_buf_free_skb(skb);
index 38bd589..3a03287 100644 (file)
@@ -636,7 +636,7 @@ static void brcms_reg_apply_radar_flags(struct wiphy *wiphy)
        struct ieee80211_channel *ch;
        int i;
 
-       sband = wiphy->bands[IEEE80211_BAND_5GHZ];
+       sband = wiphy->bands[NL80211_BAND_5GHZ];
        if (!sband)
                return;
 
@@ -666,7 +666,7 @@ brcms_reg_apply_beaconing_flags(struct wiphy *wiphy,
        const struct ieee80211_reg_rule *rule;
        int band, i;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                sband = wiphy->bands[band];
                if (!sband)
                        continue;
@@ -710,7 +710,7 @@ static void brcms_reg_notifier(struct wiphy *wiphy,
                brcms_reg_apply_beaconing_flags(wiphy, request->initiator);
 
        /* Disable radio if all channels disallowed by regulatory */
-       for (band = 0; !ch_found && band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; !ch_found && band < NUM_NL80211_BANDS; band++) {
                sband = wiphy->bands[band];
                if (!sband)
                        continue;
@@ -755,9 +755,9 @@ void brcms_c_regd_init(struct brcms_c_info *wlc)
                                              &sup_chan);
 
                if (band_idx == BAND_2G_INDEX)
-                       sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+                       sband = wiphy->bands[NL80211_BAND_2GHZ];
                else
-                       sband = wiphy->bands[IEEE80211_BAND_5GHZ];
+                       sband = wiphy->bands[NL80211_BAND_5GHZ];
 
                for (i = 0; i < sband->n_channels; i++) {
                        ch = &sband->channels[i];
index 61ae276..7c2a9a9 100644 (file)
@@ -49,7 +49,7 @@
        FIF_PSPOLL)
 
 #define CHAN2GHZ(channel, freqency, chflags)  { \
-       .band = IEEE80211_BAND_2GHZ, \
+       .band = NL80211_BAND_2GHZ, \
        .center_freq = (freqency), \
        .hw_value = (channel), \
        .flags = chflags, \
@@ -58,7 +58,7 @@
 }
 
 #define CHAN5GHZ(channel, chflags)  { \
-       .band = IEEE80211_BAND_5GHZ, \
+       .band = NL80211_BAND_5GHZ, \
        .center_freq = 5000 + 5*(channel), \
        .hw_value = (channel), \
        .flags = chflags, \
@@ -217,7 +217,7 @@ static struct ieee80211_rate legacy_ratetable[] = {
 };
 
 static const struct ieee80211_supported_band brcms_band_2GHz_nphy_template = {
-       .band = IEEE80211_BAND_2GHZ,
+       .band = NL80211_BAND_2GHZ,
        .channels = brcms_2ghz_chantable,
        .n_channels = ARRAY_SIZE(brcms_2ghz_chantable),
        .bitrates = legacy_ratetable,
@@ -238,7 +238,7 @@ static const struct ieee80211_supported_band brcms_band_2GHz_nphy_template = {
 };
 
 static const struct ieee80211_supported_band brcms_band_5GHz_nphy_template = {
-       .band = IEEE80211_BAND_5GHZ,
+       .band = NL80211_BAND_5GHZ,
        .channels = brcms_5ghz_nphy_chantable,
        .n_channels = ARRAY_SIZE(brcms_5ghz_nphy_chantable),
        .bitrates = legacy_ratetable + BRCMS_LEGACY_5G_RATE_OFFSET,
@@ -1026,8 +1026,8 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw)
        int has_5g = 0;
        u16 phy_type;
 
-       hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
-       hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
+       hw->wiphy->bands[NL80211_BAND_2GHZ] = NULL;
+       hw->wiphy->bands[NL80211_BAND_5GHZ] = NULL;
 
        phy_type = brcms_c_get_phy_type(wl->wlc, 0);
        if (phy_type == PHY_TYPE_N || phy_type == PHY_TYPE_LCN) {
@@ -1038,7 +1038,7 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw)
                        band->ht_cap.mcs.rx_mask[1] = 0;
                        band->ht_cap.mcs.rx_highest = cpu_to_le16(72);
                }
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] = band;
+               hw->wiphy->bands[NL80211_BAND_2GHZ] = band;
        } else {
                return -EPERM;
        }
@@ -1049,7 +1049,7 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw)
                if (phy_type == PHY_TYPE_N || phy_type == PHY_TYPE_LCN) {
                        band = &wlc->bandstate[BAND_5G_INDEX]->band;
                        *band = brcms_band_5GHz_nphy_template;
-                       hw->wiphy->bands[IEEE80211_BAND_5GHZ] = band;
+                       hw->wiphy->bands[NL80211_BAND_5GHZ] = band;
                } else {
                        return -EPERM;
                }
index 218cbc8..e16ee60 100644 (file)
@@ -7076,7 +7076,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
        channel = BRCMS_CHAN_CHANNEL(rxh->RxChan);
 
        rx_status->band =
-               channel > 14 ? IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ;
+               channel > 14 ? NL80211_BAND_5GHZ : NL80211_BAND_2GHZ;
        rx_status->freq =
                ieee80211_channel_to_frequency(channel, rx_status->band);
 
@@ -7143,7 +7143,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
                 * a subset of the 2.4G rates. See bitrates field
                 * of brcms_band_5GHz_nphy (in mac80211_if.c).
                 */
-               if (rx_status->band == IEEE80211_BAND_5GHZ)
+               if (rx_status->band == NL80211_BAND_5GHZ)
                        rx_status->rate_idx -= BRCMS_LEGACY_5G_RATE_OFFSET;
 
                /* Determine short preamble and rate_idx */
index d2353f6..4bd9e2b 100644 (file)
@@ -5836,7 +5836,7 @@ static int airo_get_freq(struct net_device *dev,
        ch = le16_to_cpu(status_rid.channel);
        if((ch > 0) && (ch < 15)) {
                fwrq->m = 100000 *
-                       ieee80211_channel_to_frequency(ch, IEEE80211_BAND_2GHZ);
+                       ieee80211_channel_to_frequency(ch, NL80211_BAND_2GHZ);
                fwrq->e = 1;
        } else {
                fwrq->m = ch;
@@ -6894,7 +6894,7 @@ static int airo_get_range(struct net_device *dev,
        for(i = 0; i < 14; i++) {
                range->freq[k].i = i + 1; /* List index */
                range->freq[k].m = 100000 *
-                    ieee80211_channel_to_frequency(i + 1, IEEE80211_BAND_2GHZ);
+                    ieee80211_channel_to_frequency(i + 1, NL80211_BAND_2GHZ);
                range->freq[k++].e = 1; /* Values in MHz -> * 10^5 * 10 */
        }
        range->num_frequency = k;
@@ -7302,7 +7302,7 @@ static inline char *airo_translate_scan(struct net_device *dev,
        iwe.cmd = SIOCGIWFREQ;
        iwe.u.freq.m = le16_to_cpu(bss->dsChannel);
        iwe.u.freq.m = 100000 *
-             ieee80211_channel_to_frequency(iwe.u.freq.m, IEEE80211_BAND_2GHZ);
+             ieee80211_channel_to_frequency(iwe.u.freq.m, NL80211_BAND_2GHZ);
        iwe.u.freq.e = 1;
        current_ev = iwe_stream_add_event(info, current_ev, end_buf,
                                          &iwe, IW_EV_FREQ_LEN);
index 717320b..e1e42ed 100644 (file)
@@ -1913,7 +1913,7 @@ static int ipw2100_wdev_init(struct net_device *dev)
        if (geo->bg_channels) {
                struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band;
 
-               bg_band->band = IEEE80211_BAND_2GHZ;
+               bg_band->band = NL80211_BAND_2GHZ;
                bg_band->n_channels = geo->bg_channels;
                bg_band->channels = kcalloc(geo->bg_channels,
                                            sizeof(struct ieee80211_channel),
@@ -1924,7 +1924,7 @@ static int ipw2100_wdev_init(struct net_device *dev)
                }
                /* translate geo->bg to bg_band.channels */
                for (i = 0; i < geo->bg_channels; i++) {
-                       bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
+                       bg_band->channels[i].band = NL80211_BAND_2GHZ;
                        bg_band->channels[i].center_freq = geo->bg[i].freq;
                        bg_band->channels[i].hw_value = geo->bg[i].channel;
                        bg_band->channels[i].max_power = geo->bg[i].max_power;
@@ -1945,7 +1945,7 @@ static int ipw2100_wdev_init(struct net_device *dev)
                bg_band->bitrates = ipw2100_bg_rates;
                bg_band->n_bitrates = RATE_COUNT;
 
-               wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band;
+               wdev->wiphy->bands[NL80211_BAND_2GHZ] = bg_band;
        }
 
        wdev->wiphy->cipher_suites = ipw_cipher_suites;
index ed0adaf..dac13cf 100644 (file)
@@ -11359,7 +11359,7 @@ static int ipw_wdev_init(struct net_device *dev)
        if (geo->bg_channels) {
                struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band;
 
-               bg_band->band = IEEE80211_BAND_2GHZ;
+               bg_band->band = NL80211_BAND_2GHZ;
                bg_band->n_channels = geo->bg_channels;
                bg_band->channels = kcalloc(geo->bg_channels,
                                            sizeof(struct ieee80211_channel),
@@ -11370,7 +11370,7 @@ static int ipw_wdev_init(struct net_device *dev)
                }
                /* translate geo->bg to bg_band.channels */
                for (i = 0; i < geo->bg_channels; i++) {
-                       bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
+                       bg_band->channels[i].band = NL80211_BAND_2GHZ;
                        bg_band->channels[i].center_freq = geo->bg[i].freq;
                        bg_band->channels[i].hw_value = geo->bg[i].channel;
                        bg_band->channels[i].max_power = geo->bg[i].max_power;
@@ -11391,14 +11391,14 @@ static int ipw_wdev_init(struct net_device *dev)
                bg_band->bitrates = ipw2200_bg_rates;
                bg_band->n_bitrates = ipw2200_num_bg_rates;
 
-               wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band;
+               wdev->wiphy->bands[NL80211_BAND_2GHZ] = bg_band;
        }
 
        /* fill-out priv->ieee->a_band */
        if (geo->a_channels) {
                struct ieee80211_supported_band *a_band = &priv->ieee->a_band;
 
-               a_band->band = IEEE80211_BAND_5GHZ;
+               a_band->band = NL80211_BAND_5GHZ;
                a_band->n_channels = geo->a_channels;
                a_band->channels = kcalloc(geo->a_channels,
                                           sizeof(struct ieee80211_channel),
@@ -11409,7 +11409,7 @@ static int ipw_wdev_init(struct net_device *dev)
                }
                /* translate geo->a to a_band.channels */
                for (i = 0; i < geo->a_channels; i++) {
-                       a_band->channels[i].band = IEEE80211_BAND_5GHZ;
+                       a_band->channels[i].band = NL80211_BAND_5GHZ;
                        a_band->channels[i].center_freq = geo->a[i].freq;
                        a_band->channels[i].hw_value = geo->a[i].channel;
                        a_band->channels[i].max_power = geo->a[i].max_power;
@@ -11430,7 +11430,7 @@ static int ipw_wdev_init(struct net_device *dev)
                a_band->bitrates = ipw2200_a_rates;
                a_band->n_bitrates = ipw2200_num_a_rates;
 
-               wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = a_band;
+               wdev->wiphy->bands[NL80211_BAND_5GHZ] = a_band;
        }
 
        wdev->wiphy->cipher_suites = ipw_cipher_suites;
index af1b3e6..466912e 100644 (file)
@@ -1547,7 +1547,7 @@ il3945_irq_tasklet(struct il_priv *il)
 }
 
 static int
-il3945_get_channels_for_scan(struct il_priv *il, enum ieee80211_band band,
+il3945_get_channels_for_scan(struct il_priv *il, enum nl80211_band band,
                             u8 is_active, u8 n_probes,
                             struct il3945_scan_channel *scan_ch,
                             struct ieee80211_vif *vif)
@@ -1618,7 +1618,7 @@ il3945_get_channels_for_scan(struct il_priv *il, enum ieee80211_band band,
                /* scan_pwr_info->tpc.dsp_atten; */
 
                /*scan_pwr_info->tpc.tx_gain; */
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3;
                else {
                        scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3));
@@ -2534,7 +2534,7 @@ il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
        };
        struct il3945_scan_cmd *scan;
        u8 n_probes = 0;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        bool is_active = false;
        int ret;
        u16 len;
@@ -2615,14 +2615,14 @@ il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
        /* flags + rate selection */
 
        switch (il->scan_band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
                scan->tx_cmd.rate = RATE_1M_PLCP;
-               band = IEEE80211_BAND_2GHZ;
+               band = NL80211_BAND_2GHZ;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                scan->tx_cmd.rate = RATE_6M_PLCP;
-               band = IEEE80211_BAND_5GHZ;
+               band = NL80211_BAND_5GHZ;
                break;
        default:
                IL_WARN("Invalid scan band\n");
@@ -3507,7 +3507,7 @@ il3945_init_drv(struct il_priv *il)
 
        il->ieee_channels = NULL;
        il->ieee_rates = NULL;
-       il->band = IEEE80211_BAND_2GHZ;
+       il->band = NL80211_BAND_2GHZ;
 
        il->iw_mode = NL80211_IFTYPE_STATION;
        il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF;
@@ -3582,13 +3582,13 @@ il3945_setup_mac(struct il_priv *il)
        /* Default value; 4 EDCA QOS priorities */
        hw->queues = 4;
 
-       if (il->bands[IEEE80211_BAND_2GHZ].n_channels)
-               il->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                   &il->bands[IEEE80211_BAND_2GHZ];
+       if (il->bands[NL80211_BAND_2GHZ].n_channels)
+               il->hw->wiphy->bands[NL80211_BAND_2GHZ] =
+                   &il->bands[NL80211_BAND_2GHZ];
 
-       if (il->bands[IEEE80211_BAND_5GHZ].n_channels)
-               il->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                   &il->bands[IEEE80211_BAND_5GHZ];
+       if (il->bands[NL80211_BAND_5GHZ].n_channels)
+               il->hw->wiphy->bands[NL80211_BAND_5GHZ] =
+                   &il->bands[NL80211_BAND_5GHZ];
 
        il_leds_init(il);
 
@@ -3761,7 +3761,7 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto out_release_irq;
        }
 
-       il_set_rxon_channel(il, &il->bands[IEEE80211_BAND_2GHZ].channels[5]);
+       il_set_rxon_channel(il, &il->bands[NL80211_BAND_2GHZ].channels[5]);
        il3945_setup_deferred_work(il);
        il3945_setup_handlers(il);
        il_power_initialize(il);
index 76b0729..03ad9b8 100644 (file)
@@ -97,7 +97,7 @@ static struct il3945_tpt_entry il3945_tpt_table_g[] = {
 #define RATE_RETRY_TH          15
 
 static u8
-il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band)
+il3945_get_rate_idx_by_rssi(s32 rssi, enum nl80211_band band)
 {
        u32 idx = 0;
        u32 table_size = 0;
@@ -107,11 +107,11 @@ il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band)
                rssi = IL_MIN_RSSI_VAL;
 
        switch (band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                tpt_table = il3945_tpt_table_g;
                table_size = ARRAY_SIZE(il3945_tpt_table_g);
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                tpt_table = il3945_tpt_table_a;
                table_size = ARRAY_SIZE(il3945_tpt_table_a);
                break;
@@ -380,7 +380,7 @@ il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id)
 
        il->_3945.sta_supp_rates = sta->supp_rates[sband->band];
        /* For 5 GHz band it start at IL_FIRST_OFDM_RATE */
-       if (sband->band == IEEE80211_BAND_5GHZ) {
+       if (sband->band == NL80211_BAND_5GHZ) {
                rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE;
                il->_3945.sta_supp_rates <<= IL_FIRST_OFDM_RATE;
        }
@@ -541,7 +541,7 @@ il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *sband,
 
 static u16
 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, u8 idx, u16 rate_mask,
-                        enum ieee80211_band band)
+                        enum nl80211_band band)
 {
        u8 high = RATE_INVALID;
        u8 low = RATE_INVALID;
@@ -549,7 +549,7 @@ il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, u8 idx, u16 rate_mask,
 
        /* 802.11A walks to the next literal adjacent rate in
         * the rate table */
-       if (unlikely(band == IEEE80211_BAND_5GHZ)) {
+       if (unlikely(band == NL80211_BAND_5GHZ)) {
                int i;
                u32 mask;
 
@@ -657,14 +657,14 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
 
        /* get user max rate if set */
        max_rate_idx = txrc->max_rate_idx;
-       if (sband->band == IEEE80211_BAND_5GHZ && max_rate_idx != -1)
+       if (sband->band == NL80211_BAND_5GHZ && max_rate_idx != -1)
                max_rate_idx += IL_FIRST_OFDM_RATE;
        if (max_rate_idx < 0 || max_rate_idx >= RATE_COUNT)
                max_rate_idx = -1;
 
        idx = min(rs_sta->last_txrate_idx & 0xffff, RATE_COUNT_3945 - 1);
 
-       if (sband->band == IEEE80211_BAND_5GHZ)
+       if (sband->band == NL80211_BAND_5GHZ)
                rate_mask = rate_mask << IL_FIRST_OFDM_RATE;
 
        spin_lock_irqsave(&rs_sta->lock, flags);
@@ -806,7 +806,7 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
 
 out:
 
-       if (sband->band == IEEE80211_BAND_5GHZ) {
+       if (sband->band == NL80211_BAND_5GHZ) {
                if (WARN_ON_ONCE(idx < IL_FIRST_OFDM_RATE))
                        idx = IL_FIRST_OFDM_RATE;
                rs_sta->last_txrate_idx = idx;
@@ -935,7 +935,7 @@ il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
 
        rs_sta->tgg = 0;
        switch (il->band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                /* TODO: this always does G, not a regression */
                if (il->active.flags & RXON_FLG_TGG_PROTECT_MSK) {
                        rs_sta->tgg = 1;
@@ -943,7 +943,7 @@ il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
                } else
                        rs_sta->expected_tpt = il3945_expected_tpt_g;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                rs_sta->expected_tpt = il3945_expected_tpt_a;
                break;
        default:
index 93bdf68..7bcedbb 100644 (file)
@@ -255,13 +255,13 @@ il3945_rs_next_rate(struct il_priv *il, int rate)
        int next_rate = il3945_get_prev_ieee_rate(rate);
 
        switch (il->band) {
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                if (rate == RATE_12M_IDX)
                        next_rate = RATE_9M_IDX;
                else if (rate == RATE_6M_IDX)
                        next_rate = RATE_6M_IDX;
                break;
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) &&
                    il_is_associated(il)) {
                        if (rate == RATE_11M_IDX)
@@ -349,7 +349,7 @@ il3945_hdl_tx(struct il_priv *il, struct il_rx_buf *rxb)
 
        /* Fill the MRR chain with some info about on-chip retransmissions */
        rate_idx = il3945_hwrate_to_plcp_idx(tx_resp->rate);
-       if (info->band == IEEE80211_BAND_5GHZ)
+       if (info->band == NL80211_BAND_5GHZ)
                rate_idx -= IL_FIRST_OFDM_RATE;
 
        fail = tx_resp->failure_frame;
@@ -554,14 +554,14 @@ il3945_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb)
        rx_status.mactime = le64_to_cpu(rx_end->timestamp);
        rx_status.band =
            (rx_hdr->
-            phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? IEEE80211_BAND_2GHZ :
-           IEEE80211_BAND_5GHZ;
+            phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? NL80211_BAND_2GHZ :
+           NL80211_BAND_5GHZ;
        rx_status.freq =
            ieee80211_channel_to_frequency(le16_to_cpu(rx_hdr->channel),
                                           rx_status.band);
 
        rx_status.rate_idx = il3945_hwrate_to_plcp_idx(rx_hdr->rate);
-       if (rx_status.band == IEEE80211_BAND_5GHZ)
+       if (rx_status.band == NL80211_BAND_5GHZ)
                rx_status.rate_idx -= IL_FIRST_OFDM_RATE;
 
        rx_status.antenna =
@@ -1409,7 +1409,7 @@ il3945_send_tx_power(struct il_priv *il)
 
        chan = le16_to_cpu(il->active.channel);
 
-       txpower.band = (il->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
+       txpower.band = (il->band == NL80211_BAND_5GHZ) ? 0 : 1;
        ch_info = il_get_channel_info(il, il->band, chan);
        if (!ch_info) {
                IL_ERR("Failed to get channel info for channel %d [%d]\n", chan,
@@ -2310,7 +2310,7 @@ il3945_manage_ibss_station(struct il_priv *il, struct ieee80211_vif *vif,
 
                il3945_sync_sta(il, vif_priv->ibss_bssid_sta_id,
                                (il->band ==
-                                IEEE80211_BAND_5GHZ) ? RATE_6M_PLCP :
+                                NL80211_BAND_5GHZ) ? RATE_6M_PLCP :
                                RATE_1M_PLCP);
                il3945_rate_scale_init(il->hw, vif_priv->ibss_bssid_sta_id);
 
@@ -2343,7 +2343,7 @@ il3945_init_hw_rate_table(struct il_priv *il)
        }
 
        switch (il->band) {
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                D_RATE("Select A mode rate scale\n");
                /* If one of the following CCK rates is used,
                 * have it fall back to the 6M OFDM rate */
@@ -2359,7 +2359,7 @@ il3945_init_hw_rate_table(struct il_priv *il)
                    il3945_rates[IL_FIRST_OFDM_RATE].table_rs_idx;
                break;
 
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                D_RATE("Select B/G mode rate scale\n");
                /* If an OFDM rate is used, have it fall back to the
                 * 1M CCK rates */
index f9ed480..a91d170 100644 (file)
@@ -457,7 +457,7 @@ il4965_rxq_stop(struct il_priv *il)
 }
 
 int
-il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
+il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum nl80211_band band)
 {
        int idx = 0;
        int band_offset = 0;
@@ -468,7 +468,7 @@ il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
                return idx;
                /* Legacy rate format, search for match in table */
        } else {
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        band_offset = IL_FIRST_OFDM_RATE;
                for (idx = band_offset; idx < RATE_COUNT_LEGACY; idx++)
                        if (il_rates[idx].plcp == (rate_n_flags & 0xFF))
@@ -688,8 +688,8 @@ il4965_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb)
        rx_status.mactime = le64_to_cpu(phy_res->timestamp);
        rx_status.band =
            (phy_res->
-            phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? IEEE80211_BAND_2GHZ :
-           IEEE80211_BAND_5GHZ;
+            phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? NL80211_BAND_2GHZ :
+           NL80211_BAND_5GHZ;
        rx_status.freq =
            ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel),
                                           rx_status.band);
@@ -766,7 +766,7 @@ il4965_hdl_rx_phy(struct il_priv *il, struct il_rx_buf *rxb)
 
 static int
 il4965_get_channels_for_scan(struct il_priv *il, struct ieee80211_vif *vif,
-                            enum ieee80211_band band, u8 is_active,
+                            enum nl80211_band band, u8 is_active,
                             u8 n_probes, struct il_scan_channel *scan_ch)
 {
        struct ieee80211_channel *chan;
@@ -822,7 +822,7 @@ il4965_get_channels_for_scan(struct il_priv *il, struct ieee80211_vif *vif,
                 * power level:
                 * scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3;
                 */
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
                else
                        scan_ch->tx_gain = ((1 << 5) | (5 << 3));
@@ -870,7 +870,7 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
        u32 rate_flags = 0;
        u16 cmd_len;
        u16 rx_chain = 0;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u8 n_probes = 0;
        u8 rx_ant = il->hw_params.valid_rx_ant;
        u8 rate;
@@ -944,7 +944,7 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
        scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
 
        switch (il->scan_band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
                chan_mod =
                    le32_to_cpu(il->active.flags & RXON_FLG_CHANNEL_MODE_MSK) >>
@@ -956,7 +956,7 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
                        rate_flags = RATE_MCS_CCK_MSK;
                }
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                rate = RATE_6M_PLCP;
                break;
        default:
@@ -1590,7 +1590,7 @@ il4965_tx_cmd_build_rate(struct il_priv *il,
            || rate_idx > RATE_COUNT_LEGACY)
                rate_idx = rate_lowest_index(&il->bands[info->band], sta);
        /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
-       if (info->band == IEEE80211_BAND_5GHZ)
+       if (info->band == NL80211_BAND_5GHZ)
                rate_idx += IL_FIRST_OFDM_RATE;
        /* Get PLCP rate for tx_cmd->rate_n_flags */
        rate_plcp = il_rates[rate_idx].plcp;
@@ -3051,7 +3051,7 @@ il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
        }
        /* Set up the rate scaling to start at selected rate, fall back
         * all the way down to 1M in IEEE order, and then spin on 1M */
-       if (il->band == IEEE80211_BAND_5GHZ)
+       if (il->band == NL80211_BAND_5GHZ)
                r = RATE_6M_IDX;
        else
                r = RATE_1M_IDX;
@@ -5790,12 +5790,12 @@ il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length)
 
        hw->max_listen_interval = IL_CONN_MAX_LISTEN_INTERVAL;
 
-       if (il->bands[IEEE80211_BAND_2GHZ].n_channels)
-               il->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                   &il->bands[IEEE80211_BAND_2GHZ];
-       if (il->bands[IEEE80211_BAND_5GHZ].n_channels)
-               il->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                   &il->bands[IEEE80211_BAND_5GHZ];
+       if (il->bands[NL80211_BAND_2GHZ].n_channels)
+               il->hw->wiphy->bands[NL80211_BAND_2GHZ] =
+                   &il->bands[NL80211_BAND_2GHZ];
+       if (il->bands[NL80211_BAND_5GHZ].n_channels)
+               il->hw->wiphy->bands[NL80211_BAND_5GHZ] =
+                   &il->bands[NL80211_BAND_5GHZ];
 
        il_leds_init(il);
 
@@ -6368,7 +6368,7 @@ il4965_init_drv(struct il_priv *il)
 
        il->ieee_channels = NULL;
        il->ieee_rates = NULL;
-       il->band = IEEE80211_BAND_2GHZ;
+       il->band = NL80211_BAND_2GHZ;
 
        il->iw_mode = NL80211_IFTYPE_STATION;
        il->current_ht_config.smps = IEEE80211_SMPS_STATIC;
@@ -6480,7 +6480,7 @@ il4965_set_hw_params(struct il_priv *il)
        il->hw_params.max_data_size = IL49_RTC_DATA_SIZE;
        il->hw_params.max_inst_size = IL49_RTC_INST_SIZE;
        il->hw_params.max_bsm_size = BSM_SRAM_SIZE;
-       il->hw_params.ht40_channel = BIT(IEEE80211_BAND_5GHZ);
+       il->hw_params.ht40_channel = BIT(NL80211_BAND_5GHZ);
 
        il->hw_params.rx_wrt_ptr_reg = FH49_RSCSR_CHNL0_WPTR;
 
index bac60b2..a867ae7 100644 (file)
@@ -549,7 +549,7 @@ il4965_rate_n_flags_from_tbl(struct il_priv *il, struct il_scale_tbl_info *tbl,
  */
 static int
 il4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
-                               enum ieee80211_band band,
+                               enum nl80211_band band,
                                struct il_scale_tbl_info *tbl, int *rate_idx)
 {
        u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK);
@@ -574,7 +574,7 @@ il4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
        /* legacy rate format */
        if (!(rate_n_flags & RATE_MCS_HT_MSK)) {
                if (il4965_num_of_ant == 1) {
-                       if (band == IEEE80211_BAND_5GHZ)
+                       if (band == NL80211_BAND_5GHZ)
                                tbl->lq_type = LQ_A;
                        else
                                tbl->lq_type = LQ_G;
@@ -743,7 +743,7 @@ il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta,
        if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_idx)) {
                switch_to_legacy = 1;
                scale_idx = rs_ht_to_legacy[scale_idx];
-               if (lq_sta->band == IEEE80211_BAND_5GHZ)
+               if (lq_sta->band == NL80211_BAND_5GHZ)
                        tbl->lq_type = LQ_A;
                else
                        tbl->lq_type = LQ_G;
@@ -762,7 +762,7 @@ il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta,
        /* Mask with station rate restriction */
        if (is_legacy(tbl->lq_type)) {
                /* supp_rates has no CCK bits in A mode */
-               if (lq_sta->band == IEEE80211_BAND_5GHZ)
+               if (lq_sta->band == NL80211_BAND_5GHZ)
                        rate_mask =
                            (u16) (rate_mask &
                                   (lq_sta->supp_rates << IL_FIRST_OFDM_RATE));
@@ -851,7 +851,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
        table = &lq_sta->lq;
        tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags);
        il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, &tbl_type, &rs_idx);
-       if (il->band == IEEE80211_BAND_5GHZ)
+       if (il->band == NL80211_BAND_5GHZ)
                rs_idx -= IL_FIRST_OFDM_RATE;
        mac_flags = info->status.rates[0].flags;
        mac_idx = info->status.rates[0].idx;
@@ -864,7 +864,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
                 * mac80211 HT idx is always zero-idxed; we need to move
                 * HT OFDM rates after CCK rates in 2.4 GHz band
                 */
-               if (il->band == IEEE80211_BAND_2GHZ)
+               if (il->band == NL80211_BAND_2GHZ)
                        mac_idx += IL_FIRST_OFDM_RATE;
        }
        /* Here we actually compare this rate to the latest LQ command */
@@ -1816,7 +1816,7 @@ il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb,
 
        /* mask with station rate restriction */
        if (is_legacy(tbl->lq_type)) {
-               if (lq_sta->band == IEEE80211_BAND_5GHZ)
+               if (lq_sta->band == NL80211_BAND_5GHZ)
                        /* supp_rates has no CCK bits in A mode */
                        rate_scale_idx_msk =
                            (u16) (rate_mask &
@@ -2212,7 +2212,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
        /* Get max rate if user set max rate */
        if (lq_sta) {
                lq_sta->max_rate_idx = txrc->max_rate_idx;
-               if (sband->band == IEEE80211_BAND_5GHZ &&
+               if (sband->band == NL80211_BAND_5GHZ &&
                    lq_sta->max_rate_idx != -1)
                        lq_sta->max_rate_idx += IL_FIRST_OFDM_RATE;
                if (lq_sta->max_rate_idx < 0 ||
@@ -2258,11 +2258,11 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
        } else {
                /* Check for invalid rates */
                if (rate_idx < 0 || rate_idx >= RATE_COUNT_LEGACY ||
-                   (sband->band == IEEE80211_BAND_5GHZ &&
+                   (sband->band == NL80211_BAND_5GHZ &&
                     rate_idx < IL_FIRST_OFDM_RATE))
                        rate_idx = rate_lowest_index(sband, sta);
                /* On valid 5 GHz rate, adjust idx */
-               else if (sband->band == IEEE80211_BAND_5GHZ)
+               else if (sband->band == NL80211_BAND_5GHZ)
                        rate_idx -= IL_FIRST_OFDM_RATE;
                info->control.rates[0].flags = 0;
        }
@@ -2362,7 +2362,7 @@ il4965_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id)
 
        /* Set last_txrate_idx to lowest rate */
        lq_sta->last_txrate_idx = rate_lowest_index(sband, sta);
-       if (sband->band == IEEE80211_BAND_5GHZ)
+       if (sband->band == NL80211_BAND_5GHZ)
                lq_sta->last_txrate_idx += IL_FIRST_OFDM_RATE;
        lq_sta->is_agg = 0;
 
index fe47db9..c3c638e 100644 (file)
@@ -1267,7 +1267,7 @@ il4965_send_tx_power(struct il_priv *il)
             "TX Power requested while scanning!\n"))
                return -EAGAIN;
 
-       band = il->band == IEEE80211_BAND_2GHZ;
+       band = il->band == NL80211_BAND_2GHZ;
 
        is_ht40 = iw4965_is_ht40_channel(il->active.flags);
 
@@ -1480,7 +1480,7 @@ il4965_hw_channel_switch(struct il_priv *il,
        u8 switch_count;
        u16 beacon_interval = le16_to_cpu(il->timing.beacon_interval);
        struct ieee80211_vif *vif = il->vif;
-       band = (il->band == IEEE80211_BAND_2GHZ);
+       band = (il->band == NL80211_BAND_2GHZ);
 
        if (WARN_ON_ONCE(vif == NULL))
                return -EIO;
@@ -1918,7 +1918,7 @@ struct il_cfg il4965_cfg = {
         * Force use of chains B and C for scan RX on 5 GHz band
         * because the device has off-channel reception on chain A.
         */
-       .scan_rx_antennas[IEEE80211_BAND_5GHZ] = ANT_BC,
+       .scan_rx_antennas[NL80211_BAND_5GHZ] = ANT_BC,
 
        .eeprom_size = IL4965_EEPROM_IMG_SIZE,
        .num_of_queues = IL49_NUM_QUEUES,
index e432715..527e8b5 100644 (file)
@@ -68,7 +68,7 @@ void il4965_rx_replenish(struct il_priv *il);
 void il4965_rx_replenish_now(struct il_priv *il);
 void il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq);
 int il4965_rxq_stop(struct il_priv *il);
-int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band);
+int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum nl80211_band band);
 void il4965_rx_handle(struct il_priv *il);
 
 /* tx */
index 2cc3d42..eb24b92 100644 (file)
@@ -860,7 +860,7 @@ il_init_band_reference(const struct il_priv *il, int eep_band,
  * Does not set up a command, or touch hardware.
  */
 static int
-il_mod_ht40_chan_info(struct il_priv *il, enum ieee80211_band band, u16 channel,
+il_mod_ht40_chan_info(struct il_priv *il, enum nl80211_band band, u16 channel,
                      const struct il_eeprom_channel *eeprom_ch,
                      u8 clear_ht40_extension_channel)
 {
@@ -945,7 +945,7 @@ il_init_channel_map(struct il_priv *il)
                        ch_info->channel = eeprom_ch_idx[ch];
                        ch_info->band =
                            (band ==
-                            1) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+                            1) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
 
                        /* permanently store EEPROM's channel regulatory flags
                         *   and max power in channel info database. */
@@ -1003,14 +1003,14 @@ il_init_channel_map(struct il_priv *il)
 
        /* Two additional EEPROM bands for 2.4 and 5 GHz HT40 channels */
        for (band = 6; band <= 7; band++) {
-               enum ieee80211_band ieeeband;
+               enum nl80211_band ieeeband;
 
                il_init_band_reference(il, band, &eeprom_ch_count,
                                       &eeprom_ch_info, &eeprom_ch_idx);
 
                /* EEPROM band 6 is 2.4, band 7 is 5 GHz */
                ieeeband =
-                   (band == 6) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+                   (band == 6) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
 
                /* Loop through each band adding each of the channels */
                for (ch = 0; ch < eeprom_ch_count; ch++) {
@@ -1048,19 +1048,19 @@ EXPORT_SYMBOL(il_free_channel_map);
  * Based on band and channel number.
  */
 const struct il_channel_info *
-il_get_channel_info(const struct il_priv *il, enum ieee80211_band band,
+il_get_channel_info(const struct il_priv *il, enum nl80211_band band,
                    u16 channel)
 {
        int i;
 
        switch (band) {
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                for (i = 14; i < il->channel_count; i++) {
                        if (il->channel_info[i].channel == channel)
                                return &il->channel_info[i];
                }
                break;
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                if (channel >= 1 && channel <= 14)
                        return &il->channel_info[channel - 1];
                break;
@@ -1457,7 +1457,7 @@ il_hdl_scan_complete(struct il_priv *il, struct il_rx_buf *rxb)
        clear_bit(S_SCAN_HW, &il->status);
 
        D_SCAN("Scan on %sGHz took %dms\n",
-              (il->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2",
+              (il->scan_band == NL80211_BAND_2GHZ) ? "2.4" : "5.2",
               jiffies_to_msecs(jiffies - il->scan_start));
 
        queue_work(il->workqueue, &il->scan_completed);
@@ -1475,10 +1475,10 @@ il_setup_rx_scan_handlers(struct il_priv *il)
 EXPORT_SYMBOL(il_setup_rx_scan_handlers);
 
 u16
-il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band,
+il_get_active_dwell_time(struct il_priv *il, enum nl80211_band band,
                         u8 n_probes)
 {
-       if (band == IEEE80211_BAND_5GHZ)
+       if (band == NL80211_BAND_5GHZ)
                return IL_ACTIVE_DWELL_TIME_52 +
                    IL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1);
        else
@@ -1488,14 +1488,14 @@ il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band,
 EXPORT_SYMBOL(il_get_active_dwell_time);
 
 u16
-il_get_passive_dwell_time(struct il_priv *il, enum ieee80211_band band,
+il_get_passive_dwell_time(struct il_priv *il, enum nl80211_band band,
                          struct ieee80211_vif *vif)
 {
        u16 value;
 
        u16 passive =
            (band ==
-            IEEE80211_BAND_2GHZ) ? IL_PASSIVE_DWELL_BASE +
+            NL80211_BAND_2GHZ) ? IL_PASSIVE_DWELL_BASE +
            IL_PASSIVE_DWELL_TIME_24 : IL_PASSIVE_DWELL_BASE +
            IL_PASSIVE_DWELL_TIME_52;
 
@@ -1520,10 +1520,10 @@ void
 il_init_scan_params(struct il_priv *il)
 {
        u8 ant_idx = fls(il->hw_params.valid_tx_ant) - 1;
-       if (!il->scan_tx_ant[IEEE80211_BAND_5GHZ])
-               il->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx;
-       if (!il->scan_tx_ant[IEEE80211_BAND_2GHZ])
-               il->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx;
+       if (!il->scan_tx_ant[NL80211_BAND_5GHZ])
+               il->scan_tx_ant[NL80211_BAND_5GHZ] = ant_idx;
+       if (!il->scan_tx_ant[NL80211_BAND_2GHZ])
+               il->scan_tx_ant[NL80211_BAND_2GHZ] = ant_idx;
 }
 EXPORT_SYMBOL(il_init_scan_params);
 
@@ -2003,7 +2003,7 @@ il_prep_station(struct il_priv *il, const u8 *addr, bool is_ap,
        il_set_ht_add_station(il, sta_id, sta);
 
        /* 3945 only */
-       rate = (il->band == IEEE80211_BAND_5GHZ) ? RATE_6M_PLCP : RATE_1M_PLCP;
+       rate = (il->band == NL80211_BAND_5GHZ) ? RATE_6M_PLCP : RATE_1M_PLCP;
        /* Turn on both antennas for the station... */
        station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK);
 
@@ -3382,7 +3382,7 @@ EXPORT_SYMBOL(il_bcast_addr);
 static void
 il_init_ht_hw_capab(const struct il_priv *il,
                    struct ieee80211_sta_ht_cap *ht_info,
-                   enum ieee80211_band band)
+                   enum nl80211_band band)
 {
        u16 max_bit_rate = 0;
        u8 rx_chains_num = il->hw_params.rx_chains_num;
@@ -3443,8 +3443,8 @@ il_init_geos(struct il_priv *il)
        int i = 0;
        s8 max_tx_power = 0;
 
-       if (il->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
-           il->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
+       if (il->bands[NL80211_BAND_2GHZ].n_bitrates ||
+           il->bands[NL80211_BAND_5GHZ].n_bitrates) {
                D_INFO("Geography modes already initialized.\n");
                set_bit(S_GEO_CONFIGURED, &il->status);
                return 0;
@@ -3465,23 +3465,23 @@ il_init_geos(struct il_priv *il)
        }
 
        /* 5.2GHz channels start after the 2.4GHz channels */
-       sband = &il->bands[IEEE80211_BAND_5GHZ];
+       sband = &il->bands[NL80211_BAND_5GHZ];
        sband->channels = &channels[ARRAY_SIZE(il_eeprom_band_1)];
        /* just OFDM */
        sband->bitrates = &rates[IL_FIRST_OFDM_RATE];
        sband->n_bitrates = RATE_COUNT_LEGACY - IL_FIRST_OFDM_RATE;
 
        if (il->cfg->sku & IL_SKU_N)
-               il_init_ht_hw_capab(il, &sband->ht_cap, IEEE80211_BAND_5GHZ);
+               il_init_ht_hw_capab(il, &sband->ht_cap, NL80211_BAND_5GHZ);
 
-       sband = &il->bands[IEEE80211_BAND_2GHZ];
+       sband = &il->bands[NL80211_BAND_2GHZ];
        sband->channels = channels;
        /* OFDM & CCK */
        sband->bitrates = rates;
        sband->n_bitrates = RATE_COUNT_LEGACY;
 
        if (il->cfg->sku & IL_SKU_N)
-               il_init_ht_hw_capab(il, &sband->ht_cap, IEEE80211_BAND_2GHZ);
+               il_init_ht_hw_capab(il, &sband->ht_cap, NL80211_BAND_2GHZ);
 
        il->ieee_channels = channels;
        il->ieee_rates = rates;
@@ -3532,7 +3532,7 @@ il_init_geos(struct il_priv *il)
        il->tx_power_user_lmt = max_tx_power;
        il->tx_power_next = max_tx_power;
 
-       if (il->bands[IEEE80211_BAND_5GHZ].n_channels == 0 &&
+       if (il->bands[NL80211_BAND_5GHZ].n_channels == 0 &&
            (il->cfg->sku & IL_SKU_A)) {
                IL_INFO("Incorrectly detected BG card as ABG. "
                        "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n",
@@ -3541,8 +3541,8 @@ il_init_geos(struct il_priv *il)
        }
 
        IL_INFO("Tunable channels: %d 802.11bg, %d 802.11a channels\n",
-               il->bands[IEEE80211_BAND_2GHZ].n_channels,
-               il->bands[IEEE80211_BAND_5GHZ].n_channels);
+               il->bands[NL80211_BAND_2GHZ].n_channels,
+               il->bands[NL80211_BAND_5GHZ].n_channels);
 
        set_bit(S_GEO_CONFIGURED, &il->status);
 
@@ -3563,7 +3563,7 @@ il_free_geos(struct il_priv *il)
 EXPORT_SYMBOL(il_free_geos);
 
 static bool
-il_is_channel_extension(struct il_priv *il, enum ieee80211_band band,
+il_is_channel_extension(struct il_priv *il, enum nl80211_band band,
                        u16 channel, u8 extension_chan_offset)
 {
        const struct il_channel_info *ch_info;
@@ -3926,14 +3926,14 @@ EXPORT_SYMBOL(il_set_rxon_ht);
 
 /* Return valid, unused, channel for a passive scan to reset the RF */
 u8
-il_get_single_channel_number(struct il_priv *il, enum ieee80211_band band)
+il_get_single_channel_number(struct il_priv *il, enum nl80211_band band)
 {
        const struct il_channel_info *ch_info;
        int i;
        u8 channel = 0;
        u8 min, max;
 
-       if (band == IEEE80211_BAND_5GHZ) {
+       if (band == NL80211_BAND_5GHZ) {
                min = 14;
                max = il->channel_count;
        } else {
@@ -3965,14 +3965,14 @@ EXPORT_SYMBOL(il_get_single_channel_number);
 int
 il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch)
 {
-       enum ieee80211_band band = ch->band;
+       enum nl80211_band band = ch->band;
        u16 channel = ch->hw_value;
 
        if (le16_to_cpu(il->staging.channel) == channel && il->band == band)
                return 0;
 
        il->staging.channel = cpu_to_le16(channel);
-       if (band == IEEE80211_BAND_5GHZ)
+       if (band == NL80211_BAND_5GHZ)
                il->staging.flags &= ~RXON_FLG_BAND_24G_MSK;
        else
                il->staging.flags |= RXON_FLG_BAND_24G_MSK;
@@ -3986,10 +3986,10 @@ il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch)
 EXPORT_SYMBOL(il_set_rxon_channel);
 
 void
-il_set_flags_for_band(struct il_priv *il, enum ieee80211_band band,
+il_set_flags_for_band(struct il_priv *il, enum nl80211_band band,
                      struct ieee80211_vif *vif)
 {
-       if (band == IEEE80211_BAND_5GHZ) {
+       if (band == NL80211_BAND_5GHZ) {
                il->staging.flags &=
                    ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK |
                      RXON_FLG_CCK_MSK);
@@ -5415,7 +5415,7 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 
        if (changes & BSS_CHANGED_ERP_CTS_PROT) {
                D_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot);
-               if (bss_conf->use_cts_prot && il->band != IEEE80211_BAND_5GHZ)
+               if (bss_conf->use_cts_prot && il->band != NL80211_BAND_5GHZ)
                        il->staging.flags |= RXON_FLG_TGG_PROTECT_MSK;
                else
                        il->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
index ce52cf1..726ede3 100644 (file)
@@ -432,7 +432,7 @@ u16 il_eeprom_query16(const struct il_priv *il, size_t offset);
 int il_init_channel_map(struct il_priv *il);
 void il_free_channel_map(struct il_priv *il);
 const struct il_channel_info *il_get_channel_info(const struct il_priv *il,
-                                                 enum ieee80211_band band,
+                                                 enum nl80211_band band,
                                                  u16 channel);
 
 #define IL_NUM_SCAN_RATES         (2)
@@ -497,7 +497,7 @@ struct il_channel_info {
 
        u8 group_idx;           /* 0-4, maps channel to group1/2/3/4/5 */
        u8 band_idx;            /* 0-4, maps channel to band1/2/3/4/5 */
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        /* HT40 channel info */
        s8 ht40_max_power_avg;  /* (dBm) regul. eeprom, normal Tx, any rate */
@@ -811,7 +811,7 @@ struct il_sensitivity_ranges {
  * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
  * @max_stations:
  * @ht40_channel: is 40MHz width possible in band 2.4
- * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ)
+ * BIT(NL80211_BAND_5GHZ) BIT(NL80211_BAND_5GHZ)
  * @sw_crypto: 0 for hw, 1 for sw
  * @max_xxx_size: for ucode uses
  * @ct_kill_threshold: temperature threshold
@@ -1141,13 +1141,13 @@ struct il_priv {
        struct list_head free_frames;
        int frames_count;
 
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int alloc_rxb_page;
 
        void (*handlers[IL_CN_MAX]) (struct il_priv *il,
                                     struct il_rx_buf *rxb);
 
-       struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band bands[NUM_NL80211_BANDS];
 
        /* spectrum measurement report caching */
        struct il_spectrum_notification measure_report;
@@ -1176,10 +1176,10 @@ struct il_priv {
        unsigned long scan_start;
        unsigned long scan_start_tsf;
        void *scan_cmd;
-       enum ieee80211_band scan_band;
+       enum nl80211_band scan_band;
        struct cfg80211_scan_request *scan_request;
        struct ieee80211_vif *scan_vif;
-       u8 scan_tx_ant[IEEE80211_NUM_BANDS];
+       u8 scan_tx_ant[NUM_NL80211_BANDS];
        u8 mgmt_tx_ant;
 
        /* spinlock */
@@ -1479,7 +1479,7 @@ il_is_channel_radar(const struct il_channel_info *ch_info)
 static inline u8
 il_is_channel_a_band(const struct il_channel_info *ch_info)
 {
-       return ch_info->band == IEEE80211_BAND_5GHZ;
+       return ch_info->band == NL80211_BAND_5GHZ;
 }
 
 static inline int
@@ -1673,7 +1673,7 @@ struct il_cfg {
        /* params not likely to change within a device family */
        struct il_base_params *base_params;
        /* params likely to change within a device family */
-       u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
+       u8 scan_rx_antennas[NUM_NL80211_BANDS];
        enum il_led_mode led_mode;
 
        int eeprom_size;
@@ -1707,9 +1707,9 @@ void il_set_rxon_hwcrypto(struct il_priv *il, int hw_decrypt);
 int il_check_rxon_cmd(struct il_priv *il);
 int il_full_rxon_required(struct il_priv *il);
 int il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch);
-void il_set_flags_for_band(struct il_priv *il, enum ieee80211_band band,
+void il_set_flags_for_band(struct il_priv *il, enum nl80211_band band,
                           struct ieee80211_vif *vif);
-u8 il_get_single_channel_number(struct il_priv *il, enum ieee80211_band band);
+u8 il_get_single_channel_number(struct il_priv *il, enum nl80211_band band);
 void il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf);
 bool il_is_ht40_tx_allowed(struct il_priv *il,
                           struct ieee80211_sta_ht_cap *ht_cap);
@@ -1793,9 +1793,9 @@ int il_force_reset(struct il_priv *il, bool external);
 u16 il_fill_probe_req(struct il_priv *il, struct ieee80211_mgmt *frame,
                      const u8 *ta, const u8 *ie, int ie_len, int left);
 void il_setup_rx_scan_handlers(struct il_priv *il);
-u16 il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band,
+u16 il_get_active_dwell_time(struct il_priv *il, enum nl80211_band band,
                             u8 n_probes);
-u16 il_get_passive_dwell_time(struct il_priv *il, enum ieee80211_band band,
+u16 il_get_passive_dwell_time(struct il_priv *il, enum nl80211_band band,
                              struct ieee80211_vif *vif);
 void il_setup_scan_deferred_work(struct il_priv *il);
 void il_cancel_scan_deferred_work(struct il_priv *il);
@@ -1955,7 +1955,7 @@ il_commit_rxon(struct il_priv *il)
 }
 
 static inline const struct ieee80211_supported_band *
-il_get_hw_mode(struct il_priv *il, enum ieee80211_band band)
+il_get_hw_mode(struct il_priv *il, enum nl80211_band band)
 {
        return il->hw->wiphy->bands[band];
 }
@@ -2813,7 +2813,7 @@ struct il_lq_sta {
        u8 action_counter;      /* # mode-switch actions tried */
        u8 is_green;
        u8 is_dup;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        /* The following are bitmaps of rates; RATE_6M_MASK, etc. */
        u32 supp_rates;
index 908b9f4..6fc6b7f 100644 (file)
@@ -544,7 +544,7 @@ il_dbgfs_channels_read(struct file *file, char __user *user_buf, size_t count,
                return -ENOMEM;
        }
 
-       supp_band = il_get_hw_mode(il, IEEE80211_BAND_2GHZ);
+       supp_band = il_get_hw_mode(il, NL80211_BAND_2GHZ);
        if (supp_band) {
                channels = supp_band->channels;
 
@@ -571,7 +571,7 @@ il_dbgfs_channels_read(struct file *file, char __user *user_buf, size_t count,
                                      flags & IEEE80211_CHAN_NO_IR ?
                                      "passive only" : "active/passive");
        }
-       supp_band = il_get_hw_mode(il, IEEE80211_BAND_5GHZ);
+       supp_band = il_get_hw_mode(il, NL80211_BAND_5GHZ);
        if (supp_band) {
                channels = supp_band->channels;
 
index 9de277c..b79e387 100644 (file)
@@ -158,7 +158,7 @@ void iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch,
                         struct iwl_rxon_context *ctx);
 void iwl_set_flags_for_band(struct iwl_priv *priv,
                            struct iwl_rxon_context *ctx,
-                           enum ieee80211_band band,
+                           enum nl80211_band band,
                            struct ieee80211_vif *vif);
 
 /* uCode */
@@ -186,7 +186,7 @@ int iwl_send_statistics_request(struct iwl_priv *priv,
                                u8 flags, bool clear);
 
 static inline const struct ieee80211_supported_band *iwl_get_hw_mode(
-                       struct iwl_priv *priv, enum ieee80211_band band)
+                       struct iwl_priv *priv, enum nl80211_band band)
 {
        return priv->hw->wiphy->bands[band];
 }
@@ -198,7 +198,7 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan);
 #endif
 
 /* rx */
-int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band);
+int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum nl80211_band band);
 void iwl_setup_rx_handlers(struct iwl_priv *priv);
 void iwl_chswitch_done(struct iwl_priv *priv, bool is_success);
 
@@ -258,7 +258,7 @@ void iwl_cancel_scan_deferred_work(struct iwl_priv *priv);
 int __must_check iwl_scan_initiate(struct iwl_priv *priv,
                                   struct ieee80211_vif *vif,
                                   enum iwl_scan_type scan_type,
-                                  enum ieee80211_band band);
+                                  enum nl80211_band band);
 
 /* For faster active scanning, scan will move to the next channel if fewer than
  * PLCP_QUIET_THRESH packets are heard on this channel within
index 74c5161..f6591c8 100644 (file)
@@ -335,7 +335,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
        if (!buf)
                return -ENOMEM;
 
-       supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
+       supp_band = iwl_get_hw_mode(priv, NL80211_BAND_2GHZ);
        if (supp_band) {
                channels = supp_band->channels;
 
@@ -358,7 +358,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
                                        IEEE80211_CHAN_NO_IR ?
                                        "passive only" : "active/passive");
        }
-       supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
+       supp_band = iwl_get_hw_mode(priv, NL80211_BAND_5GHZ);
        if (supp_band) {
                channels = supp_band->channels;
 
index 1a7ead7..8148df6 100644 (file)
@@ -677,7 +677,7 @@ struct iwl_priv {
 
        struct iwl_hw_params hw_params;
 
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u8 valid_contexts;
 
        void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
@@ -722,11 +722,11 @@ struct iwl_priv {
        unsigned long scan_start;
        unsigned long scan_start_tsf;
        void *scan_cmd;
-       enum ieee80211_band scan_band;
+       enum nl80211_band scan_band;
        struct cfg80211_scan_request *scan_request;
        struct ieee80211_vif *scan_vif;
        enum iwl_scan_type scan_type;
-       u8 scan_tx_ant[IEEE80211_NUM_BANDS];
+       u8 scan_tx_ant[NUM_NL80211_BANDS];
        u8 mgmt_tx_ant;
 
        /* max number of station keys */
index cc13c04..f21732e 100644 (file)
@@ -420,7 +420,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
                .data = { &cmd, },
        };
 
-       cmd.band = priv->band == IEEE80211_BAND_2GHZ;
+       cmd.band = priv->band == NL80211_BAND_2GHZ;
        ch = ch_switch->chandef.chan->hw_value;
        IWL_DEBUG_11H(priv, "channel switch from %d to %d\n",
                      ctx->active.channel, ch);
@@ -588,7 +588,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
 
        hcmd.data[0] = cmd;
 
-       cmd->band = priv->band == IEEE80211_BAND_2GHZ;
+       cmd->band = priv->band == NL80211_BAND_2GHZ;
        ch = ch_switch->chandef.chan->hw_value;
        IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
                      ctx->active.channel, ch);
index 1799469..8dda52a 100644 (file)
@@ -94,7 +94,7 @@ void iwlagn_temperature(struct iwl_priv *priv)
        iwl_tt_handler(priv);
 }
 
-int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
+int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum nl80211_band band)
 {
        int idx = 0;
        int band_offset = 0;
@@ -105,7 +105,7 @@ int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
                return idx;
        /* Legacy rate format, search for match in table */
        } else {
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        band_offset = IWL_FIRST_OFDM_RATE;
                for (idx = band_offset; idx < IWL_RATE_COUNT_LEGACY; idx++)
                        if (iwl_rates[idx].plcp == (rate_n_flags & 0xFF))
@@ -878,7 +878,7 @@ u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid)
        int i;
        u8 ind = ant;
 
-       if (priv->band == IEEE80211_BAND_2GHZ &&
+       if (priv->band == NL80211_BAND_2GHZ &&
            priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)
                return 0;
 
index c63ea79..8c07194 100644 (file)
@@ -202,12 +202,12 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
 
        hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
 
-       if (priv->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels)
-               priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                       &priv->nvm_data->bands[IEEE80211_BAND_2GHZ];
-       if (priv->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels)
-               priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                       &priv->nvm_data->bands[IEEE80211_BAND_5GHZ];
+       if (priv->nvm_data->bands[NL80211_BAND_2GHZ].n_channels)
+               priv->hw->wiphy->bands[NL80211_BAND_2GHZ] =
+                       &priv->nvm_data->bands[NL80211_BAND_2GHZ];
+       if (priv->nvm_data->bands[NL80211_BAND_5GHZ].n_channels)
+               priv->hw->wiphy->bands[NL80211_BAND_5GHZ] =
+                       &priv->nvm_data->bands[NL80211_BAND_5GHZ];
 
        hw->wiphy->hw_version = priv->trans->hw_id;
 
index 6147162..37b32a6 100644 (file)
@@ -262,7 +262,7 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
        rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
 
        /* In mac80211, rates for 5 GHz start at 0 */
-       if (info->band == IEEE80211_BAND_5GHZ)
+       if (info->band == NL80211_BAND_5GHZ)
                rate += IWL_FIRST_OFDM_RATE;
        else if (rate >= IWL_FIRST_CCK_RATE && rate <= IWL_LAST_CCK_RATE)
                rate_flags |= RATE_MCS_CCK_MSK;
@@ -1117,7 +1117,7 @@ static int iwl_init_drv(struct iwl_priv *priv)
 
        INIT_LIST_HEAD(&priv->calib_results);
 
-       priv->band = IEEE80211_BAND_2GHZ;
+       priv->band = NL80211_BAND_2GHZ;
 
        priv->plcp_delta_threshold = priv->lib->plcp_delta_threshold;
 
index ee75055..b95c2d7 100644 (file)
@@ -599,7 +599,7 @@ static u32 rate_n_flags_from_tbl(struct iwl_priv *priv,
  * fill "search" or "active" tx mode table.
  */
 static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
-                                   enum ieee80211_band band,
+                                   enum nl80211_band band,
                                    struct iwl_scale_tbl_info *tbl,
                                    int *rate_idx)
 {
@@ -624,7 +624,7 @@ static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
        /* legacy rate format */
        if (!(rate_n_flags & RATE_MCS_HT_MSK)) {
                if (num_of_ant == 1) {
-                       if (band == IEEE80211_BAND_5GHZ)
+                       if (band == NL80211_BAND_5GHZ)
                                tbl->lq_type = LQ_A;
                        else
                                tbl->lq_type = LQ_G;
@@ -802,7 +802,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
        if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_index)) {
                switch_to_legacy = 1;
                scale_index = rs_ht_to_legacy[scale_index];
-               if (lq_sta->band == IEEE80211_BAND_5GHZ)
+               if (lq_sta->band == NL80211_BAND_5GHZ)
                        tbl->lq_type = LQ_A;
                else
                        tbl->lq_type = LQ_G;
@@ -821,7 +821,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
        /* Mask with station rate restriction */
        if (is_legacy(tbl->lq_type)) {
                /* supp_rates has no CCK bits in A mode */
-               if (lq_sta->band == IEEE80211_BAND_5GHZ)
+               if (lq_sta->band == NL80211_BAND_5GHZ)
                        rate_mask  = (u16)(rate_mask &
                           (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE));
                else
@@ -939,7 +939,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
        table = &lq_sta->lq;
        tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags);
        rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index);
-       if (priv->band == IEEE80211_BAND_5GHZ)
+       if (priv->band == NL80211_BAND_5GHZ)
                rs_index -= IWL_FIRST_OFDM_RATE;
        mac_flags = info->status.rates[0].flags;
        mac_index = info->status.rates[0].idx;
@@ -952,7 +952,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
                 * mac80211 HT index is always zero-indexed; we need to move
                 * HT OFDM rates after CCK rates in 2.4 GHz band
                 */
-               if (priv->band == IEEE80211_BAND_2GHZ)
+               if (priv->band == NL80211_BAND_2GHZ)
                        mac_index += IWL_FIRST_OFDM_RATE;
        }
        /* Here we actually compare this rate to the latest LQ command */
@@ -2284,7 +2284,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
 
        /* mask with station rate restriction */
        if (is_legacy(tbl->lq_type)) {
-               if (lq_sta->band == IEEE80211_BAND_5GHZ)
+               if (lq_sta->band == NL80211_BAND_5GHZ)
                        /* supp_rates has no CCK bits in A mode */
                        rate_scale_index_msk = (u16) (rate_mask &
                                (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE));
@@ -2721,7 +2721,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
        /* Get max rate if user set max rate */
        if (lq_sta) {
                lq_sta->max_rate_idx = txrc->max_rate_idx;
-               if ((sband->band == IEEE80211_BAND_5GHZ) &&
+               if ((sband->band == NL80211_BAND_5GHZ) &&
                    (lq_sta->max_rate_idx != -1))
                        lq_sta->max_rate_idx += IWL_FIRST_OFDM_RATE;
                if ((lq_sta->max_rate_idx < 0) ||
@@ -2763,11 +2763,11 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
        } else {
                /* Check for invalid rates */
                if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) ||
-                               ((sband->band == IEEE80211_BAND_5GHZ) &&
+                               ((sband->band == NL80211_BAND_5GHZ) &&
                                 (rate_idx < IWL_FIRST_OFDM_RATE)))
                        rate_idx = rate_lowest_index(sband, sta);
                /* On valid 5 GHz rate, adjust index */
-               else if (sband->band == IEEE80211_BAND_5GHZ)
+               else if (sband->band == NL80211_BAND_5GHZ)
                        rate_idx -= IWL_FIRST_OFDM_RATE;
                info->control.rates[0].flags = 0;
        }
@@ -2880,7 +2880,7 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
 
        /* Set last_txrate_idx to lowest rate */
        lq_sta->last_txrate_idx = rate_lowest_index(sband, sta);
-       if (sband->band == IEEE80211_BAND_5GHZ)
+       if (sband->band == NL80211_BAND_5GHZ)
                lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
        lq_sta->is_agg = 0;
 #ifdef CONFIG_MAC80211_DEBUGFS
index c5fe445..50c1e95 100644 (file)
@@ -355,7 +355,7 @@ struct iwl_lq_sta {
        u8 action_counter;      /* # mode-switch actions tried */
        u8 is_green;
        u8 is_dup;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */
        u32 supp_rates;
index 27ea61e..dfa2041 100644 (file)
@@ -834,7 +834,7 @@ static void iwlagn_rx_reply_rx(struct iwl_priv *priv,
        /* rx_status carries information about the packet to mac80211 */
        rx_status.mactime = le64_to_cpu(phy_res->timestamp);
        rx_status.band = (phy_res->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
-                               IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+                               NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
        rx_status.freq =
                ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel),
                                               rx_status.band);
index 2d47cb2..b228552 100644 (file)
@@ -719,7 +719,7 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf)
 void iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch,
                         struct iwl_rxon_context *ctx)
 {
-       enum ieee80211_band band = ch->band;
+       enum nl80211_band band = ch->band;
        u16 channel = ch->hw_value;
 
        if ((le16_to_cpu(ctx->staging.channel) == channel) &&
@@ -727,7 +727,7 @@ void iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch,
                return;
 
        ctx->staging.channel = cpu_to_le16(channel);
-       if (band == IEEE80211_BAND_5GHZ)
+       if (band == NL80211_BAND_5GHZ)
                ctx->staging.flags &= ~RXON_FLG_BAND_24G_MSK;
        else
                ctx->staging.flags |= RXON_FLG_BAND_24G_MSK;
@@ -740,10 +740,10 @@ void iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch,
 
 void iwl_set_flags_for_band(struct iwl_priv *priv,
                            struct iwl_rxon_context *ctx,
-                           enum ieee80211_band band,
+                           enum nl80211_band band,
                            struct ieee80211_vif *vif)
 {
-       if (band == IEEE80211_BAND_5GHZ) {
+       if (band == NL80211_BAND_5GHZ) {
                ctx->staging.flags &=
                    ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK
                      | RXON_FLG_CCK_MSK);
@@ -1476,7 +1476,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
 
        iwlagn_set_rxon_chain(priv, ctx);
 
-       if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ))
+       if (bss_conf->use_cts_prot && (priv->band != NL80211_BAND_5GHZ))
                ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK;
        else
                ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
index 81a2ddb..d01766f 100644 (file)
@@ -312,7 +312,7 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
                       scan_notif->tsf_high, scan_notif->status);
 
        IWL_DEBUG_SCAN(priv, "Scan on %sGHz took %dms\n",
-                      (priv->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2",
+                      (priv->scan_band == NL80211_BAND_2GHZ) ? "2.4" : "5.2",
                       jiffies_to_msecs(jiffies - priv->scan_start));
 
        /*
@@ -362,9 +362,9 @@ void iwl_setup_rx_scan_handlers(struct iwl_priv *priv)
 }
 
 static u16 iwl_get_active_dwell_time(struct iwl_priv *priv,
-                                    enum ieee80211_band band, u8 n_probes)
+                                    enum nl80211_band band, u8 n_probes)
 {
-       if (band == IEEE80211_BAND_5GHZ)
+       if (band == NL80211_BAND_5GHZ)
                return IWL_ACTIVE_DWELL_TIME_52 +
                        IWL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1);
        else
@@ -431,9 +431,9 @@ static u16 iwl_limit_dwell(struct iwl_priv *priv, u16 dwell_time)
 }
 
 static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
-                                     enum ieee80211_band band)
+                                     enum nl80211_band band)
 {
-       u16 passive = (band == IEEE80211_BAND_2GHZ) ?
+       u16 passive = (band == NL80211_BAND_2GHZ) ?
            IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 :
            IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52;
 
@@ -442,7 +442,7 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
 
 /* Return valid, unused, channel for a passive scan to reset the RF */
 static u8 iwl_get_single_channel_number(struct iwl_priv *priv,
-                                       enum ieee80211_band band)
+                                       enum nl80211_band band)
 {
        struct ieee80211_supported_band *sband = priv->hw->wiphy->bands[band];
        struct iwl_rxon_context *ctx;
@@ -470,7 +470,7 @@ static u8 iwl_get_single_channel_number(struct iwl_priv *priv,
 
 static int iwl_get_channel_for_reset_scan(struct iwl_priv *priv,
                                          struct ieee80211_vif *vif,
-                                         enum ieee80211_band band,
+                                         enum nl80211_band band,
                                          struct iwl_scan_channel *scan_ch)
 {
        const struct ieee80211_supported_band *sband;
@@ -492,7 +492,7 @@ static int iwl_get_channel_for_reset_scan(struct iwl_priv *priv,
                        cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME);
                /* Set txpower levels to defaults */
                scan_ch->dsp_atten = 110;
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
                else
                        scan_ch->tx_gain = ((1 << 5) | (5 << 3));
@@ -505,7 +505,7 @@ static int iwl_get_channel_for_reset_scan(struct iwl_priv *priv,
 
 static int iwl_get_channels_for_scan(struct iwl_priv *priv,
                                     struct ieee80211_vif *vif,
-                                    enum ieee80211_band band,
+                                    enum nl80211_band band,
                                     u8 is_active, u8 n_probes,
                                     struct iwl_scan_channel *scan_ch)
 {
@@ -553,7 +553,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
                 * power level:
                 * scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3;
                 */
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
                else
                        scan_ch->tx_gain = ((1 << 5) | (5 << 3));
@@ -636,7 +636,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
        u32 rate_flags = 0;
        u16 cmd_len = 0;
        u16 rx_chain = 0;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u8 n_probes = 0;
        u8 rx_ant = priv->nvm_data->valid_rx_ant;
        u8 rate;
@@ -750,7 +750,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
        scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
 
        switch (priv->scan_band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
                chan_mod = le32_to_cpu(
                        priv->contexts[IWL_RXON_CTX_BSS].active.flags &
@@ -771,7 +771,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
                    priv->lib->bt_params->advanced_bt_coexist)
                        scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                rate = IWL_RATE_6M_PLCP;
                break;
        default:
@@ -809,7 +809,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
 
        band = priv->scan_band;
 
-       if (band == IEEE80211_BAND_2GHZ &&
+       if (band == NL80211_BAND_2GHZ &&
            priv->lib->bt_params &&
            priv->lib->bt_params->advanced_bt_coexist) {
                /* transmit 2.4 GHz probes only on first antenna */
@@ -925,16 +925,16 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
 void iwl_init_scan_params(struct iwl_priv *priv)
 {
        u8 ant_idx = fls(priv->nvm_data->valid_tx_ant) - 1;
-       if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ])
-               priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx;
-       if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ])
-               priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx;
+       if (!priv->scan_tx_ant[NL80211_BAND_5GHZ])
+               priv->scan_tx_ant[NL80211_BAND_5GHZ] = ant_idx;
+       if (!priv->scan_tx_ant[NL80211_BAND_2GHZ])
+               priv->scan_tx_ant[NL80211_BAND_2GHZ] = ant_idx;
 }
 
 int __must_check iwl_scan_initiate(struct iwl_priv *priv,
                                   struct ieee80211_vif *vif,
                                   enum iwl_scan_type scan_type,
-                                  enum ieee80211_band band)
+                                  enum nl80211_band band)
 {
        int ret;
 
index 8e9768a..de6ec9b 100644 (file)
@@ -579,7 +579,7 @@ static void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
 
        /* Set up the rate scaling to start at selected rate, fall back
         * all the way down to 1M in IEEE order, and then spin on 1M */
-       if (priv->band == IEEE80211_BAND_5GHZ)
+       if (priv->band == NL80211_BAND_5GHZ)
                r = IWL_RATE_6M_INDEX;
        else if (ctx && ctx->vif && ctx->vif->p2p)
                r = IWL_RATE_6M_INDEX;
index 59e2001..4b97371 100644 (file)
@@ -81,7 +81,7 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv,
                tx_flags |= TX_CMD_FLG_TSF_MSK;
        else if (ieee80211_is_back_req(fc))
                tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK;
-       else if (info->band == IEEE80211_BAND_2GHZ &&
+       else if (info->band == NL80211_BAND_2GHZ &&
                 priv->lib->bt_params &&
                 priv->lib->bt_params->advanced_bt_coexist &&
                 (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) ||
@@ -177,7 +177,7 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
                rate_idx = rate_lowest_index(
                                &priv->nvm_data->bands[info->band], sta);
        /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
-       if (info->band == IEEE80211_BAND_5GHZ)
+       if (info->band == NL80211_BAND_5GHZ)
                rate_idx += IWL_FIRST_OFDM_RATE;
        /* Get PLCP rate for tx_cmd->rate_n_flags */
        rate_plcp = iwl_rates[rate_idx].plcp;
index ef22c3d..5c2aae6 100644 (file)
@@ -64,7 +64,7 @@ static const struct iwl_base_params iwl1000_base_params = {
 static const struct iwl_ht_params iwl1000_ht_params = {
        .ht_greenfield_support = true,
        .use_rts_for_aggregation = true, /* use rts/cts protection */
-       .ht40_bands = BIT(IEEE80211_BAND_2GHZ),
+       .ht40_bands = BIT(NL80211_BAND_2GHZ),
 };
 
 static const struct iwl_eeprom_params iwl1000_eeprom_params = {
index dc246c9..2e823bd 100644 (file)
@@ -89,7 +89,7 @@ static const struct iwl_base_params iwl2030_base_params = {
 static const struct iwl_ht_params iwl2000_ht_params = {
        .ht_greenfield_support = true,
        .use_rts_for_aggregation = true, /* use rts/cts protection */
-       .ht40_bands = BIT(IEEE80211_BAND_2GHZ),
+       .ht40_bands = BIT(NL80211_BAND_2GHZ),
 };
 
 static const struct iwl_eeprom_params iwl20x0_eeprom_params = {
index 4dcdab6..4c3e3cf 100644 (file)
@@ -62,7 +62,7 @@ static const struct iwl_base_params iwl5000_base_params = {
 
 static const struct iwl_ht_params iwl5000_ht_params = {
        .ht_greenfield_support = true,
-       .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
+       .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
 };
 
 static const struct iwl_eeprom_params iwl5000_eeprom_params = {
index 9938f53..5a7b7e1 100644 (file)
@@ -110,7 +110,7 @@ static const struct iwl_base_params iwl6000_g2_base_params = {
 static const struct iwl_ht_params iwl6000_ht_params = {
        .ht_greenfield_support = true,
        .use_rts_for_aggregation = true, /* use rts/cts protection */
-       .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
+       .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
 };
 
 static const struct iwl_eeprom_params iwl6000_eeprom_params = {
index b6283c8..abd2904 100644 (file)
@@ -156,7 +156,7 @@ static const struct iwl_tt_params iwl7000_high_temp_tt_params = {
 
 static const struct iwl_ht_params iwl7000_ht_params = {
        .stbc = true,
-       .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
+       .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
 };
 
 #define IWL_DEVICE_7000_COMMON                                 \
@@ -287,7 +287,7 @@ static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = {
 static const struct iwl_ht_params iwl7265_ht_params = {
        .stbc = true,
        .ldpc = true,
-       .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
+       .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
 };
 
 const struct iwl_cfg iwl3165_2ac_cfg = {
index 0728a28..a9212a1 100644 (file)
@@ -124,7 +124,7 @@ static const struct iwl_base_params iwl8000_base_params = {
 static const struct iwl_ht_params iwl8000_ht_params = {
        .stbc = true,
        .ldpc = true,
-       .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
+       .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
 };
 
 static const struct iwl_tt_params iwl8000_tt_params = {
index a3d35aa..b9aca37 100644 (file)
@@ -93,7 +93,7 @@ static const struct iwl_base_params iwl9000_base_params = {
 static const struct iwl_ht_params iwl9000_ht_params = {
        .stbc = true,
        .ldpc = true,
-       .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
+       .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
 };
 
 static const struct iwl_tt_params iwl9000_tt_params = {
index 08bb4f4..7206798 100644 (file)
@@ -185,7 +185,7 @@ struct iwl_base_params {
  * @stbc: support Tx STBC and 1*SS Rx STBC
  * @ldpc: support Tx/Rx with LDPC
  * @use_rts_for_aggregation: use rts/cts protection for HT traffic
- * @ht40_bands: bitmap of bands (using %IEEE80211_BAND_*) that support HT40
+ * @ht40_bands: bitmap of bands (using %NL80211_BAND_*) that support HT40
  */
 struct iwl_ht_params {
        enum ieee80211_smps_mode smps_mode;
index 48e8737..4f495d9 100644 (file)
@@ -1280,7 +1280,10 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
        if (err)
                goto try_again;
 
-       api_ver = drv->fw.ucode_ver;
+       if (fw_has_api(&drv->fw.ucode_capa, IWL_UCODE_TLV_API_NEW_VERSION))
+               api_ver = drv->fw.ucode_ver;
+       else
+               api_ver = IWL_UCODE_API(drv->fw.ucode_ver);
 
        /*
         * api_ver should match the api version forming part of the
index c15f5be..bf1b69a 100644 (file)
@@ -390,10 +390,10 @@ iwl_eeprom_enh_txp_read_element(struct iwl_nvm_data *data,
                                int n_channels, s8 max_txpower_avg)
 {
        int ch_idx;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        band = txp->flags & IWL_EEPROM_ENH_TXP_FL_BAND_52G ?
-               IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ;
+               NL80211_BAND_5GHZ : NL80211_BAND_2GHZ;
 
        for (ch_idx = 0; ch_idx < n_channels; ch_idx++) {
                struct ieee80211_channel *chan = &data->channels[ch_idx];
@@ -526,7 +526,7 @@ static void iwl_init_band_reference(const struct iwl_cfg *cfg,
 
 static void iwl_mod_ht40_chan_info(struct device *dev,
                                   struct iwl_nvm_data *data, int n_channels,
-                                  enum ieee80211_band band, u16 channel,
+                                  enum nl80211_band band, u16 channel,
                                   const struct iwl_eeprom_channel *eeprom_ch,
                                   u8 clear_ht40_extension_channel)
 {
@@ -548,7 +548,7 @@ static void iwl_mod_ht40_chan_info(struct device *dev,
        IWL_DEBUG_EEPROM(dev,
                         "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n",
                         channel,
-                        band == IEEE80211_BAND_5GHZ ? "5.2" : "2.4",
+                        band == NL80211_BAND_5GHZ ? "5.2" : "2.4",
                         CHECK_AND_PRINT(IBSS),
                         CHECK_AND_PRINT(ACTIVE),
                         CHECK_AND_PRINT(RADAR),
@@ -606,8 +606,8 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
                        n_channels++;
 
                        channel->hw_value = eeprom_ch_array[ch_idx];
-                       channel->band = (band == 1) ? IEEE80211_BAND_2GHZ
-                                                   : IEEE80211_BAND_5GHZ;
+                       channel->band = (band == 1) ? NL80211_BAND_2GHZ
+                                                   : NL80211_BAND_5GHZ;
                        channel->center_freq =
                                ieee80211_channel_to_frequency(
                                        channel->hw_value, channel->band);
@@ -677,15 +677,15 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
 
        /* Two additional EEPROM bands for 2.4 and 5 GHz HT40 channels */
        for (band = 6; band <= 7; band++) {
-               enum ieee80211_band ieeeband;
+               enum nl80211_band ieeeband;
 
                iwl_init_band_reference(cfg, eeprom, eeprom_size, band,
                                        &eeprom_ch_count, &eeprom_ch_info,
                                        &eeprom_ch_array);
 
                /* EEPROM band 6 is 2.4, band 7 is 5 GHz */
-               ieeeband = (band == 6) ? IEEE80211_BAND_2GHZ
-                                      : IEEE80211_BAND_5GHZ;
+               ieeeband = (band == 6) ? NL80211_BAND_2GHZ
+                                      : NL80211_BAND_5GHZ;
 
                /* Loop through each band adding each of the channels */
                for (ch_idx = 0; ch_idx < eeprom_ch_count; ch_idx++) {
@@ -708,7 +708,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
 
 int iwl_init_sband_channels(struct iwl_nvm_data *data,
                            struct ieee80211_supported_band *sband,
-                           int n_channels, enum ieee80211_band band)
+                           int n_channels, enum nl80211_band band)
 {
        struct ieee80211_channel *chan = &data->channels[0];
        int n = 0, idx = 0;
@@ -734,7 +734,7 @@ int iwl_init_sband_channels(struct iwl_nvm_data *data,
 void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg,
                          struct iwl_nvm_data *data,
                          struct ieee80211_sta_ht_cap *ht_info,
-                         enum ieee80211_band band,
+                         enum nl80211_band band,
                          u8 tx_chains, u8 rx_chains)
 {
        int max_bit_rate = 0;
@@ -813,22 +813,22 @@ static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
        int n_used = 0;
        struct ieee80211_supported_band *sband;
 
-       sband = &data->bands[IEEE80211_BAND_2GHZ];
-       sband->band = IEEE80211_BAND_2GHZ;
+       sband = &data->bands[NL80211_BAND_2GHZ];
+       sband->band = NL80211_BAND_2GHZ;
        sband->bitrates = &iwl_cfg80211_rates[RATES_24_OFFS];
        sband->n_bitrates = N_RATES_24;
        n_used += iwl_init_sband_channels(data, sband, n_channels,
-                                         IEEE80211_BAND_2GHZ);
-       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_2GHZ,
+                                         NL80211_BAND_2GHZ);
+       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, NL80211_BAND_2GHZ,
                             data->valid_tx_ant, data->valid_rx_ant);
 
-       sband = &data->bands[IEEE80211_BAND_5GHZ];
-       sband->band = IEEE80211_BAND_5GHZ;
+       sband = &data->bands[NL80211_BAND_5GHZ];
+       sband->band = NL80211_BAND_5GHZ;
        sband->bitrates = &iwl_cfg80211_rates[RATES_52_OFFS];
        sband->n_bitrates = N_RATES_52;
        n_used += iwl_init_sband_channels(data, sband, n_channels,
-                                         IEEE80211_BAND_5GHZ);
-       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_5GHZ,
+                                         NL80211_BAND_5GHZ);
+       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, NL80211_BAND_5GHZ,
                             data->valid_tx_ant, data->valid_rx_ant);
 
        if (n_channels != n_used)
index ad2b834..53f39a3 100644 (file)
@@ -98,7 +98,7 @@ struct iwl_nvm_data {
        s8 max_tx_pwr_half_dbm;
 
        bool lar_enabled;
-       struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band bands[NUM_NL80211_BANDS];
        struct ieee80211_channel channels[];
 };
 
@@ -133,12 +133,12 @@ int iwl_nvm_check_version(struct iwl_nvm_data *data,
 
 int iwl_init_sband_channels(struct iwl_nvm_data *data,
                            struct ieee80211_supported_band *sband,
-                           int n_channels, enum ieee80211_band band);
+                           int n_channels, enum nl80211_band band);
 
 void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg,
                          struct iwl_nvm_data *data,
                          struct ieee80211_sta_ht_cap *ht_info,
-                         enum ieee80211_band band,
+                         enum nl80211_band band,
                          u8 tx_chains, u8 rx_chains);
 
 #endif /* __iwl_eeprom_parse_h__ */
index 843232b..37dc09e 100644 (file)
@@ -251,6 +251,7 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_api_t;
  * @IWL_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source.
  * @IWL_UCODE_TLV_API_WIDE_CMD_HDR: ucode supports wide command header
  * @IWL_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params
+ * @IWL_UCODE_TLV_API_NEW_VERSION: new versioning format
  * @IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY: scan APIs use 8-level priority
  *     instead of 3.
  * @IWL_UCODE_TLV_API_TX_POWER_CHAIN: TX power API has larger command size
@@ -263,6 +264,7 @@ enum iwl_ucode_tlv_api {
        IWL_UCODE_TLV_API_WIFI_MCC_UPDATE       = (__force iwl_ucode_tlv_api_t)9,
        IWL_UCODE_TLV_API_WIDE_CMD_HDR          = (__force iwl_ucode_tlv_api_t)14,
        IWL_UCODE_TLV_API_LQ_SS_PARAMS          = (__force iwl_ucode_tlv_api_t)18,
+       IWL_UCODE_TLV_API_NEW_VERSION           = (__force iwl_ucode_tlv_api_t)20,
        IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY     = (__force iwl_ucode_tlv_api_t)24,
        IWL_UCODE_TLV_API_TX_POWER_CHAIN        = (__force iwl_ucode_tlv_api_t)27,
 
index 93a6895..14743c3 100644 (file)
@@ -308,7 +308,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
 
                channel->hw_value = nvm_chan[ch_idx];
                channel->band = (ch_idx < num_2ghz_channels) ?
-                               IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+                               NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
                channel->center_freq =
                        ieee80211_channel_to_frequency(
                                channel->hw_value, channel->band);
@@ -320,7 +320,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
                 * is not used in mvm, and is used for backwards compatibility
                 */
                channel->max_power = IWL_DEFAULT_MAX_TX_POWER;
-               is_5ghz = channel->band == IEEE80211_BAND_5GHZ;
+               is_5ghz = channel->band == NL80211_BAND_5GHZ;
 
                /* don't put limitations in case we're using LAR */
                if (!lar_supported)
@@ -439,22 +439,22 @@ static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
                                &ch_section[NVM_CHANNELS_FAMILY_8000],
                                lar_supported);
 
-       sband = &data->bands[IEEE80211_BAND_2GHZ];
-       sband->band = IEEE80211_BAND_2GHZ;
+       sband = &data->bands[NL80211_BAND_2GHZ];
+       sband->band = NL80211_BAND_2GHZ;
        sband->bitrates = &iwl_cfg80211_rates[RATES_24_OFFS];
        sband->n_bitrates = N_RATES_24;
        n_used += iwl_init_sband_channels(data, sband, n_channels,
-                                         IEEE80211_BAND_2GHZ);
-       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_2GHZ,
+                                         NL80211_BAND_2GHZ);
+       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, NL80211_BAND_2GHZ,
                             tx_chains, rx_chains);
 
-       sband = &data->bands[IEEE80211_BAND_5GHZ];
-       sband->band = IEEE80211_BAND_5GHZ;
+       sband = &data->bands[NL80211_BAND_5GHZ];
+       sband->band = NL80211_BAND_5GHZ;
        sband->bitrates = &iwl_cfg80211_rates[RATES_52_OFFS];
        sband->n_bitrates = N_RATES_52;
        n_used += iwl_init_sband_channels(data, sband, n_channels,
-                                         IEEE80211_BAND_5GHZ);
-       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_5GHZ,
+                                         NL80211_BAND_5GHZ);
+       iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, NL80211_BAND_5GHZ,
                             tx_chains, rx_chains);
        if (data->sku_cap_11ac_enable && !iwlwifi_mod_params.disable_11ac)
                iwl_init_vht_hw_capab(cfg, data, &sband->vht_cap,
@@ -781,7 +781,7 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
        struct ieee80211_regdomain *regd;
        int size_of_regd;
        struct ieee80211_reg_rule *rule;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int center_freq, prev_center_freq = 0;
        int valid_rules = 0;
        bool new_rule;
@@ -809,7 +809,7 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
        for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) {
                ch_flags = (u16)__le32_to_cpup(channels + ch_idx);
                band = (ch_idx < NUM_2GHZ_CHANNELS) ?
-                      IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+                      NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
                center_freq = ieee80211_channel_to_frequency(nvm_chan[ch_idx],
                                                             band);
                new_rule = false;
@@ -857,7 +857,7 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
                IWL_DEBUG_DEV(dev, IWL_DL_LAR,
                              "Ch. %d [%sGHz] %s%s%s%s%s%s%s%s%s(0x%02x): Ad-Hoc %ssupported\n",
                              center_freq,
-                             band == IEEE80211_BAND_5GHZ ? "5.2" : "2.4",
+                             band == NL80211_BAND_5GHZ ? "5.2" : "2.4",
                              CHECK_AND_PRINT_I(VALID),
                              CHECK_AND_PRINT_I(ACTIVE),
                              CHECK_AND_PRINT_I(RADAR),
index 35cdeca..a63f5bb 100644 (file)
@@ -378,7 +378,7 @@ iwl_get_coex_type(struct iwl_mvm *mvm, const struct ieee80211_vif *vif)
        chanctx_conf = rcu_dereference(vif->chanctx_conf);
 
        if (!chanctx_conf ||
-            chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ) {
+            chanctx_conf->def.chan->band != NL80211_BAND_2GHZ) {
                rcu_read_unlock();
                return BT_COEX_INVALID_LUT;
        }
@@ -537,7 +537,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
 
        /* If channel context is invalid or not on 2.4GHz .. */
        if ((!chanctx_conf ||
-            chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ)) {
+            chanctx_conf->def.chan->band != NL80211_BAND_2GHZ)) {
                if (vif->type == NL80211_IFTYPE_STATION) {
                        /* ... relax constraints and disable rssi events */
                        iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
@@ -857,11 +857,11 @@ bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm)
 }
 
 bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
-                                   enum ieee80211_band band)
+                                   enum nl80211_band band)
 {
        u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading);
 
-       if (band != IEEE80211_BAND_2GHZ)
+       if (band != NL80211_BAND_2GHZ)
                return false;
 
        return bt_activity >= BT_LOW_TRAFFIC;
@@ -873,7 +873,7 @@ u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
        __le16 fc = hdr->frame_control;
        bool mplut_enabled = iwl_mvm_is_mplut_supported(mvm);
 
-       if (info->band != IEEE80211_BAND_2GHZ)
+       if (info->band != NL80211_BAND_2GHZ)
                return 0;
 
        if (unlikely(mvm->bt_tx_prio))
index 3a279d3..fb96bc0 100644 (file)
@@ -724,9 +724,9 @@ static ssize_t iwl_dbgfs_tof_responder_params_write(struct ieee80211_vif *vif,
 
                ret = kstrtou32(data, 10, &value);
                if (ret == 0 && value) {
-                       enum ieee80211_band band = (cmd->channel_num <= 14) ?
-                                                  IEEE80211_BAND_2GHZ :
-                                                  IEEE80211_BAND_5GHZ;
+                       enum nl80211_band band = (cmd->channel_num <= 14) ?
+                                                  NL80211_BAND_2GHZ :
+                                                  NL80211_BAND_5GHZ;
                        struct ieee80211_channel chn = {
                                .band = band,
                                .center_freq = ieee80211_channel_to_frequency(
index 6ad5c60..9e97cf4 100644 (file)
@@ -980,7 +980,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
                goto error;
 
        /* Add all the PHY contexts */
-       chan = &mvm->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels[0];
+       chan = &mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[0];
        cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
        for (i = 0; i < NUM_PHY_CTX; i++) {
                /*
index 923d191..456067b 100644 (file)
@@ -559,7 +559,7 @@ void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 
 static void iwl_mvm_ack_rates(struct iwl_mvm *mvm,
                              struct ieee80211_vif *vif,
-                             enum ieee80211_band band,
+                             enum nl80211_band band,
                              u8 *cck_rates, u8 *ofdm_rates)
 {
        struct ieee80211_supported_band *sband;
@@ -730,7 +730,7 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
        rcu_read_lock();
        chanctx = rcu_dereference(vif->chanctx_conf);
        iwl_mvm_ack_rates(mvm, vif, chanctx ? chanctx->def.chan->band
-                                           : IEEE80211_BAND_2GHZ,
+                                           : NL80211_BAND_2GHZ,
                          &cck_ack_rates, &ofdm_ack_rates);
        rcu_read_unlock();
 
@@ -1065,7 +1065,7 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
                cpu_to_le32(BIT(mvm->mgmt_last_antenna_idx) <<
                            RATE_MCS_ANT_POS);
 
-       if (info->band == IEEE80211_BAND_5GHZ || vif->p2p) {
+       if (info->band == NL80211_BAND_5GHZ || vif->p2p) {
                rate = IWL_FIRST_OFDM_RATE;
        } else {
                rate = IWL_FIRST_CCK_RATE;
@@ -1516,7 +1516,7 @@ void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,
        rx_status.device_timestamp = le32_to_cpu(sb->system_time);
        rx_status.band =
                (sb->phy_flags & cpu_to_le16(RX_RES_PHY_FLAGS_BAND_24)) ?
-                               IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+                               NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
        rx_status.freq =
                ieee80211_channel_to_frequency(le16_to_cpu(sb->channel),
                                               rx_status.band);
index 4f5ec49..ef91b37 100644 (file)
@@ -550,18 +550,18 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
        else
                mvm->max_scans = IWL_MVM_MAX_LMAC_SCANS;
 
-       if (mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels)
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                       &mvm->nvm_data->bands[IEEE80211_BAND_2GHZ];
-       if (mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels) {
-               hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                       &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ];
+       if (mvm->nvm_data->bands[NL80211_BAND_2GHZ].n_channels)
+               hw->wiphy->bands[NL80211_BAND_2GHZ] =
+                       &mvm->nvm_data->bands[NL80211_BAND_2GHZ];
+       if (mvm->nvm_data->bands[NL80211_BAND_5GHZ].n_channels) {
+               hw->wiphy->bands[NL80211_BAND_5GHZ] =
+                       &mvm->nvm_data->bands[NL80211_BAND_5GHZ];
 
                if (fw_has_capa(&mvm->fw->ucode_capa,
                                IWL_UCODE_TLV_CAPA_BEAMFORMER) &&
                    fw_has_api(&mvm->fw->ucode_capa,
                               IWL_UCODE_TLV_API_LQ_SS_PARAMS))
-                       hw->wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap.cap |=
+                       hw->wiphy->bands[NL80211_BAND_5GHZ]->vht_cap.cap |=
                                IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE;
        }
 
@@ -2911,7 +2911,7 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm,
                        cpu_to_le32(FW_CMD_ID_AND_COLOR(MAC_INDEX_AUX, 0)),
                .sta_id_and_color = cpu_to_le32(mvm->aux_sta.sta_id),
                /* Set the channel info data */
-               .channel_info.band = (channel->band == IEEE80211_BAND_2GHZ) ?
+               .channel_info.band = (channel->band == NL80211_BAND_2GHZ) ?
                        PHY_BAND_24 : PHY_BAND_5,
                .channel_info.channel = channel->hw_value,
                .channel_info.width = PHY_VHT_CHANNEL_MODE20,
index 2d685e0..85800ba 100644 (file)
@@ -1133,9 +1133,9 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm);
 
 /* Utils */
 int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
-                                       enum ieee80211_band band);
+                                       enum nl80211_band band);
 void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,
-                              enum ieee80211_band band,
+                              enum nl80211_band band,
                               struct ieee80211_tx_rate *r);
 u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx);
 void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm);
@@ -1468,7 +1468,7 @@ bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
 bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant);
 bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm);
 bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
-                                   enum ieee80211_band band);
+                                   enum nl80211_band band);
 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
                           struct ieee80211_tx_info *info, u8 ac);
 
index 6e6a56f..9513883 100644 (file)
@@ -147,7 +147,7 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
        u8 active_cnt, idle_cnt;
 
        /* Set the channel info data */
-       cmd->ci.band = (chandef->chan->band == IEEE80211_BAND_2GHZ ?
+       cmd->ci.band = (chandef->chan->band == NL80211_BAND_2GHZ ?
              PHY_BAND_24 : PHY_BAND_5);
 
        cmd->ci.channel = chandef->chan->hw_value;
index 61d0a8c..81dd2f6 100644 (file)
@@ -829,7 +829,7 @@ static u32 ucode_rate_from_rs_rate(struct iwl_mvm *mvm,
 
 /* Convert a ucode rate into an rs_rate object */
 static int rs_rate_from_ucode_rate(const u32 ucode_rate,
-                                  enum ieee80211_band band,
+                                  enum nl80211_band band,
                                   struct rs_rate *rate)
 {
        u32 ant_msk = ucode_rate & RATE_MCS_ANT_ABC_MSK;
@@ -848,7 +848,7 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
        if (!(ucode_rate & RATE_MCS_HT_MSK) &&
            !(ucode_rate & RATE_MCS_VHT_MSK)) {
                if (num_of_ant == 1) {
-                       if (band == IEEE80211_BAND_5GHZ)
+                       if (band == NL80211_BAND_5GHZ)
                                rate->type = LQ_LEGACY_A;
                        else
                                rate->type = LQ_LEGACY_G;
@@ -1043,7 +1043,7 @@ static void rs_get_lower_rate_down_column(struct iwl_lq_sta *lq_sta,
                return;
        } else if (is_siso(rate)) {
                /* Downgrade to Legacy if we were in SISO */
-               if (lq_sta->band == IEEE80211_BAND_5GHZ)
+               if (lq_sta->band == NL80211_BAND_5GHZ)
                        rate->type = LQ_LEGACY_A;
                else
                        rate->type = LQ_LEGACY_G;
@@ -1850,7 +1850,7 @@ static int rs_switch_to_column(struct iwl_mvm *mvm,
        rate->ant = column->ant;
 
        if (column->mode == RS_LEGACY) {
-               if (lq_sta->band == IEEE80211_BAND_5GHZ)
+               if (lq_sta->band == NL80211_BAND_5GHZ)
                        rate->type = LQ_LEGACY_A;
                else
                        rate->type = LQ_LEGACY_G;
@@ -2020,7 +2020,7 @@ static void rs_get_adjacent_txp(struct iwl_mvm *mvm, int index,
 }
 
 static bool rs_tpc_allowed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-                          struct rs_rate *rate, enum ieee80211_band band)
+                          struct rs_rate *rate, enum nl80211_band band)
 {
        int index = rate->index;
        bool cam = (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM);
@@ -2126,7 +2126,7 @@ static bool rs_tpc_perform(struct iwl_mvm *mvm,
        struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
        struct ieee80211_vif *vif = mvm_sta->vif;
        struct ieee80211_chanctx_conf *chanctx_conf;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct iwl_rate_scale_data *window;
        struct rs_rate *rate = &tbl->rate;
        enum tpc_action action;
@@ -2148,7 +2148,7 @@ static bool rs_tpc_perform(struct iwl_mvm *mvm,
        rcu_read_lock();
        chanctx_conf = rcu_dereference(vif->chanctx_conf);
        if (WARN_ON(!chanctx_conf))
-               band = IEEE80211_NUM_BANDS;
+               band = NUM_NL80211_BANDS;
        else
                band = chanctx_conf->def.chan->band;
        rcu_read_unlock();
@@ -2606,7 +2606,7 @@ static void rs_init_optimal_rate(struct iwl_mvm *mvm,
                rate->type = lq_sta->is_vht ? LQ_VHT_MIMO2 : LQ_HT_MIMO2;
        else if (lq_sta->max_siso_rate_idx != IWL_RATE_INVALID)
                rate->type = lq_sta->is_vht ? LQ_VHT_SISO : LQ_HT_SISO;
-       else if (lq_sta->band == IEEE80211_BAND_5GHZ)
+       else if (lq_sta->band == NL80211_BAND_5GHZ)
                rate->type = LQ_LEGACY_A;
        else
                rate->type = LQ_LEGACY_G;
@@ -2623,7 +2623,7 @@ static void rs_init_optimal_rate(struct iwl_mvm *mvm,
        } else {
                lq_sta->optimal_rate_mask = lq_sta->active_legacy_rate;
 
-               if (lq_sta->band == IEEE80211_BAND_5GHZ) {
+               if (lq_sta->band == NL80211_BAND_5GHZ) {
                        lq_sta->optimal_rates = rs_optimal_rates_5ghz_legacy;
                        lq_sta->optimal_nentries =
                                ARRAY_SIZE(rs_optimal_rates_5ghz_legacy);
@@ -2679,7 +2679,7 @@ static struct rs_rate *rs_get_optimal_rate(struct iwl_mvm *mvm,
 static void rs_get_initial_rate(struct iwl_mvm *mvm,
                                struct ieee80211_sta *sta,
                                struct iwl_lq_sta *lq_sta,
-                               enum ieee80211_band band,
+                               enum nl80211_band band,
                                struct rs_rate *rate)
 {
        int i, nentries;
@@ -2714,7 +2714,7 @@ static void rs_get_initial_rate(struct iwl_mvm *mvm,
        rate->index = find_first_bit(&lq_sta->active_legacy_rate,
                                     BITS_PER_LONG);
 
-       if (band == IEEE80211_BAND_5GHZ) {
+       if (band == NL80211_BAND_5GHZ) {
                rate->type = LQ_LEGACY_A;
                initial_rates = rs_optimal_rates_5ghz_legacy;
                nentries = ARRAY_SIZE(rs_optimal_rates_5ghz_legacy);
@@ -2814,7 +2814,7 @@ void rs_update_last_rssi(struct iwl_mvm *mvm,
 static void rs_initialize_lq(struct iwl_mvm *mvm,
                             struct ieee80211_sta *sta,
                             struct iwl_lq_sta *lq_sta,
-                            enum ieee80211_band band,
+                            enum nl80211_band band,
                             bool init)
 {
        struct iwl_scale_tbl_info *tbl;
@@ -3097,7 +3097,7 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg)
  * Called after adding a new station to initialize rate scaling
  */
 void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
-                         enum ieee80211_band band, bool init)
+                         enum nl80211_band band, bool init)
 {
        int i, j;
        struct ieee80211_hw *hw = mvm->hw;
@@ -3203,7 +3203,7 @@ static void rs_rate_update(void *mvm_r,
 #ifdef CONFIG_MAC80211_DEBUGFS
 static void rs_build_rates_table_from_fixed(struct iwl_mvm *mvm,
                                            struct iwl_lq_cmd *lq_cmd,
-                                           enum ieee80211_band band,
+                                           enum nl80211_band band,
                                            u32 ucode_rate)
 {
        struct rs_rate rate;
index bdb6f2d..90d046f 100644 (file)
@@ -305,7 +305,7 @@ struct iwl_lq_sta {
        bool stbc_capable;      /* Tx STBC is supported by chip and Rx by STA */
        bool bfer_capable;      /* Remote supports beamformee and we BFer */
 
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */
        unsigned long active_legacy_rate;
@@ -358,7 +358,7 @@ struct iwl_lq_sta {
 
 /* Initialize station's rate scaling information after adding station */
 void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
-                         enum ieee80211_band band, bool init);
+                         enum nl80211_band band, bool init);
 
 /* Notify RS about Tx status */
 void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
index d8cadf2..263e8a8 100644 (file)
@@ -319,7 +319,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
        rx_status->device_timestamp = le32_to_cpu(phy_info->system_timestamp);
        rx_status->band =
                (phy_info->phy_flags & cpu_to_le16(RX_RES_PHY_FLAGS_BAND_24)) ?
-                               IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+                               NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
        rx_status->freq =
                ieee80211_channel_to_frequency(le16_to_cpu(phy_info->channel),
                                               rx_status->band);
index d4a4c13..651604d 100644 (file)
@@ -456,8 +456,8 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
 
        rx_status->mactime = le64_to_cpu(desc->tsf_on_air_rise);
        rx_status->device_timestamp = le32_to_cpu(desc->gp2_on_air_rise);
-       rx_status->band = desc->channel > 14 ? IEEE80211_BAND_5GHZ :
-                                              IEEE80211_BAND_2GHZ;
+       rx_status->band = desc->channel > 14 ? NL80211_BAND_5GHZ :
+                                              NL80211_BAND_2GHZ;
        rx_status->freq = ieee80211_channel_to_frequency(desc->channel,
                                                         rx_status->band);
        iwl_mvm_get_signal_strength(mvm, desc, rx_status);
index c1d1be9..6f609dd 100644 (file)
@@ -163,16 +163,16 @@ static inline __le16 iwl_mvm_scan_rx_chain(struct iwl_mvm *mvm)
        return cpu_to_le16(rx_chain);
 }
 
-static __le32 iwl_mvm_scan_rxon_flags(enum ieee80211_band band)
+static __le32 iwl_mvm_scan_rxon_flags(enum nl80211_band band)
 {
-       if (band == IEEE80211_BAND_2GHZ)
+       if (band == NL80211_BAND_2GHZ)
                return cpu_to_le32(PHY_BAND_24);
        else
                return cpu_to_le32(PHY_BAND_5);
 }
 
 static inline __le32
-iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum ieee80211_band band,
+iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum nl80211_band band,
                          bool no_cck)
 {
        u32 tx_ant;
@@ -182,7 +182,7 @@ iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum ieee80211_band band,
                                     mvm->scan_last_antenna_idx);
        tx_ant = BIT(mvm->scan_last_antenna_idx) << RATE_MCS_ANT_POS;
 
-       if (band == IEEE80211_BAND_2GHZ && !no_cck)
+       if (band == NL80211_BAND_2GHZ && !no_cck)
                return cpu_to_le32(IWL_RATE_1M_PLCP | RATE_MCS_CCK_MSK |
                                   tx_ant);
        else
@@ -591,14 +591,14 @@ static void iwl_mvm_scan_fill_tx_cmd(struct iwl_mvm *mvm,
        tx_cmd[0].tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL |
                                         TX_CMD_FLG_BT_DIS);
        tx_cmd[0].rate_n_flags = iwl_mvm_scan_rate_n_flags(mvm,
-                                                          IEEE80211_BAND_2GHZ,
+                                                          NL80211_BAND_2GHZ,
                                                           no_cck);
        tx_cmd[0].sta_id = mvm->aux_sta.sta_id;
 
        tx_cmd[1].tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL |
                                         TX_CMD_FLG_BT_DIS);
        tx_cmd[1].rate_n_flags = iwl_mvm_scan_rate_n_flags(mvm,
-                                                          IEEE80211_BAND_5GHZ,
+                                                          NL80211_BAND_5GHZ,
                                                           no_cck);
        tx_cmd[1].sta_id = mvm->aux_sta.sta_id;
 }
@@ -695,19 +695,19 @@ iwl_mvm_build_scan_probe(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 
        /* Insert ds parameter set element on 2.4 GHz band */
        newpos = iwl_mvm_copy_and_insert_ds_elem(mvm,
-                                                ies->ies[IEEE80211_BAND_2GHZ],
-                                                ies->len[IEEE80211_BAND_2GHZ],
+                                                ies->ies[NL80211_BAND_2GHZ],
+                                                ies->len[NL80211_BAND_2GHZ],
                                                 pos);
        params->preq.band_data[0].offset = cpu_to_le16(pos - params->preq.buf);
        params->preq.band_data[0].len = cpu_to_le16(newpos - pos);
        pos = newpos;
 
-       memcpy(pos, ies->ies[IEEE80211_BAND_5GHZ],
-              ies->len[IEEE80211_BAND_5GHZ]);
+       memcpy(pos, ies->ies[NL80211_BAND_5GHZ],
+              ies->len[NL80211_BAND_5GHZ]);
        params->preq.band_data[1].offset = cpu_to_le16(pos - params->preq.buf);
        params->preq.band_data[1].len =
-               cpu_to_le16(ies->len[IEEE80211_BAND_5GHZ]);
-       pos += ies->len[IEEE80211_BAND_5GHZ];
+               cpu_to_le16(ies->len[NL80211_BAND_5GHZ]);
+       pos += ies->len[NL80211_BAND_5GHZ];
 
        memcpy(pos, ies->common_ies, ies->common_ie_len);
        params->preq.common_data.offset = cpu_to_le16(pos - params->preq.buf);
@@ -921,10 +921,10 @@ static __le32 iwl_mvm_scan_config_rates(struct iwl_mvm *mvm)
        unsigned int rates = 0;
        int i;
 
-       band = &mvm->nvm_data->bands[IEEE80211_BAND_2GHZ];
+       band = &mvm->nvm_data->bands[NL80211_BAND_2GHZ];
        for (i = 0; i < band->n_bitrates; i++)
                rates |= rate_to_scan_rate_flag(band->bitrates[i].hw_value);
-       band = &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ];
+       band = &mvm->nvm_data->bands[NL80211_BAND_5GHZ];
        for (i = 0; i < band->n_bitrates; i++)
                rates |= rate_to_scan_rate_flag(band->bitrates[i].hw_value);
 
@@ -939,8 +939,8 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm)
        struct iwl_scan_config *scan_config;
        struct ieee80211_supported_band *band;
        int num_channels =
-               mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels +
-               mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels;
+               mvm->nvm_data->bands[NL80211_BAND_2GHZ].n_channels +
+               mvm->nvm_data->bands[NL80211_BAND_5GHZ].n_channels;
        int ret, i, j = 0, cmd_size;
        struct iwl_host_cmd cmd = {
                .id = iwl_cmd_id(SCAN_CFG_CMD, IWL_ALWAYS_LONG_GROUP, 0),
@@ -994,10 +994,10 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm)
                                     IWL_CHANNEL_FLAG_EBS_ADD |
                                     IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE;
 
-       band = &mvm->nvm_data->bands[IEEE80211_BAND_2GHZ];
+       band = &mvm->nvm_data->bands[NL80211_BAND_2GHZ];
        for (i = 0; i < band->n_channels; i++, j++)
                scan_config->channel_array[j] = band->channels[i].hw_value;
-       band = &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ];
+       band = &mvm->nvm_data->bands[NL80211_BAND_5GHZ];
        for (i = 0; i < band->n_channels; i++, j++)
                scan_config->channel_array[j] = band->channels[i].hw_value;
 
index 18711c5..9f160fc 100644 (file)
@@ -444,7 +444,7 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm,
        }
 
        if (chandef) {
-               cmd.ci.band = (chandef->chan->band == IEEE80211_BAND_2GHZ ?
+               cmd.ci.band = (chandef->chan->band == NL80211_BAND_2GHZ ?
                               PHY_BAND_24 : PHY_BAND_5);
                cmd.ci.channel = chandef->chan->hw_value;
                cmd.ci.width = iwl_mvm_get_channel_width(chandef);
index efb9b98..bd286fc 100644 (file)
@@ -359,7 +359,7 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd,
                                &mvm->nvm_data->bands[info->band], sta);
 
        /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
-       if (info->band == IEEE80211_BAND_5GHZ)
+       if (info->band == NL80211_BAND_5GHZ)
                rate_idx += IWL_FIRST_OFDM_RATE;
 
        /* For 2.4 GHZ band, check that there is no need to remap */
@@ -372,7 +372,7 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd,
                iwl_mvm_next_antenna(mvm, iwl_mvm_get_valid_tx_ant(mvm),
                                     mvm->mgmt_last_antenna_idx);
 
-       if (info->band == IEEE80211_BAND_2GHZ &&
+       if (info->band == NL80211_BAND_2GHZ &&
            !iwl_mvm_bt_coex_is_shared_ant_avail(mvm))
                rate_flags = mvm->cfg->non_shared_ant << RATE_MCS_ANT_POS;
        else
@@ -1052,7 +1052,7 @@ const char *iwl_mvm_get_tx_fail_reason(u32 status)
 #endif /* CONFIG_IWLWIFI_DEBUG */
 
 void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,
-                              enum ieee80211_band band,
+                              enum nl80211_band band,
                               struct ieee80211_tx_rate *r)
 {
        if (rate_n_flags & RATE_HT_MCS_GF_MSK)
index 486c985..f0ffd62 100644 (file)
@@ -217,14 +217,14 @@ static const u8 fw_rate_idx_to_plcp[IWL_RATE_COUNT] = {
 };
 
 int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
-                                       enum ieee80211_band band)
+                                       enum nl80211_band band)
 {
        int rate = rate_n_flags & RATE_LEGACY_RATE_MSK;
        int idx;
        int band_offset = 0;
 
        /* Legacy rate format, search for match in table */
-       if (band == IEEE80211_BAND_5GHZ)
+       if (band == NL80211_BAND_5GHZ)
                band_offset = IWL_FIRST_OFDM_RATE;
        for (idx = band_offset; idx < IWL_RATE_COUNT_LEGACY; idx++)
                if (fw_rate_idx_to_plcp[idx] == rate)
index 0f6ea31..7aa4706 100644 (file)
@@ -60,14 +60,14 @@ int orinoco_wiphy_register(struct wiphy *wiphy)
                if (priv->channel_mask & (1 << i)) {
                        priv->channels[i].center_freq =
                                ieee80211_channel_to_frequency(i + 1,
-                                                          IEEE80211_BAND_2GHZ);
+                                                          NL80211_BAND_2GHZ);
                        channels++;
                }
        }
        priv->band.channels = priv->channels;
        priv->band.n_channels = channels;
 
-       wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+       wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
        wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
 
        i = 0;
@@ -175,7 +175,7 @@ static int orinoco_set_monitor_channel(struct wiphy *wiphy,
        if (cfg80211_get_chandef_type(chandef) != NL80211_CHAN_NO_HT)
                return -EINVAL;
 
-       if (chandef->chan->band != IEEE80211_BAND_2GHZ)
+       if (chandef->chan->band != NL80211_BAND_2GHZ)
                return -EINVAL;
 
        channel = ieee80211_frequency_to_channel(chandef->chan->center_freq);
index e27e328..61af5a2 100644 (file)
@@ -1193,7 +1193,7 @@ int orinoco_hw_get_freq(struct orinoco_private *priv)
                goto out;
 
        }
-       freq = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+       freq = ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
 
  out:
        orinoco_unlock(priv, &flags);
index 2c66166..d0ceb06 100644 (file)
@@ -111,7 +111,7 @@ static void orinoco_add_hostscan_result(struct orinoco_private *priv,
        }
 
        freq = ieee80211_channel_to_frequency(
-               le16_to_cpu(bss->a.channel), IEEE80211_BAND_2GHZ);
+               le16_to_cpu(bss->a.channel), NL80211_BAND_2GHZ);
        channel = ieee80211_get_channel(wiphy, freq);
        if (!channel) {
                printk(KERN_DEBUG "Invalid channel designation %04X(%04X)",
@@ -148,7 +148,7 @@ void orinoco_add_extscan_result(struct orinoco_private *priv,
        ie_len = len - sizeof(*bss);
        ie = cfg80211_find_ie(WLAN_EID_DS_PARAMS, bss->data, ie_len);
        chan = ie ? ie[2] : 0;
-       freq = ieee80211_channel_to_frequency(chan, IEEE80211_BAND_2GHZ);
+       freq = ieee80211_channel_to_frequency(chan, NL80211_BAND_2GHZ);
        channel = ieee80211_get_channel(wiphy, freq);
 
        timestamp = le64_to_cpu(bss->timestamp);
index 2fe713e..d4c73d3 100644 (file)
@@ -76,14 +76,14 @@ struct p54_channel_entry {
        u16 data;
        int index;
        int max_power;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 };
 
 struct p54_channel_list {
        struct p54_channel_entry *channels;
        size_t entries;
        size_t max_entries;
-       size_t band_channel_num[IEEE80211_NUM_BANDS];
+       size_t band_channel_num[NUM_NL80211_BANDS];
 };
 
 static int p54_get_band_from_freq(u16 freq)
@@ -91,10 +91,10 @@ static int p54_get_band_from_freq(u16 freq)
        /* FIXME: sync these values with the 802.11 spec */
 
        if ((freq >= 2412) && (freq <= 2484))
-               return IEEE80211_BAND_2GHZ;
+               return NL80211_BAND_2GHZ;
 
        if ((freq >= 4920) && (freq <= 5825))
-               return IEEE80211_BAND_5GHZ;
+               return NL80211_BAND_5GHZ;
 
        return -1;
 }
@@ -124,16 +124,16 @@ static int p54_compare_rssichan(const void *_a,
 
 static int p54_fill_band_bitrates(struct ieee80211_hw *dev,
                                  struct ieee80211_supported_band *band_entry,
-                                 enum ieee80211_band band)
+                                 enum nl80211_band band)
 {
        /* TODO: generate rate array dynamically */
 
        switch (band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                band_entry->bitrates = p54_bgrates;
                band_entry->n_bitrates = ARRAY_SIZE(p54_bgrates);
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                band_entry->bitrates = p54_arates;
                band_entry->n_bitrates = ARRAY_SIZE(p54_arates);
                break;
@@ -147,7 +147,7 @@ static int p54_fill_band_bitrates(struct ieee80211_hw *dev,
 static int p54_generate_band(struct ieee80211_hw *dev,
                             struct p54_channel_list *list,
                             unsigned int *chan_num,
-                            enum ieee80211_band band)
+                            enum nl80211_band band)
 {
        struct p54_common *priv = dev->priv;
        struct ieee80211_supported_band *tmp, *old;
@@ -206,7 +206,7 @@ static int p54_generate_band(struct ieee80211_hw *dev,
 
        if (j == 0) {
                wiphy_err(dev->wiphy, "Disabling totally damaged %d GHz band\n",
-                         (band == IEEE80211_BAND_2GHZ) ? 2 : 5);
+                         (band == NL80211_BAND_2GHZ) ? 2 : 5);
 
                ret = -ENODATA;
                goto err_out;
@@ -396,7 +396,7 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
             p54_compare_channels, NULL);
 
        k = 0;
-       for (i = 0, j = 0; i < IEEE80211_NUM_BANDS; i++) {
+       for (i = 0, j = 0; i < NUM_NL80211_BANDS; i++) {
                if (p54_generate_band(dev, list, &k, i) == 0)
                        j++;
        }
@@ -573,10 +573,10 @@ static int p54_parse_rssical(struct ieee80211_hw *dev,
                for (i = 0; i < entries; i++) {
                        u16 freq = 0;
                        switch (i) {
-                       case IEEE80211_BAND_2GHZ:
+                       case NL80211_BAND_2GHZ:
                                freq = 2437;
                                break;
-                       case IEEE80211_BAND_5GHZ:
+                       case NL80211_BAND_5GHZ:
                                freq = 5240;
                                break;
                        }
@@ -902,11 +902,11 @@ good_eeprom:
        if (priv->rxhw == PDR_SYNTH_FRONTEND_XBOW)
                p54_init_xbow_synth(priv);
        if (!(synth & PDR_SYNTH_24_GHZ_DISABLED))
-               dev->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                       priv->band_table[IEEE80211_BAND_2GHZ];
+               dev->wiphy->bands[NL80211_BAND_2GHZ] =
+                       priv->band_table[NL80211_BAND_2GHZ];
        if (!(synth & PDR_SYNTH_5_GHZ_DISABLED))
-               dev->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                       priv->band_table[IEEE80211_BAND_5GHZ];
+               dev->wiphy->bands[NL80211_BAND_5GHZ] =
+                       priv->band_table[NL80211_BAND_5GHZ];
        if ((synth & PDR_SYNTH_RX_DIV_MASK) == PDR_SYNTH_RX_DIV_SUPPORTED)
                priv->rx_diversity_mask = 3;
        if ((synth & PDR_SYNTH_TX_DIV_MASK) == PDR_SYNTH_TX_DIV_SUPPORTED)
index 7805864..d5a3bf9 100644 (file)
@@ -477,7 +477,7 @@ static void p54_bss_info_changed(struct ieee80211_hw *dev,
                p54_set_edcf(priv);
        }
        if (changed & BSS_CHANGED_BASIC_RATES) {
-               if (dev->conf.chandef.chan->band == IEEE80211_BAND_5GHZ)
+               if (dev->conf.chandef.chan->band == NL80211_BAND_5GHZ)
                        priv->basic_rate_mask = (info->basic_rates << 4);
                else
                        priv->basic_rate_mask = info->basic_rates;
@@ -829,7 +829,7 @@ void p54_free_common(struct ieee80211_hw *dev)
        struct p54_common *priv = dev->priv;
        unsigned int i;
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++)
+       for (i = 0; i < NUM_NL80211_BANDS; i++)
                kfree(priv->band_table[i]);
 
        kfree(priv->iq_autocal);
index 40b401e..529939e 100644 (file)
@@ -223,7 +223,7 @@ struct p54_common {
        struct p54_cal_database *curve_data;
        struct p54_cal_database *output_limit;
        struct p54_cal_database *rssi_db;
-       struct ieee80211_supported_band *band_table[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band *band_table[NUM_NL80211_BANDS];
 
        /* BBP/MAC state */
        u8 mac_addr[ETH_ALEN];
index 24e5ff9..1af7da0 100644 (file)
@@ -353,7 +353,7 @@ static int p54_rx_data(struct p54_common *priv, struct sk_buff *skb)
        rx_status->signal = p54_rssi_to_dbm(priv, hdr->rssi);
        if (hdr->rate & 0x10)
                rx_status->flag |= RX_FLAG_SHORTPRE;
-       if (priv->hw->conf.chandef.chan->band == IEEE80211_BAND_5GHZ)
+       if (priv->hw->conf.chandef.chan->band == NL80211_BAND_5GHZ)
                rx_status->rate_idx = (rate < 4) ? 0 : rate - 4;
        else
                rx_status->rate_idx = rate;
@@ -867,7 +867,7 @@ void p54_tx_80211(struct ieee80211_hw *dev,
        for (i = 0; i < nrates && ridx < 8; i++) {
                /* we register the rates in perfect order */
                rate = info->control.rates[i].idx;
-               if (info->band == IEEE80211_BAND_5GHZ)
+               if (info->band == NL80211_BAND_5GHZ)
                        rate += 4;
 
                /* store the count we actually calculated for TX status */
index 333c1a2..6700387 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/delay.h>
+#include <linux/ktime.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -113,7 +114,7 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
 
 #if VERBOSE > SHOW_ERROR_MESSAGES
        u32 counter = 0;
-       struct timeval current_time;
+       struct timespec64 current_ts64;
        DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n");
 #endif
 
@@ -121,22 +122,22 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
        if (asleep) {
                /* device is in powersave, trigger the device for wakeup */
 #if VERBOSE > SHOW_ERROR_MESSAGES
-               do_gettimeofday(&current_time);
-               DEBUG(SHOW_TRACING, "%08li.%08li Device wakeup triggered\n",
-                     current_time.tv_sec, (long)current_time.tv_usec);
+               ktime_get_real_ts64(&current_ts64);
+               DEBUG(SHOW_TRACING, "%lld.%09ld Device wakeup triggered\n",
+                     (s64)current_ts64.tv_sec, current_ts64.tv_nsec);
 
-               DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n",
-                     current_time.tv_sec, (long)current_time.tv_usec,
+               DEBUG(SHOW_TRACING, "%lld.%09ld Device register read %08x\n",
+                     (s64)current_ts64.tv_sec, current_ts64.tv_nsec,
                      readl(device_base + ISL38XX_CTRL_STAT_REG));
 #endif
 
                reg = readl(device_base + ISL38XX_INT_IDENT_REG);
                if (reg == 0xabadface) {
 #if VERBOSE > SHOW_ERROR_MESSAGES
-                       do_gettimeofday(&current_time);
+                       ktime_get_real_ts64(&current_ts64);
                        DEBUG(SHOW_TRACING,
-                             "%08li.%08li Device register abadface\n",
-                             current_time.tv_sec, (long)current_time.tv_usec);
+                             "%lld.%09ld Device register abadface\n",
+                             (s64)current_ts64.tv_sec, current_ts64.tv_nsec);
 #endif
                        /* read the Device Status Register until Sleepmode bit is set */
                        while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG),
@@ -149,13 +150,13 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
 
 #if VERBOSE > SHOW_ERROR_MESSAGES
                        DEBUG(SHOW_TRACING,
-                             "%08li.%08li Device register read %08x\n",
-                             current_time.tv_sec, (long)current_time.tv_usec,
+                             "%lld.%09ld Device register read %08x\n",
+                             (s64)current_ts64.tv_sec, current_ts64.tv_nsec,
                              readl(device_base + ISL38XX_CTRL_STAT_REG));
-                       do_gettimeofday(&current_time);
+                       ktime_get_real_ts64(&current_ts64);
                        DEBUG(SHOW_TRACING,
-                             "%08li.%08li Device asleep counter %i\n",
-                             current_time.tv_sec, (long)current_time.tv_usec,
+                             "%lld.%09ld Device asleep counter %i\n",
+                             (s64)current_ts64.tv_sec, current_ts64.tv_nsec,
                              counter);
 #endif
                }
@@ -168,9 +169,9 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base)
 
                /* perform another read on the Device Status Register */
                reg = readl(device_base + ISL38XX_CTRL_STAT_REG);
-               do_gettimeofday(&current_time);
-               DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n",
-                     current_time.tv_sec, (long)current_time.tv_usec, reg);
+               ktime_get_real_ts64(&current_ts64);
+               DEBUG(SHOW_TRACING, "%lld.%00ld Device register read %08x\n",
+                     (s64)current_ts64.tv_sec, current_ts64.tv_nsec, reg);
 #endif
        } else {
                /* device is (still) awake  */
index 2b185fe..c757f14 100644 (file)
@@ -255,14 +255,14 @@ static struct class *hwsim_class;
 static struct net_device *hwsim_mon; /* global monitor netdev */
 
 #define CHAN2G(_freq)  { \
-       .band = IEEE80211_BAND_2GHZ, \
+       .band = NL80211_BAND_2GHZ, \
        .center_freq = (_freq), \
        .hw_value = (_freq), \
        .max_power = 20, \
 }
 
 #define CHAN5G(_freq) { \
-       .band = IEEE80211_BAND_5GHZ, \
+       .band = NL80211_BAND_5GHZ, \
        .center_freq = (_freq), \
        .hw_value = (_freq), \
        .max_power = 20, \
@@ -479,7 +479,7 @@ struct mac80211_hwsim_data {
        struct list_head list;
        struct ieee80211_hw *hw;
        struct device *dev;
-       struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band bands[NUM_NL80211_BANDS];
        struct ieee80211_channel channels_2ghz[ARRAY_SIZE(hwsim_channels_2ghz)];
        struct ieee80211_channel channels_5ghz[ARRAY_SIZE(hwsim_channels_5ghz)];
        struct ieee80211_rate rates[ARRAY_SIZE(hwsim_rates)];
@@ -2347,7 +2347,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
        u8 addr[ETH_ALEN];
        struct mac80211_hwsim_data *data;
        struct ieee80211_hw *hw;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
        int idx;
 
@@ -2476,16 +2476,16 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
                sizeof(hwsim_channels_5ghz));
        memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates));
 
-       for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
                struct ieee80211_supported_band *sband = &data->bands[band];
                switch (band) {
-               case IEEE80211_BAND_2GHZ:
+               case NL80211_BAND_2GHZ:
                        sband->channels = data->channels_2ghz;
                        sband->n_channels = ARRAY_SIZE(hwsim_channels_2ghz);
                        sband->bitrates = data->rates;
                        sband->n_bitrates = ARRAY_SIZE(hwsim_rates);
                        break;
-               case IEEE80211_BAND_5GHZ:
+               case NL80211_BAND_5GHZ:
                        sband->channels = data->channels_5ghz;
                        sband->n_channels = ARRAY_SIZE(hwsim_channels_5ghz);
                        sband->bitrates = data->rates + 4;
index 2eea76a..776b44b 100644 (file)
@@ -23,7 +23,7 @@
 
 
 #define CHAN2G(_channel, _freq, _flags) {        \
-       .band             = IEEE80211_BAND_2GHZ, \
+       .band             = NL80211_BAND_2GHZ, \
        .center_freq      = (_freq),             \
        .hw_value         = (_channel),          \
        .flags            = (_flags),            \
@@ -639,7 +639,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy,
                if (chan_no != -1) {
                        struct wiphy *wiphy = priv->wdev->wiphy;
                        int freq = ieee80211_channel_to_frequency(chan_no,
-                                                       IEEE80211_BAND_2GHZ);
+                                                       NL80211_BAND_2GHZ);
                        struct ieee80211_channel *channel =
                                ieee80211_get_channel(wiphy, freq);
 
@@ -1266,7 +1266,7 @@ _new_connect_scan_req(struct wiphy *wiphy, struct cfg80211_connect_params *sme)
 {
        struct cfg80211_scan_request *creq = NULL;
        int i, n_channels = ieee80211_get_num_supported_channels(wiphy);
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) +
                       n_channels * sizeof(void *),
@@ -1281,7 +1281,7 @@ _new_connect_scan_req(struct wiphy *wiphy, struct cfg80211_connect_params *sme)
 
        /* Scan all available channels */
        i = 0;
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                int j;
 
                if (!wiphy->bands[band])
@@ -2200,7 +2200,7 @@ int lbs_cfg_register(struct lbs_private *priv)
        if (lbs_mesh_activated(priv))
                wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MESH_POINT);
 
-       wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &lbs_band_2ghz;
+       wdev->wiphy->bands[NL80211_BAND_2GHZ] = &lbs_band_2ghz;
 
        /*
         * We could check priv->fwcapinfo && FW_CAPINFO_WPA, but I have
index 4ddd0e5..301170c 100644 (file)
@@ -743,7 +743,7 @@ int lbs_set_11d_domain_info(struct lbs_private *priv)
        struct cmd_ds_802_11d_domain_info cmd;
        struct mrvl_ie_domain_param_set *domain = &cmd.domain;
        struct ieee80211_country_ie_triplet *t;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_channel *ch;
        u8 num_triplet = 0;
        u8 num_parsed_chan = 0;
@@ -777,7 +777,7 @@ int lbs_set_11d_domain_info(struct lbs_private *priv)
         * etc.
         */
        for (band = 0;
-            (band < IEEE80211_NUM_BANDS) && (num_triplet < MAX_11D_TRIPLETS);
+            (band < NUM_NL80211_BANDS) && (num_triplet < MAX_11D_TRIPLETS);
             band++) {
 
                if (!bands[band])
index a47f0ac..0bf8916 100644 (file)
@@ -570,7 +570,7 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
        if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
                stats.flag |= RX_FLAG_FAILED_FCS_CRC;
        stats.freq = priv->cur_freq;
-       stats.band = IEEE80211_BAND_2GHZ;
+       stats.band = NL80211_BAND_2GHZ;
        stats.signal = prxpd->snr;
        priv->noise = prxpd->nf;
        /* Marvell rate index has a hole at value 4 */
@@ -642,7 +642,7 @@ struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev)
        priv->band.bitrates = priv->rates;
        priv->band.n_channels = ARRAY_SIZE(lbtf_channels);
        priv->band.channels = priv->channels;
-       hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+       hw->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
        hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_STATION) |
                BIT(NL80211_IFTYPE_ADHOC);
index 49661e0..6db202f 100644 (file)
@@ -474,7 +474,7 @@ int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
        u8 no_of_parsed_chan = 0;
        u8 first_chan = 0, next_chan = 0, max_pwr = 0;
        u8 i, flag = 0;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *ch;
        struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
@@ -1410,7 +1410,7 @@ mwifiex_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,
 {
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
        struct mwifiex_chan_stats *pchan_stats = priv->adapter->chan_stats;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        mwifiex_dbg(priv->adapter, DUMP, "dump_survey idx=%d\n", idx);
 
@@ -1586,7 +1586,7 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
 {
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
        u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct mwifiex_adapter *adapter = priv->adapter;
 
        if (!priv->media_connected) {
@@ -1600,11 +1600,11 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
        memset(bitmap_rates, 0, sizeof(bitmap_rates));
 
        /* Fill HR/DSSS rates. */
-       if (band == IEEE80211_BAND_2GHZ)
+       if (band == NL80211_BAND_2GHZ)
                bitmap_rates[0] = mask->control[band].legacy & 0x000f;
 
        /* Fill OFDM rates */
-       if (band == IEEE80211_BAND_2GHZ)
+       if (band == NL80211_BAND_2GHZ)
                bitmap_rates[1] = (mask->control[band].legacy & 0x0ff0) >> 4;
        else
                bitmap_rates[1] = mask->control[band].legacy;
@@ -1771,7 +1771,7 @@ mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
        } else {
                struct ieee80211_sta_ht_cap *ht_info;
                int rx_mcs_supp;
-               enum ieee80211_band band;
+               enum nl80211_band band;
 
                if ((tx_ant == 0x1 && rx_ant == 0x1)) {
                        adapter->user_dev_mcs_support = HT_STREAM_1X1;
@@ -1785,7 +1785,7 @@ mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
                                                MWIFIEX_11AC_MCS_MAP_2X2;
                }
 
-               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               for (band = 0; band < NUM_NL80211_BANDS; band++) {
                        if (!adapter->wiphy->bands[band])
                                continue;
 
@@ -1997,7 +1997,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
        struct cfg80211_bss *bss;
        int ie_len;
        u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)];
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        if (mwifiex_get_bss_info(priv, &bss_info))
                return -1;
@@ -2271,7 +2271,7 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv,
        int index = 0, i;
        u8 config_bands = 0;
 
-       if (params->chandef.chan->band == IEEE80211_BAND_2GHZ) {
+       if (params->chandef.chan->band == NL80211_BAND_2GHZ) {
                if (!params->basic_rates) {
                        config_bands = BAND_B | BAND_G;
                } else {
@@ -2859,18 +2859,18 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
        mwifiex_init_priv_params(priv, dev);
        priv->netdev = dev;
 
-       mwifiex_setup_ht_caps(&wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap, priv);
+       mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv);
        if (adapter->is_hw_11ac_capable)
                mwifiex_setup_vht_caps(
-                       &wiphy->bands[IEEE80211_BAND_2GHZ]->vht_cap, priv);
+                       &wiphy->bands[NL80211_BAND_2GHZ]->vht_cap, priv);
 
        if (adapter->config_bands & BAND_A)
                mwifiex_setup_ht_caps(
-                       &wiphy->bands[IEEE80211_BAND_5GHZ]->ht_cap, priv);
+                       &wiphy->bands[NL80211_BAND_5GHZ]->ht_cap, priv);
 
        if ((adapter->config_bands & BAND_A) && adapter->is_hw_11ac_capable)
                mwifiex_setup_vht_caps(
-                       &wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap, priv);
+                       &wiphy->bands[NL80211_BAND_5GHZ]->vht_cap, priv);
 
        dev_net_set(dev, wiphy_net(wiphy));
        dev->ieee80211_ptr = &priv->wdev;
@@ -3821,7 +3821,7 @@ static int mwifiex_cfg80211_get_channel(struct wiphy *wiphy,
        struct ieee80211_channel *chan;
        u8 second_chan_offset;
        enum nl80211_channel_type chan_type;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int freq;
        int ret = -ENODATA;
 
@@ -4053,11 +4053,11 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
                                 BIT(NL80211_IFTYPE_P2P_GO) |
                                 BIT(NL80211_IFTYPE_AP);
 
-       wiphy->bands[IEEE80211_BAND_2GHZ] = &mwifiex_band_2ghz;
+       wiphy->bands[NL80211_BAND_2GHZ] = &mwifiex_band_2ghz;
        if (adapter->config_bands & BAND_A)
-               wiphy->bands[IEEE80211_BAND_5GHZ] = &mwifiex_band_5ghz;
+               wiphy->bands[NL80211_BAND_5GHZ] = &mwifiex_band_5ghz;
        else
-               wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
+               wiphy->bands[NL80211_BAND_5GHZ] = NULL;
 
        if (adapter->drcs_enabled && ISSUPP_DRCS_ENABLED(adapter->fw_cap_info))
                wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta_drcs;
index 09fae27..1ff2205 100644 (file)
@@ -322,9 +322,9 @@ mwifiex_get_cfp(struct mwifiex_private *priv, u8 band, u16 channel, u32 freq)
                return cfp;
 
        if (mwifiex_band_to_radio_type(band) == HostCmd_SCAN_RADIO_TYPE_BG)
-               sband = priv->wdev.wiphy->bands[IEEE80211_BAND_2GHZ];
+               sband = priv->wdev.wiphy->bands[NL80211_BAND_2GHZ];
        else
-               sband = priv->wdev.wiphy->bands[IEEE80211_BAND_5GHZ];
+               sband = priv->wdev.wiphy->bands[NL80211_BAND_5GHZ];
 
        if (!sband) {
                mwifiex_dbg(priv->adapter, ERROR,
@@ -399,15 +399,15 @@ u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv,
        int i;
 
        if (radio_type) {
-               sband = wiphy->bands[IEEE80211_BAND_5GHZ];
+               sband = wiphy->bands[NL80211_BAND_5GHZ];
                if (WARN_ON_ONCE(!sband))
                        return 0;
-               rate_mask = request->rates[IEEE80211_BAND_5GHZ];
+               rate_mask = request->rates[NL80211_BAND_5GHZ];
        } else {
-               sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+               sband = wiphy->bands[NL80211_BAND_2GHZ];
                if (WARN_ON_ONCE(!sband))
                        return 0;
-               rate_mask = request->rates[IEEE80211_BAND_2GHZ];
+               rate_mask = request->rates[NL80211_BAND_2GHZ];
        }
 
        num_rates = 0;
index a12adee..6bc2011 100644 (file)
@@ -104,6 +104,47 @@ mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter,
        }
 }
 
+/*
+ * This function returns a command to the command free queue.
+ *
+ * The function also calls the completion callback if required, before
+ * cleaning the command node and re-inserting it into the free queue.
+ */
+static void
+mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter,
+                            struct cmd_ctrl_node *cmd_node)
+{
+       unsigned long flags;
+
+       if (!cmd_node)
+               return;
+
+       if (cmd_node->wait_q_enabled)
+               mwifiex_complete_cmd(adapter, cmd_node);
+       /* Clean the node */
+       mwifiex_clean_cmd_node(adapter, cmd_node);
+
+       /* Insert node into cmd_free_q */
+       spin_lock_irqsave(&adapter->cmd_free_q_lock, flags);
+       list_add_tail(&cmd_node->list, &adapter->cmd_free_q);
+       spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags);
+}
+
+/* This function reuses a command node. */
+void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter,
+                             struct cmd_ctrl_node *cmd_node)
+{
+       struct host_cmd_ds_command *host_cmd = (void *)cmd_node->cmd_skb->data;
+
+       mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
+
+       atomic_dec(&adapter->cmd_pending);
+       mwifiex_dbg(adapter, CMD,
+                   "cmd: FREE_CMD: cmd=%#x, cmd_pending=%d\n",
+               le16_to_cpu(host_cmd->command),
+               atomic_read(&adapter->cmd_pending));
+}
+
 /*
  * This function sends a host command to the firmware.
  *
@@ -613,47 +654,6 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
        return ret;
 }
 
-/*
- * This function returns a command to the command free queue.
- *
- * The function also calls the completion callback if required, before
- * cleaning the command node and re-inserting it into the free queue.
- */
-void
-mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter,
-                            struct cmd_ctrl_node *cmd_node)
-{
-       unsigned long flags;
-
-       if (!cmd_node)
-               return;
-
-       if (cmd_node->wait_q_enabled)
-               mwifiex_complete_cmd(adapter, cmd_node);
-       /* Clean the node */
-       mwifiex_clean_cmd_node(adapter, cmd_node);
-
-       /* Insert node into cmd_free_q */
-       spin_lock_irqsave(&adapter->cmd_free_q_lock, flags);
-       list_add_tail(&cmd_node->list, &adapter->cmd_free_q);
-       spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags);
-}
-
-/* This function reuses a command node. */
-void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter,
-                             struct cmd_ctrl_node *cmd_node)
-{
-       struct host_cmd_ds_command *host_cmd = (void *)cmd_node->cmd_skb->data;
-
-       mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
-
-       atomic_dec(&adapter->cmd_pending);
-       mwifiex_dbg(adapter, CMD,
-                   "cmd: FREE_CMD: cmd=%#x, cmd_pending=%d\n",
-               le16_to_cpu(host_cmd->command),
-               atomic_read(&adapter->cmd_pending));
-}
-
 /*
  * This function queues a command to the command pending queue.
  *
@@ -991,6 +991,23 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
                adapter->if_ops.card_reset(adapter);
 }
 
+void
+mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter)
+{
+       struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
+       unsigned long flags;
+
+       /* Cancel all pending scan command */
+       spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
+       list_for_each_entry_safe(cmd_node, tmp_node,
+                                &adapter->scan_pending_q, list) {
+               list_del(&cmd_node->list);
+               cmd_node->wait_q_enabled = false;
+               mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
+       }
+       spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
+}
+
 /*
  * This function cancels all the pending commands.
  *
@@ -1009,9 +1026,9 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
        spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
        /* Cancel current cmd */
        if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) {
-               adapter->curr_cmd->wait_q_enabled = false;
                adapter->cmd_wait_q.status = -1;
                mwifiex_complete_cmd(adapter, adapter->curr_cmd);
+               adapter->curr_cmd->wait_q_enabled = false;
                /* no recycle probably wait for response */
        }
        /* Cancel all pending command */
@@ -1029,16 +1046,7 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
        spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags);
        spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags);
 
-       /* Cancel all pending scan command */
-       spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
-       list_for_each_entry_safe(cmd_node, tmp_node,
-                                &adapter->scan_pending_q, list) {
-               list_del(&cmd_node->list);
-
-               cmd_node->wait_q_enabled = false;
-               mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
-       }
-       spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
+       mwifiex_cancel_pending_scan_cmd(adapter);
 
        if (adapter->scan_processing) {
                spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
@@ -1070,9 +1078,8 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
 void
 mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
 {
-       struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL;
+       struct cmd_ctrl_node *cmd_node = NULL;
        unsigned long cmd_flags;
-       unsigned long scan_pending_q_flags;
        struct mwifiex_private *priv;
        int i;
 
@@ -1094,17 +1101,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
                mwifiex_recycle_cmd_node(adapter, cmd_node);
        }
 
-       /* Cancel all pending scan command */
-       spin_lock_irqsave(&adapter->scan_pending_q_lock,
-                         scan_pending_q_flags);
-       list_for_each_entry_safe(cmd_node, tmp_node,
-                                &adapter->scan_pending_q, list) {
-               list_del(&cmd_node->list);
-               cmd_node->wait_q_enabled = false;
-               mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
-       }
-       spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
-                              scan_pending_q_flags);
+       mwifiex_cancel_pending_scan_cmd(adapter);
 
        if (adapter->scan_processing) {
                spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
index 04b975c..8b67a55 100644 (file)
@@ -702,6 +702,13 @@ mwifiex_close(struct net_device *dev)
                priv->scan_aborting = true;
        }
 
+       if (priv->sched_scanning) {
+               mwifiex_dbg(priv->adapter, INFO,
+                           "aborting bgscan on ndo_stop\n");
+               mwifiex_stop_bg_scan(priv);
+               cfg80211_sched_scan_stopped(priv->wdev.wiphy);
+       }
+
        return 0;
 }
 
@@ -753,13 +760,6 @@ int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb)
 
        mwifiex_queue_main_work(priv->adapter);
 
-       if (priv->sched_scanning) {
-               mwifiex_dbg(priv->adapter, INFO,
-                           "aborting bgscan on ndo_stop\n");
-               mwifiex_stop_bg_scan(priv);
-               cfg80211_sched_scan_stopped(priv->wdev.wiphy);
-       }
-
        return 0;
 }
 
@@ -1434,7 +1434,7 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
        struct mwifiex_private *priv = NULL;
        int i;
 
-       if (down_interruptible(sem))
+       if (down_trylock(sem))
                goto exit_sem_err;
 
        if (!adapter)
index a159fbe..4c742a5 100644 (file)
 #include <linux/idr.h>
 #include <linux/inetdevice.h>
 #include <linux/devcoredump.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/gfp.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/of_gpio.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/slab.h>
+#include <linux/of_irq.h>
 
 #include "decl.h"
 #include "ioctl.h"
@@ -1042,9 +1053,8 @@ int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter);
 int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter);
 void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter);
 void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter);
+void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter);
 
-void mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter,
-                                 struct cmd_ctrl_node *cmd_node);
 void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter,
                              struct cmd_ctrl_node *cmd_node);
 
index edf8b07..0c7937e 100644 (file)
@@ -2811,6 +2811,7 @@ static int mwifiex_pcie_request_irq(struct mwifiex_adapter *adapter)
 static void mwifiex_pcie_get_fw_name(struct mwifiex_adapter *adapter)
 {
        int revision_id = 0;
+       int version;
        struct pcie_service_card *card = adapter->card;
 
        switch (card->dev->device) {
@@ -2829,18 +2830,34 @@ static void mwifiex_pcie_get_fw_name(struct mwifiex_adapter *adapter)
                        strcpy(adapter->fw_name, PCIE8897_B0_FW_NAME);
                        break;
                default:
+                       strcpy(adapter->fw_name, PCIE8897_DEFAULT_FW_NAME);
+
                        break;
                }
+               break;
        case PCIE_DEVICE_ID_MARVELL_88W8997:
                mwifiex_read_reg(adapter, 0x0c48, &revision_id);
+               mwifiex_read_reg(adapter, 0x0cd0, &version);
+               version &= 0x7;
                switch (revision_id) {
                case PCIE8997_V2:
-                       strcpy(adapter->fw_name, PCIE8997_FW_NAME_V2);
+                       if (version == CHIP_VER_PCIEUSB)
+                               strcpy(adapter->fw_name,
+                                      PCIEUSB8997_FW_NAME_V2);
+                       else
+                               strcpy(adapter->fw_name,
+                                      PCIEUART8997_FW_NAME_V2);
                        break;
                case PCIE8997_Z:
-                       strcpy(adapter->fw_name, PCIE8997_FW_NAME_Z);
+                       if (version == CHIP_VER_PCIEUSB)
+                               strcpy(adapter->fw_name,
+                                      PCIEUSB8997_FW_NAME_Z);
+                       else
+                               strcpy(adapter->fw_name,
+                                      PCIEUART8997_FW_NAME_Z);
                        break;
                default:
+                       strcpy(adapter->fw_name, PCIE8997_DEFAULT_FW_NAME);
                        break;
                }
        default:
index cc7a5df..5770b43 100644 (file)
 #include    "main.h"
 
 #define PCIE8766_DEFAULT_FW_NAME "mrvl/pcie8766_uapsta.bin"
+#define PCIE8897_DEFAULT_FW_NAME "mrvl/pcie8897_uapsta.bin"
 #define PCIE8897_A0_FW_NAME "mrvl/pcie8897_uapsta_a0.bin"
 #define PCIE8897_B0_FW_NAME "mrvl/pcie8897_uapsta.bin"
-#define PCIE8997_FW_NAME_Z "mrvl/pcieusb8997_combo.bin"
-#define PCIE8997_FW_NAME_V2 "mrvl/pcieusb8997_combo_v2.bin"
+#define PCIE8997_DEFAULT_FW_NAME "mrvl/pcieuart8997_combo_v2.bin"
+#define PCIEUART8997_FW_NAME_Z "mrvl/pcieuart8997_combo.bin"
+#define PCIEUART8997_FW_NAME_V2 "mrvl/pcieuart8997_combo_v2.bin"
+#define PCIEUSB8997_FW_NAME_Z "mrvl/pcieusb8997_combo.bin"
+#define PCIEUSB8997_FW_NAME_V2 "mrvl/pcieusb8997_combo_v2.bin"
 
 #define PCIE_VENDOR_ID_MARVELL              (0x11ab)
 #define PCIE_VENDOR_ID_V2_MARVELL           (0x1b4b)
@@ -45,6 +49,7 @@
 #define PCIE8897_B0    0x1200
 #define PCIE8997_Z     0x0
 #define PCIE8997_V2    0x471
+#define CHIP_VER_PCIEUSB       0x2
 
 /* Constants for Buffer Descriptor (BD) rings */
 #define MWIFIEX_MAX_TXRX_BD                    0x20
index 489f7a9..36cc9cc 100644 (file)
@@ -76,6 +76,39 @@ static u8 mwifiex_rsn_oui[CIPHER_SUITE_MAX][4] = {
        { 0x00, 0x0f, 0xac, 0x04 },     /* AES  */
 };
 
+static void
+_dbg_security_flags(int log_level, const char *func, const char *desc,
+                   struct mwifiex_private *priv,
+                   struct mwifiex_bssdescriptor *bss_desc)
+{
+       _mwifiex_dbg(priv->adapter, log_level,
+                    "info: %s: %s:\twpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\tEncMode=%#x privacy=%#x\n",
+                    func, desc,
+                    bss_desc->bcn_wpa_ie ?
+                    bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0,
+                    bss_desc->bcn_rsn_ie ?
+                    bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0,
+                    priv->sec_info.wep_enabled ? "e" : "d",
+                    priv->sec_info.wpa_enabled ? "e" : "d",
+                    priv->sec_info.wpa2_enabled ? "e" : "d",
+                    priv->sec_info.encryption_mode,
+                    bss_desc->privacy);
+}
+#define dbg_security_flags(mask, desc, priv, bss_desc) \
+       _dbg_security_flags(MWIFIEX_DBG_##mask, desc, __func__, priv, bss_desc)
+
+static bool
+has_ieee_hdr(struct ieee_types_generic *ie, u8 key)
+{
+       return (ie && ie->ieee_hdr.element_id == key);
+}
+
+static bool
+has_vendor_hdr(struct ieee_types_vendor_specific *ie, u8 key)
+{
+       return (ie && ie->vend_hdr.element_id == key);
+}
+
 /*
  * This function parses a given IE for a given OUI.
  *
@@ -121,8 +154,7 @@ mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
        struct ie_body *iebody;
        u8 ret = MWIFIEX_OUI_NOT_PRESENT;
 
-       if (((bss_desc->bcn_rsn_ie) && ((*(bss_desc->bcn_rsn_ie)).
-                                       ieee_hdr.element_id == WLAN_EID_RSN))) {
+       if (has_ieee_hdr(bss_desc->bcn_rsn_ie, WLAN_EID_RSN)) {
                iebody = (struct ie_body *)
                         (((u8 *) bss_desc->bcn_rsn_ie->data) +
                          RSN_GTK_OUI_OFFSET);
@@ -148,9 +180,7 @@ mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
        struct ie_body *iebody;
        u8 ret = MWIFIEX_OUI_NOT_PRESENT;
 
-       if (((bss_desc->bcn_wpa_ie) &&
-            ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id ==
-             WLAN_EID_VENDOR_SPECIFIC))) {
+       if (has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC)) {
                iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data;
                oui = &mwifiex_wpa_oui[cipher][0];
                ret = mwifiex_search_oui_in_ie(iebody, oui);
@@ -180,11 +210,8 @@ mwifiex_is_bss_wapi(struct mwifiex_private *priv,
                    struct mwifiex_bssdescriptor *bss_desc)
 {
        if (priv->sec_info.wapi_enabled &&
-           (bss_desc->bcn_wapi_ie &&
-            ((*(bss_desc->bcn_wapi_ie)).ieee_hdr.element_id ==
-                       WLAN_EID_BSS_AC_ACCESS_DELAY))) {
+           has_ieee_hdr(bss_desc->bcn_wapi_ie, WLAN_EID_BSS_AC_ACCESS_DELAY))
                return true;
-       }
        return false;
 }
 
@@ -197,12 +224,9 @@ mwifiex_is_bss_no_sec(struct mwifiex_private *priv,
                      struct mwifiex_bssdescriptor *bss_desc)
 {
        if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
-           !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) ||
-               ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id !=
-                WLAN_EID_VENDOR_SPECIFIC)) &&
-           ((!bss_desc->bcn_rsn_ie) ||
-               ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id !=
-                WLAN_EID_RSN)) &&
+           !priv->sec_info.wpa2_enabled &&
+           !has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC) &&
+           !has_ieee_hdr(bss_desc->bcn_rsn_ie, WLAN_EID_RSN) &&
            !priv->sec_info.encryption_mode && !bss_desc->privacy) {
                return true;
        }
@@ -233,29 +257,14 @@ mwifiex_is_bss_wpa(struct mwifiex_private *priv,
                   struct mwifiex_bssdescriptor *bss_desc)
 {
        if (!priv->sec_info.wep_enabled && priv->sec_info.wpa_enabled &&
-           !priv->sec_info.wpa2_enabled && ((bss_desc->bcn_wpa_ie) &&
-           ((*(bss_desc->bcn_wpa_ie)).
-            vend_hdr.element_id == WLAN_EID_VENDOR_SPECIFIC))
+           !priv->sec_info.wpa2_enabled &&
+           has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC)
           /*
            * Privacy bit may NOT be set in some APs like
            * LinkSys WRT54G && bss_desc->privacy
            */
         ) {
-               mwifiex_dbg(priv->adapter, INFO,
-                           "info: %s: WPA:\t"
-                           "wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\t"
-                           "EncMode=%#x privacy=%#x\n", __func__,
-                           (bss_desc->bcn_wpa_ie) ?
-                           (*bss_desc->bcn_wpa_ie).
-                           vend_hdr.element_id : 0,
-                           (bss_desc->bcn_rsn_ie) ?
-                           (*bss_desc->bcn_rsn_ie).
-                           ieee_hdr.element_id : 0,
-                           (priv->sec_info.wep_enabled) ? "e" : "d",
-                           (priv->sec_info.wpa_enabled) ? "e" : "d",
-                           (priv->sec_info.wpa2_enabled) ? "e" : "d",
-                           priv->sec_info.encryption_mode,
-                           bss_desc->privacy);
+               dbg_security_flags(INFO, "WPA", priv, bss_desc);
                return true;
        }
        return false;
@@ -269,30 +278,14 @@ static bool
 mwifiex_is_bss_wpa2(struct mwifiex_private *priv,
                    struct mwifiex_bssdescriptor *bss_desc)
 {
-       if (!priv->sec_info.wep_enabled &&
-           !priv->sec_info.wpa_enabled &&
+       if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
            priv->sec_info.wpa2_enabled &&
-           ((bss_desc->bcn_rsn_ie) &&
-            ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id == WLAN_EID_RSN))) {
+           has_ieee_hdr(bss_desc->bcn_rsn_ie, WLAN_EID_RSN)) {
                /*
                 * Privacy bit may NOT be set in some APs like
                 * LinkSys WRT54G && bss_desc->privacy
                 */
-               mwifiex_dbg(priv->adapter, INFO,
-                           "info: %s: WPA2:\t"
-                           "wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\t"
-                           "EncMode=%#x privacy=%#x\n", __func__,
-                           (bss_desc->bcn_wpa_ie) ?
-                           (*bss_desc->bcn_wpa_ie).
-                           vend_hdr.element_id : 0,
-                           (bss_desc->bcn_rsn_ie) ?
-                           (*bss_desc->bcn_rsn_ie).
-                           ieee_hdr.element_id : 0,
-                           (priv->sec_info.wep_enabled) ? "e" : "d",
-                           (priv->sec_info.wpa_enabled) ? "e" : "d",
-                           (priv->sec_info.wpa2_enabled) ? "e" : "d",
-                           priv->sec_info.encryption_mode,
-                           bss_desc->privacy);
+               dbg_security_flags(INFO, "WAP2", priv, bss_desc);
                return true;
        }
        return false;
@@ -308,11 +301,8 @@ mwifiex_is_bss_adhoc_aes(struct mwifiex_private *priv,
 {
        if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
            !priv->sec_info.wpa2_enabled &&
-           ((!bss_desc->bcn_wpa_ie) ||
-            ((*(bss_desc->bcn_wpa_ie)).
-             vend_hdr.element_id != WLAN_EID_VENDOR_SPECIFIC)) &&
-           ((!bss_desc->bcn_rsn_ie) ||
-            ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) &&
+           !has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC) &&
+           !has_ieee_hdr(bss_desc->bcn_rsn_ie, WLAN_EID_RSN) &&
            !priv->sec_info.encryption_mode && bss_desc->privacy) {
                return true;
        }
@@ -329,25 +319,10 @@ mwifiex_is_bss_dynamic_wep(struct mwifiex_private *priv,
 {
        if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
            !priv->sec_info.wpa2_enabled &&
-           ((!bss_desc->bcn_wpa_ie) ||
-            ((*(bss_desc->bcn_wpa_ie)).
-             vend_hdr.element_id != WLAN_EID_VENDOR_SPECIFIC)) &&
-           ((!bss_desc->bcn_rsn_ie) ||
-            ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) &&
+           !has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC) &&
+           !has_ieee_hdr(bss_desc->bcn_rsn_ie, WLAN_EID_RSN) &&
            priv->sec_info.encryption_mode && bss_desc->privacy) {
-               mwifiex_dbg(priv->adapter, INFO,
-                           "info: %s: dynamic\t"
-                           "WEP: wpa_ie=%#x wpa2_ie=%#x\t"
-                           "EncMode=%#x privacy=%#x\n",
-                           __func__,
-                           (bss_desc->bcn_wpa_ie) ?
-                           (*bss_desc->bcn_wpa_ie).
-                           vend_hdr.element_id : 0,
-                           (bss_desc->bcn_rsn_ie) ?
-                           (*bss_desc->bcn_rsn_ie).
-                           ieee_hdr.element_id : 0,
-                           priv->sec_info.encryption_mode,
-                           bss_desc->privacy);
+               dbg_security_flags(INFO, "dynamic", priv, bss_desc);
                return true;
        }
        return false;
@@ -460,18 +435,7 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
                }
 
                /* Security doesn't match */
-               mwifiex_dbg(adapter, ERROR,
-                           "info: %s: failed: wpa_ie=%#x wpa2_ie=%#x WEP=%s\t"
-                           "WPA=%s WPA2=%s EncMode=%#x privacy=%#x\n",
-                           __func__,
-                           (bss_desc->bcn_wpa_ie) ?
-                           (*bss_desc->bcn_wpa_ie).vend_hdr.element_id : 0,
-                           (bss_desc->bcn_rsn_ie) ?
-                           (*bss_desc->bcn_rsn_ie).ieee_hdr.element_id : 0,
-                           (priv->sec_info.wep_enabled) ? "e" : "d",
-                           (priv->sec_info.wpa_enabled) ? "e" : "d",
-                           (priv->sec_info.wpa2_enabled) ? "e" : "d",
-                           priv->sec_info.encryption_mode, bss_desc->privacy);
+               dbg_security_flags(ERROR, "failed", priv, bss_desc);
                return -1;
        }
 
@@ -494,13 +458,13 @@ mwifiex_scan_create_channel_list(struct mwifiex_private *priv,
                                                        *scan_chan_list,
                                 u8 filtered_scan)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *ch;
        struct mwifiex_adapter *adapter = priv->adapter;
        int chan_idx = 0, i;
 
-       for (band = 0; (band < IEEE80211_NUM_BANDS) ; band++) {
+       for (band = 0; (band < NUM_NL80211_BANDS) ; band++) {
 
                if (!priv->wdev.wiphy->bands[band])
                        continue;
@@ -557,13 +521,13 @@ mwifiex_bgscan_create_channel_list(struct mwifiex_private *priv,
                                   struct mwifiex_chan_scan_param_set
                                                *scan_chan_list)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *ch;
        struct mwifiex_adapter *adapter = priv->adapter;
        int chan_idx = 0, i;
 
-       for (band = 0; (band < IEEE80211_NUM_BANDS); band++) {
+       for (band = 0; (band < NUM_NL80211_BANDS); band++) {
                if (!priv->wdev.wiphy->bands[band])
                        continue;
 
@@ -655,8 +619,6 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
        int ret = 0;
        struct mwifiex_chan_scan_param_set *tmp_chan_list;
        struct mwifiex_chan_scan_param_set *start_chan;
-       struct cmd_ctrl_node *cmd_node, *tmp_node;
-       unsigned long flags;
        u32 tlv_idx, rates_size, cmd_no;
        u32 total_scan_time;
        u32 done_early;
@@ -813,16 +775,7 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
                            sizeof(struct mwifiex_ie_types_header) + rates_size;
 
                if (ret) {
-                       spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
-                       list_for_each_entry_safe(cmd_node, tmp_node,
-                                                &adapter->scan_pending_q,
-                                                list) {
-                               list_del(&cmd_node->list);
-                               cmd_node->wait_q_enabled = false;
-                               mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
-                       }
-                       spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
-                                              flags);
+                       mwifiex_cancel_pending_scan_cmd(adapter);
                        break;
                }
        }
@@ -912,14 +865,11 @@ mwifiex_config_scan(struct mwifiex_private *priv,
                /* Set the BSS type scan filter, use Adapter setting if
                   unset */
                scan_cfg_out->bss_mode =
-                       (user_scan_in->bss_mode ? (u8) user_scan_in->
-                        bss_mode : (u8) adapter->scan_mode);
+                       (u8)(user_scan_in->bss_mode ?: adapter->scan_mode);
 
                /* Set the number of probes to send, use Adapter setting
                   if unset */
-               num_probes =
-                       (user_scan_in->num_probes ? user_scan_in->
-                        num_probes : adapter->scan_probes);
+               num_probes = user_scan_in->num_probes ?: adapter->scan_probes;
 
                /*
                 * Set the BSSID filter to the incoming configuration,
@@ -1094,27 +1044,24 @@ mwifiex_config_scan(struct mwifiex_private *priv,
                     chan_idx++) {
 
                        channel = user_scan_in->chan_list[chan_idx].chan_number;
-                       (scan_chan_list + chan_idx)->chan_number = channel;
+                       scan_chan_list[chan_idx].chan_number = channel;
 
                        radio_type =
                                user_scan_in->chan_list[chan_idx].radio_type;
-                       (scan_chan_list + chan_idx)->radio_type = radio_type;
+                       scan_chan_list[chan_idx].radio_type = radio_type;
 
                        scan_type = user_scan_in->chan_list[chan_idx].scan_type;
 
                        if (scan_type == MWIFIEX_SCAN_TYPE_PASSIVE)
-                               (scan_chan_list +
-                                chan_idx)->chan_scan_mode_bitmap
+                               scan_chan_list[chan_idx].chan_scan_mode_bitmap
                                        |= (MWIFIEX_PASSIVE_SCAN |
                                            MWIFIEX_HIDDEN_SSID_REPORT);
                        else
-                               (scan_chan_list +
-                                chan_idx)->chan_scan_mode_bitmap
+                               scan_chan_list[chan_idx].chan_scan_mode_bitmap
                                        &= ~MWIFIEX_PASSIVE_SCAN;
 
                        if (*filtered_scan)
-                               (scan_chan_list +
-                                chan_idx)->chan_scan_mode_bitmap
+                               scan_chan_list[chan_idx].chan_scan_mode_bitmap
                                        |= MWIFIEX_DISABLE_CHAN_FILT;
 
                        if (user_scan_in->chan_list[chan_idx].scan_time) {
@@ -1129,9 +1076,9 @@ mwifiex_config_scan(struct mwifiex_private *priv,
                                        scan_dur = adapter->active_scan_time;
                        }
 
-                       (scan_chan_list + chan_idx)->min_scan_time =
+                       scan_chan_list[chan_idx].min_scan_time =
                                cpu_to_le16(scan_dur);
-                       (scan_chan_list + chan_idx)->max_scan_time =
+                       scan_chan_list[chan_idx].max_scan_time =
                                cpu_to_le16(scan_dur);
                }
 
@@ -1991,12 +1938,13 @@ mwifiex_active_scan_req_for_passive_chan(struct mwifiex_private *priv)
 static void mwifiex_check_next_scan_command(struct mwifiex_private *priv)
 {
        struct mwifiex_adapter *adapter = priv->adapter;
-       struct cmd_ctrl_node *cmd_node, *tmp_node;
+       struct cmd_ctrl_node *cmd_node;
        unsigned long flags;
 
        spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
        if (list_empty(&adapter->scan_pending_q)) {
                spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
+
                spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
                adapter->scan_processing = false;
                spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
@@ -2018,13 +1966,10 @@ static void mwifiex_check_next_scan_command(struct mwifiex_private *priv)
                }
        } else if ((priv->scan_aborting && !priv->scan_request) ||
                   priv->scan_block) {
-               list_for_each_entry_safe(cmd_node, tmp_node,
-                                        &adapter->scan_pending_q, list) {
-                       list_del(&cmd_node->list);
-                       mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
-               }
                spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
 
+               mwifiex_cancel_pending_scan_cmd(adapter);
+
                spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
                adapter->scan_processing = false;
                spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
index a0aec3e..cbd9dcd 100644 (file)
@@ -73,6 +73,66 @@ static struct memory_type_mapping mem_type_mapping_tbl[] = {
        {"EXTLAST", NULL, 0, 0xFE},
 };
 
+static const struct of_device_id mwifiex_sdio_of_match_table[] = {
+       { .compatible = "marvell,sd8897" },
+       { .compatible = "marvell,sd8997" },
+       { }
+};
+
+static irqreturn_t mwifiex_wake_irq_wifi(int irq, void *priv)
+{
+       struct mwifiex_plt_wake_cfg *cfg = priv;
+
+       if (cfg->irq_wifi >= 0) {
+               pr_info("%s: wake by wifi", __func__);
+               cfg->wake_by_wifi = true;
+               disable_irq_nosync(irq);
+       }
+
+       return IRQ_HANDLED;
+}
+
+/* This function parse device tree node using mmc subnode devicetree API.
+ * The device node is saved in card->plt_of_node.
+ * if the device tree node exist and include interrupts attributes, this
+ * function will also request platform specific wakeup interrupt.
+ */
+static int mwifiex_sdio_probe_of(struct device *dev, struct sdio_mmc_card *card)
+{
+       struct mwifiex_plt_wake_cfg *cfg;
+       int ret;
+
+       if (!dev->of_node ||
+           !of_match_node(mwifiex_sdio_of_match_table, dev->of_node)) {
+               pr_err("sdio platform data not available");
+               return -1;
+       }
+
+       card->plt_of_node = dev->of_node;
+       card->plt_wake_cfg = devm_kzalloc(dev, sizeof(*card->plt_wake_cfg),
+                                         GFP_KERNEL);
+       cfg = card->plt_wake_cfg;
+       if (cfg && card->plt_of_node) {
+               cfg->irq_wifi = irq_of_parse_and_map(card->plt_of_node, 0);
+               if (!cfg->irq_wifi) {
+                       dev_err(dev, "fail to parse irq_wifi from device tree");
+               } else {
+                       ret = devm_request_irq(dev, cfg->irq_wifi,
+                                              mwifiex_wake_irq_wifi,
+                                              IRQF_TRIGGER_LOW,
+                                              "wifi_wake", cfg);
+                       if (ret) {
+                               dev_err(dev,
+                                       "Failed to request irq_wifi %d (%d)\n",
+                                       cfg->irq_wifi, ret);
+                       }
+                       disable_irq(cfg->irq_wifi);
+               }
+       }
+
+       return 0;
+}
+
 /*
  * SDIO probe.
  *
@@ -127,6 +187,9 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
                return -EIO;
        }
 
+       /* device tree node parsing and platform specific configuration*/
+       mwifiex_sdio_probe_of(&func->dev, card);
+
        if (mwifiex_add_card(card, &add_remove_card_sem, &sdio_ops,
                             MWIFIEX_SDIO)) {
                pr_err("%s: add card failed\n", __func__);
@@ -183,6 +246,13 @@ static int mwifiex_sdio_resume(struct device *dev)
        mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
                          MWIFIEX_SYNC_CMD);
 
+       /* Disable platform specific wakeup interrupt */
+       if (card->plt_wake_cfg && card->plt_wake_cfg->irq_wifi >= 0) {
+               disable_irq_wake(card->plt_wake_cfg->irq_wifi);
+               if (!card->plt_wake_cfg->wake_by_wifi)
+                       disable_irq(card->plt_wake_cfg->irq_wifi);
+       }
+
        return 0;
 }
 
@@ -262,6 +332,13 @@ static int mwifiex_sdio_suspend(struct device *dev)
 
        adapter = card->adapter;
 
+       /* Enable platform specific wakeup interrupt */
+       if (card->plt_wake_cfg && card->plt_wake_cfg->irq_wifi >= 0) {
+               card->plt_wake_cfg->wake_by_wifi = false;
+               enable_irq(card->plt_wake_cfg->irq_wifi);
+               enable_irq_wake(card->plt_wake_cfg->irq_wifi);
+       }
+
        /* Enable the Host Sleep */
        if (!mwifiex_enable_hs(adapter)) {
                mwifiex_dbg(adapter, ERROR,
index b9fbc5c..db837f1 100644 (file)
        a->mpa_rx.start_port = 0;                                       \
 } while (0)
 
+struct mwifiex_plt_wake_cfg {
+       int irq_wifi;
+       bool wake_by_wifi;
+};
+
 /* data structure for SDIO MPA TX */
 struct mwifiex_sdio_mpa_tx {
        /* multiport tx aggregation buffer pointer */
@@ -237,6 +242,8 @@ struct mwifiex_sdio_card_reg {
 struct sdio_mmc_card {
        struct sdio_func *func;
        struct mwifiex_adapter *adapter;
+       struct device_node *plt_of_node;
+       struct mwifiex_plt_wake_cfg *plt_wake_cfg;
 
        const char *firmware;
        const struct mwifiex_sdio_card_reg *reg;
index 8cb895b..e436574 100644 (file)
@@ -2162,6 +2162,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
        enum state_11d_t state_11d;
        struct mwifiex_ds_11n_tx_cfg tx_cfg;
        u8 sdio_sp_rx_aggr_enable;
+       int data;
 
        if (first_sta) {
                if (priv->adapter->iface_type == MWIFIEX_PCIE) {
@@ -2182,9 +2183,16 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
                 * The cal-data can be read from device tree and/or
                 * a configuration file and downloaded to firmware.
                 */
-               adapter->dt_node =
-                               of_find_node_by_name(NULL, "marvell_cfgdata");
-               if (adapter->dt_node) {
+               if (priv->adapter->iface_type == MWIFIEX_SDIO &&
+                   adapter->dev->of_node) {
+                       adapter->dt_node = adapter->dev->of_node;
+                       if (of_property_read_u32(adapter->dt_node,
+                                                "marvell,wakeup-pin",
+                                                &data) == 0) {
+                               pr_debug("Wakeup pin = 0x%x\n", data);
+                               adapter->hs_cfg.gpio = data;
+                       }
+
                        ret = mwifiex_dnld_dt_cfgdata(priv, adapter->dt_node,
                                                      "marvell,caldata");
                        if (ret)
index 434b977..d18c797 100644 (file)
@@ -44,7 +44,6 @@ static void
 mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
                              struct host_cmd_ds_command *resp)
 {
-       struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
        struct mwifiex_adapter *adapter = priv->adapter;
        struct host_cmd_ds_802_11_ps_mode_enh *pm;
        unsigned long flags;
@@ -71,17 +70,7 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
                break;
        case HostCmd_CMD_802_11_SCAN:
        case HostCmd_CMD_802_11_SCAN_EXT:
-               /* Cancel all pending scan command */
-               spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
-               list_for_each_entry_safe(cmd_node, tmp_node,
-                                        &adapter->scan_pending_q, list) {
-                       list_del(&cmd_node->list);
-                       spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
-                                              flags);
-                       mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
-                       spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
-               }
-               spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
+               mwifiex_cancel_pending_scan_cmd(adapter);
 
                spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
                adapter->scan_processing = false;
index d8de432..8e08626 100644 (file)
@@ -146,6 +146,7 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
        size_t beacon_ie_len;
        struct mwifiex_bss_priv *bss_priv = (void *)bss->priv;
        const struct cfg80211_bss_ies *ies;
+       int ret;
 
        rcu_read_lock();
        ies = rcu_dereference(bss->ies);
@@ -189,7 +190,48 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
        if (bss_desc->cap_info_bitmap & WLAN_CAPABILITY_SPECTRUM_MGMT)
                bss_desc->sensed_11h = true;
 
-       return mwifiex_update_bss_desc_with_ie(priv->adapter, bss_desc);
+       ret = mwifiex_update_bss_desc_with_ie(priv->adapter, bss_desc);
+       if (ret)
+               return ret;
+
+       /* Update HT40 capability based on current channel information */
+       if (bss_desc->bcn_ht_oper && bss_desc->bcn_ht_cap) {
+               u8 ht_param = bss_desc->bcn_ht_oper->ht_param;
+               u8 radio = mwifiex_band_to_radio_type(bss_desc->bss_band);
+               struct ieee80211_supported_band *sband =
+                                               priv->wdev.wiphy->bands[radio];
+               int freq = ieee80211_channel_to_frequency(bss_desc->channel,
+                                                         radio);
+               struct ieee80211_channel *chan =
+                       ieee80211_get_channel(priv->adapter->wiphy, freq);
+
+               switch (ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
+               case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
+                       if (chan->flags & IEEE80211_CHAN_NO_HT40PLUS) {
+                               sband->ht_cap.cap &=
+                                       ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+                               sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40;
+                       } else {
+                               sband->ht_cap.cap |=
+                                       IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
+                                       IEEE80211_HT_CAP_SGI_40;
+                       }
+                       break;
+               case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
+                       if (chan->flags & IEEE80211_CHAN_NO_HT40MINUS) {
+                               sband->ht_cap.cap &=
+                                       ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+                               sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40;
+                       } else {
+                               sband->ht_cap.cap |=
+                                       IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
+                                       IEEE80211_HT_CAP_SGI_40;
+                       }
+                       break;
+               }
+       }
+
+       return 0;
 }
 
 void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv)
index 92ce32f..f79d00d 100644 (file)
@@ -816,7 +816,7 @@ void mwifiex_uap_set_channel(struct mwifiex_private *priv,
                                                     chandef.chan->center_freq);
 
        /* Set appropriate bands */
-       if (chandef.chan->band == IEEE80211_BAND_2GHZ) {
+       if (chandef.chan->band == NL80211_BAND_2GHZ) {
                bss_cfg->band_cfg = BAND_CONFIG_BG;
                config_bands = BAND_B | BAND_G;
 
index 0510861..0857575 100644 (file)
@@ -995,7 +995,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
 {
        int ret = 0;
        u8 *firmware = fw->fw_buf, *recv_buff;
-       u32 retries = USB8XXX_FW_MAX_RETRY, dlen;
+       u32 retries = USB8XXX_FW_MAX_RETRY + 1;
+       u32 dlen;
        u32 fw_seqnum = 0, tlen = 0, dnld_cmd = 0;
        struct fw_data *fwdata;
        struct fw_sync_header sync_fw;
@@ -1017,8 +1018,10 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
 
        /* Allocate memory for receive */
        recv_buff = kzalloc(FW_DNLD_RX_BUF_SIZE, GFP_KERNEL);
-       if (!recv_buff)
+       if (!recv_buff) {
+               ret = -ENOMEM;
                goto cleanup;
+       }
 
        do {
                /* Send pseudo data to check winner status first */
@@ -1041,7 +1044,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
                }
 
                /* If the send/receive fails or CRC occurs then retry */
-               while (retries--) {
+               while (--retries) {
                        u8 *buf = (u8 *)fwdata;
                        u32 len = FW_DATA_XMIT_SIZE;
 
@@ -1101,7 +1104,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
                                continue;
                        }
 
-                       retries = USB8XXX_FW_MAX_RETRY;
+                       retries = USB8XXX_FW_MAX_RETRY + 1;
                        break;
                }
                fw_seqnum++;
index 088429d..b1b400b 100644 (file)
@@ -346,20 +346,20 @@ struct mwl8k_sta {
 #define MWL8K_STA(_sta) ((struct mwl8k_sta *)&((_sta)->drv_priv))
 
 static const struct ieee80211_channel mwl8k_channels_24[] = {
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, },
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, },
 };
 
 static const struct ieee80211_rate mwl8k_rates_24[] = {
@@ -379,10 +379,10 @@ static const struct ieee80211_rate mwl8k_rates_24[] = {
 };
 
 static const struct ieee80211_channel mwl8k_channels_50[] = {
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, },
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, },
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, },
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, },
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, },
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, },
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, },
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, },
 };
 
 static const struct ieee80211_rate mwl8k_rates_50[] = {
@@ -1010,11 +1010,11 @@ mwl8k_rxd_ap_process(void *_rxd, struct ieee80211_rx_status *status,
        }
 
        if (rxd->channel > 14) {
-               status->band = IEEE80211_BAND_5GHZ;
+               status->band = NL80211_BAND_5GHZ;
                if (!(status->flag & RX_FLAG_HT))
                        status->rate_idx -= 5;
        } else {
-               status->band = IEEE80211_BAND_2GHZ;
+               status->band = NL80211_BAND_2GHZ;
        }
        status->freq = ieee80211_channel_to_frequency(rxd->channel,
                                                      status->band);
@@ -1118,11 +1118,11 @@ mwl8k_rxd_sta_process(void *_rxd, struct ieee80211_rx_status *status,
                status->flag |= RX_FLAG_HT;
 
        if (rxd->channel > 14) {
-               status->band = IEEE80211_BAND_5GHZ;
+               status->band = NL80211_BAND_5GHZ;
                if (!(status->flag & RX_FLAG_HT))
                        status->rate_idx -= 5;
        } else {
-               status->band = IEEE80211_BAND_2GHZ;
+               status->band = NL80211_BAND_2GHZ;
        }
        status->freq = ieee80211_channel_to_frequency(rxd->channel,
                                                      status->band);
@@ -2300,13 +2300,13 @@ static void mwl8k_setup_2ghz_band(struct ieee80211_hw *hw)
        BUILD_BUG_ON(sizeof(priv->rates_24) != sizeof(mwl8k_rates_24));
        memcpy(priv->rates_24, mwl8k_rates_24, sizeof(mwl8k_rates_24));
 
-       priv->band_24.band = IEEE80211_BAND_2GHZ;
+       priv->band_24.band = NL80211_BAND_2GHZ;
        priv->band_24.channels = priv->channels_24;
        priv->band_24.n_channels = ARRAY_SIZE(mwl8k_channels_24);
        priv->band_24.bitrates = priv->rates_24;
        priv->band_24.n_bitrates = ARRAY_SIZE(mwl8k_rates_24);
 
-       hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band_24;
+       hw->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band_24;
 }
 
 static void mwl8k_setup_5ghz_band(struct ieee80211_hw *hw)
@@ -2319,13 +2319,13 @@ static void mwl8k_setup_5ghz_band(struct ieee80211_hw *hw)
        BUILD_BUG_ON(sizeof(priv->rates_50) != sizeof(mwl8k_rates_50));
        memcpy(priv->rates_50, mwl8k_rates_50, sizeof(mwl8k_rates_50));
 
-       priv->band_50.band = IEEE80211_BAND_5GHZ;
+       priv->band_50.band = NL80211_BAND_5GHZ;
        priv->band_50.channels = priv->channels_50;
        priv->band_50.n_channels = ARRAY_SIZE(mwl8k_channels_50);
        priv->band_50.bitrates = priv->rates_50;
        priv->band_50.n_bitrates = ARRAY_SIZE(mwl8k_rates_50);
 
-       hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->band_50;
+       hw->wiphy->bands[NL80211_BAND_5GHZ] = &priv->band_50;
 }
 
 /*
@@ -2876,9 +2876,9 @@ static int mwl8k_cmd_tx_power(struct ieee80211_hw *hw,
        cmd->header.length = cpu_to_le16(sizeof(*cmd));
        cmd->action = cpu_to_le16(MWL8K_CMD_SET_LIST);
 
-       if (channel->band == IEEE80211_BAND_2GHZ)
+       if (channel->band == NL80211_BAND_2GHZ)
                cmd->band = cpu_to_le16(0x1);
-       else if (channel->band == IEEE80211_BAND_5GHZ)
+       else if (channel->band == NL80211_BAND_5GHZ)
                cmd->band = cpu_to_le16(0x4);
 
        cmd->channel = cpu_to_le16(channel->hw_value);
@@ -3067,7 +3067,7 @@ static int freq_to_idx(struct mwl8k_priv *priv, int freq)
        struct ieee80211_supported_band *sband;
        int band, ch, idx = 0;
 
-       for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
                sband = priv->hw->wiphy->bands[band];
                if (!sband)
                        continue;
@@ -3149,9 +3149,9 @@ static int mwl8k_cmd_set_rf_channel(struct ieee80211_hw *hw,
        cmd->action = cpu_to_le16(MWL8K_CMD_SET);
        cmd->current_channel = channel->hw_value;
 
-       if (channel->band == IEEE80211_BAND_2GHZ)
+       if (channel->band == NL80211_BAND_2GHZ)
                cmd->channel_flags |= cpu_to_le32(0x00000001);
-       else if (channel->band == IEEE80211_BAND_5GHZ)
+       else if (channel->band == NL80211_BAND_5GHZ)
                cmd->channel_flags |= cpu_to_le32(0x00000004);
 
        if (!priv->sw_scan_start) {
@@ -4094,10 +4094,10 @@ static int mwl8k_cmd_set_new_stn_add(struct ieee80211_hw *hw,
        memcpy(cmd->mac_addr, sta->addr, ETH_ALEN);
        cmd->stn_id = cpu_to_le16(sta->aid);
        cmd->action = cpu_to_le16(MWL8K_STA_ACTION_ADD);
-       if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
-               rates = sta->supp_rates[IEEE80211_BAND_2GHZ];
+       if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
+               rates = sta->supp_rates[NL80211_BAND_2GHZ];
        else
-               rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5;
+               rates = sta->supp_rates[NL80211_BAND_5GHZ] << 5;
        cmd->legacy_rates = cpu_to_le32(rates);
        if (sta->ht_cap.ht_supported) {
                cmd->ht_rates[0] = sta->ht_cap.mcs.rx_mask[0];
@@ -4529,10 +4529,10 @@ static int mwl8k_cmd_update_stadb_add(struct ieee80211_hw *hw,
        p->ht_caps = cpu_to_le16(sta->ht_cap.cap);
        p->extended_ht_caps = (sta->ht_cap.ampdu_factor & 3) |
                ((sta->ht_cap.ampdu_density & 7) << 2);
-       if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
-               rates = sta->supp_rates[IEEE80211_BAND_2GHZ];
+       if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
+               rates = sta->supp_rates[NL80211_BAND_2GHZ];
        else
-               rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5;
+               rates = sta->supp_rates[NL80211_BAND_5GHZ] << 5;
        legacy_rate_mask_to_array(p->legacy_rates, rates);
        memcpy(p->ht_rates, sta->ht_cap.mcs.rx_mask, 16);
        p->interop = 1;
@@ -5010,11 +5010,11 @@ mwl8k_bss_info_changed_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                        goto out;
                }
 
-               if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) {
-                       ap_legacy_rates = ap->supp_rates[IEEE80211_BAND_2GHZ];
+               if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) {
+                       ap_legacy_rates = ap->supp_rates[NL80211_BAND_2GHZ];
                } else {
                        ap_legacy_rates =
-                               ap->supp_rates[IEEE80211_BAND_5GHZ] << 5;
+                               ap->supp_rates[NL80211_BAND_5GHZ] << 5;
                }
                memcpy(ap_mcs_rates, ap->ht_cap.mcs.rx_mask, 16);
 
@@ -5042,7 +5042,7 @@ mwl8k_bss_info_changed_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                                        idx--;
 
                                if (hw->conf.chandef.chan->band ==
-                                   IEEE80211_BAND_2GHZ)
+                                   NL80211_BAND_2GHZ)
                                        rate = mwl8k_rates_24[idx].hw_value;
                                else
                                        rate = mwl8k_rates_50[idx].hw_value;
@@ -5116,7 +5116,7 @@ mwl8k_bss_info_changed_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                if (idx)
                        idx--;
 
-               if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
+               if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
                        rate = mwl8k_rates_24[idx].hw_value;
                else
                        rate = mwl8k_rates_50[idx].hw_value;
@@ -5388,7 +5388,7 @@ static int mwl8k_get_survey(struct ieee80211_hw *hw, int idx,
        struct ieee80211_supported_band *sband;
 
        if (priv->ap_fw) {
-               sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ];
+               sband = hw->wiphy->bands[NL80211_BAND_2GHZ];
 
                if (sband && idx >= sband->n_channels) {
                        idx -= sband->n_channels;
@@ -5396,7 +5396,7 @@ static int mwl8k_get_survey(struct ieee80211_hw *hw, int idx,
                }
 
                if (!sband)
-                       sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ];
+                       sband = hw->wiphy->bands[NL80211_BAND_5GHZ];
 
                if (!sband || idx >= sband->n_channels)
                        return -ENOENT;
index 26190fd..8fa78d7 100644 (file)
@@ -469,7 +469,7 @@ struct mt7601u_dev *mt7601u_alloc_device(struct device *pdev)
 }
 
 #define CHAN2G(_idx, _freq) {                  \
-       .band = IEEE80211_BAND_2GHZ,            \
+       .band = NL80211_BAND_2GHZ,              \
        .center_freq = (_freq),                 \
        .hw_value = (_idx),                     \
        .max_power = 30,                        \
@@ -563,7 +563,7 @@ mt76_init_sband_2g(struct mt7601u_dev *dev)
 {
        dev->sband_2g = devm_kzalloc(dev->dev, sizeof(*dev->sband_2g),
                                     GFP_KERNEL);
-       dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = dev->sband_2g;
+       dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = dev->sband_2g;
 
        WARN_ON(dev->ee->reg.start - 1 + dev->ee->reg.num >
                ARRAY_SIZE(mt76_channels_2ghz));
index 7fa0128..bf3f0a3 100644 (file)
@@ -777,7 +777,7 @@ static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2)
        u8 offset1;
        u8 offset2;
 
-       if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) {
                rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &eeprom);
                offset0 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG_OFFSET0);
                offset1 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG_OFFSET1);
@@ -1174,7 +1174,7 @@ static void rt2800_brightness_set(struct led_classdev *led_cdev,
            container_of(led_cdev, struct rt2x00_led, led_dev);
        unsigned int enabled = brightness != LED_OFF;
        unsigned int bg_mode =
-           (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ);
+           (enabled && led->rt2x00dev->curr_band == NL80211_BAND_2GHZ);
        unsigned int polarity =
                rt2x00_get_field16(led->rt2x00dev->led_mcu_reg,
                                   EEPROM_FREQ_LED_POLARITY);
@@ -1741,7 +1741,7 @@ static void rt2800_config_3572bt_ant(struct rt2x00_dev *rt2x00dev)
        u8 led_ctrl, led_g_mode, led_r_mode;
 
        rt2800_register_read(rt2x00dev, GPIO_SWITCH, &reg);
-       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) {
                rt2x00_set_field32(&reg, GPIO_SWITCH_0, 1);
                rt2x00_set_field32(&reg, GPIO_SWITCH_1, 1);
        } else {
@@ -1844,7 +1844,7 @@ void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant)
                    rt2x00_has_cap_bt_coexist(rt2x00dev)) {
                        rt2x00_set_field8(&r3, BBP3_RX_ADC, 1);
                        rt2x00_set_field8(&r3, BBP3_RX_ANTENNA,
-                               rt2x00dev->curr_band == IEEE80211_BAND_5GHZ);
+                               rt2x00dev->curr_band == NL80211_BAND_5GHZ);
                        rt2800_set_ant_diversity(rt2x00dev, ANTENNA_B);
                } else {
                        rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 1);
@@ -3451,7 +3451,7 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev)
         * Matching Delta value   -4   -3   -2   -1    0   +1   +2   +3   +4
         * Example TSSI bounds  0xF0 0xD0 0xB5 0xA0 0x88 0x45 0x25 0x15 0x00
         */
-       if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) {
                rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG1, &eeprom);
                tssi_bounds[0] = rt2x00_get_field16(eeprom,
                                        EEPROM_TSSI_BOUND_BG1_MINUS4);
@@ -3546,7 +3546,7 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev)
 }
 
 static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev,
-                                     enum ieee80211_band band)
+                                     enum nl80211_band band)
 {
        u16 eeprom;
        u8 comp_en;
@@ -3562,7 +3562,7 @@ static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev,
            !test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags))
                return 0;
 
-       if (band == IEEE80211_BAND_2GHZ) {
+       if (band == NL80211_BAND_2GHZ) {
                comp_en = rt2x00_get_field16(eeprom,
                                 EEPROM_TXPOWER_DELTA_ENABLE_2G);
                if (comp_en) {
@@ -3611,7 +3611,7 @@ static int rt2800_get_txpower_reg_delta(struct rt2x00_dev *rt2x00dev,
 }
 
 static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
-                                  enum ieee80211_band band, int power_level,
+                                  enum nl80211_band band, int power_level,
                                   u8 txpower, int delta)
 {
        u16 eeprom;
@@ -3639,7 +3639,7 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
                rt2800_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER,
                                   &eeprom);
 
-               if (band == IEEE80211_BAND_2GHZ)
+               if (band == NL80211_BAND_2GHZ)
                        eirp_txpower_criterion = rt2x00_get_field16(eeprom,
                                                 EEPROM_EIRP_MAX_TX_POWER_2GHZ);
                else
@@ -3686,7 +3686,7 @@ static void rt2800_config_txpower_rt3593(struct rt2x00_dev *rt2x00dev,
        u16 eeprom;
        u32 regs[TX_PWR_CFG_IDX_COUNT];
        unsigned int offset;
-       enum ieee80211_band band = chan->band;
+       enum nl80211_band band = chan->band;
        int delta;
        int i;
 
@@ -3697,7 +3697,7 @@ static void rt2800_config_txpower_rt3593(struct rt2x00_dev *rt2x00dev,
        /* calculate temperature compensation delta */
        delta = rt2800_get_gain_calibration_delta(rt2x00dev);
 
-       if (band == IEEE80211_BAND_5GHZ)
+       if (band == NL80211_BAND_5GHZ)
                offset = 16;
        else
                offset = 0;
@@ -4055,7 +4055,7 @@ static void rt2800_config_txpower_rt3593(struct rt2x00_dev *rt2x00dev,
        for (i = 0; i < TX_PWR_CFG_IDX_COUNT; i++)
                rt2x00_dbg(rt2x00dev,
                           "band:%cGHz, BW:%c0MHz, TX_PWR_CFG_%d%s = %08lx\n",
-                          (band == IEEE80211_BAND_5GHZ) ? '5' : '2',
+                          (band == NL80211_BAND_5GHZ) ? '5' : '2',
                           (test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) ?
                                                                '4' : '2',
                           (i > TX_PWR_CFG_9_IDX) ?
@@ -4081,7 +4081,7 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
        u16 eeprom;
        u32 reg, offset;
        int i, is_rate_b, delta, power_ctrl;
-       enum ieee80211_band band = chan->band;
+       enum nl80211_band band = chan->band;
 
        /*
         * Calculate HT40 compensation. For 40MHz we need to add or subtract
@@ -4436,7 +4436,7 @@ static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev)
 {
        u8 vgc;
 
-       if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) {
                if (rt2x00_rt(rt2x00dev, RT3070) ||
                    rt2x00_rt(rt2x00dev, RT3071) ||
                    rt2x00_rt(rt2x00dev, RT3090) ||
@@ -4511,7 +4511,7 @@ void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual,
        case RT3572:
        case RT3593:
                if (qual->rssi > -65) {
-                       if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ)
+                       if (rt2x00dev->curr_band == NL80211_BAND_2GHZ)
                                vgc += 0x20;
                        else
                                vgc += 0x10;
@@ -7492,6 +7492,10 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
        if (!rt2x00_is_usb(rt2x00dev))
                ieee80211_hw_set(rt2x00dev->hw, HOST_BROADCAST_PS_BUFFERING);
 
+       /* Set MFP if HW crypto is disabled. */
+       if (rt2800_hwcrypt_disabled(rt2x00dev))
+               ieee80211_hw_set(rt2x00dev->hw, MFP_CAPABLE);
+
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
        SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
                                rt2800_eeprom_addr(rt2x00dev,
index 3dacede..f68d492 100644 (file)
@@ -753,8 +753,8 @@ struct rt2x00_dev {
         * IEEE80211 control structure.
         */
        struct ieee80211_hw *hw;
-       struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
-       enum ieee80211_band curr_band;
+       struct ieee80211_supported_band bands[NUM_NL80211_BANDS];
+       enum nl80211_band curr_band;
        int curr_freq;
 
        /*
index b2f7c58..4e0c565 100644 (file)
@@ -911,7 +911,7 @@ static void rt2x00lib_channel(struct ieee80211_channel *entry,
                              const int value)
 {
        /* XXX: this assumption about the band is wrong for 802.11j */
-       entry->band = channel <= 14 ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+       entry->band = channel <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
        entry->center_freq = ieee80211_channel_to_frequency(channel,
                                                            entry->band);
        entry->hw_value = value;
@@ -975,13 +975,13 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
         * Channels: 2.4 GHz
         */
        if (spec->supported_bands & SUPPORT_BAND_2GHZ) {
-               rt2x00dev->bands[IEEE80211_BAND_2GHZ].n_channels = 14;
-               rt2x00dev->bands[IEEE80211_BAND_2GHZ].n_bitrates = num_rates;
-               rt2x00dev->bands[IEEE80211_BAND_2GHZ].channels = channels;
-               rt2x00dev->bands[IEEE80211_BAND_2GHZ].bitrates = rates;
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                   &rt2x00dev->bands[IEEE80211_BAND_2GHZ];
-               memcpy(&rt2x00dev->bands[IEEE80211_BAND_2GHZ].ht_cap,
+               rt2x00dev->bands[NL80211_BAND_2GHZ].n_channels = 14;
+               rt2x00dev->bands[NL80211_BAND_2GHZ].n_bitrates = num_rates;
+               rt2x00dev->bands[NL80211_BAND_2GHZ].channels = channels;
+               rt2x00dev->bands[NL80211_BAND_2GHZ].bitrates = rates;
+               hw->wiphy->bands[NL80211_BAND_2GHZ] =
+                   &rt2x00dev->bands[NL80211_BAND_2GHZ];
+               memcpy(&rt2x00dev->bands[NL80211_BAND_2GHZ].ht_cap,
                       &spec->ht, sizeof(spec->ht));
        }
 
@@ -991,15 +991,15 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
         * Channels: OFDM, UNII, HiperLAN2.
         */
        if (spec->supported_bands & SUPPORT_BAND_5GHZ) {
-               rt2x00dev->bands[IEEE80211_BAND_5GHZ].n_channels =
+               rt2x00dev->bands[NL80211_BAND_5GHZ].n_channels =
                    spec->num_channels - 14;
-               rt2x00dev->bands[IEEE80211_BAND_5GHZ].n_bitrates =
+               rt2x00dev->bands[NL80211_BAND_5GHZ].n_bitrates =
                    num_rates - 4;
-               rt2x00dev->bands[IEEE80211_BAND_5GHZ].channels = &channels[14];
-               rt2x00dev->bands[IEEE80211_BAND_5GHZ].bitrates = &rates[4];
-               hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                   &rt2x00dev->bands[IEEE80211_BAND_5GHZ];
-               memcpy(&rt2x00dev->bands[IEEE80211_BAND_5GHZ].ht_cap,
+               rt2x00dev->bands[NL80211_BAND_5GHZ].channels = &channels[14];
+               rt2x00dev->bands[NL80211_BAND_5GHZ].bitrates = &rates[4];
+               hw->wiphy->bands[NL80211_BAND_5GHZ] =
+                   &rt2x00dev->bands[NL80211_BAND_5GHZ];
+               memcpy(&rt2x00dev->bands[NL80211_BAND_5GHZ].ht_cap,
                       &spec->ht, sizeof(spec->ht));
        }
 
@@ -1016,11 +1016,11 @@ static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev)
        if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags))
                ieee80211_unregister_hw(rt2x00dev->hw);
 
-       if (likely(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ])) {
-               kfree(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
-               kfree(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->bitrates);
-               rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
-               rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
+       if (likely(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ])) {
+               kfree(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels);
+               kfree(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ]->bitrates);
+               rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = NULL;
+               rt2x00dev->hw->wiphy->bands[NL80211_BAND_5GHZ] = NULL;
        }
 
        kfree(rt2x00dev->spec.channels_info);
index 24a3436..03013eb 100644 (file)
@@ -252,9 +252,9 @@ static void rt61pci_brightness_set(struct led_classdev *led_cdev,
            container_of(led_cdev, struct rt2x00_led, led_dev);
        unsigned int enabled = brightness != LED_OFF;
        unsigned int a_mode =
-           (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_5GHZ);
+           (enabled && led->rt2x00dev->curr_band == NL80211_BAND_5GHZ);
        unsigned int bg_mode =
-           (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ);
+           (enabled && led->rt2x00dev->curr_band == NL80211_BAND_2GHZ);
 
        if (led->type == LED_TYPE_RADIO) {
                rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg,
@@ -643,12 +643,12 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
        case ANTENNA_HW_DIVERSITY:
                rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 2);
                rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
-                                 (rt2x00dev->curr_band != IEEE80211_BAND_5GHZ));
+                                 (rt2x00dev->curr_band != NL80211_BAND_5GHZ));
                break;
        case ANTENNA_A:
                rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
                rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
-               if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ)
+               if (rt2x00dev->curr_band == NL80211_BAND_5GHZ)
                        rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
                else
                        rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
@@ -657,7 +657,7 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
        default:
                rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
                rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
-               if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ)
+               if (rt2x00dev->curr_band == NL80211_BAND_5GHZ)
                        rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
                else
                        rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
@@ -808,7 +808,7 @@ static void rt61pci_config_ant(struct rt2x00_dev *rt2x00dev,
        BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
               ant->tx == ANTENNA_SW_DIVERSITY);
 
-       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) {
                sel = antenna_sel_a;
                lna = rt2x00_has_cap_external_lna_a(rt2x00dev);
        } else {
@@ -822,9 +822,9 @@ static void rt61pci_config_ant(struct rt2x00_dev *rt2x00dev,
        rt2x00mmio_register_read(rt2x00dev, PHY_CSR0, &reg);
 
        rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_BG,
-                          rt2x00dev->curr_band == IEEE80211_BAND_2GHZ);
+                          rt2x00dev->curr_band == NL80211_BAND_2GHZ);
        rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_A,
-                          rt2x00dev->curr_band == IEEE80211_BAND_5GHZ);
+                          rt2x00dev->curr_band == NL80211_BAND_5GHZ);
 
        rt2x00mmio_register_write(rt2x00dev, PHY_CSR0, reg);
 
@@ -846,7 +846,7 @@ static void rt61pci_config_lna_gain(struct rt2x00_dev *rt2x00dev,
        u16 eeprom;
        short lna_gain = 0;
 
-       if (libconf->conf->chandef.chan->band == IEEE80211_BAND_2GHZ) {
+       if (libconf->conf->chandef.chan->band == NL80211_BAND_2GHZ) {
                if (rt2x00_has_cap_external_lna_bg(rt2x00dev))
                        lna_gain += 14;
 
@@ -1048,7 +1048,7 @@ static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev,
        /*
         * Determine r17 bounds.
         */
-       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) {
                low_bound = 0x28;
                up_bound = 0x48;
                if (rt2x00_has_cap_external_lna_a(rt2x00dev)) {
@@ -2077,7 +2077,7 @@ static int rt61pci_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1)
                return 0;
        }
 
-       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) {
                if (lna == 3 || lna == 2)
                        offset += 10;
        }
index 7bbc869..c1397a6 100644 (file)
@@ -197,9 +197,9 @@ static void rt73usb_brightness_set(struct led_classdev *led_cdev,
           container_of(led_cdev, struct rt2x00_led, led_dev);
        unsigned int enabled = brightness != LED_OFF;
        unsigned int a_mode =
-           (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_5GHZ);
+           (enabled && led->rt2x00dev->curr_band == NL80211_BAND_5GHZ);
        unsigned int bg_mode =
-           (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ);
+           (enabled && led->rt2x00dev->curr_band == NL80211_BAND_2GHZ);
 
        if (led->type == LED_TYPE_RADIO) {
                rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg,
@@ -593,13 +593,13 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
        case ANTENNA_HW_DIVERSITY:
                rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 2);
                temp = !rt2x00_has_cap_frame_type(rt2x00dev) &&
-                      (rt2x00dev->curr_band != IEEE80211_BAND_5GHZ);
+                      (rt2x00dev->curr_band != NL80211_BAND_5GHZ);
                rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, temp);
                break;
        case ANTENNA_A:
                rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
                rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
-               if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ)
+               if (rt2x00dev->curr_band == NL80211_BAND_5GHZ)
                        rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
                else
                        rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
@@ -608,7 +608,7 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
        default:
                rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
                rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
-               if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ)
+               if (rt2x00dev->curr_band == NL80211_BAND_5GHZ)
                        rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
                else
                        rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
@@ -704,7 +704,7 @@ static void rt73usb_config_ant(struct rt2x00_dev *rt2x00dev,
        BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
               ant->tx == ANTENNA_SW_DIVERSITY);
 
-       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) {
                sel = antenna_sel_a;
                lna = rt2x00_has_cap_external_lna_a(rt2x00dev);
        } else {
@@ -718,9 +718,9 @@ static void rt73usb_config_ant(struct rt2x00_dev *rt2x00dev,
        rt2x00usb_register_read(rt2x00dev, PHY_CSR0, &reg);
 
        rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_BG,
-                          (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ));
+                          (rt2x00dev->curr_band == NL80211_BAND_2GHZ));
        rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_A,
-                          (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ));
+                          (rt2x00dev->curr_band == NL80211_BAND_5GHZ));
 
        rt2x00usb_register_write(rt2x00dev, PHY_CSR0, reg);
 
@@ -736,7 +736,7 @@ static void rt73usb_config_lna_gain(struct rt2x00_dev *rt2x00dev,
        u16 eeprom;
        short lna_gain = 0;
 
-       if (libconf->conf->chandef.chan->band == IEEE80211_BAND_2GHZ) {
+       if (libconf->conf->chandef.chan->band == NL80211_BAND_2GHZ) {
                if (rt2x00_has_cap_external_lna_bg(rt2x00dev))
                        lna_gain += 14;
 
@@ -923,7 +923,7 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev,
        /*
         * Determine r17 bounds.
         */
-       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) {
                low_bound = 0x28;
                up_bound = 0x48;
 
@@ -1657,7 +1657,7 @@ static int rt73usb_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1)
                return 0;
        }
 
-       if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
+       if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) {
                if (rt2x00_has_cap_external_lna_a(rt2x00dev)) {
                        if (lna == 3 || lna == 2)
                                offset += 10;
index c76af5d..e895a84 100644 (file)
@@ -526,7 +526,7 @@ static void rtl8180_tx(struct ieee80211_hw *dev,
                 * ieee80211_generic_frame_duration
                 */
                duration = ieee80211_generic_frame_duration(dev, priv->vif,
-                                       IEEE80211_BAND_2GHZ, skb->len,
+                                       NL80211_BAND_2GHZ, skb->len,
                                        ieee80211_get_tx_rate(dev, info));
 
                frame_duration =  priv->ack_time + le16_to_cpu(duration);
@@ -1018,6 +1018,8 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev)
                dma_addr_t *mapping;
                entry = priv->rx_ring + priv->rx_ring_sz*i;
                if (!skb) {
+                       pci_free_consistent(priv->pdev, priv->rx_ring_sz * 32,
+                                       priv->rx_ring, priv->rx_ring_dma);
                        wiphy_err(dev->wiphy, "Cannot allocate RX skb\n");
                        return -ENOMEM;
                }
@@ -1028,6 +1030,8 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev)
 
                if (pci_dma_mapping_error(priv->pdev, *mapping)) {
                        kfree_skb(skb);
+                       pci_free_consistent(priv->pdev, priv->rx_ring_sz * 32,
+                                       priv->rx_ring, priv->rx_ring_dma);
                        wiphy_err(dev->wiphy, "Cannot map DMA for RX skb\n");
                        return -ENOMEM;
                }
@@ -1529,7 +1533,7 @@ static void rtl8180_bss_info_changed(struct ieee80211_hw *dev,
                priv->ack_time =
                        le16_to_cpu(ieee80211_generic_frame_duration(dev,
                                        priv->vif,
-                                       IEEE80211_BAND_2GHZ, 10,
+                                       NL80211_BAND_2GHZ, 10,
                                        &priv->rates[0])) - 10;
 
                rtl8180_conf_erp(dev, info);
@@ -1795,12 +1799,12 @@ static int rtl8180_probe(struct pci_dev *pdev,
        memcpy(priv->channels, rtl818x_channels, sizeof(rtl818x_channels));
        memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates));
 
-       priv->band.band = IEEE80211_BAND_2GHZ;
+       priv->band.band = NL80211_BAND_2GHZ;
        priv->band.channels = priv->channels;
        priv->band.n_channels = ARRAY_SIZE(rtl818x_channels);
        priv->band.bitrates = priv->rates;
        priv->band.n_bitrates = 4;
-       dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+       dev->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
 
        ieee80211_hw_set(dev, HOST_BROADCAST_PS_BUFFERING);
        ieee80211_hw_set(dev, RX_INCLUDES_FCS);
index b7f72f9..231f84d 100644 (file)
@@ -1470,12 +1470,12 @@ static int rtl8187_probe(struct usb_interface *intf,
        memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates));
        priv->map = (struct rtl818x_csr *)0xFF00;
 
-       priv->band.band = IEEE80211_BAND_2GHZ;
+       priv->band.band = NL80211_BAND_2GHZ;
        priv->band.channels = priv->channels;
        priv->band.n_channels = ARRAY_SIZE(rtl818x_channels);
        priv->band.bitrates = priv->rates;
        priv->band.n_bitrates = ARRAY_SIZE(rtl818x_rates);
-       dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+       dev->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
 
 
        ieee80211_hw_set(dev, RX_INCLUDES_FCS);
index 333addd..f2ce8c9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * RTL8XXXU mac80211 USB driver
  *
- * Copyright (c) 2014 - 2015 Jes Sorensen <Jes.Sorensen@redhat.com>
+ * Copyright (c) 2014 - 2016 Jes Sorensen <Jes.Sorensen@redhat.com>
  *
  * Portions, notably calibration code:
  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
@@ -91,33 +91,33 @@ static struct ieee80211_rate rtl8xxxu_rates[] = {
 };
 
 static struct ieee80211_channel rtl8xxxu_channels_2g[] = {
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2412,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2412,
          .hw_value = 1, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2417,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2417,
          .hw_value = 2, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2422,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2422,
          .hw_value = 3, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2427,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2427,
          .hw_value = 4, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2432,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2432,
          .hw_value = 5, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2437,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2437,
          .hw_value = 6, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2442,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2442,
          .hw_value = 7, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2447,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2447,
          .hw_value = 8, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2452,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2452,
          .hw_value = 9, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2457,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2457,
          .hw_value = 10, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2462,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2462,
          .hw_value = 11, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2467,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2467,
          .hw_value = 12, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2472,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2472,
          .hw_value = 13, .max_power = 30 },
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2484,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2484,
          .hw_value = 14, .max_power = 30 }
 };
 
@@ -128,7 +128,7 @@ static struct ieee80211_supported_band rtl8xxxu_supported_band = {
        .n_bitrates = ARRAY_SIZE(rtl8xxxu_rates),
 };
 
-static struct rtl8xxxu_reg8val rtl8723a_mac_init_table[] = {
+static struct rtl8xxxu_reg8val rtl8xxxu_gen1_mac_init_table[] = {
        {0x420, 0x80}, {0x423, 0x00}, {0x430, 0x00}, {0x431, 0x00},
        {0x432, 0x00}, {0x433, 0x01}, {0x434, 0x04}, {0x435, 0x05},
        {0x436, 0x06}, {0x437, 0x07}, {0x438, 0x00}, {0x439, 0x00},
@@ -184,6 +184,104 @@ static struct rtl8xxxu_reg8val rtl8723b_mac_init_table[] = {
        {0xffff, 0xff},
 };
 
+static struct rtl8xxxu_reg8val rtl8192e_mac_init_table[] = {
+       {0x011, 0xeb}, {0x012, 0x07}, {0x014, 0x75}, {0x303, 0xa7},
+       {0x428, 0x0a}, {0x429, 0x10}, {0x430, 0x00}, {0x431, 0x00},
+       {0x432, 0x00}, {0x433, 0x01}, {0x434, 0x04}, {0x435, 0x05},
+       {0x436, 0x07}, {0x437, 0x08}, {0x43c, 0x04}, {0x43d, 0x05},
+       {0x43e, 0x07}, {0x43f, 0x08}, {0x440, 0x5d}, {0x441, 0x01},
+       {0x442, 0x00}, {0x444, 0x10}, {0x445, 0x00}, {0x446, 0x00},
+       {0x447, 0x00}, {0x448, 0x00}, {0x449, 0xf0}, {0x44a, 0x0f},
+       {0x44b, 0x3e}, {0x44c, 0x10}, {0x44d, 0x00}, {0x44e, 0x00},
+       {0x44f, 0x00}, {0x450, 0x00}, {0x451, 0xf0}, {0x452, 0x0f},
+       {0x453, 0x00}, {0x456, 0x5e}, {0x460, 0x66}, {0x461, 0x66},
+       {0x4c8, 0xff}, {0x4c9, 0x08}, {0x4cc, 0xff}, {0x4cd, 0xff},
+       {0x4ce, 0x01}, {0x500, 0x26}, {0x501, 0xa2}, {0x502, 0x2f},
+       {0x503, 0x00}, {0x504, 0x28}, {0x505, 0xa3}, {0x506, 0x5e},
+       {0x507, 0x00}, {0x508, 0x2b}, {0x509, 0xa4}, {0x50a, 0x5e},
+       {0x50b, 0x00}, {0x50c, 0x4f}, {0x50d, 0xa4}, {0x50e, 0x00},
+       {0x50f, 0x00}, {0x512, 0x1c}, {0x514, 0x0a}, {0x516, 0x0a},
+       {0x525, 0x4f}, {0x540, 0x12}, {0x541, 0x64}, {0x550, 0x10},
+       {0x551, 0x10}, {0x559, 0x02}, {0x55c, 0x50}, {0x55d, 0xff},
+       {0x605, 0x30}, {0x608, 0x0e}, {0x609, 0x2a}, {0x620, 0xff},
+       {0x621, 0xff}, {0x622, 0xff}, {0x623, 0xff}, {0x624, 0xff},
+       {0x625, 0xff}, {0x626, 0xff}, {0x627, 0xff}, {0x638, 0x50},
+       {0x63c, 0x0a}, {0x63d, 0x0a}, {0x63e, 0x0e}, {0x63f, 0x0e},
+       {0x640, 0x40}, {0x642, 0x40}, {0x643, 0x00}, {0x652, 0xc8},
+       {0x66e, 0x05}, {0x700, 0x21}, {0x701, 0x43}, {0x702, 0x65},
+       {0x703, 0x87}, {0x708, 0x21}, {0x709, 0x43}, {0x70a, 0x65},
+       {0x70b, 0x87},
+       {0xffff, 0xff},
+};
+
+#ifdef CONFIG_RTL8XXXU_UNTESTED
+static struct rtl8xxxu_power_base rtl8188r_power_base = {
+       .reg_0e00 = 0x06080808,
+       .reg_0e04 = 0x00040406,
+       .reg_0e08 = 0x00000000,
+       .reg_086c = 0x00000000,
+
+       .reg_0e10 = 0x04060608,
+       .reg_0e14 = 0x00020204,
+       .reg_0e18 = 0x04060608,
+       .reg_0e1c = 0x00020204,
+
+       .reg_0830 = 0x06080808,
+       .reg_0834 = 0x00040406,
+       .reg_0838 = 0x00000000,
+       .reg_086c_2 = 0x00000000,
+
+       .reg_083c = 0x04060608,
+       .reg_0848 = 0x00020204,
+       .reg_084c = 0x04060608,
+       .reg_0868 = 0x00020204,
+};
+
+static struct rtl8xxxu_power_base rtl8192c_power_base = {
+       .reg_0e00 = 0x07090c0c,
+       .reg_0e04 = 0x01020405,
+       .reg_0e08 = 0x00000000,
+       .reg_086c = 0x00000000,
+
+       .reg_0e10 = 0x0b0c0c0e,
+       .reg_0e14 = 0x01030506,
+       .reg_0e18 = 0x0b0c0d0e,
+       .reg_0e1c = 0x01030509,
+
+       .reg_0830 = 0x07090c0c,
+       .reg_0834 = 0x01020405,
+       .reg_0838 = 0x00000000,
+       .reg_086c_2 = 0x00000000,
+
+       .reg_083c = 0x0b0c0d0e,
+       .reg_0848 = 0x01030509,
+       .reg_084c = 0x0b0c0d0e,
+       .reg_0868 = 0x01030509,
+};
+#endif
+
+static struct rtl8xxxu_power_base rtl8723a_power_base = {
+       .reg_0e00 = 0x0a0c0c0c,
+       .reg_0e04 = 0x02040608,
+       .reg_0e08 = 0x00000000,
+       .reg_086c = 0x00000000,
+
+       .reg_0e10 = 0x0a0c0d0e,
+       .reg_0e14 = 0x02040608,
+       .reg_0e18 = 0x0a0c0d0e,
+       .reg_0e1c = 0x02040608,
+
+       .reg_0830 = 0x0a0c0c0c,
+       .reg_0834 = 0x02040608,
+       .reg_0838 = 0x00000000,
+       .reg_086c_2 = 0x00000000,
+
+       .reg_083c = 0x0a0c0d0e,
+       .reg_0848 = 0x02040608,
+       .reg_084c = 0x0a0c0d0e,
+       .reg_0868 = 0x02040608,
+};
+
 static struct rtl8xxxu_reg32val rtl8723a_phy_1t_init_table[] = {
        {0x800, 0x80040000}, {0x804, 0x00000003},
        {0x808, 0x0000fc00}, {0x80c, 0x0000000a},
@@ -580,6 +678,138 @@ static struct rtl8xxxu_reg32val rtl8188ru_phy_1t_highpa_table[] = {
        {0xffff, 0xffffffff},
 };
 
+static struct rtl8xxxu_reg32val rtl8192eu_phy_init_table[] = {
+       {0x800, 0x80040000}, {0x804, 0x00000003},
+       {0x808, 0x0000fc00}, {0x80c, 0x0000000a},
+       {0x810, 0x10001331}, {0x814, 0x020c3d10},
+       {0x818, 0x02220385}, {0x81c, 0x00000000},
+       {0x820, 0x01000100}, {0x824, 0x00390204},
+       {0x828, 0x01000100}, {0x82c, 0x00390204},
+       {0x830, 0x32323232}, {0x834, 0x30303030},
+       {0x838, 0x30303030}, {0x83c, 0x30303030},
+       {0x840, 0x00010000}, {0x844, 0x00010000},
+       {0x848, 0x28282828}, {0x84c, 0x28282828},
+       {0x850, 0x00000000}, {0x854, 0x00000000},
+       {0x858, 0x009a009a}, {0x85c, 0x01000014},
+       {0x860, 0x66f60000}, {0x864, 0x061f0000},
+       {0x868, 0x30303030}, {0x86c, 0x30303030},
+       {0x870, 0x00000000}, {0x874, 0x55004200},
+       {0x878, 0x08080808}, {0x87c, 0x00000000},
+       {0x880, 0xb0000c1c}, {0x884, 0x00000001},
+       {0x888, 0x00000000}, {0x88c, 0xcc0000c0},
+       {0x890, 0x00000800}, {0x894, 0xfffffffe},
+       {0x898, 0x40302010}, {0x900, 0x00000000},
+       {0x904, 0x00000023}, {0x908, 0x00000000},
+       {0x90c, 0x81121313}, {0x910, 0x806c0001},
+       {0x914, 0x00000001}, {0x918, 0x00000000},
+       {0x91c, 0x00010000}, {0x924, 0x00000001},
+       {0x928, 0x00000000}, {0x92c, 0x00000000},
+       {0x930, 0x00000000}, {0x934, 0x00000000},
+       {0x938, 0x00000000}, {0x93c, 0x00000000},
+       {0x940, 0x00000000}, {0x944, 0x00000000},
+       {0x94c, 0x00000008}, {0xa00, 0x00d0c7c8},
+       {0xa04, 0x81ff000c}, {0xa08, 0x8c838300},
+       {0xa0c, 0x2e68120f}, {0xa10, 0x95009b78},
+       {0xa14, 0x1114d028}, {0xa18, 0x00881117},
+       {0xa1c, 0x89140f00}, {0xa20, 0x1a1b0000},
+       {0xa24, 0x090e1317}, {0xa28, 0x00000204},
+       {0xa2c, 0x00d30000}, {0xa70, 0x101fff00},
+       {0xa74, 0x00000007}, {0xa78, 0x00000900},
+       {0xa7c, 0x225b0606}, {0xa80, 0x218075b1},
+       {0xb38, 0x00000000}, {0xc00, 0x48071d40},
+       {0xc04, 0x03a05633}, {0xc08, 0x000000e4},
+       {0xc0c, 0x6c6c6c6c}, {0xc10, 0x08800000},
+       {0xc14, 0x40000100}, {0xc18, 0x08800000},
+       {0xc1c, 0x40000100}, {0xc20, 0x00000000},
+       {0xc24, 0x00000000}, {0xc28, 0x00000000},
+       {0xc2c, 0x00000000}, {0xc30, 0x69e9ac47},
+       {0xc34, 0x469652af}, {0xc38, 0x49795994},
+       {0xc3c, 0x0a97971c}, {0xc40, 0x1f7c403f},
+       {0xc44, 0x000100b7}, {0xc48, 0xec020107},
+       {0xc4c, 0x007f037f},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0xc50, 0x00340220},
+#else
+       {0xc50, 0x00340020},
+#endif
+       {0xc54, 0x0080801f},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0xc58, 0x00000220},
+#else
+       {0xc58, 0x00000020},
+#endif
+       {0xc5c, 0x00248492}, {0xc60, 0x00000000},
+       {0xc64, 0x7112848b}, {0xc68, 0x47c00bff},
+       {0xc6c, 0x00000036}, {0xc70, 0x00000600},
+       {0xc74, 0x02013169}, {0xc78, 0x0000001f},
+       {0xc7c, 0x00b91612},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0xc80, 0x2d4000b5},
+#else
+       {0xc80, 0x40000100},
+#endif
+       {0xc84, 0x21f60000},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0xc88, 0x2d4000b5},
+#else
+       {0xc88, 0x40000100},
+#endif
+       {0xc8c, 0xa0e40000}, {0xc90, 0x00121820},
+       {0xc94, 0x00000000}, {0xc98, 0x00121820},
+       {0xc9c, 0x00007f7f}, {0xca0, 0x00000000},
+       {0xca4, 0x000300a0}, {0xca8, 0x00000000},
+       {0xcac, 0x00000000}, {0xcb0, 0x00000000},
+       {0xcb4, 0x00000000}, {0xcb8, 0x00000000},
+       {0xcbc, 0x28000000}, {0xcc0, 0x00000000},
+       {0xcc4, 0x00000000}, {0xcc8, 0x00000000},
+       {0xccc, 0x00000000}, {0xcd0, 0x00000000},
+       {0xcd4, 0x00000000}, {0xcd8, 0x64b22427},
+       {0xcdc, 0x00766932}, {0xce0, 0x00222222},
+       {0xce4, 0x00040000}, {0xce8, 0x77644302},
+       {0xcec, 0x2f97d40c}, {0xd00, 0x00080740},
+       {0xd04, 0x00020403}, {0xd08, 0x0000907f},
+       {0xd0c, 0x20010201}, {0xd10, 0xa0633333},
+       {0xd14, 0x3333bc43}, {0xd18, 0x7a8f5b6b},
+       {0xd1c, 0x0000007f}, {0xd2c, 0xcc979975},
+       {0xd30, 0x00000000}, {0xd34, 0x80608000},
+       {0xd38, 0x00000000}, {0xd3c, 0x00127353},
+       {0xd40, 0x00000000}, {0xd44, 0x00000000},
+       {0xd48, 0x00000000}, {0xd4c, 0x00000000},
+       {0xd50, 0x6437140a}, {0xd54, 0x00000000},
+       {0xd58, 0x00000282}, {0xd5c, 0x30032064},
+       {0xd60, 0x4653de68}, {0xd64, 0x04518a3c},
+       {0xd68, 0x00002101}, {0xd6c, 0x2a201c16},
+       {0xd70, 0x1812362e}, {0xd74, 0x322c2220},
+       {0xd78, 0x000e3c24}, {0xd80, 0x01081008},
+       {0xd84, 0x00000800}, {0xd88, 0xf0b50000},
+       {0xe00, 0x30303030}, {0xe04, 0x30303030},
+       {0xe08, 0x03903030}, {0xe10, 0x30303030},
+       {0xe14, 0x30303030}, {0xe18, 0x30303030},
+       {0xe1c, 0x30303030}, {0xe28, 0x00000000},
+       {0xe30, 0x1000dc1f}, {0xe34, 0x10008c1f},
+       {0xe38, 0x02140102}, {0xe3c, 0x681604c2},
+       {0xe40, 0x01007c00}, {0xe44, 0x01004800},
+       {0xe48, 0xfb000000}, {0xe4c, 0x000028d1},
+       {0xe50, 0x1000dc1f}, {0xe54, 0x10008c1f},
+       {0xe58, 0x02140102}, {0xe5c, 0x28160d05},
+       {0xe60, 0x00000008}, {0xe68, 0x0fc05656},
+       {0xe6c, 0x03c09696}, {0xe70, 0x03c09696},
+       {0xe74, 0x0c005656}, {0xe78, 0x0c005656},
+       {0xe7c, 0x0c005656}, {0xe80, 0x0c005656},
+       {0xe84, 0x03c09696}, {0xe88, 0x0c005656},
+       {0xe8c, 0x03c09696}, {0xed0, 0x03c09696},
+       {0xed4, 0x03c09696}, {0xed8, 0x03c09696},
+       {0xedc, 0x0000d6d6}, {0xee0, 0x0000d6d6},
+       {0xeec, 0x0fc01616}, {0xee4, 0xb0000c1c},
+       {0xee8, 0x00000001}, {0xf14, 0x00000003},
+       {0xf4c, 0x00000000}, {0xf00, 0x00000300},
+       {0xffff, 0xffffffff},
+};
+
 static struct rtl8xxxu_reg32val rtl8xxx_agc_standard_table[] = {
        {0xc78, 0x7b000001}, {0xc78, 0x7b010001},
        {0xc78, 0x7b020001}, {0xc78, 0x7b030001},
@@ -819,6 +1049,144 @@ static struct rtl8xxxu_reg32val rtl8xxx_agc_8723bu_table[] = {
        {0xffff, 0xffffffff}
 };
 
+static struct rtl8xxxu_reg32val rtl8xxx_agc_8192eu_std_table[] = {
+       {0xc78, 0xfb000001}, {0xc78, 0xfb010001},
+       {0xc78, 0xfb020001}, {0xc78, 0xfb030001},
+       {0xc78, 0xfb040001}, {0xc78, 0xfb050001},
+       {0xc78, 0xfa060001}, {0xc78, 0xf9070001},
+       {0xc78, 0xf8080001}, {0xc78, 0xf7090001},
+       {0xc78, 0xf60a0001}, {0xc78, 0xf50b0001},
+       {0xc78, 0xf40c0001}, {0xc78, 0xf30d0001},
+       {0xc78, 0xf20e0001}, {0xc78, 0xf10f0001},
+       {0xc78, 0xf0100001}, {0xc78, 0xef110001},
+       {0xc78, 0xee120001}, {0xc78, 0xed130001},
+       {0xc78, 0xec140001}, {0xc78, 0xeb150001},
+       {0xc78, 0xea160001}, {0xc78, 0xe9170001},
+       {0xc78, 0xe8180001}, {0xc78, 0xe7190001},
+       {0xc78, 0xc81a0001}, {0xc78, 0xc71b0001},
+       {0xc78, 0xc61c0001}, {0xc78, 0x071d0001},
+       {0xc78, 0x061e0001}, {0xc78, 0x051f0001},
+       {0xc78, 0x04200001}, {0xc78, 0x03210001},
+       {0xc78, 0xaa220001}, {0xc78, 0xa9230001},
+       {0xc78, 0xa8240001}, {0xc78, 0xa7250001},
+       {0xc78, 0xa6260001}, {0xc78, 0x85270001},
+       {0xc78, 0x84280001}, {0xc78, 0x83290001},
+       {0xc78, 0x252a0001}, {0xc78, 0x242b0001},
+       {0xc78, 0x232c0001}, {0xc78, 0x222d0001},
+       {0xc78, 0x672e0001}, {0xc78, 0x662f0001},
+       {0xc78, 0x65300001}, {0xc78, 0x64310001},
+       {0xc78, 0x63320001}, {0xc78, 0x62330001},
+       {0xc78, 0x61340001}, {0xc78, 0x45350001},
+       {0xc78, 0x44360001}, {0xc78, 0x43370001},
+       {0xc78, 0x42380001}, {0xc78, 0x41390001},
+       {0xc78, 0x403a0001}, {0xc78, 0x403b0001},
+       {0xc78, 0x403c0001}, {0xc78, 0x403d0001},
+       {0xc78, 0x403e0001}, {0xc78, 0x403f0001},
+       {0xc78, 0xfb400001}, {0xc78, 0xfb410001},
+       {0xc78, 0xfb420001}, {0xc78, 0xfb430001},
+       {0xc78, 0xfb440001}, {0xc78, 0xfb450001},
+       {0xc78, 0xfa460001}, {0xc78, 0xf9470001},
+       {0xc78, 0xf8480001}, {0xc78, 0xf7490001},
+       {0xc78, 0xf64a0001}, {0xc78, 0xf54b0001},
+       {0xc78, 0xf44c0001}, {0xc78, 0xf34d0001},
+       {0xc78, 0xf24e0001}, {0xc78, 0xf14f0001},
+       {0xc78, 0xf0500001}, {0xc78, 0xef510001},
+       {0xc78, 0xee520001}, {0xc78, 0xed530001},
+       {0xc78, 0xec540001}, {0xc78, 0xeb550001},
+       {0xc78, 0xea560001}, {0xc78, 0xe9570001},
+       {0xc78, 0xe8580001}, {0xc78, 0xe7590001},
+       {0xc78, 0xe65a0001}, {0xc78, 0xe55b0001},
+       {0xc78, 0xe45c0001}, {0xc78, 0xe35d0001},
+       {0xc78, 0xe25e0001}, {0xc78, 0xe15f0001},
+       {0xc78, 0x8a600001}, {0xc78, 0x89610001},
+       {0xc78, 0x88620001}, {0xc78, 0x87630001},
+       {0xc78, 0x86640001}, {0xc78, 0x85650001},
+       {0xc78, 0x84660001}, {0xc78, 0x83670001},
+       {0xc78, 0x82680001}, {0xc78, 0x6b690001},
+       {0xc78, 0x6a6a0001}, {0xc78, 0x696b0001},
+       {0xc78, 0x686c0001}, {0xc78, 0x676d0001},
+       {0xc78, 0x666e0001}, {0xc78, 0x656f0001},
+       {0xc78, 0x64700001}, {0xc78, 0x63710001},
+       {0xc78, 0x62720001}, {0xc78, 0x61730001},
+       {0xc78, 0x49740001}, {0xc78, 0x48750001},
+       {0xc78, 0x47760001}, {0xc78, 0x46770001},
+       {0xc78, 0x45780001}, {0xc78, 0x44790001},
+       {0xc78, 0x437a0001}, {0xc78, 0x427b0001},
+       {0xc78, 0x417c0001}, {0xc78, 0x407d0001},
+       {0xc78, 0x407e0001}, {0xc78, 0x407f0001},
+       {0xc50, 0x00040022}, {0xc50, 0x00040020},
+       {0xffff, 0xffffffff}
+};
+
+static struct rtl8xxxu_reg32val rtl8xxx_agc_8192eu_highpa_table[] = {
+       {0xc78, 0xfa000001}, {0xc78, 0xf9010001},
+       {0xc78, 0xf8020001}, {0xc78, 0xf7030001},
+       {0xc78, 0xf6040001}, {0xc78, 0xf5050001},
+       {0xc78, 0xf4060001}, {0xc78, 0xf3070001},
+       {0xc78, 0xf2080001}, {0xc78, 0xf1090001},
+       {0xc78, 0xf00a0001}, {0xc78, 0xef0b0001},
+       {0xc78, 0xee0c0001}, {0xc78, 0xed0d0001},
+       {0xc78, 0xec0e0001}, {0xc78, 0xeb0f0001},
+       {0xc78, 0xea100001}, {0xc78, 0xe9110001},
+       {0xc78, 0xe8120001}, {0xc78, 0xe7130001},
+       {0xc78, 0xe6140001}, {0xc78, 0xe5150001},
+       {0xc78, 0xe4160001}, {0xc78, 0xe3170001},
+       {0xc78, 0xe2180001}, {0xc78, 0xe1190001},
+       {0xc78, 0x8a1a0001}, {0xc78, 0x891b0001},
+       {0xc78, 0x881c0001}, {0xc78, 0x871d0001},
+       {0xc78, 0x861e0001}, {0xc78, 0x851f0001},
+       {0xc78, 0x84200001}, {0xc78, 0x83210001},
+       {0xc78, 0x82220001}, {0xc78, 0x6a230001},
+       {0xc78, 0x69240001}, {0xc78, 0x68250001},
+       {0xc78, 0x67260001}, {0xc78, 0x66270001},
+       {0xc78, 0x65280001}, {0xc78, 0x64290001},
+       {0xc78, 0x632a0001}, {0xc78, 0x622b0001},
+       {0xc78, 0x612c0001}, {0xc78, 0x602d0001},
+       {0xc78, 0x472e0001}, {0xc78, 0x462f0001},
+       {0xc78, 0x45300001}, {0xc78, 0x44310001},
+       {0xc78, 0x43320001}, {0xc78, 0x42330001},
+       {0xc78, 0x41340001}, {0xc78, 0x40350001},
+       {0xc78, 0x40360001}, {0xc78, 0x40370001},
+       {0xc78, 0x40380001}, {0xc78, 0x40390001},
+       {0xc78, 0x403a0001}, {0xc78, 0x403b0001},
+       {0xc78, 0x403c0001}, {0xc78, 0x403d0001},
+       {0xc78, 0x403e0001}, {0xc78, 0x403f0001},
+       {0xc78, 0xfa400001}, {0xc78, 0xf9410001},
+       {0xc78, 0xf8420001}, {0xc78, 0xf7430001},
+       {0xc78, 0xf6440001}, {0xc78, 0xf5450001},
+       {0xc78, 0xf4460001}, {0xc78, 0xf3470001},
+       {0xc78, 0xf2480001}, {0xc78, 0xf1490001},
+       {0xc78, 0xf04a0001}, {0xc78, 0xef4b0001},
+       {0xc78, 0xee4c0001}, {0xc78, 0xed4d0001},
+       {0xc78, 0xec4e0001}, {0xc78, 0xeb4f0001},
+       {0xc78, 0xea500001}, {0xc78, 0xe9510001},
+       {0xc78, 0xe8520001}, {0xc78, 0xe7530001},
+       {0xc78, 0xe6540001}, {0xc78, 0xe5550001},
+       {0xc78, 0xe4560001}, {0xc78, 0xe3570001},
+       {0xc78, 0xe2580001}, {0xc78, 0xe1590001},
+       {0xc78, 0x8a5a0001}, {0xc78, 0x895b0001},
+       {0xc78, 0x885c0001}, {0xc78, 0x875d0001},
+       {0xc78, 0x865e0001}, {0xc78, 0x855f0001},
+       {0xc78, 0x84600001}, {0xc78, 0x83610001},
+       {0xc78, 0x82620001}, {0xc78, 0x6a630001},
+       {0xc78, 0x69640001}, {0xc78, 0x68650001},
+       {0xc78, 0x67660001}, {0xc78, 0x66670001},
+       {0xc78, 0x65680001}, {0xc78, 0x64690001},
+       {0xc78, 0x636a0001}, {0xc78, 0x626b0001},
+       {0xc78, 0x616c0001}, {0xc78, 0x606d0001},
+       {0xc78, 0x476e0001}, {0xc78, 0x466f0001},
+       {0xc78, 0x45700001}, {0xc78, 0x44710001},
+       {0xc78, 0x43720001}, {0xc78, 0x42730001},
+       {0xc78, 0x41740001}, {0xc78, 0x40750001},
+       {0xc78, 0x40760001}, {0xc78, 0x40770001},
+       {0xc78, 0x40780001}, {0xc78, 0x40790001},
+       {0xc78, 0x407a0001}, {0xc78, 0x407b0001},
+       {0xc78, 0x407c0001}, {0xc78, 0x407d0001},
+       {0xc78, 0x407e0001}, {0xc78, 0x407f0001},
+       {0xc50, 0x00040222}, {0xc50, 0x00040220},
+       {0xffff, 0xffffffff}
+};
+
 static struct rtl8xxxu_rfregval rtl8723au_radioa_1t_init_table[] = {
        {0x00, 0x00030159}, {0x01, 0x00031284},
        {0x02, 0x00098000}, {0x03, 0x00039c63},
@@ -963,6 +1331,7 @@ static struct rtl8xxxu_rfregval rtl8723bu_radioa_1t_init_table[] = {
        {0xff, 0xffffffff}
 };
 
+#ifdef CONFIG_RTL8XXXU_UNTESTED
 static struct rtl8xxxu_rfregval rtl8192cu_radioa_2t_init_table[] = {
        {0x00, 0x00030159}, {0x01, 0x00031284},
        {0x02, 0x00098000}, {0x03, 0x00018c63},
@@ -1211,6 +1580,153 @@ static struct rtl8xxxu_rfregval rtl8188ru_radioa_1t_highpa_table[] = {
        {0x00, 0x00030159},
        {0xff, 0xffffffff}
 };
+#endif
+
+static struct rtl8xxxu_rfregval rtl8192eu_radioa_init_table[] = {
+       {0x7f, 0x00000082}, {0x81, 0x0003fc00},
+       {0x00, 0x00030000}, {0x08, 0x00008400},
+       {0x18, 0x00000407}, {0x19, 0x00000012},
+       {0x1b, 0x00000064}, {0x1e, 0x00080009},
+       {0x1f, 0x00000880}, {0x2f, 0x0001a060},
+       {0x3f, 0x00000000}, {0x42, 0x000060c0},
+       {0x57, 0x000d0000}, {0x58, 0x000be180},
+       {0x67, 0x00001552}, {0x83, 0x00000000},
+       {0xb0, 0x000ff9f1}, {0xb1, 0x00055418},
+       {0xb2, 0x0008cc00}, {0xb4, 0x00043083},
+       {0xb5, 0x00008166}, {0xb6, 0x0000803e},
+       {0xb7, 0x0001c69f}, {0xb8, 0x0000407f},
+       {0xb9, 0x00080001}, {0xba, 0x00040001},
+       {0xbb, 0x00000400}, {0xbf, 0x000c0000},
+       {0xc2, 0x00002400}, {0xc3, 0x00000009},
+       {0xc4, 0x00040c91}, {0xc5, 0x00099999},
+       {0xc6, 0x000000a3}, {0xc7, 0x00088820},
+       {0xc8, 0x00076c06}, {0xc9, 0x00000000},
+       {0xca, 0x00080000}, {0xdf, 0x00000180},
+       {0xef, 0x000001a0}, {0x51, 0x00069545},
+       {0x52, 0x0007e45e}, {0x53, 0x00000071},
+       {0x56, 0x00051ff3}, {0x35, 0x000000a8},
+       {0x35, 0x000001e2}, {0x35, 0x000002a8},
+       {0x36, 0x00001c24}, {0x36, 0x00009c24},
+       {0x36, 0x00011c24}, {0x36, 0x00019c24},
+       {0x18, 0x00000c07}, {0x5a, 0x00048000},
+       {0x19, 0x000739d0},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0x34, 0x0000a093}, {0x34, 0x0000908f},
+       {0x34, 0x0000808c}, {0x34, 0x0000704d},
+       {0x34, 0x0000604a}, {0x34, 0x00005047},
+       {0x34, 0x0000400a}, {0x34, 0x00003007},
+       {0x34, 0x00002004}, {0x34, 0x00001001},
+       {0x34, 0x00000000},
+#else
+       /* Regular */
+       {0x34, 0x0000add7}, {0x34, 0x00009dd4},
+       {0x34, 0x00008dd1}, {0x34, 0x00007dce},
+       {0x34, 0x00006dcb}, {0x34, 0x00005dc8},
+       {0x34, 0x00004dc5}, {0x34, 0x000034cc},
+       {0x34, 0x0000244f}, {0x34, 0x0000144c},
+       {0x34, 0x00000014},
+#endif
+       {0x00, 0x00030159},
+       {0x84, 0x00068180},
+       {0x86, 0x0000014e},
+       {0x87, 0x00048e00},
+       {0x8e, 0x00065540},
+       {0x8f, 0x00088000},
+       {0xef, 0x000020a0},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0x3b, 0x000f07b0},
+#else
+       {0x3b, 0x000f02b0},
+#endif
+       {0x3b, 0x000ef7b0}, {0x3b, 0x000d4fb0},
+       {0x3b, 0x000cf060}, {0x3b, 0x000b0090},
+       {0x3b, 0x000a0080}, {0x3b, 0x00090080},
+       {0x3b, 0x0008f780},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0x3b, 0x000787b0},
+#else
+       {0x3b, 0x00078730},
+#endif
+       {0x3b, 0x00060fb0}, {0x3b, 0x0005ffa0},
+       {0x3b, 0x00040620}, {0x3b, 0x00037090},
+       {0x3b, 0x00020080}, {0x3b, 0x0001f060},
+       {0x3b, 0x0000ffb0}, {0xef, 0x000000a0},
+       {0xfe, 0x00000000}, {0x18, 0x0000fc07},
+       {0xfe, 0x00000000}, {0xfe, 0x00000000},
+       {0xfe, 0x00000000}, {0xfe, 0x00000000},
+       {0x1e, 0x00000001}, {0x1f, 0x00080000},
+       {0x00, 0x00033e70},
+       {0xff, 0xffffffff}
+};
+
+static struct rtl8xxxu_rfregval rtl8192eu_radiob_init_table[] = {
+       {0x7f, 0x00000082}, {0x81, 0x0003fc00},
+       {0x00, 0x00030000}, {0x08, 0x00008400},
+       {0x18, 0x00000407}, {0x19, 0x00000012},
+       {0x1b, 0x00000064}, {0x1e, 0x00080009},
+       {0x1f, 0x00000880}, {0x2f, 0x0001a060},
+       {0x3f, 0x00000000}, {0x42, 0x000060c0},
+       {0x57, 0x000d0000}, {0x58, 0x000be180},
+       {0x67, 0x00001552}, {0x7f, 0x00000082},
+       {0x81, 0x0003f000}, {0x83, 0x00000000},
+       {0xdf, 0x00000180}, {0xef, 0x000001a0},
+       {0x51, 0x00069545}, {0x52, 0x0007e42e},
+       {0x53, 0x00000071}, {0x56, 0x00051ff3},
+       {0x35, 0x000000a8}, {0x35, 0x000001e0},
+       {0x35, 0x000002a8}, {0x36, 0x00001ca8},
+       {0x36, 0x00009c24}, {0x36, 0x00011c24},
+       {0x36, 0x00019c24}, {0x18, 0x00000c07},
+       {0x5a, 0x00048000}, {0x19, 0x000739d0},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0x34, 0x0000a093}, {0x34, 0x0000908f},
+       {0x34, 0x0000808c}, {0x34, 0x0000704d},
+       {0x34, 0x0000604a}, {0x34, 0x00005047},
+       {0x34, 0x0000400a}, {0x34, 0x00003007},
+       {0x34, 0x00002004}, {0x34, 0x00001001},
+       {0x34, 0x00000000},
+#else
+       {0x34, 0x0000add7}, {0x34, 0x00009dd4},
+       {0x34, 0x00008dd1}, {0x34, 0x00007dce},
+       {0x34, 0x00006dcb}, {0x34, 0x00005dc8},
+       {0x34, 0x00004dc5}, {0x34, 0x000034cc},
+       {0x34, 0x0000244f}, {0x34, 0x0000144c},
+       {0x34, 0x00000014},
+#endif
+       {0x00, 0x00030159}, {0x84, 0x00068180},
+       {0x86, 0x000000ce}, {0x87, 0x00048a00},
+       {0x8e, 0x00065540}, {0x8f, 0x00088000},
+       {0xef, 0x000020a0},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0x3b, 0x000f07b0},
+#else
+       {0x3b, 0x000f02b0},
+#endif
+
+       {0x3b, 0x000ef7b0}, {0x3b, 0x000d4fb0},
+       {0x3b, 0x000cf060}, {0x3b, 0x000b0090},
+       {0x3b, 0x000a0080}, {0x3b, 0x00090080},
+       {0x3b, 0x0008f780},
+#ifdef EXT_PA_8192EU
+       /* External PA or external LNA */
+       {0x3b, 0x000787b0},
+#else
+       {0x3b, 0x00078730},
+#endif
+       {0x3b, 0x00060fb0}, {0x3b, 0x0005ffa0},
+       {0x3b, 0x00040620}, {0x3b, 0x00037090},
+       {0x3b, 0x00020080}, {0x3b, 0x0001f060},
+       {0x3b, 0x0000ffb0}, {0xef, 0x000000a0},
+       {0x00, 0x00010159}, {0xfe, 0x00000000},
+       {0xfe, 0x00000000}, {0xfe, 0x00000000},
+       {0xfe, 0x00000000}, {0x1e, 0x00000001},
+       {0x1f, 0x00080000}, {0x00, 0x00033e70},
+       {0xff, 0xffffffff}
+};
 
 static struct rtl8xxxu_rfregs rtl8xxxu_rfregs[] = {
        {       /* RF_A */
@@ -1231,7 +1747,7 @@ static struct rtl8xxxu_rfregs rtl8xxxu_rfregs[] = {
        },
 };
 
-static const u32 rtl8723au_iqk_phy_iq_bb_reg[RTL8XXXU_BB_REGS] = {
+static const u32 rtl8xxxu_iqk_phy_iq_bb_reg[RTL8XXXU_BB_REGS] = {
        REG_OFDM0_XA_RX_IQ_IMBALANCE,
        REG_OFDM0_XB_RX_IQ_IMBALANCE,
        REG_OFDM0_ENERGY_CCA_THRES,
@@ -1450,7 +1966,7 @@ static int rtl8xxxu_write_rfreg(struct rtl8xxxu_priv *priv,
                                enum rtl8xxxu_rfpath path, u8 reg, u32 data)
 {
        int ret, retval;
-       u32 dataaddr;
+       u32 dataaddr, val32;
 
        if (rtl8xxxu_debug & RTL8XXXU_DEBUG_RFREG_WRITE)
                dev_info(&priv->udev->dev, "%s(%02x) = 0x%06x\n",
@@ -1459,6 +1975,12 @@ static int rtl8xxxu_write_rfreg(struct rtl8xxxu_priv *priv,
        data &= FPGA0_LSSI_PARM_DATA_MASK;
        dataaddr = (reg << FPGA0_LSSI_PARM_ADDR_SHIFT) | data;
 
+       if (priv->rtl_chip == RTL8192E) {
+               val32 = rtl8xxxu_read32(priv, REG_FPGA0_POWER_SAVE);
+               val32 &= ~0x20000;
+               rtl8xxxu_write32(priv, REG_FPGA0_POWER_SAVE, val32);
+       }
+
        /* Use XB for path B */
        ret = rtl8xxxu_write32(priv, rtl8xxxu_rfregs[path].lssiparm, dataaddr);
        if (ret != sizeof(dataaddr))
@@ -1468,6 +1990,12 @@ static int rtl8xxxu_write_rfreg(struct rtl8xxxu_priv *priv,
 
        udelay(1);
 
+       if (priv->rtl_chip == RTL8192E) {
+               val32 = rtl8xxxu_read32(priv, REG_FPGA0_POWER_SAVE);
+               val32 |= 0x20000;
+               rtl8xxxu_write32(priv, REG_FPGA0_POWER_SAVE, val32);
+       }
+
        return retval;
 }
 
@@ -1552,7 +2080,7 @@ static void rtl8723bu_write_btreg(struct rtl8xxxu_priv *priv, u8 reg, u8 data)
        rtl8723a_h2c_cmd(priv, &h2c, sizeof(h2c.bt_mp_oper));
 }
 
-static void rtl8723a_enable_rf(struct rtl8xxxu_priv *priv)
+static void rtl8xxxu_gen1_enable_rf(struct rtl8xxxu_priv *priv)
 {
        u8 val8;
        u32 val32;
@@ -1596,13 +2124,11 @@ static void rtl8723a_enable_rf(struct rtl8xxxu_priv *priv)
        rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00);
 }
 
-static void rtl8723a_disable_rf(struct rtl8xxxu_priv *priv)
+static void rtl8xxxu_gen1_disable_rf(struct rtl8xxxu_priv *priv)
 {
        u8 sps0;
        u32 val32;
 
-       rtl8xxxu_write8(priv, REG_TXPAUSE, 0xff);
-
        sps0 = rtl8xxxu_read8(priv, REG_SPS0_CTRL);
 
        /* RF RX code for preamble power saving */
@@ -1676,7 +2202,10 @@ static int rtl8723a_channel_to_group(int channel)
        return group;
 }
 
-static int rtl8723b_channel_to_group(int channel)
+/*
+ * Valid for rtl8723bu and rtl8192eu
+ */
+static int rtl8xxxu_gen2_channel_to_group(int channel)
 {
        int group;
 
@@ -1694,7 +2223,7 @@ static int rtl8723b_channel_to_group(int channel)
        return group;
 }
 
-static void rtl8723au_config_channel(struct ieee80211_hw *hw)
+static void rtl8xxxu_gen1_config_channel(struct ieee80211_hw *hw)
 {
        struct rtl8xxxu_priv *priv = hw->priv;
        u32 val32, rsr;
@@ -1816,7 +2345,7 @@ static void rtl8723au_config_channel(struct ieee80211_hw *hw)
        }
 }
 
-static void rtl8723bu_config_channel(struct ieee80211_hw *hw)
+static void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw)
 {
        struct rtl8xxxu_priv *priv = hw->priv;
        u32 val32, rsr;
@@ -1947,8 +2476,9 @@ static void rtl8723bu_config_channel(struct ieee80211_hw *hw)
 }
 
 static void
-rtl8723a_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
+rtl8xxxu_gen1_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
 {
+       struct rtl8xxxu_power_base *power_base = priv->power_base;
        u8 cck[RTL8723A_MAX_RF_PATHS], ofdm[RTL8723A_MAX_RF_PATHS];
        u8 ofdmbase[RTL8723A_MAX_RF_PATHS], mcsbase[RTL8723A_MAX_RF_PATHS];
        u32 val32, ofdm_a, ofdm_b, mcs_a, mcs_b;
@@ -1957,11 +2487,22 @@ rtl8723a_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
 
        group = rtl8723a_channel_to_group(channel);
 
-       cck[0] = priv->cck_tx_power_index_A[group];
-       cck[1] = priv->cck_tx_power_index_B[group];
+       cck[0] = priv->cck_tx_power_index_A[group] - 1;
+       cck[1] = priv->cck_tx_power_index_B[group] - 1;
+
+       if (priv->hi_pa) {
+               if (cck[0] > 0x20)
+                       cck[0] = 0x20;
+               if (cck[1] > 0x20)
+                       cck[1] = 0x20;
+       }
 
        ofdm[0] = priv->ht40_1s_tx_power_index_A[group];
        ofdm[1] = priv->ht40_1s_tx_power_index_B[group];
+       if (ofdm[0])
+               ofdm[0] -= 1;
+       if (ofdm[1])
+               ofdm[1] -= 1;
 
        ofdmbase[0] = ofdm[0] + priv->ofdm_tx_power_index_diff[group].a;
        ofdmbase[1] = ofdm[1] + priv->ofdm_tx_power_index_diff[group].b;
@@ -2017,27 +2558,39 @@ rtl8723a_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
                ofdmbase[0] << 16 | ofdmbase[0] << 24;
        ofdm_b = ofdmbase[1] | ofdmbase[1] << 8 |
                ofdmbase[1] << 16 | ofdmbase[1] << 24;
-       rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06, ofdm_a);
-       rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE18_06, ofdm_b);
 
-       rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24, ofdm_a);
-       rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE54_24, ofdm_b);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06,
+                        ofdm_a + power_base->reg_0e00);
+       rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE18_06,
+                        ofdm_b + power_base->reg_0830);
+
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24,
+                        ofdm_a + power_base->reg_0e04);
+       rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE54_24,
+                        ofdm_b + power_base->reg_0834);
 
        mcs_a = mcsbase[0] | mcsbase[0] << 8 |
                mcsbase[0] << 16 | mcsbase[0] << 24;
        mcs_b = mcsbase[1] | mcsbase[1] << 8 |
                mcsbase[1] << 16 | mcsbase[1] << 24;
 
-       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00, mcs_a);
-       rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS03_MCS00, mcs_b);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00,
+                        mcs_a + power_base->reg_0e10);
+       rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS03_MCS00,
+                        mcs_b + power_base->reg_083c);
 
-       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs_a);
-       rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS07_MCS04, mcs_b);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04,
+                        mcs_a + power_base->reg_0e14);
+       rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS07_MCS04,
+                        mcs_b + power_base->reg_0848);
 
-       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS11_MCS08, mcs_a);
-       rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS11_MCS08, mcs_b);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS11_MCS08,
+                        mcs_a + power_base->reg_0e18);
+       rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS11_MCS08,
+                        mcs_b + power_base->reg_084c);
 
-       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12, mcs_a);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12,
+                        mcs_a + power_base->reg_0e1c);
        for (i = 0; i < 3; i++) {
                if (i != 2)
                        val8 = (mcsbase[0] > 8) ? (mcsbase[0] - 8) : 0;
@@ -2045,7 +2598,8 @@ rtl8723a_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
                        val8 = (mcsbase[0] > 6) ? (mcsbase[0] - 6) : 0;
                rtl8xxxu_write8(priv, REG_OFDM0_XC_TX_IQ_IMBALANCE + i, val8);
        }
-       rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS15_MCS12, mcs_b);
+       rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS15_MCS12,
+                        mcs_b + power_base->reg_0868);
        for (i = 0; i < 3; i++) {
                if (i != 2)
                        val8 = (mcsbase[1] > 8) ? (mcsbase[1] - 8) : 0;
@@ -2063,7 +2617,7 @@ rtl8723b_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
        int group, tx_idx;
 
        tx_idx = 0;
-       group = rtl8723b_channel_to_group(channel);
+       group = rtl8xxxu_gen2_channel_to_group(channel);
 
        cck = priv->cck_tx_power_index_B[group];
        val32 = rtl8xxxu_read32(priv, REG_TX_AGC_A_CCK1_MCS32);
@@ -2094,6 +2648,82 @@ rtl8723b_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
        rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs);
 }
 
+static void
+rtl8192e_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
+{
+       u32 val32, ofdm, mcs;
+       u8 cck, ofdmbase, mcsbase;
+       int group, tx_idx;
+
+       tx_idx = 0;
+       group = rtl8xxxu_gen2_channel_to_group(channel);
+
+       cck = priv->cck_tx_power_index_A[group];
+
+       val32 = rtl8xxxu_read32(priv, REG_TX_AGC_A_CCK1_MCS32);
+       val32 &= 0xffff00ff;
+       val32 |= (cck << 8);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_CCK1_MCS32, val32);
+
+       val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11);
+       val32 &= 0xff;
+       val32 |= ((cck << 8) | (cck << 16) | (cck << 24));
+       rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32);
+
+       ofdmbase = priv->ht40_1s_tx_power_index_A[group];
+       ofdmbase += priv->ofdm_tx_power_diff[tx_idx].a;
+       ofdm = ofdmbase | ofdmbase << 8 | ofdmbase << 16 | ofdmbase << 24;
+
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06, ofdm);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24, ofdm);
+
+       mcsbase = priv->ht40_1s_tx_power_index_A[group];
+       if (ht40)
+               mcsbase += priv->ht40_tx_power_diff[tx_idx++].a;
+       else
+               mcsbase += priv->ht20_tx_power_diff[tx_idx++].a;
+       mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24;
+
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00, mcs);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS11_MCS08, mcs);
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12, mcs);
+
+       if (priv->tx_paths > 1) {
+               cck = priv->cck_tx_power_index_B[group];
+
+               val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK1_55_MCS32);
+               val32 &= 0xff;
+               val32 |= ((cck << 8) | (cck << 16) | (cck << 24));
+               rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK1_55_MCS32, val32);
+
+               val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11);
+               val32 &= 0xffffff00;
+               val32 |= cck;
+               rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32);
+
+               ofdmbase = priv->ht40_1s_tx_power_index_B[group];
+               ofdmbase += priv->ofdm_tx_power_diff[tx_idx].b;
+               ofdm = ofdmbase | ofdmbase << 8 |
+                       ofdmbase << 16 | ofdmbase << 24;
+
+               rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE18_06, ofdm);
+               rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE54_24, ofdm);
+
+               mcsbase = priv->ht40_1s_tx_power_index_B[group];
+               if (ht40)
+                       mcsbase += priv->ht40_tx_power_diff[tx_idx++].b;
+               else
+                       mcsbase += priv->ht20_tx_power_diff[tx_idx++].b;
+               mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24;
+
+               rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS03_MCS00, mcs);
+               rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS07_MCS04, mcs);
+               rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS11_MCS08, mcs);
+               rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS15_MCS12, mcs);
+       }
+}
+
 static void rtl8xxxu_set_linktype(struct rtl8xxxu_priv *priv,
                                  enum nl80211_iftype linktype)
 {
@@ -2221,7 +2851,8 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
        } else if (val32 & SYS_CFG_TYPE_ID) {
                bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
                bonding &= HPON_FSM_BONDING_MASK;
-               if (priv->fops->has_s0s1) {
+               if (priv->fops->tx_desc_size ==
+                   sizeof(struct rtl8xxxu_txdesc40)) {
                        if (bonding == HPON_FSM_BONDING_1T2R) {
                                sprintf(priv->chip_name, "8191EU");
                                priv->rf_paths = 2;
@@ -2375,6 +3006,9 @@ static int rtl8723au_parse_efuse(struct rtl8xxxu_priv *priv)
                priv->has_xtalk = 1;
                priv->xtalk = priv->efuse_wifi.efuse8723.xtal_k & 0x3f;
        }
+
+       priv->power_base = &rtl8723a_power_base;
+
        dev_info(&priv->udev->dev, "Vendor: %.7s\n",
                 efuse->vendor_name);
        dev_info(&priv->udev->dev, "Product: %.41s\n",
@@ -2507,9 +3141,14 @@ static int rtl8192cu_parse_efuse(struct rtl8xxxu_priv *priv)
        dev_info(&priv->udev->dev, "Product: %.20s\n",
                 efuse->device_name);
 
+       priv->power_base = &rtl8192c_power_base;
+
        if (efuse->rf_regulatory & 0x20) {
                sprintf(priv->chip_name, "8188RU");
+               priv->rtl_chip = RTL8188R;
                priv->hi_pa = 1;
+               priv->no_pape = 1;
+               priv->power_base = &rtl8188r_power_base;
        }
 
        if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) {
@@ -2541,6 +3180,43 @@ static int rtl8192eu_parse_efuse(struct rtl8xxxu_priv *priv)
 
        ether_addr_copy(priv->mac_addr, efuse->mac_addr);
 
+       memcpy(priv->cck_tx_power_index_A, efuse->tx_power_index_A.cck_base,
+              sizeof(efuse->tx_power_index_A.cck_base));
+       memcpy(priv->cck_tx_power_index_B, efuse->tx_power_index_B.cck_base,
+              sizeof(efuse->tx_power_index_B.cck_base));
+
+       memcpy(priv->ht40_1s_tx_power_index_A,
+              efuse->tx_power_index_A.ht40_base,
+              sizeof(efuse->tx_power_index_A.ht40_base));
+       memcpy(priv->ht40_1s_tx_power_index_B,
+              efuse->tx_power_index_B.ht40_base,
+              sizeof(efuse->tx_power_index_B.ht40_base));
+
+       priv->ht20_tx_power_diff[0].a =
+               efuse->tx_power_index_A.ht20_ofdm_1s_diff.b;
+       priv->ht20_tx_power_diff[0].b =
+               efuse->tx_power_index_B.ht20_ofdm_1s_diff.b;
+
+       priv->ht40_tx_power_diff[0].a = 0;
+       priv->ht40_tx_power_diff[0].b = 0;
+
+       for (i = 1; i < RTL8723B_TX_COUNT; i++) {
+               priv->ofdm_tx_power_diff[i].a =
+                       efuse->tx_power_index_A.pwr_diff[i - 1].ofdm;
+               priv->ofdm_tx_power_diff[i].b =
+                       efuse->tx_power_index_B.pwr_diff[i - 1].ofdm;
+
+               priv->ht20_tx_power_diff[i].a =
+                       efuse->tx_power_index_A.pwr_diff[i - 1].ht20;
+               priv->ht20_tx_power_diff[i].b =
+                       efuse->tx_power_index_B.pwr_diff[i - 1].ht20;
+
+               priv->ht40_tx_power_diff[i].a =
+                       efuse->tx_power_index_A.pwr_diff[i - 1].ht40;
+               priv->ht40_tx_power_diff[i].b =
+                       efuse->tx_power_index_B.pwr_diff[i - 1].ht40;
+       }
+
        priv->has_xtalk = 1;
        priv->xtalk = priv->efuse_wifi.efuse8192eu.xtal_k & 0x3f;
 
@@ -2562,10 +3238,6 @@ static int rtl8192eu_parse_efuse(struct rtl8xxxu_priv *priv)
                                 raw[i + 6], raw[i + 7]);
                }
        }
-       /*
-        * Temporarily disable 8192eu support
-        */
-       return -EINVAL;
        return 0;
 }
 
@@ -3052,9 +3724,9 @@ static void rtl8723bu_phy_init_antenna_selection(struct rtl8xxxu_priv *priv)
 {
        u32 val32;
 
-       val32 = rtl8xxxu_read32(priv, 0x64);
+       val32 = rtl8xxxu_read32(priv, REG_PAD_CTRL1);
        val32 &= ~(BIT(20) | BIT(24));
-       rtl8xxxu_write32(priv, 0x64, val32);
+       rtl8xxxu_write32(priv, REG_PAD_CTRL1, val32);
 
        val32 = rtl8xxxu_read32(priv, REG_GPIO_MUXCFG);
        val32 &= ~BIT(4);
@@ -3087,8 +3759,9 @@ static void rtl8723bu_phy_init_antenna_selection(struct rtl8xxxu_priv *priv)
 }
 
 static int
-rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv, struct rtl8xxxu_reg8val *array)
+rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv)
 {
+       struct rtl8xxxu_reg8val *array = priv->fops->mactable;
        int i, ret;
        u16 reg;
        u8 val;
@@ -3103,12 +3776,13 @@ rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv, struct rtl8xxxu_reg8val *array)
                ret = rtl8xxxu_write8(priv, reg, val);
                if (ret != 1) {
                        dev_warn(&priv->udev->dev,
-                                "Failed to initialize MAC\n");
+                                "Failed to initialize MAC "
+                                "(reg: %04x, val %02x)\n", reg, val);
                        return -EAGAIN;
                }
        }
 
-       if (priv->rtl_chip != RTL8723B)
+       if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E)
                rtl8xxxu_write8(priv, REG_MAX_AGGR_NUM, 0x0a);
 
        return 0;
@@ -3140,50 +3814,30 @@ static int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
        return 0;
 }
 
-/*
- * Most of this is black magic retrieved from the old rtl8723au driver
- */
-static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv)
+static void rtl8xxxu_gen1_init_phy_bb(struct rtl8xxxu_priv *priv)
 {
        u8 val8, ldoa15, ldov12d, lpldo, ldohci12;
        u16 val16;
        u32 val32;
 
-       /*
-        * Todo: The vendor driver maintains a table of PHY register
-        *       addresses, which is initialized here. Do we need this?
-        */
-
-       if (priv->rtl_chip == RTL8723B) {
-               val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC);
-               val16 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB |
-                       SYS_FUNC_DIO_RF;
-               rtl8xxxu_write16(priv, REG_SYS_FUNC, val16);
-
-               rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x00);
-       } else {
-               val8 = rtl8xxxu_read8(priv, REG_AFE_PLL_CTRL);
-               udelay(2);
-               val8 |= AFE_PLL_320_ENABLE;
-               rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL, val8);
-               udelay(2);
+       val8 = rtl8xxxu_read8(priv, REG_AFE_PLL_CTRL);
+       udelay(2);
+       val8 |= AFE_PLL_320_ENABLE;
+       rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL, val8);
+       udelay(2);
 
-               rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL + 1, 0xff);
-               udelay(2);
+       rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL + 1, 0xff);
+       udelay(2);
 
-               val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC);
-               val16 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB;
-               rtl8xxxu_write16(priv, REG_SYS_FUNC, val16);
-       }
+       val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC);
+       val16 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB;
+       rtl8xxxu_write16(priv, REG_SYS_FUNC, val16);
 
-       if (priv->rtl_chip != RTL8723B) {
-               /* AFE_XTAL_RF_GATE (bit 14) if addressing as 32 bit register */
-               val32 = rtl8xxxu_read32(priv, REG_AFE_XTAL_CTRL);
-               val32 &= ~AFE_XTAL_RF_GATE;
-               if (priv->has_bluetooth)
-                       val32 &= ~AFE_XTAL_BT_GATE;
-               rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32);
-       }
+       val32 = rtl8xxxu_read32(priv, REG_AFE_XTAL_CTRL);
+       val32 &= ~AFE_XTAL_RF_GATE;
+       if (priv->has_bluetooth)
+               val32 &= ~AFE_XTAL_BT_GATE;
+       rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32);
 
        /* 6. 0x1f[7:0] = 0x07 */
        val8 = RF_ENABLE | RF_RSTB | RF_SDMRSTB;
@@ -3193,43 +3847,110 @@ static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv)
                rtl8xxxu_init_phy_regs(priv, rtl8188ru_phy_1t_highpa_table);
        else if (priv->tx_paths == 2)
                rtl8xxxu_init_phy_regs(priv, rtl8192cu_phy_2t_init_table);
-       else if (priv->rtl_chip == RTL8723B) {
-               /*
-                * Why?
-                */
-               rtl8xxxu_write8(priv, REG_SYS_FUNC, 0xe3);
-               rtl8xxxu_write8(priv, REG_AFE_XTAL_CTRL + 1, 0x80);
-               rtl8xxxu_init_phy_regs(priv, rtl8723b_phy_1t_init_table);
-       } else
+       else
                rtl8xxxu_init_phy_regs(priv, rtl8723a_phy_1t_init_table);
 
-
-       if (priv->rtl_chip == RTL8188C && priv->hi_pa &&
+       if (priv->rtl_chip == RTL8188R && priv->hi_pa &&
            priv->vendor_umc && priv->chip_cut == 1)
                rtl8xxxu_write8(priv, REG_OFDM0_AGC_PARM1 + 2, 0x50);
 
-       if (priv->tx_paths == 1 && priv->rx_paths == 2) {
-               /*
-                * For 1T2R boards, patch the registers.
-                *
-                * It looks like 8191/2 1T2R boards use path B for TX
-                */
-               val32 = rtl8xxxu_read32(priv, REG_FPGA0_TX_INFO);
-               val32 &= ~(BIT(0) | BIT(1));
-               val32 |= BIT(1);
-               rtl8xxxu_write32(priv, REG_FPGA0_TX_INFO, val32);
+       if (priv->hi_pa)
+               rtl8xxxu_init_phy_regs(priv, rtl8xxx_agc_highpa_table);
+       else
+               rtl8xxxu_init_phy_regs(priv, rtl8xxx_agc_standard_table);
 
-               val32 = rtl8xxxu_read32(priv, REG_FPGA1_TX_INFO);
-               val32 &= ~0x300033;
-               val32 |= 0x200022;
-               rtl8xxxu_write32(priv, REG_FPGA1_TX_INFO, val32);
+       ldoa15 = LDOA15_ENABLE | LDOA15_OBUF;
+       ldov12d = LDOV12D_ENABLE | BIT(2) | (2 << LDOV12D_VADJ_SHIFT);
+       ldohci12 = 0x57;
+       lpldo = 1;
+       val32 = (lpldo << 24) | (ldohci12 << 16) | (ldov12d << 8) | ldoa15;
+       rtl8xxxu_write32(priv, REG_LDOA15_CTRL, val32);
+}
 
-               val32 = rtl8xxxu_read32(priv, REG_CCK0_AFE_SETTING);
-               val32 &= 0xff000000;
-               val32 |= 0x45000000;
-               rtl8xxxu_write32(priv, REG_CCK0_AFE_SETTING, val32);
+static void rtl8723bu_init_phy_bb(struct rtl8xxxu_priv *priv)
+{
+       u8 val8;
+       u16 val16;
 
-               val32 = rtl8xxxu_read32(priv, REG_OFDM0_TRX_PATH_ENABLE);
+       val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC);
+       val16 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB | SYS_FUNC_DIO_RF;
+       rtl8xxxu_write16(priv, REG_SYS_FUNC, val16);
+
+       rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x00);
+
+       /* 6. 0x1f[7:0] = 0x07 */
+       val8 = RF_ENABLE | RF_RSTB | RF_SDMRSTB;
+       rtl8xxxu_write8(priv, REG_RF_CTRL, val8);
+
+       /* Why? */
+       rtl8xxxu_write8(priv, REG_SYS_FUNC, 0xe3);
+       rtl8xxxu_write8(priv, REG_AFE_XTAL_CTRL + 1, 0x80);
+       rtl8xxxu_init_phy_regs(priv, rtl8723b_phy_1t_init_table);
+
+       rtl8xxxu_init_phy_regs(priv, rtl8xxx_agc_8723bu_table);
+}
+
+static void rtl8192eu_init_phy_bb(struct rtl8xxxu_priv *priv)
+{
+       u8 val8;
+       u16 val16;
+
+       val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC);
+       val16 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB | SYS_FUNC_DIO_RF;
+       rtl8xxxu_write16(priv, REG_SYS_FUNC, val16);
+
+       /* 6. 0x1f[7:0] = 0x07 */
+       val8 = RF_ENABLE | RF_RSTB | RF_SDMRSTB;
+       rtl8xxxu_write8(priv, REG_RF_CTRL, val8);
+
+       val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC);
+       val16 |= (SYS_FUNC_USBA | SYS_FUNC_USBD | SYS_FUNC_DIO_RF |
+                 SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB);
+       rtl8xxxu_write16(priv, REG_SYS_FUNC, val16);
+       val8 = RF_ENABLE | RF_RSTB | RF_SDMRSTB;
+       rtl8xxxu_write8(priv, REG_RF_CTRL, val8);
+       rtl8xxxu_init_phy_regs(priv, rtl8192eu_phy_init_table);
+
+       if (priv->hi_pa)
+               rtl8xxxu_init_phy_regs(priv, rtl8xxx_agc_8192eu_highpa_table);
+       else
+               rtl8xxxu_init_phy_regs(priv, rtl8xxx_agc_8192eu_std_table);
+}
+
+/*
+ * Most of this is black magic retrieved from the old rtl8723au driver
+ */
+static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv)
+{
+       u8 val8;
+       u32 val32;
+
+       priv->fops->init_phy_bb(priv);
+
+       if (priv->tx_paths == 1 && priv->rx_paths == 2) {
+               /*
+                * For 1T2R boards, patch the registers.
+                *
+                * It looks like 8191/2 1T2R boards use path B for TX
+                */
+               val32 = rtl8xxxu_read32(priv, REG_FPGA0_TX_INFO);
+               val32 &= ~(BIT(0) | BIT(1));
+               val32 |= BIT(1);
+               rtl8xxxu_write32(priv, REG_FPGA0_TX_INFO, val32);
+
+               val32 = rtl8xxxu_read32(priv, REG_FPGA1_TX_INFO);
+               val32 &= ~0x300033;
+               val32 |= 0x200022;
+               rtl8xxxu_write32(priv, REG_FPGA1_TX_INFO, val32);
+
+               val32 = rtl8xxxu_read32(priv, REG_CCK0_AFE_SETTING);
+               val32 &= ~CCK0_AFE_RX_MASK;
+               val32 &= 0x00ffffff;
+               val32 |= 0x40000000;
+               val32 |= CCK0_AFE_RX_ANT_B;
+               rtl8xxxu_write32(priv, REG_CCK0_AFE_SETTING, val32);
+
+               val32 = rtl8xxxu_read32(priv, REG_OFDM0_TRX_PATH_ENABLE);
                val32 &= ~(OFDM_RF_PATH_RX_MASK | OFDM_RF_PATH_TX_MASK);
                val32 |= (OFDM_RF_PATH_RX_A | OFDM_RF_PATH_RX_B |
                          OFDM_RF_PATH_TX_B);
@@ -3266,13 +3987,6 @@ static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv)
                rtl8xxxu_write32(priv, REG_TX_TO_TX, val32);
        }
 
-       if (priv->rtl_chip == RTL8723B)
-               rtl8xxxu_init_phy_regs(priv, rtl8xxx_agc_8723bu_table);
-       else if (priv->hi_pa)
-               rtl8xxxu_init_phy_regs(priv, rtl8xxx_agc_highpa_table);
-       else
-               rtl8xxxu_init_phy_regs(priv, rtl8xxx_agc_standard_table);
-
        if (priv->has_xtalk) {
                val32 = rtl8xxxu_read32(priv, REG_MAC_PHY_CTRL);
 
@@ -3283,16 +3997,8 @@ static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv)
                rtl8xxxu_write32(priv, REG_MAC_PHY_CTRL, val32);
        }
 
-       if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E) {
-               ldoa15 = LDOA15_ENABLE | LDOA15_OBUF;
-               ldov12d = LDOV12D_ENABLE | BIT(2) | (2 << LDOV12D_VADJ_SHIFT);
-               ldohci12 = 0x57;
-               lpldo = 1;
-               val32 = (lpldo << 24) | (ldohci12 << 16) |
-                       (ldov12d << 8) | ldoa15;
-
-               rtl8xxxu_write32(priv, REG_LDOA15_CTRL, val32);
-       }
+       if (priv->rtl_chip == RTL8192E)
+               rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, 0x000f81fb);
 
        return 0;
 }
@@ -3410,6 +4116,77 @@ static int rtl8xxxu_init_phy_rf(struct rtl8xxxu_priv *priv,
        return 0;
 }
 
+static int rtl8723au_init_phy_rf(struct rtl8xxxu_priv *priv)
+{
+       int ret;
+
+       ret = rtl8xxxu_init_phy_rf(priv, rtl8723au_radioa_1t_init_table, RF_A);
+
+       /* Reduce 80M spur */
+       rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, 0x0381808d);
+       rtl8xxxu_write32(priv, REG_AFE_PLL_CTRL, 0xf0ffff83);
+       rtl8xxxu_write32(priv, REG_AFE_PLL_CTRL, 0xf0ffff82);
+       rtl8xxxu_write32(priv, REG_AFE_PLL_CTRL, 0xf0ffff83);
+
+       return ret;
+}
+
+static int rtl8723bu_init_phy_rf(struct rtl8xxxu_priv *priv)
+{
+       int ret;
+
+       ret = rtl8xxxu_init_phy_rf(priv, rtl8723bu_radioa_1t_init_table, RF_A);
+       /*
+        * PHY LCK
+        */
+       rtl8xxxu_write_rfreg(priv, RF_A, 0xb0, 0xdfbe0);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_MODE_AG, 0x8c01);
+       msleep(200);
+       rtl8xxxu_write_rfreg(priv, RF_A, 0xb0, 0xdffe0);
+
+       return ret;
+}
+
+#ifdef CONFIG_RTL8XXXU_UNTESTED
+static int rtl8192cu_init_phy_rf(struct rtl8xxxu_priv *priv)
+{
+       struct rtl8xxxu_rfregval *rftable;
+       int ret;
+
+       if (priv->rtl_chip == RTL8188R) {
+               rftable = rtl8188ru_radioa_1t_highpa_table;
+               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_A);
+       } else if (priv->rf_paths == 1) {
+               rftable = rtl8192cu_radioa_1t_init_table;
+               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_A);
+       } else {
+               rftable = rtl8192cu_radioa_2t_init_table;
+               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_A);
+               if (ret)
+                       goto exit;
+               rftable = rtl8192cu_radiob_2t_init_table;
+               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_B);
+       }
+
+exit:
+       return ret;
+}
+#endif
+
+static int rtl8192eu_init_phy_rf(struct rtl8xxxu_priv *priv)
+{
+       int ret;
+
+       ret = rtl8xxxu_init_phy_rf(priv, rtl8192eu_radioa_init_table, RF_A);
+       if (ret)
+               goto exit;
+
+       ret = rtl8xxxu_init_phy_rf(priv, rtl8192eu_radiob_init_table, RF_B);
+
+exit:
+       return ret;
+}
+
 static int rtl8xxxu_llt_write(struct rtl8xxxu_priv *priv, u8 address, u8 data)
 {
        int ret = -EBUSY;
@@ -3818,8 +4595,8 @@ static bool rtl8xxxu_simularity_compare(struct rtl8xxxu_priv *priv,
        return false;
 }
 
-static bool rtl8723bu_simularity_compare(struct rtl8xxxu_priv *priv,
-                                        int result[][8], int c1, int c2)
+static bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv,
+                                            int result[][8], int c1, int c2)
 {
        u32 i, j, diff, simubitmap, bound = 0;
        int candidate[2] = {-1, -1};    /* for path A and path B */
@@ -4389,138 +5166,425 @@ out:
        return result;
 }
 
-#ifdef RTL8723BU_PATH_B
-static int rtl8723bu_iqk_path_b(struct rtl8xxxu_priv *priv)
+static int rtl8192eu_iqk_path_a(struct rtl8xxxu_priv *priv)
 {
-       u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc, path_sel;
+       u32 reg_eac, reg_e94, reg_e9c;
        int result = 0;
 
-       path_sel = rtl8xxxu_read32(priv, REG_S0S1_PATH_SWITCH);
+       /*
+        * TX IQK
+        * PA/PAD controlled by 0x0
+        */
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x00180);
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
 
-       val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
-       val32 &= 0x000000ff;
-       rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
+       /* Path A IQK setting */
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x18008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_B, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_B, 0x38008c1c);
 
-       /* One shot, path B LOK & IQK */
-       rtl8xxxu_write32(priv, REG_IQK_AGC_CONT, 0x00000002);
-       rtl8xxxu_write32(priv, REG_IQK_AGC_CONT, 0x00000000);
+       rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82140303);
+       rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x68160000);
 
-       mdelay(1);
+       /* LO calibration setting */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x00462911);
+
+       /* One shot, path A LOK & IQK */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000);
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000);
+
+       mdelay(10);
 
        /* Check failed */
        reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2);
-       reg_eb4 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B);
-       reg_ebc = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B);
-       reg_ec4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_B_2);
-       reg_ecc = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_B_2);
+       reg_e94 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_A);
+       reg_e9c = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_A);
 
-       if (!(reg_eac & BIT(31)) &&
-           ((reg_eb4 & 0x03ff0000) != 0x01420000) &&
-           ((reg_ebc & 0x03ff0000) != 0x00420000))
+       if (!(reg_eac & BIT(28)) &&
+           ((reg_e94 & 0x03ff0000) != 0x01420000) &&
+           ((reg_e9c & 0x03ff0000) != 0x00420000))
                result |= 0x01;
-       else
-               goto out;
 
-       if (!(reg_eac & BIT(30)) &&
-           (((reg_ec4 & 0x03ff0000) >> 16) != 0x132) &&
-           (((reg_ecc & 0x03ff0000) >> 16) != 0x36))
-               result |= 0x02;
-       else
-               dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n",
-                        __func__);
-out:
        return result;
 }
-#endif
 
-static void rtl8xxxu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,
-                                    int result[][8], int t)
+static int rtl8192eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 {
-       struct device *dev = &priv->udev->dev;
-       u32 i, val32;
-       int path_a_ok, path_b_ok;
-       int retry = 2;
-       const u32 adda_regs[RTL8XXXU_ADDA_REGS] = {
-               REG_FPGA0_XCD_SWITCH_CTRL, REG_BLUETOOTH,
-               REG_RX_WAIT_CCA, REG_TX_CCK_RFON,
-               REG_TX_CCK_BBON, REG_TX_OFDM_RFON,
-               REG_TX_OFDM_BBON, REG_TX_TO_RX,
-               REG_TX_TO_TX, REG_RX_CCK,
-               REG_RX_OFDM, REG_RX_WAIT_RIFS,
-               REG_RX_TO_RX, REG_STANDBY,
-               REG_SLEEP, REG_PMPD_ANAEN
-       };
-       const u32 iqk_mac_regs[RTL8XXXU_MAC_REGS] = {
-               REG_TXPAUSE, REG_BEACON_CTRL,
-               REG_BEACON_CTRL_1, REG_GPIO_MUXCFG
-       };
-       const u32 iqk_bb_regs[RTL8XXXU_BB_REGS] = {
-               REG_OFDM0_TRX_PATH_ENABLE, REG_OFDM0_TR_MUX_PAR,
-               REG_FPGA0_XCD_RF_SW_CTRL, REG_CONFIG_ANT_A, REG_CONFIG_ANT_B,
-               REG_FPGA0_XAB_RF_SW_CTRL, REG_FPGA0_XA_RF_INT_OE,
-               REG_FPGA0_XB_RF_INT_OE, REG_FPGA0_RF_MODE
-       };
-
-       /*
-        * Note: IQ calibration must be performed after loading
-        *       PHY_REG.txt , and radio_a, radio_b.txt
-        */
+       u32 reg_ea4, reg_eac, reg_e94, reg_e9c, val32;
+       int result = 0;
 
-       if (t == 0) {
-               /* Save ADDA parameters, turn Path A ADDA on */
-               rtl8xxxu_save_regs(priv, adda_regs, priv->adda_backup,
-                                  RTL8XXXU_ADDA_REGS);
-               rtl8xxxu_save_mac_regs(priv, iqk_mac_regs, priv->mac_backup);
-               rtl8xxxu_save_regs(priv, iqk_bb_regs,
-                                  priv->bb_backup, RTL8XXXU_BB_REGS);
-       }
+       /* Leave IQK mode */
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00);
 
-       rtl8xxxu_path_adda_on(priv, adda_regs, true);
+       /* Enable path A PA in TX IQK mode */
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, 0x800a0);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0000f);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf117b);
 
-       if (t == 0) {
-               val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_HSSI_PARM1);
-               if (val32 & FPGA0_HSSI_PARM1_PI)
-                       priv->pi_enabled = 1;
-       }
+       /* PA/PAD control by 0x56, and set = 0x0 */
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x00980);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_56, 0x51000);
 
-       if (!priv->pi_enabled) {
-               /* Switch BB to PI mode to do IQ Calibration. */
-               rtl8xxxu_write32(priv, REG_FPGA0_XA_HSSI_PARM1, 0x01000100);
-               rtl8xxxu_write32(priv, REG_FPGA0_XB_HSSI_PARM1, 0x01000100);
-       }
+       /* Enter IQK mode */
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
 
-       val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE);
-       val32 &= ~FPGA_RF_MODE_CCK;
-       rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32);
+       /* TX IQK setting */
+       rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00);
+       rtl8xxxu_write32(priv, REG_RX_IQK, 0x01004800);
 
-       rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, 0x03a05600);
-       rtl8xxxu_write32(priv, REG_OFDM0_TR_MUX_PAR, 0x000800e4);
-       rtl8xxxu_write32(priv, REG_FPGA0_XCD_RF_SW_CTRL, 0x22204000);
+       /* path-A IQK setting */
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x18008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_B, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_B, 0x38008c1c);
 
-       val32 = rtl8xxxu_read32(priv, REG_FPGA0_XAB_RF_SW_CTRL);
-       val32 |= (FPGA0_RF_PAPE | (FPGA0_RF_PAPE << FPGA0_RF_BD_CTRL_SHIFT));
-       rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32);
+       rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82160c1f);
+       rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x68160c1f);
 
-       val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_RF_INT_OE);
-       val32 &= ~BIT(10);
-       rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, val32);
-       val32 = rtl8xxxu_read32(priv, REG_FPGA0_XB_RF_INT_OE);
-       val32 &= ~BIT(10);
-       rtl8xxxu_write32(priv, REG_FPGA0_XB_RF_INT_OE, val32);
+       /* LO calibration setting */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a911);
 
-       if (priv->tx_paths > 1) {
-               rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00010000);
-               rtl8xxxu_write32(priv, REG_FPGA0_XB_LSSI_PARM, 0x00010000);
-       }
+       /* One shot, path A LOK & IQK */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xfa000000);
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000);
 
-       /* MAC settings */
-       rtl8xxxu_mac_calibration(priv, iqk_mac_regs, priv->mac_backup);
+       mdelay(10);
 
-       /* Page B init */
-       rtl8xxxu_write32(priv, REG_CONFIG_ANT_A, 0x00080000);
+       /* Check failed */
+       reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2);
+       reg_e94 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_A);
+       reg_e9c = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_A);
 
-       if (priv->tx_paths > 1)
-               rtl8xxxu_write32(priv, REG_CONFIG_ANT_B, 0x00080000);
+       if (!(reg_eac & BIT(28)) &&
+           ((reg_e94 & 0x03ff0000) != 0x01420000) &&
+           ((reg_e9c & 0x03ff0000) != 0x00420000)) {
+               result |= 0x01;
+       } else {
+               /* PA/PAD controlled by 0x0 */
+               rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+               rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x180);
+               goto out;
+       }
+
+       val32 = 0x80007c00 |
+               (reg_e94 & 0x03ff0000) | ((reg_e9c >> 16) & 0x03ff);
+       rtl8xxxu_write32(priv, REG_TX_IQK, val32);
+
+       /* Modify RX IQK mode table */
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, 0x800a0);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0000f);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf7ffa);
+
+       /* PA/PAD control by 0x56, and set = 0x0 */
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x00980);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_56, 0x51000);
+
+       /* Enter IQK mode */
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
+
+       /* IQK setting */
+       rtl8xxxu_write32(priv, REG_RX_IQK, 0x01004800);
+
+       /* Path A IQK setting */
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x18008c1c);
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_B, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_B, 0x38008c1c);
+
+       rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82160c1f);
+       rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160c1f);
+
+       /* LO calibration setting */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a891);
+
+       /* One shot, path A LOK & IQK */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xfa000000);
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000);
+
+       mdelay(10);
+
+       reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2);
+       reg_ea4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_A_2);
+
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x180);
+
+       if (!(reg_eac & BIT(27)) &&
+           ((reg_ea4 & 0x03ff0000) != 0x01320000) &&
+           ((reg_eac & 0x03ff0000) != 0x00360000))
+               result |= 0x02;
+       else
+               dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n",
+                        __func__);
+
+out:
+       return result;
+}
+
+static int rtl8192eu_iqk_path_b(struct rtl8xxxu_priv *priv)
+{
+       u32 reg_eac, reg_eb4, reg_ebc;
+       int result = 0;
+
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_UNKNOWN_DF, 0x00180);
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
+
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
+
+       /* Path B IQK setting */
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_B, 0x18008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_B, 0x38008c1c);
+
+       rtl8xxxu_write32(priv, REG_TX_IQK_PI_B, 0x821403e2);
+       rtl8xxxu_write32(priv, REG_RX_IQK_PI_B, 0x68160000);
+
+       /* LO calibration setting */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x00492911);
+
+       /* One shot, path A LOK & IQK */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xfa000000);
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000);
+
+       mdelay(1);
+
+       /* Check failed */
+       reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2);
+       reg_eb4 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B);
+       reg_ebc = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B);
+
+       if (!(reg_eac & BIT(31)) &&
+           ((reg_eb4 & 0x03ff0000) != 0x01420000) &&
+           ((reg_ebc & 0x03ff0000) != 0x00420000))
+               result |= 0x01;
+       else
+               dev_warn(&priv->udev->dev, "%s: Path B IQK failed!\n",
+                        __func__);
+
+       return result;
+}
+
+static int rtl8192eu_rx_iqk_path_b(struct rtl8xxxu_priv *priv)
+{
+       u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc, val32;
+       int result = 0;
+
+       /* Leave IQK mode */
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+
+       /* Enable path A PA in TX IQK mode */
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_WE_LUT, 0x800a0);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_RCK_OS, 0x30000);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_TXPA_G1, 0x0000f);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_TXPA_G2, 0xf117b);
+
+       /* PA/PAD control by 0x56, and set = 0x0 */
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_UNKNOWN_DF, 0x00980);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_UNKNOWN_56, 0x51000);
+
+       /* Enter IQK mode */
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
+
+       /* TX IQK setting */
+       rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00);
+       rtl8xxxu_write32(priv, REG_RX_IQK, 0x01004800);
+
+       /* path-A IQK setting */
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_B, 0x18008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_B, 0x38008c1c);
+
+       rtl8xxxu_write32(priv, REG_TX_IQK_PI_B, 0x82160c1f);
+       rtl8xxxu_write32(priv, REG_RX_IQK_PI_B, 0x68160c1f);
+
+       /* LO calibration setting */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a911);
+
+       /* One shot, path A LOK & IQK */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xfa000000);
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000);
+
+       mdelay(10);
+
+       /* Check failed */
+       reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2);
+       reg_eb4 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B);
+       reg_ebc = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B);
+
+       if (!(reg_eac & BIT(31)) &&
+           ((reg_eb4 & 0x03ff0000) != 0x01420000) &&
+           ((reg_ebc & 0x03ff0000) != 0x00420000)) {
+               result |= 0x01;
+       } else {
+               /*
+                * PA/PAD controlled by 0x0
+                * Vendor driver restores RF_A here which I believe is a bug
+                */
+               rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+               rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_UNKNOWN_DF, 0x180);
+               goto out;
+       }
+
+       val32 = 0x80007c00 |
+               (reg_eb4 & 0x03ff0000) | ((reg_ebc >> 16) & 0x03ff);
+       rtl8xxxu_write32(priv, REG_TX_IQK, val32);
+
+       /* Modify RX IQK mode table */
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_WE_LUT, 0x800a0);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_RCK_OS, 0x30000);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_TXPA_G1, 0x0000f);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_TXPA_G2, 0xf7ffa);
+
+       /* PA/PAD control by 0x56, and set = 0x0 */
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_UNKNOWN_DF, 0x00980);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_UNKNOWN_56, 0x51000);
+
+       /* Enter IQK mode */
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
+
+       /* IQK setting */
+       rtl8xxxu_write32(priv, REG_RX_IQK, 0x01004800);
+
+       /* Path A IQK setting */
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_TX_IQK_TONE_B, 0x38008c1c);
+       rtl8xxxu_write32(priv, REG_RX_IQK_TONE_B, 0x18008c1c);
+
+       rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82160c1f);
+       rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160c1f);
+
+       /* LO calibration setting */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a891);
+
+       /* One shot, path A LOK & IQK */
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xfa000000);
+       rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000);
+
+       mdelay(10);
+
+       reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2);
+       reg_ec4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_B_2);
+       reg_ecc = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_B_2);
+
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
+       rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_UNKNOWN_DF, 0x180);
+
+       if (!(reg_eac & BIT(30)) &&
+           ((reg_ec4 & 0x03ff0000) != 0x01320000) &&
+           ((reg_ecc & 0x03ff0000) != 0x00360000))
+               result |= 0x02;
+       else
+               dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n",
+                        __func__);
+
+out:
+       return result;
+}
+
+static void rtl8xxxu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,
+                                    int result[][8], int t)
+{
+       struct device *dev = &priv->udev->dev;
+       u32 i, val32;
+       int path_a_ok, path_b_ok;
+       int retry = 2;
+       const u32 adda_regs[RTL8XXXU_ADDA_REGS] = {
+               REG_FPGA0_XCD_SWITCH_CTRL, REG_BLUETOOTH,
+               REG_RX_WAIT_CCA, REG_TX_CCK_RFON,
+               REG_TX_CCK_BBON, REG_TX_OFDM_RFON,
+               REG_TX_OFDM_BBON, REG_TX_TO_RX,
+               REG_TX_TO_TX, REG_RX_CCK,
+               REG_RX_OFDM, REG_RX_WAIT_RIFS,
+               REG_RX_TO_RX, REG_STANDBY,
+               REG_SLEEP, REG_PMPD_ANAEN
+       };
+       const u32 iqk_mac_regs[RTL8XXXU_MAC_REGS] = {
+               REG_TXPAUSE, REG_BEACON_CTRL,
+               REG_BEACON_CTRL_1, REG_GPIO_MUXCFG
+       };
+       const u32 iqk_bb_regs[RTL8XXXU_BB_REGS] = {
+               REG_OFDM0_TRX_PATH_ENABLE, REG_OFDM0_TR_MUX_PAR,
+               REG_FPGA0_XCD_RF_SW_CTRL, REG_CONFIG_ANT_A, REG_CONFIG_ANT_B,
+               REG_FPGA0_XAB_RF_SW_CTRL, REG_FPGA0_XA_RF_INT_OE,
+               REG_FPGA0_XB_RF_INT_OE, REG_FPGA0_RF_MODE
+       };
+
+       /*
+        * Note: IQ calibration must be performed after loading
+        *       PHY_REG.txt , and radio_a, radio_b.txt
+        */
+
+       if (t == 0) {
+               /* Save ADDA parameters, turn Path A ADDA on */
+               rtl8xxxu_save_regs(priv, adda_regs, priv->adda_backup,
+                                  RTL8XXXU_ADDA_REGS);
+               rtl8xxxu_save_mac_regs(priv, iqk_mac_regs, priv->mac_backup);
+               rtl8xxxu_save_regs(priv, iqk_bb_regs,
+                                  priv->bb_backup, RTL8XXXU_BB_REGS);
+       }
+
+       rtl8xxxu_path_adda_on(priv, adda_regs, true);
+
+       if (t == 0) {
+               val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_HSSI_PARM1);
+               if (val32 & FPGA0_HSSI_PARM1_PI)
+                       priv->pi_enabled = 1;
+       }
+
+       if (!priv->pi_enabled) {
+               /* Switch BB to PI mode to do IQ Calibration. */
+               rtl8xxxu_write32(priv, REG_FPGA0_XA_HSSI_PARM1, 0x01000100);
+               rtl8xxxu_write32(priv, REG_FPGA0_XB_HSSI_PARM1, 0x01000100);
+       }
+
+       val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE);
+       val32 &= ~FPGA_RF_MODE_CCK;
+       rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32);
+
+       rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, 0x03a05600);
+       rtl8xxxu_write32(priv, REG_OFDM0_TR_MUX_PAR, 0x000800e4);
+       rtl8xxxu_write32(priv, REG_FPGA0_XCD_RF_SW_CTRL, 0x22204000);
+
+       if (!priv->no_pape) {
+               val32 = rtl8xxxu_read32(priv, REG_FPGA0_XAB_RF_SW_CTRL);
+               val32 |= (FPGA0_RF_PAPE |
+                         (FPGA0_RF_PAPE << FPGA0_RF_BD_CTRL_SHIFT));
+               rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32);
+       }
+
+       val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_RF_INT_OE);
+       val32 &= ~BIT(10);
+       rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, val32);
+       val32 = rtl8xxxu_read32(priv, REG_FPGA0_XB_RF_INT_OE);
+       val32 &= ~BIT(10);
+       rtl8xxxu_write32(priv, REG_FPGA0_XB_RF_INT_OE, val32);
+
+       if (priv->tx_paths > 1) {
+               rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00010000);
+               rtl8xxxu_write32(priv, REG_FPGA0_XB_LSSI_PARM, 0x00010000);
+       }
+
+       /* MAC settings */
+       rtl8xxxu_mac_calibration(priv, iqk_mac_regs, priv->mac_backup);
+
+       /* Page B init */
+       rtl8xxxu_write32(priv, REG_CONFIG_ANT_A, 0x00080000);
+
+       if (priv->tx_paths > 1)
+               rtl8xxxu_write32(priv, REG_CONFIG_ANT_B, 0x00080000);
 
        /* IQ calibration setting */
        rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
@@ -4692,55 +5756,232 @@ static void rtl8723bu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,
        rtl8xxxu_write32(priv, REG_OFDM0_TR_MUX_PAR, 0x000800e4);
        rtl8xxxu_write32(priv, REG_FPGA0_XCD_RF_SW_CTRL, 0x22204000);
 
-#ifdef RTL8723BU_PATH_B
-       /* Set RF mode to standby Path B */
-       if (priv->tx_paths > 1)
-               rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_AC, 0x10000);
-#endif
+       /*
+        * RX IQ calibration setting for 8723B D cut large current issue
+        * when leaving IPS
+        */
+       val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
+       val32 &= 0x000000ff;
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
 
-#if 0
-       /* Page B init */
-       rtl8xxxu_write32(priv, REG_CONFIG_ANT_A, 0x0f600000);
+       val32 = rtl8xxxu_read_rfreg(priv, RF_A, RF6052_REG_WE_LUT);
+       val32 |= 0x80000;
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, val32);
 
-       if (priv->tx_paths > 1)
-               rtl8xxxu_write32(priv, REG_CONFIG_ANT_B, 0x0f600000);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0001f);
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf7fb7);
+
+       val32 = rtl8xxxu_read_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_ED);
+       val32 |= 0x20;
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_ED, val32);
+
+       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_43, 0x60fbd);
+
+       for (i = 0; i < retry; i++) {
+               path_a_ok = rtl8723bu_iqk_path_a(priv);
+               if (path_a_ok == 0x01) {
+                       val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
+                       val32 &= 0x000000ff;
+                       rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
+
+                       val32 = rtl8xxxu_read32(priv,
+                                               REG_TX_POWER_BEFORE_IQK_A);
+                       result[t][0] = (val32 >> 16) & 0x3ff;
+                       val32 = rtl8xxxu_read32(priv,
+                                               REG_TX_POWER_AFTER_IQK_A);
+                       result[t][1] = (val32 >> 16) & 0x3ff;
+
+                       break;
+               }
+       }
+
+       if (!path_a_ok)
+               dev_dbg(dev, "%s: Path A TX IQK failed!\n", __func__);
+
+       for (i = 0; i < retry; i++) {
+               path_a_ok = rtl8723bu_rx_iqk_path_a(priv);
+               if (path_a_ok == 0x03) {
+                       val32 = rtl8xxxu_read32(priv,
+                                               REG_RX_POWER_BEFORE_IQK_A_2);
+                       result[t][2] = (val32 >> 16) & 0x3ff;
+                       val32 = rtl8xxxu_read32(priv,
+                                               REG_RX_POWER_AFTER_IQK_A_2);
+                       result[t][3] = (val32 >> 16) & 0x3ff;
+
+                       break;
+               }
+       }
+
+       if (!path_a_ok)
+               dev_dbg(dev, "%s: Path A RX IQK failed!\n", __func__);
+
+       if (priv->tx_paths > 1) {
+#if 1
+               dev_warn(dev, "%s: Path B not supported\n", __func__);
+#else
+
+               /*
+                * Path A into standby
+                */
+               val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
+               val32 &= 0x000000ff;
+               rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
+               rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0x10000);
+
+               val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
+               val32 &= 0x000000ff;
+               val32 |= 0x80800000;
+               rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
+
+               /* Turn Path B ADDA on */
+               rtl8xxxu_path_adda_on(priv, adda_regs, false);
+
+               for (i = 0; i < retry; i++) {
+                       path_b_ok = rtl8xxxu_iqk_path_b(priv);
+                       if (path_b_ok == 0x03) {
+                               val32 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B);
+                               result[t][4] = (val32 >> 16) & 0x3ff;
+                               val32 = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B);
+                               result[t][5] = (val32 >> 16) & 0x3ff;
+                               break;
+                       }
+               }
+
+               if (!path_b_ok)
+                       dev_dbg(dev, "%s: Path B IQK failed!\n", __func__);
+
+               for (i = 0; i < retry; i++) {
+                       path_b_ok = rtl8723bu_rx_iqk_path_b(priv);
+                       if (path_a_ok == 0x03) {
+                               val32 = rtl8xxxu_read32(priv,
+                                                       REG_RX_POWER_BEFORE_IQK_B_2);
+                               result[t][6] = (val32 >> 16) & 0x3ff;
+                               val32 = rtl8xxxu_read32(priv,
+                                                       REG_RX_POWER_AFTER_IQK_B_2);
+                               result[t][7] = (val32 >> 16) & 0x3ff;
+                               break;
+                       }
+               }
+
+               if (!path_b_ok)
+                       dev_dbg(dev, "%s: Path B RX IQK failed!\n", __func__);
 #endif
+       }
+
+       /* Back to BB mode, load original value */
+       val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
+       val32 &= 0x000000ff;
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
+
+       if (t) {
+               /* Reload ADDA power saving parameters */
+               rtl8xxxu_restore_regs(priv, adda_regs, priv->adda_backup,
+                                     RTL8XXXU_ADDA_REGS);
+
+               /* Reload MAC parameters */
+               rtl8xxxu_restore_mac_regs(priv, iqk_mac_regs, priv->mac_backup);
+
+               /* Reload BB parameters */
+               rtl8xxxu_restore_regs(priv, iqk_bb_regs,
+                                     priv->bb_backup, RTL8XXXU_BB_REGS);
+
+               /* Restore RX initial gain */
+               val32 = rtl8xxxu_read32(priv, REG_OFDM0_XA_AGC_CORE1);
+               val32 &= 0xffffff00;
+               rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, val32 | 0x50);
+               rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, val32 | xa_agc);
+
+               if (priv->tx_paths > 1) {
+                       val32 = rtl8xxxu_read32(priv, REG_OFDM0_XB_AGC_CORE1);
+                       val32 &= 0xffffff00;
+                       rtl8xxxu_write32(priv, REG_OFDM0_XB_AGC_CORE1,
+                                        val32 | 0x50);
+                       rtl8xxxu_write32(priv, REG_OFDM0_XB_AGC_CORE1,
+                                        val32 | xb_agc);
+               }
+
+               /* Load 0xe30 IQC default value */
+               rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x01008c00);
+               rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x01008c00);
+       }
+}
+
+static void rtl8192eu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,
+                                     int result[][8], int t)
+{
+       struct device *dev = &priv->udev->dev;
+       u32 i, val32;
+       int path_a_ok, path_b_ok;
+       int retry = 2;
+       const u32 adda_regs[RTL8XXXU_ADDA_REGS] = {
+               REG_FPGA0_XCD_SWITCH_CTRL, REG_BLUETOOTH,
+               REG_RX_WAIT_CCA, REG_TX_CCK_RFON,
+               REG_TX_CCK_BBON, REG_TX_OFDM_RFON,
+               REG_TX_OFDM_BBON, REG_TX_TO_RX,
+               REG_TX_TO_TX, REG_RX_CCK,
+               REG_RX_OFDM, REG_RX_WAIT_RIFS,
+               REG_RX_TO_RX, REG_STANDBY,
+               REG_SLEEP, REG_PMPD_ANAEN
+       };
+       const u32 iqk_mac_regs[RTL8XXXU_MAC_REGS] = {
+               REG_TXPAUSE, REG_BEACON_CTRL,
+               REG_BEACON_CTRL_1, REG_GPIO_MUXCFG
+       };
+       const u32 iqk_bb_regs[RTL8XXXU_BB_REGS] = {
+               REG_OFDM0_TRX_PATH_ENABLE, REG_OFDM0_TR_MUX_PAR,
+               REG_FPGA0_XCD_RF_SW_CTRL, REG_CONFIG_ANT_A, REG_CONFIG_ANT_B,
+               REG_FPGA0_XAB_RF_SW_CTRL, REG_FPGA0_XA_RF_INT_OE,
+               REG_FPGA0_XB_RF_INT_OE, REG_CCK0_AFE_SETTING
+       };
+       u8 xa_agc = rtl8xxxu_read32(priv, REG_OFDM0_XA_AGC_CORE1) & 0xff;
+       u8 xb_agc = rtl8xxxu_read32(priv, REG_OFDM0_XB_AGC_CORE1) & 0xff;
+
+       /*
+        * Note: IQ calibration must be performed after loading
+        *       PHY_REG.txt , and radio_a, radio_b.txt
+        */
+
+       if (t == 0) {
+               /* Save ADDA parameters, turn Path A ADDA on */
+               rtl8xxxu_save_regs(priv, adda_regs, priv->adda_backup,
+                                  RTL8XXXU_ADDA_REGS);
+               rtl8xxxu_save_mac_regs(priv, iqk_mac_regs, priv->mac_backup);
+               rtl8xxxu_save_regs(priv, iqk_bb_regs,
+                                  priv->bb_backup, RTL8XXXU_BB_REGS);
+       }
+
+       rtl8xxxu_path_adda_on(priv, adda_regs, true);
 
-       /*
-        * RX IQ calibration setting for 8723B D cut large current issue
-        * when leaving IPS
-        */
-       val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
-       val32 &= 0x000000ff;
-       rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
+       /* MAC settings */
+       rtl8xxxu_mac_calibration(priv, iqk_mac_regs, priv->mac_backup);
 
-       val32 = rtl8xxxu_read_rfreg(priv, RF_A, RF6052_REG_WE_LUT);
-       val32 |= 0x80000;
-       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, val32);
+       val32 = rtl8xxxu_read32(priv, REG_CCK0_AFE_SETTING);
+       val32 |= 0x0f000000;
+       rtl8xxxu_write32(priv, REG_CCK0_AFE_SETTING, val32);
 
-       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000);
-       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0001f);
-       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf7fb7);
+       rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, 0x03a05600);
+       rtl8xxxu_write32(priv, REG_OFDM0_TR_MUX_PAR, 0x000800e4);
+       rtl8xxxu_write32(priv, REG_FPGA0_XCD_RF_SW_CTRL, 0x22208200);
 
-       val32 = rtl8xxxu_read_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_ED);
-       val32 |= 0x20;
-       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_ED, val32);
+       val32 = rtl8xxxu_read32(priv, REG_FPGA0_XAB_RF_SW_CTRL);
+       val32 |= (FPGA0_RF_PAPE | (FPGA0_RF_PAPE << FPGA0_RF_BD_CTRL_SHIFT));
+       rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32);
 
-       rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_43, 0x60fbd);
+       val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_RF_INT_OE);
+       val32 |= BIT(10);
+       rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, val32);
+       val32 = rtl8xxxu_read32(priv, REG_FPGA0_XB_RF_INT_OE);
+       val32 |= BIT(10);
+       rtl8xxxu_write32(priv, REG_FPGA0_XB_RF_INT_OE, val32);
+
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
+       rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00);
+       rtl8xxxu_write32(priv, REG_RX_IQK, 0x01004800);
 
        for (i = 0; i < retry; i++) {
-               path_a_ok = rtl8723bu_iqk_path_a(priv);
+               path_a_ok = rtl8192eu_iqk_path_a(priv);
                if (path_a_ok == 0x01) {
-                       val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
-                       val32 &= 0x000000ff;
-                       rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
-
-#if 0 /* Only needed in restore case, we may need this when going to suspend */
-                       priv->RFCalibrateInfo.TxLOK[RF_A] =
-                               rtl8xxxu_read_rfreg(priv, RF_A,
-                                                   RF6052_REG_TXM_IDAC);
-#endif
-
                        val32 = rtl8xxxu_read32(priv,
                                                REG_TX_POWER_BEFORE_IQK_A);
                        result[t][0] = (val32 >> 16) & 0x3ff;
@@ -4756,7 +5997,7 @@ static void rtl8723bu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,
                dev_dbg(dev, "%s: Path A TX IQK failed!\n", __func__);
 
        for (i = 0; i < retry; i++) {
-               path_a_ok = rtl8723bu_rx_iqk_path_a(priv);
+               path_a_ok = rtl8192eu_rx_iqk_path_a(priv);
                if (path_a_ok == 0x03) {
                        val32 = rtl8xxxu_read32(priv,
                                                REG_RX_POWER_BEFORE_IQK_A_2);
@@ -4772,30 +6013,22 @@ static void rtl8723bu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,
        if (!path_a_ok)
                dev_dbg(dev, "%s: Path A RX IQK failed!\n", __func__);
 
-       if (priv->tx_paths > 1) {
-#if 1
-               dev_warn(dev, "%s: Path B not supported\n", __func__);
-#else
-
-               /*
-                * Path A into standby
-                */
-               val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
-               val32 &= 0x000000ff;
-               rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
+       if (priv->rf_paths > 1) {
+               /* Path A into standby */
+               rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
                rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0x10000);
-
-               val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
-               val32 &= 0x000000ff;
-               val32 |= 0x80800000;
-               rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
+               rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
 
                /* Turn Path B ADDA on */
                rtl8xxxu_path_adda_on(priv, adda_regs, false);
 
+               rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000);
+               rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00);
+               rtl8xxxu_write32(priv, REG_RX_IQK, 0x01004800);
+
                for (i = 0; i < retry; i++) {
-                       path_b_ok = rtl8xxxu_iqk_path_b(priv);
-                       if (path_b_ok == 0x03) {
+                       path_b_ok = rtl8192eu_iqk_path_b(priv);
+                       if (path_b_ok == 0x01) {
                                val32 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B);
                                result[t][4] = (val32 >> 16) & 0x3ff;
                                val32 = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B);
@@ -4808,7 +6041,7 @@ static void rtl8723bu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,
                        dev_dbg(dev, "%s: Path B IQK failed!\n", __func__);
 
                for (i = 0; i < retry; i++) {
-                       path_b_ok = rtl8723bu_rx_iqk_path_b(priv);
+                       path_b_ok = rtl8192eu_rx_iqk_path_b(priv);
                        if (path_a_ok == 0x03) {
                                val32 = rtl8xxxu_read32(priv,
                                                        REG_RX_POWER_BEFORE_IQK_B_2);
@@ -4822,13 +6055,10 @@ static void rtl8723bu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,
 
                if (!path_b_ok)
                        dev_dbg(dev, "%s: Path B RX IQK failed!\n", __func__);
-#endif
        }
 
        /* Back to BB mode, load original value */
-       val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
-       val32 &= 0x000000ff;
-       rtl8xxxu_write32(priv, REG_FPGA0_IQK, val32);
+       rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000);
 
        if (t) {
                /* Reload ADDA power saving parameters */
@@ -4848,7 +6078,7 @@ static void rtl8723bu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,
                rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, val32 | 0x50);
                rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, val32 | xa_agc);
 
-               if (priv->tx_paths > 1) {
+               if (priv->rf_paths > 1) {
                        val32 = rtl8xxxu_read32(priv, REG_OFDM0_XB_AGC_CORE1);
                        val32 &= 0xffffff00;
                        rtl8xxxu_write32(priv, REG_OFDM0_XB_AGC_CORE1,
@@ -4877,7 +6107,7 @@ static void rtl8xxxu_prepare_calibrate(struct rtl8xxxu_priv *priv, u8 start)
        rtl8723a_h2c_cmd(priv, &h2c, sizeof(h2c.bt_wlan_calibration));
 }
 
-static void rtl8723au_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
+static void rtl8xxxu_gen1_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
 {
        struct device *dev = &priv->udev->dev;
        int result[4][8];       /* last is final result */
@@ -4975,7 +6205,7 @@ static void rtl8723au_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
                rtl8xxxu_fill_iqk_matrix_b(priv, path_b_ok, result,
                                           candidate, (reg_ec4 == 0));
 
-       rtl8xxxu_save_regs(priv, rtl8723au_iqk_phy_iq_bb_reg,
+       rtl8xxxu_save_regs(priv, rtl8xxxu_iqk_phy_iq_bb_reg,
                           priv->bb_recovery_backup, RTL8XXXU_BB_REGS);
 
        rtl8xxxu_prepare_calibrate(priv, 0);
@@ -5007,7 +6237,8 @@ static void rtl8723bu_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
                rtl8723bu_phy_iqcalibrate(priv, result, i);
 
                if (i == 1) {
-                       simu = rtl8723bu_simularity_compare(priv, result, 0, 1);
+                       simu = rtl8xxxu_gen2_simularity_compare(priv,
+                                                               result, 0, 1);
                        if (simu) {
                                candidate = 0;
                                break;
@@ -5015,13 +6246,15 @@ static void rtl8723bu_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
                }
 
                if (i == 2) {
-                       simu = rtl8723bu_simularity_compare(priv, result, 0, 2);
+                       simu = rtl8xxxu_gen2_simularity_compare(priv,
+                                                               result, 0, 2);
                        if (simu) {
                                candidate = 0;
                                break;
                        }
 
-                       simu = rtl8723bu_simularity_compare(priv, result, 1, 2);
+                       simu = rtl8xxxu_gen2_simularity_compare(priv,
+                                                               result, 1, 2);
                        if (simu) {
                                candidate = 1;
                        } else {
@@ -5080,7 +6313,7 @@ static void rtl8723bu_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
                rtl8xxxu_fill_iqk_matrix_b(priv, path_b_ok, result,
                                           candidate, (reg_ec4 == 0));
 
-       rtl8xxxu_save_regs(priv, rtl8723au_iqk_phy_iq_bb_reg,
+       rtl8xxxu_save_regs(priv, rtl8xxxu_iqk_phy_iq_bb_reg,
                           priv->bb_recovery_backup, RTL8XXXU_BB_REGS);
 
        rtl8xxxu_write32(priv, REG_BT_CONTROL_8723BU, bt_control);
@@ -5096,18 +6329,105 @@ static void rtl8723bu_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
        rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_ED, val32);
        rtl8xxxu_write_rfreg(priv, RF_A, 0x43, 0x300bd);
 
-       if (priv->rf_paths > 1) {
-               dev_dbg(dev, "%s: beware 2T not yet supported\n", __func__);
-#ifdef RTL8723BU_PATH_B
-               if (RF_Path == 0x0)     //S1
-                       ODM_SetIQCbyRFpath(pDM_Odm, 0);
-               else    //S0
-                       ODM_SetIQCbyRFpath(pDM_Odm, 1);
-#endif
-       }
+       if (priv->rf_paths > 1)
+               dev_dbg(dev, "%s: 8723BU 2T not supported\n", __func__);
+
        rtl8xxxu_prepare_calibrate(priv, 0);
 }
 
+static void rtl8192eu_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
+{
+       struct device *dev = &priv->udev->dev;
+       int result[4][8];       /* last is final result */
+       int i, candidate;
+       bool path_a_ok, path_b_ok;
+       u32 reg_e94, reg_e9c, reg_ea4, reg_eac;
+       u32 reg_eb4, reg_ebc, reg_ec4, reg_ecc;
+       bool simu;
+
+       memset(result, 0, sizeof(result));
+       candidate = -1;
+
+       path_a_ok = false;
+       path_b_ok = false;
+
+       for (i = 0; i < 3; i++) {
+               rtl8192eu_phy_iqcalibrate(priv, result, i);
+
+               if (i == 1) {
+                       simu = rtl8xxxu_gen2_simularity_compare(priv,
+                                                               result, 0, 1);
+                       if (simu) {
+                               candidate = 0;
+                               break;
+                       }
+               }
+
+               if (i == 2) {
+                       simu = rtl8xxxu_gen2_simularity_compare(priv,
+                                                               result, 0, 2);
+                       if (simu) {
+                               candidate = 0;
+                               break;
+                       }
+
+                       simu = rtl8xxxu_gen2_simularity_compare(priv,
+                                                               result, 1, 2);
+                       if (simu)
+                               candidate = 1;
+                       else
+                               candidate = 3;
+               }
+       }
+
+       for (i = 0; i < 4; i++) {
+               reg_e94 = result[i][0];
+               reg_e9c = result[i][1];
+               reg_ea4 = result[i][2];
+               reg_eac = result[i][3];
+               reg_eb4 = result[i][4];
+               reg_ebc = result[i][5];
+               reg_ec4 = result[i][6];
+               reg_ecc = result[i][7];
+       }
+
+       if (candidate >= 0) {
+               reg_e94 = result[candidate][0];
+               priv->rege94 =  reg_e94;
+               reg_e9c = result[candidate][1];
+               priv->rege9c = reg_e9c;
+               reg_ea4 = result[candidate][2];
+               reg_eac = result[candidate][3];
+               reg_eb4 = result[candidate][4];
+               priv->regeb4 = reg_eb4;
+               reg_ebc = result[candidate][5];
+               priv->regebc = reg_ebc;
+               reg_ec4 = result[candidate][6];
+               reg_ecc = result[candidate][7];
+               dev_dbg(dev, "%s: candidate is %x\n", __func__, candidate);
+               dev_dbg(dev,
+                       "%s: e94 =%x e9c=%x ea4=%x eac=%x eb4=%x ebc=%x ec4=%x "
+                       "ecc=%x\n ", __func__, reg_e94, reg_e9c,
+                       reg_ea4, reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc);
+               path_a_ok = true;
+               path_b_ok = true;
+       } else {
+               reg_e94 = reg_eb4 = priv->rege94 = priv->regeb4 = 0x100;
+               reg_e9c = reg_ebc = priv->rege9c = priv->regebc = 0x0;
+       }
+
+       if (reg_e94 && candidate >= 0)
+               rtl8xxxu_fill_iqk_matrix_a(priv, path_a_ok, result,
+                                          candidate, (reg_ea4 == 0));
+
+       if (priv->rf_paths > 1)
+               rtl8xxxu_fill_iqk_matrix_b(priv, path_b_ok, result,
+                                          candidate, (reg_ec4 == 0));
+
+       rtl8xxxu_save_regs(priv, rtl8xxxu_iqk_phy_iq_bb_reg,
+                          priv->bb_recovery_backup, RTL8XXXU_BB_REGS);
+}
+
 static void rtl8723a_phy_lc_calibrate(struct rtl8xxxu_priv *priv)
 {
        u32 val32;
@@ -5231,7 +6551,7 @@ static void rtl8xxxu_set_ampdu_min_space(struct rtl8xxxu_priv *priv, u8 density)
 static int rtl8xxxu_active_to_emu(struct rtl8xxxu_priv *priv)
 {
        u8 val8;
-       int count, ret;
+       int count, ret = 0;
 
        /* Start of rtl8723AU_card_enable_flow */
        /* Act to Cardemu sequence*/
@@ -5281,7 +6601,7 @@ static int rtl8723bu_active_to_emu(struct rtl8xxxu_priv *priv)
        u8 val8;
        u16 val16;
        u32 val32;
-       int count, ret;
+       int count, ret = 0;
 
        /* Turn off RF */
        rtl8xxxu_write8(priv, REG_RF_CTRL, 0);
@@ -5292,9 +6612,9 @@ static int rtl8723bu_active_to_emu(struct rtl8xxxu_priv *priv)
        rtl8xxxu_write16(priv, REG_GPIO_INTM, val16);
 
        /* Release WLON reset 0x04[16]= 1*/
-       val32 = rtl8xxxu_read32(priv, REG_GPIO_INTM);
+       val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO);
        val32 |= APS_FSMCO_WLON_RESET;
-       rtl8xxxu_write32(priv, REG_GPIO_INTM, val32);
+       rtl8xxxu_write32(priv, REG_APS_FSMCO, val32);
 
        /* 0x0005[1] = 1 turn off MAC by HW state machine*/
        val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1);
@@ -5338,7 +6658,7 @@ static int rtl8xxxu_active_to_lps(struct rtl8xxxu_priv *priv)
 {
        u8 val8;
        u8 val32;
-       int count, ret;
+       int count, ret = 0;
 
        rtl8xxxu_write8(priv, REG_TXPAUSE, 0xff);
 
@@ -5756,6 +7076,50 @@ static int rtl8xxxu_flush_fifo(struct rtl8xxxu_priv *priv)
        return retval;
 }
 
+static void rtl8xxxu_gen1_usb_quirks(struct rtl8xxxu_priv *priv)
+{
+       /* Fix USB interface interference issue */
+       rtl8xxxu_write8(priv, 0xfe40, 0xe0);
+       rtl8xxxu_write8(priv, 0xfe41, 0x8d);
+       rtl8xxxu_write8(priv, 0xfe42, 0x80);
+       /*
+        * This sets TXDMA_OFFSET_DROP_DATA_EN (bit 9) as well as bits
+        * 8 and 5, for which I have found no documentation.
+        */
+       rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, 0xfd0320);
+
+       /*
+        * Solve too many protocol error on USB bus.
+        * Can't do this for 8188/8192 UMC A cut parts
+        */
+       if (!(!priv->chip_cut && priv->vendor_umc)) {
+               rtl8xxxu_write8(priv, 0xfe40, 0xe6);
+               rtl8xxxu_write8(priv, 0xfe41, 0x94);
+               rtl8xxxu_write8(priv, 0xfe42, 0x80);
+
+               rtl8xxxu_write8(priv, 0xfe40, 0xe0);
+               rtl8xxxu_write8(priv, 0xfe41, 0x19);
+               rtl8xxxu_write8(priv, 0xfe42, 0x80);
+
+               rtl8xxxu_write8(priv, 0xfe40, 0xe5);
+               rtl8xxxu_write8(priv, 0xfe41, 0x91);
+               rtl8xxxu_write8(priv, 0xfe42, 0x80);
+
+               rtl8xxxu_write8(priv, 0xfe40, 0xe2);
+               rtl8xxxu_write8(priv, 0xfe41, 0x81);
+               rtl8xxxu_write8(priv, 0xfe42, 0x80);
+       }
+}
+
+static void rtl8xxxu_gen2_usb_quirks(struct rtl8xxxu_priv *priv)
+{
+       u32 val32;
+
+       val32 = rtl8xxxu_read32(priv, REG_TXDMA_OFFSET_CHK);
+       val32 |= TXDMA_OFFSET_DROP_DATA_EN;
+       rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, val32);
+}
+
 static int rtl8723au_power_on(struct rtl8xxxu_priv *priv)
 {
        u8 val8;
@@ -5952,10 +7316,12 @@ static int rtl8192cu_power_on(struct rtl8xxxu_priv *priv)
                CR_SCHEDULE_ENABLE | CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE;
        rtl8xxxu_write16(priv, REG_CR, val16);
 
+       rtl8xxxu_write8(priv, 0xfe10, 0x19);
+
        /*
         * Workaround for 8188RU LNA power leakage problem.
         */
-       if (priv->rtl_chip == RTL8188C && priv->hi_pa) {
+       if (priv->rtl_chip == RTL8188R) {
                val32 = rtl8xxxu_read32(priv, REG_FPGA0_XCD_RF_PARM);
                val32 &= ~BIT(1);
                rtl8xxxu_write32(priv, REG_FPGA0_XCD_RF_PARM, val32);
@@ -5965,6 +7331,41 @@ static int rtl8192cu_power_on(struct rtl8xxxu_priv *priv)
 
 #endif
 
+/*
+ * This is needed for 8723bu as well, presumable
+ */
+static void rtl8192e_crystal_afe_adjust(struct rtl8xxxu_priv *priv)
+{
+       u8 val8;
+       u32 val32;
+
+       /*
+        * 40Mhz crystal source, MAC 0x28[2]=0
+        */
+       val8 = rtl8xxxu_read8(priv, REG_AFE_PLL_CTRL);
+       val8 &= 0xfb;
+       rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL, val8);
+
+       val32 = rtl8xxxu_read32(priv, REG_AFE_CTRL4);
+       val32 &= 0xfffffc7f;
+       rtl8xxxu_write32(priv, REG_AFE_CTRL4, val32);
+
+       /*
+        * 92e AFE parameter
+        * AFE PLL KVCO selection, MAC 0x28[6]=1
+        */
+       val8 = rtl8xxxu_read8(priv, REG_AFE_PLL_CTRL);
+       val8 &= 0xbf;
+       rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL, val8);
+
+       /*
+        * AFE PLL KVCO selection, MAC 0x78[21]=0
+        */
+       val32 = rtl8xxxu_read32(priv, REG_AFE_CTRL4);
+       val32 &= 0xffdfffff;
+       rtl8xxxu_write32(priv, REG_AFE_CTRL4, val32);
+}
+
 static int rtl8192eu_power_on(struct rtl8xxxu_priv *priv)
 {
        u16 val16;
@@ -5987,6 +7388,10 @@ static int rtl8192eu_power_on(struct rtl8xxxu_priv *priv)
                rtl8xxxu_write8(priv, REG_LDO_SW_CTRL, 0x83);
        }
 
+       /*
+        * Adjust AFE before enabling PLL
+        */
+       rtl8192e_crystal_afe_adjust(priv);
        rtl8192e_disabled_to_emu(priv);
 
        ret = rtl8192e_emu_to_active(priv);
@@ -6020,7 +7425,7 @@ static void rtl8xxxu_power_off(struct rtl8xxxu_priv *priv)
        /*
         * Workaround for 8188RU LNA power leakage problem.
         */
-       if (priv->rtl_chip == RTL8188C && priv->hi_pa) {
+       if (priv->rtl_chip == RTL8188R) {
                val32 = rtl8xxxu_read32(priv, REG_FPGA0_XCD_RF_PARM);
                val32 |= BIT(1);
                rtl8xxxu_write32(priv, REG_FPGA0_XCD_RF_PARM, val32);
@@ -6075,7 +7480,7 @@ static void rtl8723bu_power_off(struct rtl8xxxu_priv *priv)
        val8 &= ~TX_REPORT_CTRL_TIMER_ENABLE;
        rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8);
 
-       rtl8xxxu_write16(priv, REG_CR, 0x0000);
+       rtl8xxxu_write8(priv, REG_CR, 0x0000);
 
        rtl8xxxu_active_to_lps(priv);
 
@@ -6092,7 +7497,15 @@ static void rtl8723bu_power_off(struct rtl8xxxu_priv *priv)
        rtl8xxxu_write8(priv, REG_MCU_FW_DL, 0x00);
 
        rtl8723bu_active_to_emu(priv);
-       rtl8xxxu_emu_to_disabled(priv);
+
+       val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1);
+       val8 |= BIT(3); /* APS_FSMCO_HW_SUSPEND */
+       rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8);
+
+       /* 0x48[16] = 1 to enable GPIO9 as EXT wakeup */
+       val8 = rtl8xxxu_read8(priv, REG_GPIO_INTM + 2);
+       val8 |= BIT(0);
+       rtl8xxxu_write8(priv, REG_GPIO_INTM + 2, val8);
 }
 
 #ifdef NEED_PS_TDMA
@@ -6101,16 +7514,53 @@ static void rtl8723bu_set_ps_tdma(struct rtl8xxxu_priv *priv,
 {
        struct h2c_cmd h2c;
 
-       memset(&h2c, 0, sizeof(struct h2c_cmd));
-       h2c.b_type_dma.cmd = H2C_8723B_B_TYPE_TDMA;
-       h2c.b_type_dma.data1 = arg1;
-       h2c.b_type_dma.data2 = arg2;
-       h2c.b_type_dma.data3 = arg3;
-       h2c.b_type_dma.data4 = arg4;
-       h2c.b_type_dma.data5 = arg5;
-       rtl8723a_h2c_cmd(priv, &h2c, sizeof(h2c.b_type_dma));
+       memset(&h2c, 0, sizeof(struct h2c_cmd));
+       h2c.b_type_dma.cmd = H2C_8723B_B_TYPE_TDMA;
+       h2c.b_type_dma.data1 = arg1;
+       h2c.b_type_dma.data2 = arg2;
+       h2c.b_type_dma.data3 = arg3;
+       h2c.b_type_dma.data4 = arg4;
+       h2c.b_type_dma.data5 = arg5;
+       rtl8723a_h2c_cmd(priv, &h2c, sizeof(h2c.b_type_dma));
+}
+#endif
+
+static void rtl8192e_enable_rf(struct rtl8xxxu_priv *priv)
+{
+       u32 val32;
+       u8 val8;
+
+       val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG);
+       val8 |= BIT(5);
+       rtl8xxxu_write8(priv, REG_GPIO_MUXCFG, val8);
+
+       /*
+        * WLAN action by PTA
+        */
+       rtl8xxxu_write8(priv, REG_WLAN_ACT_CONTROL_8723B, 0x04);
+
+       val32 = rtl8xxxu_read32(priv, REG_PWR_DATA);
+       val32 |= PWR_DATA_EEPRPAD_RFE_CTRL_EN;
+       rtl8xxxu_write32(priv, REG_PWR_DATA, val32);
+
+       val32 = rtl8xxxu_read32(priv, REG_RFE_BUFFER);
+       val32 |= (BIT(0) | BIT(1));
+       rtl8xxxu_write32(priv, REG_RFE_BUFFER, val32);
+
+       rtl8xxxu_write8(priv, REG_RFE_CTRL_ANTA_SRC, 0x77);
+
+       val32 = rtl8xxxu_read32(priv, REG_LEDCFG0);
+       val32 &= ~BIT(24);
+       val32 |= BIT(23);
+       rtl8xxxu_write32(priv, REG_LEDCFG0, val32);
+
+       /*
+        * Fix external switch Main->S1, Aux->S0
+        */
+       val8 = rtl8xxxu_read8(priv, REG_PAD_CTRL1);
+       val8 &= ~BIT(0);
+       rtl8xxxu_write8(priv, REG_PAD_CTRL1, val8);
 }
-#endif
 
 static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv)
 {
@@ -6219,12 +7669,10 @@ static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv)
        rtl8723a_h2c_cmd(priv, &h2c, sizeof(h2c.ignore_wlan));
 }
 
-static void rtl8723b_disable_rf(struct rtl8xxxu_priv *priv)
+static void rtl8xxxu_gen2_disable_rf(struct rtl8xxxu_priv *priv)
 {
        u32 val32;
 
-       rtl8xxxu_write8(priv, REG_TXPAUSE, 0xff);
-
        val32 = rtl8xxxu_read32(priv, REG_RX_WAIT_CCA);
        val32 &= ~(BIT(22) | BIT(23));
        rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32);
@@ -6272,11 +7720,64 @@ static void rtl8723bu_init_statistics(struct rtl8xxxu_priv *priv)
        rtl8xxxu_write32(priv, REG_OFDM0_FA_RSTC, val32);
 }
 
+static void rtl8xxxu_old_init_queue_reserved_page(struct rtl8xxxu_priv *priv)
+{
+       u8 val8;
+       u32 val32;
+
+       if (priv->ep_tx_normal_queue)
+               val8 = TX_PAGE_NUM_NORM_PQ;
+       else
+               val8 = 0;
+
+       rtl8xxxu_write8(priv, REG_RQPN_NPQ, val8);
+
+       val32 = (TX_PAGE_NUM_PUBQ << RQPN_PUB_PQ_SHIFT) | RQPN_LOAD;
+
+       if (priv->ep_tx_high_queue)
+               val32 |= (TX_PAGE_NUM_HI_PQ << RQPN_HI_PQ_SHIFT);
+       if (priv->ep_tx_low_queue)
+               val32 |= (TX_PAGE_NUM_LO_PQ << RQPN_LO_PQ_SHIFT);
+
+       rtl8xxxu_write32(priv, REG_RQPN, val32);
+}
+
+static void rtl8xxxu_init_queue_reserved_page(struct rtl8xxxu_priv *priv)
+{
+       struct rtl8xxxu_fileops *fops = priv->fops;
+       u32 hq, lq, nq, eq, pubq;
+       u32 val32;
+
+       hq = 0;
+       lq = 0;
+       nq = 0;
+       eq = 0;
+       pubq = 0;
+
+       if (priv->ep_tx_high_queue)
+               hq = fops->page_num_hi;
+       if (priv->ep_tx_low_queue)
+               lq = fops->page_num_lo;
+       if (priv->ep_tx_normal_queue)
+               nq = fops->page_num_norm;
+
+       val32 = (nq << RQPN_NPQ_SHIFT) | (eq << RQPN_EPQ_SHIFT);
+       rtl8xxxu_write32(priv, REG_RQPN_NPQ, val32);
+
+       pubq = fops->total_page_num - hq - lq - nq;
+
+       val32 = RQPN_LOAD;
+       val32 |= (hq << RQPN_HI_PQ_SHIFT);
+       val32 |= (lq << RQPN_LO_PQ_SHIFT);
+       val32 |= (pubq << RQPN_PUB_PQ_SHIFT);
+
+       rtl8xxxu_write32(priv, REG_RQPN, val32);
+}
+
 static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
 {
        struct rtl8xxxu_priv *priv = hw->priv;
        struct device *dev = &priv->udev->dev;
-       struct rtl8xxxu_rfregval *rftable;
        bool macpower;
        int ret;
        u8 val8;
@@ -6301,33 +7802,22 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
                goto exit;
        }
 
-       dev_dbg(dev, "%s: macpower %i\n", __func__, macpower);
        if (!macpower) {
-               ret = priv->fops->llt_init(priv, TX_TOTAL_PAGE_NUM);
-               if (ret) {
-                       dev_warn(dev, "%s: LLT table init failed\n", __func__);
-                       goto exit;
-               }
+               if (priv->fops->total_page_num)
+                       rtl8xxxu_init_queue_reserved_page(priv);
+               else
+                       rtl8xxxu_old_init_queue_reserved_page(priv);
+       }
 
-               /*
-                * Presumably this is for 8188EU as well
-                * Enable TX report and TX report timer
-                */
-               if (priv->rtl_chip == RTL8723B) {
-                       val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL);
-                       val8 |= TX_REPORT_CTRL_TIMER_ENABLE;
-                       rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8);
-                       /* Set MAX RPT MACID */
-                       rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL + 1, 0x02);
-                       /* TX report Timer. Unit: 32us */
-                       rtl8xxxu_write16(priv, REG_TX_REPORT_TIME, 0xcdf0);
+       ret = rtl8xxxu_init_queue_priority(priv);
+       dev_dbg(dev, "%s: init_queue_priority %i\n", __func__, ret);
+       if (ret)
+               goto exit;
 
-                       /* tmp ps ? */
-                       val8 = rtl8xxxu_read8(priv, 0xa3);
-                       val8 &= 0xf8;
-                       rtl8xxxu_write8(priv, 0xa3, val8);
-               }
-       }
+       /*
+        * Set RX page boundary
+        */
+       rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, priv->fops->trxff_boundary);
 
        ret = rtl8xxxu_download_firmware(priv);
        dev_dbg(dev, "%s: download_fiwmare %i\n", __func__, ret);
@@ -6338,41 +7828,10 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
        if (ret)
                goto exit;
 
-       /* Solve too many protocol error on USB bus */
-       /* Can't do this for 8188/8192 UMC A cut parts */
-       if (priv->rtl_chip == RTL8723A ||
-           ((priv->rtl_chip == RTL8192C || priv->rtl_chip == RTL8191C ||
-             priv->rtl_chip == RTL8188C) &&
-            (priv->chip_cut || !priv->vendor_umc))) {
-               rtl8xxxu_write8(priv, 0xfe40, 0xe6);
-               rtl8xxxu_write8(priv, 0xfe41, 0x94);
-               rtl8xxxu_write8(priv, 0xfe42, 0x80);
-
-               rtl8xxxu_write8(priv, 0xfe40, 0xe0);
-               rtl8xxxu_write8(priv, 0xfe41, 0x19);
-               rtl8xxxu_write8(priv, 0xfe42, 0x80);
-
-               rtl8xxxu_write8(priv, 0xfe40, 0xe5);
-               rtl8xxxu_write8(priv, 0xfe41, 0x91);
-               rtl8xxxu_write8(priv, 0xfe42, 0x80);
-
-               rtl8xxxu_write8(priv, 0xfe40, 0xe2);
-               rtl8xxxu_write8(priv, 0xfe41, 0x81);
-               rtl8xxxu_write8(priv, 0xfe42, 0x80);
-       }
-
-       if (priv->rtl_chip == RTL8192E) {
-               rtl8xxxu_write32(priv, REG_HIMR0, 0x00);
-               rtl8xxxu_write32(priv, REG_HIMR1, 0x00);
-       }
-
        if (priv->fops->phy_init_antenna_selection)
                priv->fops->phy_init_antenna_selection(priv);
 
-       if (priv->rtl_chip == RTL8723B)
-               ret = rtl8xxxu_init_mac(priv, rtl8723b_mac_init_table);
-       else
-               ret = rtl8xxxu_init_mac(priv, rtl8723a_mac_init_table);
+       ret = rtl8xxxu_init_mac(priv);
 
        dev_dbg(dev, "%s: init_mac %i\n", __func__, ret);
        if (ret)
@@ -6383,90 +7842,35 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
        if (ret)
                goto exit;
 
-       switch(priv->rtl_chip) {
-       case RTL8723A:
-               rftable = rtl8723au_radioa_1t_init_table;
-               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_A);
-               break;
-       case RTL8723B:
-               rftable = rtl8723bu_radioa_1t_init_table;
-               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_A);
-               /*
-                * PHY LCK
-                */
-               rtl8xxxu_write_rfreg(priv, RF_A, 0xb0, 0xdfbe0);
-               rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_MODE_AG, 0x8c01);
-               msleep(200);
-               rtl8xxxu_write_rfreg(priv, RF_A, 0xb0, 0xdffe0);
-               break;
-       case RTL8188C:
-               if (priv->hi_pa)
-                       rftable = rtl8188ru_radioa_1t_highpa_table;
-               else
-                       rftable = rtl8192cu_radioa_1t_init_table;
-               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_A);
-               break;
-       case RTL8191C:
-               rftable = rtl8192cu_radioa_1t_init_table;
-               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_A);
-               break;
-       case RTL8192C:
-               rftable = rtl8192cu_radioa_2t_init_table;
-               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_A);
-               if (ret)
-                       break;
-               rftable = rtl8192cu_radiob_2t_init_table;
-               ret = rtl8xxxu_init_phy_rf(priv, rftable, RF_B);
-               break;
-       default:
-               ret = -EINVAL;
-       }
-
+       ret = priv->fops->init_phy_rf(priv);
        if (ret)
                goto exit;
 
-       /*
-        * Chip specific quirks
-        */
-       if (priv->rtl_chip == RTL8723A) {
-               /* Fix USB interface interference issue */
-               rtl8xxxu_write8(priv, 0xfe40, 0xe0);
-               rtl8xxxu_write8(priv, 0xfe41, 0x8d);
-               rtl8xxxu_write8(priv, 0xfe42, 0x80);
-               rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, 0xfd0320);
+       /* RFSW Control - clear bit 14 ?? */
+       if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E)
+               rtl8xxxu_write32(priv, REG_FPGA0_TX_INFO, 0x00000003);
 
-               /* Reduce 80M spur */
-               rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, 0x0381808d);
-               rtl8xxxu_write32(priv, REG_AFE_PLL_CTRL, 0xf0ffff83);
-               rtl8xxxu_write32(priv, REG_AFE_PLL_CTRL, 0xf0ffff82);
-               rtl8xxxu_write32(priv, REG_AFE_PLL_CTRL, 0xf0ffff83);
-       } else {
-               val32 = rtl8xxxu_read32(priv, REG_TXDMA_OFFSET_CHK);
-               val32 |= TXDMA_OFFSET_DROP_DATA_EN;
-               rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, val32);
+       val32 = FPGA0_RF_TRSW | FPGA0_RF_TRSWB | FPGA0_RF_ANTSW |
+               FPGA0_RF_ANTSWB |
+               ((FPGA0_RF_ANTSW | FPGA0_RF_ANTSWB) << FPGA0_RF_BD_CTRL_SHIFT);
+       if (!priv->no_pape) {
+               val32 |= (FPGA0_RF_PAPE |
+                         (FPGA0_RF_PAPE << FPGA0_RF_BD_CTRL_SHIFT));
        }
+       rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32);
 
-       if (!macpower) {
-               if (priv->ep_tx_normal_queue)
-                       val8 = TX_PAGE_NUM_NORM_PQ;
-               else
-                       val8 = 0;
-
-               rtl8xxxu_write8(priv, REG_RQPN_NPQ, val8);
-
-               val32 = (TX_PAGE_NUM_PUBQ << RQPN_NORM_PQ_SHIFT) | RQPN_LOAD;
-
-               if (priv->ep_tx_high_queue)
-                       val32 |= (TX_PAGE_NUM_HI_PQ << RQPN_HI_PQ_SHIFT);
-               if (priv->ep_tx_low_queue)
-                       val32 |= (TX_PAGE_NUM_LO_PQ << RQPN_LO_PQ_SHIFT);
-
-               rtl8xxxu_write32(priv, REG_RQPN, val32);
+       /* 0x860[6:5]= 00 - why? - this sets antenna B */
+       if (priv->rtl_chip != RTL8192E)
+               rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, 0x66f60210);
 
+       if (!macpower) {
                /*
                 * Set TX buffer boundary
                 */
-               val8 = TX_TOTAL_PAGE_NUM + 1;
+               if (priv->rtl_chip == RTL8192E)
+                       val8 = TX_TOTAL_PAGE_NUM_8192E + 1;
+               else
+                       val8 = TX_TOTAL_PAGE_NUM + 1;
 
                if (priv->rtl_chip == RTL8723B)
                        val8 -= 1;
@@ -6478,54 +7882,63 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
                rtl8xxxu_write8(priv, REG_TDECTRL + 1, val8);
        }
 
-       ret = rtl8xxxu_init_queue_priority(priv);
-       dev_dbg(dev, "%s: init_queue_priority %i\n", __func__, ret);
-       if (ret)
-               goto exit;
+       /*
+        * The vendor drivers set PBP for all devices, except 8192e.
+        * There is no explanation for this in any of the sources.
+        */
+       val8 = (priv->fops->pbp_rx << PBP_PAGE_SIZE_RX_SHIFT) |
+               (priv->fops->pbp_tx << PBP_PAGE_SIZE_TX_SHIFT);
+       if (priv->rtl_chip != RTL8192E)
+               rtl8xxxu_write8(priv, REG_PBP, val8);
 
-       /* RFSW Control - clear bit 14 ?? */
-       if (priv->rtl_chip != RTL8723B)
-               rtl8xxxu_write32(priv, REG_FPGA0_TX_INFO, 0x00000003);
-       /* 0x07000760 */
-       val32 = FPGA0_RF_TRSW | FPGA0_RF_TRSWB | FPGA0_RF_ANTSW |
-               FPGA0_RF_ANTSWB | FPGA0_RF_PAPE |
-               ((FPGA0_RF_ANTSW | FPGA0_RF_ANTSWB | FPGA0_RF_PAPE) <<
-                FPGA0_RF_BD_CTRL_SHIFT);
-       rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32);
-       /* 0x860[6:5]= 00 - why? - this sets antenna B */
-       rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, 0x66F60210);
+       dev_dbg(dev, "%s: macpower %i\n", __func__, macpower);
+       if (!macpower) {
+               ret = priv->fops->llt_init(priv, TX_TOTAL_PAGE_NUM);
+               if (ret) {
+                       dev_warn(dev, "%s: LLT table init failed\n", __func__);
+                       goto exit;
+               }
 
-       priv->rf_mode_ag[0] = rtl8xxxu_read_rfreg(priv, RF_A,
-                                                 RF6052_REG_MODE_AG);
+               /*
+                * Chip specific quirks
+                */
+               priv->fops->usb_quirks(priv);
 
-       /*
-        * Set RX page boundary
-        */
-       if (priv->rtl_chip == RTL8723B)
-               rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, 0x3f7f);
-       else
-               rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, 0x27ff);
-       /*
-        * Transfer page size is always 128
-        */
-       if (priv->rtl_chip == RTL8723B)
-               val8 = (PBP_PAGE_SIZE_256 << PBP_PAGE_SIZE_RX_SHIFT) |
-                       (PBP_PAGE_SIZE_256 << PBP_PAGE_SIZE_TX_SHIFT);
-       else
-               val8 = (PBP_PAGE_SIZE_128 << PBP_PAGE_SIZE_RX_SHIFT) |
-                       (PBP_PAGE_SIZE_128 << PBP_PAGE_SIZE_TX_SHIFT);
-       rtl8xxxu_write8(priv, REG_PBP, val8);
+               /*
+                * Presumably this is for 8188EU as well
+                * Enable TX report and TX report timer
+                */
+               if (priv->rtl_chip == RTL8723B) {
+                       val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL);
+                       val8 |= TX_REPORT_CTRL_TIMER_ENABLE;
+                       rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8);
+                       /* Set MAX RPT MACID */
+                       rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL + 1, 0x02);
+                       /* TX report Timer. Unit: 32us */
+                       rtl8xxxu_write16(priv, REG_TX_REPORT_TIME, 0xcdf0);
+
+                       /* tmp ps ? */
+                       val8 = rtl8xxxu_read8(priv, 0xa3);
+                       val8 &= 0xf8;
+                       rtl8xxxu_write8(priv, 0xa3, val8);
+               }
+       }
 
        /*
         * Unit in 8 bytes, not obvious what it is used for
         */
        rtl8xxxu_write8(priv, REG_RX_DRVINFO_SZ, 4);
 
-       /*
-        * Enable all interrupts - not obvious USB needs to do this
-        */
-       rtl8xxxu_write32(priv, REG_HISR, 0xffffffff);
-       rtl8xxxu_write32(priv, REG_HIMR, 0xffffffff);
+       if (priv->rtl_chip == RTL8192E) {
+               rtl8xxxu_write32(priv, REG_HIMR0, 0x00);
+               rtl8xxxu_write32(priv, REG_HIMR1, 0x00);
+       } else {
+               /*
+                * Enable all interrupts - not obvious USB needs to do this
+                */
+               rtl8xxxu_write32(priv, REG_HISR, 0xffffffff);
+               rtl8xxxu_write32(priv, REG_HIMR, 0xffffffff);
+       }
 
        rtl8xxxu_set_mac(priv);
        rtl8xxxu_set_linktype(priv, NL80211_IFTYPE_STATION);
@@ -6651,9 +8064,11 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
        priv->fops->set_tx_power(priv, 1, false);
 
        /* Let the 8051 take control of antenna setting */
-       val8 = rtl8xxxu_read8(priv, REG_LEDCFG2);
-       val8 |= LEDCFG2_DPDT_SELECT;
-       rtl8xxxu_write8(priv, REG_LEDCFG2, val8);
+       if (priv->rtl_chip != RTL8192E) {
+               val8 = rtl8xxxu_read8(priv, REG_LEDCFG2);
+               val8 |= LEDCFG2_DPDT_SELECT;
+               rtl8xxxu_write8(priv, REG_LEDCFG2, val8);
+       }
 
        rtl8xxxu_write8(priv, REG_HWSEQ_CTRL, 0xff);
 
@@ -6665,6 +8080,20 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
        if (priv->fops->init_statistics)
                priv->fops->init_statistics(priv);
 
+       if (priv->rtl_chip == RTL8192E) {
+               /*
+                * 0x4c6[3] 1: RTS BW = Data BW
+                * 0: RTS BW depends on CCA / secondary CCA result.
+                */
+               val8 = rtl8xxxu_read8(priv, REG_QUEUE_CTRL);
+               val8 &= ~BIT(3);
+               rtl8xxxu_write8(priv, REG_QUEUE_CTRL, val8);
+               /*
+                * Reset USB mode switch setting
+                */
+               rtl8xxxu_write8(priv, REG_ACLK_MON, 0x00);
+       }
+
        rtl8723a_phy_lc_calibrate(priv);
 
        priv->fops->phy_iq_calibrate(priv);
@@ -6672,7 +8101,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
        /*
         * This should enable thermal meter
         */
-       if (priv->fops->has_s0s1)
+       if (priv->fops->tx_desc_size == sizeof(struct rtl8xxxu_txdesc40))
                rtl8xxxu_write_rfreg(priv,
                                     RF_A, RF6052_REG_T_METER_8723B, 0x37cf8);
        else
@@ -6693,6 +8122,8 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
                        val32 |= FPGA_RF_MODE_CCK;
                        rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32);
                }
+       } else if (priv->rtl_chip == RTL8192E) {
+               rtl8xxxu_write8(priv, REG_USB_HRPWM, 0x00);
        }
 
        val32 = rtl8xxxu_read32(priv, REG_FWHW_TXQ_CTRL);
@@ -6700,17 +8131,20 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
        /* ack for xmit mgmt frames. */
        rtl8xxxu_write32(priv, REG_FWHW_TXQ_CTRL, val32);
 
+       if (priv->rtl_chip == RTL8192E) {
+               /*
+                * Fix LDPC rx hang issue.
+                */
+               val32 = rtl8xxxu_read32(priv, REG_AFE_MISC);
+               rtl8xxxu_write8(priv, REG_8192E_LDOV12_CTRL, 0x75);
+               val32 &= 0xfff00fff;
+               val32 |= 0x0007e000;
+               rtl8xxxu_write32(priv, REG_AFE_MISC, val32);
+       }
 exit:
        return ret;
 }
 
-static void rtl8xxxu_disable_device(struct ieee80211_hw *hw)
-{
-       struct rtl8xxxu_priv *priv = hw->priv;
-
-       priv->fops->power_off(priv);
-}
-
 static void rtl8xxxu_cam_write(struct rtl8xxxu_priv *priv,
                               struct ieee80211_key_conf *key, const u8 *mac)
 {
@@ -6775,8 +8209,8 @@ static void rtl8xxxu_sw_scan_complete(struct ieee80211_hw *hw,
        rtl8xxxu_write8(priv, REG_BEACON_CTRL, val8);
 }
 
-static void rtl8723au_update_rate_mask(struct rtl8xxxu_priv *priv,
-                                      u32 ramask, int sgi)
+static void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv,
+                                     u32 ramask, int sgi)
 {
        struct h2c_cmd h2c;
 
@@ -6795,8 +8229,8 @@ static void rtl8723au_update_rate_mask(struct rtl8xxxu_priv *priv,
        rtl8723a_h2c_cmd(priv, &h2c, sizeof(h2c.ramask));
 }
 
-static void rtl8723bu_update_rate_mask(struct rtl8xxxu_priv *priv,
-                                      u32 ramask, int sgi)
+static void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv,
+                                          u32 ramask, int sgi)
 {
        struct h2c_cmd h2c;
        u8 bw = 0;
@@ -6821,8 +8255,8 @@ static void rtl8723bu_update_rate_mask(struct rtl8xxxu_priv *priv,
        rtl8723a_h2c_cmd(priv, &h2c, sizeof(h2c.b_macid_cfg));
 }
 
-static void rtl8723au_report_connect(struct rtl8xxxu_priv *priv,
-                                    u8 macid, bool connect)
+static void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv,
+                                        u8 macid, bool connect)
 {
        struct h2c_cmd h2c;
 
@@ -6838,8 +8272,8 @@ static void rtl8723au_report_connect(struct rtl8xxxu_priv *priv,
        rtl8723a_h2c_cmd(priv, &h2c, sizeof(h2c.joinbss));
 }
 
-static void rtl8723bu_report_connect(struct rtl8xxxu_priv *priv,
-                                    u8 macid, bool connect)
+static void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv,
+                                        u8 macid, bool connect)
 {
        struct h2c_cmd h2c;
 
@@ -7492,15 +8926,22 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)
        }
 }
 
-static int rtl8723au_parse_rx_desc(struct rtl8xxxu_priv *priv,
+static int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv,
                                   struct sk_buff *skb,
                                   struct ieee80211_rx_status *rx_status)
 {
-       struct rtl8xxxu_rx_desc *rx_desc = (struct rtl8xxxu_rx_desc *)skb->data;
+       struct rtl8xxxu_rxdesc16 *rx_desc =
+               (struct rtl8xxxu_rxdesc16 *)skb->data;
        struct rtl8723au_phy_stats *phy_stats;
+       __le32 *_rx_desc_le = (__le32 *)skb->data;
+       u32 *_rx_desc = (u32 *)skb->data;
        int drvinfo_sz, desc_shift;
+       int i;
+
+       for (i = 0; i < (sizeof(struct rtl8xxxu_rxdesc16) / sizeof(u32)); i++)
+               _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]);
 
-       skb_pull(skb, sizeof(struct rtl8xxxu_rx_desc));
+       skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc16));
 
        phy_stats = (struct rtl8723au_phy_stats *)skb->data;
 
@@ -7532,16 +8973,22 @@ static int rtl8723au_parse_rx_desc(struct rtl8xxxu_priv *priv,
        return RX_TYPE_DATA_PKT;
 }
 
-static int rtl8723bu_parse_rx_desc(struct rtl8xxxu_priv *priv,
+static int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv,
                                   struct sk_buff *skb,
                                   struct ieee80211_rx_status *rx_status)
 {
-       struct rtl8723bu_rx_desc *rx_desc =
-               (struct rtl8723bu_rx_desc *)skb->data;
+       struct rtl8xxxu_rxdesc24 *rx_desc =
+               (struct rtl8xxxu_rxdesc24 *)skb->data;
        struct rtl8723au_phy_stats *phy_stats;
+       __le32 *_rx_desc_le = (__le32 *)skb->data;
+       u32 *_rx_desc = (u32 *)skb->data;
        int drvinfo_sz, desc_shift;
+       int i;
+
+       for (i = 0; i < (sizeof(struct rtl8xxxu_rxdesc24) / sizeof(u32)); i++)
+               _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]);
 
-       skb_pull(skb, sizeof(struct rtl8723bu_rx_desc));
+       skb_pull(skb, sizeof(struct rtl8xxxu_rxdesc24));
 
        phy_stats = (struct rtl8723au_phy_stats *)skb->data;
 
@@ -7633,12 +9080,7 @@ static void rtl8xxxu_rx_complete(struct urb *urb)
        struct sk_buff *skb = (struct sk_buff *)urb->context;
        struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
        struct device *dev = &priv->udev->dev;
-       __le32 *_rx_desc_le = (__le32 *)skb->data;
-       u32 *_rx_desc = (u32 *)skb->data;
-       int rx_type, i;
-
-       for (i = 0; i < (sizeof(struct rtl8xxxu_rx_desc) / sizeof(u32)); i++)
-               _rx_desc[i] = le32_to_cpu(_rx_desc_le[i]);
+       int rx_type;
 
        skb_put(skb, urb->actual_length);
 
@@ -7677,14 +9119,15 @@ static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv,
 {
        struct sk_buff *skb;
        int skb_size;
-       int ret;
+       int ret, rx_desc_sz;
 
-       skb_size = sizeof(struct rtl8xxxu_rx_desc) + RTL_RX_BUFFER_SIZE;
+       rx_desc_sz = priv->fops->rx_desc_size;
+       skb_size = rx_desc_sz + RTL_RX_BUFFER_SIZE;
        skb = __netdev_alloc_skb(NULL, skb_size, GFP_KERNEL);
        if (!skb)
                return -ENOMEM;
 
-       memset(skb->data, 0, sizeof(struct rtl8xxxu_rx_desc));
+       memset(skb->data, 0, rx_desc_sz);
        usb_fill_bulk_urb(&rx_urb->urb, priv->udev, priv->pipe_in, skb->data,
                          skb_size, rtl8xxxu_rx_complete, skb);
        usb_anchor_urb(&rx_urb->urb, &priv->rx_anchor);
@@ -8154,6 +9597,8 @@ static void rtl8xxxu_stop(struct ieee80211_hw *hw)
        if (priv->usb_interrupts)
                usb_kill_anchored_urbs(&priv->int_anchor);
 
+       rtl8xxxu_write8(priv, REG_TXPAUSE, 0xff);
+
        priv->fops->disable_rf(priv);
 
        /*
@@ -8286,6 +9731,10 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
                if (id->idProduct == 0x7811)
                        untested = 0;
                break;
+       case 0x050d:
+               if (id->idProduct == 0x1004)
+                       untested = 0;
+               break;
        default:
                break;
        }
@@ -8378,7 +9827,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
                dev_info(&udev->dev, "Enabling HT_20_40 on the 2.4GHz band\n");
                sband->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
        }
-       hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
+       hw->wiphy->bands[NL80211_BAND_2GHZ] = sband;
 
        hw->wiphy->rts_threshold = 2347;
 
@@ -8414,13 +9863,14 @@ static void rtl8xxxu_disconnect(struct usb_interface *interface)
        hw = usb_get_intfdata(interface);
        priv = hw->priv;
 
-       rtl8xxxu_disable_device(hw);
+       ieee80211_unregister_hw(hw);
+
+       priv->fops->power_off(priv);
+
        usb_set_intfdata(interface, NULL);
 
        dev_info(&priv->udev->dev, "disconnecting\n");
 
-       ieee80211_unregister_hw(hw);
-
        kfree(priv->fw_data);
        mutex_destroy(&priv->usb_buf_mutex);
        mutex_destroy(&priv->h2c_mutex);
@@ -8436,22 +9886,30 @@ static struct rtl8xxxu_fileops rtl8723au_fops = {
        .power_off = rtl8xxxu_power_off,
        .reset_8051 = rtl8xxxu_reset_8051,
        .llt_init = rtl8xxxu_init_llt_table,
-       .phy_iq_calibrate = rtl8723au_phy_iq_calibrate,
-       .config_channel = rtl8723au_config_channel,
-       .parse_rx_desc = rtl8723au_parse_rx_desc,
-       .enable_rf = rtl8723a_enable_rf,
-       .disable_rf = rtl8723a_disable_rf,
-       .set_tx_power = rtl8723a_set_tx_power,
-       .update_rate_mask = rtl8723au_update_rate_mask,
-       .report_connect = rtl8723au_report_connect,
+       .init_phy_bb = rtl8xxxu_gen1_init_phy_bb,
+       .init_phy_rf = rtl8723au_init_phy_rf,
+       .phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate,
+       .config_channel = rtl8xxxu_gen1_config_channel,
+       .parse_rx_desc = rtl8xxxu_parse_rxdesc16,
+       .enable_rf = rtl8xxxu_gen1_enable_rf,
+       .disable_rf = rtl8xxxu_gen1_disable_rf,
+       .usb_quirks = rtl8xxxu_gen1_usb_quirks,
+       .set_tx_power = rtl8xxxu_gen1_set_tx_power,
+       .update_rate_mask = rtl8xxxu_update_rate_mask,
+       .report_connect = rtl8xxxu_gen1_report_connect,
        .writeN_block_size = 1024,
        .mbox_ext_reg = REG_HMBOX_EXT_0,
        .mbox_ext_width = 2,
        .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32),
+       .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16),
        .adda_1t_init = 0x0b1b25a0,
        .adda_1t_path_on = 0x0bdb25a0,
        .adda_2t_path_on_a = 0x04db25a4,
        .adda_2t_path_on_b = 0x0b1b25a4,
+       .trxff_boundary = 0x27ff,
+       .pbp_rx = PBP_PAGE_SIZE_128,
+       .pbp_tx = PBP_PAGE_SIZE_128,
+       .mactable = rtl8xxxu_gen1_mac_init_table,
 };
 
 static struct rtl8xxxu_fileops rtl8723bu_fops = {
@@ -8461,26 +9919,34 @@ static struct rtl8xxxu_fileops rtl8723bu_fops = {
        .power_off = rtl8723bu_power_off,
        .reset_8051 = rtl8723bu_reset_8051,
        .llt_init = rtl8xxxu_auto_llt_table,
+       .init_phy_bb = rtl8723bu_init_phy_bb,
+       .init_phy_rf = rtl8723bu_init_phy_rf,
        .phy_init_antenna_selection = rtl8723bu_phy_init_antenna_selection,
        .phy_iq_calibrate = rtl8723bu_phy_iq_calibrate,
-       .config_channel = rtl8723bu_config_channel,
-       .parse_rx_desc = rtl8723bu_parse_rx_desc,
+       .config_channel = rtl8xxxu_gen2_config_channel,
+       .parse_rx_desc = rtl8xxxu_parse_rxdesc24,
        .init_aggregation = rtl8723bu_init_aggregation,
        .init_statistics = rtl8723bu_init_statistics,
        .enable_rf = rtl8723b_enable_rf,
-       .disable_rf = rtl8723b_disable_rf,
+       .disable_rf = rtl8xxxu_gen2_disable_rf,
+       .usb_quirks = rtl8xxxu_gen2_usb_quirks,
        .set_tx_power = rtl8723b_set_tx_power,
-       .update_rate_mask = rtl8723bu_update_rate_mask,
-       .report_connect = rtl8723bu_report_connect,
+       .update_rate_mask = rtl8xxxu_gen2_update_rate_mask,
+       .report_connect = rtl8xxxu_gen2_report_connect,
        .writeN_block_size = 1024,
        .mbox_ext_reg = REG_HMBOX_EXT0_8723B,
        .mbox_ext_width = 4,
        .tx_desc_size = sizeof(struct rtl8xxxu_txdesc40),
+       .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24),
        .has_s0s1 = 1,
        .adda_1t_init = 0x01c00014,
        .adda_1t_path_on = 0x01c00014,
        .adda_2t_path_on_a = 0x01c00014,
        .adda_2t_path_on_b = 0x01c00014,
+       .trxff_boundary = 0x3f7f,
+       .pbp_rx = PBP_PAGE_SIZE_256,
+       .pbp_tx = PBP_PAGE_SIZE_256,
+       .mactable = rtl8723b_mac_init_table,
 };
 
 #ifdef CONFIG_RTL8XXXU_UNTESTED
@@ -8492,22 +9958,30 @@ static struct rtl8xxxu_fileops rtl8192cu_fops = {
        .power_off = rtl8xxxu_power_off,
        .reset_8051 = rtl8xxxu_reset_8051,
        .llt_init = rtl8xxxu_init_llt_table,
-       .phy_iq_calibrate = rtl8723au_phy_iq_calibrate,
-       .config_channel = rtl8723au_config_channel,
-       .parse_rx_desc = rtl8723au_parse_rx_desc,
-       .enable_rf = rtl8723a_enable_rf,
-       .disable_rf = rtl8723a_disable_rf,
-       .set_tx_power = rtl8723a_set_tx_power,
-       .update_rate_mask = rtl8723au_update_rate_mask,
-       .report_connect = rtl8723au_report_connect,
+       .init_phy_bb = rtl8xxxu_gen1_init_phy_bb,
+       .init_phy_rf = rtl8192cu_init_phy_rf,
+       .phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate,
+       .config_channel = rtl8xxxu_gen1_config_channel,
+       .parse_rx_desc = rtl8xxxu_parse_rxdesc16,
+       .enable_rf = rtl8xxxu_gen1_enable_rf,
+       .disable_rf = rtl8xxxu_gen1_disable_rf,
+       .usb_quirks = rtl8xxxu_gen1_usb_quirks,
+       .set_tx_power = rtl8xxxu_gen1_set_tx_power,
+       .update_rate_mask = rtl8xxxu_update_rate_mask,
+       .report_connect = rtl8xxxu_gen1_report_connect,
        .writeN_block_size = 128,
        .mbox_ext_reg = REG_HMBOX_EXT_0,
        .mbox_ext_width = 2,
        .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32),
+       .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16),
        .adda_1t_init = 0x0b1b25a0,
        .adda_1t_path_on = 0x0bdb25a0,
        .adda_2t_path_on_a = 0x04db25a4,
        .adda_2t_path_on_b = 0x0b1b25a4,
+       .trxff_boundary = 0x27ff,
+       .pbp_rx = PBP_PAGE_SIZE_128,
+       .pbp_tx = PBP_PAGE_SIZE_128,
+       .mactable = rtl8xxxu_gen1_mac_init_table,
 };
 
 #endif
@@ -8519,23 +9993,33 @@ static struct rtl8xxxu_fileops rtl8192eu_fops = {
        .power_off = rtl8xxxu_power_off,
        .reset_8051 = rtl8xxxu_reset_8051,
        .llt_init = rtl8xxxu_auto_llt_table,
-       .phy_iq_calibrate = rtl8723bu_phy_iq_calibrate,
-       .config_channel = rtl8723bu_config_channel,
-       .parse_rx_desc = rtl8723bu_parse_rx_desc,
-       .enable_rf = rtl8723b_enable_rf,
-       .disable_rf = rtl8723b_disable_rf,
-       .set_tx_power = rtl8723b_set_tx_power,
-       .update_rate_mask = rtl8723bu_update_rate_mask,
-       .report_connect = rtl8723bu_report_connect,
+       .init_phy_bb = rtl8192eu_init_phy_bb,
+       .init_phy_rf = rtl8192eu_init_phy_rf,
+       .phy_iq_calibrate = rtl8192eu_phy_iq_calibrate,
+       .config_channel = rtl8xxxu_gen2_config_channel,
+       .parse_rx_desc = rtl8xxxu_parse_rxdesc24,
+       .enable_rf = rtl8192e_enable_rf,
+       .disable_rf = rtl8xxxu_gen2_disable_rf,
+       .usb_quirks = rtl8xxxu_gen2_usb_quirks,
+       .set_tx_power = rtl8192e_set_tx_power,
+       .update_rate_mask = rtl8xxxu_gen2_update_rate_mask,
+       .report_connect = rtl8xxxu_gen2_report_connect,
        .writeN_block_size = 128,
        .mbox_ext_reg = REG_HMBOX_EXT0_8723B,
        .mbox_ext_width = 4,
        .tx_desc_size = sizeof(struct rtl8xxxu_txdesc40),
-       .has_s0s1 = 1,
+       .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24),
+       .has_s0s1 = 0,
        .adda_1t_init = 0x0fc01616,
        .adda_1t_path_on = 0x0fc01616,
        .adda_2t_path_on_a = 0x0fc01616,
        .adda_2t_path_on_b = 0x0fc01616,
+       .trxff_boundary = 0x3cff,
+       .mactable = rtl8192e_mac_init_table,
+       .total_page_num = TX_TOTAL_PAGE_NUM_8192E,
+       .page_num_hi = TX_PAGE_NUM_HI_PQ_8192E,
+       .page_num_lo = TX_PAGE_NUM_LO_PQ_8192E,
+       .page_num_norm = TX_PAGE_NUM_NORM_PQ_8192E,
 };
 
 static struct usb_device_id dev_table[] = {
@@ -8560,6 +10044,9 @@ static struct usb_device_id dev_table[] = {
 /* Tested by Larry Finger */
 {USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0x7811, 0xff, 0xff, 0xff),
        .driver_info = (unsigned long)&rtl8192cu_fops},
+/* Tested by Andrea Merello */
+{USB_DEVICE_AND_INTERFACE_INFO(0x050d, 0x1004, 0xff, 0xff, 0xff),
+       .driver_info = (unsigned long)&rtl8192cu_fops},
 /* Currently untested 8188 series devices */
 {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8191, 0xff, 0xff, 0xff),
        .driver_info = (unsigned long)&rtl8192cu_fops},
@@ -8644,8 +10131,6 @@ static struct usb_device_id dev_table[] = {
 /* Currently untested 8192 series devices */
 {USB_DEVICE_AND_INTERFACE_INFO(0x04bb, 0x0950, 0xff, 0xff, 0xff),
        .driver_info = (unsigned long)&rtl8192cu_fops},
-{USB_DEVICE_AND_INTERFACE_INFO(0x050d, 0x1004, 0xff, 0xff, 0xff),
-       .driver_info = (unsigned long)&rtl8192cu_fops},
 {USB_DEVICE_AND_INTERFACE_INFO(0x050d, 0x2102, 0xff, 0xff, 0xff),
        .driver_info = (unsigned long)&rtl8192cu_fops},
 {USB_DEVICE_AND_INTERFACE_INFO(0x050d, 0x2103, 0xff, 0xff, 0xff),
@@ -8701,6 +10186,7 @@ static struct usb_driver rtl8xxxu_driver = {
        .probe = rtl8xxxu_probe,
        .disconnect = rtl8xxxu_disconnect,
        .id_table = dev_table,
+       .no_dynamic_id = 1,
        .disable_hub_initiated_lpm = 1,
 };
 
index 455e112..3e2643c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 - 2015 Jes Sorensen <Jes.Sorensen@redhat.com>
+ * Copyright (c) 2014 - 2016 Jes Sorensen <Jes.Sorensen@redhat.com>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 #define REALTEK_USB_CMD_IDX            0x00
 
 #define TX_TOTAL_PAGE_NUM              0xf8
+#define TX_TOTAL_PAGE_NUM_8192E                0xf3
 /* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */
 #define TX_PAGE_NUM_PUBQ               0xe7
 #define TX_PAGE_NUM_HI_PQ              0x0c
 #define TX_PAGE_NUM_LO_PQ              0x02
 #define TX_PAGE_NUM_NORM_PQ            0x02
 
+#define TX_PAGE_NUM_PUBQ_8192E         0xe7
+#define TX_PAGE_NUM_HI_PQ_8192E                0x08
+#define TX_PAGE_NUM_LO_PQ_8192E                0x0c
+#define TX_PAGE_NUM_NORM_PQ_8192E      0x00
+
 #define RTL_FW_PAGE_SIZE               4096
 #define RTL8XXXU_FIRMWARE_POLL_MAX     1000
 
@@ -95,7 +101,7 @@ enum rtl8xxxu_rx_type {
        RX_TYPE_ERROR = -1
 };
 
-struct rtl8xxxu_rx_desc {
+struct rtl8xxxu_rxdesc16 {
 #ifdef __LITTLE_ENDIAN
        u32 pktlen:14;
        u32 crc32:1;
@@ -231,7 +237,7 @@ struct rtl8xxxu_rx_desc {
 #endif
 };
 
-struct rtl8723bu_rx_desc {
+struct rtl8xxxu_rxdesc24 {
 #ifdef __LITTLE_ENDIAN
        u32 pktlen:14;
        u32 crc32:1;
@@ -623,6 +629,31 @@ struct rtl8xxxu_firmware_header {
        u8      data[0];
 };
 
+/*
+ * 8723au/8192cu/8188ru required base power index offset tables.
+ */
+struct rtl8xxxu_power_base {
+       u32 reg_0e00;
+       u32 reg_0e04;
+       u32 reg_0e08;
+       u32 reg_086c;
+
+       u32 reg_0e10;
+       u32 reg_0e14;
+       u32 reg_0e18;
+       u32 reg_0e1c;
+
+       u32 reg_0830;
+       u32 reg_0834;
+       u32 reg_0838;
+       u32 reg_086c_2;
+
+       u32 reg_083c;
+       u32 reg_0848;
+       u32 reg_084c;
+       u32 reg_0868;
+};
+
 /*
  * The 8723au has 3 channel groups: 1-3, 4-9, and 10-14
  */
@@ -787,55 +818,49 @@ struct rtl8192eu_efuse_tx_power {
        u8 cck_base[6];
        u8 ht40_base[5];
        struct rtl8723au_idx ht20_ofdm_1s_diff;
-       struct rtl8723au_idx ht40_ht20_2s_diff;
-       struct rtl8723au_idx ofdm_cck_2s_diff; /* not used */
-       struct rtl8723au_idx ht40_ht20_3s_diff;
-       struct rtl8723au_idx ofdm_cck_3s_diff; /* not used */
-       struct rtl8723au_idx ht40_ht20_4s_diff;
-       struct rtl8723au_idx ofdm_cck_4s_diff; /* not used */
+       struct rtl8723bu_pwr_idx pwr_diff[3];
+       u8 dummy5g[24]; /* max channel group (14) + power diff offset (10) */
 };
 
 struct rtl8192eu_efuse {
        __le16 rtl_id;
        u8 res0[0x0e];
        struct rtl8192eu_efuse_tx_power tx_power_index_A;       /* 0x10 */
-       struct rtl8192eu_efuse_tx_power tx_power_index_B;       /* 0x22 */
-       struct rtl8192eu_efuse_tx_power tx_power_index_C;       /* 0x34 */
-       struct rtl8192eu_efuse_tx_power tx_power_index_D;       /* 0x46 */
-       u8 res1[0x60];
+       struct rtl8192eu_efuse_tx_power tx_power_index_B;       /* 0x3a */
+       u8 res2[0x54];
        u8 channel_plan;                /* 0xb8 */
        u8 xtal_k;
        u8 thermal_meter;
        u8 iqk_lck;
        u8 pa_type;                     /* 0xbc */
        u8 lna_type_2g;                 /* 0xbd */
-       u8 res2[1];
+       u8 res3[1];
        u8 lna_type_5g;                 /* 0xbf */
-       u8 res13[1];
+       u8 res4[1];
        u8 rf_board_option;
        u8 rf_feature_option;
        u8 rf_bt_setting;
        u8 eeprom_version;
        u8 eeprom_customer_id;
-       u8 res3[3];
+       u8 res5[3];
        u8 rf_antenna_option;           /* 0xc9 */
-       u8 res4[6];
+       u8 res6[6];
        u8 vid;                         /* 0xd0 */
-       u8 res5[1];
+       u8 res7[1];
        u8 pid;                         /* 0xd2 */
-       u8 res6[1];
+       u8 res8[1];
        u8 usb_optional_function;
-       u8 res7[2];
+       u8 res9[2];
        u8 mac_addr[ETH_ALEN];          /* 0xd7 */
-       u8 res8[2];
+       u8 res10[2];
        u8 vendor_name[7];
-       u8 res9[2];
+       u8 res11[2];
        u8 device_name[0x0b];           /* 0xe8 */
-       u8 res10[2];
+       u8 res12[2];
        u8 serial[0x0b];                /* 0xf5 */
-       u8 res11[0x30];
+       u8 res13[0x30];
        u8 unknown[0x0d];               /* 0x130 */
-       u8 res12[0xc3];
+       u8 res14[0xc3];
 };
 
 struct rtl8xxxu_reg8val {
@@ -1201,6 +1226,7 @@ struct rtl8xxxu_priv {
        struct rtl8723au_idx ofdm_tx_power_diff[RTL8723B_TX_COUNT];
        struct rtl8723au_idx ht20_tx_power_diff[RTL8723B_TX_COUNT];
        struct rtl8723au_idx ht40_tx_power_diff[RTL8723B_TX_COUNT];
+       struct rtl8xxxu_power_base *power_base;
        u32 chip_cut:4;
        u32 rom_rev:4;
        u32 is_multi_func:1;
@@ -1228,7 +1254,6 @@ struct rtl8xxxu_priv {
        u8 rf_paths;
        u8 rx_paths;
        u8 tx_paths;
-       u32 rf_mode_ag[2];
        u32 rege94;
        u32 rege9c;
        u32 regeb4;
@@ -1262,6 +1287,7 @@ struct rtl8xxxu_priv {
        u32 bb_recovery_backup[RTL8XXXU_BB_REGS];
        enum rtl8xxxu_rtl_chip rtl_chip;
        u8 pi_enabled:1;
+       u8 no_pape:1;
        u8 int_buf[USB_INTR_CONTENT_LENGTH];
 };
 
@@ -1284,6 +1310,8 @@ struct rtl8xxxu_fileops {
        void (*power_off) (struct rtl8xxxu_priv *priv);
        void (*reset_8051) (struct rtl8xxxu_priv *priv);
        int (*llt_init) (struct rtl8xxxu_priv *priv, u8 last_tx_page);
+       void (*init_phy_bb) (struct rtl8xxxu_priv *priv);
+       int (*init_phy_rf) (struct rtl8xxxu_priv *priv);
        void (*phy_init_antenna_selection) (struct rtl8xxxu_priv *priv);
        void (*phy_iq_calibrate) (struct rtl8xxxu_priv *priv);
        void (*config_channel) (struct ieee80211_hw *hw);
@@ -1293,6 +1321,7 @@ struct rtl8xxxu_fileops {
        void (*init_statistics) (struct rtl8xxxu_priv *priv);
        void (*enable_rf) (struct rtl8xxxu_priv *priv);
        void (*disable_rf) (struct rtl8xxxu_priv *priv);
+       void (*usb_quirks) (struct rtl8xxxu_priv *priv);
        void (*set_tx_power) (struct rtl8xxxu_priv *priv, int channel,
                              bool ht40);
        void (*update_rate_mask) (struct rtl8xxxu_priv *priv,
@@ -1303,9 +1332,18 @@ struct rtl8xxxu_fileops {
        u16 mbox_ext_reg;
        char mbox_ext_width;
        char tx_desc_size;
+       char rx_desc_size;
        char has_s0s1;
        u32 adda_1t_init;
        u32 adda_1t_path_on;
        u32 adda_2t_path_on_a;
        u32 adda_2t_path_on_b;
+       u16 trxff_boundary;
+       u8 pbp_rx;
+       u8 pbp_tx;
+       struct rtl8xxxu_reg8val *mactable;
+       u8 total_page_num;
+       u8 page_num_hi;
+       u8 page_num_lo;
+       u8 page_num_norm;
 };
index ade42fe..b0e0c64 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 - 2015 Jes Sorensen <Jes.Sorensen@redhat.com>
+ * Copyright (c) 2014 - 2016 Jes Sorensen <Jes.Sorensen@redhat.com>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 #define  AFE_XTAL_GATE_DIG             BIT(17)
 #define  AFE_XTAL_BT_GATE              BIT(20)
 
+/*
+ * 0x0028 is also known as REG_AFE_CTRL2 on 8723bu/8192eu
+ */
 #define REG_AFE_PLL_CTRL               0x0028
 #define  AFE_PLL_ENABLE                        BIT(0)
 #define  AFE_PLL_320_ENABLE            BIT(1)
                                                   control */
 #define  MULTI_GPS_FUNC_EN             BIT(22) /* GPS function enable */
 
+#define REG_AFE_CTRL4                  0x0078  /* 8192eu/8723bu */
 #define REG_LDO_SW_CTRL                        0x007c  /* 8192eu */
 
 #define REG_MCU_FW_DL                  0x0080
 #define REG_RQPN                       0x0200
 #define  RQPN_HI_PQ_SHIFT              0
 #define  RQPN_LO_PQ_SHIFT              8
-#define  RQPN_NORM_PQ_SHIFT            16
+#define  RQPN_PUB_PQ_SHIFT             16
 #define  RQPN_LOAD                     BIT(31)
 
 #define REG_FIFOPAGE                   0x0204
 #define REG_PKT_VO_VI_LIFE_TIME                0x04c0
 #define REG_PKT_BE_BK_LIFE_TIME                0x04c2
 #define REG_STBC_SETTING               0x04c4
+#define REG_QUEUE_CTRL                 0x04c6
 #define REG_HT_SINGLE_AMPDU_8723B      0x04c7
 #define REG_PROT_MODE_CTRL             0x04c8
 #define REG_MAX_AGGR_NUM               0x04ca
 #define  CCK0_SIDEBAND                 BIT(4)
 
 #define REG_CCK0_AFE_SETTING           0x0a04
+#define  CCK0_AFE_RX_MASK              0x0f000000
+#define  CCK0_AFE_RX_ANT_AB            BIT(24)
+#define  CCK0_AFE_RX_ANT_A             0
+#define  CCK0_AFE_RX_ANT_B             (BIT(24) | BIT(26))
 
 #define REG_CONFIG_ANT_A               0x0b68
 #define REG_CONFIG_ANT_B               0x0b6c
 #define  USB_HIMR_ROK                  BIT(0)  /*  Receive DMA OK Interrupt */
 
 #define REG_USB_SPECIAL_OPTION         0xfe55
+#define REG_USB_HRPWM                  0xfe58
 #define REG_USB_DMA_AGG_TO             0xfe5b
 #define REG_USB_AGG_TO                 0xfe5c
 #define REG_USB_AGG_TH                 0xfe5d
 #define RF6052_REG_T_METER_8723B       0x42
 #define RF6052_REG_UNKNOWN_43          0x43
 #define RF6052_REG_UNKNOWN_55          0x55
+#define RF6052_REG_UNKNOWN_56          0x56
 #define RF6052_REG_S0S1                        0xb0
 #define RF6052_REG_UNKNOWN_DF          0xdf
 #define RF6052_REG_UNKNOWN_ED          0xed
index 0517a4f..c74eb13 100644 (file)
@@ -131,7 +131,7 @@ static struct ieee80211_rate rtl_ratetable_5g[] = {
 };
 
 static const struct ieee80211_supported_band rtl_band_2ghz = {
-       .band = IEEE80211_BAND_2GHZ,
+       .band = NL80211_BAND_2GHZ,
 
        .channels = rtl_channeltable_2g,
        .n_channels = ARRAY_SIZE(rtl_channeltable_2g),
@@ -143,7 +143,7 @@ static const struct ieee80211_supported_band rtl_band_2ghz = {
 };
 
 static struct ieee80211_supported_band rtl_band_5ghz = {
-       .band = IEEE80211_BAND_5GHZ,
+       .band = NL80211_BAND_5GHZ,
 
        .channels = rtl_channeltable_5g,
        .n_channels = ARRAY_SIZE(rtl_channeltable_5g),
@@ -197,7 +197,7 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw,
 
        ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
 
-       /*hw->wiphy->bands[IEEE80211_BAND_2GHZ]
+       /*hw->wiphy->bands[NL80211_BAND_2GHZ]
         *base on ant_num
         *rx_mask: RX mask
         *if rx_ant = 1 rx_mask[0]= 0xff;==>MCS0-MCS7
@@ -328,26 +328,26 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
            rtlhal->bandset == BAND_ON_BOTH) {
                /* 1: 2.4 G bands */
                /* <1> use  mac->bands as mem for hw->wiphy->bands */
-               sband = &(rtlmac->bands[IEEE80211_BAND_2GHZ]);
+               sband = &(rtlmac->bands[NL80211_BAND_2GHZ]);
 
-               /* <2> set hw->wiphy->bands[IEEE80211_BAND_2GHZ]
+               /* <2> set hw->wiphy->bands[NL80211_BAND_2GHZ]
                 * to default value(1T1R) */
-               memcpy(&(rtlmac->bands[IEEE80211_BAND_2GHZ]), &rtl_band_2ghz,
+               memcpy(&(rtlmac->bands[NL80211_BAND_2GHZ]), &rtl_band_2ghz,
                                sizeof(struct ieee80211_supported_band));
 
                /* <3> init ht cap base on ant_num */
                _rtl_init_hw_ht_capab(hw, &sband->ht_cap);
 
                /* <4> set mac->sband to wiphy->sband */
-               hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
+               hw->wiphy->bands[NL80211_BAND_2GHZ] = sband;
 
                /* 2: 5 G bands */
                /* <1> use  mac->bands as mem for hw->wiphy->bands */
-               sband = &(rtlmac->bands[IEEE80211_BAND_5GHZ]);
+               sband = &(rtlmac->bands[NL80211_BAND_5GHZ]);
 
-               /* <2> set hw->wiphy->bands[IEEE80211_BAND_5GHZ]
+               /* <2> set hw->wiphy->bands[NL80211_BAND_5GHZ]
                 * to default value(1T1R) */
-               memcpy(&(rtlmac->bands[IEEE80211_BAND_5GHZ]), &rtl_band_5ghz,
+               memcpy(&(rtlmac->bands[NL80211_BAND_5GHZ]), &rtl_band_5ghz,
                                sizeof(struct ieee80211_supported_band));
 
                /* <3> init ht cap base on ant_num */
@@ -355,15 +355,15 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
 
                _rtl_init_hw_vht_capab(hw, &sband->vht_cap);
                /* <4> set mac->sband to wiphy->sband */
-               hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
+               hw->wiphy->bands[NL80211_BAND_5GHZ] = sband;
        } else {
                if (rtlhal->current_bandtype == BAND_ON_2_4G) {
                        /* <1> use  mac->bands as mem for hw->wiphy->bands */
-                       sband = &(rtlmac->bands[IEEE80211_BAND_2GHZ]);
+                       sband = &(rtlmac->bands[NL80211_BAND_2GHZ]);
 
-                       /* <2> set hw->wiphy->bands[IEEE80211_BAND_2GHZ]
+                       /* <2> set hw->wiphy->bands[NL80211_BAND_2GHZ]
                         * to default value(1T1R) */
-                       memcpy(&(rtlmac->bands[IEEE80211_BAND_2GHZ]),
+                       memcpy(&(rtlmac->bands[NL80211_BAND_2GHZ]),
                               &rtl_band_2ghz,
                               sizeof(struct ieee80211_supported_band));
 
@@ -371,14 +371,14 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
                        _rtl_init_hw_ht_capab(hw, &sband->ht_cap);
 
                        /* <4> set mac->sband to wiphy->sband */
-                       hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
+                       hw->wiphy->bands[NL80211_BAND_2GHZ] = sband;
                } else if (rtlhal->current_bandtype == BAND_ON_5G) {
                        /* <1> use  mac->bands as mem for hw->wiphy->bands */
-                       sband = &(rtlmac->bands[IEEE80211_BAND_5GHZ]);
+                       sband = &(rtlmac->bands[NL80211_BAND_5GHZ]);
 
-                       /* <2> set hw->wiphy->bands[IEEE80211_BAND_5GHZ]
+                       /* <2> set hw->wiphy->bands[NL80211_BAND_5GHZ]
                         * to default value(1T1R) */
-                       memcpy(&(rtlmac->bands[IEEE80211_BAND_5GHZ]),
+                       memcpy(&(rtlmac->bands[NL80211_BAND_5GHZ]),
                               &rtl_band_5ghz,
                               sizeof(struct ieee80211_supported_band));
 
@@ -387,7 +387,7 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
 
                        _rtl_init_hw_vht_capab(hw, &sband->vht_cap);
                        /* <4> set mac->sband to wiphy->sband */
-                       hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
+                       hw->wiphy->bands[NL80211_BAND_5GHZ] = sband;
                } else {
                        RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Err BAND %d\n",
                                 rtlhal->current_bandtype);
@@ -861,7 +861,7 @@ static u8 _rtl_get_highest_n_rate(struct ieee80211_hw *hw,
 
 /* mac80211's rate_idx is like this:
  *
- * 2.4G band:rx_status->band == IEEE80211_BAND_2GHZ
+ * 2.4G band:rx_status->band == NL80211_BAND_2GHZ
  *
  * B/G rate:
  * (rx_status->flag & RX_FLAG_HT) = 0,
@@ -871,7 +871,7 @@ static u8 _rtl_get_highest_n_rate(struct ieee80211_hw *hw,
  * (rx_status->flag & RX_FLAG_HT) = 1,
  * DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
  *
- * 5G band:rx_status->band == IEEE80211_BAND_5GHZ
+ * 5G band:rx_status->band == NL80211_BAND_5GHZ
  * A rate:
  * (rx_status->flag & RX_FLAG_HT) = 0,
  * DESC_RATE6M-->DESC_RATE54M ==> idx is 0-->7,
@@ -958,7 +958,7 @@ int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht, bool isvht,
                return rate_idx;
        }
        if (false == isht) {
-               if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
+               if (NL80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
                        switch (desc_rate) {
                        case DESC_RATE1M:
                                rate_idx = 0;
index 5be3411..3524441 100644 (file)
@@ -154,13 +154,13 @@ static bool _rtl_is_radar_freq(u16 center_freq)
 static void _rtl_reg_apply_beaconing_flags(struct wiphy *wiphy,
                                           enum nl80211_reg_initiator initiator)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        const struct ieee80211_reg_rule *reg_rule;
        struct ieee80211_channel *ch;
        unsigned int i;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
 
                if (!wiphy->bands[band])
                        continue;
@@ -210,9 +210,9 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy,
        struct ieee80211_channel *ch;
        const struct ieee80211_reg_rule *reg_rule;
 
-       if (!wiphy->bands[IEEE80211_BAND_2GHZ])
+       if (!wiphy->bands[NL80211_BAND_2GHZ])
                return;
-       sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+       sband = wiphy->bands[NL80211_BAND_2GHZ];
 
        /*
         *If no country IE has been received always enable active scan
@@ -262,10 +262,10 @@ static void _rtl_reg_apply_radar_flags(struct wiphy *wiphy)
        struct ieee80211_channel *ch;
        unsigned int i;
 
-       if (!wiphy->bands[IEEE80211_BAND_5GHZ])
+       if (!wiphy->bands[NL80211_BAND_5GHZ])
                return;
 
-       sband = wiphy->bands[IEEE80211_BAND_5GHZ];
+       sband = wiphy->bands[NL80211_BAND_5GHZ];
 
        for (i = 0; i < sband->n_channels; i++) {
                ch = &sband->channels[i];
@@ -301,12 +301,12 @@ static void _rtl_reg_apply_world_flags(struct wiphy *wiphy,
 
 static void _rtl_dump_channel_map(struct wiphy *wiphy)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *ch;
        unsigned int i;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                if (!wiphy->bands[band])
                        continue;
                sband = wiphy->bands[band];
index ddf74d5..0c3b9ce 100644 (file)
@@ -959,7 +959,7 @@ static void _rtl8821ae_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw)
 static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start,
                                                u8 end, u8 base_val)
 {
-       char i = 0;
+       int i;
        u8 temp_value = 0;
        u32 temp_data = 0;
 
index 389dc47..11d9c23 100644 (file)
@@ -1359,7 +1359,7 @@ struct rtl_mac {
        u32 tx_ss_num;
        u32 rx_ss_num;
 
-       struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band bands[NUM_NL80211_BANDS];
        struct ieee80211_hw *hw;
        struct ieee80211_vif *vif;
        enum nl80211_iftype opmode;
index a13d1f2..569918c 100644 (file)
@@ -1291,7 +1291,7 @@ static int set_channel(struct usbnet *usbdev, int channel)
                return 0;
 
        dsconfig = 1000 *
-               ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
+               ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
 
        len = sizeof(config);
        ret = rndis_query_oid(usbdev,
@@ -3476,7 +3476,7 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
        priv->band.n_channels = ARRAY_SIZE(rndis_channels);
        priv->band.bitrates = priv->rates;
        priv->band.n_bitrates = ARRAY_SIZE(rndis_rates);
-       wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+       wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
        wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
 
        memcpy(priv->cipher_suites, rndis_cipher_suites,
index 4df992d..dbb2389 100644 (file)
 #include "rsi_common.h"
 
 static const struct ieee80211_channel rsi_2ghz_channels[] = {
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2412,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2412,
          .hw_value = 1 }, /* Channel 1 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2417,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2417,
          .hw_value = 2 }, /* Channel 2 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2422,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2422,
          .hw_value = 3 }, /* Channel 3 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2427,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2427,
          .hw_value = 4 }, /* Channel 4 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2432,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2432,
          .hw_value = 5 }, /* Channel 5 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2437,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2437,
          .hw_value = 6 }, /* Channel 6 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2442,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2442,
          .hw_value = 7 }, /* Channel 7 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2447,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2447,
          .hw_value = 8 }, /* Channel 8 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2452,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2452,
          .hw_value = 9 }, /* Channel 9 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2457,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2457,
          .hw_value = 10 }, /* Channel 10 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2462,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2462,
          .hw_value = 11 }, /* Channel 11 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2467,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2467,
          .hw_value = 12 }, /* Channel 12 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2472,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2472,
          .hw_value = 13 }, /* Channel 13 */
-       { .band = IEEE80211_BAND_2GHZ, .center_freq = 2484,
+       { .band = NL80211_BAND_2GHZ, .center_freq = 2484,
          .hw_value = 14 }, /* Channel 14 */
 };
 
 static const struct ieee80211_channel rsi_5ghz_channels[] = {
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5180,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5180,
          .hw_value = 36,  }, /* Channel 36 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5200,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5200,
          .hw_value = 40, }, /* Channel 40 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5220,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5220,
          .hw_value = 44, }, /* Channel 44 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5240,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5240,
          .hw_value = 48, }, /* Channel 48 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5260,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5260,
          .hw_value = 52, }, /* Channel 52 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5280,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5280,
          .hw_value = 56, }, /* Channel 56 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5300,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5300,
          .hw_value = 60, }, /* Channel 60 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5320,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5320,
          .hw_value = 64, }, /* Channel 64 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5500,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5500,
          .hw_value = 100, }, /* Channel 100 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5520,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5520,
          .hw_value = 104, }, /* Channel 104 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5540,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5540,
          .hw_value = 108, }, /* Channel 108 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5560,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5560,
          .hw_value = 112, }, /* Channel 112 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5580,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5580,
          .hw_value = 116, }, /* Channel 116 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5600,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5600,
          .hw_value = 120, }, /* Channel 120 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5620,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5620,
          .hw_value = 124, }, /* Channel 124 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5640,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5640,
          .hw_value = 128, }, /* Channel 128 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5660,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5660,
          .hw_value = 132, }, /* Channel 132 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5680,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5680,
          .hw_value = 136, }, /* Channel 136 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5700,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5700,
          .hw_value = 140, }, /* Channel 140 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5745,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5745,
          .hw_value = 149, }, /* Channel 149 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5765,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5765,
          .hw_value = 153, }, /* Channel 153 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5785,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5785,
          .hw_value = 157, }, /* Channel 157 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5805,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5805,
          .hw_value = 161, }, /* Channel 161 */
-       { .band = IEEE80211_BAND_5GHZ, .center_freq = 5825,
+       { .band = NL80211_BAND_5GHZ, .center_freq = 5825,
          .hw_value = 165, }, /* Channel 165 */
 };
 
@@ -150,12 +150,12 @@ static void rsi_register_rates_channels(struct rsi_hw *adapter, int band)
        struct ieee80211_supported_band *sbands = &adapter->sbands[band];
        void *channels = NULL;
 
-       if (band == IEEE80211_BAND_2GHZ) {
+       if (band == NL80211_BAND_2GHZ) {
                channels = kmalloc(sizeof(rsi_2ghz_channels), GFP_KERNEL);
                memcpy(channels,
                       rsi_2ghz_channels,
                       sizeof(rsi_2ghz_channels));
-               sbands->band = IEEE80211_BAND_2GHZ;
+               sbands->band = NL80211_BAND_2GHZ;
                sbands->n_channels = ARRAY_SIZE(rsi_2ghz_channels);
                sbands->bitrates = rsi_rates;
                sbands->n_bitrates = ARRAY_SIZE(rsi_rates);
@@ -164,7 +164,7 @@ static void rsi_register_rates_channels(struct rsi_hw *adapter, int band)
                memcpy(channels,
                       rsi_5ghz_channels,
                       sizeof(rsi_5ghz_channels));
-               sbands->band = IEEE80211_BAND_5GHZ;
+               sbands->band = NL80211_BAND_5GHZ;
                sbands->n_channels = ARRAY_SIZE(rsi_5ghz_channels);
                sbands->bitrates = &rsi_rates[4];
                sbands->n_bitrates = ARRAY_SIZE(rsi_rates) - 4;
@@ -775,7 +775,7 @@ static int rsi_mac80211_set_rate_mask(struct ieee80211_hw *hw,
 {
        struct rsi_hw *adapter = hw->priv;
        struct rsi_common *common = adapter->priv;
-       enum ieee80211_band band = hw->conf.chandef.chan->band;
+       enum nl80211_band band = hw->conf.chandef.chan->band;
 
        mutex_lock(&common->mutex);
        common->fixedrate_mask[band] = 0;
@@ -999,8 +999,8 @@ static int rsi_mac80211_sta_remove(struct ieee80211_hw *hw,
 
        mutex_lock(&common->mutex);
        /* Resetting all the fields to default values */
-       common->bitrate_mask[IEEE80211_BAND_2GHZ] = 0;
-       common->bitrate_mask[IEEE80211_BAND_5GHZ] = 0;
+       common->bitrate_mask[NL80211_BAND_2GHZ] = 0;
+       common->bitrate_mask[NL80211_BAND_5GHZ] = 0;
        common->min_rate = 0xffff;
        common->vif_info[0].is_ht = false;
        common->vif_info[0].sgi = false;
@@ -1070,8 +1070,8 @@ int rsi_mac80211_attach(struct rsi_common *common)
        hw->max_rate_tries = MAX_RETRIES;
 
        hw->max_tx_aggregation_subframes = 6;
-       rsi_register_rates_channels(adapter, IEEE80211_BAND_2GHZ);
-       rsi_register_rates_channels(adapter, IEEE80211_BAND_5GHZ);
+       rsi_register_rates_channels(adapter, NL80211_BAND_2GHZ);
+       rsi_register_rates_channels(adapter, NL80211_BAND_5GHZ);
        hw->rate_control_algorithm = "AARF";
 
        SET_IEEE80211_PERM_ADDR(hw, common->mac_addr);
@@ -1087,10 +1087,10 @@ int rsi_mac80211_attach(struct rsi_common *common)
 
        wiphy->available_antennas_rx = 1;
        wiphy->available_antennas_tx = 1;
-       wiphy->bands[IEEE80211_BAND_2GHZ] =
-               &adapter->sbands[IEEE80211_BAND_2GHZ];
-       wiphy->bands[IEEE80211_BAND_5GHZ] =
-               &adapter->sbands[IEEE80211_BAND_5GHZ];
+       wiphy->bands[NL80211_BAND_2GHZ] =
+               &adapter->sbands[NL80211_BAND_2GHZ];
+       wiphy->bands[NL80211_BAND_5GHZ] =
+               &adapter->sbands[NL80211_BAND_5GHZ];
 
        status = ieee80211_register_hw(hw);
        if (status)
index e43b59d..40658b6 100644 (file)
@@ -210,7 +210,7 @@ static u16 mcs[] = {13, 26, 39, 52, 78, 104, 117, 130};
  */
 static void rsi_set_default_parameters(struct rsi_common *common)
 {
-       common->band = IEEE80211_BAND_2GHZ;
+       common->band = NL80211_BAND_2GHZ;
        common->channel_width = BW_20MHZ;
        common->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
        common->channel = 1;
@@ -655,7 +655,7 @@ int rsi_set_vap_capabilities(struct rsi_common *common, enum opmode mode)
        vap_caps->rts_threshold = cpu_to_le16(common->rts_threshold);
        vap_caps->default_mgmt_rate = cpu_to_le32(RSI_RATE_6);
 
-       if (common->band == IEEE80211_BAND_5GHZ) {
+       if (common->band == NL80211_BAND_5GHZ) {
                vap_caps->default_ctrl_rate = cpu_to_le32(RSI_RATE_6);
                if (conf_is_ht40(&common->priv->hw->conf)) {
                        vap_caps->default_ctrl_rate |=
@@ -872,7 +872,7 @@ int rsi_band_check(struct rsi_common *common)
        else
                common->channel_width = BW_40MHZ;
 
-       if (common->band == IEEE80211_BAND_2GHZ) {
+       if (common->band == NL80211_BAND_2GHZ) {
                if (common->channel_width)
                        common->endpoint = EP_2GHZ_40MHZ;
                else
@@ -1046,7 +1046,7 @@ static int rsi_send_auto_rate_request(struct rsi_common *common)
        if (common->channel_width == BW_40MHZ)
                auto_rate->desc_word[7] |= cpu_to_le16(1);
 
-       if (band == IEEE80211_BAND_2GHZ) {
+       if (band == NL80211_BAND_2GHZ) {
                min_rate = RSI_RATE_1;
                rate_table_offset = 0;
        } else {
index a0b31c0..02920c9 100644 (file)
@@ -184,7 +184,7 @@ int rsi_send_mgmt_pkt(struct rsi_common *common,
        if (wh->addr1[0] & BIT(0))
                msg[3] |= cpu_to_le16(RSI_BROADCAST_PKT);
 
-       if (common->band == IEEE80211_BAND_2GHZ)
+       if (common->band == NL80211_BAND_2GHZ)
                msg[4] = cpu_to_le16(RSI_11B_MODE);
        else
                msg[4] = cpu_to_le16((RSI_RATE_6 & 0x0f) | RSI_11G_MODE);
index 5baed94..dcd0957 100644 (file)
@@ -211,7 +211,7 @@ struct rsi_hw {
        struct ieee80211_hw *hw;
        struct ieee80211_vif *vifs[RSI_MAX_VIFS];
        struct ieee80211_tx_queue_params edca_params[NUM_EDCA_QUEUES];
-       struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
 
        struct device *device;
        u8 sc_nvifs;
index 0e51e27..dc478ce 100644 (file)
@@ -102,7 +102,7 @@ static struct ieee80211_rate cw1200_mcs_rates[] = {
 
 
 #define CHAN2G(_channel, _freq, _flags) {                      \
-       .band                   = IEEE80211_BAND_2GHZ,          \
+       .band                   = NL80211_BAND_2GHZ,            \
        .center_freq            = (_freq),                      \
        .hw_value               = (_channel),                   \
        .flags                  = (_flags),                     \
@@ -111,7 +111,7 @@ static struct ieee80211_rate cw1200_mcs_rates[] = {
 }
 
 #define CHAN5G(_channel, _flags) {                             \
-       .band                   = IEEE80211_BAND_5GHZ,          \
+       .band                   = NL80211_BAND_5GHZ,            \
        .center_freq    = 5000 + (5 * (_channel)),              \
        .hw_value               = (_channel),                   \
        .flags                  = (_flags),                     \
@@ -311,12 +311,12 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
 
        hw->sta_data_size = sizeof(struct cw1200_sta_priv);
 
-       hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &cw1200_band_2ghz;
+       hw->wiphy->bands[NL80211_BAND_2GHZ] = &cw1200_band_2ghz;
        if (have_5ghz)
-               hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &cw1200_band_5ghz;
+               hw->wiphy->bands[NL80211_BAND_5GHZ] = &cw1200_band_5ghz;
 
        /* Channel params have to be cleared before registering wiphy again */
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                struct ieee80211_supported_band *sband = hw->wiphy->bands[band];
                if (!sband)
                        continue;
index bff81b8..9837881 100644 (file)
@@ -402,7 +402,7 @@ void cw1200_probe_work(struct work_struct *work)
        }
        wsm = (struct wsm_tx *)frame.skb->data;
        scan.max_tx_rate = wsm->max_tx_rate;
-       scan.band = (priv->channel->band == IEEE80211_BAND_5GHZ) ?
+       scan.band = (priv->channel->band == NL80211_BAND_5GHZ) ?
                WSM_PHY_BAND_5G : WSM_PHY_BAND_2_4G;
        if (priv->join_status == CW1200_JOIN_STATUS_STA ||
            priv->join_status == CW1200_JOIN_STATUS_IBSS) {
index d0ddcde..daf06a4 100644 (file)
@@ -1278,7 +1278,7 @@ static void cw1200_do_join(struct cw1200_common *priv)
        join.dtim_period = priv->join_dtim_period;
 
        join.channel_number = priv->channel->hw_value;
-       join.band = (priv->channel->band == IEEE80211_BAND_5GHZ) ?
+       join.band = (priv->channel->band == NL80211_BAND_5GHZ) ?
                WSM_PHY_BAND_5G : WSM_PHY_BAND_2_4G;
 
        memcpy(join.bssid, bssid, sizeof(join.bssid));
@@ -1462,7 +1462,7 @@ int cw1200_enable_listening(struct cw1200_common *priv)
        };
 
        if (priv->channel) {
-               start.band = priv->channel->band == IEEE80211_BAND_5GHZ ?
+               start.band = priv->channel->band == NL80211_BAND_5GHZ ?
                             WSM_PHY_BAND_5G : WSM_PHY_BAND_2_4G;
                start.channel_number = priv->channel->hw_value;
        } else {
@@ -2315,7 +2315,7 @@ static int cw1200_start_ap(struct cw1200_common *priv)
        struct wsm_start start = {
                .mode = priv->vif->p2p ?
                                WSM_START_MODE_P2P_GO : WSM_START_MODE_AP,
-               .band = (priv->channel->band == IEEE80211_BAND_5GHZ) ?
+               .band = (priv->channel->band == NL80211_BAND_5GHZ) ?
                                WSM_PHY_BAND_5G : WSM_PHY_BAND_2_4G,
                .channel_number = priv->channel->hw_value,
                .beacon_interval = conf->beacon_int,
index d28bd49..3d17028 100644 (file)
@@ -1079,7 +1079,7 @@ void cw1200_rx_cb(struct cw1200_common *priv,
 
        hdr->band = ((arg->channel_number & 0xff00) ||
                     (arg->channel_number > 14)) ?
-                       IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ;
+                       NL80211_BAND_5GHZ : NL80211_BAND_2GHZ;
        hdr->freq = ieee80211_channel_to_frequency(
                        arg->channel_number,
                        hdr->band);
index 9e0ca30..680d60e 100644 (file)
@@ -849,9 +849,9 @@ static int wsm_startup_indication(struct cw1200_common *priv,
 
        /* Disable unsupported frequency bands */
        if (!(priv->wsm_caps.fw_cap & 0x1))
-               priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
+               priv->hw->wiphy->bands[NL80211_BAND_2GHZ] = NULL;
        if (!(priv->wsm_caps.fw_cap & 0x2))
-               priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
+               priv->hw->wiphy->bands[NL80211_BAND_5GHZ] = NULL;
 
        priv->firmware_ready = 1;
        wake_up(&priv->wsm_startup_done);
index cd47779..56384a4 100644 (file)
@@ -1482,7 +1482,7 @@ int wl1251_init_ieee80211(struct wl1251 *wl)
        wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
                                         BIT(NL80211_IFTYPE_ADHOC);
        wl->hw->wiphy->max_scan_ssids = 1;
-       wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1251_band_2ghz;
+       wl->hw->wiphy->bands[NL80211_BAND_2GHZ] = &wl1251_band_2ghz;
 
        wl->hw->queues = 4;
 
index cde0eaf..a27d4c2 100644 (file)
@@ -53,7 +53,7 @@ static void wl1251_rx_status(struct wl1251 *wl,
 
        memset(status, 0, sizeof(struct ieee80211_rx_status));
 
-       status->band = IEEE80211_BAND_2GHZ;
+       status->band = NL80211_BAND_2GHZ;
        status->mactime = desc->timestamp;
 
        /*
index a0d6ccc..58b9d3c 100644 (file)
@@ -469,8 +469,8 @@ static const u8 wl12xx_rate_to_idx_5ghz[] = {
 };
 
 static const u8 *wl12xx_band_rate_to_idx[] = {
-       [IEEE80211_BAND_2GHZ] = wl12xx_rate_to_idx_2ghz,
-       [IEEE80211_BAND_5GHZ] = wl12xx_rate_to_idx_5ghz
+       [NL80211_BAND_2GHZ] = wl12xx_rate_to_idx_2ghz,
+       [NL80211_BAND_5GHZ] = wl12xx_rate_to_idx_5ghz
 };
 
 enum wl12xx_hw_rates {
@@ -1827,8 +1827,8 @@ static int wl12xx_setup(struct wl1271 *wl)
        wl->fw_status_priv_len = 0;
        wl->stats.fw_stats_len = sizeof(struct wl12xx_acx_statistics);
        wl->ofdm_only_ap = true;
-       wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, &wl12xx_ht_cap);
-       wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, &wl12xx_ht_cap);
+       wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, &wl12xx_ht_cap);
+       wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ, &wl12xx_ht_cap);
        wl12xx_conf_init(wl);
 
        if (!fref_param) {
index a0dfc59..8d47539 100644 (file)
@@ -27,7 +27,7 @@
 static int wl1271_get_scan_channels(struct wl1271 *wl,
                                    struct cfg80211_scan_request *req,
                                    struct basic_scan_channel_params *channels,
-                                   enum ieee80211_band band, bool passive)
+                                   enum nl80211_band band, bool passive)
 {
        struct conf_scan_settings *c = &wl->conf.scan;
        int i, j;
@@ -92,7 +92,7 @@ static int wl1271_get_scan_channels(struct wl1271 *wl,
 #define WL1271_NOTHING_TO_SCAN 1
 
 static int wl1271_scan_send(struct wl1271 *wl, struct wl12xx_vif *wlvif,
-                           enum ieee80211_band band,
+                           enum nl80211_band band,
                            bool passive, u32 basic_rate)
 {
        struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
@@ -144,7 +144,7 @@ static int wl1271_scan_send(struct wl1271 *wl, struct wl12xx_vif *wlvif,
        cmd->params.tid_trigger = CONF_TX_AC_ANY_TID;
        cmd->params.scan_tag = WL1271_SCAN_DEFAULT_TAG;
 
-       if (band == IEEE80211_BAND_2GHZ)
+       if (band == NL80211_BAND_2GHZ)
                cmd->params.band = WL1271_SCAN_BAND_2_4_GHZ;
        else
                cmd->params.band = WL1271_SCAN_BAND_5_GHZ;
@@ -218,7 +218,7 @@ out:
 void wl1271_scan_stm(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 {
        int ret = 0;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u32 rate, mask;
 
        switch (wl->scan.state) {
@@ -226,7 +226,7 @@ void wl1271_scan_stm(struct wl1271 *wl, struct wl12xx_vif *wlvif)
                break;
 
        case WL1271_SCAN_STATE_2GHZ_ACTIVE:
-               band = IEEE80211_BAND_2GHZ;
+               band = NL80211_BAND_2GHZ;
                mask = wlvif->bitrate_masks[band];
                if (wl->scan.req->no_cck) {
                        mask &= ~CONF_TX_CCK_RATES;
@@ -243,7 +243,7 @@ void wl1271_scan_stm(struct wl1271 *wl, struct wl12xx_vif *wlvif)
                break;
 
        case WL1271_SCAN_STATE_2GHZ_PASSIVE:
-               band = IEEE80211_BAND_2GHZ;
+               band = NL80211_BAND_2GHZ;
                mask = wlvif->bitrate_masks[band];
                if (wl->scan.req->no_cck) {
                        mask &= ~CONF_TX_CCK_RATES;
@@ -263,7 +263,7 @@ void wl1271_scan_stm(struct wl1271 *wl, struct wl12xx_vif *wlvif)
                break;
 
        case WL1271_SCAN_STATE_5GHZ_ACTIVE:
-               band = IEEE80211_BAND_5GHZ;
+               band = NL80211_BAND_5GHZ;
                rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[band]);
                ret = wl1271_scan_send(wl, wlvif, band, false, rate);
                if (ret == WL1271_NOTHING_TO_SCAN) {
@@ -274,7 +274,7 @@ void wl1271_scan_stm(struct wl1271 *wl, struct wl12xx_vif *wlvif)
                break;
 
        case WL1271_SCAN_STATE_5GHZ_PASSIVE:
-               band = IEEE80211_BAND_5GHZ;
+               band = NL80211_BAND_5GHZ;
                rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[band]);
                ret = wl1271_scan_send(wl, wlvif, band, true, rate);
                if (ret == WL1271_NOTHING_TO_SCAN) {
@@ -378,7 +378,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
        wl12xx_adjust_channels(cfg, cfg_channels);
 
        if (!force_passive && cfg->active[0]) {
-               u8 band = IEEE80211_BAND_2GHZ;
+               u8 band = NL80211_BAND_2GHZ;
                ret = wl12xx_cmd_build_probe_req(wl, wlvif,
                                                 wlvif->role_id, band,
                                                 req->ssids[0].ssid,
@@ -395,7 +395,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
        }
 
        if (!force_passive && cfg->active[1]) {
-               u8 band = IEEE80211_BAND_5GHZ;
+               u8 band = NL80211_BAND_5GHZ;
                ret = wl12xx_cmd_build_probe_req(wl, wlvif,
                                                 wlvif->role_id, band,
                                                 req->ssids[0].ssid,
index a8d176d..63e95ba 100644 (file)
@@ -48,10 +48,10 @@ int wl18xx_cmd_channel_switch(struct wl1271 *wl,
        cmd->stop_tx = ch_switch->block_tx;
 
        switch (ch_switch->chandef.chan->band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                cmd->band = WLCORE_BAND_2_4GHZ;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                cmd->band = WLCORE_BAND_5GHZ;
                break;
        default:
@@ -187,7 +187,7 @@ int wl18xx_cmd_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start)
 
        cmd->role_id = wlvif->role_id;
        cmd->channel = wlvif->channel;
-       if (wlvif->band == IEEE80211_BAND_5GHZ)
+       if (wlvif->band == NL80211_BAND_5GHZ)
                cmd->band = WLCORE_BAND_5GHZ;
        cmd->bandwidth = wlcore_get_native_channel_type(wlvif->channel_type);
 
index ff6e46d..ef81184 100644 (file)
@@ -64,13 +64,13 @@ static int wlcore_smart_config_sync_event(struct wl1271 *wl, u8 sync_channel,
                                          u8 sync_band)
 {
        struct sk_buff *skb;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int freq;
 
        if (sync_band == WLCORE_BAND_5GHZ)
-               band = IEEE80211_BAND_5GHZ;
+               band = NL80211_BAND_5GHZ;
        else
-               band = IEEE80211_BAND_2GHZ;
+               band = NL80211_BAND_2GHZ;
 
        freq = ieee80211_channel_to_frequency(sync_channel, band);
 
index 1bf26cc..ae47c79 100644 (file)
@@ -137,8 +137,8 @@ static const u8 wl18xx_rate_to_idx_5ghz[] = {
 };
 
 static const u8 *wl18xx_band_rate_to_idx[] = {
-       [IEEE80211_BAND_2GHZ] = wl18xx_rate_to_idx_2ghz,
-       [IEEE80211_BAND_5GHZ] = wl18xx_rate_to_idx_5ghz
+       [NL80211_BAND_2GHZ] = wl18xx_rate_to_idx_2ghz,
+       [NL80211_BAND_5GHZ] = wl18xx_rate_to_idx_5ghz
 };
 
 enum wl18xx_hw_rates {
@@ -1302,12 +1302,12 @@ static u32 wl18xx_ap_get_mimo_wide_rate_mask(struct wl1271 *wl,
                wl1271_debug(DEBUG_ACX, "using wide channel rate mask");
 
                /* sanity check - we don't support this */
-               if (WARN_ON(wlvif->band != IEEE80211_BAND_5GHZ))
+               if (WARN_ON(wlvif->band != NL80211_BAND_5GHZ))
                        return 0;
 
                return CONF_TX_RATE_USE_WIDE_CHAN;
        } else if (wl18xx_is_mimo_supported(wl) &&
-                  wlvif->band == IEEE80211_BAND_2GHZ) {
+                  wlvif->band == NL80211_BAND_2GHZ) {
                wl1271_debug(DEBUG_ACX, "using MIMO rate mask");
                /*
                 * we don't care about HT channel here - if a peer doesn't
@@ -1996,24 +1996,24 @@ static int wl18xx_setup(struct wl1271 *wl)
                 * siso40.
                 */
                if (wl18xx_is_mimo_supported(wl))
-                       wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ,
+                       wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ,
                                          &wl18xx_mimo_ht_cap_2ghz);
                else
-                       wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ,
+                       wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ,
                                          &wl18xx_siso40_ht_cap_2ghz);
 
                /* 5Ghz is always wide */
-               wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ,
+               wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ,
                                  &wl18xx_siso40_ht_cap_5ghz);
        } else if (priv->conf.ht.mode == HT_MODE_WIDE) {
-               wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ,
+               wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ,
                                  &wl18xx_siso40_ht_cap_2ghz);
-               wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ,
+               wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ,
                                  &wl18xx_siso40_ht_cap_5ghz);
        } else if (priv->conf.ht.mode == HT_MODE_SISO20) {
-               wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ,
+               wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ,
                                  &wl18xx_siso20_ht_cap);
-               wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ,
+               wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ,
                                  &wl18xx_siso20_ht_cap);
        }
 
index bc15aa2..4e52215 100644 (file)
@@ -110,7 +110,7 @@ static int wl18xx_scan_send(struct wl1271 *wl, struct wl12xx_vif *wlvif,
 
        /* TODO: per-band ies? */
        if (cmd->active[0]) {
-               u8 band = IEEE80211_BAND_2GHZ;
+               u8 band = NL80211_BAND_2GHZ;
                ret = wl12xx_cmd_build_probe_req(wl, wlvif,
                                 cmd->role_id, band,
                                 req->ssids ? req->ssids[0].ssid : NULL,
@@ -127,7 +127,7 @@ static int wl18xx_scan_send(struct wl1271 *wl, struct wl12xx_vif *wlvif,
        }
 
        if (cmd->active[1] || cmd->dfs) {
-               u8 band = IEEE80211_BAND_5GHZ;
+               u8 band = NL80211_BAND_5GHZ;
                ret = wl12xx_cmd_build_probe_req(wl, wlvif,
                                 cmd->role_id, band,
                                 req->ssids ? req->ssids[0].ssid : NULL,
@@ -253,7 +253,7 @@ int wl18xx_scan_sched_scan_config(struct wl1271 *wl,
        cmd->terminate_on_report = 0;
 
        if (cmd->active[0]) {
-               u8 band = IEEE80211_BAND_2GHZ;
+               u8 band = NL80211_BAND_2GHZ;
                ret = wl12xx_cmd_build_probe_req(wl, wlvif,
                                 cmd->role_id, band,
                                 req->ssids ? req->ssids[0].ssid : NULL,
@@ -270,7 +270,7 @@ int wl18xx_scan_sched_scan_config(struct wl1271 *wl,
        }
 
        if (cmd->active[1] || cmd->dfs) {
-               u8 band = IEEE80211_BAND_5GHZ;
+               u8 band = NL80211_BAND_5GHZ;
                ret = wl12xx_cmd_build_probe_req(wl, wlvif,
                                 cmd->role_id, band,
                                 req->ssids ? req->ssids[0].ssid : NULL,
index 3406ffb..ebaf66e 100644 (file)
@@ -43,7 +43,7 @@ void wl18xx_get_last_tx_rate(struct wl1271 *wl, struct ieee80211_vif *vif,
 
        if (fw_rate <= CONF_HW_RATE_INDEX_54MBPS) {
                rate->idx = fw_rate;
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        rate->idx -= CONF_HW_RATE_INDEX_6MBPS;
                rate->flags = 0;
        } else {
index f01d24b..3315356 100644 (file)
@@ -423,7 +423,7 @@ EXPORT_SYMBOL_GPL(wlcore_get_native_channel_type);
 
 static int wl12xx_cmd_role_start_dev(struct wl1271 *wl,
                                     struct wl12xx_vif *wlvif,
-                                    enum ieee80211_band band,
+                                    enum nl80211_band band,
                                     int channel)
 {
        struct wl12xx_cmd_role_start *cmd;
@@ -438,7 +438,7 @@ static int wl12xx_cmd_role_start_dev(struct wl1271 *wl,
        wl1271_debug(DEBUG_CMD, "cmd role start dev %d", wlvif->dev_role_id);
 
        cmd->role_id = wlvif->dev_role_id;
-       if (band == IEEE80211_BAND_5GHZ)
+       if (band == NL80211_BAND_5GHZ)
                cmd->band = WLCORE_BAND_5GHZ;
        cmd->channel = channel;
 
@@ -524,7 +524,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        wl1271_debug(DEBUG_CMD, "cmd role start sta %d", wlvif->role_id);
 
        cmd->role_id = wlvif->role_id;
-       if (wlvif->band == IEEE80211_BAND_5GHZ)
+       if (wlvif->band == NL80211_BAND_5GHZ)
                cmd->band = WLCORE_BAND_5GHZ;
        cmd->channel = wlvif->channel;
        cmd->sta.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
@@ -693,10 +693,10 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        cmd->ap.local_rates = cpu_to_le32(supported_rates);
 
        switch (wlvif->band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                cmd->band = WLCORE_BAND_2_4GHZ;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                cmd->band = WLCORE_BAND_5GHZ;
                break;
        default:
@@ -773,7 +773,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        wl1271_debug(DEBUG_CMD, "cmd role start ibss %d", wlvif->role_id);
 
        cmd->role_id = wlvif->role_id;
-       if (wlvif->band == IEEE80211_BAND_5GHZ)
+       if (wlvif->band == NL80211_BAND_5GHZ)
                cmd->band = WLCORE_BAND_5GHZ;
        cmd->channel = wlvif->channel;
        cmd->ibss.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
@@ -1164,7 +1164,7 @@ int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif,
        }
 
        rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[band]);
-       if (band == IEEE80211_BAND_2GHZ)
+       if (band == NL80211_BAND_2GHZ)
                ret = wl1271_cmd_template_set(wl, role_id,
                                              template_id_2_4,
                                              skb->data, skb->len, 0, rate);
@@ -1195,7 +1195,7 @@ struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
        wl1271_debug(DEBUG_SCAN, "set ap probe request template");
 
        rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[wlvif->band]);
-       if (wlvif->band == IEEE80211_BAND_2GHZ)
+       if (wlvif->band == NL80211_BAND_2GHZ)
                ret = wl1271_cmd_template_set(wl, wlvif->role_id,
                                              CMD_TEMPL_CFG_PROBE_REQ_2_4,
                                              skb->data, skb->len, 0, rate);
@@ -1628,19 +1628,19 @@ out:
        return ret;
 }
 
-static int wlcore_get_reg_conf_ch_idx(enum ieee80211_band band, u16 ch)
+static int wlcore_get_reg_conf_ch_idx(enum nl80211_band band, u16 ch)
 {
        /*
         * map the given band/channel to the respective predefined
         * bit expected by the fw
         */
        switch (band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                /* channels 1..14 are mapped to 0..13 */
                if (ch >= 1 && ch <= 14)
                        return ch - 1;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                switch (ch) {
                case 8 ... 16:
                        /* channels 8,12,16 are mapped to 18,19,20 */
@@ -1670,7 +1670,7 @@ static int wlcore_get_reg_conf_ch_idx(enum ieee80211_band band, u16 ch)
 }
 
 void wlcore_set_pending_regdomain_ch(struct wl1271 *wl, u16 channel,
-                                    enum ieee80211_band band)
+                                    enum nl80211_band band)
 {
        int ch_bit_idx = 0;
 
@@ -1699,7 +1699,7 @@ int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl)
 
        memset(tmp_ch_bitmap, 0, sizeof(tmp_ch_bitmap));
 
-       for (b = IEEE80211_BAND_2GHZ; b <= IEEE80211_BAND_5GHZ; b++) {
+       for (b = NL80211_BAND_2GHZ; b <= NL80211_BAND_5GHZ; b++) {
                band = wiphy->bands[b];
                for (i = 0; i < band->n_channels; i++) {
                        struct ieee80211_channel *channel = &band->channels[i];
@@ -1851,7 +1851,7 @@ out:
 }
 
 static int wl12xx_cmd_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif,
-                         u8 role_id, enum ieee80211_band band, u8 channel)
+                         u8 role_id, enum nl80211_band band, u8 channel)
 {
        struct wl12xx_cmd_roc *cmd;
        int ret = 0;
@@ -1870,10 +1870,10 @@ static int wl12xx_cmd_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif,
        cmd->role_id = role_id;
        cmd->channel = channel;
        switch (band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                cmd->band = WLCORE_BAND_2_4GHZ;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                cmd->band = WLCORE_BAND_5GHZ;
                break;
        default:
@@ -1925,7 +1925,7 @@ out:
 }
 
 int wl12xx_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 role_id,
-              enum ieee80211_band band, u8 channel)
+              enum nl80211_band band, u8 channel)
 {
        int ret = 0;
 
@@ -1995,7 +1995,7 @@ out:
 
 /* start dev role and roc on its channel */
 int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif,
-                    enum ieee80211_band band, int channel)
+                    enum nl80211_band band, int channel)
 {
        int ret;
 
index e28e2f2..52c3b48 100644 (file)
@@ -40,7 +40,7 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif,
-                    enum ieee80211_band band, int channel);
+                    enum nl80211_band band, int channel);
 int wl12xx_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
 int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf,
@@ -83,14 +83,14 @@ int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
 int wl12xx_cmd_set_peer_state(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                              u8 hlid);
 int wl12xx_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 role_id,
-              enum ieee80211_band band, u8 channel);
+              enum nl80211_band band, u8 channel);
 int wl12xx_croc(struct wl1271 *wl, u8 role_id);
 int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                        struct ieee80211_sta *sta, u8 hlid);
 int wl12xx_cmd_remove_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                           u8 hlid);
 void wlcore_set_pending_regdomain_ch(struct wl1271 *wl, u16 channel,
-                                    enum ieee80211_band band);
+                                    enum nl80211_band band);
 int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl);
 int wlcore_cmd_generic_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                           u8 feature, u8 enable, u8 value);
index a872a07..10fd24c 100644 (file)
@@ -1930,7 +1930,7 @@ static void wlcore_op_stop_locked(struct wl1271 *wl)
        if (test_and_clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags))
                wlcore_enable_interrupts(wl);
 
-       wl->band = IEEE80211_BAND_2GHZ;
+       wl->band = NL80211_BAND_2GHZ;
 
        wl->rx_counter = 0;
        wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
@@ -2240,8 +2240,8 @@ static int wl12xx_init_vif_data(struct wl1271 *wl, struct ieee80211_vif *vif)
                wlvif->rate_set = CONF_TX_ENABLED_RATES;
        }
 
-       wlvif->bitrate_masks[IEEE80211_BAND_2GHZ] = wl->conf.tx.basic_rate;
-       wlvif->bitrate_masks[IEEE80211_BAND_5GHZ] = wl->conf.tx.basic_rate_5;
+       wlvif->bitrate_masks[NL80211_BAND_2GHZ] = wl->conf.tx.basic_rate;
+       wlvif->bitrate_masks[NL80211_BAND_5GHZ] = wl->conf.tx.basic_rate_5;
        wlvif->beacon_int = WL1271_DEFAULT_BEACON_INT;
 
        /*
@@ -2330,7 +2330,7 @@ power_off:
         * 11a channels if not supported
         */
        if (!wl->enable_11a)
-               wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels = 0;
+               wiphy->bands[NL80211_BAND_5GHZ]->n_channels = 0;
 
        wl1271_debug(DEBUG_MAC80211, "11a is %ssupported",
                     wl->enable_11a ? "" : "not ");
@@ -5871,7 +5871,7 @@ static const struct ieee80211_ops wl1271_ops = {
 };
 
 
-u8 wlcore_rate_to_idx(struct wl1271 *wl, u8 rate, enum ieee80211_band band)
+u8 wlcore_rate_to_idx(struct wl1271 *wl, u8 rate, enum nl80211_band band)
 {
        u8 idx;
 
@@ -6096,21 +6096,21 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
         * We keep local copies of the band structs because we need to
         * modify them on a per-device basis.
         */
-       memcpy(&wl->bands[IEEE80211_BAND_2GHZ], &wl1271_band_2ghz,
+       memcpy(&wl->bands[NL80211_BAND_2GHZ], &wl1271_band_2ghz,
               sizeof(wl1271_band_2ghz));
-       memcpy(&wl->bands[IEEE80211_BAND_2GHZ].ht_cap,
-              &wl->ht_cap[IEEE80211_BAND_2GHZ],
+       memcpy(&wl->bands[NL80211_BAND_2GHZ].ht_cap,
+              &wl->ht_cap[NL80211_BAND_2GHZ],
               sizeof(*wl->ht_cap));
-       memcpy(&wl->bands[IEEE80211_BAND_5GHZ], &wl1271_band_5ghz,
+       memcpy(&wl->bands[NL80211_BAND_5GHZ], &wl1271_band_5ghz,
               sizeof(wl1271_band_5ghz));
-       memcpy(&wl->bands[IEEE80211_BAND_5GHZ].ht_cap,
-              &wl->ht_cap[IEEE80211_BAND_5GHZ],
+       memcpy(&wl->bands[NL80211_BAND_5GHZ].ht_cap,
+              &wl->ht_cap[NL80211_BAND_5GHZ],
               sizeof(*wl->ht_cap));
 
-       wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-               &wl->bands[IEEE80211_BAND_2GHZ];
-       wl->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-               &wl->bands[IEEE80211_BAND_5GHZ];
+       wl->hw->wiphy->bands[NL80211_BAND_2GHZ] =
+               &wl->bands[NL80211_BAND_2GHZ];
+       wl->hw->wiphy->bands[NL80211_BAND_5GHZ] =
+               &wl->bands[NL80211_BAND_5GHZ];
 
        /*
         * allow 4 queues per mac address we support +
@@ -6205,7 +6205,7 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size,
        wl->channel = 0;
        wl->rx_counter = 0;
        wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
-       wl->band = IEEE80211_BAND_2GHZ;
+       wl->band = NL80211_BAND_2GHZ;
        wl->channel_type = NL80211_CHAN_NO_HT;
        wl->flags = 0;
        wl->sg_enabled = true;
index d4420da..b36133b 100644 (file)
@@ -202,7 +202,7 @@ int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                 * enable beacon early termination.
                 * Not relevant for 5GHz and for high rates.
                 */
-               if ((wlvif->band == IEEE80211_BAND_2GHZ) &&
+               if ((wlvif->band == NL80211_BAND_2GHZ) &&
                    (wlvif->basic_rate < CONF_HW_BIT_RATE_9MBPS)) {
                        ret = wl1271_acx_bet_enable(wl, wlvif, true);
                        if (ret < 0)
@@ -213,7 +213,7 @@ int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                wl1271_debug(DEBUG_PSM, "leaving psm");
 
                /* disable beacon early termination */
-               if ((wlvif->band == IEEE80211_BAND_2GHZ) &&
+               if ((wlvif->band == NL80211_BAND_2GHZ) &&
                    (wlvif->basic_rate < CONF_HW_BIT_RATE_9MBPS)) {
                        ret = wl1271_acx_bet_enable(wl, wlvif, false);
                        if (ret < 0)
index 34e7e93..c9bd294 100644 (file)
@@ -64,9 +64,9 @@ static void wl1271_rx_status(struct wl1271 *wl,
        memset(status, 0, sizeof(struct ieee80211_rx_status));
 
        if ((desc->flags & WL1271_RX_DESC_BAND_MASK) == WL1271_RX_DESC_BAND_BG)
-               status->band = IEEE80211_BAND_2GHZ;
+               status->band = NL80211_BAND_2GHZ;
        else
-               status->band = IEEE80211_BAND_5GHZ;
+               status->band = NL80211_BAND_5GHZ;
 
        status->rate_idx = wlcore_rate_to_idx(wl, desc->rate, status->band);
 
index f5a7087..57c0565 100644 (file)
@@ -146,7 +146,7 @@ struct wl1271_rx_descriptor {
 } __packed;
 
 int wlcore_rx(struct wl1271 *wl, struct wl_fw_status *status);
-u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);
+u8 wl1271_rate_to_idx(int rate, enum nl80211_band band);
 int wl1271_rx_filter_enable(struct wl1271 *wl,
                            int index, bool enable,
                            struct wl12xx_rx_filter *filter);
index a384f3f..2334364 100644 (file)
@@ -164,7 +164,7 @@ wlcore_scan_get_channels(struct wl1271 *wl,
                struct conf_sched_scan_settings *c = &wl->conf.sched_scan;
                u32 delta_per_probe;
 
-               if (band == IEEE80211_BAND_5GHZ)
+               if (band == NL80211_BAND_5GHZ)
                        delta_per_probe = c->dwell_time_delta_per_probe_5;
                else
                        delta_per_probe = c->dwell_time_delta_per_probe;
@@ -215,7 +215,7 @@ wlcore_scan_get_channels(struct wl1271 *wl,
                        channels[j].channel = req_channels[i]->hw_value;
 
                        if (n_pactive_ch &&
-                           (band == IEEE80211_BAND_2GHZ) &&
+                           (band == NL80211_BAND_2GHZ) &&
                            (channels[j].channel >= 12) &&
                            (channels[j].channel <= 14) &&
                            (flags & IEEE80211_CHAN_NO_IR) &&
@@ -266,7 +266,7 @@ wlcore_set_scan_chan_params(struct wl1271 *wl,
                                         n_channels,
                                         n_ssids,
                                         cfg->channels_2,
-                                        IEEE80211_BAND_2GHZ,
+                                        NL80211_BAND_2GHZ,
                                         false, true, 0,
                                         MAX_CHANNELS_2GHZ,
                                         &n_pactive_ch,
@@ -277,7 +277,7 @@ wlcore_set_scan_chan_params(struct wl1271 *wl,
                                         n_channels,
                                         n_ssids,
                                         cfg->channels_2,
-                                        IEEE80211_BAND_2GHZ,
+                                        NL80211_BAND_2GHZ,
                                         false, false,
                                         cfg->passive[0],
                                         MAX_CHANNELS_2GHZ,
@@ -289,7 +289,7 @@ wlcore_set_scan_chan_params(struct wl1271 *wl,
                                         n_channels,
                                         n_ssids,
                                         cfg->channels_5,
-                                        IEEE80211_BAND_5GHZ,
+                                        NL80211_BAND_5GHZ,
                                         false, true, 0,
                                         wl->max_channels_5,
                                         &n_pactive_ch,
@@ -300,7 +300,7 @@ wlcore_set_scan_chan_params(struct wl1271 *wl,
                                         n_channels,
                                         n_ssids,
                                         cfg->channels_5,
-                                        IEEE80211_BAND_5GHZ,
+                                        NL80211_BAND_5GHZ,
                                         true, true,
                                         cfg->passive[1],
                                         wl->max_channels_5,
@@ -312,7 +312,7 @@ wlcore_set_scan_chan_params(struct wl1271 *wl,
                                         n_channels,
                                         n_ssids,
                                         cfg->channels_5,
-                                        IEEE80211_BAND_5GHZ,
+                                        NL80211_BAND_5GHZ,
                                         false, false,
                                         cfg->passive[1] + cfg->dfs,
                                         wl->max_channels_5,
index f0ac361..c1b8e4e 100644 (file)
@@ -453,7 +453,7 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct wl12xx_vif *wlvif,
 }
 
 u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set,
-                               enum ieee80211_band rate_band)
+                               enum nl80211_band rate_band)
 {
        struct ieee80211_supported_band *band;
        u32 enabled_rates = 0;
index 79cb3ff..e2ba62d 100644 (file)
@@ -246,9 +246,9 @@ int wlcore_tx_complete(struct wl1271 *wl);
 void wl12xx_tx_reset_wlvif(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 void wl12xx_tx_reset(struct wl1271 *wl);
 void wl1271_tx_flush(struct wl1271 *wl);
-u8 wlcore_rate_to_idx(struct wl1271 *wl, u8 rate, enum ieee80211_band band);
+u8 wlcore_rate_to_idx(struct wl1271 *wl, u8 rate, enum nl80211_band band);
 u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set,
-                               enum ieee80211_band rate_band);
+                               enum nl80211_band rate_band);
 u32 wl1271_tx_min_rate_get(struct wl1271 *wl, u32 rate_set);
 u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                      struct sk_buff *skb, struct ieee80211_sta *sta);
index 72c31a8..8f28aa0 100644 (file)
@@ -342,7 +342,7 @@ struct wl1271 {
        struct wl12xx_vif *sched_vif;
 
        /* The current band */
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        struct completion *elp_compl;
        struct delayed_work elp_work;
@@ -517,7 +517,7 @@ void wlcore_update_inconn_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                              struct wl1271_station *wl_sta, bool in_conn);
 
 static inline void
-wlcore_set_ht_cap(struct wl1271 *wl, enum ieee80211_band band,
+wlcore_set_ht_cap(struct wl1271 *wl, enum nl80211_band band,
                  struct ieee80211_sta_ht_cap *ht_cap)
 {
        memcpy(&wl->ht_cap[band], ht_cap, sizeof(*ht_cap));
index 27c5687..5c4199f 100644 (file)
@@ -392,7 +392,7 @@ struct wl12xx_vif {
        u8 ssid_len;
 
        /* The current band */
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int channel;
        enum nl80211_channel_type channel_type;
 
index d5c371d..99de07d 100644 (file)
@@ -1454,7 +1454,7 @@ static int wl3501_get_freq(struct net_device *dev, struct iw_request_info *info,
        struct wl3501_card *this = netdev_priv(dev);
 
        wrqu->freq.m = 100000 *
-               ieee80211_channel_to_frequency(this->chan, IEEE80211_BAND_2GHZ);
+               ieee80211_channel_to_frequency(this->chan, NL80211_BAND_2GHZ);
        wrqu->freq.e = 1;
        return 0;
 }
index e539d9b..3e37a04 100644 (file)
@@ -1068,7 +1068,7 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length)
        }
 
        stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq;
-       stats.band = IEEE80211_BAND_2GHZ;
+       stats.band = NL80211_BAND_2GHZ;
        stats.signal = zd_check_signal(hw, status->signal_strength);
 
        rate = zd_rx_rate(buffer, status);
@@ -1395,7 +1395,7 @@ struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf)
        mac->band.n_channels = ARRAY_SIZE(zd_channels);
        mac->band.channels = mac->channels;
 
-       hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band;
+       hw->wiphy->bands[NL80211_BAND_2GHZ] = &mac->band;
 
        ieee80211_hw_set(hw, MFP_CAPABLE);
        ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
index f4fff38..7dd1540 100644 (file)
@@ -2113,10 +2113,10 @@ static int on_action_public23a(struct rtw_adapter *padapter,
 
        if (channel <= RTW_CH_MAX_2G_CHANNEL)
                freq = ieee80211_channel_to_frequency(channel,
-                                                     IEEE80211_BAND_2GHZ);
+                                                     NL80211_BAND_2GHZ);
        else
                freq = ieee80211_channel_to_frequency(channel,
-                                                     IEEE80211_BAND_5GHZ);
+                                                     NL80211_BAND_5GHZ);
 
        if (cfg80211_rx_mgmt(padapter->rtw_wdev, freq, 0, pframe,
                             skb->len, 0))
index 3aa40a3..634102e 100644 (file)
@@ -266,7 +266,7 @@ join_res:
 
 /* Represent channel details, subset of ieee80211_channel */
 struct rtw_ieee80211_channel {
-       /* enum ieee80211_band band; */
+       /* enum nl80211_band band; */
        /* u16 center_freq; */
        u16 hw_value;
        u32 flags;
index 12d1844..0da559d 100644 (file)
@@ -39,7 +39,7 @@ static const u32 rtw_cipher_suites[] = {
 }
 
 #define CHAN2G(_channel, _freq, _flags) {                      \
-       .band                   = IEEE80211_BAND_2GHZ,          \
+       .band                   = NL80211_BAND_2GHZ,            \
        .center_freq            = (_freq),                      \
        .hw_value               = (_channel),                   \
        .flags                  = (_flags),                     \
@@ -48,7 +48,7 @@ static const u32 rtw_cipher_suites[] = {
 }
 
 #define CHAN5G(_channel, _flags) {                             \
-       .band                   = IEEE80211_BAND_5GHZ,          \
+       .band                   = NL80211_BAND_5GHZ,            \
        .center_freq            = 5000 + (5 * (_channel)),      \
        .hw_value               = (_channel),                   \
        .flags                  = (_flags),                     \
@@ -143,15 +143,15 @@ static void rtw_5g_rates_init(struct ieee80211_rate *rates)
 }
 
 static struct ieee80211_supported_band *
-rtw_spt_band_alloc(enum ieee80211_band band)
+rtw_spt_band_alloc(enum nl80211_band band)
 {
        struct ieee80211_supported_band *spt_band = NULL;
        int n_channels, n_bitrates;
 
-       if (band == IEEE80211_BAND_2GHZ) {
+       if (band == NL80211_BAND_2GHZ) {
                n_channels = RTW_2G_CHANNELS_NUM;
                n_bitrates = RTW_G_RATES_NUM;
-       } else if (band == IEEE80211_BAND_5GHZ) {
+       } else if (band == NL80211_BAND_5GHZ) {
                n_channels = RTW_5G_CHANNELS_NUM;
                n_bitrates = RTW_A_RATES_NUM;
        } else {
@@ -176,10 +176,10 @@ rtw_spt_band_alloc(enum ieee80211_band band)
        spt_band->n_channels = n_channels;
        spt_band->n_bitrates = n_bitrates;
 
-       if (band == IEEE80211_BAND_2GHZ) {
+       if (band == NL80211_BAND_2GHZ) {
                rtw_2g_channels_init(spt_band->channels);
                rtw_2g_rates_init(spt_band->bitrates);
-       } else if (band == IEEE80211_BAND_5GHZ) {
+       } else if (band == NL80211_BAND_5GHZ) {
                rtw_5g_channels_init(spt_band->channels);
                rtw_5g_rates_init(spt_band->bitrates);
        }
@@ -257,10 +257,10 @@ static int rtw_cfg80211_inform_bss(struct rtw_adapter *padapter,
        channel = pnetwork->network.DSConfig;
        if (channel <= RTW_CH_MAX_2G_CHANNEL)
                freq = ieee80211_channel_to_frequency(channel,
-                                                     IEEE80211_BAND_2GHZ);
+                                                     NL80211_BAND_2GHZ);
        else
                freq = ieee80211_channel_to_frequency(channel,
-                                                     IEEE80211_BAND_5GHZ);
+                                                     NL80211_BAND_5GHZ);
 
        notify_channel = ieee80211_get_channel(wiphy, freq);
 
@@ -322,11 +322,11 @@ void rtw_cfg80211_indicate_connect(struct rtw_adapter *padapter)
                if (channel <= RTW_CH_MAX_2G_CHANNEL)
                        freq =
                            ieee80211_channel_to_frequency(channel,
-                                                          IEEE80211_BAND_2GHZ);
+                                                          NL80211_BAND_2GHZ);
                else
                        freq =
                            ieee80211_channel_to_frequency(channel,
-                                                          IEEE80211_BAND_5GHZ);
+                                                          NL80211_BAND_5GHZ);
 
                notify_channel = ieee80211_get_channel(wiphy, freq);
 
@@ -2360,10 +2360,10 @@ void rtw_cfg80211_indicate_sta_assoc(struct rtw_adapter *padapter,
        channel = pmlmeext->cur_channel;
        if (channel <= RTW_CH_MAX_2G_CHANNEL)
                freq = ieee80211_channel_to_frequency(channel,
-                                                     IEEE80211_BAND_2GHZ);
+                                                     NL80211_BAND_2GHZ);
        else
                freq = ieee80211_channel_to_frequency(channel,
-                                                     IEEE80211_BAND_5GHZ);
+                                                     NL80211_BAND_5GHZ);
 
        cfg80211_rx_mgmt(padapter->rtw_wdev, freq, 0, pmgmt_frame, frame_len,
                         0);
@@ -2392,10 +2392,10 @@ void rtw_cfg80211_indicate_sta_disassoc(struct rtw_adapter *padapter,
        channel = pmlmeext->cur_channel;
        if (channel <= RTW_CH_MAX_2G_CHANNEL)
                freq = ieee80211_channel_to_frequency(channel,
-                                                     IEEE80211_BAND_2GHZ);
+                                                     NL80211_BAND_2GHZ);
        else
                freq = ieee80211_channel_to_frequency(channel,
-                                                     IEEE80211_BAND_5GHZ);
+                                                     NL80211_BAND_5GHZ);
 
        mgmt.frame_control =
                cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
@@ -3109,7 +3109,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
 };
 
 static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap,
-                                      enum ieee80211_band band, u8 rf_type)
+                                      enum nl80211_band band, u8 rf_type)
 {
 
 #define MAX_BIT_RATE_40MHZ_MCS15       300     /* Mbps */
@@ -3133,7 +3133,7 @@ static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap,
        ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
 
        /*
-        *hw->wiphy->bands[IEEE80211_BAND_2GHZ]
+        *hw->wiphy->bands[NL80211_BAND_2GHZ]
         *base on ant_num
         *rx_mask: RX mask
         *if rx_ant = 1 rx_mask[0]= 0xff;==>MCS0-MCS7
@@ -3173,19 +3173,19 @@ void rtw_cfg80211_init_wiphy(struct rtw_adapter *padapter)
 
        /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */
        {
-               bands = wiphy->bands[IEEE80211_BAND_2GHZ];
+               bands = wiphy->bands[NL80211_BAND_2GHZ];
                if (bands)
                        rtw_cfg80211_init_ht_capab(&bands->ht_cap,
-                                                  IEEE80211_BAND_2GHZ,
+                                                  NL80211_BAND_2GHZ,
                                                   rf_type);
        }
 
        /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */
        {
-               bands = wiphy->bands[IEEE80211_BAND_5GHZ];
+               bands = wiphy->bands[NL80211_BAND_5GHZ];
                if (bands)
                        rtw_cfg80211_init_ht_capab(&bands->ht_cap,
-                                                  IEEE80211_BAND_5GHZ,
+                                                  NL80211_BAND_5GHZ,
                                                   rf_type);
        }
 }
@@ -3224,11 +3224,11 @@ static void rtw_cfg80211_preinit_wiphy(struct rtw_adapter *padapter,
        wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites);
 
        /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */
-       wiphy->bands[IEEE80211_BAND_2GHZ] =
-           rtw_spt_band_alloc(IEEE80211_BAND_2GHZ);
+       wiphy->bands[NL80211_BAND_2GHZ] =
+           rtw_spt_band_alloc(NL80211_BAND_2GHZ);
        /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */
-       wiphy->bands[IEEE80211_BAND_5GHZ] =
-           rtw_spt_band_alloc(IEEE80211_BAND_5GHZ);
+       wiphy->bands[NL80211_BAND_5GHZ] =
+           rtw_spt_band_alloc(NL80211_BAND_5GHZ);
 
        wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
        wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME;
@@ -3313,8 +3313,8 @@ void rtw_wdev_free(struct wireless_dev *wdev)
        if (!wdev)
                return;
 
-       kfree(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]);
-       kfree(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]);
+       kfree(wdev->wiphy->bands[NL80211_BAND_2GHZ]);
+       kfree(wdev->wiphy->bands[NL80211_BAND_5GHZ]);
 
        wiphy_free(wdev->wiphy);
 
index 9ac1ef9..b7d43a5 100644 (file)
@@ -144,7 +144,7 @@ void vnt_init_bands(struct vnt_private *priv)
                        ch[i].flags = IEEE80211_CHAN_NO_HT40;
                }
 
-               priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
+               priv->hw->wiphy->bands[NL80211_BAND_5GHZ] =
                                                &vnt_supported_5ghz_band;
        /* fallthrough */
        case RF_RFMD2959:
@@ -159,7 +159,7 @@ void vnt_init_bands(struct vnt_private *priv)
                        ch[i].flags = IEEE80211_CHAN_NO_HT40;
                }
 
-               priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+               priv->hw->wiphy->bands[NL80211_BAND_2GHZ] =
                                                &vnt_supported_2ghz_band;
                break;
        }
index c3eea07..4941640 100644 (file)
@@ -812,7 +812,7 @@ static int vnt_int_report_rate(struct vnt_private *priv,
                else if (fb_option & FIFOCTL_AUTO_FB_1)
                        tx_rate = fallback_rate1[tx_rate][retry];
 
-               if (info->band == IEEE80211_BAND_5GHZ)
+               if (info->band == NL80211_BAND_5GHZ)
                        idx = tx_rate - RATE_6M;
                else
                        idx = tx_rate;
@@ -1290,7 +1290,7 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed)
            (conf->flags & IEEE80211_CONF_OFFCHANNEL)) {
                set_channel(priv, conf->chandef.chan);
 
-               if (conf->chandef.chan->band == IEEE80211_BAND_5GHZ)
+               if (conf->chandef.chan->band == NL80211_BAND_5GHZ)
                        bb_type = BB_TYPE_11A;
                else
                        bb_type = BB_TYPE_11G;
index 1a2dda0..e4c3165 100644 (file)
@@ -1307,7 +1307,7 @@ int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx,
        }
 
        if (current_rate > RATE_11M) {
-               if (info->band == IEEE80211_BAND_5GHZ) {
+               if (info->band == NL80211_BAND_5GHZ) {
                        pkt_type = PK_TYPE_11A;
                } else {
                        if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
index a0fe288..a4299f4 100644 (file)
@@ -153,7 +153,7 @@ void vnt_init_bands(struct vnt_private *priv)
                        ch[i].flags = IEEE80211_CHAN_NO_HT40;
                }
 
-               priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
+               priv->hw->wiphy->bands[NL80211_BAND_5GHZ] =
                                                &vnt_supported_5ghz_band;
        /* fallthrough */
        case RF_AL2230:
@@ -167,7 +167,7 @@ void vnt_init_bands(struct vnt_private *priv)
                        ch[i].flags = IEEE80211_CHAN_NO_HT40;
                }
 
-               priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+               priv->hw->wiphy->bands[NL80211_BAND_2GHZ] =
                                                &vnt_supported_2ghz_band;
                break;
        }
index 8d05acb..73538fb 100644 (file)
@@ -97,7 +97,7 @@ static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr)
                else if (context->fb_option == AUTO_FB_1)
                        tx_rate = fallback_rate1[tx_rate][retry];
 
-               if (info->band == IEEE80211_BAND_5GHZ)
+               if (info->band == NL80211_BAND_5GHZ)
                        idx = tx_rate - RATE_6M;
                else
                        idx = tx_rate;
index f9afab7..fc5fe4e 100644 (file)
@@ -662,7 +662,7 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed)
                        (conf->flags & IEEE80211_CONF_OFFCHANNEL)) {
                vnt_set_channel(priv, conf->chandef.chan->hw_value);
 
-               if (conf->chandef.chan->band == IEEE80211_BAND_5GHZ)
+               if (conf->chandef.chan->band == NL80211_BAND_5GHZ)
                        bb_type = BB_TYPE_11A;
                else
                        bb_type = BB_TYPE_11G;
index b74e320..aa59e7f 100644 (file)
@@ -813,7 +813,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
        }
 
        if (current_rate > RATE_11M) {
-               if (info->band == IEEE80211_BAND_5GHZ) {
+               if (info->band == NL80211_BAND_5GHZ) {
                        pkt_type = PK_TYPE_11A;
                } else {
                        if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
index 448a5c8..544917d 100644 (file)
@@ -102,7 +102,7 @@ static u8 op_ifcs;
 u8 wilc_initialized = 1;
 
 #define CHAN2G(_channel, _freq, _flags) {       \
-               .band             = IEEE80211_BAND_2GHZ, \
+               .band             = NL80211_BAND_2GHZ, \
                .center_freq      = (_freq),             \
                .hw_value         = (_channel),          \
                .flags            = (_flags),            \
@@ -241,7 +241,7 @@ static void refresh_scan(void *user_void, u8 all, bool direct_scan)
                        struct ieee80211_channel *channel;
 
                        if (network_info) {
-                               freq = ieee80211_channel_to_frequency((s32)network_info->ch, IEEE80211_BAND_2GHZ);
+                               freq = ieee80211_channel_to_frequency((s32)network_info->ch, NL80211_BAND_2GHZ);
                                channel = ieee80211_get_channel(wiphy, freq);
 
                                rssi = get_rssi_avg(network_info);
@@ -409,7 +409,7 @@ static void CfgScanResult(enum scan_event scan_event,
                                return;
 
                        if (network_info) {
-                               s32Freq = ieee80211_channel_to_frequency((s32)network_info->ch, IEEE80211_BAND_2GHZ);
+                               s32Freq = ieee80211_channel_to_frequency((s32)network_info->ch, NL80211_BAND_2GHZ);
                                channel = ieee80211_get_channel(wiphy, s32Freq);
 
                                if (!channel)
@@ -1451,7 +1451,7 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size)
                        return;
                }
        } else {
-               s32Freq = ieee80211_channel_to_frequency(curr_channel, IEEE80211_BAND_2GHZ);
+               s32Freq = ieee80211_channel_to_frequency(curr_channel, NL80211_BAND_2GHZ);
 
                if (ieee80211_is_action(buff[FRAME_TYPE_ID])) {
                        if (priv->bCfgScanning && time_after_eq(jiffies, (unsigned long)pstrWFIDrv->p2p_timeout)) {
@@ -2246,7 +2246,7 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void)
        WILC_WFI_band_2ghz.ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K;
        WILC_WFI_band_2ghz.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE;
 
-       wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &WILC_WFI_band_2ghz;
+       wdev->wiphy->bands[NL80211_BAND_2GHZ] = &WILC_WFI_band_2ghz;
 
        return wdev;
 
index 8bad018..2438cf7 100644 (file)
@@ -415,7 +415,7 @@ static int prism2_scan(struct wiphy *wiphy,
                ie_len = ie_buf[1] + 2;
                memcpy(&ie_buf[2], &(msg2.ssid.data.data), msg2.ssid.data.len);
                freq = ieee80211_channel_to_frequency(msg2.dschannel.data,
-                                                     IEEE80211_BAND_2GHZ);
+                                                     NL80211_BAND_2GHZ);
                bss = cfg80211_inform_bss(wiphy,
                        ieee80211_get_channel(wiphy, freq),
                        CFG80211_BSS_FTYPE_UNKNOWN,
@@ -758,9 +758,9 @@ static struct wiphy *wlan_create_wiphy(struct device *dev, wlandevice_t *wlandev
        priv->band.n_channels = ARRAY_SIZE(prism2_channels);
        priv->band.bitrates = priv->rates;
        priv->band.n_bitrates = ARRAY_SIZE(prism2_rates);
-       priv->band.band = IEEE80211_BAND_2GHZ;
+       priv->band.band = NL80211_BAND_2GHZ;
        priv->band.ht_cap.ht_supported = false;
-       wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+       wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
 
        set_wiphy_dev(wiphy, dev);
        wiphy->privid = prism2_wiphy_privid;
index 428b0d9..5772038 100644 (file)
@@ -1283,9 +1283,8 @@ static int iscsit_do_rx_data(
        iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC,
                      count->iov, count->iov_count, data);
 
-       while (total_rx < data) {
-               rx_loop = sock_recvmsg(conn->sock, &msg,
-                                     (data - total_rx), MSG_WAITALL);
+       while (msg_data_left(&msg)) {
+               rx_loop = sock_recvmsg(conn->sock, &msg, MSG_WAITALL);
                if (rx_loop <= 0) {
                        pr_debug("rx_loop: %d total_rx: %d\n",
                                rx_loop, total_rx);
index b506428..63cd9f9 100644 (file)
@@ -65,6 +65,12 @@ static void afs_async_workfn(struct work_struct *work)
        call->async_workfn(call);
 }
 
+static int afs_wait_atomic_t(atomic_t *p)
+{
+       schedule();
+       return 0;
+}
+
 /*
  * open an RxRPC socket and bind it to be a server for callback notifications
  * - the socket is left in blocking mode and non-blocking ops use MSG_DONTWAIT
@@ -126,13 +132,16 @@ void afs_close_socket(void)
 {
        _enter("");
 
+       wait_on_atomic_t(&afs_outstanding_calls, afs_wait_atomic_t,
+                        TASK_UNINTERRUPTIBLE);
+       _debug("no outstanding calls");
+
        sock_release(afs_socket);
 
        _debug("dework");
        destroy_workqueue(afs_async_calls);
 
        ASSERTCMP(atomic_read(&afs_outstanding_skbs), ==, 0);
-       ASSERTCMP(atomic_read(&afs_outstanding_calls), ==, 0);
        _leave("");
 }
 
@@ -178,8 +187,6 @@ static void afs_free_call(struct afs_call *call)
 {
        _debug("DONE %p{%s} [%d]",
               call, call->type->name, atomic_read(&afs_outstanding_calls));
-       if (atomic_dec_return(&afs_outstanding_calls) == -1)
-               BUG();
 
        ASSERTCMP(call->rxcall, ==, NULL);
        ASSERT(!work_pending(&call->async_work));
@@ -188,6 +195,9 @@ static void afs_free_call(struct afs_call *call)
 
        kfree(call->request);
        kfree(call);
+
+       if (atomic_dec_and_test(&afs_outstanding_calls))
+               wake_up_atomic_t(&afs_outstanding_calls);
 }
 
 /*
@@ -420,9 +430,11 @@ error_kill_call:
 }
 
 /*
- * handles intercepted messages that were arriving in the socket's Rx queue
- * - called with the socket receive queue lock held to ensure message ordering
- * - called with softirqs disabled
+ * Handles intercepted messages that were arriving in the socket's Rx queue.
+ *
+ * Called from the AF_RXRPC call processor in waitqueue process context.  For
+ * each call, it is guaranteed this will be called in order of packet to be
+ * delivered.
  */
 static void afs_rx_interceptor(struct sock *sk, unsigned long user_call_ID,
                               struct sk_buff *skb)
@@ -513,6 +525,12 @@ static void afs_deliver_to_call(struct afs_call *call)
                        call->state = AFS_CALL_ABORTED;
                        _debug("Rcv ABORT %u -> %d", abort_code, call->error);
                        break;
+               case RXRPC_SKB_MARK_LOCAL_ABORT:
+                       abort_code = rxrpc_kernel_get_abort_code(skb);
+                       call->error = call->type->abort_to_error(abort_code);
+                       call->state = AFS_CALL_ABORTED;
+                       _debug("Loc ABORT %u -> %d", abort_code, call->error);
+                       break;
                case RXRPC_SKB_MARK_NET_ERROR:
                        call->error = -rxrpc_kernel_get_error_number(skb);
                        call->state = AFS_CALL_ERROR;
index 6f62ac8..2e2e0a6 100644 (file)
@@ -2918,7 +2918,7 @@ static inline void
 cifs_reclassify_socket4(struct socket *sock)
 {
        struct sock *sk = sock->sk;
-       BUG_ON(sock_owned_by_user(sk));
+       BUG_ON(!sock_allow_reclassification(sk));
        sock_lock_init_class_and_name(sk, "slock-AF_INET-CIFS",
                &cifs_slock_key[0], "sk_lock-AF_INET-CIFS", &cifs_key[0]);
 }
@@ -2927,7 +2927,7 @@ static inline void
 cifs_reclassify_socket6(struct socket *sock)
 {
        struct sock *sk = sock->sk;
-       BUG_ON(sock_owned_by_user(sk));
+       BUG_ON(!sock_allow_reclassification(sk));
        sock_lock_init_class_and_name(sk, "slock-AF_INET6-CIFS",
                &cifs_slock_key[1], "sk_lock-AF_INET6-CIFS", &cifs_key[1]);
 }
index 5bfd99d..bf9d1d7 100644 (file)
 
 struct mii_bus;
 
+/* Multiple levels of nesting are possible. However typically this is
+ * limited to nested DSA like layer, a MUX layer, and the normal
+ * user. Instead of trying to handle the general case, just define
+ * these cases.
+ */
+enum mdio_mutex_lock_class {
+       MDIO_MUTEX_NORMAL,
+       MDIO_MUTEX_MUX,
+       MDIO_MUTEX_NESTED,
+};
+
 struct mdio_device {
        struct device dev;
 
index 49175e4..72c1e06 100644 (file)
@@ -218,8 +218,7 @@ int sock_create_lite(int family, int type, int proto, struct socket **res);
 struct socket *sock_alloc(void);
 void sock_release(struct socket *sock);
 int sock_sendmsg(struct socket *sock, struct msghdr *msg);
-int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
-                int flags);
+int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags);
 struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
 struct socket *sockfd_lookup(int fd, int *err);
 struct socket *sock_from_file(struct file *file, int *err);
index 166402a..9884fe9 100644 (file)
@@ -1586,8 +1586,6 @@ enum netdev_priv_flags {
  *     @gso_max_size:  Maximum size of generic segmentation offload
  *     @gso_max_segs:  Maximum number of segments that can be passed to the
  *                     NIC for GSO
- *     @gso_min_segs:  Minimum number of segments that can be passed to the
- *                     NIC for GSO
  *
  *     @dcbnl_ops:     Data Center Bridging netlink ops
  *     @num_tc:        Number of traffic classes in the net device
@@ -1858,7 +1856,7 @@ struct net_device {
        unsigned int            gso_max_size;
 #define GSO_MAX_SEGS           65535
        u16                     gso_max_segs;
-       u16                     gso_min_segs;
+
 #ifdef CONFIG_DCB
        const struct dcbnl_rtnl_ops *dcbnl_ops;
 #endif
@@ -2787,7 +2785,7 @@ static inline void netif_tx_schedule_all(struct net_device *dev)
                netif_schedule_queue(netdev_get_tx_queue(dev, i));
 }
 
-static inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
+static __always_inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
 {
        clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
 }
@@ -2837,7 +2835,7 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev)
        }
 }
 
-static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
+static __always_inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
 {
        set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
 }
index e1d6983..795c990 100644 (file)
@@ -27,6 +27,7 @@ struct qed_dev_eth_info {
 struct qed_update_vport_rss_params {
        u16     rss_ind_table[128];
        u32     rss_key[10];
+       u8      rss_caps;
 };
 
 struct qed_update_vport_params {
@@ -167,7 +168,7 @@ struct qed_eth_ops {
                                struct qed_eth_stats *stats);
 };
 
-const struct qed_eth_ops *qed_get_eth_ops(u32 version);
+const struct qed_eth_ops *qed_get_eth_ops(void);
 void qed_put_eth_ops(void);
 
 #endif
index 1f7599c..67e8c20 100644 (file)
@@ -271,15 +271,6 @@ struct qed_common_ops {
                       enum qed_led_mode mode);
 };
 
-/**
- * @brief qed_get_protocol_version
- *
- * @param protocol
- *
- * @return version supported by qed for given protocol driver
- */
-u32 qed_get_protocol_version(enum qed_protocol protocol);
-
 #define MASK_FIELD(_name, _value) \
        ((_value) &= (_name ## _MASK))
 
@@ -524,4 +515,15 @@ static inline void internal_ram_wr(void __iomem *addr,
        __internal_ram_wr(NULL, addr, size, data);
 }
 
+enum qed_rss_caps {
+       QED_RSS_IPV4            = 0x1,
+       QED_RSS_IPV6            = 0x2,
+       QED_RSS_IPV4_TCP        = 0x4,
+       QED_RSS_IPV6_TCP        = 0x8,
+       QED_RSS_IPV4_UDP        = 0x10,
+       QED_RSS_IPV6_UDP        = 0x20,
+};
+
+#define QED_RSS_IND_TABLE_SIZE 128
+#define QED_RSS_KEY_SIZE 10 /* size in 32b chunks */
 #endif
index e797d45..ac1bc3c 100644 (file)
@@ -12,6 +12,7 @@
 #ifndef _NET_RXRPC_H
 #define _NET_RXRPC_H
 
+#include <linux/skbuff.h>
 #include <linux/rxrpc.h>
 
 struct rxrpc_call;
@@ -19,11 +20,12 @@ struct rxrpc_call;
 /*
  * the mark applied to socket buffers that may be intercepted
  */
-enum {
+enum rxrpc_skb_mark {
        RXRPC_SKB_MARK_DATA,            /* data message */
        RXRPC_SKB_MARK_FINAL_ACK,       /* final ACK received message */
        RXRPC_SKB_MARK_BUSY,            /* server busy message */
        RXRPC_SKB_MARK_REMOTE_ABORT,    /* remote abort message */
+       RXRPC_SKB_MARK_LOCAL_ABORT,     /* local abort message */
        RXRPC_SKB_MARK_NET_ERROR,       /* network error message */
        RXRPC_SKB_MARK_LOCAL_ERROR,     /* local error message */
        RXRPC_SKB_MARK_NEW_CALL,        /* local error message */
index b39277e..183916e 100644 (file)
@@ -67,26 +67,6 @@ struct wiphy;
  * wireless hardware capability structures
  */
 
-/**
- * enum ieee80211_band - supported frequency bands
- *
- * The bands are assigned this way because the supported
- * bitrates differ in these bands.
- *
- * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
- * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
- * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
- * @IEEE80211_NUM_BANDS: number of defined bands
- */
-enum ieee80211_band {
-       IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
-       IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
-       IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
-
-       /* keep last */
-       IEEE80211_NUM_BANDS
-};
-
 /**
  * enum ieee80211_channel_flags - channel flags
  *
@@ -167,7 +147,7 @@ enum ieee80211_channel_flags {
  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
  */
 struct ieee80211_channel {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u16 center_freq;
        u16 hw_value;
        u32 flags;
@@ -324,7 +304,7 @@ struct ieee80211_sta_vht_cap {
 struct ieee80211_supported_band {
        struct ieee80211_channel *channels;
        struct ieee80211_rate *bitrates;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int n_channels;
        int n_bitrates;
        struct ieee80211_sta_ht_cap ht_cap;
@@ -1370,7 +1350,7 @@ struct mesh_setup {
        bool user_mpm;
        u8 dtim_period;
        u16 beacon_interval;
-       int mcast_rate[IEEE80211_NUM_BANDS];
+       int mcast_rate[NUM_NL80211_BANDS];
        u32 basic_rates;
 };
 
@@ -1468,7 +1448,7 @@ struct cfg80211_scan_request {
        size_t ie_len;
        u32 flags;
 
-       u32 rates[IEEE80211_NUM_BANDS];
+       u32 rates[NUM_NL80211_BANDS];
 
        struct wireless_dev *wdev;
 
@@ -1750,7 +1730,12 @@ enum cfg80211_assoc_req_flags {
  * @ie_len: Length of ie buffer in octets
  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
  * @crypto: crypto settings
- * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
+ * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
+ *     to indicate a request to reassociate within the ESS instead of a request
+ *     do the initial association with the ESS. When included, this is set to
+ *     the BSSID of the current association, i.e., to the value that is
+ *     included in the Current AP address field of the Reassociation Request
+ *     frame.
  * @flags:  See &enum cfg80211_assoc_req_flags
  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
  *     will be used in ht_capa.  Un-supported values will be ignored.
@@ -1855,7 +1840,7 @@ struct cfg80211_ibss_params {
        bool privacy;
        bool control_port;
        bool userspace_handles_dfs;
-       int mcast_rate[IEEE80211_NUM_BANDS];
+       int mcast_rate[NUM_NL80211_BANDS];
        struct ieee80211_ht_cap ht_capa;
        struct ieee80211_ht_cap ht_capa_mask;
 };
@@ -1867,7 +1852,7 @@ struct cfg80211_ibss_params {
  * @delta: value of RSSI level adjustment.
  */
 struct cfg80211_bss_select_adjust {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        s8 delta;
 };
 
@@ -1882,7 +1867,7 @@ struct cfg80211_bss_select_adjust {
 struct cfg80211_bss_selection {
        enum nl80211_bss_select_attr behaviour;
        union {
-               enum ieee80211_band band_pref;
+               enum nl80211_band band_pref;
                struct cfg80211_bss_select_adjust adjust;
        } param;
 };
@@ -1925,7 +1910,12 @@ struct cfg80211_bss_selection {
  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
  *     networks.
  * @bss_select: criteria to be used for BSS selection.
- * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
+ * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
+ *     to indicate a request to reassociate within the ESS instead of a request
+ *     do the initial association with the ESS. When included, this is set to
+ *     the BSSID of the current association, i.e., to the value that is
+ *     included in the Current AP address field of the Reassociation Request
+ *     frame.
  */
 struct cfg80211_connect_params {
        struct ieee80211_channel *channel;
@@ -1980,7 +1970,7 @@ struct cfg80211_bitrate_mask {
                u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
                u16 vht_mcs[NL80211_VHT_NSS_MAX];
                enum nl80211_txrate_gi gi;
-       } control[IEEE80211_NUM_BANDS];
+       } control[NUM_NL80211_BANDS];
 };
 /**
  * struct cfg80211_pmksa - PMK Security Association
@@ -2377,7 +2367,17 @@ struct cfg80211_qos_map {
  * @connect: Connect to the ESS with the specified parameters. When connected,
  *     call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
  *     If the connection fails for some reason, call cfg80211_connect_result()
- *     with the status from the AP.
+ *     with the status from the AP. The driver is allowed to roam to other
+ *     BSSes within the ESS when the other BSS matches the connect parameters.
+ *     When such roaming is initiated by the driver, the driver is expected to
+ *     verify that the target matches the configured security parameters and
+ *     to use Reassociation Request frame instead of Association Request frame.
+ *     The connect function can also be used to request the driver to perform
+ *     a specific roam when connected to an ESS. In that case, the prev_bssid
+ *     parameter is set to the BSSID of the currently associated BSS as an
+ *     indication of requesting reassociation. In both the driver-initiated and
+ *     new connect() call initiated roaming cases, the result of roaming is
+ *     indicated with a call to cfg80211_roamed() or cfg80211_roamed_bss().
  *     (invoked with the wireless_dev mutex held)
  * @disconnect: Disconnect from the BSS/ESS.
  *     (invoked with the wireless_dev mutex held)
@@ -2657,7 +2657,7 @@ struct cfg80211_ops {
        int     (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
 
        int     (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
-                                 int rate[IEEE80211_NUM_BANDS]);
+                                 int rate[NUM_NL80211_BANDS]);
 
        int     (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
 
@@ -3303,7 +3303,7 @@ struct wiphy {
         * help determine whether you own this wiphy or not. */
        const void *privid;
 
-       struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
+       struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
 
        /* Lets us get back the wiphy on the callback */
        void (*reg_notifier)(struct wiphy *wiphy,
@@ -3638,7 +3638,7 @@ static inline void *wdev_priv(struct wireless_dev *wdev)
  * @band: band, necessary due to channel number overlap
  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
  */
-int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
+int ieee80211_channel_to_frequency(int chan, enum nl80211_band band);
 
 /**
  * ieee80211_frequency_to_channel - convert frequency to channel number
@@ -5069,7 +5069,7 @@ void cfg80211_ch_switch_started_notify(struct net_device *dev,
  * Returns %true if the conversion was successful, %false otherwise.
  */
 bool ieee80211_operating_class_to_band(u8 operating_class,
-                                      enum ieee80211_band *band);
+                                      enum nl80211_band *band);
 
 /**
  * ieee80211_chandef_to_operating_class - convert chandef to operation class
index 18d1be3..689ebd3 100644 (file)
@@ -129,6 +129,12 @@ struct dsa_switch {
        struct dsa_switch_tree  *dst;
        int                     index;
 
+       /*
+        * Give the switch driver somewhere to hang its private data
+        * structure.
+        */
+       void *priv;
+
        /*
         * Tagging protocol understood by this switch
         */
@@ -161,7 +167,7 @@ struct dsa_switch {
         * Slave mii_bus and devices for the individual ports.
         */
        u32                     dsa_port_mask;
-       u32                     phys_port_mask;
+       u32                     enabled_port_mask;
        u32                     phys_mii_mask;
        struct mii_bus          *slave_mii_bus;
        struct net_device       *ports[DSA_MAX_PORTS];
@@ -179,7 +185,7 @@ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
 
 static inline bool dsa_is_port_initialized(struct dsa_switch *ds, int p)
 {
-       return ds->phys_port_mask & (1 << p) && ds->ports[p];
+       return ds->enabled_port_mask & (1 << p) && ds->ports[p];
 }
 
 static inline u8 dsa_upstream_port(struct dsa_switch *ds)
@@ -207,12 +213,12 @@ struct dsa_switch_driver {
        struct list_head        list;
 
        enum dsa_tag_protocol   tag_protocol;
-       int                     priv_size;
 
        /*
         * Probing and setup.
         */
-       char    *(*probe)(struct device *host_dev, int sw_addr);
+       char    *(*probe)(struct device *dsa_dev, struct device *host_dev,
+                         int sw_addr, void **priv);
        int     (*setup)(struct dsa_switch *ds);
        int     (*set_addr)(struct dsa_switch *ds, u8 *addr);
        u32     (*get_phy_flags)(struct dsa_switch *ds, int port);
@@ -341,7 +347,7 @@ struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);
 
 static inline void *ds_to_priv(struct dsa_switch *ds)
 {
-       return (void *)(ds + 1);
+       return ds->priv;
 }
 
 static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
index 16435d8..9ae9fbb 100644 (file)
@@ -105,24 +105,23 @@ struct ip_tunnel {
        struct net_device       *dev;
        struct net              *net;   /* netns for packet i/o */
 
-       int             err_count;      /* Number of arrived ICMP errors */
        unsigned long   err_time;       /* Time when the last ICMP error
                                         * arrived */
+       int             err_count;      /* Number of arrived ICMP errors */
 
        /* These four fields used only by GRE */
        u32             i_seqno;        /* The last seen seqno  */
        u32             o_seqno;        /* The last output seqno */
        int             tun_hlen;       /* Precalculated header length */
-       int             mlink;
 
        struct dst_cache dst_cache;
 
        struct ip_tunnel_parm parms;
 
+       int             mlink;
        int             encap_hlen;     /* Encap header length (FOU,GUE) */
-       struct ip_tunnel_encap encap;
-
        int             hlen;           /* tun_hlen + encap_hlen */
+       struct ip_tunnel_encap encap;
 
        /* for SIT */
 #ifdef CONFIG_IPV6_SIT_6RD
index ebc5a40..07ef937 100644 (file)
@@ -549,7 +549,7 @@ struct ieee80211_bss_conf {
        u8 sync_dtim_count;
        u32 basic_rates;
        struct ieee80211_rate *beacon_rate;
-       int mcast_rate[IEEE80211_NUM_BANDS];
+       int mcast_rate[NUM_NL80211_BANDS];
        u16 ht_operation_mode;
        s32 cqm_rssi_thold;
        u32 cqm_rssi_hyst;
@@ -938,8 +938,8 @@ struct ieee80211_tx_info {
  * @common_ie_len: length of the common_ies
  */
 struct ieee80211_scan_ies {
-       const u8 *ies[IEEE80211_NUM_BANDS];
-       size_t len[IEEE80211_NUM_BANDS];
+       const u8 *ies[NUM_NL80211_BANDS];
+       size_t len[NUM_NL80211_BANDS];
        const u8 *common_ies;
        size_t common_ie_len;
 };
@@ -1754,7 +1754,7 @@ struct ieee80211_sta_rates {
  * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  */
 struct ieee80211_sta {
-       u32 supp_rates[IEEE80211_NUM_BANDS];
+       u32 supp_rates[NUM_NL80211_BANDS];
        u8 addr[ETH_ALEN];
        u16 aid;
        struct ieee80211_sta_ht_cap ht_cap;
@@ -4404,7 +4404,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
  */
 __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
                                        struct ieee80211_vif *vif,
-                                       enum ieee80211_band band,
+                                       enum nl80211_band band,
                                        size_t frame_len,
                                        struct ieee80211_rate *rate);
 
@@ -5357,7 +5357,7 @@ struct rate_control_ops {
 };
 
 static inline int rate_supported(struct ieee80211_sta *sta,
-                                enum ieee80211_band band,
+                                enum nl80211_band band,
                                 int index)
 {
        return (sta == NULL || sta->supp_rates[band] & BIT(index));
index 57c8803..fa36447 100644 (file)
@@ -73,6 +73,8 @@ void nf_conntrack_unregister_notifier(struct net *net,
                                      struct nf_ct_event_notifier *nb);
 
 void nf_ct_deliver_cached_events(struct nf_conn *ct);
+int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct,
+                                 u32 portid, int report);
 
 static inline void
 nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
@@ -90,70 +92,26 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
        set_bit(event, &e->cache);
 }
 
-static inline int
-nf_conntrack_eventmask_report(unsigned int eventmask,
-                             struct nf_conn *ct,
-                             u32 portid,
-                             int report)
-{
-       int ret = 0;
-       struct net *net = nf_ct_net(ct);
-       struct nf_ct_event_notifier *notify;
-       struct nf_conntrack_ecache *e;
-
-       rcu_read_lock();
-       notify = rcu_dereference(net->ct.nf_conntrack_event_cb);
-       if (notify == NULL)
-               goto out_unlock;
-
-       e = nf_ct_ecache_find(ct);
-       if (e == NULL)
-               goto out_unlock;
-
-       if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) {
-               struct nf_ct_event item = {
-                       .ct     = ct,
-                       .portid = e->portid ? e->portid : portid,
-                       .report = report
-               };
-               /* This is a resent of a destroy event? If so, skip missed */
-               unsigned long missed = e->portid ? 0 : e->missed;
-
-               if (!((eventmask | missed) & e->ctmask))
-                       goto out_unlock;
-
-               ret = notify->fcn(eventmask | missed, &item);
-               if (unlikely(ret < 0 || missed)) {
-                       spin_lock_bh(&ct->lock);
-                       if (ret < 0) {
-                               /* This is a destroy event that has been
-                                * triggered by a process, we store the PORTID
-                                * to include it in the retransmission. */
-                               if (eventmask & (1 << IPCT_DESTROY) &&
-                                   e->portid == 0 && portid != 0)
-                                       e->portid = portid;
-                               else
-                                       e->missed |= eventmask;
-                       } else
-                               e->missed &= ~missed;
-                       spin_unlock_bh(&ct->lock);
-               }
-       }
-out_unlock:
-       rcu_read_unlock();
-       return ret;
-}
-
 static inline int
 nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct,
                          u32 portid, int report)
 {
+       const struct net *net = nf_ct_net(ct);
+
+       if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb))
+               return 0;
+
        return nf_conntrack_eventmask_report(1 << event, ct, portid, report);
 }
 
 static inline int
 nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
 {
+       const struct net *net = nf_ct_net(ct);
+
+       if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb))
+               return 0;
+
        return nf_conntrack_eventmask_report(1 << event, ct, 0, 0);
 }
 
@@ -172,43 +130,9 @@ int nf_ct_expect_register_notifier(struct net *net,
 void nf_ct_expect_unregister_notifier(struct net *net,
                                      struct nf_exp_event_notifier *nb);
 
-static inline void
-nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
-                         struct nf_conntrack_expect *exp,
-                         u32 portid,
-                         int report)
-{
-       struct net *net = nf_ct_exp_net(exp);
-       struct nf_exp_event_notifier *notify;
-       struct nf_conntrack_ecache *e;
-
-       rcu_read_lock();
-       notify = rcu_dereference(net->ct.nf_expect_event_cb);
-       if (notify == NULL)
-               goto out_unlock;
-
-       e = nf_ct_ecache_find(exp->master);
-       if (e == NULL)
-               goto out_unlock;
-
-       if (e->expmask & (1 << event)) {
-               struct nf_exp_event item = {
-                       .exp    = exp,
-                       .portid = portid,
-                       .report = report
-               };
-               notify->fcn(1 << event, &item);
-       }
-out_unlock:
-       rcu_read_unlock();
-}
-
-static inline void
-nf_ct_expect_event(enum ip_conntrack_expect_events event,
-                  struct nf_conntrack_expect *exp)
-{
-       nf_ct_expect_event_report(event, exp, 0, 0);
-}
+void nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
+                              struct nf_conntrack_expect *exp,
+                              u32 portid, int report);
 
 int nf_conntrack_ecache_pernet_init(struct net *net);
 void nf_conntrack_ecache_pernet_fini(struct net *net);
@@ -245,8 +169,6 @@ static inline int nf_conntrack_event_report(enum ip_conntrack_events event,
                                            u32 portid,
                                            int report) { return 0; }
 static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
-static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
-                                     struct nf_conntrack_expect *exp) {}
 static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
                                             struct nf_conntrack_expect *exp,
                                             u32 portid,
index a69cde3..d061ffe 100644 (file)
@@ -132,6 +132,9 @@ struct netns_ipv4 {
        struct list_head        mr_tables;
        struct fib_rules_ops    *mr_rules_ops;
 #endif
+#endif
+#ifdef CONFIG_IP_ROUTE_MULTIPATH
+       int sysctl_fib_multipath_use_neigh;
 #endif
        atomic_t        rt_genid;
 };
index 6df1ce7..21cb111 100644 (file)
@@ -210,14 +210,15 @@ struct sctp_sock {
        int user_frag;
 
        __u32 autoclose;
-       __u8 nodelay;
-       __u8 disable_fragments;
-       __u8 v4mapped;
-       __u8 frag_interleave;
        __u32 adaptation_ind;
        __u32 pd_point;
-       __u8 recvrcvinfo;
-       __u8 recvnxtinfo;
+       __u16   nodelay:1,
+               disable_fragments:1,
+               v4mapped:1,
+               frag_interleave:1,
+               recvrcvinfo:1,
+               recvnxtinfo:1,
+               pending_data_ready:1;
 
        atomic_t pd_mode;
        /* Receive to here while partial delivery is in effect. */
index 81d6fec..d997ec1 100644 (file)
@@ -569,7 +569,7 @@ static inline bool __sk_del_node_init(struct sock *sk)
    modifications.
  */
 
-static inline void sock_hold(struct sock *sk)
+static __always_inline void sock_hold(struct sock *sk)
 {
        atomic_inc(&sk->sk_refcnt);
 }
@@ -577,7 +577,7 @@ static inline void sock_hold(struct sock *sk)
 /* Ungrab socket in the context, which assumes that socket refcnt
    cannot hit zero, f.e. it is true in context of any socketcall.
  */
-static inline void __sock_put(struct sock *sk)
+static __always_inline void __sock_put(struct sock *sk)
 {
        atomic_dec(&sk->sk_refcnt);
 }
@@ -1316,21 +1316,6 @@ static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
        __kfree_skb(skb);
 }
 
-/* Used by processes to "lock" a socket state, so that
- * interrupts and bottom half handlers won't change it
- * from under us. It essentially blocks any incoming
- * packets, so that we won't get any new data or any
- * packets that change the state of the socket.
- *
- * While locked, BH processing will add new packets to
- * the backlog queue.  This queue is processed by the
- * owner of the socket lock right before it is released.
- *
- * Since ~2.3.5 it is also exclusive sleep lock serializing
- * accesses from user process context.
- */
-#define sock_owned_by_user(sk) ((sk)->sk_lock.owned)
-
 static inline void sock_release_ownership(struct sock *sk)
 {
        if (sk->sk_lock.owned) {
@@ -1403,6 +1388,35 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow)
                spin_unlock_bh(&sk->sk_lock.slock);
 }
 
+/* Used by processes to "lock" a socket state, so that
+ * interrupts and bottom half handlers won't change it
+ * from under us. It essentially blocks any incoming
+ * packets, so that we won't get any new data or any
+ * packets that change the state of the socket.
+ *
+ * While locked, BH processing will add new packets to
+ * the backlog queue.  This queue is processed by the
+ * owner of the socket lock right before it is released.
+ *
+ * Since ~2.3.5 it is also exclusive sleep lock serializing
+ * accesses from user process context.
+ */
+
+static inline bool sock_owned_by_user(const struct sock *sk)
+{
+#ifdef CONFIG_LOCKDEP
+       WARN_ON(!lockdep_sock_is_held(sk));
+#endif
+       return sk->sk_lock.owned;
+}
+
+/* no reclassification while locks are held */
+static inline bool sock_allow_reclassification(const struct sock *csk)
+{
+       struct sock *sk = (struct sock *)csk;
+
+       return !sk->sk_lock.owned && !spin_is_locked(&sk->sk_lock.slock);
+}
 
 struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
                      struct proto *prot, int kern);
index 9ebab3a..b201744 100644 (file)
@@ -68,8 +68,6 @@ struct rxrpc_wire_header {
 
 } __packed;
 
-extern const char *rxrpc_pkts[];
-
 #define RXRPC_SUPPORTED_PACKET_TYPES (                 \
                (1 << RXRPC_PACKET_TYPE_DATA) |         \
                (1 << RXRPC_PACKET_TYPE_ACK) |          \
index b67a853..ae30841 100644 (file)
@@ -30,6 +30,14 @@ struct nfqnl_msg_packet_timestamp {
        __aligned_be64  usec;
 };
 
+enum nfqnl_vlan_attr {
+       NFQA_VLAN_UNSPEC,
+       NFQA_VLAN_PROTO,                /* __be16 skb vlan_proto */
+       NFQA_VLAN_TCI,                  /* __be16 skb htons(vlan_tci) */
+       __NFQA_VLAN_MAX,
+};
+#define NFQA_VLAN_MAX (__NFQA_VLAN_MAX + 1)
+
 enum nfqnl_attr_type {
        NFQA_UNSPEC,
        NFQA_PACKET_HDR,
@@ -50,6 +58,8 @@ enum nfqnl_attr_type {
        NFQA_UID,                       /* __u32 sk uid */
        NFQA_GID,                       /* __u32 sk gid */
        NFQA_SECCTX,                    /* security context string */
+       NFQA_VLAN,                      /* nested attribute: packet vlan info */
+       NFQA_L2HDR,                     /* full L2 header */
 
        __NFQA_MAX
 };
index 6da52d7..1df655d 100644 (file)
  * @NL80211_CMD_ASSOCIATE: association request and notification; like
  *     NL80211_CMD_AUTHENTICATE but for Association and Reassociation
  *     (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
- *     MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
+ *     MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
+ *     %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
+ *     request is for the initial association to an ESS (that attribute not
+ *     included) or for reassociation within the ESS (that attribute is
+ *     included).
  * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
  *     NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
  *     MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
  *     set of BSSID,frequency parameters is used (i.e., either the enforcing
  *     %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
  *     %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
+ *     %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
+ *     the ESS in case the device is already associated and an association with
+ *     a different BSS is desired.
  *     Background scan period can optionally be
  *     specified in %NL80211_ATTR_BG_SCAN_PERIOD,
  *     if not specified default background scan configuration
@@ -1287,8 +1294,11 @@ enum nl80211_commands {
  * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
  *     sent by peer, for ROAM and successful CONNECT events.
  *
- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
- *     commands to specify using a reassociate frame
+ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
+ *     commands to specify a request to reassociate within an ESS, i.e., to use
+ *     Reassociate Request frame (with the value of this attribute in the
+ *     Current AP address field) instead of Association Request frame which is
+ *     used for the initial association to an ESS.
  *
  * @NL80211_ATTR_KEY: key information in a nested attribute with
  *     %NL80211_KEY_* sub-attributes
@@ -3643,11 +3653,15 @@ enum nl80211_txrate_gi {
  * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
+ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
+ *     since newer kernel versions may support more bands
  */
 enum nl80211_band {
        NL80211_BAND_2GHZ,
        NL80211_BAND_5GHZ,
        NL80211_BAND_60GHZ,
+
+       NUM_NL80211_BANDS,
 };
 
 /**
index 99bb22a..68c80f3 100644 (file)
         (((a)->s6_addr16[6]) == 0) &&          \
         (((a)->s6_addr[14]) == 0))
 
+#define lowpan_is_linklocal_zero_padded(a)     \
+       (!(hdr->saddr.s6_addr[1] & 0x3f) &&     \
+        !hdr->saddr.s6_addr16[1] &&            \
+        !hdr->saddr.s6_addr32[1])
+
 #define LOWPAN_IPHC_CID_DCI(cid)       (cid & 0x0f)
 #define LOWPAN_IPHC_CID_SCI(cid)       ((cid & 0xf0) >> 4)
 
@@ -1101,7 +1106,8 @@ int lowpan_header_compress(struct sk_buff *skb, const struct net_device *dev,
                                                          true);
                        iphc1 |= LOWPAN_IPHC_SAC;
                } else {
-                       if (ipv6_saddr_type & IPV6_ADDR_LINKLOCAL) {
+                       if (ipv6_saddr_type & IPV6_ADDR_LINKLOCAL &&
+                           lowpan_is_linklocal_zero_padded(hdr->saddr)) {
                                iphc1 |= lowpan_compress_addr_64(&hc_ptr,
                                                                 &hdr->saddr,
                                                                 saddr, true);
@@ -1135,7 +1141,8 @@ int lowpan_header_compress(struct sk_buff *skb, const struct net_device *dev,
                                                          false);
                        iphc1 |= LOWPAN_IPHC_DAC;
                } else {
-                       if (ipv6_daddr_type & IPV6_ADDR_LINKLOCAL) {
+                       if (ipv6_daddr_type & IPV6_ADDR_LINKLOCAL &&
+                           lowpan_is_linklocal_zero_padded(hdr->daddr)) {
                                iphc1 |= lowpan_compress_addr_64(&hc_ptr,
                                                                 &hdr->daddr,
                                                                 daddr, false);
index 955eda9..3df7aef 100644 (file)
@@ -65,7 +65,7 @@ static const char *const bt_slock_key_strings[BT_MAX_PROTO] = {
 void bt_sock_reclassify_lock(struct sock *sk, int proto)
 {
        BUG_ON(!sk);
-       BUG_ON(sock_owned_by_user(sk));
+       BUG_ON(!sock_allow_reclassification(sk));
 
        sock_lock_init_class_and_name(sk,
                        bt_slock_key_strings[proto], &bt_slock_key[proto],
index c162af5..d4b3dd5 100644 (file)
@@ -4727,6 +4727,19 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
        u32 flags;
        u8 *ptr, real_len;
 
+       switch (type) {
+       case LE_ADV_IND:
+       case LE_ADV_DIRECT_IND:
+       case LE_ADV_SCAN_IND:
+       case LE_ADV_NONCONN_IND:
+       case LE_ADV_SCAN_RSP:
+               break;
+       default:
+               BT_ERR_RATELIMITED("Unknown advetising packet type: 0x%02x",
+                                  type);
+               return;
+       }
+
        /* Find the end of the data in case the report contains padded zero
         * bytes at the end causing an invalid length value.
         *
index 6e125d7..c045b3c 100644 (file)
@@ -1065,6 +1065,9 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr)
        if (instance_flags & MGMT_ADV_FLAG_LIMITED_DISCOV)
                flags |= LE_AD_LIMITED;
 
+       if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED))
+               flags |= LE_AD_NO_BREDR;
+
        if (flags || (instance_flags & MGMT_ADV_FLAG_MANAGED_FLAGS)) {
                /* If a discovery flag wasn't provided, simply use the global
                 * settings.
@@ -1072,9 +1075,6 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr)
                if (!flags)
                        flags |= mgmt_get_adv_discov_flags(hdev);
 
-               if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED))
-                       flags |= LE_AD_NO_BREDR;
-
                /* If flags would still be empty, then there is no need to
                 * include the "Flags" AD field".
                 */
index e4cae72..388ee8b 100644 (file)
@@ -778,7 +778,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
                }
 
                if (sec.level < BT_SECURITY_LOW ||
-                   sec.level > BT_SECURITY_HIGH) {
+                   sec.level > BT_SECURITY_FIPS) {
                        err = -EINVAL;
                        break;
                }
index 263b4de..f8fc624 100644 (file)
@@ -112,7 +112,9 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
 static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
        struct net_bridge *br = netdev_priv(dev);
+       struct net_bridge_port *p = NULL;
        unsigned long args[4];
+       int ret = -EOPNOTSUPP;
 
        if (copy_from_user(args, rq->ifr_data, sizeof(args)))
                return -EFAULT;
@@ -182,25 +184,29 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
 
-               return br_set_forward_delay(br, args[1]);
+               ret = br_set_forward_delay(br, args[1]);
+               break;
 
        case BRCTL_SET_BRIDGE_HELLO_TIME:
                if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
 
-               return br_set_hello_time(br, args[1]);
+               ret = br_set_hello_time(br, args[1]);
+               break;
 
        case BRCTL_SET_BRIDGE_MAX_AGE:
                if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
 
-               return br_set_max_age(br, args[1]);
+               ret = br_set_max_age(br, args[1]);
+               break;
 
        case BRCTL_SET_AGEING_TIME:
                if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
 
-               return br_set_ageing_time(br, args[1]);
+               ret = br_set_ageing_time(br, args[1]);
+               break;
 
        case BRCTL_GET_PORT_INFO:
        {
@@ -240,20 +246,19 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                        return -EPERM;
 
                br_stp_set_enabled(br, args[1]);
-               return 0;
+               ret = 0;
+               break;
 
        case BRCTL_SET_BRIDGE_PRIORITY:
                if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
 
                br_stp_set_bridge_priority(br, args[1]);
-               return 0;
+               ret = 0;
+               break;
 
        case BRCTL_SET_PORT_PRIORITY:
        {
-               struct net_bridge_port *p;
-               int ret;
-
                if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
 
@@ -263,14 +268,11 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                else
                        ret = br_stp_set_port_priority(p, args[2]);
                spin_unlock_bh(&br->lock);
-               return ret;
+               break;
        }
 
        case BRCTL_SET_PATH_COST:
        {
-               struct net_bridge_port *p;
-               int ret;
-
                if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
 
@@ -280,8 +282,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                else
                        ret = br_stp_set_path_cost(p, args[2]);
                spin_unlock_bh(&br->lock);
-
-               return ret;
+               break;
        }
 
        case BRCTL_GET_FDB_ENTRIES:
@@ -289,7 +290,14 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                                       args[2], args[3]);
        }
 
-       return -EOPNOTSUPP;
+       if (!ret) {
+               if (p)
+                       br_ifinfo_notify(RTM_NEWLINK, p);
+               else
+                       netdev_state_change(br->dev);
+       }
+
+       return ret;
 }
 
 static int old_deviceless(struct net *net, void __user *uarg)
index 6b80914..70bddfd 100644 (file)
@@ -43,7 +43,14 @@ static ssize_t store_bridge_parm(struct device *d,
        if (endp == buf)
                return -EINVAL;
 
+       if (!rtnl_trylock())
+               return restart_syscall();
+
        err = (*set)(br, val);
+       if (!err)
+               netdev_state_change(br->dev);
+       rtnl_unlock();
+
        return err ? err : len;
 }
 
@@ -101,15 +108,7 @@ static ssize_t ageing_time_show(struct device *d,
 
 static int set_ageing_time(struct net_bridge *br, unsigned long val)
 {
-       int ret;
-
-       if (!rtnl_trylock())
-               return restart_syscall();
-
-       ret = br_set_ageing_time(br, val);
-       rtnl_unlock();
-
-       return ret;
+       return br_set_ageing_time(br, val);
 }
 
 static ssize_t ageing_time_store(struct device *d,
@@ -128,27 +127,18 @@ static ssize_t stp_state_show(struct device *d,
 }
 
 
+static int set_stp_state(struct net_bridge *br, unsigned long val)
+{
+       br_stp_set_enabled(br, val);
+
+       return 0;
+}
+
 static ssize_t stp_state_store(struct device *d,
                               struct device_attribute *attr, const char *buf,
                               size_t len)
 {
-       struct net_bridge *br = to_bridge(d);
-       char *endp;
-       unsigned long val;
-
-       if (!ns_capable(dev_net(br->dev)->user_ns, CAP_NET_ADMIN))
-               return -EPERM;
-
-       val = simple_strtoul(buf, &endp, 0);
-       if (endp == buf)
-               return -EINVAL;
-
-       if (!rtnl_trylock())
-               return restart_syscall();
-       br_stp_set_enabled(br, val);
-       rtnl_unlock();
-
-       return len;
+       return store_bridge_parm(d, buf, len, set_stp_state);
 }
 static DEVICE_ATTR_RW(stp_state);
 
@@ -160,29 +150,22 @@ static ssize_t group_fwd_mask_show(struct device *d,
        return sprintf(buf, "%#x\n", br->group_fwd_mask);
 }
 
-
-static ssize_t group_fwd_mask_store(struct device *d,
-                                   struct device_attribute *attr,
-                                   const char *buf,
-                                   size_t len)
+static int set_group_fwd_mask(struct net_bridge *br, unsigned long val)
 {
-       struct net_bridge *br = to_bridge(d);
-       char *endp;
-       unsigned long val;
-
-       if (!ns_capable(dev_net(br->dev)->user_ns, CAP_NET_ADMIN))
-               return -EPERM;
-
-       val = simple_strtoul(buf, &endp, 0);
-       if (endp == buf)
-               return -EINVAL;
-
        if (val & BR_GROUPFWD_RESTRICTED)
                return -EINVAL;
 
        br->group_fwd_mask = val;
 
-       return len;
+       return 0;
+}
+
+static ssize_t group_fwd_mask_store(struct device *d,
+                                   struct device_attribute *attr,
+                                   const char *buf,
+                                   size_t len)
+{
+       return store_bridge_parm(d, buf, len, set_group_fwd_mask);
 }
 static DEVICE_ATTR_RW(group_fwd_mask);
 
@@ -328,6 +311,7 @@ static ssize_t group_addr_store(struct device *d,
 
        br->group_addr_set = true;
        br_recalculate_fwd_mask(br);
+       netdev_state_change(br->dev);
 
        rtnl_unlock();
 
@@ -336,17 +320,17 @@ static ssize_t group_addr_store(struct device *d,
 
 static DEVICE_ATTR_RW(group_addr);
 
+static int set_flush(struct net_bridge *br, unsigned long val)
+{
+       br_fdb_flush(br);
+       return 0;
+}
+
 static ssize_t flush_store(struct device *d,
                           struct device_attribute *attr,
                           const char *buf, size_t len)
 {
-       struct net_bridge *br = to_bridge(d);
-
-       if (!ns_capable(dev_net(br->dev)->user_ns, CAP_NET_ADMIN))
-               return -EPERM;
-
-       br_fdb_flush(br);
-       return len;
+       return store_bridge_parm(d, buf, len, set_flush);
 }
 static DEVICE_ATTR_WO(flush);
 
index efe415a..1e04d4d 100644 (file)
@@ -61,7 +61,6 @@ static int store_flag(struct net_bridge_port *p, unsigned long v,
        if (flags != p->flags) {
                p->flags = flags;
                br_port_flags_change(p, mask);
-               br_ifinfo_notify(RTM_NEWLINK, p);
        }
        return 0;
 }
@@ -253,8 +252,10 @@ static ssize_t brport_store(struct kobject *kobj,
                        spin_lock_bh(&p->br->lock);
                        ret = brport_attr->store(p, val);
                        spin_unlock_bh(&p->br->lock);
-                       if (ret == 0)
+                       if (!ret) {
+                               br_ifinfo_notify(RTM_NEWLINK, p);
                                ret = count;
+                       }
                }
                rtnl_unlock();
        }
index 9309bb4..e001152 100644 (file)
@@ -651,15 +651,7 @@ int __br_vlan_filter_toggle(struct net_bridge *br, unsigned long val)
 
 int br_vlan_filter_toggle(struct net_bridge *br, unsigned long val)
 {
-       int err;
-
-       if (!rtnl_trylock())
-               return restart_syscall();
-
-       err = __br_vlan_filter_toggle(br, val);
-       rtnl_unlock();
-
-       return err;
+       return __br_vlan_filter_toggle(br, val);
 }
 
 int __br_vlan_set_proto(struct net_bridge *br, __be16 proto)
@@ -713,18 +705,10 @@ err_filt:
 
 int br_vlan_set_proto(struct net_bridge *br, unsigned long val)
 {
-       int err;
-
        if (val != ETH_P_8021Q && val != ETH_P_8021AD)
                return -EPROTONOSUPPORT;
 
-       if (!rtnl_trylock())
-               return restart_syscall();
-
-       err = __br_vlan_set_proto(br, htons(val));
-       rtnl_unlock();
-
-       return err;
+       return __br_vlan_set_proto(br, htons(val));
 }
 
 static bool vlan_default_pvid(struct net_bridge_vlan_group *vg, u16 vid)
@@ -855,21 +839,17 @@ int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val)
        if (val >= VLAN_VID_MASK)
                return -EINVAL;
 
-       if (!rtnl_trylock())
-               return restart_syscall();
-
        if (pvid == br->default_pvid)
-               goto unlock;
+               goto out;
 
        /* Only allow default pvid change when filtering is disabled */
        if (br->vlan_enabled) {
                pr_info_once("Please disable vlan filtering to change default_pvid\n");
                err = -EPERM;
-               goto unlock;
+               goto out;
        }
        err = __br_vlan_set_default_pvid(br, pvid);
-unlock:
-       rtnl_unlock();
+out:
        return err;
 }
 
index 7fcdd72..a78c4e2 100644 (file)
@@ -162,15 +162,57 @@ static const struct nf_chain_type filter_bridge = {
                          (1 << NF_BR_POST_ROUTING),
 };
 
+static void nf_br_saveroute(const struct sk_buff *skb,
+                           struct nf_queue_entry *entry)
+{
+}
+
+static int nf_br_reroute(struct net *net, struct sk_buff *skb,
+                        const struct nf_queue_entry *entry)
+{
+       return 0;
+}
+
+static __sum16 nf_br_checksum(struct sk_buff *skb, unsigned int hook,
+                             unsigned int dataoff, u_int8_t protocol)
+{
+       return 0;
+}
+
+static __sum16 nf_br_checksum_partial(struct sk_buff *skb, unsigned int hook,
+                                     unsigned int dataoff, unsigned int len,
+                                     u_int8_t protocol)
+{
+       return 0;
+}
+
+static int nf_br_route(struct net *net, struct dst_entry **dst,
+                      struct flowi *fl, bool strict __always_unused)
+{
+       return 0;
+}
+
+static const struct nf_afinfo nf_br_afinfo = {
+       .family                 = AF_BRIDGE,
+       .checksum               = nf_br_checksum,
+       .checksum_partial       = nf_br_checksum_partial,
+       .route                  = nf_br_route,
+       .saveroute              = nf_br_saveroute,
+       .reroute                = nf_br_reroute,
+       .route_key_size         = 0,
+};
+
 static int __init nf_tables_bridge_init(void)
 {
        int ret;
 
+       nf_register_afinfo(&nf_br_afinfo);
        nft_register_chain_type(&filter_bridge);
        ret = register_pernet_subsys(&nf_tables_bridge_net_ops);
-       if (ret < 0)
+       if (ret < 0) {
                nft_unregister_chain_type(&filter_bridge);
-
+               nf_unregister_afinfo(&nf_br_afinfo);
+       }
        return ret;
 }
 
@@ -178,6 +220,7 @@ static void __exit nf_tables_bridge_exit(void)
 {
        unregister_pernet_subsys(&nf_tables_bridge_net_ops);
        nft_unregister_chain_type(&filter_bridge);
+       nf_unregister_afinfo(&nf_br_afinfo);
 }
 
 module_init(nf_tables_bridge_init);
index d51343a..09fb1ac 100644 (file)
@@ -2831,7 +2831,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
        netdev_features_t features = dev->features;
        u16 gso_segs = skb_shinfo(skb)->gso_segs;
 
-       if (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs)
+       if (gso_segs > dev->gso_max_segs)
                features &= ~NETIF_F_GSO_MASK;
 
        /* If encapsulation offload request, verify we are testing
@@ -7429,7 +7429,6 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 
        dev->gso_max_size = GSO_MAX_SIZE;
        dev->gso_max_segs = GSO_MAX_SEGS;
-       dev->gso_min_segs = 0;
 
        INIT_LIST_HEAD(&dev->napi_list);
        INIT_LIST_HEAD(&dev->unreg_list);
index c28c474..60ea984 100644 (file)
@@ -51,7 +51,8 @@ void unregister_switch_driver(struct dsa_switch_driver *drv)
 EXPORT_SYMBOL_GPL(unregister_switch_driver);
 
 static struct dsa_switch_driver *
-dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name)
+dsa_switch_probe(struct device *parent, struct device *host_dev, int sw_addr,
+                char **_name, void **priv)
 {
        struct dsa_switch_driver *ret;
        struct list_head *list;
@@ -66,7 +67,7 @@ dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name)
 
                drv = list_entry(list, struct dsa_switch_driver, list);
 
-               name = drv->probe(host_dev, sw_addr);
+               name = drv->probe(parent, host_dev, sw_addr, priv);
                if (name != NULL) {
                        ret = drv;
                        break;
@@ -245,7 +246,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
                } else if (!strcmp(name, "dsa")) {
                        ds->dsa_port_mask |= 1 << i;
                } else {
-                       ds->phys_port_mask |= 1 << i;
+                       ds->enabled_port_mask |= 1 << i;
                }
                valid_name_found = true;
        }
@@ -258,7 +259,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
        /* Make the built-in MII bus mask match the number of ports,
         * switch drivers can override this later
         */
-       ds->phys_mii_mask = ds->phys_port_mask;
+       ds->phys_mii_mask = ds->enabled_port_mask;
 
        /*
         * If the CPU connects to this switch, set the switch tree
@@ -324,7 +325,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
         * Create network devices for physical switch ports.
         */
        for (i = 0; i < DSA_MAX_PORTS; i++) {
-               if (!(ds->phys_port_mask & (1 << i)))
+               if (!(ds->enabled_port_mask & (1 << i)))
                        continue;
 
                ret = dsa_slave_create(ds, parent, i, pd->port_names[i]);
@@ -383,11 +384,12 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
        struct dsa_switch *ds;
        int ret;
        char *name;
+       void *priv;
 
        /*
         * Probe for switch model.
         */
-       drv = dsa_switch_probe(host_dev, pd->sw_addr, &name);
+       drv = dsa_switch_probe(parent, host_dev, pd->sw_addr, &name, &priv);
        if (drv == NULL) {
                netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n",
                           index);
@@ -400,7 +402,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
        /*
         * Allocate and initialise switch state.
         */
-       ds = devm_kzalloc(parent, sizeof(*ds) + drv->priv_size, GFP_KERNEL);
+       ds = devm_kzalloc(parent, sizeof(*ds), GFP_KERNEL);
        if (ds == NULL)
                return ERR_PTR(-ENOMEM);
 
@@ -408,6 +410,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
        ds->index = index;
        ds->pd = pd;
        ds->drv = drv;
+       ds->priv = priv;
        ds->tag_protocol = drv->tag_protocol;
        ds->master_dev = host_dev;
 
@@ -432,7 +435,7 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
 
        /* Destroy network devices for physical switch ports. */
        for (port = 0; port < DSA_MAX_PORTS; port++) {
-               if (!(ds->phys_port_mask & (1 << port)))
+               if (!(ds->enabled_port_mask & (1 << port)))
                        continue;
 
                if (!ds->ports[port])
index d97268e..ab64d9f 100644 (file)
@@ -1559,21 +1559,45 @@ int fib_sync_up(struct net_device *dev, unsigned int nh_flags)
 }
 
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
+static bool fib_good_nh(const struct fib_nh *nh)
+{
+       int state = NUD_REACHABLE;
+
+       if (nh->nh_scope == RT_SCOPE_LINK) {
+               struct neighbour *n;
+
+               rcu_read_lock_bh();
+
+               n = __ipv4_neigh_lookup_noref(nh->nh_dev, nh->nh_gw);
+               if (n)
+                       state = n->nud_state;
+
+               rcu_read_unlock_bh();
+       }
+
+       return !!(state & NUD_VALID);
+}
 
 void fib_select_multipath(struct fib_result *res, int hash)
 {
        struct fib_info *fi = res->fi;
+       struct net *net = fi->fib_net;
+       bool first = false;
 
        for_nexthops(fi) {
                if (hash > atomic_read(&nh->nh_upper_bound))
                        continue;
 
-               res->nh_sel = nhsel;
-               return;
+               if (!net->ipv4.sysctl_fib_multipath_use_neigh ||
+                   fib_good_nh(nh)) {
+                       res->nh_sel = nhsel;
+                       return;
+               }
+               if (!first) {
+                       res->nh_sel = nhsel;
+                       first = true;
+               }
        } endfor_nexthops(fi);
-
-       /* Race condition: route has just become dead. */
-       res->nh_sel = 0;
 }
 #endif
 
index 89b5f3b..279471c 100644 (file)
@@ -106,7 +106,8 @@ static void ip_cmsg_recv_checksum(struct msghdr *msg, struct sk_buff *skb,
                return;
 
        if (offset != 0)
-               csum = csum_sub(csum, csum_partial(skb->data, offset, 0));
+               csum = csum_sub(csum, csum_partial(skb_transport_header(skb),
+                                                  offset, 0));
 
        put_cmsg(msg, SOL_IP, IP_CHECKSUM, sizeof(__wsum), &csum);
 }
index 1e1fe60..bb04195 100644 (file)
@@ -960,6 +960,17 @@ static struct ctl_table ipv4_net_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec,
        },
+#ifdef CONFIG_IP_ROUTE_MULTIPATH
+       {
+               .procname       = "fib_multipath_use_neigh",
+               .data           = &init_net.ipv4.sysctl_fib_multipath_use_neigh,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
+               .extra2         = &one,
+       },
+#endif
        { }
 };
 
index 3563788..f186313 100644 (file)
@@ -1282,8 +1282,6 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
                         * of this packet since that is all
                         * that will be read.
                         */
-                       amount -= sizeof(struct udphdr);
-
                return put_user(amount, (int __user *)arg);
        }
 
@@ -1377,7 +1375,7 @@ try_again:
                *addr_len = sizeof(*sin);
        }
        if (inet->cmsg_flags)
-               ip_cmsg_recv_offset(msg, skb, sizeof(struct udphdr));
+               ip_cmsg_recv_offset(msg, skb, sizeof(struct udphdr) + off);
 
        err = copied;
        if (flags & MSG_TRUNC)
index 27aed1a..a6c9927 100644 (file)
@@ -4995,15 +4995,13 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
 {
        struct inet6_ifaddr *ifp;
        struct net_device *dev = idev->dev;
-       bool update_rs = false;
+       bool clear_token, update_rs = false;
        struct in6_addr ll_addr;
 
        ASSERT_RTNL();
 
        if (!token)
                return -EINVAL;
-       if (ipv6_addr_any(token))
-               return -EINVAL;
        if (dev->flags & (IFF_LOOPBACK | IFF_NOARP))
                return -EINVAL;
        if (!ipv6_accept_ra(idev))
@@ -5018,10 +5016,13 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
 
        write_unlock_bh(&idev->lock);
 
+       clear_token = ipv6_addr_any(token);
+       if (clear_token)
+               goto update_lft;
+
        if (!idev->dead && (idev->if_flags & IF_READY) &&
            !ipv6_get_lladdr(dev, &ll_addr, IFA_F_TENTATIVE |
                             IFA_F_OPTIMISTIC)) {
-
                /* If we're not ready, then normal ifup will take care
                 * of this. Otherwise, we need to request our rs here.
                 */
@@ -5029,6 +5030,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
                update_rs = true;
        }
 
+update_lft:
        write_lock_bh(&idev->lock);
 
        if (update_rs) {
index 3deed58..5d778dd 100644 (file)
 #include <net/netfilter/nf_conntrack_synproxy.h>
 
 static struct ipv6hdr *
-synproxy_build_ip(struct sk_buff *skb, const struct in6_addr *saddr,
-                                      const struct in6_addr *daddr)
+synproxy_build_ip(struct net *net, struct sk_buff *skb,
+                 const struct in6_addr *saddr,
+                 const struct in6_addr *daddr)
 {
        struct ipv6hdr *iph;
 
        skb_reset_network_header(skb);
        iph = (struct ipv6hdr *)skb_put(skb, sizeof(*iph));
        ip6_flow_hdr(iph, 0, 0);
-       iph->hop_limit  = 64;   //XXX
+       iph->hop_limit  = net->ipv6.devconf_all->hop_limit;
        iph->nexthdr    = IPPROTO_TCP;
        iph->saddr      = *saddr;
        iph->daddr      = *daddr;
@@ -37,13 +38,12 @@ synproxy_build_ip(struct sk_buff *skb, const struct in6_addr *saddr,
 }
 
 static void
-synproxy_send_tcp(const struct synproxy_net *snet,
+synproxy_send_tcp(struct net *net,
                  const struct sk_buff *skb, struct sk_buff *nskb,
                  struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo,
                  struct ipv6hdr *niph, struct tcphdr *nth,
                  unsigned int tcp_hdr_size)
 {
-       struct net *net = nf_ct_net(snet->tmpl);
        struct dst_entry *dst;
        struct flowi6 fl6;
 
@@ -84,7 +84,7 @@ free_nskb:
 }
 
 static void
-synproxy_send_client_synack(const struct synproxy_net *snet,
+synproxy_send_client_synack(struct net *net,
                            const struct sk_buff *skb, const struct tcphdr *th,
                            const struct synproxy_options *opts)
 {
@@ -103,7 +103,7 @@ synproxy_send_client_synack(const struct synproxy_net *snet,
                return;
        skb_reserve(nskb, MAX_TCP_HEADER);
 
-       niph = synproxy_build_ip(nskb, &iph->daddr, &iph->saddr);
+       niph = synproxy_build_ip(net, nskb, &iph->daddr, &iph->saddr);
 
        skb_reset_transport_header(nskb);
        nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size);
@@ -121,15 +121,16 @@ synproxy_send_client_synack(const struct synproxy_net *snet,
 
        synproxy_build_options(nth, opts);
 
-       synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
+       synproxy_send_tcp(net, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
                          niph, nth, tcp_hdr_size);
 }
 
 static void
-synproxy_send_server_syn(const struct synproxy_net *snet,
+synproxy_send_server_syn(struct net *net,
                         const struct sk_buff *skb, const struct tcphdr *th,
                         const struct synproxy_options *opts, u32 recv_seq)
 {
+       struct synproxy_net *snet = synproxy_pernet(net);
        struct sk_buff *nskb;
        struct ipv6hdr *iph, *niph;
        struct tcphdr *nth;
@@ -144,7 +145,7 @@ synproxy_send_server_syn(const struct synproxy_net *snet,
                return;
        skb_reserve(nskb, MAX_TCP_HEADER);
 
-       niph = synproxy_build_ip(nskb, &iph->saddr, &iph->daddr);
+       niph = synproxy_build_ip(net, nskb, &iph->saddr, &iph->daddr);
 
        skb_reset_transport_header(nskb);
        nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size);
@@ -165,12 +166,12 @@ synproxy_send_server_syn(const struct synproxy_net *snet,
 
        synproxy_build_options(nth, opts);
 
-       synproxy_send_tcp(snet, skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW,
+       synproxy_send_tcp(net, skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW,
                          niph, nth, tcp_hdr_size);
 }
 
 static void
-synproxy_send_server_ack(const struct synproxy_net *snet,
+synproxy_send_server_ack(struct net *net,
                         const struct ip_ct_tcp *state,
                         const struct sk_buff *skb, const struct tcphdr *th,
                         const struct synproxy_options *opts)
@@ -189,7 +190,7 @@ synproxy_send_server_ack(const struct synproxy_net *snet,
                return;
        skb_reserve(nskb, MAX_TCP_HEADER);
 
-       niph = synproxy_build_ip(nskb, &iph->daddr, &iph->saddr);
+       niph = synproxy_build_ip(net, nskb, &iph->daddr, &iph->saddr);
 
        skb_reset_transport_header(nskb);
        nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size);
@@ -205,11 +206,11 @@ synproxy_send_server_ack(const struct synproxy_net *snet,
 
        synproxy_build_options(nth, opts);
 
-       synproxy_send_tcp(snet, skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
+       synproxy_send_tcp(net, skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
 }
 
 static void
-synproxy_send_client_ack(const struct synproxy_net *snet,
+synproxy_send_client_ack(struct net *net,
                         const struct sk_buff *skb, const struct tcphdr *th,
                         const struct synproxy_options *opts)
 {
@@ -227,7 +228,7 @@ synproxy_send_client_ack(const struct synproxy_net *snet,
                return;
        skb_reserve(nskb, MAX_TCP_HEADER);
 
-       niph = synproxy_build_ip(nskb, &iph->saddr, &iph->daddr);
+       niph = synproxy_build_ip(net, nskb, &iph->saddr, &iph->daddr);
 
        skb_reset_transport_header(nskb);
        nth = (struct tcphdr *)skb_put(nskb, tcp_hdr_size);
@@ -243,15 +244,16 @@ synproxy_send_client_ack(const struct synproxy_net *snet,
 
        synproxy_build_options(nth, opts);
 
-       synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
+       synproxy_send_tcp(net, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
                          niph, nth, tcp_hdr_size);
 }
 
 static bool
-synproxy_recv_client_ack(const struct synproxy_net *snet,
+synproxy_recv_client_ack(struct net *net,
                         const struct sk_buff *skb, const struct tcphdr *th,
                         struct synproxy_options *opts, u32 recv_seq)
 {
+       struct synproxy_net *snet = synproxy_pernet(net);
        int mss;
 
        mss = __cookie_v6_check(ipv6_hdr(skb), th, ntohl(th->ack_seq) - 1);
@@ -267,7 +269,7 @@ synproxy_recv_client_ack(const struct synproxy_net *snet,
        if (opts->options & XT_SYNPROXY_OPT_TIMESTAMP)
                synproxy_check_timestamp_cookie(opts);
 
-       synproxy_send_server_syn(snet, skb, th, opts, recv_seq);
+       synproxy_send_server_syn(net, skb, th, opts, recv_seq);
        return true;
 }
 
@@ -275,7 +277,8 @@ static unsigned int
 synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par)
 {
        const struct xt_synproxy_info *info = par->targinfo;
-       struct synproxy_net *snet = synproxy_pernet(par->net);
+       struct net *net = par->net;
+       struct synproxy_net *snet = synproxy_pernet(net);
        struct synproxy_options opts = {};
        struct tcphdr *th, _th;
 
@@ -304,12 +307,12 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par)
                                          XT_SYNPROXY_OPT_SACK_PERM |
                                          XT_SYNPROXY_OPT_ECN);
 
-               synproxy_send_client_synack(snet, skb, th, &opts);
+               synproxy_send_client_synack(net, skb, th, &opts);
                return NF_DROP;
 
        } else if (th->ack && !(th->fin || th->rst || th->syn)) {
                /* ACK from client */
-               synproxy_recv_client_ack(snet, skb, th, &opts, ntohl(th->seq));
+               synproxy_recv_client_ack(net, skb, th, &opts, ntohl(th->seq));
                return NF_DROP;
        }
 
@@ -320,7 +323,8 @@ static unsigned int ipv6_synproxy_hook(void *priv,
                                       struct sk_buff *skb,
                                       const struct nf_hook_state *nhs)
 {
-       struct synproxy_net *snet = synproxy_pernet(nhs->net);
+       struct net *net = nhs->net;
+       struct synproxy_net *snet = synproxy_pernet(net);
        enum ip_conntrack_info ctinfo;
        struct nf_conn *ct;
        struct nf_conn_synproxy *synproxy;
@@ -384,7 +388,7 @@ static unsigned int ipv6_synproxy_hook(void *priv,
                         * therefore we need to add 1 to make the SYN sequence
                         * number match the one of first SYN.
                         */
-                       if (synproxy_recv_client_ack(snet, skb, th, &opts,
+                       if (synproxy_recv_client_ack(net, skb, th, &opts,
                                                     ntohl(th->seq) + 1))
                                this_cpu_inc(snet->stats->cookie_retrans);
 
@@ -410,12 +414,12 @@ static unsigned int ipv6_synproxy_hook(void *priv,
                                  XT_SYNPROXY_OPT_SACK_PERM);
 
                swap(opts.tsval, opts.tsecr);
-               synproxy_send_server_ack(snet, state, skb, th, &opts);
+               synproxy_send_server_ack(net, state, skb, th, &opts);
 
                nf_ct_seqadj_init(ct, ctinfo, synproxy->isn - ntohl(th->seq));
 
                swap(opts.tsval, opts.tsecr);
-               synproxy_send_client_ack(snet, skb, th, &opts);
+               synproxy_send_client_ack(net, skb, th, &opts);
 
                consume_skb(skb);
                return NF_STOLEN;
index 4709f65..a540022 100644 (file)
@@ -158,7 +158,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook)
        fl6.fl6_dport = otcph->source;
        security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6));
        dst = ip6_route_output(net, NULL, &fl6);
-       if (dst == NULL || dst->error) {
+       if (dst->error) {
                dst_release(dst);
                return;
        }
index 1a3c7e0..29c509c 100644 (file)
@@ -195,7 +195,7 @@ static int llc_seq_core_show(struct seq_file *seq, void *v)
                   timer_pending(&llc->pf_cycle_timer.timer),
                   timer_pending(&llc->rej_sent_timer.timer),
                   timer_pending(&llc->busy_state_timer.timer),
-                  !!sk->sk_backlog.tail, !!sock_owned_by_user(sk));
+                  !!sk->sk_backlog.tail, !!sk->sk_lock.owned);
 out:
        return 0;
 }
index fc4730b..0c12e40 100644 (file)
@@ -1049,7 +1049,7 @@ static int sta_apply_parameters(struct ieee80211_local *local,
        int ret = 0;
        struct ieee80211_supported_band *sband;
        struct ieee80211_sub_if_data *sdata = sta->sdata;
-       enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        u32 mask, set;
 
        sband = local->hw.wiphy->bands[band];
@@ -1848,7 +1848,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
                                struct bss_parameters *params)
 {
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u32 changed = 0;
 
        if (!sdata_dereference(sdata->u.ap.beacon, sdata))
@@ -1867,7 +1867,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
        }
 
        if (!sdata->vif.bss_conf.use_short_slot &&
-           band == IEEE80211_BAND_5GHZ) {
+           band == NL80211_BAND_5GHZ) {
                sdata->vif.bss_conf.use_short_slot = true;
                changed |= BSS_CHANGED_ERP_SLOT;
        }
@@ -2097,12 +2097,12 @@ static int ieee80211_leave_ocb(struct wiphy *wiphy, struct net_device *dev)
 }
 
 static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev,
-                                   int rate[IEEE80211_NUM_BANDS])
+                                   int rate[NUM_NL80211_BANDS])
 {
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        memcpy(sdata->vif.bss_conf.mcast_rate, rate,
-              sizeof(int) * IEEE80211_NUM_BANDS);
+              sizeof(int) * NUM_NL80211_BANDS);
 
        return 0;
 }
@@ -2507,7 +2507,7 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
                        return ret;
        }
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+       for (i = 0; i < NUM_NL80211_BANDS; i++) {
                struct ieee80211_supported_band *sband = wiphy->bands[i];
                int j;
 
@@ -3135,7 +3135,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
        struct ieee80211_tx_info *info;
        struct sta_info *sta;
        struct ieee80211_chanctx_conf *chanctx_conf;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int ret;
 
        /* the lock is needed to assign the cookie later */
index 37ea30e..a5ba739 100644 (file)
@@ -169,21 +169,21 @@ static ssize_t ieee80211_if_write_##name(struct file *file,               \
        IEEE80211_IF_FILE_R(name)
 
 /* common attributes */
-IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
+IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[NL80211_BAND_2GHZ],
                  HEX);
-IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
+IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[NL80211_BAND_5GHZ],
                  HEX);
 IEEE80211_IF_FILE(rc_rateidx_mcs_mask_2ghz,
-                 rc_rateidx_mcs_mask[IEEE80211_BAND_2GHZ], HEXARRAY);
+                 rc_rateidx_mcs_mask[NL80211_BAND_2GHZ], HEXARRAY);
 IEEE80211_IF_FILE(rc_rateidx_mcs_mask_5ghz,
-                 rc_rateidx_mcs_mask[IEEE80211_BAND_5GHZ], HEXARRAY);
+                 rc_rateidx_mcs_mask[NL80211_BAND_5GHZ], HEXARRAY);
 
 static ssize_t ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_2ghz(
                                const struct ieee80211_sub_if_data *sdata,
                                char *buf, int buflen)
 {
        int i, len = 0;
-       const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[IEEE80211_BAND_2GHZ];
+       const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[NL80211_BAND_2GHZ];
 
        for (i = 0; i < NL80211_VHT_NSS_MAX; i++)
                len += scnprintf(buf + len, buflen - len, "%04x ", mask[i]);
@@ -199,7 +199,7 @@ static ssize_t ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_5ghz(
                                char *buf, int buflen)
 {
        int i, len = 0;
-       const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[IEEE80211_BAND_5GHZ];
+       const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[NL80211_BAND_5GHZ];
 
        for (i = 0; i < NL80211_VHT_NSS_MAX; i++)
                len += scnprintf(buf + len, buflen - len, "%04x ", mask[i]);
index c6d4b75..a31d307 100644 (file)
@@ -126,7 +126,7 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata,
                }
        }
 
-       if (sband->band == IEEE80211_BAND_2GHZ) {
+       if (sband->band == NL80211_BAND_2GHZ) {
                *pos++ = WLAN_EID_DS_PARAMS;
                *pos++ = 1;
                *pos++ = ieee80211_frequency_to_channel(
@@ -348,11 +348,11 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
         *
         * HT follows these specifications (IEEE 802.11-2012 20.3.18)
         */
-       sdata->vif.bss_conf.use_short_slot = chan->band == IEEE80211_BAND_5GHZ;
+       sdata->vif.bss_conf.use_short_slot = chan->band == NL80211_BAND_5GHZ;
        bss_change |= BSS_CHANGED_ERP_SLOT;
 
        /* cf. IEEE 802.11 9.2.12 */
-       if (chan->band == IEEE80211_BAND_2GHZ && have_higher_than_11mbit)
+       if (chan->band == NL80211_BAND_2GHZ && have_higher_than_11mbit)
                sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
        else
                sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
@@ -989,7 +989,7 @@ static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata,
                                      struct ieee80211_channel *channel)
 {
        struct sta_info *sta;
-       enum ieee80211_band band = rx_status->band;
+       enum nl80211_band band = rx_status->band;
        enum nl80211_bss_scan_width scan_width;
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
@@ -1109,7 +1109,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_channel *channel;
        u64 beacon_timestamp, rx_timestamp;
        u32 supp_rates = 0;
-       enum ieee80211_band band = rx_status->band;
+       enum nl80211_band band = rx_status->band;
 
        channel = ieee80211_get_channel(local->hw.wiphy, rx_status->freq);
        if (!channel)
index 8857b01..9438c94 100644 (file)
@@ -896,13 +896,13 @@ struct ieee80211_sub_if_data {
        struct ieee80211_if_ap *bss;
 
        /* bitmap of allowed (non-MCS) rate indexes for rate control */
-       u32 rc_rateidx_mask[IEEE80211_NUM_BANDS];
+       u32 rc_rateidx_mask[NUM_NL80211_BANDS];
 
-       bool rc_has_mcs_mask[IEEE80211_NUM_BANDS];
-       u8  rc_rateidx_mcs_mask[IEEE80211_NUM_BANDS][IEEE80211_HT_MCS_MASK_LEN];
+       bool rc_has_mcs_mask[NUM_NL80211_BANDS];
+       u8  rc_rateidx_mcs_mask[NUM_NL80211_BANDS][IEEE80211_HT_MCS_MASK_LEN];
 
-       bool rc_has_vht_mcs_mask[IEEE80211_NUM_BANDS];
-       u16 rc_rateidx_vht_mcs_mask[IEEE80211_NUM_BANDS][NL80211_VHT_NSS_MAX];
+       bool rc_has_vht_mcs_mask[NUM_NL80211_BANDS];
+       u16 rc_rateidx_vht_mcs_mask[NUM_NL80211_BANDS][NL80211_VHT_NSS_MAX];
 
        union {
                struct ieee80211_if_ap ap;
@@ -957,10 +957,10 @@ sdata_assert_lock(struct ieee80211_sub_if_data *sdata)
        lockdep_assert_held(&sdata->wdev.mtx);
 }
 
-static inline enum ieee80211_band
+static inline enum nl80211_band
 ieee80211_get_sdata_band(struct ieee80211_sub_if_data *sdata)
 {
-       enum ieee80211_band band = IEEE80211_BAND_2GHZ;
+       enum nl80211_band band = NL80211_BAND_2GHZ;
        struct ieee80211_chanctx_conf *chanctx_conf;
 
        rcu_read_lock();
@@ -1231,7 +1231,7 @@ struct ieee80211_local {
        struct cfg80211_scan_request __rcu *scan_req;
        struct ieee80211_scan_request *hw_scan_req;
        struct cfg80211_chan_def scan_chandef;
-       enum ieee80211_band hw_scan_band;
+       enum nl80211_band hw_scan_band;
        int scan_channel_idx;
        int scan_ies_len;
        int hw_scan_ies_bufsize;
@@ -1738,10 +1738,10 @@ void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
                                 struct ieee80211_mgmt *mgmt);
 u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
                                   struct sta_info *sta, u8 opmode,
-                                 enum ieee80211_band band);
+                                 enum nl80211_band band);
 void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
                                 struct sta_info *sta, u8 opmode,
-                                enum ieee80211_band band);
+                                enum nl80211_band band);
 void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata,
                                      struct ieee80211_sta_vht_cap *vht_cap);
 void ieee80211_get_vht_mask_from_cap(__le16 vht_cap,
@@ -1769,7 +1769,7 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
  */
 int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
                                 struct ieee802_11_elems *elems,
-                                enum ieee80211_band current_band,
+                                enum nl80211_band current_band,
                                 u32 sta_flags, u8 *bssid,
                                 struct ieee80211_csa_ie *csa_ie);
 
@@ -1794,7 +1794,7 @@ static inline int __ieee80211_resume(struct ieee80211_hw *hw)
 
 /* utility functions/constants */
 extern const void *const mac80211_wiphy_privid; /* for wiphy privid */
-int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
+int ieee80211_frame_duration(enum nl80211_band band, size_t len,
                             int rate, int erp, int short_preamble,
                             int shift);
 void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
@@ -1804,12 +1804,12 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
 
 void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
                                 struct sk_buff *skb, int tid,
-                                enum ieee80211_band band);
+                                enum nl80211_band band);
 
 static inline void
 ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
                          struct sk_buff *skb, int tid,
-                         enum ieee80211_band band)
+                         enum nl80211_band band)
 {
        rcu_read_lock();
        __ieee80211_tx_skb_tid_band(sdata, skb, tid, band);
@@ -1964,7 +1964,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
 
 u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
                            struct ieee802_11_elems *elems,
-                           enum ieee80211_band band, u32 *basic_rates);
+                           enum nl80211_band band, u32 *basic_rates);
 int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
                                 enum ieee80211_smps_mode smps_mode);
 int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata,
@@ -1987,10 +1987,10 @@ int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
                             const u8 *srates, int srates_len, u32 *rates);
 int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
                            struct sk_buff *skb, bool need_basic,
-                           enum ieee80211_band band);
+                           enum nl80211_band band);
 int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
                                struct sk_buff *skb, bool need_basic,
-                               enum ieee80211_band band);
+                               enum nl80211_band band);
 u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
 
 /* channel management */
index 097ece8..6a33f0b 100644 (file)
@@ -1800,7 +1800,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
        INIT_DELAYED_WORK(&sdata->dec_tailroom_needed_wk,
                          ieee80211_delayed_tailroom_dec);
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+       for (i = 0; i < NUM_NL80211_BANDS; i++) {
                struct ieee80211_supported_band *sband;
                sband = local->hw.wiphy->bands[i];
                sdata->rc_rateidx_mask[i] =
index 33c80de..7ee91d6 100644 (file)
@@ -801,7 +801,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 {
        struct ieee80211_local *local = hw_to_local(hw);
        int result, i;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int channels, max_bitrates;
        bool supp_ht, supp_vht;
        netdev_features_t feature_whitelist;
@@ -874,7 +874,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        max_bitrates = 0;
        supp_ht = false;
        supp_vht = false;
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                struct ieee80211_supported_band *sband;
 
                sband = local->hw.wiphy->bands[band];
@@ -936,7 +936,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        if (!local->int_scan_req)
                return -ENOMEM;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                if (!local->hw.wiphy->bands[band])
                        continue;
                local->int_scan_req->rates[band] = (u32) -1;
index dcc1fac..4c6404e 100644 (file)
@@ -415,7 +415,7 @@ int mesh_add_ht_cap_ie(struct ieee80211_sub_if_data *sdata,
                       struct sk_buff *skb)
 {
        struct ieee80211_local *local = sdata->local;
-       enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        struct ieee80211_supported_band *sband;
        u8 *pos;
 
@@ -478,7 +478,7 @@ int mesh_add_vht_cap_ie(struct ieee80211_sub_if_data *sdata,
                        struct sk_buff *skb)
 {
        struct ieee80211_local *local = sdata->local;
-       enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        struct ieee80211_supported_band *sband;
        u8 *pos;
 
@@ -680,7 +680,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
        struct ieee80211_mgmt *mgmt;
        struct ieee80211_chanctx_conf *chanctx_conf;
        struct mesh_csa_settings *csa;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        u8 *pos;
        struct ieee80211_sub_if_data *sdata;
        int hdr_len = offsetof(struct ieee80211_mgmt, u.beacon) +
@@ -930,7 +930,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
        struct cfg80211_csa_settings params;
        struct ieee80211_csa_ie csa_ie;
        struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-       enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        int err;
        u32 sta_flags;
 
@@ -1084,7 +1084,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_channel *channel;
        size_t baselen;
        int freq;
-       enum ieee80211_band band = rx_status->band;
+       enum nl80211_band band = rx_status->band;
 
        /* ignore ProbeResp to foreign address */
        if (stype == IEEE80211_STYPE_PROBE_RESP &&
index 563bea0..79f2a0a 100644 (file)
@@ -93,18 +93,18 @@ static inline void mesh_plink_fsm_restart(struct sta_info *sta)
 static u32 mesh_set_short_slot_time(struct ieee80211_sub_if_data *sdata)
 {
        struct ieee80211_local *local = sdata->local;
-       enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
        struct sta_info *sta;
        u32 erp_rates = 0, changed = 0;
        int i;
        bool short_slot = false;
 
-       if (band == IEEE80211_BAND_5GHZ) {
+       if (band == NL80211_BAND_5GHZ) {
                /* (IEEE 802.11-2012 19.4.5) */
                short_slot = true;
                goto out;
-       } else if (band != IEEE80211_BAND_2GHZ)
+       } else if (band != NL80211_BAND_2GHZ)
                goto out;
 
        for (i = 0; i < sband->n_bitrates; i++)
@@ -247,7 +247,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
        mgmt->u.action.u.self_prot.action_code = action;
 
        if (action != WLAN_SP_MESH_PEERING_CLOSE) {
-               enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+               enum nl80211_band band = ieee80211_get_sdata_band(sdata);
 
                /* capability info */
                pos = skb_put(skb, 2);
@@ -385,7 +385,7 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
                               struct ieee802_11_elems *elems, bool insert)
 {
        struct ieee80211_local *local = sdata->local;
-       enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        struct ieee80211_supported_band *sband;
        u32 rates, basic_rates = 0, changed = 0;
        enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth;
index d3c75ac..885f4ca 100644 (file)
@@ -661,7 +661,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
 
        capab = WLAN_CAPABILITY_ESS;
 
-       if (sband->band == IEEE80211_BAND_2GHZ) {
+       if (sband->band == NL80211_BAND_2GHZ) {
                capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME;
                capab |= WLAN_CAPABILITY_SHORT_PREAMBLE;
        }
@@ -1100,7 +1100,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
        struct cfg80211_bss *cbss = ifmgd->associated;
        struct ieee80211_chanctx_conf *conf;
        struct ieee80211_chanctx *chanctx;
-       enum ieee80211_band current_band;
+       enum nl80211_band current_band;
        struct ieee80211_csa_ie csa_ie;
        struct ieee80211_channel_switch ch_switch;
        int res;
@@ -1257,11 +1257,11 @@ ieee80211_find_80211h_pwr_constr(struct ieee80211_sub_if_data *sdata,
        default:
                WARN_ON_ONCE(1);
                /* fall through */
-       case IEEE80211_BAND_2GHZ:
-       case IEEE80211_BAND_60GHZ:
+       case NL80211_BAND_2GHZ:
+       case NL80211_BAND_60GHZ:
                chan_increment = 1;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                chan_increment = 4;
                break;
        }
@@ -1861,7 +1861,7 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
        }
 
        use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME);
-       if (ieee80211_get_sdata_band(sdata) == IEEE80211_BAND_5GHZ)
+       if (ieee80211_get_sdata_band(sdata) == NL80211_BAND_5GHZ)
                use_short_slot = true;
 
        if (use_protection != bss_conf->use_cts_prot) {
@@ -4375,7 +4375,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
                sdata->vif.bss_conf.basic_rates = basic_rates;
 
                /* cf. IEEE 802.11 9.2.12 */
-               if (cbss->channel->band == IEEE80211_BAND_2GHZ &&
+               if (cbss->channel->band == NL80211_BAND_2GHZ &&
                    have_higher_than_11mbit)
                        sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
                else
index a4e2f4e..206698b 100644 (file)
@@ -287,7 +287,7 @@ static void __rate_control_send_low(struct ieee80211_hw *hw,
        u32 rate_flags =
                ieee80211_chandef_rate_flags(&hw->conf.chandef);
 
-       if ((sband->band == IEEE80211_BAND_2GHZ) &&
+       if ((sband->band == NL80211_BAND_2GHZ) &&
            (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE))
                rate_flags |= IEEE80211_RATE_ERP_G;
 
index b54f398..14c5ba3 100644 (file)
@@ -436,7 +436,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
 
 
 static void
-calc_rate_durations(enum ieee80211_band band,
+calc_rate_durations(enum nl80211_band band,
                    struct minstrel_rate *d,
                    struct ieee80211_rate *rate,
                    struct cfg80211_chan_def *chandef)
@@ -579,7 +579,7 @@ minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
        if (!mi)
                return NULL;
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+       for (i = 0; i < NUM_NL80211_BANDS; i++) {
                sband = hw->wiphy->bands[i];
                if (sband && sband->n_bitrates > max_rates)
                        max_rates = sband->n_bitrates;
@@ -621,7 +621,7 @@ minstrel_init_cck_rates(struct minstrel_priv *mp)
        u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef);
        int i, j;
 
-       sband = mp->hw->wiphy->bands[IEEE80211_BAND_2GHZ];
+       sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ];
        if (!sband)
                return;
 
index d77a9a8..30fbabf 100644 (file)
@@ -1137,7 +1137,7 @@ minstrel_ht_update_cck(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
 {
        int i;
 
-       if (sband->band != IEEE80211_BAND_2GHZ)
+       if (sband->band != NL80211_BAND_2GHZ)
                return;
 
        if (!ieee80211_hw_check(mp->hw, SUPPORTS_HT_CCK_RATES))
@@ -1335,7 +1335,7 @@ minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
        int max_rates = 0;
        int i;
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+       for (i = 0; i < NUM_NL80211_BANDS; i++) {
                sband = hw->wiphy->bands[i];
                if (sband && sband->n_bitrates > max_rates)
                        max_rates = sband->n_bitrates;
index c2b659e..c567870 100644 (file)
@@ -322,7 +322,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
        else if (status->flag & RX_FLAG_5MHZ)
                channel_flags |= IEEE80211_CHAN_QUARTER;
 
-       if (status->band == IEEE80211_BAND_5GHZ)
+       if (status->band == NL80211_BAND_5GHZ)
                channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;
        else if (status->flag & (RX_FLAG_HT | RX_FLAG_VHT))
                channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
@@ -2823,7 +2823,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
 
                switch (mgmt->u.action.u.measurement.action_code) {
                case WLAN_ACTION_SPCT_MSR_REQ:
-                       if (status->band != IEEE80211_BAND_5GHZ)
+                       if (status->band != NL80211_BAND_5GHZ)
                                break;
 
                        if (len < (IEEE80211_MIN_ACTION_SIZE +
@@ -4043,7 +4043,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,
 
        WARN_ON_ONCE(softirq_count() == 0);
 
-       if (WARN_ON(status->band >= IEEE80211_NUM_BANDS))
+       if (WARN_ON(status->band >= NUM_NL80211_BANDS))
                goto drop;
 
        sband = local->hw.wiphy->bands[status->band];
index 41aa728..f9648ef 100644 (file)
@@ -272,7 +272,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
                n_chans = req->n_channels;
        } else {
                do {
-                       if (local->hw_scan_band == IEEE80211_NUM_BANDS)
+                       if (local->hw_scan_band == NUM_NL80211_BANDS)
                                return false;
 
                        n_chans = 0;
@@ -485,7 +485,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
        int i;
        struct ieee80211_sub_if_data *sdata;
        struct cfg80211_scan_request *scan_req;
-       enum ieee80211_band band = local->hw.conf.chandef.chan->band;
+       enum nl80211_band band = local->hw.conf.chandef.chan->band;
        u32 tx_flags;
 
        scan_req = rcu_dereference_protected(local->scan_req,
@@ -953,7 +953,7 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
 {
        struct ieee80211_local *local = sdata->local;
        int ret = -EBUSY, i, n_ch = 0;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        mutex_lock(&local->mtx);
 
@@ -965,7 +965,7 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
        if (!channels) {
                int max_n;
 
-               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               for (band = 0; band < NUM_NL80211_BANDS; band++) {
                        if (!local->hw.wiphy->bands[band])
                                continue;
 
@@ -1085,7 +1085,7 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_scan_ies sched_scan_ies = {};
        struct cfg80211_chan_def chandef;
        int ret, i, iebufsz, num_bands = 0;
-       u32 rate_masks[IEEE80211_NUM_BANDS] = {};
+       u32 rate_masks[NUM_NL80211_BANDS] = {};
        u8 bands_used = 0;
        u8 *ie;
        size_t len;
@@ -1097,7 +1097,7 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
        if (!local->ops->sched_scan_start)
                return -ENOTSUPP;
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+       for (i = 0; i < NUM_NL80211_BANDS; i++) {
                if (local->hw.wiphy->bands[i]) {
                        bands_used |= BIT(i);
                        rate_masks[i] = (u32) -1;
index 06e6ac8..2ddc661 100644 (file)
 
 int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
                                 struct ieee802_11_elems *elems,
-                                enum ieee80211_band current_band,
+                                enum nl80211_band current_band,
                                 u32 sta_flags, u8 *bssid,
                                 struct ieee80211_csa_ie *csa_ie)
 {
-       enum ieee80211_band new_band;
+       enum nl80211_band new_band;
        int new_freq;
        u8 new_chan_no;
        struct ieee80211_channel *new_chan;
index a29ea81..1c7d45a 100644 (file)
@@ -47,7 +47,7 @@ static void ieee80211_tdls_add_ext_capab(struct ieee80211_sub_if_data *sdata,
                           NL80211_FEATURE_TDLS_CHANNEL_SWITCH;
        bool wider_band = ieee80211_hw_check(&local->hw, TDLS_WIDER_BW) &&
                          !ifmgd->tdls_wider_bw_prohibited;
-       enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
        bool vht = sband && sband->vht_cap.vht_supported;
        u8 *pos = (void *)skb_put(skb, 10);
@@ -184,7 +184,7 @@ static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata,
        if (status_code != 0)
                return 0;
 
-       if (ieee80211_get_sdata_band(sdata) == IEEE80211_BAND_2GHZ) {
+       if (ieee80211_get_sdata_band(sdata) == NL80211_BAND_2GHZ) {
                return WLAN_CAPABILITY_SHORT_SLOT_TIME |
                       WLAN_CAPABILITY_SHORT_PREAMBLE;
        }
@@ -357,7 +357,7 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata,
                                   u8 action_code, bool initiator,
                                   const u8 *extra_ies, size_t extra_ies_len)
 {
-       enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_supported_band *sband;
        struct ieee80211_sta_ht_cap ht_cap;
@@ -544,7 +544,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
        size_t offset = 0, noffset;
        struct sta_info *sta, *ap_sta;
-       enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
+       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        u8 *pos;
 
        mutex_lock(&local->sta_mtx);
@@ -611,7 +611,7 @@ ieee80211_tdls_add_setup_cfm_ies(struct ieee80211_sub_if_data *sdata,
        ieee80211_tdls_add_link_ie(sdata, skb, peer, initiator);
 
        /* only include VHT-operation if not on the 2.4GHz band */
-       if (band != IEEE80211_BAND_2GHZ && sta->sta.vht_cap.vht_supported) {
+       if (band != NL80211_BAND_2GHZ && sta->sta.vht_cap.vht_supported) {
                /*
                 * if both peers support WIDER_BW, we can expand the chandef to
                 * a wider compatible one, up to 80MHz
@@ -1773,7 +1773,7 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,
        u8 target_channel, oper_class;
        bool local_initiator;
        struct sta_info *sta;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_tdls_data *tf = (void *)skb->data;
        struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
        int baselen = offsetof(typeof(*tf), u.chan_switch_req.variable);
@@ -1805,10 +1805,10 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,
        if ((oper_class == 112 || oper_class == 2 || oper_class == 3 ||
             oper_class == 4 || oper_class == 5 || oper_class == 6) &&
             target_channel < 14)
-               band = IEEE80211_BAND_5GHZ;
+               band = NL80211_BAND_5GHZ;
        else
-               band = target_channel < 14 ? IEEE80211_BAND_2GHZ :
-                                            IEEE80211_BAND_5GHZ;
+               band = target_channel < 14 ? NL80211_BAND_2GHZ :
+                                            NL80211_BAND_5GHZ;
 
        freq = ieee80211_channel_to_frequency(target_channel, band);
        if (freq == 0) {
index 8c3b7ae..77e4c53 100644 (file)
@@ -401,7 +401,7 @@ TRACE_EVENT(drv_bss_info_changed,
                __field(u32, sync_device_ts)
                __field(u8, sync_dtim_count)
                __field(u32, basic_rates)
-               __array(int, mcast_rate, IEEE80211_NUM_BANDS)
+               __array(int, mcast_rate, NUM_NL80211_BANDS)
                __field(u16, ht_operation_mode)
                __field(s32, cqm_rssi_thold);
                __field(s32, cqm_rssi_hyst);
@@ -1265,8 +1265,8 @@ TRACE_EVENT(drv_set_bitrate_mask,
        TP_fast_assign(
                LOCAL_ASSIGN;
                VIF_ASSIGN;
-               __entry->legacy_2g = mask->control[IEEE80211_BAND_2GHZ].legacy;
-               __entry->legacy_5g = mask->control[IEEE80211_BAND_5GHZ].legacy;
+               __entry->legacy_2g = mask->control[NL80211_BAND_2GHZ].legacy;
+               __entry->legacy_5g = mask->control[NL80211_BAND_5GHZ].legacy;
        ),
 
        TP_printk(
index e04d850..2030443 100644 (file)
@@ -150,7 +150,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
                        rate = DIV_ROUND_UP(r->bitrate, 1 << shift);
 
                switch (sband->band) {
-               case IEEE80211_BAND_2GHZ: {
+               case NL80211_BAND_2GHZ: {
                        u32 flag;
                        if (tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
                                flag = IEEE80211_RATE_MANDATORY_G;
@@ -160,13 +160,13 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
                                mrate = r->bitrate;
                        break;
                }
-               case IEEE80211_BAND_5GHZ:
+               case NL80211_BAND_5GHZ:
                        if (r->flags & IEEE80211_RATE_MANDATORY_A)
                                mrate = r->bitrate;
                        break;
-               case IEEE80211_BAND_60GHZ:
+               case NL80211_BAND_60GHZ:
                        /* TODO, for now fall through */
-               case IEEE80211_NUM_BANDS:
+               case NUM_NL80211_BANDS:
                        WARN_ON(1);
                        break;
                }
@@ -2138,7 +2138,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
        u16 info_id = 0;
        struct ieee80211_chanctx_conf *chanctx_conf;
        struct ieee80211_sub_if_data *ap_sdata;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int ret;
 
        if (IS_ERR(sta))
@@ -3597,7 +3597,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
        struct sk_buff *skb = NULL;
        struct ieee80211_tx_info *info;
        struct ieee80211_sub_if_data *sdata = NULL;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_tx_rate_control txrc;
        struct ieee80211_chanctx_conf *chanctx_conf;
        int csa_off_base = 0;
@@ -4165,7 +4165,7 @@ EXPORT_SYMBOL(ieee80211_unreserve_tid);
 
 void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
                                 struct sk_buff *skb, int tid,
-                                enum ieee80211_band band)
+                                enum nl80211_band band)
 {
        int ac = ieee802_1d_to_ac[tid & 7];
 
index 0319d6d..905003f 100644 (file)
@@ -59,7 +59,7 @@ void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx)
        }
 }
 
-int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
+int ieee80211_frame_duration(enum nl80211_band band, size_t len,
                             int rate, int erp, int short_preamble,
                             int shift)
 {
@@ -77,7 +77,7 @@ int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
         * is assumed to be 0 otherwise.
         */
 
-       if (band == IEEE80211_BAND_5GHZ || erp) {
+       if (band == NL80211_BAND_5GHZ || erp) {
                /*
                 * OFDM:
                 *
@@ -129,7 +129,7 @@ int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
 /* Exported duration function for driver use */
 __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
                                        struct ieee80211_vif *vif,
-                                       enum ieee80211_band band,
+                                       enum nl80211_band band,
                                        size_t frame_len,
                                        struct ieee80211_rate *rate)
 {
@@ -1129,7 +1129,7 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
        rcu_read_lock();
        chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
        use_11b = (chanctx_conf &&
-                  chanctx_conf->def.chan->band == IEEE80211_BAND_2GHZ) &&
+                  chanctx_conf->def.chan->band == NL80211_BAND_2GHZ) &&
                 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE);
        rcu_read_unlock();
 
@@ -1301,7 +1301,7 @@ void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
 static int ieee80211_build_preq_ies_band(struct ieee80211_local *local,
                                         u8 *buffer, size_t buffer_len,
                                         const u8 *ie, size_t ie_len,
-                                        enum ieee80211_band band,
+                                        enum nl80211_band band,
                                         u32 rate_mask,
                                         struct cfg80211_chan_def *chandef,
                                         size_t *offset)
@@ -1375,7 +1375,7 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_local *local,
                pos += ext_rates_len;
        }
 
-       if (chandef->chan && sband->band == IEEE80211_BAND_2GHZ) {
+       if (chandef->chan && sband->band == NL80211_BAND_2GHZ) {
                if (end - pos < 3)
                        goto out_err;
                *pos++ = WLAN_EID_DS_PARAMS;
@@ -1479,7 +1479,7 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
 
        memset(ie_desc, 0, sizeof(*ie_desc));
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+       for (i = 0; i < NUM_NL80211_BANDS; i++) {
                if (bands_used & BIT(i)) {
                        pos += ieee80211_build_preq_ies_band(local,
                                                             buffer + pos,
@@ -1522,7 +1522,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
        struct sk_buff *skb;
        struct ieee80211_mgmt *mgmt;
        int ies_len;
-       u32 rate_masks[IEEE80211_NUM_BANDS] = {};
+       u32 rate_masks[NUM_NL80211_BANDS] = {};
        struct ieee80211_scan_ies dummy_ie_desc;
 
        /*
@@ -1582,7 +1582,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
 
 u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
                            struct ieee802_11_elems *elems,
-                           enum ieee80211_band band, u32 *basic_rates)
+                           enum nl80211_band band, u32 *basic_rates)
 {
        struct ieee80211_supported_band *sband;
        size_t num_rates;
@@ -2520,7 +2520,7 @@ int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
 
 int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
                            struct sk_buff *skb, bool need_basic,
-                           enum ieee80211_band band)
+                           enum nl80211_band band)
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_supported_band *sband;
@@ -2565,7 +2565,7 @@ int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
 
 int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
                                struct sk_buff *skb, bool need_basic,
-                               enum ieee80211_band band)
+                               enum nl80211_band band)
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_supported_band *sband;
@@ -2711,7 +2711,7 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
 
                if (status->flag & RX_FLAG_MACTIME_PLCP_START) {
                        /* TODO: handle HT/VHT preambles */
-                       if (status->band == IEEE80211_BAND_5GHZ) {
+                       if (status->band == NL80211_BAND_5GHZ) {
                                ts += 20 << shift;
                                mpdu_offset += 2;
                        } else if (status->flag & RX_FLAG_SHORTPRE) {
index e590e2e..ee71576 100644 (file)
@@ -418,7 +418,7 @@ void ieee80211_sta_set_rx_nss(struct sta_info *sta)
 
 u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
                                  struct sta_info *sta, u8 opmode,
-                                 enum ieee80211_band band)
+                                 enum nl80211_band band)
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_supported_band *sband;
@@ -504,7 +504,7 @@ EXPORT_SYMBOL_GPL(ieee80211_update_mu_groups);
 
 void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
                                 struct sta_info *sta, u8 opmode,
-                                enum ieee80211_band band)
+                                enum nl80211_band band)
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
index afde5f5..2fd6074 100644 (file)
@@ -12,6 +12,8 @@
  * published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/types.h>
 #include <linux/netfilter.h>
 #include <linux/module.h>
@@ -966,7 +968,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
 
        if (!l4proto->new(ct, skb, dataoff, timeouts)) {
                nf_conntrack_free(ct);
-               pr_debug("init conntrack: can't track with proto module\n");
+               pr_debug("can't track with proto module\n");
                return NULL;
        }
 
@@ -988,7 +990,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
                spin_lock(&nf_conntrack_expect_lock);
                exp = nf_ct_find_expectation(net, zone, tuple);
                if (exp) {
-                       pr_debug("conntrack: expectation arrives ct=%p exp=%p\n",
+                       pr_debug("expectation arrives ct=%p exp=%p\n",
                                 ct, exp);
                        /* Welcome, Mr. Bond.  We've been expecting you... */
                        __set_bit(IPS_EXPECTED_BIT, &ct->status);
@@ -1053,7 +1055,7 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl,
        if (!nf_ct_get_tuple(skb, skb_network_offset(skb),
                             dataoff, l3num, protonum, net, &tuple, l3proto,
                             l4proto)) {
-               pr_debug("resolve_normal_ct: Can't get tuple\n");
+               pr_debug("Can't get tuple\n");
                return NULL;
        }
 
@@ -1079,14 +1081,13 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl,
        } else {
                /* Once we've had two way comms, always ESTABLISHED. */
                if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
-                       pr_debug("nf_conntrack_in: normal packet for %p\n", ct);
+                       pr_debug("normal packet for %p\n", ct);
                        *ctinfo = IP_CT_ESTABLISHED;
                } else if (test_bit(IPS_EXPECTED_BIT, &ct->status)) {
-                       pr_debug("nf_conntrack_in: related packet for %p\n",
-                                ct);
+                       pr_debug("related packet for %p\n", ct);
                        *ctinfo = IP_CT_RELATED;
                } else {
-                       pr_debug("nf_conntrack_in: new packet for %p\n", ct);
+                       pr_debug("new packet for %p\n", ct);
                        *ctinfo = IP_CT_NEW;
                }
                *set_reply = 0;
index 4e78c57..d28011b 100644 (file)
@@ -113,6 +113,60 @@ static void ecache_work(struct work_struct *work)
                schedule_delayed_work(&ctnet->ecache_dwork, delay);
 }
 
+int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct,
+                                 u32 portid, int report)
+{
+       int ret = 0;
+       struct net *net = nf_ct_net(ct);
+       struct nf_ct_event_notifier *notify;
+       struct nf_conntrack_ecache *e;
+
+       rcu_read_lock();
+       notify = rcu_dereference(net->ct.nf_conntrack_event_cb);
+       if (!notify)
+               goto out_unlock;
+
+       e = nf_ct_ecache_find(ct);
+       if (!e)
+               goto out_unlock;
+
+       if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) {
+               struct nf_ct_event item = {
+                       .ct     = ct,
+                       .portid = e->portid ? e->portid : portid,
+                       .report = report
+               };
+               /* This is a resent of a destroy event? If so, skip missed */
+               unsigned long missed = e->portid ? 0 : e->missed;
+
+               if (!((eventmask | missed) & e->ctmask))
+                       goto out_unlock;
+
+               ret = notify->fcn(eventmask | missed, &item);
+               if (unlikely(ret < 0 || missed)) {
+                       spin_lock_bh(&ct->lock);
+                       if (ret < 0) {
+                               /* This is a destroy event that has been
+                                * triggered by a process, we store the PORTID
+                                * to include it in the retransmission.
+                                */
+                               if (eventmask & (1 << IPCT_DESTROY) &&
+                                   e->portid == 0 && portid != 0)
+                                       e->portid = portid;
+                               else
+                                       e->missed |= eventmask;
+                       } else {
+                               e->missed &= ~missed;
+                       }
+                       spin_unlock_bh(&ct->lock);
+               }
+       }
+out_unlock:
+       rcu_read_unlock();
+       return ret;
+}
+EXPORT_SYMBOL_GPL(nf_conntrack_eventmask_report);
+
 /* deliver cached events and clear cache entry - must be called with locally
  * disabled softirqs */
 void nf_ct_deliver_cached_events(struct nf_conn *ct)
@@ -167,6 +221,36 @@ out_unlock:
 }
 EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events);
 
+void nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
+                              struct nf_conntrack_expect *exp,
+                              u32 portid, int report)
+
+{
+       struct net *net = nf_ct_exp_net(exp);
+       struct nf_exp_event_notifier *notify;
+       struct nf_conntrack_ecache *e;
+
+       rcu_read_lock();
+       notify = rcu_dereference(net->ct.nf_expect_event_cb);
+       if (!notify)
+               goto out_unlock;
+
+       e = nf_ct_ecache_find(exp->master);
+       if (!e)
+               goto out_unlock;
+
+       if (e->expmask & (1 << event)) {
+               struct nf_exp_event item = {
+                       .exp    = exp,
+                       .portid = portid,
+                       .report = report
+               };
+               notify->fcn(1 << event, &item);
+       }
+out_unlock:
+       rcu_read_unlock();
+}
+
 int nf_conntrack_register_notifier(struct net *net,
                                   struct nf_ct_event_notifier *new)
 {
index cb5b630..aa93877 100644 (file)
@@ -295,6 +295,59 @@ static u32 nfqnl_get_sk_secctx(struct sk_buff *skb, char **secdata)
        return seclen;
 }
 
+static u32 nfqnl_get_bridge_size(struct nf_queue_entry *entry)
+{
+       struct sk_buff *entskb = entry->skb;
+       u32 nlalen = 0;
+
+       if (entry->state.pf != PF_BRIDGE || !skb_mac_header_was_set(entskb))
+               return 0;
+
+       if (skb_vlan_tag_present(entskb))
+               nlalen += nla_total_size(nla_total_size(sizeof(__be16)) +
+                                        nla_total_size(sizeof(__be16)));
+
+       if (entskb->network_header > entskb->mac_header)
+               nlalen += nla_total_size((entskb->network_header -
+                                         entskb->mac_header));
+
+       return nlalen;
+}
+
+static int nfqnl_put_bridge(struct nf_queue_entry *entry, struct sk_buff *skb)
+{
+       struct sk_buff *entskb = entry->skb;
+
+       if (entry->state.pf != PF_BRIDGE || !skb_mac_header_was_set(entskb))
+               return 0;
+
+       if (skb_vlan_tag_present(entskb)) {
+               struct nlattr *nest;
+
+               nest = nla_nest_start(skb, NFQA_VLAN | NLA_F_NESTED);
+               if (!nest)
+                       goto nla_put_failure;
+
+               if (nla_put_be16(skb, NFQA_VLAN_TCI, htons(entskb->vlan_tci)) ||
+                   nla_put_be16(skb, NFQA_VLAN_PROTO, entskb->vlan_proto))
+                       goto nla_put_failure;
+
+               nla_nest_end(skb, nest);
+       }
+
+       if (entskb->mac_header < entskb->network_header) {
+               int len = (int)(entskb->network_header - entskb->mac_header);
+
+               if (nla_put(skb, NFQA_L2HDR, len, skb_mac_header(entskb)))
+                       goto nla_put_failure;
+       }
+
+       return 0;
+
+nla_put_failure:
+       return -1;
+}
+
 static struct sk_buff *
 nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
                           struct nf_queue_entry *entry,
@@ -334,6 +387,8 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
        if (entskb->tstamp.tv64)
                size += nla_total_size(sizeof(struct nfqnl_msg_packet_timestamp));
 
+       size += nfqnl_get_bridge_size(entry);
+
        if (entry->state.hook <= NF_INET_FORWARD ||
           (entry->state.hook == NF_INET_POST_ROUTING && entskb->sk == NULL))
                csum_verify = !skb_csum_unnecessary(entskb);
@@ -497,6 +552,9 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
                }
        }
 
+       if (nfqnl_put_bridge(entry, skb) < 0)
+               goto nla_put_failure;
+
        if (entskb->tstamp.tv64) {
                struct nfqnl_msg_packet_timestamp ts;
                struct timespec64 kts = ktime_to_timespec64(skb->tstamp);
@@ -911,12 +969,18 @@ static struct notifier_block nfqnl_rtnl_notifier = {
        .notifier_call  = nfqnl_rcv_nl_event,
 };
 
+static const struct nla_policy nfqa_vlan_policy[NFQA_VLAN_MAX + 1] = {
+       [NFQA_VLAN_TCI]         = { .type = NLA_U16},
+       [NFQA_VLAN_PROTO]       = { .type = NLA_U16},
+};
+
 static const struct nla_policy nfqa_verdict_policy[NFQA_MAX+1] = {
        [NFQA_VERDICT_HDR]      = { .len = sizeof(struct nfqnl_msg_verdict_hdr) },
        [NFQA_MARK]             = { .type = NLA_U32 },
        [NFQA_PAYLOAD]          = { .type = NLA_UNSPEC },
        [NFQA_CT]               = { .type = NLA_UNSPEC },
        [NFQA_EXP]              = { .type = NLA_UNSPEC },
+       [NFQA_VLAN]             = { .type = NLA_NESTED },
 };
 
 static const struct nla_policy nfqa_verdict_batch_policy[NFQA_MAX+1] = {
@@ -1030,6 +1094,40 @@ static struct nf_conn *nfqnl_ct_parse(struct nfnl_ct_hook *nfnl_ct,
        return ct;
 }
 
+static int nfqa_parse_bridge(struct nf_queue_entry *entry,
+                            const struct nlattr * const nfqa[])
+{
+       if (nfqa[NFQA_VLAN]) {
+               struct nlattr *tb[NFQA_VLAN_MAX + 1];
+               int err;
+
+               err = nla_parse_nested(tb, NFQA_VLAN_MAX, nfqa[NFQA_VLAN],
+                                      nfqa_vlan_policy);
+               if (err < 0)
+                       return err;
+
+               if (!tb[NFQA_VLAN_TCI] || !tb[NFQA_VLAN_PROTO])
+                       return -EINVAL;
+
+               entry->skb->vlan_tci = ntohs(nla_get_be16(tb[NFQA_VLAN_TCI]));
+               entry->skb->vlan_proto = nla_get_be16(tb[NFQA_VLAN_PROTO]);
+       }
+
+       if (nfqa[NFQA_L2HDR]) {
+               int mac_header_len = entry->skb->network_header -
+                       entry->skb->mac_header;
+
+               if (mac_header_len != nla_len(nfqa[NFQA_L2HDR]))
+                       return -EINVAL;
+               else if (mac_header_len > 0)
+                       memcpy(skb_mac_header(entry->skb),
+                              nla_data(nfqa[NFQA_L2HDR]),
+                              mac_header_len);
+       }
+
+       return 0;
+}
+
 static int nfqnl_recv_verdict(struct net *net, struct sock *ctnl,
                              struct sk_buff *skb,
                              const struct nlmsghdr *nlh,
@@ -1045,6 +1143,7 @@ static int nfqnl_recv_verdict(struct net *net, struct sock *ctnl,
        struct nfnl_ct_hook *nfnl_ct;
        struct nf_conn *ct = NULL;
        struct nfnl_queue_net *q = nfnl_queue_pernet(net);
+       int err;
 
        queue = instance_lookup(q, queue_num);
        if (!queue)
@@ -1071,6 +1170,12 @@ static int nfqnl_recv_verdict(struct net *net, struct sock *ctnl,
                        ct = nfqnl_ct_parse(nfnl_ct, nlh, nfqa, entry, &ctinfo);
        }
 
+       if (entry->state.pf == PF_BRIDGE) {
+               err = nfqa_parse_bridge(entry, nfqa);
+               if (err < 0)
+                       return err;
+       }
+
        if (nfqa[NFQA_PAYLOAD]) {
                u16 payload_len = nla_len(nfqa[NFQA_PAYLOAD]);
                int diff = payload_len - entry->skb->len;
index 23dcef1..784c531 100644 (file)
@@ -30,7 +30,7 @@ config AF_RXRPC_DEBUG
 
 
 config RXKAD
-       tristate "RxRPC Kerberos security"
+       bool "RxRPC Kerberos security"
        depends on AF_RXRPC
        select CRYPTO
        select CRYPTO_MANAGER
index ec126f9..e05a06e 100644 (file)
@@ -18,11 +18,12 @@ af-rxrpc-y := \
        ar-recvmsg.o \
        ar-security.o \
        ar-skbuff.o \
-       ar-transport.o
+       ar-transport.o \
+       insecure.o \
+       misc.o
 
 af-rxrpc-$(CONFIG_PROC_FS) += ar-proc.o
+af-rxrpc-$(CONFIG_RXKAD) += rxkad.o
 af-rxrpc-$(CONFIG_SYSCTL) += sysctl.o
 
 obj-$(CONFIG_AF_RXRPC) += af-rxrpc.o
-
-obj-$(CONFIG_RXKAD) += rxkad.o
index 9d935fa..e45e94c 100644 (file)
@@ -806,6 +806,12 @@ static int __init af_rxrpc_init(void)
                goto error_work_queue;
        }
 
+       ret = rxrpc_init_security();
+       if (ret < 0) {
+               printk(KERN_CRIT "RxRPC: Cannot initialise security\n");
+               goto error_security;
+       }
+
        ret = proto_register(&rxrpc_proto, 1);
        if (ret < 0) {
                printk(KERN_CRIT "RxRPC: Cannot register protocol\n");
@@ -853,6 +859,8 @@ error_sock:
        proto_unregister(&rxrpc_proto);
 error_proto:
        destroy_workqueue(rxrpc_workqueue);
+error_security:
+       rxrpc_exit_security();
 error_work_queue:
        kmem_cache_destroy(rxrpc_call_jar);
 error_call_jar:
@@ -883,6 +891,7 @@ static void __exit af_rxrpc_exit(void)
        remove_proc_entry("rxrpc_conns", init_net.proc_net);
        remove_proc_entry("rxrpc_calls", init_net.proc_net);
        destroy_workqueue(rxrpc_workqueue);
+       rxrpc_exit_security();
        kmem_cache_destroy(rxrpc_call_jar);
        _leave("");
 }
index 277731a..e7a7f05 100644 (file)
@@ -108,7 +108,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
                goto error;
        }
 
-       conn = rxrpc_incoming_connection(trans, &sp->hdr, GFP_NOIO);
+       conn = rxrpc_incoming_connection(trans, &sp->hdr);
        rxrpc_put_transport(trans);
        if (IS_ERR(conn)) {
                _debug("no conn");
@@ -116,7 +116,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
                goto error;
        }
 
-       call = rxrpc_incoming_call(rx, conn, &sp->hdr, GFP_NOIO);
+       call = rxrpc_incoming_call(rx, conn, &sp->hdr);
        rxrpc_put_connection(conn);
        if (IS_ERR(call)) {
                _debug("no call");
index 16d9670..374478e 100644 (file)
 #include <net/af_rxrpc.h>
 #include "ar-internal.h"
 
-/*
- * How long to wait before scheduling ACK generation after seeing a
- * packet with RXRPC_REQUEST_ACK set (in jiffies).
- */
-unsigned int rxrpc_requested_ack_delay = 1;
-
-/*
- * How long to wait before scheduling an ACK with subtype DELAY (in jiffies).
- *
- * We use this when we've received new data packets.  If those packets aren't
- * all consumed within this time we will send a DELAY ACK if an ACK was not
- * requested to let the sender know it doesn't need to resend.
- */
-unsigned int rxrpc_soft_ack_delay = 1 * HZ;
-
-/*
- * How long to wait before scheduling an ACK with subtype IDLE (in jiffies).
- *
- * We use this when we've consumed some previously soft-ACK'd packets when
- * further packets aren't immediately received to decide when to send an IDLE
- * ACK let the other end know that it can free up its Tx buffer space.
- */
-unsigned int rxrpc_idle_ack_delay = 0.5 * HZ;
-
-/*
- * Receive window size in packets.  This indicates the maximum number of
- * unconsumed received packets we're willing to retain in memory.  Once this
- * limit is hit, we should generate an EXCEEDS_WINDOW ACK and discard further
- * packets.
- */
-unsigned int rxrpc_rx_window_size = 32;
-
-/*
- * Maximum Rx MTU size.  This indicates to the sender the size of jumbo packet
- * made by gluing normal packets together that we're willing to handle.
- */
-unsigned int rxrpc_rx_mtu = 5692;
-
-/*
- * The maximum number of fragments in a received jumbo packet that we tell the
- * sender that we're willing to handle.
- */
-unsigned int rxrpc_rx_jumbo_max = 4;
-
-static const char *rxrpc_acks(u8 reason)
-{
-       static const char *const str[] = {
-               "---", "REQ", "DUP", "OOS", "WIN", "MEM", "PNG", "PNR", "DLY",
-               "IDL", "-?-"
-       };
-
-       if (reason >= ARRAY_SIZE(str))
-               reason = ARRAY_SIZE(str) - 1;
-       return str[reason];
-}
-
-static const s8 rxrpc_ack_priority[] = {
-       [0]                             = 0,
-       [RXRPC_ACK_DELAY]               = 1,
-       [RXRPC_ACK_REQUESTED]           = 2,
-       [RXRPC_ACK_IDLE]                = 3,
-       [RXRPC_ACK_PING_RESPONSE]       = 4,
-       [RXRPC_ACK_DUPLICATE]           = 5,
-       [RXRPC_ACK_OUT_OF_SEQUENCE]     = 6,
-       [RXRPC_ACK_EXCEEDS_WINDOW]      = 7,
-       [RXRPC_ACK_NOSPACE]             = 8,
-};
-
 /*
  * propose an ACK be sent
  */
@@ -426,7 +358,7 @@ static void rxrpc_rotate_tx_window(struct rxrpc_call *call, u32 hard)
        int tail = call->acks_tail, old_tail;
        int win = CIRC_CNT(call->acks_head, tail, call->acks_winsz);
 
-       kenter("{%u,%u},%u", call->acks_hard, win, hard);
+       _enter("{%u,%u},%u", call->acks_hard, win, hard);
 
        ASSERTCMP(hard - call->acks_hard, <=, win);
 
@@ -656,7 +588,8 @@ process_further:
                _proto("OOSQ DATA %%%u { #%u }", sp->hdr.serial, sp->hdr.seq);
 
                /* secured packets must be verified and possibly decrypted */
-               if (rxrpc_verify_packet(call, skb, _abort_code) < 0)
+               if (call->conn->security->verify_packet(call, skb,
+                                                       _abort_code) < 0)
                        goto protocol_error;
 
                rxrpc_insert_oos_packet(call, skb);
@@ -901,8 +834,8 @@ void rxrpc_process_call(struct work_struct *work)
 
        /* there's a good chance we're going to have to send a message, so set
         * one up in advance */
-       msg.msg_name    = &call->conn->trans->peer->srx.transport.sin;
-       msg.msg_namelen = sizeof(call->conn->trans->peer->srx.transport.sin);
+       msg.msg_name    = &call->conn->trans->peer->srx.transport;
+       msg.msg_namelen = call->conn->trans->peer->srx.transport_len;
        msg.msg_control = NULL;
        msg.msg_controllen = 0;
        msg.msg_flags   = 0;
@@ -973,7 +906,7 @@ void rxrpc_process_call(struct work_struct *work)
                                       ECONNABORTED, true) < 0)
                        goto no_mem;
                whdr.type = RXRPC_PACKET_TYPE_ABORT;
-               data = htonl(call->abort_code);
+               data = htonl(call->local_abort);
                iov[1].iov_base = &data;
                iov[1].iov_len = sizeof(data);
                genbit = RXRPC_CALL_EV_ABORT;
@@ -1036,7 +969,7 @@ void rxrpc_process_call(struct work_struct *work)
                write_lock_bh(&call->state_lock);
                if (call->state <= RXRPC_CALL_COMPLETE) {
                        call->state = RXRPC_CALL_LOCALLY_ABORTED;
-                       call->abort_code = RX_CALL_TIMEOUT;
+                       call->local_abort = RX_CALL_TIMEOUT;
                        set_bit(RXRPC_CALL_EV_ABORT, &call->events);
                }
                write_unlock_bh(&call->state_lock);
index 7c8d300..571a41f 100644 (file)
@@ -411,18 +411,17 @@ found_extant_second:
  */
 struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx,
                                       struct rxrpc_connection *conn,
-                                      struct rxrpc_host_header *hdr,
-                                      gfp_t gfp)
+                                      struct rxrpc_host_header *hdr)
 {
        struct rxrpc_call *call, *candidate;
        struct rb_node **p, *parent;
        u32 call_id;
 
-       _enter(",%d,,%x", conn->debug_id, gfp);
+       _enter(",%d", conn->debug_id);
 
        ASSERT(rx != NULL);
 
-       candidate = rxrpc_alloc_call(gfp);
+       candidate = rxrpc_alloc_call(GFP_NOIO);
        if (!candidate)
                return ERR_PTR(-EBUSY);
 
@@ -682,7 +681,7 @@ void rxrpc_release_call(struct rxrpc_call *call)
            call->state != RXRPC_CALL_CLIENT_FINAL_ACK) {
                _debug("+++ ABORTING STATE %d +++\n", call->state);
                call->state = RXRPC_CALL_LOCALLY_ABORTED;
-               call->abort_code = RX_CALL_DEAD;
+               call->local_abort = RX_CALL_DEAD;
                set_bit(RXRPC_CALL_EV_ABORT, &call->events);
                rxrpc_queue_call(call);
        }
@@ -758,7 +757,7 @@ static void rxrpc_mark_call_released(struct rxrpc_call *call)
                if (call->state < RXRPC_CALL_COMPLETE) {
                        _debug("abort call %p", call);
                        call->state = RXRPC_CALL_LOCALLY_ABORTED;
-                       call->abort_code = RX_CALL_DEAD;
+                       call->local_abort = RX_CALL_DEAD;
                        if (!test_and_set_bit(RXRPC_CALL_EV_ABORT, &call->events))
                                sched = true;
                }
index 9942da1..97f4fae 100644 (file)
@@ -207,6 +207,7 @@ static struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp)
                INIT_LIST_HEAD(&conn->bundle_link);
                conn->calls = RB_ROOT;
                skb_queue_head_init(&conn->rx_queue);
+               conn->security = &rxrpc_no_security;
                rwlock_init(&conn->lock);
                spin_lock_init(&conn->state_lock);
                atomic_set(&conn->usage, 1);
@@ -564,8 +565,7 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
                     candidate->debug_id, candidate->trans->debug_id);
 
                rxrpc_assign_connection_id(candidate);
-               if (candidate->security)
-                       candidate->security->prime_packet_security(candidate);
+               candidate->security->prime_packet_security(candidate);
 
                /* leave the candidate lurking in zombie mode attached to the
                 * bundle until we're ready for it */
@@ -619,8 +619,7 @@ interrupted:
  */
 struct rxrpc_connection *
 rxrpc_incoming_connection(struct rxrpc_transport *trans,
-                         struct rxrpc_host_header *hdr,
-                         gfp_t gfp)
+                         struct rxrpc_host_header *hdr)
 {
        struct rxrpc_connection *conn, *candidate = NULL;
        struct rb_node *p, **pp;
@@ -659,7 +658,7 @@ rxrpc_incoming_connection(struct rxrpc_transport *trans,
 
        /* not yet present - create a candidate for a new record and then
         * redo the search */
-       candidate = rxrpc_alloc_connection(gfp);
+       candidate = rxrpc_alloc_connection(GFP_NOIO);
        if (!candidate) {
                _leave(" = -ENOMEM");
                return ERR_PTR(-ENOMEM);
@@ -831,7 +830,10 @@ static void rxrpc_destroy_connection(struct rxrpc_connection *conn)
        ASSERT(RB_EMPTY_ROOT(&conn->calls));
        rxrpc_purge_queue(&conn->rx_queue);
 
-       rxrpc_clear_conn_security(conn);
+       conn->security->clear(conn);
+       key_put(conn->key);
+       key_put(conn->server_key);
+
        rxrpc_put_transport(conn->trans);
        kfree(conn);
        _leave("");
index 1bdaaed..5f95639 100644 (file)
@@ -40,11 +40,13 @@ static void rxrpc_abort_calls(struct rxrpc_connection *conn, int state,
                write_lock(&call->state_lock);
                if (call->state <= RXRPC_CALL_COMPLETE) {
                        call->state = state;
-                       call->abort_code = abort_code;
-                       if (state == RXRPC_CALL_LOCALLY_ABORTED)
+                       if (state == RXRPC_CALL_LOCALLY_ABORTED) {
+                               call->local_abort = conn->local_abort;
                                set_bit(RXRPC_CALL_EV_CONN_ABORT, &call->events);
-                       else
+                       } else {
+                               call->remote_abort = conn->remote_abort;
                                set_bit(RXRPC_CALL_EV_RCVD_ABORT, &call->events);
+                       }
                        rxrpc_queue_call(call);
                }
                write_unlock(&call->state_lock);
@@ -84,8 +86,8 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
 
        rxrpc_abort_calls(conn, RXRPC_CALL_LOCALLY_ABORTED, abort_code);
 
-       msg.msg_name    = &conn->trans->peer->srx.transport.sin;
-       msg.msg_namelen = sizeof(conn->trans->peer->srx.transport.sin);
+       msg.msg_name    = &conn->trans->peer->srx.transport;
+       msg.msg_namelen = conn->trans->peer->srx.transport_len;
        msg.msg_control = NULL;
        msg.msg_controllen = 0;
        msg.msg_flags   = 0;
@@ -101,7 +103,7 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
        whdr._rsvd      = 0;
        whdr.serviceId  = htons(conn->service_id);
 
-       word = htonl(abort_code);
+       word            = htonl(conn->local_abort);
 
        iov[0].iov_base = &whdr;
        iov[0].iov_len  = sizeof(whdr);
@@ -112,7 +114,7 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
 
        serial = atomic_inc_return(&conn->serial);
        whdr.serial = htonl(serial);
-       _proto("Tx CONN ABORT %%%u { %d }", serial, abort_code);
+       _proto("Tx CONN ABORT %%%u { %d }", serial, conn->local_abort);
 
        ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 2, len);
        if (ret < 0) {
@@ -172,15 +174,10 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
                return -ECONNABORTED;
 
        case RXRPC_PACKET_TYPE_CHALLENGE:
-               if (conn->security)
-                       return conn->security->respond_to_challenge(
-                               conn, skb, _abort_code);
-               return -EPROTO;
+               return conn->security->respond_to_challenge(conn, skb,
+                                                           _abort_code);
 
        case RXRPC_PACKET_TYPE_RESPONSE:
-               if (!conn->security)
-                       return -EPROTO;
-
                ret = conn->security->verify_response(conn, skb, _abort_code);
                if (ret < 0)
                        return ret;
@@ -236,8 +233,6 @@ static void rxrpc_secure_connection(struct rxrpc_connection *conn)
                }
        }
 
-       ASSERT(conn->security != NULL);
-
        if (conn->security->issue_challenge(conn) < 0) {
                abort_code = RX_CALL_DEAD;
                ret = -ENOMEM;
index 63ed75c..01e0381 100644 (file)
 #include <net/net_namespace.h>
 #include "ar-internal.h"
 
-const char *rxrpc_pkts[] = {
-       "?00",
-       "DATA", "ACK", "BUSY", "ABORT", "ACKALL", "CHALL", "RESP", "DEBUG",
-       "?09", "?10", "?11", "?12", "VERSION", "?14", "?15"
-};
-
 /*
  * queue a packet for recvmsg to pass to userspace
  * - the caller must hold a lock on call->lock
@@ -199,7 +193,7 @@ static int rxrpc_fast_process_data(struct rxrpc_call *call,
 
        /* if the packet need security things doing to it, then it goes down
         * the slow path */
-       if (call->conn->security)
+       if (call->conn->security_ix)
                goto enqueue_packet;
 
        sp->call = call;
@@ -355,7 +349,7 @@ void rxrpc_fast_process_packet(struct rxrpc_call *call, struct sk_buff *skb)
                write_lock_bh(&call->state_lock);
                if (call->state < RXRPC_CALL_COMPLETE) {
                        call->state = RXRPC_CALL_REMOTELY_ABORTED;
-                       call->abort_code = abort_code;
+                       call->remote_abort = abort_code;
                        set_bit(RXRPC_CALL_EV_RCVD_ABORT, &call->events);
                        rxrpc_queue_call(call);
                }
@@ -428,7 +422,7 @@ protocol_error:
 protocol_error_locked:
        if (call->state <= RXRPC_CALL_COMPLETE) {
                call->state = RXRPC_CALL_LOCALLY_ABORTED;
-               call->abort_code = RX_PROTOCOL_ERROR;
+               call->local_abort = RX_PROTOCOL_ERROR;
                set_bit(RXRPC_CALL_EV_ABORT, &call->events);
                rxrpc_queue_call(call);
        }
@@ -500,7 +494,7 @@ protocol_error:
        write_lock_bh(&call->state_lock);
        if (call->state <= RXRPC_CALL_COMPLETE) {
                call->state = RXRPC_CALL_LOCALLY_ABORTED;
-               call->abort_code = RX_PROTOCOL_ERROR;
+               call->local_abort = RX_PROTOCOL_ERROR;
                set_bit(RXRPC_CALL_EV_ABORT, &call->events);
                rxrpc_queue_call(call);
        }
@@ -612,9 +606,9 @@ int rxrpc_extract_header(struct rxrpc_skb_priv *sp, struct sk_buff *skb)
        struct rxrpc_wire_header whdr;
 
        /* dig out the RxRPC connection details */
-       if (skb_copy_bits(skb, sizeof(struct udphdr), &whdr, sizeof(whdr)) < 0)
+       if (skb_copy_bits(skb, 0, &whdr, sizeof(whdr)) < 0)
                return -EBADMSG;
-       if (!pskb_pull(skb, sizeof(struct udphdr) + sizeof(whdr)))
+       if (!pskb_pull(skb, sizeof(whdr)))
                BUG();
 
        memset(sp, 0, sizeof(*sp));
index cd6cdbe..f0b807a 100644 (file)
@@ -9,6 +9,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#include <net/sock.h>
 #include <rxrpc/packet.h>
 
 #if 0
@@ -124,11 +125,15 @@ enum rxrpc_command {
  * RxRPC security module interface
  */
 struct rxrpc_security {
-       struct module           *owner;         /* providing module */
-       struct list_head        link;           /* link in master list */
        const char              *name;          /* name of this service */
        u8                      security_index; /* security type provided */
 
+       /* Initialise a security service */
+       int (*init)(void);
+
+       /* Clean up a security service */
+       void (*exit)(void);
+
        /* initialise a connection's security */
        int (*init_connection_security)(struct rxrpc_connection *);
 
@@ -268,7 +273,7 @@ struct rxrpc_connection {
        struct rb_root          calls;          /* calls on this connection */
        struct sk_buff_head     rx_queue;       /* received conn-level packets */
        struct rxrpc_call       *channels[RXRPC_MAXCALLS]; /* channels (active calls) */
-       struct rxrpc_security   *security;      /* applied security module */
+       const struct rxrpc_security *security;  /* applied security module */
        struct key              *key;           /* security for this connection (client) */
        struct key              *server_key;    /* security for this service */
        struct crypto_skcipher  *cipher;        /* encryption handle */
@@ -289,7 +294,9 @@ struct rxrpc_connection {
                RXRPC_CONN_LOCALLY_ABORTED,     /* - conn aborted locally */
                RXRPC_CONN_NETWORK_ERROR,       /* - conn terminated by network error */
        } state;
-       int                     error;          /* error code for local abort */
+       u32                     local_abort;    /* local abort code */
+       u32                     remote_abort;   /* remote abort code */
+       int                     error;          /* local error incurred */
        int                     debug_id;       /* debug ID for printks */
        unsigned int            call_counter;   /* call ID counter */
        atomic_t                serial;         /* packet serial number counter */
@@ -399,7 +406,9 @@ struct rxrpc_call {
        rwlock_t                state_lock;     /* lock for state transition */
        atomic_t                usage;
        atomic_t                sequence;       /* Tx data packet sequence counter */
-       u32                     abort_code;     /* local/remote abort code */
+       u32                     local_abort;    /* local abort code */
+       u32                     remote_abort;   /* remote abort code */
+       int                     error;          /* local error incurred */
        enum rxrpc_call_state   state : 8;      /* current state of call */
        int                     debug_id;       /* debug ID for printks */
        u8                      channel;        /* connection channel occupied by this call */
@@ -453,7 +462,7 @@ static inline void rxrpc_abort_call(struct rxrpc_call *call, u32 abort_code)
 {
        write_lock_bh(&call->state_lock);
        if (call->state < RXRPC_CALL_COMPLETE) {
-               call->abort_code = abort_code;
+               call->local_abort = abort_code;
                call->state = RXRPC_CALL_LOCALLY_ABORTED;
                set_bit(RXRPC_CALL_EV_ABORT, &call->events);
        }
@@ -478,13 +487,6 @@ int rxrpc_reject_call(struct rxrpc_sock *);
 /*
  * ar-ack.c
  */
-extern unsigned int rxrpc_requested_ack_delay;
-extern unsigned int rxrpc_soft_ack_delay;
-extern unsigned int rxrpc_idle_ack_delay;
-extern unsigned int rxrpc_rx_window_size;
-extern unsigned int rxrpc_rx_mtu;
-extern unsigned int rxrpc_rx_jumbo_max;
-
 void __rxrpc_propose_ACK(struct rxrpc_call *, u8, u32, bool);
 void rxrpc_propose_ACK(struct rxrpc_call *, u8, u32, bool);
 void rxrpc_process_call(struct work_struct *);
@@ -506,7 +508,7 @@ struct rxrpc_call *rxrpc_get_client_call(struct rxrpc_sock *,
                                         unsigned long, int, gfp_t);
 struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *,
                                       struct rxrpc_connection *,
-                                      struct rxrpc_host_header *, gfp_t);
+                                      struct rxrpc_host_header *);
 struct rxrpc_call *rxrpc_find_server_call(struct rxrpc_sock *, unsigned long);
 void rxrpc_release_call(struct rxrpc_call *);
 void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
@@ -531,8 +533,7 @@ void __exit rxrpc_destroy_all_connections(void);
 struct rxrpc_connection *rxrpc_find_connection(struct rxrpc_transport *,
                                               struct rxrpc_host_header *);
 extern struct rxrpc_connection *
-rxrpc_incoming_connection(struct rxrpc_transport *, struct rxrpc_host_header *,
-                         gfp_t);
+rxrpc_incoming_connection(struct rxrpc_transport *, struct rxrpc_host_header *);
 
 /*
  * ar-connevent.c
@@ -550,8 +551,6 @@ void rxrpc_UDP_error_handler(struct work_struct *);
 /*
  * ar-input.c
  */
-extern const char *rxrpc_pkts[];
-
 void rxrpc_data_ready(struct sock *);
 int rxrpc_queue_rcv_skb(struct rxrpc_call *, struct sk_buff *, bool, bool);
 void rxrpc_fast_process_packet(struct rxrpc_call *, struct sk_buff *);
@@ -610,14 +609,10 @@ int rxrpc_recvmsg(struct socket *, struct msghdr *, size_t, int);
 /*
  * ar-security.c
  */
-int rxrpc_register_security(struct rxrpc_security *);
-void rxrpc_unregister_security(struct rxrpc_security *);
+int __init rxrpc_init_security(void);
+void rxrpc_exit_security(void);
 int rxrpc_init_client_conn_security(struct rxrpc_connection *);
 int rxrpc_init_server_conn_security(struct rxrpc_connection *);
-int rxrpc_secure_packet(const struct rxrpc_call *, struct sk_buff *, size_t,
-                       void *);
-int rxrpc_verify_packet(const struct rxrpc_call *, struct sk_buff *, u32 *);
-void rxrpc_clear_conn_security(struct rxrpc_connection *);
 
 /*
  * ar-skbuff.c
@@ -636,6 +631,33 @@ void __exit rxrpc_destroy_all_transports(void);
 struct rxrpc_transport *rxrpc_find_transport(struct rxrpc_local *,
                                             struct rxrpc_peer *);
 
+/*
+ * insecure.c
+ */
+extern const struct rxrpc_security rxrpc_no_security;
+
+/*
+ * misc.c
+ */
+extern unsigned int rxrpc_requested_ack_delay;
+extern unsigned int rxrpc_soft_ack_delay;
+extern unsigned int rxrpc_idle_ack_delay;
+extern unsigned int rxrpc_rx_window_size;
+extern unsigned int rxrpc_rx_mtu;
+extern unsigned int rxrpc_rx_jumbo_max;
+
+extern const char *const rxrpc_pkts[];
+extern const s8 rxrpc_ack_priority[];
+
+extern const char *rxrpc_acks(u8 reason);
+
+/*
+ * rxkad.c
+ */
+#ifdef CONFIG_RXKAD
+extern const struct rxrpc_security rxkad;
+#endif
+
 /*
  * sysctl.c
  */
index d36fb6e..51cb100 100644 (file)
@@ -110,7 +110,7 @@ static void rxrpc_send_abort(struct rxrpc_call *call, u32 abort_code)
 
        if (call->state <= RXRPC_CALL_COMPLETE) {
                call->state = RXRPC_CALL_LOCALLY_ABORTED;
-               call->abort_code = abort_code;
+               call->local_abort = abort_code;
                set_bit(RXRPC_CALL_EV_ABORT, &call->events);
                del_timer_sync(&call->resend_timer);
                del_timer_sync(&call->ack_timer);
@@ -663,7 +663,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
                        size_t pad;
 
                        /* pad out if we're using security */
-                       if (conn->security) {
+                       if (conn->security_ix) {
                                pad = conn->security_size + skb->mark;
                                pad = conn->size_align - pad;
                                pad &= conn->size_align - 1;
@@ -695,7 +695,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
                        if (more && seq & 1)
                                sp->hdr.flags |= RXRPC_REQUEST_ACK;
 
-                       ret = rxrpc_secure_packet(
+                       ret = conn->security->secure_packet(
                                call, skb, skb->mark,
                                skb->head + sizeof(struct rxrpc_wire_header));
                        if (ret < 0)
index 525b2ba..225163b 100644 (file)
@@ -80,7 +80,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v)
                   call->conn->in_clientflag ? "Svc" : "Clt",
                   atomic_read(&call->usage),
                   rxrpc_call_states[call->state],
-                  call->abort_code,
+                  call->remote_abort ?: call->local_abort,
                   call->user_call_ID);
 
        return 0;
index 64facba..160f092 100644 (file)
@@ -288,7 +288,11 @@ receive_non_data_message:
                ret = put_cmsg(msg, SOL_RXRPC, RXRPC_BUSY, 0, &abort_code);
                break;
        case RXRPC_SKB_MARK_REMOTE_ABORT:
-               abort_code = call->abort_code;
+               abort_code = call->remote_abort;
+               ret = put_cmsg(msg, SOL_RXRPC, RXRPC_ABORT, 4, &abort_code);
+               break;
+       case RXRPC_SKB_MARK_LOCAL_ABORT:
+               abort_code = call->local_abort;
                ret = put_cmsg(msg, SOL_RXRPC, RXRPC_ABORT, 4, &abort_code);
                break;
        case RXRPC_SKB_MARK_NET_ERROR:
@@ -303,6 +307,7 @@ receive_non_data_message:
                               &abort_code);
                break;
        default:
+               pr_err("RxRPC: Unknown packet mark %u\n", skb->mark);
                BUG();
                break;
        }
@@ -401,9 +406,14 @@ u32 rxrpc_kernel_get_abort_code(struct sk_buff *skb)
 {
        struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
 
-       ASSERTCMP(skb->mark, ==, RXRPC_SKB_MARK_REMOTE_ABORT);
-
-       return sp->call->abort_code;
+       switch (skb->mark) {
+       case RXRPC_SKB_MARK_REMOTE_ABORT:
+               return sp->call->remote_abort;
+       case RXRPC_SKB_MARK_LOCAL_ABORT:
+               return sp->call->local_abort;
+       default:
+               BUG();
+       }
 }
 
 EXPORT_SYMBOL(rxrpc_kernel_get_abort_code);
index ceff639..d223253 100644 (file)
 static LIST_HEAD(rxrpc_security_methods);
 static DECLARE_RWSEM(rxrpc_security_sem);
 
-/*
- * get an RxRPC security module
- */
-static struct rxrpc_security *rxrpc_security_get(struct rxrpc_security *sec)
-{
-       return try_module_get(sec->owner) ? sec : NULL;
-}
-
-/*
- * release an RxRPC security module
- */
-static void rxrpc_security_put(struct rxrpc_security *sec)
+static const struct rxrpc_security *rxrpc_security_types[] = {
+       [RXRPC_SECURITY_NONE]   = &rxrpc_no_security,
+#ifdef CONFIG_RXKAD
+       [RXRPC_SECURITY_RXKAD]  = &rxkad,
+#endif
+};
+
+int __init rxrpc_init_security(void)
 {
-       module_put(sec->owner);
-}
-
-/*
- * look up an rxrpc security module
- */
-static struct rxrpc_security *rxrpc_security_lookup(u8 security_index)
-{
-       struct rxrpc_security *sec = NULL;
-
-       _enter("");
+       int i, ret;
 
-       down_read(&rxrpc_security_sem);
-
-       list_for_each_entry(sec, &rxrpc_security_methods, link) {
-               if (sec->security_index == security_index) {
-                       if (unlikely(!rxrpc_security_get(sec)))
-                               break;
-                       goto out;
+       for (i = 0; i < ARRAY_SIZE(rxrpc_security_types); i++) {
+               if (rxrpc_security_types[i]) {
+                       ret = rxrpc_security_types[i]->init();
+                       if (ret < 0)
+                               goto failed;
                }
        }
 
-       sec = NULL;
-out:
-       up_read(&rxrpc_security_sem);
-       _leave(" = %p [%s]", sec, sec ? sec->name : "");
-       return sec;
+       return 0;
+
+failed:
+       for (i--; i >= 0; i--)
+               if (rxrpc_security_types[i])
+                       rxrpc_security_types[i]->exit();
+       return ret;
 }
 
-/**
- * rxrpc_register_security - register an RxRPC security handler
- * @sec: security module
- *
- * register an RxRPC security handler for use by RxRPC
- */
-int rxrpc_register_security(struct rxrpc_security *sec)
+void rxrpc_exit_security(void)
 {
-       struct rxrpc_security *psec;
-       int ret;
+       int i;
 
-       _enter("");
-       down_write(&rxrpc_security_sem);
-
-       ret = -EEXIST;
-       list_for_each_entry(psec, &rxrpc_security_methods, link) {
-               if (psec->security_index == sec->security_index)
-                       goto out;
-       }
-
-       list_add(&sec->link, &rxrpc_security_methods);
-
-       printk(KERN_NOTICE "RxRPC: Registered security type %d '%s'\n",
-              sec->security_index, sec->name);
-       ret = 0;
-
-out:
-       up_write(&rxrpc_security_sem);
-       _leave(" = %d", ret);
-       return ret;
+       for (i = 0; i < ARRAY_SIZE(rxrpc_security_types); i++)
+               if (rxrpc_security_types[i])
+                       rxrpc_security_types[i]->exit();
 }
 
-EXPORT_SYMBOL_GPL(rxrpc_register_security);
-
-/**
- * rxrpc_unregister_security - unregister an RxRPC security handler
- * @sec: security module
- *
- * unregister an RxRPC security handler
+/*
+ * look up an rxrpc security module
  */
-void rxrpc_unregister_security(struct rxrpc_security *sec)
+static const struct rxrpc_security *rxrpc_security_lookup(u8 security_index)
 {
-
-       _enter("");
-       down_write(&rxrpc_security_sem);
-       list_del_init(&sec->link);
-       up_write(&rxrpc_security_sem);
-
-       printk(KERN_NOTICE "RxRPC: Unregistered security type %d '%s'\n",
-              sec->security_index, sec->name);
+       if (security_index >= ARRAY_SIZE(rxrpc_security_types))
+               return NULL;
+       return rxrpc_security_types[security_index];
 }
 
-EXPORT_SYMBOL_GPL(rxrpc_unregister_security);
-
 /*
  * initialise the security on a client connection
  */
 int rxrpc_init_client_conn_security(struct rxrpc_connection *conn)
 {
+       const struct rxrpc_security *sec;
        struct rxrpc_key_token *token;
-       struct rxrpc_security *sec;
        struct key *key = conn->key;
        int ret;
 
@@ -148,8 +99,7 @@ int rxrpc_init_client_conn_security(struct rxrpc_connection *conn)
 
        ret = conn->security->init_connection_security(conn);
        if (ret < 0) {
-               rxrpc_security_put(conn->security);
-               conn->security = NULL;
+               conn->security = &rxrpc_no_security;
                return ret;
        }
 
@@ -162,7 +112,7 @@ int rxrpc_init_client_conn_security(struct rxrpc_connection *conn)
  */
 int rxrpc_init_server_conn_security(struct rxrpc_connection *conn)
 {
-       struct rxrpc_security *sec;
+       const struct rxrpc_security *sec;
        struct rxrpc_local *local = conn->trans->local;
        struct rxrpc_sock *rx;
        struct key *key;
@@ -188,14 +138,12 @@ int rxrpc_init_server_conn_security(struct rxrpc_connection *conn)
 
        /* the service appears to have died */
        read_unlock_bh(&local->services_lock);
-       rxrpc_security_put(sec);
        _leave(" = -ENOENT");
        return -ENOENT;
 
 found_service:
        if (!rx->securities) {
                read_unlock_bh(&local->services_lock);
-               rxrpc_security_put(sec);
                _leave(" = -ENOKEY");
                return -ENOKEY;
        }
@@ -205,7 +153,6 @@ found_service:
                              &key_type_rxrpc_s, kdesc);
        if (IS_ERR(kref)) {
                read_unlock_bh(&local->services_lock);
-               rxrpc_security_put(sec);
                _leave(" = %ld [search]", PTR_ERR(kref));
                return PTR_ERR(kref);
        }
@@ -219,46 +166,3 @@ found_service:
        _leave(" = 0");
        return 0;
 }
-
-/*
- * secure a packet prior to transmission
- */
-int rxrpc_secure_packet(const struct rxrpc_call *call,
-                       struct sk_buff *skb,
-                       size_t data_size,
-                       void *sechdr)
-{
-       if (call->conn->security)
-               return call->conn->security->secure_packet(
-                       call, skb, data_size, sechdr);
-       return 0;
-}
-
-/*
- * secure a packet prior to transmission
- */
-int rxrpc_verify_packet(const struct rxrpc_call *call, struct sk_buff *skb,
-                       u32 *_abort_code)
-{
-       if (call->conn->security)
-               return call->conn->security->verify_packet(
-                       call, skb, _abort_code);
-       return 0;
-}
-
-/*
- * clear connection security
- */
-void rxrpc_clear_conn_security(struct rxrpc_connection *conn)
-{
-       _enter("{%d}", conn->debug_id);
-
-       if (conn->security) {
-               conn->security->clear(conn);
-               rxrpc_security_put(conn->security);
-               conn->security = NULL;
-       }
-
-       key_put(conn->key);
-       key_put(conn->server_key);
-}
diff --git a/net/rxrpc/insecure.c b/net/rxrpc/insecure.c
new file mode 100644 (file)
index 0000000..e571403
--- /dev/null
@@ -0,0 +1,83 @@
+/* Null security operations.
+ *
+ * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public Licence
+ * as published by the Free Software Foundation; either version
+ * 2 of the Licence, or (at your option) any later version.
+ */
+
+#include <net/af_rxrpc.h>
+#include "ar-internal.h"
+
+static int none_init_connection_security(struct rxrpc_connection *conn)
+{
+       return 0;
+}
+
+static void none_prime_packet_security(struct rxrpc_connection *conn)
+{
+}
+
+static int none_secure_packet(const struct rxrpc_call *call,
+                              struct sk_buff *skb,
+                              size_t data_size,
+                              void *sechdr)
+{
+       return 0;
+}
+
+static int none_verify_packet(const struct rxrpc_call *call,
+                              struct sk_buff *skb,
+                              u32 *_abort_code)
+{
+       return 0;
+}
+
+static int none_respond_to_challenge(struct rxrpc_connection *conn,
+                                     struct sk_buff *skb,
+                                     u32 *_abort_code)
+{
+       *_abort_code = RX_PROTOCOL_ERROR;
+       return -EPROTO;
+}
+
+static int none_verify_response(struct rxrpc_connection *conn,
+                                struct sk_buff *skb,
+                                u32 *_abort_code)
+{
+       *_abort_code = RX_PROTOCOL_ERROR;
+       return -EPROTO;
+}
+
+static void none_clear(struct rxrpc_connection *conn)
+{
+}
+
+static int none_init(void)
+{
+       return 0;
+}
+
+static void none_exit(void)
+{
+}
+
+/*
+ * RxRPC Kerberos-based security
+ */
+const struct rxrpc_security rxrpc_no_security = {
+       .name                           = "none",
+       .security_index                 = RXRPC_SECURITY_NONE,
+       .init                           = none_init,
+       .exit                           = none_exit,
+       .init_connection_security       = none_init_connection_security,
+       .prime_packet_security          = none_prime_packet_security,
+       .secure_packet                  = none_secure_packet,
+       .verify_packet                  = none_verify_packet,
+       .respond_to_challenge           = none_respond_to_challenge,
+       .verify_response                = none_verify_response,
+       .clear                          = none_clear,
+};
diff --git a/net/rxrpc/misc.c b/net/rxrpc/misc.c
new file mode 100644 (file)
index 0000000..1afe987
--- /dev/null
@@ -0,0 +1,89 @@
+/* Miscellaneous bits
+ *
+ * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public Licence
+ * as published by the Free Software Foundation; either version
+ * 2 of the Licence, or (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <net/sock.h>
+#include <net/af_rxrpc.h>
+#include "ar-internal.h"
+
+/*
+ * How long to wait before scheduling ACK generation after seeing a
+ * packet with RXRPC_REQUEST_ACK set (in jiffies).
+ */
+unsigned int rxrpc_requested_ack_delay = 1;
+
+/*
+ * How long to wait before scheduling an ACK with subtype DELAY (in jiffies).
+ *
+ * We use this when we've received new data packets.  If those packets aren't
+ * all consumed within this time we will send a DELAY ACK if an ACK was not
+ * requested to let the sender know it doesn't need to resend.
+ */
+unsigned int rxrpc_soft_ack_delay = 1 * HZ;
+
+/*
+ * How long to wait before scheduling an ACK with subtype IDLE (in jiffies).
+ *
+ * We use this when we've consumed some previously soft-ACK'd packets when
+ * further packets aren't immediately received to decide when to send an IDLE
+ * ACK let the other end know that it can free up its Tx buffer space.
+ */
+unsigned int rxrpc_idle_ack_delay = 0.5 * HZ;
+
+/*
+ * Receive window size in packets.  This indicates the maximum number of
+ * unconsumed received packets we're willing to retain in memory.  Once this
+ * limit is hit, we should generate an EXCEEDS_WINDOW ACK and discard further
+ * packets.
+ */
+unsigned int rxrpc_rx_window_size = 32;
+
+/*
+ * Maximum Rx MTU size.  This indicates to the sender the size of jumbo packet
+ * made by gluing normal packets together that we're willing to handle.
+ */
+unsigned int rxrpc_rx_mtu = 5692;
+
+/*
+ * The maximum number of fragments in a received jumbo packet that we tell the
+ * sender that we're willing to handle.
+ */
+unsigned int rxrpc_rx_jumbo_max = 4;
+
+const char *const rxrpc_pkts[] = {
+       "?00",
+       "DATA", "ACK", "BUSY", "ABORT", "ACKALL", "CHALL", "RESP", "DEBUG",
+       "?09", "?10", "?11", "?12", "VERSION", "?14", "?15"
+};
+
+const s8 rxrpc_ack_priority[] = {
+       [0]                             = 0,
+       [RXRPC_ACK_DELAY]               = 1,
+       [RXRPC_ACK_REQUESTED]           = 2,
+       [RXRPC_ACK_IDLE]                = 3,
+       [RXRPC_ACK_PING_RESPONSE]       = 4,
+       [RXRPC_ACK_DUPLICATE]           = 5,
+       [RXRPC_ACK_OUT_OF_SEQUENCE]     = 6,
+       [RXRPC_ACK_EXCEEDS_WINDOW]      = 7,
+       [RXRPC_ACK_NOSPACE]             = 8,
+};
+
+const char *rxrpc_acks(u8 reason)
+{
+       static const char *const str[] = {
+               "---", "REQ", "DUP", "OOS", "WIN", "MEM", "PNG", "PNR", "DLY",
+               "IDL", "-?-"
+       };
+
+       if (reason >= ARRAY_SIZE(str))
+               reason = ARRAY_SIZE(str) - 1;
+       return str[reason];
+}
index f0aeb81..6b726a0 100644 (file)
@@ -20,7 +20,6 @@
 #include <net/sock.h>
 #include <net/af_rxrpc.h>
 #include <keys/rxrpc-type.h>
-#define rxrpc_debug rxkad_debug
 #include "ar-internal.h"
 
 #define RXKAD_VERSION                  2
 #define REALM_SZ                       40      /* size of principal's auth domain */
 #define SNAME_SZ                       40      /* size of service name */
 
-unsigned int rxrpc_debug;
-module_param_named(debug, rxrpc_debug, uint, S_IWUSR | S_IRUGO);
-MODULE_PARM_DESC(debug, "rxkad debugging mask");
-
 struct rxkad_level1_hdr {
        __be32  data_size;      /* true data size (excluding padding) */
 };
@@ -44,10 +39,6 @@ struct rxkad_level2_hdr {
        __be32  checksum;       /* decrypted data checksum */
 };
 
-MODULE_DESCRIPTION("RxRPC network protocol type-2 security (Kerberos 4)");
-MODULE_AUTHOR("Red Hat, Inc.");
-MODULE_LICENSE("GPL");
-
 /*
  * this holds a pinned cipher so that keventd doesn't get called by the cipher
  * alloc routine, but since we have it to hand, we use it to decrypt RESPONSE
@@ -1163,13 +1154,36 @@ static void rxkad_clear(struct rxrpc_connection *conn)
                crypto_free_skcipher(conn->cipher);
 }
 
+/*
+ * Initialise the rxkad security service.
+ */
+static int rxkad_init(void)
+{
+       /* pin the cipher we need so that the crypto layer doesn't invoke
+        * keventd to go get it */
+       rxkad_ci = crypto_alloc_skcipher("pcbc(fcrypt)", 0, CRYPTO_ALG_ASYNC);
+       if (IS_ERR(rxkad_ci))
+               return PTR_ERR(rxkad_ci);
+       return 0;
+}
+
+/*
+ * Clean up the rxkad security service.
+ */
+static void rxkad_exit(void)
+{
+       if (rxkad_ci)
+               crypto_free_skcipher(rxkad_ci);
+}
+
 /*
  * RxRPC Kerberos-based security
  */
-static struct rxrpc_security rxkad = {
-       .owner                          = THIS_MODULE,
+const struct rxrpc_security rxkad = {
        .name                           = "rxkad",
        .security_index                 = RXRPC_SECURITY_RXKAD,
+       .init                           = rxkad_init,
+       .exit                           = rxkad_exit,
        .init_connection_security       = rxkad_init_connection_security,
        .prime_packet_security          = rxkad_prime_packet_security,
        .secure_packet                  = rxkad_secure_packet,
@@ -1179,28 +1193,3 @@ static struct rxrpc_security rxkad = {
        .verify_response                = rxkad_verify_response,
        .clear                          = rxkad_clear,
 };
-
-static __init int rxkad_init(void)
-{
-       _enter("");
-
-       /* pin the cipher we need so that the crypto layer doesn't invoke
-        * keventd to go get it */
-       rxkad_ci = crypto_alloc_skcipher("pcbc(fcrypt)", 0, CRYPTO_ALG_ASYNC);
-       if (IS_ERR(rxkad_ci))
-               return PTR_ERR(rxkad_ci);
-
-       return rxrpc_register_security(&rxkad);
-}
-
-module_init(rxkad_init);
-
-static __exit void rxkad_exit(void)
-{
-       _enter("");
-
-       rxrpc_unregister_security(&rxkad);
-       crypto_free_skcipher(rxkad_ci);
-}
-
-module_exit(rxkad_exit);
index f2aabc0..a309a07 100644 (file)
@@ -796,7 +796,7 @@ struct meta_type_ops {
        int     (*dump)(struct sk_buff *, struct meta_value *, int);
 };
 
-static struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX + 1] = {
+static const struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX + 1] = {
        [TCF_META_TYPE_VAR] = {
                .destroy = meta_var_destroy,
                .compare = meta_var_compare,
@@ -812,7 +812,7 @@ static struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX + 1] = {
        }
 };
 
-static inline struct meta_type_ops *meta_type_ops(struct meta_value *v)
+static inline const struct meta_type_ops *meta_type_ops(struct meta_value *v)
 {
        return &__meta_type_ops[meta_type(v)];
 }
@@ -870,7 +870,7 @@ static int em_meta_match(struct sk_buff *skb, struct tcf_ematch *m,
 static void meta_delete(struct meta_match *meta)
 {
        if (meta) {
-               struct meta_type_ops *ops = meta_type_ops(&meta->lvalue);
+               const struct meta_type_ops *ops = meta_type_ops(&meta->lvalue);
 
                if (ops && ops->destroy) {
                        ops->destroy(&meta->lvalue);
@@ -964,7 +964,7 @@ static int em_meta_dump(struct sk_buff *skb, struct tcf_ematch *em)
 {
        struct meta_match *meta = (struct meta_match *) em->data;
        struct tcf_meta_hdr hdr;
-       struct meta_type_ops *ops;
+       const struct meta_type_ops *ops;
 
        memset(&hdr, 0, sizeof(hdr));
        memcpy(&hdr.left, &meta->lvalue.hdr, sizeof(hdr.left));
index 7fe56d0..d06317d 100644 (file)
@@ -1222,6 +1222,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
                                sctp_cmd_seq_t *commands,
                                gfp_t gfp)
 {
+       struct sock *sk = ep->base.sk;
+       struct sctp_sock *sp = sctp_sk(sk);
        int error = 0;
        int force;
        sctp_cmd_t *cmd;
@@ -1742,6 +1744,11 @@ out:
                        error = sctp_outq_uncork(&asoc->outqueue, gfp);
        } else if (local_cork)
                error = sctp_outq_uncork(&asoc->outqueue, gfp);
+
+       if (sp->pending_data_ready) {
+               sk->sk_data_ready(sk);
+               sp->pending_data_ready = 0;
+       }
        return error;
 nomem:
        error = -ENOMEM;
index ce469d6..72e5b3e 100644 (file)
@@ -264,7 +264,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
                sctp_ulpq_clear_pd(ulpq);
 
        if (queue == &sk->sk_receive_queue)
-               sk->sk_data_ready(sk);
+               sctp_sk(sk)->pending_data_ready = 1;
        return 1;
 
 out_free:
@@ -1140,5 +1140,5 @@ void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, gfp_t gfp)
 
        /* If there is data waiting, send it up the socket now. */
        if (sctp_ulpq_clear_pd(ulpq) || ev)
-               sk->sk_data_ready(sk);
+               sctp_sk(sk)->pending_data_ready = 1;
 }
index afa3c34..5dbb0bb 100644 (file)
@@ -709,17 +709,16 @@ void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
 EXPORT_SYMBOL_GPL(__sock_recv_ts_and_drops);
 
 static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
-                                    size_t size, int flags)
+                                    int flags)
 {
-       return sock->ops->recvmsg(sock, msg, size, flags);
+       return sock->ops->recvmsg(sock, msg, msg_data_left(msg), flags);
 }
 
-int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
-                int flags)
+int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags)
 {
-       int err = security_socket_recvmsg(sock, msg, size, flags);
+       int err = security_socket_recvmsg(sock, msg, msg_data_left(msg), flags);
 
-       return err ?: sock_recvmsg_nosec(sock, msg, size, flags);
+       return err ?: sock_recvmsg_nosec(sock, msg, flags);
 }
 EXPORT_SYMBOL(sock_recvmsg);
 
@@ -746,7 +745,7 @@ int kernel_recvmsg(struct socket *sock, struct msghdr *msg,
 
        iov_iter_kvec(&msg->msg_iter, READ | ITER_KVEC, vec, num, size);
        set_fs(KERNEL_DS);
-       result = sock_recvmsg(sock, msg, size, flags);
+       result = sock_recvmsg(sock, msg, flags);
        set_fs(oldfs);
        return result;
 }
@@ -796,7 +795,7 @@ static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to)
        if (!iov_iter_count(to))        /* Match SYS5 behaviour */
                return 0;
 
-       res = sock_recvmsg(sock, &msg, iov_iter_count(to), msg.msg_flags);
+       res = sock_recvmsg(sock, &msg, msg.msg_flags);
        *to = msg.msg_iter;
        return res;
 }
@@ -1696,7 +1695,7 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
        msg.msg_iocb = NULL;
        if (sock->file->f_flags & O_NONBLOCK)
                flags |= MSG_DONTWAIT;
-       err = sock_recvmsg(sock, &msg, iov_iter_count(&msg.msg_iter), flags);
+       err = sock_recvmsg(sock, &msg, flags);
 
        if (err >= 0 && addr != NULL) {
                err2 = move_addr_to_user(&address,
@@ -2073,7 +2072,7 @@ static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg,
        struct iovec iovstack[UIO_FASTIOV];
        struct iovec *iov = iovstack;
        unsigned long cmsg_ptr;
-       int total_len, len;
+       int len;
        ssize_t err;
 
        /* kernel mode address */
@@ -2091,7 +2090,6 @@ static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg,
                err = copy_msghdr_from_user(msg_sys, msg, &uaddr, &iov);
        if (err < 0)
                return err;
-       total_len = iov_iter_count(&msg_sys->msg_iter);
 
        cmsg_ptr = (unsigned long)msg_sys->msg_control;
        msg_sys->msg_flags = flags & (MSG_CMSG_CLOEXEC|MSG_CMSG_COMPAT);
@@ -2101,8 +2099,7 @@ static int ___sys_recvmsg(struct socket *sock, struct user_msghdr __user *msg,
 
        if (sock->file->f_flags & O_NONBLOCK)
                flags |= MSG_DONTWAIT;
-       err = (nosec ? sock_recvmsg_nosec : sock_recvmsg)(sock, msg_sys,
-                                                         total_len, flags);
+       err = (nosec ? sock_recvmsg_nosec : sock_recvmsg)(sock, msg_sys, flags);
        if (err < 0)
                goto out_freeiov;
        len = err;
index de70c78..f217c34 100644 (file)
@@ -155,7 +155,7 @@ int csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb)
        struct xdr_skb_reader   desc;
 
        desc.skb = skb;
-       desc.offset = sizeof(struct udphdr);
+       desc.offset = 0;
        desc.count = skb->len - desc.offset;
 
        if (skb_csum_unnecessary(skb))
index 1413cdc..dadfec6 100644 (file)
@@ -85,8 +85,7 @@ static void svc_reclassify_socket(struct socket *sock)
 {
        struct sock *sk = sock->sk;
 
-       WARN_ON_ONCE(sock_owned_by_user(sk));
-       if (sock_owned_by_user(sk))
+       if (WARN_ON_ONCE(!sock_allow_reclassification(sk)))
                return;
 
        switch (sk->sk_family) {
@@ -617,7 +616,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
        svsk->sk_sk->sk_stamp = skb->tstamp;
        set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); /* there may be more data... */
 
-       len  = skb->len - sizeof(struct udphdr);
+       len  = skb->len;
        rqstp->rq_arg.len = len;
 
        rqstp->rq_prot = IPPROTO_UDP;
@@ -641,8 +640,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
                skb_free_datagram_locked(svsk->sk_sk, skb);
        } else {
                /* we can use it in-place */
-               rqstp->rq_arg.head[0].iov_base = skb->data +
-                       sizeof(struct udphdr);
+               rqstp->rq_arg.head[0].iov_base = skb->data;
                rqstp->rq_arg.head[0].iov_len = len;
                if (skb_checksum_complete(skb))
                        goto out_free;
index 65e7595..d0756ac 100644 (file)
@@ -995,15 +995,14 @@ static void xs_udp_data_read_skb(struct rpc_xprt *xprt,
        u32 _xid;
        __be32 *xp;
 
-       repsize = skb->len - sizeof(struct udphdr);
+       repsize = skb->len;
        if (repsize < 4) {
                dprintk("RPC:       impossible RPC reply size %d!\n", repsize);
                return;
        }
 
        /* Copy the XID from the skb... */
-       xp = skb_header_pointer(skb, sizeof(struct udphdr),
-                               sizeof(_xid), &_xid);
+       xp = skb_header_pointer(skb, 0, sizeof(_xid), &_xid);
        if (xp == NULL)
                return;
 
@@ -1881,8 +1880,7 @@ static inline void xs_reclassify_socket6(struct socket *sock)
 
 static inline void xs_reclassify_socket(int family, struct socket *sock)
 {
-       WARN_ON_ONCE(sock_owned_by_user(sock->sk));
-       if (sock_owned_by_user(sock->sk))
+       if (WARN_ON_ONCE(!sock_allow_reclassification(sock->sk)))
                return;
 
        switch (family) {
index e318205..f686e41 100644 (file)
@@ -42,8 +42,6 @@
 #include <net/genetlink.h>
 
 #define MAX_MEDIA      3
-#define MAX_NODES      4096
-#define WSIZE          32
 
 /* Identifiers associated with TIPC message header media address info
  * - address info field is 32 bytes long
 #define TIPC_MEDIA_TYPE_IB     2
 #define TIPC_MEDIA_TYPE_UDP    3
 
-/**
- * struct tipc_node_map - set of node identifiers
- * @count: # of nodes in set
- * @map: bitmap of node identifiers that are in the set
- */
-struct tipc_node_map {
-       u32 count;
-       u32 map[MAX_NODES / WSIZE];
-};
-
 /**
  * struct tipc_media_addr - destination address used by TIPC bearers
  * @value: address info (format defined by media)
@@ -142,7 +130,6 @@ struct tipc_media {
  * @identity: array index of this bearer within TIPC bearer array
  * @link_req: ptr to (optional) structure making periodic link setup requests
  * @net_plane: network plane ('A' through 'H') currently associated with bearer
- * @nodes: indicates which nodes in cluster can be reached through bearer
  *
  * Note: media-specific code is responsible for initialization of the fields
  * indicated below when a bearer is enabled; TIPC's generic bearer code takes
@@ -163,8 +150,6 @@ struct tipc_bearer {
        u32 identity;
        struct tipc_link_req *link_req;
        char net_plane;
-       int node_cnt;
-       struct tipc_node_map nodes;
 };
 
 struct tipc_bearer_names {
index 59cabc9..a6631fb 100644 (file)
@@ -768,7 +768,7 @@ static bool cfg80211_ir_permissive_chan(struct wiphy *wiphy,
                if (chan == other_chan)
                        return true;
 
-               if (chan->band != IEEE80211_BAND_5GHZ)
+               if (chan->band != NL80211_BAND_5GHZ)
                        continue;
 
                r1 = cfg80211_get_unii(chan->center_freq);
index 5327e4b..7f7b940 100644 (file)
@@ -557,7 +557,7 @@ int wiphy_register(struct wiphy *wiphy)
 {
        struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
        int res;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        bool have_band = false;
        int i;
@@ -647,7 +647,7 @@ int wiphy_register(struct wiphy *wiphy)
                return res;
 
        /* sanity check supported bands/channels */
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                sband = wiphy->bands[band];
                if (!sband)
                        continue;
@@ -659,7 +659,7 @@ int wiphy_register(struct wiphy *wiphy)
                 * on 60GHz band, there are no legacy rates, so
                 * n_bitrates is 0
                 */
-               if (WARN_ON(band != IEEE80211_BAND_60GHZ &&
+               if (WARN_ON(band != NL80211_BAND_60GHZ &&
                            !sband->n_bitrates))
                        return -EINVAL;
 
@@ -669,7 +669,7 @@ int wiphy_register(struct wiphy *wiphy)
                 * global structure for that.
                 */
                if (cfg80211_disable_40mhz_24ghz &&
-                   band == IEEE80211_BAND_2GHZ &&
+                   band == NL80211_BAND_2GHZ &&
                    sband->ht_cap.ht_supported) {
                        sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
                        sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40;
index 4541577..5d45391 100644 (file)
@@ -69,7 +69,7 @@ static ssize_t ht40allow_map_read(struct file *file,
        struct wiphy *wiphy = file->private_data;
        char *buf;
        unsigned int offset = 0, buf_size = PAGE_SIZE, i, r;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
 
        buf = kzalloc(buf_size, GFP_KERNEL);
@@ -78,7 +78,7 @@ static ssize_t ht40allow_map_read(struct file *file,
 
        rtnl_lock();
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                sband = wiphy->bands[band];
                if (!sband)
                        continue;
index 4c55fab..4a4dda5 100644 (file)
@@ -104,7 +104,7 @@ static int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
                struct ieee80211_supported_band *sband =
                        rdev->wiphy.bands[params->chandef.chan->band];
                int j;
-               u32 flag = params->chandef.chan->band == IEEE80211_BAND_5GHZ ?
+               u32 flag = params->chandef.chan->band == NL80211_BAND_5GHZ ?
                        IEEE80211_RATE_MANDATORY_A :
                        IEEE80211_RATE_MANDATORY_B;
 
@@ -236,7 +236,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
                            struct wireless_dev *wdev)
 {
        struct cfg80211_cached_keys *ck = NULL;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int i, err;
 
        ASSERT_WDEV_LOCK(wdev);
@@ -248,7 +248,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
        if (!wdev->wext.ibss.chandef.chan) {
                struct ieee80211_channel *new_chan = NULL;
 
-               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               for (band = 0; band < NUM_NL80211_BANDS; band++) {
                        struct ieee80211_supported_band *sband;
                        struct ieee80211_channel *chan;
 
index 092300b..fa2066b 100644 (file)
@@ -128,9 +128,9 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
 
        if (!setup->chandef.chan) {
                /* if we don't have that either, use the first usable channel */
-               enum ieee80211_band band;
+               enum nl80211_band band;
 
-               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               for (band = 0; band < NUM_NL80211_BANDS; band++) {
                        struct ieee80211_supported_band *sband;
                        struct ieee80211_channel *chan;
                        int i;
index ff32825..c284d88 100644 (file)
@@ -726,7 +726,7 @@ void cfg80211_dfs_channels_update_work(struct work_struct *work)
        wiphy = &rdev->wiphy;
 
        rtnl_lock();
-       for (bandid = 0; bandid < IEEE80211_NUM_BANDS; bandid++) {
+       for (bandid = 0; bandid < NUM_NL80211_BANDS; bandid++) {
                sband = wiphy->bands[bandid];
                if (!sband)
                        continue;
index 4f45a29..13ef553 100644 (file)
@@ -1277,7 +1277,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
        struct nlattr *nl_bands, *nl_band;
        struct nlattr *nl_freqs, *nl_freq;
        struct nlattr *nl_cmds;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_channel *chan;
        int i;
        const struct ieee80211_txrx_stypes *mgmt_stypes =
@@ -1410,7 +1410,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                        goto nla_put_failure;
 
                for (band = state->band_start;
-                    band < IEEE80211_NUM_BANDS; band++) {
+                    band < NUM_NL80211_BANDS; band++) {
                        struct ieee80211_supported_band *sband;
 
                        sband = rdev->wiphy.bands[band];
@@ -1472,7 +1472,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                }
                nla_nest_end(msg, nl_bands);
 
-               if (band < IEEE80211_NUM_BANDS)
+               if (band < NUM_NL80211_BANDS)
                        state->band_start = band + 1;
                else
                        state->band_start = 0;
@@ -3493,7 +3493,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
        }
 
        params.pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]);
-       if (params.pbss && !rdev->wiphy.bands[IEEE80211_BAND_60GHZ])
+       if (params.pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ])
                return -EOPNOTSUPP;
 
        wdev_lock(wdev);
@@ -5821,9 +5821,9 @@ static int validate_scan_freqs(struct nlattr *freqs)
        return n_channels;
 }
 
-static bool is_band_valid(struct wiphy *wiphy, enum ieee80211_band b)
+static bool is_band_valid(struct wiphy *wiphy, enum nl80211_band b)
 {
-       return b < IEEE80211_NUM_BANDS && wiphy->bands[b];
+       return b < NUM_NL80211_BANDS && wiphy->bands[b];
 }
 
 static int parse_bss_select(struct nlattr *nla, struct wiphy *wiphy,
@@ -6018,10 +6018,10 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
                        i++;
                }
        } else {
-               enum ieee80211_band band;
+               enum nl80211_band band;
 
                /* all channels */
-               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               for (band = 0; band < NUM_NL80211_BANDS; band++) {
                        int j;
                        if (!wiphy->bands[band])
                                continue;
@@ -6066,7 +6066,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
                       request->ie_len);
        }
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++)
+       for (i = 0; i < NUM_NL80211_BANDS; i++)
                if (wiphy->bands[i])
                        request->rates[i] =
                                (1 << wiphy->bands[i]->n_bitrates) - 1;
@@ -6075,9 +6075,9 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
                nla_for_each_nested(attr,
                                    info->attrs[NL80211_ATTR_SCAN_SUPP_RATES],
                                    tmp) {
-                       enum ieee80211_band band = nla_type(attr);
+                       enum nl80211_band band = nla_type(attr);
 
-                       if (band < 0 || band >= IEEE80211_NUM_BANDS) {
+                       if (band < 0 || band >= NUM_NL80211_BANDS) {
                                err = -EINVAL;
                                goto out_free;
                        }
@@ -6265,7 +6265,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev,
        struct cfg80211_sched_scan_request *request;
        struct nlattr *attr;
        int err, tmp, n_ssids = 0, n_match_sets = 0, n_channels, i, n_plans = 0;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        size_t ie_len;
        struct nlattr *tb[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1];
        s32 default_match_rssi = NL80211_SCAN_RSSI_THOLD_OFF;
@@ -6430,7 +6430,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev,
                }
        } else {
                /* all channels */
-               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               for (band = 0; band < NUM_NL80211_BANDS; band++) {
                        int j;
                        if (!wiphy->bands[band])
                                continue;
@@ -7538,14 +7538,14 @@ static int nl80211_disassociate(struct sk_buff *skb, struct genl_info *info)
 
 static bool
 nl80211_parse_mcast_rate(struct cfg80211_registered_device *rdev,
-                        int mcast_rate[IEEE80211_NUM_BANDS],
+                        int mcast_rate[NUM_NL80211_BANDS],
                         int rateval)
 {
        struct wiphy *wiphy = &rdev->wiphy;
        bool found = false;
        int band, i;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                struct ieee80211_supported_band *sband;
 
                sband = wiphy->bands[band];
@@ -7725,7 +7725,7 @@ static int nl80211_set_mcast_rate(struct sk_buff *skb, struct genl_info *info)
 {
        struct cfg80211_registered_device *rdev = info->user_ptr[0];
        struct net_device *dev = info->user_ptr[1];
-       int mcast_rate[IEEE80211_NUM_BANDS];
+       int mcast_rate[NUM_NL80211_BANDS];
        u32 nla_rate;
        int err;
 
@@ -8130,7 +8130,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
        }
 
        connect.pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]);
-       if (connect.pbss && !rdev->wiphy.bands[IEEE80211_BAND_60GHZ]) {
+       if (connect.pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) {
                kzfree(connkeys);
                return -EOPNOTSUPP;
        }
@@ -8550,7 +8550,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
 
        memset(&mask, 0, sizeof(mask));
        /* Default to all rates enabled */
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+       for (i = 0; i < NUM_NL80211_BANDS; i++) {
                sband = rdev->wiphy.bands[i];
 
                if (!sband)
@@ -8574,14 +8574,14 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
 
        /*
         * The nested attribute uses enum nl80211_band as the index. This maps
-        * directly to the enum ieee80211_band values used in cfg80211.
+        * directly to the enum nl80211_band values used in cfg80211.
         */
        BUILD_BUG_ON(NL80211_MAX_SUPP_HT_RATES > IEEE80211_HT_MCS_MASK_LEN * 8);
        nla_for_each_nested(tx_rates, info->attrs[NL80211_ATTR_TX_RATES], rem) {
-               enum ieee80211_band band = nla_type(tx_rates);
+               enum nl80211_band band = nla_type(tx_rates);
                int err;
 
-               if (band < 0 || band >= IEEE80211_NUM_BANDS)
+               if (band < 0 || band >= NUM_NL80211_BANDS)
                        return -EINVAL;
                sband = rdev->wiphy.bands[band];
                if (sband == NULL)
@@ -10746,7 +10746,7 @@ static int nl80211_tdls_channel_switch(struct sk_buff *skb,
         * section 10.22.6.2.1. Disallow 5/10Mhz channels as well for now, the
         * specification is not defined for them.
         */
-       if (chandef.chan->band == IEEE80211_BAND_2GHZ &&
+       if (chandef.chan->band == NL80211_BAND_2GHZ &&
            chandef.width != NL80211_CHAN_WIDTH_20_NOHT &&
            chandef.width != NL80211_CHAN_WIDTH_20)
                return -EINVAL;
index 8ae0c04..85ff30b 100644 (file)
@@ -1048,7 +1048,7 @@ rdev_start_radar_detection(struct cfg80211_registered_device *rdev,
 static inline int
 rdev_set_mcast_rate(struct cfg80211_registered_device *rdev,
                    struct net_device *dev,
-                   int mcast_rate[IEEE80211_NUM_BANDS])
+                   int mcast_rate[NUM_NL80211_BANDS])
 {
        int ret = -ENOTSUPP;
 
index c5fb317..e271dea 100644 (file)
@@ -1546,12 +1546,12 @@ static void reg_process_ht_flags_band(struct wiphy *wiphy,
 
 static void reg_process_ht_flags(struct wiphy *wiphy)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        if (!wiphy)
                return;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++)
+       for (band = 0; band < NUM_NL80211_BANDS; band++)
                reg_process_ht_flags_band(wiphy, wiphy->bands[band]);
 }
 
@@ -1673,7 +1673,7 @@ static void reg_check_channels(void)
 static void wiphy_update_regulatory(struct wiphy *wiphy,
                                    enum nl80211_reg_initiator initiator)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct regulatory_request *lr = get_last_request();
 
        if (ignore_reg_update(wiphy, initiator)) {
@@ -1690,7 +1690,7 @@ static void wiphy_update_regulatory(struct wiphy *wiphy,
 
        lr->dfs_region = get_cfg80211_regdom()->dfs_region;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++)
+       for (band = 0; band < NUM_NL80211_BANDS; band++)
                handle_band(wiphy, initiator, wiphy->bands[band]);
 
        reg_process_beacons(wiphy);
@@ -1786,14 +1786,14 @@ static void handle_band_custom(struct wiphy *wiphy,
 void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
                                   const struct ieee80211_regdomain *regd)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        unsigned int bands_set = 0;
 
        WARN(!(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG),
             "wiphy should have REGULATORY_CUSTOM_REG\n");
        wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                if (!wiphy->bands[band])
                        continue;
                handle_band_custom(wiphy, wiphy->bands[band], regd);
@@ -2228,7 +2228,7 @@ static void reg_process_self_managed_hints(void)
        struct wiphy *wiphy;
        const struct ieee80211_regdomain *tmp;
        const struct ieee80211_regdomain *regd;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct regulatory_request request = {};
 
        list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
@@ -2246,7 +2246,7 @@ static void reg_process_self_managed_hints(void)
                rcu_assign_pointer(wiphy->regd, regd);
                rcu_free_regdom(tmp);
 
-               for (band = 0; band < IEEE80211_NUM_BANDS; band++)
+               for (band = 0; band < NUM_NL80211_BANDS; band++)
                        handle_band_custom(wiphy, wiphy->bands[band], regd);
 
                reg_process_ht_flags(wiphy);
@@ -2404,7 +2404,7 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2)
 }
 EXPORT_SYMBOL(regulatory_hint);
 
-void regulatory_hint_country_ie(struct wiphy *wiphy, enum ieee80211_band band,
+void regulatory_hint_country_ie(struct wiphy *wiphy, enum nl80211_band band,
                                const u8 *country_ie, u8 country_ie_len)
 {
        char alpha2[2];
@@ -2504,11 +2504,11 @@ static void restore_alpha2(char *alpha2, bool reset_user)
 static void restore_custom_reg_settings(struct wiphy *wiphy)
 {
        struct ieee80211_supported_band *sband;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_channel *chan;
        int i;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                sband = wiphy->bands[band];
                if (!sband)
                        continue;
@@ -2623,9 +2623,9 @@ void regulatory_hint_disconnect(void)
 
 static bool freq_is_chan_12_13_14(u16 freq)
 {
-       if (freq == ieee80211_channel_to_frequency(12, IEEE80211_BAND_2GHZ) ||
-           freq == ieee80211_channel_to_frequency(13, IEEE80211_BAND_2GHZ) ||
-           freq == ieee80211_channel_to_frequency(14, IEEE80211_BAND_2GHZ))
+       if (freq == ieee80211_channel_to_frequency(12, NL80211_BAND_2GHZ) ||
+           freq == ieee80211_channel_to_frequency(13, NL80211_BAND_2GHZ) ||
+           freq == ieee80211_channel_to_frequency(14, NL80211_BAND_2GHZ))
                return true;
        return false;
 }
@@ -2650,7 +2650,7 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy,
 
        if (beacon_chan->beacon_found ||
            beacon_chan->flags & IEEE80211_CHAN_RADAR ||
-           (beacon_chan->band == IEEE80211_BAND_2GHZ &&
+           (beacon_chan->band == NL80211_BAND_2GHZ &&
             !freq_is_chan_12_13_14(beacon_chan->center_freq)))
                return 0;
 
index 9f495d7..f6ced31 100644 (file)
@@ -104,7 +104,7 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy,
  * information for a band the BSS is not present in it will be ignored.
  */
 void regulatory_hint_country_ie(struct wiphy *wiphy,
-                        enum ieee80211_band band,
+                        enum nl80211_band band,
                         const u8 *country_ie,
                         u8 country_ie_len);
 
index 50ea8e3..abdf651 100644 (file)
@@ -531,7 +531,7 @@ static int cmp_bss(struct cfg80211_bss *a,
 }
 
 static bool cfg80211_bss_type_match(u16 capability,
-                                   enum ieee80211_band band,
+                                   enum nl80211_band band,
                                    enum ieee80211_bss_type bss_type)
 {
        bool ret = true;
@@ -540,7 +540,7 @@ static bool cfg80211_bss_type_match(u16 capability,
        if (bss_type == IEEE80211_BSS_TYPE_ANY)
                return ret;
 
-       if (band == IEEE80211_BAND_60GHZ) {
+       if (band == NL80211_BAND_60GHZ) {
                mask = WLAN_CAPABILITY_DMG_TYPE_MASK;
                switch (bss_type) {
                case IEEE80211_BSS_TYPE_ESS:
@@ -1006,7 +1006,7 @@ cfg80211_inform_bss_data(struct wiphy *wiphy,
        if (!res)
                return NULL;
 
-       if (channel->band == IEEE80211_BAND_60GHZ) {
+       if (channel->band == NL80211_BAND_60GHZ) {
                bss_type = res->pub.capability & WLAN_CAPABILITY_DMG_TYPE_MASK;
                if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP ||
                    bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS)
@@ -1089,7 +1089,7 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
        if (!res)
                return NULL;
 
-       if (channel->band == IEEE80211_BAND_60GHZ) {
+       if (channel->band == NL80211_BAND_60GHZ) {
                bss_type = res->pub.capability & WLAN_CAPABILITY_DMG_TYPE_MASK;
                if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP ||
                    bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS)
@@ -1185,7 +1185,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
        struct iw_scan_req *wreq = NULL;
        struct cfg80211_scan_request *creq = NULL;
        int i, err, n_channels = 0;
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
        if (!netif_running(dev))
                return -ENETDOWN;
@@ -1229,7 +1229,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
 
        /* translate "Scan on frequencies" request */
        i = 0;
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                int j;
 
                if (!wiphy->bands[band])
@@ -1289,7 +1289,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
                        creq->n_ssids = 0;
        }
 
-       for (i = 0; i < IEEE80211_NUM_BANDS; i++)
+       for (i = 0; i < NUM_NL80211_BANDS; i++)
                if (wiphy->bands[i])
                        creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
 
index 1fba416..e22e5b8 100644 (file)
@@ -81,7 +81,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
                return -ENOMEM;
 
        if (wdev->conn->params.channel) {
-               enum ieee80211_band band = wdev->conn->params.channel->band;
+               enum nl80211_band band = wdev->conn->params.channel->band;
                struct ieee80211_supported_band *sband =
                        wdev->wiphy->bands[band];
 
@@ -93,11 +93,11 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
                request->rates[band] = (1 << sband->n_bitrates) - 1;
        } else {
                int i = 0, j;
-               enum ieee80211_band band;
+               enum nl80211_band band;
                struct ieee80211_supported_band *bands;
                struct ieee80211_channel *channel;
 
-               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               for (band = 0; band < NUM_NL80211_BANDS; band++) {
                        bands = wdev->wiphy->bands[band];
                        if (!bands)
                                continue;
index 8da1fae..3c1091a 100644 (file)
                                conf->dot11MeshHWMPconfirmationInterval;      \
        } while (0)
 
-#define CHAN_ENTRY __field(enum ieee80211_band, band) \
+#define CHAN_ENTRY __field(enum nl80211_band, band) \
                   __field(u16, center_freq)
 #define CHAN_ASSIGN(chan)                                        \
        do {                                                      \
 #define CHAN_PR_FMT "band: %d, freq: %u"
 #define CHAN_PR_ARG __entry->band, __entry->center_freq
 
-#define CHAN_DEF_ENTRY __field(enum ieee80211_band, band)              \
+#define CHAN_DEF_ENTRY __field(enum nl80211_band, band)                \
                       __field(u32, control_freq)                       \
                       __field(u32, width)                              \
                       __field(u32, center_freq1)                       \
@@ -2647,7 +2647,7 @@ TRACE_EVENT(cfg80211_scan_done,
        TP_STRUCT__entry(
                __field(u32, n_channels)
                __dynamic_array(u8, ie, request ? request->ie_len : 0)
-               __array(u32, rates, IEEE80211_NUM_BANDS)
+               __array(u32, rates, NUM_NL80211_BANDS)
                __field(u32, wdev_id)
                MAC_ENTRY(wiphy_mac)
                __field(bool, no_cck)
@@ -2658,7 +2658,7 @@ TRACE_EVENT(cfg80211_scan_done,
                        memcpy(__get_dynamic_array(ie), request->ie,
                               request->ie_len);
                        memcpy(__entry->rates, request->rates,
-                              IEEE80211_NUM_BANDS);
+                              NUM_NL80211_BANDS);
                        __entry->wdev_id = request->wdev ?
                                        request->wdev->identifier : 0;
                        if (request->wiphy)
@@ -2883,25 +2883,25 @@ TRACE_EVENT(rdev_start_radar_detection,
 
 TRACE_EVENT(rdev_set_mcast_rate,
        TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
-                int mcast_rate[IEEE80211_NUM_BANDS]),
+                int mcast_rate[NUM_NL80211_BANDS]),
        TP_ARGS(wiphy, netdev, mcast_rate),
        TP_STRUCT__entry(
                WIPHY_ENTRY
                NETDEV_ENTRY
-               __array(int, mcast_rate, IEEE80211_NUM_BANDS)
+               __array(int, mcast_rate, NUM_NL80211_BANDS)
        ),
        TP_fast_assign(
                WIPHY_ASSIGN;
                NETDEV_ASSIGN;
                memcpy(__entry->mcast_rate, mcast_rate,
-                      sizeof(int) * IEEE80211_NUM_BANDS);
+                      sizeof(int) * NUM_NL80211_BANDS);
        ),
        TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", "
                  "mcast_rates [2.4GHz=0x%x, 5.2GHz=0x%x, 60GHz=0x%x]",
                  WIPHY_PR_ARG, NETDEV_PR_ARG,
-                 __entry->mcast_rate[IEEE80211_BAND_2GHZ],
-                 __entry->mcast_rate[IEEE80211_BAND_5GHZ],
-                 __entry->mcast_rate[IEEE80211_BAND_60GHZ])
+                 __entry->mcast_rate[NL80211_BAND_2GHZ],
+                 __entry->mcast_rate[NL80211_BAND_5GHZ],
+                 __entry->mcast_rate[NL80211_BAND_60GHZ])
 );
 
 TRACE_EVENT(rdev_set_coalesce,
index 9f440a9..f360398 100644 (file)
@@ -47,7 +47,7 @@ u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
        if (WARN_ON(!sband))
                return 1;
 
-       if (sband->band == IEEE80211_BAND_2GHZ) {
+       if (sband->band == NL80211_BAND_2GHZ) {
                if (scan_width == NL80211_BSS_CHAN_WIDTH_5 ||
                    scan_width == NL80211_BSS_CHAN_WIDTH_10)
                        mandatory_flag = IEEE80211_RATE_MANDATORY_G;
@@ -65,26 +65,26 @@ u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
 }
 EXPORT_SYMBOL(ieee80211_mandatory_rates);
 
-int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band)
+int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
 {
        /* see 802.11 17.3.8.3.2 and Annex J
         * there are overlapping channel numbers in 5GHz and 2GHz bands */
        if (chan <= 0)
                return 0; /* not supported */
        switch (band) {
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                if (chan == 14)
                        return 2484;
                else if (chan < 14)
                        return 2407 + chan * 5;
                break;
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                if (chan >= 182 && chan <= 196)
                        return 4000 + chan * 5;
                else
                        return 5000 + chan * 5;
                break;
-       case IEEE80211_BAND_60GHZ:
+       case NL80211_BAND_60GHZ:
                if (chan < 5)
                        return 56160 + chan * 2160;
                break;
@@ -116,11 +116,11 @@ EXPORT_SYMBOL(ieee80211_frequency_to_channel);
 struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
                                                  int freq)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        int i;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                sband = wiphy->bands[band];
 
                if (!sband)
@@ -137,12 +137,12 @@ struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
 EXPORT_SYMBOL(__ieee80211_get_channel);
 
 static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
-                                    enum ieee80211_band band)
+                                    enum nl80211_band band)
 {
        int i, want;
 
        switch (band) {
-       case IEEE80211_BAND_5GHZ:
+       case NL80211_BAND_5GHZ:
                want = 3;
                for (i = 0; i < sband->n_bitrates; i++) {
                        if (sband->bitrates[i].bitrate == 60 ||
@@ -155,7 +155,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
                }
                WARN_ON(want);
                break;
-       case IEEE80211_BAND_2GHZ:
+       case NL80211_BAND_2GHZ:
                want = 7;
                for (i = 0; i < sband->n_bitrates; i++) {
                        if (sband->bitrates[i].bitrate == 10) {
@@ -185,12 +185,12 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
                }
                WARN_ON(want != 0 && want != 3 && want != 6);
                break;
-       case IEEE80211_BAND_60GHZ:
+       case NL80211_BAND_60GHZ:
                /* check for mandatory HT MCS 1..4 */
                WARN_ON(!sband->ht_cap.ht_supported);
                WARN_ON((sband->ht_cap.mcs.rx_mask[0] & 0x1e) != 0x1e);
                break;
-       case IEEE80211_NUM_BANDS:
+       case NUM_NL80211_BANDS:
                WARN_ON(1);
                break;
        }
@@ -198,9 +198,9 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
 
 void ieee80211_set_bitrate_flags(struct wiphy *wiphy)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++)
+       for (band = 0; band < NUM_NL80211_BANDS; band++)
                if (wiphy->bands[band])
                        set_mandatory_flags_band(wiphy->bands[band], band);
 }
@@ -1399,22 +1399,22 @@ size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
 EXPORT_SYMBOL(ieee80211_ie_split_ric);
 
 bool ieee80211_operating_class_to_band(u8 operating_class,
-                                      enum ieee80211_band *band)
+                                      enum nl80211_band *band)
 {
        switch (operating_class) {
        case 112:
        case 115 ... 127:
        case 128 ... 130:
-               *band = IEEE80211_BAND_5GHZ;
+               *band = NL80211_BAND_5GHZ;
                return true;
        case 81:
        case 82:
        case 83:
        case 84:
-               *band = IEEE80211_BAND_2GHZ;
+               *band = NL80211_BAND_2GHZ;
                return true;
        case 180:
-               *band = IEEE80211_BAND_60GHZ;
+               *band = NL80211_BAND_60GHZ;
                return true;
        }
 
@@ -1726,10 +1726,10 @@ int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
 
 unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy)
 {
-       enum ieee80211_band band;
+       enum nl80211_band band;
        unsigned int n_channels = 0;
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++)
+       for (band = 0; band < NUM_NL80211_BANDS; band++)
                if (wiphy->bands[band])
                        n_channels += wiphy->bands[band]->n_channels;
 
index fd68283..4c89f0c 100644 (file)
@@ -32,13 +32,13 @@ int cfg80211_wext_giwname(struct net_device *dev,
        if (!wdev)
                return -EOPNOTSUPP;
 
-       sband = wdev->wiphy->bands[IEEE80211_BAND_5GHZ];
+       sband = wdev->wiphy->bands[NL80211_BAND_5GHZ];
        if (sband) {
                is_a = true;
                is_ht |= sband->ht_cap.ht_supported;
        }
 
-       sband = wdev->wiphy->bands[IEEE80211_BAND_2GHZ];
+       sband = wdev->wiphy->bands[NL80211_BAND_2GHZ];
        if (sband) {
                int i;
                /* Check for mandatory rates */
@@ -143,7 +143,7 @@ int cfg80211_wext_giwrange(struct net_device *dev,
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
        struct iw_range *range = (struct iw_range *) extra;
-       enum ieee80211_band band;
+       enum nl80211_band band;
        int i, c = 0;
 
        if (!wdev)
@@ -215,7 +215,7 @@ int cfg80211_wext_giwrange(struct net_device *dev,
                }
        }
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band ++) {
                struct ieee80211_supported_band *sband;
 
                sband = wdev->wiphy->bands[band];
@@ -265,11 +265,11 @@ int cfg80211_wext_freq(struct iw_freq *freq)
         * -EINVAL for impossible things.
         */
        if (freq->e == 0) {
-               enum ieee80211_band band = IEEE80211_BAND_2GHZ;
+               enum nl80211_band band = NL80211_BAND_2GHZ;
                if (freq->m < 0)
                        return 0;
                if (freq->m > 14)
-                       band = IEEE80211_BAND_5GHZ;
+                       band = NL80211_BAND_5GHZ;
                return ieee80211_channel_to_frequency(freq->m, band);
        } else {
                int i, div = 1000000;
@@ -1245,7 +1245,7 @@ static int cfg80211_wext_siwrate(struct net_device *dev,
                maxrate = rate->value / 100000;
        }
 
-       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+       for (band = 0; band < NUM_NL80211_BANDS; band++) {
                sband = wdev->wiphy->bands[band];
                if (sband == NULL)
                        continue;