Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
authorJohn W. Linville <linville@tuxdriver.com>
Wed, 6 Jun 2012 18:40:06 +0000 (14:40 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 6 Jun 2012 18:40:06 +0000 (14:40 -0400)
Conflicts:
drivers/net/wireless/iwlwifi/iwl-drv.c

65 files changed:
Documentation/feature-removal-schedule.txt
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/ath6kl/core.h
drivers/net/wireless/ath/ath6kl/main.c
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
drivers/net/wireless/ath/ath9k/eeprom_4k.c
drivers/net/wireless/ath/ath9k/eeprom_9287.c
drivers/net/wireless/ath/ath9k/eeprom_def.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
drivers/net/wireless/brcm80211/brcmutil/utils.c
drivers/net/wireless/ipw2x00/ipw2200.c
drivers/net/wireless/iwlwifi/Kconfig
drivers/net/wireless/iwlwifi/Makefile
drivers/net/wireless/iwlwifi/iwl-agn-sta.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-commands.h
drivers/net/wireless/iwlwifi/iwl-config.h
drivers/net/wireless/iwlwifi/iwl-debug.c
drivers/net/wireless/iwlwifi/iwl-debug.h
drivers/net/wireless/iwlwifi/iwl-devtrace.c
drivers/net/wireless/iwlwifi/iwl-drv.c
drivers/net/wireless/iwlwifi/iwl-io.c
drivers/net/wireless/iwlwifi/iwl-mac80211.c
drivers/net/wireless/iwlwifi/iwl-notif-wait.c
drivers/net/wireless/iwlwifi/iwl-op-mode.h
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
drivers/net/wireless/iwlwifi/iwl-trans.h
drivers/net/wireless/rt2x00/rt2800.h
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c
include/linux/nl80211.h
include/net/cfg80211.h
include/net/mac80211.h
net/core/net-sysfs.c
net/mac80211/agg-rx.c
net/mac80211/agg-tx.c
net/mac80211/cfg.c
net/mac80211/chan.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_hwmp.c
net/mac80211/mesh_pathtbl.c
net/mac80211/mesh_plink.c
net/mac80211/mesh_sync.c
net/mac80211/mlme.c
net/mac80211/rx.c
net/mac80211/sta_info.c
net/mac80211/status.c
net/mac80211/tkip.c
net/mac80211/tx.c
net/wireless/Kconfig
net/wireless/chan.c
net/wireless/core.h
net/wireless/mesh.c
net/wireless/nl80211.c
net/wireless/wext-compat.c

index 56000b33340bbe33f0b141934c756470d32ecbbd..dec901554ef7d58d8ad9de35431017e51b22a2fa 100644 (file)
@@ -249,15 +249,6 @@ Who:       Ravikiran Thirumalai <kiran@scalex86.org>
 
 ---------------------------
 
-What:  Code that is now under CONFIG_WIRELESS_EXT_SYSFS
-       (in net/core/net-sysfs.c)
-When:  3.5
-Why:   Over 1K .text/.data size reduction, data is available in other
-       ways (ioctls)
-Who:   Johannes Berg <johannes@sipsolutions.net>
-
----------------------------
-
 What:  sysfs ui for changing p4-clockmod parameters
 When:  September 2009
 Why:   See commits 129f8ae9b1b5be94517da76009ea956e89104ce8 and
@@ -449,6 +440,19 @@ Who:       Hans Verkuil <hans.verkuil@cisco.com>
 
 ----------------------------
 
+What:  CONFIG_CFG80211_WEXT
+When:  as soon as distributions ship new wireless tools, ie. wpa_supplicant 1.0
+       and NetworkManager/connman/etc. that are able to use nl80211
+Why:   Wireless extensions are deprecated, and userland tools are moving to
+       using nl80211. New drivers are no longer using wireless extensions,
+       and while there might still be old drivers, both new drivers and new
+       userland no longer needs them and they can't be used for an feature
+       developed in the past couple of years. As such, compatibility with
+       wireless extensions in new drivers will be removed.
+Who:   Johannes Berg <johannes@sipsolutions.net>
+
+----------------------------
+
 What:  g_file_storage driver
 When:  3.8
 Why:   This driver has been superseded by g_mass_storage.
index b869a358ce4366276735f375b1d61366ac8631dc..f27e9732951d1f48819c3e88510e0f01b782770c 100644 (file)
@@ -2585,35 +2585,6 @@ static int ath6kl_set_ies(struct ath6kl_vif *vif,
        return 0;
 }
 
-static int ath6kl_set_channel(struct wiphy *wiphy, struct net_device *dev,
-                             struct ieee80211_channel *chan,
-                             enum nl80211_channel_type channel_type)
-{
-       struct ath6kl_vif *vif;
-
-       /*
-        * 'dev' could be NULL if a channel change is required for the hardware
-        * device itself, instead of a particular VIF.
-        *
-        * FIXME: To be handled properly when monitor mode is supported.
-        */
-       if (!dev)
-               return -EBUSY;
-
-       vif = netdev_priv(dev);
-
-       if (!ath6kl_cfg80211_ready(vif))
-               return -EIO;
-
-       ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: center_freq=%u hw_value=%u\n",
-                  __func__, chan->center_freq, chan->hw_value);
-       vif->next_chan = chan->center_freq;
-       vif->next_ch_type = channel_type;
-       vif->next_ch_band = chan->band;
-
-       return 0;
-}
-
 static int ath6kl_get_rsn_capab(struct cfg80211_beacon_data *beacon,
                                u8 *rsn_capab)
 {
@@ -2791,7 +2762,7 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
        p.ssid_len = vif->ssid_len;
        memcpy(p.ssid, vif->ssid, vif->ssid_len);
        p.dot11_auth_mode = vif->dot11_auth_mode;
-       p.ch = cpu_to_le16(vif->next_chan);
+       p.ch = cpu_to_le16(info->channel->center_freq);
 
        /* Enable uAPSD support by default */
        res = ath6kl_wmi_ap_set_apsd(ar->wmi, vif->fw_vif_idx, true);
@@ -2815,8 +2786,8 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
                        return res;
        }
 
-       if (ath6kl_set_htcap(vif, vif->next_ch_band,
-                            vif->next_ch_type != NL80211_CHAN_NO_HT))
+       if (ath6kl_set_htcap(vif, info->channel->band,
+                            info->channel_type != NL80211_CHAN_NO_HT))
                return -EIO;
 
        /*
@@ -3271,7 +3242,6 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
        .suspend = __ath6kl_cfg80211_suspend,
        .resume = __ath6kl_cfg80211_resume,
 #endif
-       .set_channel = ath6kl_set_channel,
        .start_ap = ath6kl_start_ap,
        .change_beacon = ath6kl_change_beacon,
        .stop_ap = ath6kl_stop_ap,
index 4d9c6f1426987aab4b9cb419dbb101438dee9027..8443b2a4133e007bb039ca103dc6c7baafe2867c 100644 (file)
@@ -553,9 +553,6 @@ struct ath6kl_vif {
        u32 last_cancel_roc_id;
        u32 send_action_id;
        bool probe_req_report;
-       u16 next_chan;
-       enum nl80211_channel_type next_ch_type;
-       enum ieee80211_band next_ch_band;
        u16 assoc_bss_beacon_int;
        u16 listen_intvl_t;
        u16 bmiss_time_t;
index e5524470529c9d8a77034855fec8d3e3fa9d6a86..b836f27951145f5d562247bdcef4af1159b5e112 100644 (file)
@@ -598,7 +598,6 @@ static int ath6kl_commit_ch_switch(struct ath6kl_vif *vif, u16 channel)
 
        struct ath6kl *ar = vif->ar;
 
-       vif->next_chan = channel;
        vif->profile.ch = cpu_to_le16(channel);
 
        switch (vif->nw_type) {
index dfb0441f406c24e59c10fac636007d7337cd4b65..f794828c08e2376607eda282965ff003a45d1022 100644 (file)
@@ -3412,11 +3412,11 @@ static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
        if (!dump_base_hdr) {
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "2GHz modal Header");
-               len += ar9003_dump_modal_eeprom(buf, len, size,
+               len = ar9003_dump_modal_eeprom(buf, len, size,
                                                &eep->modalHeader2G);
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "5GHz modal Header");
-               len += ar9003_dump_modal_eeprom(buf, len, size,
+               len = ar9003_dump_modal_eeprom(buf, len, size,
                                                &eep->modalHeader5G);
                goto out;
        }
index 4322ac80c203c1dfc6762f7f8547c73fbf3af7b3..a850f44fa76714e0f506907ac897c48777ab9069 100644 (file)
@@ -135,7 +135,7 @@ static u32 ath9k_hw_4k_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
        if (!dump_base_hdr) {
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "2GHz modal Header");
-               len += ath9k_dump_4k_modal_eeprom(buf, len, size,
+               len = ath9k_dump_4k_modal_eeprom(buf, len, size,
                                                  &eep->modalHeader);
                goto out;
        }
index aa614767adffc8b342a4b37cb5265cbb15c3fad3..cd742fb944c274528ee5cfce31625ba329f42b55 100644 (file)
@@ -132,7 +132,7 @@ static u32 ath9k_hw_ar9287_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
        if (!dump_base_hdr) {
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "2GHz modal Header");
-               len += ar9287_dump_modal_eeprom(buf, len, size,
+               len = ar9287_dump_modal_eeprom(buf, len, size,
                                                &eep->modalHeader);
                goto out;
        }
index b5fba8b18b8b851fbe985820c9d8021729171290..56290f3185208e0e6863f3ee70bb622dd5e04e0b 100644 (file)
@@ -211,11 +211,11 @@ static u32 ath9k_hw_def_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
        if (!dump_base_hdr) {
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "2GHz modal Header");
-               len += ath9k_def_dump_modal_eeprom(buf, len, size,
+               len = ath9k_def_dump_modal_eeprom(buf, len, size,
                                                   &eep->modalHeader[0]);
                len += snprintf(buf + len, size - len,
                                "%20s :\n", "5GHz modal Header");
-               len += ath9k_def_dump_modal_eeprom(buf, len, size,
+               len = ath9k_def_dump_modal_eeprom(buf, len, size,
                                                   &eep->modalHeader[1]);
                goto out;
        }
index 4de4473776acd808f52eeed3994af2858897796d..cfbcc047c61ed0de26d253ee551d78c749fe7bea 100644 (file)
@@ -2389,6 +2389,134 @@ static int ath9k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
        return 0;
 }
 
+#ifdef CONFIG_ATH9K_DEBUGFS
+
+/* Ethtool support for get-stats */
+
+#define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
+static const char ath9k_gstrings_stats[][ETH_GSTRING_LEN] = {
+       "tx_pkts_nic",
+       "tx_bytes_nic",
+       "rx_pkts_nic",
+       "rx_bytes_nic",
+       AMKSTR(d_tx_pkts),
+       AMKSTR(d_tx_bytes),
+       AMKSTR(d_tx_mpdus_queued),
+       AMKSTR(d_tx_mpdus_completed),
+       AMKSTR(d_tx_mpdu_xretries),
+       AMKSTR(d_tx_aggregates),
+       AMKSTR(d_tx_ampdus_queued_hw),
+       AMKSTR(d_tx_ampdus_queued_sw),
+       AMKSTR(d_tx_ampdus_completed),
+       AMKSTR(d_tx_ampdu_retries),
+       AMKSTR(d_tx_ampdu_xretries),
+       AMKSTR(d_tx_fifo_underrun),
+       AMKSTR(d_tx_op_exceeded),
+       AMKSTR(d_tx_timer_expiry),
+       AMKSTR(d_tx_desc_cfg_err),
+       AMKSTR(d_tx_data_underrun),
+       AMKSTR(d_tx_delim_underrun),
+
+       "d_rx_decrypt_crc_err",
+       "d_rx_phy_err",
+       "d_rx_mic_err",
+       "d_rx_pre_delim_crc_err",
+       "d_rx_post_delim_crc_err",
+       "d_rx_decrypt_busy_err",
+
+       "d_rx_phyerr_radar",
+       "d_rx_phyerr_ofdm_timing",
+       "d_rx_phyerr_cck_timing",
+
+};
+#define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats)
+
+static void ath9k_get_et_strings(struct ieee80211_hw *hw,
+                                struct ieee80211_vif *vif,
+                                u32 sset, u8 *data)
+{
+       if (sset == ETH_SS_STATS)
+               memcpy(data, *ath9k_gstrings_stats,
+                      sizeof(ath9k_gstrings_stats));
+}
+
+static int ath9k_get_et_sset_count(struct ieee80211_hw *hw,
+                                  struct ieee80211_vif *vif, int sset)
+{
+       if (sset == ETH_SS_STATS)
+               return ATH9K_SSTATS_LEN;
+       return 0;
+}
+
+#define PR_QNUM(_n) (sc->tx.txq_map[_n]->axq_qnum)
+#define AWDATA(elem)                                                   \
+       do {                                                            \
+               data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].elem; \
+               data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].elem; \
+               data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].elem; \
+               data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].elem; \
+       } while (0)
+
+#define AWDATA_RX(elem)                                                \
+       do {                                                    \
+               data[i++] = sc->debug.stats.rxstats.elem;       \
+       } while (0)
+
+static void ath9k_get_et_stats(struct ieee80211_hw *hw,
+                              struct ieee80211_vif *vif,
+                              struct ethtool_stats *stats, u64 *data)
+{
+       struct ath_softc *sc = hw->priv;
+       int i = 0;
+
+       data[i++] = (sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].tx_pkts_all +
+                    sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].tx_pkts_all +
+                    sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].tx_pkts_all +
+                    sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].tx_pkts_all);
+       data[i++] = (sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].tx_bytes_all +
+                    sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].tx_bytes_all +
+                    sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].tx_bytes_all +
+                    sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].tx_bytes_all);
+       AWDATA_RX(rx_pkts_all);
+       AWDATA_RX(rx_bytes_all);
+
+       AWDATA(tx_pkts_all);
+       AWDATA(tx_bytes_all);
+       AWDATA(queued);
+       AWDATA(completed);
+       AWDATA(xretries);
+       AWDATA(a_aggr);
+       AWDATA(a_queued_hw);
+       AWDATA(a_queued_sw);
+       AWDATA(a_completed);
+       AWDATA(a_retries);
+       AWDATA(a_xretries);
+       AWDATA(fifo_underrun);
+       AWDATA(xtxop);
+       AWDATA(timer_exp);
+       AWDATA(desc_cfg_err);
+       AWDATA(data_underrun);
+       AWDATA(delim_underrun);
+
+       AWDATA_RX(decrypt_crc_err);
+       AWDATA_RX(phy_err);
+       AWDATA_RX(mic_err);
+       AWDATA_RX(pre_delim_crc_err);
+       AWDATA_RX(post_delim_crc_err);
+       AWDATA_RX(decrypt_busy_err);
+
+       AWDATA_RX(phy_err_stats[ATH9K_PHYERR_RADAR]);
+       AWDATA_RX(phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]);
+       AWDATA_RX(phy_err_stats[ATH9K_PHYERR_CCK_TIMING]);
+
+       WARN_ON(i != ATH9K_SSTATS_LEN);
+}
+
+/* End of ethtool get-stats functions */
+
+#endif
+
+
 struct ieee80211_ops ath9k_ops = {
        .tx                 = ath9k_tx,
        .start              = ath9k_start,
@@ -2417,4 +2545,10 @@ struct ieee80211_ops ath9k_ops = {
        .get_stats          = ath9k_get_stats,
        .set_antenna        = ath9k_set_antenna,
        .get_antenna        = ath9k_get_antenna,
+
+#ifdef CONFIG_ATH9K_DEBUGFS
+       .get_et_sset_count  = ath9k_get_et_sset_count,
+       .get_et_stats  = ath9k_get_et_stats,
+       .get_et_strings  = ath9k_get_et_strings,
+#endif
 };
index 13b261517cce53d130235b43ce62bbfbe01e00ee..3667181464184bc3293f9241f8ccc10d3d9323ab 100644 (file)
@@ -14358,7 +14358,7 @@ void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs)
 
        wlc_phy_write_txmacreg_nphy(pi, holdoff, delay);
 
-       if (pi && pi->sh && (pi->sh->_rifs_phy != rifs))
+       if (pi->sh && (pi->sh->_rifs_phy != rifs))
                pi->sh->_rifs_phy = rifs;
 }
 
index b45ab34cdfdc0693676fae614359b2bafaa5c526..3e6405e06ac028687e1d12627874491e969d6e94 100644 (file)
@@ -43,6 +43,8 @@ EXPORT_SYMBOL(brcmu_pkt_buf_get_skb);
 /* Free the driver packet. Free the tag if present */
 void brcmu_pkt_buf_free_skb(struct sk_buff *skb)
 {
+       if (!skb)
+               return;
        WARN_ON(skb->next);
        if (skb->destructor)
                /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if
index 0036737fe8e3fb54be0b780ba66508d7fc869d57..254b8922327690127013f848b487fb372fa21c93 100644 (file)
@@ -2701,6 +2701,20 @@ static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac)
        memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6);
 }
 
+static void ipw_read_eeprom(struct ipw_priv *priv)
+{
+       int i;
+       __le16 *eeprom = (__le16 *) priv->eeprom;
+
+       IPW_DEBUG_TRACE(">>\n");
+
+       /* read entire contents of eeprom into private buffer */
+       for (i = 0; i < 128; i++)
+               eeprom[i] = cpu_to_le16(eeprom_read_u16(priv, (u8) i));
+
+       IPW_DEBUG_TRACE("<<\n");
+}
+
 /*
  * Either the device driver (i.e. the host) or the firmware can
  * load eeprom data into the designated region in SRAM.  If neither
@@ -2712,14 +2726,9 @@ static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac)
 static void ipw_eeprom_init_sram(struct ipw_priv *priv)
 {
        int i;
-       __le16 *eeprom = (__le16 *) priv->eeprom;
 
        IPW_DEBUG_TRACE(">>\n");
 
-       /* read entire contents of eeprom into private buffer */
-       for (i = 0; i < 128; i++)
-               eeprom[i] = cpu_to_le16(eeprom_read_u16(priv, (u8) i));
-
        /*
           If the data looks correct, then copy it to our private
           copy.  Otherwise let the firmware know to perform the operation
@@ -3643,8 +3652,10 @@ static int ipw_load(struct ipw_priv *priv)
        /* ack fw init done interrupt */
        ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE);
 
-       /* read eeprom data and initialize the eeprom region of sram */
+       /* read eeprom data */
        priv->eeprom_delay = 1;
+       ipw_read_eeprom(priv);
+       /* initialize the eeprom region of sram */
        ipw_eeprom_init_sram(priv);
 
        /* enable interrupts */
index 2463c06264387230759f14801239610a4fe4eb58..727fbb5db9da0b41b10b6132267d4b91f533f852 100644 (file)
@@ -6,6 +6,7 @@ config IWLWIFI
        select LEDS_CLASS
        select LEDS_TRIGGERS
        select MAC80211_LEDS
+       select IWLDVM
        ---help---
          Select to build the driver supporting the:
 
@@ -41,6 +42,10 @@ config IWLWIFI
          say M here and read <file:Documentation/kbuild/modules.txt>.  The
          module will be called iwlwifi.
 
+config IWLDVM
+       tristate "Intel Wireless WiFi"
+       depends on IWLWIFI
+
 menu "Debugging Options"
        depends on IWLWIFI
 
index d615eacbf050be320d803c74fec0ace223abae73..931002738c9f79876e83e6aee17bafb7adce34ae 100644 (file)
@@ -1,27 +1,31 @@
+# DVM
+obj-$(CONFIG_IWLDVM)   += iwldvm.o
+iwldvm-objs            := iwl-agn.o iwl-agn-rs.o iwl-mac80211.o
+iwldvm-objs            += iwl-ucode.o iwl-agn-tx.o
+iwldvm-objs            += iwl-agn-lib.o iwl-agn-calib.o
+iwldvm-objs            += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-rx.o
+iwldvm-objs            += iwl-eeprom.o iwl-power.o
+iwldvm-objs            += iwl-scan.o iwl-led.o
+iwldvm-objs            += iwl-agn-rxon.o iwl-agn-devices.o
+
+iwldvm-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
+iwldvm-$(CONFIG_IWLWIFI_DEVICE_TESTMODE) += iwl-testmode.o
+
+CFLAGS_iwl-devtrace.o := -I$(src)
+
 # WIFI
 obj-$(CONFIG_IWLWIFI)  += iwlwifi.o
-iwlwifi-objs           := iwl-agn.o iwl-agn-rs.o iwl-mac80211.o
-iwlwifi-objs           += iwl-ucode.o iwl-agn-tx.o iwl-debug.o
-iwlwifi-objs           += iwl-agn-lib.o iwl-agn-calib.o iwl-io.o
-iwlwifi-objs           += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-rx.o
-
-iwlwifi-objs           += iwl-eeprom.o iwl-power.o
-iwlwifi-objs           += iwl-scan.o iwl-led.o
-iwlwifi-objs           += iwl-agn-rxon.o iwl-agn-devices.o
 iwlwifi-objs           += iwl-5000.o
 iwlwifi-objs           += iwl-6000.o
 iwlwifi-objs           += iwl-1000.o
 iwlwifi-objs           += iwl-2000.o
+iwlwifi-objs           += iwl-io.o
 iwlwifi-objs           += iwl-pci.o
 iwlwifi-objs           += iwl-drv.o
+iwlwifi-objs           += iwl-debug.o
 iwlwifi-objs           += iwl-notif-wait.o
 iwlwifi-objs           += iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o
 
-
-iwlwifi-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
 iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o
-iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TESTMODE) += iwl-testmode.o
-
-CFLAGS_iwl-devtrace.o := -I$(src)
 
 ccflags-y += -D__CHECK_ENDIAN__
index aea07aab3c9e82c44f6b417d20794f4523e6ae70..36055ed1c0695c0a0438162cab0f8e6e0d8c2303 100644 (file)
@@ -236,6 +236,7 @@ static void iwl_sta_calc_ht_flags(struct iwl_priv *priv,
        mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2;
 
        IWL_DEBUG_INFO(priv, "STA %pM SM PS mode: %s\n",
+                       sta->addr,
                        (mimo_ps_mode == WLAN_HT_CAP_SM_PS_STATIC) ?
                        "static" :
                        (mimo_ps_mode == WLAN_HT_CAP_SM_PS_DYNAMIC) ?
index ec36e2b020b6e9227935ca85fff855c58f5fd894..5149e6f7294555a6d6761a3a094f04a42c092a55 100644 (file)
@@ -78,7 +78,6 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION);
 MODULE_VERSION(DRV_VERSION);
 MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("iwlagn");
 
 void iwl_update_chain_flags(struct iwl_priv *priv)
 {
@@ -2344,24 +2343,25 @@ static int __init iwl_init(void)
                goto error_rc_register;
        }
 
-       ret = iwl_pci_register_driver();
-       if (ret)
-               goto error_pci_register;
+       ret = iwl_opmode_register("iwldvm", &iwl_dvm_ops);
+       if (ret) {
+               pr_err("Unable to register op_mode: %d\n", ret);
+               goto error_opmode_register;
+       }
        return ret;
 
-error_pci_register:
+error_opmode_register:
        iwlagn_rate_control_unregister();
 error_rc_register:
        kmem_cache_destroy(iwl_tx_cmd_pool);
        return ret;
 }
+module_init(iwl_init);
 
 static void __exit iwl_exit(void)
 {
-       iwl_pci_unregister_driver();
+       iwl_opmode_deregister("iwldvm");
        iwlagn_rate_control_unregister();
        kmem_cache_destroy(iwl_tx_cmd_pool);
 }
-
 module_exit(iwl_exit);
-module_init(iwl_init);
index 9af6a239b3843d0081dcc0fd7498d66258dbce5f..b9f7361d2426c32fb70b1335d53cc2c4d029a4ad 100644 (file)
@@ -197,9 +197,6 @@ enum {
  *
  *****************************************************************************/
 
-/* iwl_cmd_header flags value */
-#define IWL_CMD_FAILED_MSK 0x40
-
 /**
  * iwlagn rate_n_flags bit fields
  *
index 67b28aa7f9bef79470efa15fc01c3f968ca33edb..a52818bbfe98c1c911ef2498f7a93d8f5a87b4e1 100644 (file)
@@ -143,7 +143,7 @@ enum iwl_led_mode {
  * @chain_noise_scale: default chain noise scale used for gain computation
  * @wd_timeout: TX queues watchdog timeout
  * @max_event_log_size: size of event log buffer size for ucode event logging
- * @shadow_reg_enable: HW shadhow register bit
+ * @shadow_reg_enable: HW shadow register support
  * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up
  * @no_idle_support: do not support idle mode
  */
index 2d1b42847b9bb3f9510bb111757297054cb9bb67..0f8fcd1d4fe2a00a4d5958f4f1ea4cd1f8377420 100644 (file)
@@ -62,6 +62,7 @@
  *****************************************************************************/
 
 #include <linux/interrupt.h>
+#include <linux/export.h>
 #include "iwl-debug.h"
 #include "iwl-devtrace.h"
 
@@ -81,8 +82,11 @@ void __iwl_ ##fn(struct device *dev, const char *fmt, ...)   \
 }
 
 __iwl_fn(warn)
+EXPORT_SYMBOL_GPL(__iwl_warn);
 __iwl_fn(info)
+EXPORT_SYMBOL_GPL(__iwl_info);
 __iwl_fn(crit)
+EXPORT_SYMBOL_GPL(__iwl_crit);
 
 void __iwl_err(struct device *dev, bool rfkill_prefix, bool trace_only,
                const char *fmt, ...)
@@ -103,6 +107,7 @@ void __iwl_err(struct device *dev, bool rfkill_prefix, bool trace_only,
        trace_iwlwifi_err(&vaf);
        va_end(args);
 }
+EXPORT_SYMBOL_GPL(__iwl_err);
 
 #if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
 void __iwl_dbg(struct device *dev,
@@ -125,4 +130,5 @@ void __iwl_dbg(struct device *dev,
        trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf);
        va_end(args);
 }
+EXPORT_SYMBOL_GPL(__iwl_dbg);
 #endif
index 8376b842bdba719bd08df0fb42aea7cf9e497158..f6bf91c8f773900dae9a4a4de64155298f6e2f77 100644 (file)
@@ -38,10 +38,10 @@ static inline bool iwl_have_debug_level(u32 level)
 }
 
 void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace,
-               const char *fmt, ...);
-void __iwl_warn(struct device *dev, const char *fmt, ...);
-void __iwl_info(struct device *dev, const char *fmt, ...);
-void __iwl_crit(struct device *dev, const char *fmt, ...);
+               const char *fmt, ...) __printf(4, 5);
+void __iwl_warn(struct device *dev, const char *fmt, ...) __printf(2, 3);
+void __iwl_info(struct device *dev, const char *fmt, ...) __printf(2, 3);
+void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3);
 
 /* No matter what is m (priv, bus, trans), this will work */
 #define IWL_ERR(m, f, a...) __iwl_err((m)->dev, false, false, f, ## a)
@@ -52,9 +52,9 @@ void __iwl_crit(struct device *dev, const char *fmt, ...);
 #if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
 void __iwl_dbg(struct device *dev,
               u32 level, bool limit, const char *function,
-              const char *fmt, ...);
+              const char *fmt, ...) __printf(5, 6);
 #else
-static inline void
+__printf(5, 6) static inline void
 __iwl_dbg(struct device *dev,
          u32 level, bool limit, const char *function,
          const char *fmt, ...)
index 91f45e71e0a2568498e60f01003f8c79e27670f7..70191ddbd8f6ac1cbcd787fee1a511a13f7f655f 100644 (file)
@@ -42,4 +42,9 @@ EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_event);
 EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_error);
 EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_cont_event);
 EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_wrap_event);
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_info);
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_warn);
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_crit);
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_err);
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dbg);
 #endif
index fac67a526a30880199bb12b8fb7310e6a3471a75..49df0e9d5c5f05397e2b8947b394320906cd6a51 100644 (file)
 /* private includes */
 #include "iwl-fw-file.h"
 
+/******************************************************************************
+ *
+ * module boiler plate
+ *
+ ******************************************************************************/
+
+/*
+ * module name, copyright, version, etc.
+ */
+#define DRV_DESCRIPTION        "Intel(R) Wireless WiFi driver for Linux"
+
+#ifdef CONFIG_IWLWIFI_DEBUG
+#define VD "d"
+#else
+#define VD
+#endif
+
+#define DRV_VERSION     IWLWIFI_VERSION VD
+
+MODULE_DESCRIPTION(DRV_DESCRIPTION);
+MODULE_VERSION(DRV_VERSION);
+MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
+MODULE_LICENSE("GPL");
+
 /**
  * struct iwl_drv - drv common data
+ * @list: list of drv structures using this opmode
  * @fw: the iwl_fw structure
  * @op_mode: the running op_mode
  * @trans: transport layer
  * @request_firmware_complete: the firmware has been obtained from user space
  */
 struct iwl_drv {
+       struct list_head list;
        struct iwl_fw fw;
 
        struct iwl_op_mode *op_mode;
@@ -102,7 +128,17 @@ struct iwl_drv {
        struct completion request_firmware_complete;
 };
 
+#define DVM_OP_MODE    0
+#define MVM_OP_MODE    1
 
+static struct iwlwifi_opmode_table {
+       const char *name;                       /* name: iwldvm, iwlmvm, etc */
+       const struct iwl_op_mode_ops *ops;      /* pointer to op_mode ops */
+       struct list_head drv;           /* list of devices using this op_mode */
+} iwlwifi_opmode_table[] = {           /* ops set when driver is initialized */
+       { .name = "iwldvm", .ops = NULL },
+       { .name = "iwlmvm", .ops = NULL },
+};
 
 /*
  * struct fw_sec: Just for the image parsing proccess.
@@ -721,7 +757,6 @@ static int validate_sec_sizes(struct iwl_drv *drv,
        return 0;
 }
 
-
 /**
  * iwl_ucode_callback - callback when firmware was loaded
  *
@@ -733,6 +768,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
        struct iwl_drv *drv = context;
        struct iwl_fw *fw = &drv->fw;
        struct iwl_ucode_header *ucode;
+       struct iwlwifi_opmode_table *op;
        int err;
        struct iwl_firmware_pieces pieces;
        const unsigned int api_max = drv->cfg->ucode_api_max;
@@ -862,10 +898,20 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
        /* We have our copies now, allow OS release its copies */
        release_firmware(ucode_raw);
 
-       drv->op_mode = iwl_dvm_ops.start(drv->trans, drv->cfg, &drv->fw);
+       op = &iwlwifi_opmode_table[DVM_OP_MODE];
 
-       if (!drv->op_mode)
-               goto out_unbind;
+       /* add this device to the list of devices using this op_mode */
+       list_add_tail(&drv->list, &op->drv);
+
+       if (op->ops) {
+               const struct iwl_op_mode_ops *ops = op->ops;
+               drv->op_mode = ops->start(drv->trans, drv->cfg, &drv->fw);
+
+               if (!drv->op_mode)
+                       goto out_unbind;
+       } else {
+               request_module_nowait("%s", op->name);
+       }
 
        /*
         * Complete the firmware request last so that
@@ -943,6 +989,67 @@ struct iwl_mod_params iwlwifi_mod_params = {
        .auto_agg = true,
        /* the rest are 0 by default */
 };
+EXPORT_SYMBOL_GPL(iwlwifi_mod_params);
+
+int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops)
+{
+       int i;
+       struct iwl_drv *drv;
+
+       for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) {
+               if (strcmp(iwlwifi_opmode_table[i].name, name))
+                       continue;
+               iwlwifi_opmode_table[i].ops = ops;
+               list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list)
+                       drv->op_mode = ops->start(drv->trans, drv->cfg,
+                                                 &drv->fw);
+               return 0;
+       }
+       return -EIO;
+}
+EXPORT_SYMBOL_GPL(iwl_opmode_register);
+
+void iwl_opmode_deregister(const char *name)
+{
+       int i;
+       struct iwl_drv *drv;
+
+       for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) {
+               if (strcmp(iwlwifi_opmode_table[i].name, name))
+                       continue;
+               iwlwifi_opmode_table[i].ops = NULL;
+
+               /* call the stop routine for all devices */
+               list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list) {
+                       if (drv->op_mode) {
+                               iwl_op_mode_stop(drv->op_mode);
+                               drv->op_mode = NULL;
+                       }
+               }
+               return;
+       }
+}
+EXPORT_SYMBOL_GPL(iwl_opmode_deregister);
+
+static int __init iwl_drv_init(void)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++)
+               INIT_LIST_HEAD(&iwlwifi_opmode_table[i].drv);
+
+       pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
+       pr_info(DRV_COPYRIGHT "\n");
+
+       return iwl_pci_register_driver();
+}
+module_init(iwl_drv_init);
+
+static void __exit iwl_drv_exit(void)
+{
+       iwl_pci_unregister_driver();
+}
+module_exit(iwl_drv_exit);
 
 #ifdef CONFIG_IWLWIFI_DEBUG
 module_param_named(debug, iwlwifi_mod_params.debug_level, uint,
index 081dd34d2387d1787ab575ebb2106c9d683ab119..ee93274214d67fa7802d7685c9df10af45b52ba7 100644 (file)
@@ -27,6 +27,7 @@
  *****************************************************************************/
 #include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/export.h>
 
 #include "iwl-io.h"
 #include"iwl-csr.h"
@@ -52,6 +53,7 @@ void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask)
        __iwl_set_bit(trans, reg, mask);
        spin_unlock_irqrestore(&trans->reg_lock, flags);
 }
+EXPORT_SYMBOL_GPL(iwl_set_bit);
 
 void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask)
 {
@@ -61,6 +63,7 @@ void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask)
        __iwl_clear_bit(trans, reg, mask);
        spin_unlock_irqrestore(&trans->reg_lock, flags);
 }
+EXPORT_SYMBOL_GPL(iwl_clear_bit);
 
 int iwl_poll_bit(struct iwl_trans *trans, u32 addr,
                 u32 bits, u32 mask, int timeout)
@@ -76,6 +79,7 @@ int iwl_poll_bit(struct iwl_trans *trans, u32 addr,
 
        return -ETIMEDOUT;
 }
+EXPORT_SYMBOL_GPL(iwl_poll_bit);
 
 int iwl_grab_nic_access_silent(struct iwl_trans *trans)
 {
@@ -117,6 +121,7 @@ int iwl_grab_nic_access_silent(struct iwl_trans *trans)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(iwl_grab_nic_access_silent);
 
 bool iwl_grab_nic_access(struct iwl_trans *trans)
 {
@@ -130,6 +135,7 @@ bool iwl_grab_nic_access(struct iwl_trans *trans)
 
        return true;
 }
+EXPORT_SYMBOL_GPL(iwl_grab_nic_access);
 
 void iwl_release_nic_access(struct iwl_trans *trans)
 {
@@ -144,6 +150,7 @@ void iwl_release_nic_access(struct iwl_trans *trans)
         */
        mmiowb();
 }
+EXPORT_SYMBOL_GPL(iwl_release_nic_access);
 
 u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg)
 {
@@ -158,6 +165,7 @@ u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg)
 
        return value;
 }
+EXPORT_SYMBOL_GPL(iwl_read_direct32);
 
 void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value)
 {
@@ -170,6 +178,7 @@ void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value)
        }
        spin_unlock_irqrestore(&trans->reg_lock, flags);
 }
+EXPORT_SYMBOL_GPL(iwl_write_direct32);
 
 int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask,
                        int timeout)
@@ -185,6 +194,7 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask,
 
        return -ETIMEDOUT;
 }
+EXPORT_SYMBOL_GPL(iwl_poll_direct_bit);
 
 static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 reg)
 {
@@ -211,6 +221,7 @@ u32 iwl_read_prph(struct iwl_trans *trans, u32 reg)
        spin_unlock_irqrestore(&trans->reg_lock, flags);
        return val;
 }
+EXPORT_SYMBOL_GPL(iwl_read_prph);
 
 void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val)
 {
@@ -223,6 +234,7 @@ void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val)
        }
        spin_unlock_irqrestore(&trans->reg_lock, flags);
 }
+EXPORT_SYMBOL_GPL(iwl_write_prph);
 
 void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask)
 {
@@ -236,6 +248,7 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask)
        }
        spin_unlock_irqrestore(&trans->reg_lock, flags);
 }
+EXPORT_SYMBOL_GPL(iwl_set_bits_prph);
 
 void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg,
                            u32 bits, u32 mask)
@@ -250,6 +263,7 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg,
        }
        spin_unlock_irqrestore(&trans->reg_lock, flags);
 }
+EXPORT_SYMBOL_GPL(iwl_set_bits_mask_prph);
 
 void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask)
 {
@@ -264,6 +278,7 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask)
        }
        spin_unlock_irqrestore(&trans->reg_lock, flags);
 }
+EXPORT_SYMBOL_GPL(iwl_clear_bits_prph);
 
 void _iwl_read_targ_mem_words(struct iwl_trans *trans, u32 addr,
                              void *buf, int words)
@@ -281,6 +296,7 @@ void _iwl_read_targ_mem_words(struct iwl_trans *trans, u32 addr,
        }
        spin_unlock_irqrestore(&trans->reg_lock, flags);
 }
+EXPORT_SYMBOL_GPL(_iwl_read_targ_mem_words);
 
 u32 iwl_read_targ_mem(struct iwl_trans *trans, u32 addr)
 {
@@ -290,6 +306,7 @@ u32 iwl_read_targ_mem(struct iwl_trans *trans, u32 addr)
 
        return value;
 }
+EXPORT_SYMBOL_GPL(iwl_read_targ_mem);
 
 int _iwl_write_targ_mem_words(struct iwl_trans *trans, u32 addr,
                                void *buf, int words)
@@ -310,8 +327,10 @@ int _iwl_write_targ_mem_words(struct iwl_trans *trans, u32 addr,
 
        return result;
 }
+EXPORT_SYMBOL_GPL(_iwl_write_targ_mem_words);
 
 int iwl_write_targ_mem(struct iwl_trans *trans, u32 addr, u32 val)
 {
        return _iwl_write_targ_mem_words(trans, addr, &val, 1);
 }
+EXPORT_SYMBOL_GPL(iwl_write_targ_mem);
index 3ee23134c02b9b96ee184a5999e9577bf6452511..a55012609cac736ac3c957e3ebd1b4a163073971 100644 (file)
@@ -420,8 +420,6 @@ int iwlagn_mac_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
        if (ret)
                goto error;
 
-       device_set_wakeup_enable(priv->trans->dev, true);
-
        iwl_trans_wowlan_suspend(priv->trans);
 
        goto out;
@@ -488,8 +486,6 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
 
        priv->wowlan = false;
 
-       device_set_wakeup_enable(priv->trans->dev, false);
-
        iwlagn_prepare_restart(priv);
 
        memset((void *)&ctx->active, 0, sizeof(ctx->active));
@@ -504,6 +500,12 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
        return 1;
 }
 
+static void iwlagn_mac_set_wakeup(struct ieee80211_hw *hw, bool enabled)
+{
+       struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
+
+       device_set_wakeup_enable(priv->trans->dev, enabled);
+}
 #endif
 
 void iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
@@ -1584,6 +1586,7 @@ struct ieee80211_ops iwlagn_hw_ops = {
 #ifdef CONFIG_PM_SLEEP
        .suspend = iwlagn_mac_suspend,
        .resume = iwlagn_mac_resume,
+       .set_wakeup = iwlagn_mac_set_wakeup,
 #endif
        .add_interface = iwlagn_mac_add_interface,
        .remove_interface = iwlagn_mac_remove_interface,
index 0066b899fe5cffe39ae526b73987e75026632ec5..5cfed29b1b18dbbdae16f3a93af279220cc41c74 100644 (file)
@@ -61,6 +61,7 @@
  *
  *****************************************************************************/
 #include <linux/sched.h>
+#include <linux/export.h>
 
 #include "iwl-notif-wait.h"
 
@@ -71,6 +72,7 @@ void iwl_notification_wait_init(struct iwl_notif_wait_data *notif_wait)
        INIT_LIST_HEAD(&notif_wait->notif_waits);
        init_waitqueue_head(&notif_wait->notif_waitq);
 }
+EXPORT_SYMBOL_GPL(iwl_notification_wait_init);
 
 void iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_wait,
                                  struct iwl_rx_packet *pkt)
@@ -115,6 +117,7 @@ void iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_wait,
        if (triggered)
                wake_up_all(&notif_wait->notif_waitq);
 }
+EXPORT_SYMBOL_GPL(iwl_notification_wait_notify);
 
 void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_wait)
 {
@@ -128,7 +131,7 @@ void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_wait)
 
        wake_up_all(&notif_wait->notif_waitq);
 }
-
+EXPORT_SYMBOL_GPL(iwl_abort_notification_waits);
 
 void
 iwl_init_notification_wait(struct iwl_notif_wait_data *notif_wait,
@@ -152,6 +155,7 @@ iwl_init_notification_wait(struct iwl_notif_wait_data *notif_wait,
        list_add(&wait_entry->list, &notif_wait->notif_waits);
        spin_unlock_bh(&notif_wait->notif_wait_lock);
 }
+EXPORT_SYMBOL_GPL(iwl_init_notification_wait);
 
 int iwl_wait_notification(struct iwl_notif_wait_data *notif_wait,
                          struct iwl_notification_wait *wait_entry,
@@ -175,6 +179,7 @@ int iwl_wait_notification(struct iwl_notif_wait_data *notif_wait,
                return -ETIMEDOUT;
        return 0;
 }
+EXPORT_SYMBOL_GPL(iwl_wait_notification);
 
 void iwl_remove_notification(struct iwl_notif_wait_data *notif_wait,
                             struct iwl_notification_wait *wait_entry)
@@ -183,3 +188,4 @@ void iwl_remove_notification(struct iwl_notif_wait_data *notif_wait,
        list_del(&wait_entry->list);
        spin_unlock_bh(&notif_wait->notif_wait_lock);
 }
+EXPORT_SYMBOL_GPL(iwl_remove_notification);
index 4ef742b28e0839ebe787c0aeee40f43152b825f5..cec133c87ad82e6bd4bd0ba0a465fe33ff377240 100644 (file)
@@ -145,6 +145,9 @@ struct iwl_op_mode_ops {
        void (*wimax_active)(struct iwl_op_mode *op_mode);
 };
 
+int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops);
+void iwl_opmode_deregister(const char *name);
+
 /**
  * struct iwl_op_mode - operational mode
  *
index e959207c630a9352f143536c1a51a5de995ee96b..f027769933d901dc705f86d73f7dc7c8210d89da 100644 (file)
@@ -313,7 +313,7 @@ void iwl_bg_rx_replenish(struct work_struct *data);
 void iwl_irq_tasklet(struct iwl_trans *trans);
 void iwlagn_rx_replenish(struct iwl_trans *trans);
 void iwl_rx_queue_update_write_ptr(struct iwl_trans *trans,
-                       struct iwl_rx_queue *q);
+                                  struct iwl_rx_queue *q);
 
 /*****************************************************
 * ICT
@@ -328,7 +328,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data);
 * TX / HCMD
 ******************************************************/
 void iwl_txq_update_write_ptr(struct iwl_trans *trans,
-                       struct iwl_tx_queue *txq);
+                             struct iwl_tx_queue *txq);
 int iwlagn_txq_attach_buf_to_tfd(struct iwl_trans *trans,
                                 struct iwl_tx_queue *txq,
                                 dma_addr_t addr, u16 len, u8 reset);
@@ -337,8 +337,8 @@ int iwl_trans_pcie_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
 void iwl_tx_cmd_complete(struct iwl_trans *trans,
                         struct iwl_rx_cmd_buffer *rxb, int handler_status);
 void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans,
-                                          struct iwl_tx_queue *txq,
-                                          u16 byte_cnt);
+                                      struct iwl_tx_queue *txq,
+                                      u16 byte_cnt);
 void iwl_trans_pcie_tx_agg_disable(struct iwl_trans *trans, int queue);
 void iwl_trans_set_wr_ptrs(struct iwl_trans *trans, int txq_id, u32 index);
 void iwl_trans_tx_queue_set_status(struct iwl_trans *trans,
@@ -346,8 +346,8 @@ void iwl_trans_tx_queue_set_status(struct iwl_trans *trans,
                                   int tx_fifo_id, bool active);
 void iwl_trans_pcie_tx_agg_setup(struct iwl_trans *trans, int queue, int fifo,
                                 int sta_id, int tid, int frame_limit, u16 ssn);
-void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
-                        enum dma_data_direction dma_dir);
+void iwl_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
+                     enum dma_data_direction dma_dir);
 int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
                         struct sk_buff_head *skbs);
 int iwl_queue_space(const struct iwl_queue *q);
index 08517d3c80bb203e302825e6349814db9963b0bb..98605fc7ad3794eeb4ddbd42c394fc5eb681dc48 100644 (file)
@@ -130,7 +130,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q)
  * iwl_rx_queue_update_write_ptr - Update the write pointer for the RX queue
  */
 void iwl_rx_queue_update_write_ptr(struct iwl_trans *trans,
-                       struct iwl_rx_queue *q)
+                                  struct iwl_rx_queue *q)
 {
        unsigned long flags;
        u32 reg;
@@ -201,9 +201,7 @@ static inline __le32 iwlagn_dma_addr2rbd_ptr(dma_addr_t dma_addr)
  */
 static void iwlagn_rx_queue_restock(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
-
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rx_queue *rxq = &trans_pcie->rxq;
        struct list_head *element;
        struct iwl_rx_mem_buffer *rxb;
@@ -253,9 +251,7 @@ static void iwlagn_rx_queue_restock(struct iwl_trans *trans)
  */
 static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
-
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rx_queue *rxq = &trans_pcie->rxq;
        struct list_head *element;
        struct iwl_rx_mem_buffer *rxb;
@@ -278,8 +274,7 @@ static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority)
                        gfp_mask |= __GFP_COMP;
 
                /* Alloc a new receive buffer */
-               page = alloc_pages(gfp_mask,
-                                 trans_pcie->rx_page_order);
+               page = alloc_pages(gfp_mask, trans_pcie->rx_page_order);
                if (!page) {
                        if (net_ratelimit())
                                IWL_DEBUG_INFO(trans, "alloc_pages failed, "
@@ -315,9 +310,10 @@ static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority)
                BUG_ON(rxb->page);
                rxb->page = page;
                /* Get physical address of the RB */
-               rxb->page_dma = dma_map_page(trans->dev, page, 0,
-                               PAGE_SIZE << trans_pcie->rx_page_order,
-                               DMA_FROM_DEVICE);
+               rxb->page_dma =
+                       dma_map_page(trans->dev, page, 0,
+                                    PAGE_SIZE << trans_pcie->rx_page_order,
+                                    DMA_FROM_DEVICE);
                /* dma address must be no more than 36 bits */
                BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));
                /* and also 256 byte aligned! */
@@ -465,8 +461,8 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
        if (rxb->page != NULL) {
                rxb->page_dma =
                        dma_map_page(trans->dev, rxb->page, 0,
-                               PAGE_SIZE << trans_pcie->rx_page_order,
-                               DMA_FROM_DEVICE);
+                                    PAGE_SIZE << trans_pcie->rx_page_order,
+                                    DMA_FROM_DEVICE);
                list_add_tail(&rxb->list, &rxq->rx_free);
                rxq->free_count++;
        } else
@@ -497,7 +493,7 @@ static void iwl_rx_handle(struct iwl_trans *trans)
 
        /* Rx interrupt, but nothing sent from uCode */
        if (i == r)
-               IWL_DEBUG_RX(trans, "r = %d, i = %d\n", r, i);
+               IWL_DEBUG_RX(trans, "HW = SW = %d\n", r);
 
        /* calculate total frames need to be restock after handling RX */
        total_empty = r - rxq->write_actual;
@@ -513,8 +509,8 @@ static void iwl_rx_handle(struct iwl_trans *trans)
                rxb = rxq->queue[i];
                rxq->queue[i] = NULL;
 
-               IWL_DEBUG_RX(trans, "rxbuf: r = %d, i = %d (%p)\n", rxb);
-
+               IWL_DEBUG_RX(trans, "rxbuf: HW = %d, SW = %d (%p)\n",
+                            r, i, rxb);
                iwl_rx_handle_rxbuf(trans, rxb);
 
                i = (i + 1) & RX_QUEUE_MASK;
@@ -546,12 +542,12 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
        /* W/A for WiFi/WiMAX coex and WiMAX own the RF */
        if (trans->cfg->internal_wimax_coex &&
            (!(iwl_read_prph(trans, APMG_CLK_CTRL_REG) &
-                       APMS_CLK_VAL_MRB_FUNC_MODE) ||
+                            APMS_CLK_VAL_MRB_FUNC_MODE) ||
             (iwl_read_prph(trans, APMG_PS_CTRL_REG) &
-                       APMG_PS_CTRL_VAL_RESET_REQ))) {
-               struct iwl_trans_pcie *trans_pcie;
+                           APMG_PS_CTRL_VAL_RESET_REQ))) {
+               struct iwl_trans_pcie *trans_pcie =
+                       IWL_TRANS_GET_PCIE_TRANS(trans);
 
-               trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
                clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status);
                iwl_op_mode_wimax_active(trans->op_mode);
                wake_up(&trans->wait_command_queue);
@@ -567,6 +563,8 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
 /* tasklet for iwlagn interrupt */
 void iwl_irq_tasklet(struct iwl_trans *trans)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
        u32 inta = 0;
        u32 handled = 0;
        unsigned long flags;
@@ -575,10 +573,6 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
        u32 inta_mask;
 #endif
 
-       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-       struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
-
-
        spin_lock_irqsave(&trans_pcie->irq_lock, flags);
 
        /* Ack/clear/reset pending uCode interrupts.
@@ -593,7 +587,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
         * interrupt coalescing can still be achieved.
         */
        iwl_write32(trans, CSR_INT,
-               trans_pcie->inta | ~trans_pcie->inta_mask);
+                   trans_pcie->inta | ~trans_pcie->inta_mask);
 
        inta = trans_pcie->inta;
 
@@ -602,7 +596,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
                /* just for debug */
                inta_mask = iwl_read32(trans, CSR_INT_MASK);
                IWL_DEBUG_ISR(trans, "inta 0x%08x, enabled 0x%08x\n",
-                               inta, inta_mask);
+                             inta, inta_mask);
        }
 #endif
 
@@ -651,7 +645,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
 
                hw_rfkill = iwl_is_rfkill_set(trans);
                IWL_WARN(trans, "RF_KILL bit toggled to %s.\n",
-                               hw_rfkill ? "disable radio" : "enable radio");
+                        hw_rfkill ? "disable radio" : "enable radio");
 
                isr_stats->rfkill++;
 
@@ -693,7 +687,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
         * Rx "responses" (frame-received notification), and other
         * notifications from uCode come through here*/
        if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX |
-                       CSR_INT_BIT_RX_PERIODIC)) {
+                   CSR_INT_BIT_RX_PERIODIC)) {
                IWL_DEBUG_ISR(trans, "Rx interrupt\n");
                if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) {
                        handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX);
@@ -733,7 +727,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
                 */
                if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX))
                        iwl_write8(trans, CSR_INT_PERIODIC_REG,
-                                   CSR_INT_PERIODIC_ENA);
+                                  CSR_INT_PERIODIC_ENA);
 
                isr_stats->rx++;
        }
@@ -782,8 +776,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
 /* Free dram table */
 void iwl_free_isr_ict(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
        if (trans_pcie->ict_tbl) {
                dma_free_coherent(trans->dev, ICT_SIZE,
@@ -802,8 +795,7 @@ void iwl_free_isr_ict(struct iwl_trans *trans)
  */
 int iwl_alloc_isr_ict(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
        trans_pcie->ict_tbl =
                dma_alloc_coherent(trans->dev, ICT_SIZE,
@@ -837,10 +829,9 @@ int iwl_alloc_isr_ict(struct iwl_trans *trans)
  */
 void iwl_reset_ict(struct iwl_trans *trans)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        u32 val;
        unsigned long flags;
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
 
        if (!trans_pcie->ict_tbl)
                return;
@@ -868,9 +859,7 @@ void iwl_reset_ict(struct iwl_trans *trans)
 /* Device is going down disable ict interrupt usage */
 void iwl_disable_ict(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
-
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        unsigned long flags;
 
        spin_lock_irqsave(&trans_pcie->irq_lock, flags);
@@ -934,7 +923,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
        if (likely(inta))
                tasklet_schedule(&trans_pcie->irq_tasklet);
        else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
-                       !trans_pcie->inta)
+                !trans_pcie->inta)
                iwl_enable_interrupts(trans);
 
  unplugged:
@@ -945,7 +934,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
        /* re-enable interrupts here since we don't have anything to service. */
        /* only Re-enable if disabled by irq  and no schedules tasklet. */
        if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
-               !trans_pcie->inta)
+           !trans_pcie->inta)
                iwl_enable_interrupts(trans);
 
        spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
@@ -1036,7 +1025,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data)
 
        inta = (0xff & val) | ((0xff00 & val) << 16);
        IWL_DEBUG_ISR(trans, "ISR inta 0x%08x, enabled 0x%08x ict 0x%08x\n",
-                       inta, inta_mask, val);
+                     inta, inta_mask, val);
 
        inta &= trans_pcie->inta_mask;
        trans_pcie->inta |= inta;
index a8750238ee09b78a99623693332e8c8c40c83a85..6f601cd05a942a1a9b6fd8dda39ee6faa70a30e1 100644 (file)
  * iwl_trans_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array
  */
 void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans,
-                                          struct iwl_tx_queue *txq,
-                                          u16 byte_cnt)
+                                      struct iwl_tx_queue *txq,
+                                      u16 byte_cnt)
 {
        struct iwlagn_scd_bc_tbl *scd_bc_tbl;
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        int write_ptr = txq->q.write_ptr;
        int txq_id = txq->q.id;
        u8 sec_ctl = 0;
@@ -178,8 +177,8 @@ static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)
        return tfd->num_tbs & 0x1f;
 }
 
-static void iwlagn_unmap_tfd(struct iwl_trans *trans, struct iwl_cmd_meta *meta,
-                    struct iwl_tfd *tfd, enum dma_data_direction dma_dir)
+static void iwl_unmap_tfd(struct iwl_trans *trans, struct iwl_cmd_meta *meta,
+                         struct iwl_tfd *tfd, enum dma_data_direction dma_dir)
 {
        int i;
        int num_tbs;
@@ -209,7 +208,7 @@ static void iwlagn_unmap_tfd(struct iwl_trans *trans, struct iwl_cmd_meta *meta,
 }
 
 /**
- * iwlagn_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
+ * iwl_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
  * @trans - transport private data
  * @txq - tx queue
  * @dma_dir - the direction of the DMA mapping
@@ -217,8 +216,8 @@ static void iwlagn_unmap_tfd(struct iwl_trans *trans, struct iwl_cmd_meta *meta,
  * Does NOT advance any TFD circular buffer read/write indexes
  * Does NOT free the TFD itself (which is within circular buffer)
  */
-void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
-                        enum dma_data_direction dma_dir)
+void iwl_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
+                     enum dma_data_direction dma_dir)
 {
        struct iwl_tfd *tfd_tmp = txq->tfds;
 
@@ -229,8 +228,8 @@ void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
        lockdep_assert_held(&txq->lock);
 
        /* We have only q->n_window txq->entries, but we use q->n_bd tfds */
-       iwlagn_unmap_tfd(trans, &txq->entries[idx].meta,
-                        &tfd_tmp[rd_ptr], dma_dir);
+       iwl_unmap_tfd(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr],
+                     dma_dir);
 
        /* free SKB */
        if (txq->entries) {
@@ -270,7 +269,7 @@ int iwlagn_txq_attach_buf_to_tfd(struct iwl_trans *trans,
        /* Each TFD can point to a maximum 20 Tx buffers */
        if (num_tbs >= IWL_NUM_OF_TBS) {
                IWL_ERR(trans, "Error can not send more than %d chunks\n",
-                         IWL_NUM_OF_TBS);
+                       IWL_NUM_OF_TBS);
                return -EINVAL;
        }
 
@@ -279,7 +278,7 @@ int iwlagn_txq_attach_buf_to_tfd(struct iwl_trans *trans,
 
        if (unlikely(addr & ~IWL_TX_DMA_MASK))
                IWL_ERR(trans, "Unaligned address = %llx\n",
-                         (unsigned long long)addr);
+                       (unsigned long long)addr);
 
        iwl_tfd_set_tb(tfd, num_tbs, addr, len);
 
@@ -383,15 +382,13 @@ static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_trans *trans,
 }
 
 static int iwlagn_tx_queue_set_q2ratid(struct iwl_trans *trans, u16 ra_tid,
-                                       u16 txq_id)
+                                      u16 txq_id)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        u32 tbl_dw_addr;
        u32 tbl_dw;
        u16 scd_q2ratid;
 
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
-
        scd_q2ratid = ra_tid & SCD_QUEUE_RA_TID_MAP_RATID_MSK;
 
        tbl_dw_addr = trans_pcie->scd_base_addr +
@@ -419,12 +416,11 @@ static void iwlagn_tx_queue_stop_scheduler(struct iwl_trans *trans, u16 txq_id)
                (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
 }
 
-void iwl_trans_set_wr_ptrs(struct iwl_trans *trans,
-                               int txq_id, u32 index)
+void iwl_trans_set_wr_ptrs(struct iwl_trans *trans, int txq_id, u32 index)
 {
        IWL_DEBUG_TX_QUEUES(trans, "Q %d  WrPtr: %d\n", txq_id, index & 0xff);
        iwl_write_direct32(trans, HBUS_TARG_WRPTR,
-                       (index & 0xff) | (txq_id << 8));
+                          (index & 0xff) | (txq_id << 8));
        iwl_write_prph(trans, SCD_QUEUE_RDPTR(txq_id), index);
 }
 
@@ -615,13 +611,13 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
        }
 
        IWL_DEBUG_HC(trans,
-               "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n",
-               trans_pcie_get_cmd_string(trans_pcie, out_cmd->hdr.cmd),
-               out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), cmd_size,
-               q->write_ptr, idx, trans_pcie->cmd_queue);
+                    "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n",
+                    trans_pcie_get_cmd_string(trans_pcie, out_cmd->hdr.cmd),
+                    out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence),
+                    cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue);
 
        phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size,
-                               DMA_BIDIRECTIONAL);
+                                  DMA_BIDIRECTIONAL);
        if (unlikely(dma_mapping_error(trans->dev, phys_addr))) {
                idx = -ENOMEM;
                goto out;
@@ -630,8 +626,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
        dma_unmap_addr_set(out_meta, mapping, phys_addr);
        dma_unmap_len_set(out_meta, len, copy_size);
 
-       iwlagn_txq_attach_buf_to_tfd(trans, txq,
-                                       phys_addr, copy_size, 1);
+       iwlagn_txq_attach_buf_to_tfd(trans, txq, phys_addr, copy_size, 1);
 #ifdef CONFIG_IWLWIFI_DEVICE_TRACING
        trace_bufs[0] = &out_cmd->hdr;
        trace_lens[0] = copy_size;
@@ -643,13 +638,12 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
                        continue;
                if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))
                        continue;
-               phys_addr = dma_map_single(trans->dev,
-                                          (void *)cmd->data[i],
+               phys_addr = dma_map_single(trans->dev, (void *)cmd->data[i],
                                           cmd->len[i], DMA_BIDIRECTIONAL);
                if (dma_mapping_error(trans->dev, phys_addr)) {
-                       iwlagn_unmap_tfd(trans, out_meta,
-                                        &txq->tfds[q->write_ptr],
-                                        DMA_BIDIRECTIONAL);
+                       iwl_unmap_tfd(trans, out_meta,
+                                     &txq->tfds[q->write_ptr],
+                                     DMA_BIDIRECTIONAL);
                        idx = -ENOMEM;
                        goto out;
                }
@@ -723,9 +717,10 @@ static void iwl_hcmd_queue_reclaim(struct iwl_trans *trans, int txq_id,
        lockdep_assert_held(&txq->lock);
 
        if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) {
-               IWL_ERR(trans, "%s: Read index for DMA queue txq id (%d), "
-                         "index %d is out of range [0-%d] %d %d.\n", __func__,
-                         txq_id, idx, q->n_bd, q->write_ptr, q->read_ptr);
+               IWL_ERR(trans,
+                       "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n",
+                       __func__, txq_id, idx, q->n_bd,
+                       q->write_ptr, q->read_ptr);
                return;
        }
 
@@ -733,8 +728,8 @@ static void iwl_hcmd_queue_reclaim(struct iwl_trans *trans, int txq_id,
             q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
 
                if (nfreed++ > 0) {
-                       IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", idx,
-                                       q->write_ptr, q->read_ptr);
+                       IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n",
+                               idx, q->write_ptr, q->read_ptr);
                        iwl_op_mode_nic_error(trans->op_mode);
                }
 
@@ -771,9 +766,9 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
         * in the queue management code. */
        if (WARN(txq_id != trans_pcie->cmd_queue,
                 "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n",
-                 txq_id, trans_pcie->cmd_queue, sequence,
-                 trans_pcie->txq[trans_pcie->cmd_queue].q.read_ptr,
-                 trans_pcie->txq[trans_pcie->cmd_queue].q.write_ptr)) {
+                txq_id, trans_pcie->cmd_queue, sequence,
+                trans_pcie->txq[trans_pcie->cmd_queue].q.read_ptr,
+                trans_pcie->txq[trans_pcie->cmd_queue].q.write_ptr)) {
                iwl_print_hex_error(trans, pkt, 32);
                return;
        }
@@ -784,8 +779,7 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
        cmd = txq->entries[cmd_index].cmd;
        meta = &txq->entries[cmd_index].meta;
 
-       iwlagn_unmap_tfd(trans, meta, &txq->tfds[index],
-                        DMA_BIDIRECTIONAL);
+       iwl_unmap_tfd(trans, meta, &txq->tfds[index], DMA_BIDIRECTIONAL);
 
        /* Input error checking is done when commands are added to queue. */
        if (meta->flags & CMD_WANT_SKB) {
@@ -870,8 +864,9 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
        }
 
        ret = wait_event_timeout(trans->wait_command_queue,
-                       !test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status),
-                       HOST_COMPLETE_TIMEOUT);
+                                !test_bit(STATUS_HCMD_ACTIVE,
+                                          &trans_pcie->status),
+                                HOST_COMPLETE_TIMEOUT);
        if (!ret) {
                if (test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) {
                        struct iwl_tx_queue *txq =
@@ -956,10 +951,10 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
 
        if ((index >= q->n_bd) ||
           (iwl_queue_used(q, last_to_free) == 0)) {
-               IWL_ERR(trans, "%s: Read index for DMA queue txq id (%d), "
-                         "last_to_free %d is out of range [0-%d] %d %d.\n",
-                         __func__, txq_id, last_to_free, q->n_bd,
-                         q->write_ptr, q->read_ptr);
+               IWL_ERR(trans,
+                       "%s: Read index for DMA queue txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n",
+                       __func__, txq_id, last_to_free, q->n_bd,
+                       q->write_ptr, q->read_ptr);
                return 0;
        }
 
@@ -979,7 +974,7 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
 
                iwlagn_txq_inval_byte_cnt_tbl(trans, txq);
 
-               iwlagn_txq_free_tfd(trans, txq, DMA_TO_DEVICE);
+               iwl_txq_free_tfd(trans, txq, DMA_TO_DEVICE);
                freed++;
        }
 
index ec6fb395b84d0aca4e7d7bfcf2e1729c3959dc5a..1e50401023e0363ff66e764eaa4f705f8400b94a 100644 (file)
 /* FIXME: need to abstract out TX command (once we know what it looks like) */
 #include "iwl-commands.h"
 
-#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
-
 #define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie)      \
        (((1<<trans->cfg->base_params->num_of_queues) - 1) &\
        (~(1<<(trans_pcie)->cmd_queue)))
 
 static int iwl_trans_rx_alloc(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rx_queue *rxq = &trans_pcie->rxq;
        struct device *dev = trans->dev;
 
@@ -114,7 +111,7 @@ static int iwl_trans_rx_alloc(struct iwl_trans *trans)
 
 err_rb_stts:
        dma_free_coherent(dev, sizeof(__le32) * RX_QUEUE_SIZE,
-                       rxq->bd, rxq->bd_dma);
+                         rxq->bd, rxq->bd_dma);
        memset(&rxq->bd_dma, 0, sizeof(rxq->bd_dma));
        rxq->bd = NULL;
 err_bd:
@@ -123,8 +120,7 @@ err_bd:
 
 static void iwl_trans_rxq_free_rx_bufs(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rx_queue *rxq = &trans_pcie->rxq;
        int i;
 
@@ -134,8 +130,8 @@ static void iwl_trans_rxq_free_rx_bufs(struct iwl_trans *trans)
                 * to an SKB, so we need to unmap and free potential storage */
                if (rxq->pool[i].page != NULL) {
                        dma_unmap_page(trans->dev, rxq->pool[i].page_dma,
-                               PAGE_SIZE << trans_pcie->rx_page_order,
-                               DMA_FROM_DEVICE);
+                                      PAGE_SIZE << trans_pcie->rx_page_order,
+                                      DMA_FROM_DEVICE);
                        __free_pages(rxq->pool[i].page,
                                     trans_pcie->rx_page_order);
                        rxq->pool[i].page = NULL;
@@ -193,8 +189,7 @@ static void iwl_trans_rx_hw_init(struct iwl_trans *trans,
 
 static int iwl_rx_init(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rx_queue *rxq = &trans_pcie->rxq;
 
        int i, err;
@@ -236,10 +231,8 @@ static int iwl_rx_init(struct iwl_trans *trans)
 
 static void iwl_trans_pcie_rx_free(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rx_queue *rxq = &trans_pcie->rxq;
-
        unsigned long flags;
 
        /*if rxq->bd is NULL, it means that nothing has been allocated,
@@ -274,11 +267,11 @@ static int iwl_trans_rx_stop(struct iwl_trans *trans)
        /* stop Rx DMA */
        iwl_write_direct32(trans, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
        return iwl_poll_direct_bit(trans, FH_MEM_RSSR_RX_STATUS_REG,
-                           FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
+                                  FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
 }
 
-static inline int iwlagn_alloc_dma_ptr(struct iwl_trans *trans,
-                                   struct iwl_dma_ptr *ptr, size_t size)
+static int iwlagn_alloc_dma_ptr(struct iwl_trans *trans,
+                               struct iwl_dma_ptr *ptr, size_t size)
 {
        if (WARN_ON(ptr->addr))
                return -EINVAL;
@@ -291,8 +284,8 @@ static inline int iwlagn_alloc_dma_ptr(struct iwl_trans *trans,
        return 0;
 }
 
-static inline void iwlagn_free_dma_ptr(struct iwl_trans *trans,
-                                   struct iwl_dma_ptr *ptr)
+static void iwlagn_free_dma_ptr(struct iwl_trans *trans,
+                               struct iwl_dma_ptr *ptr)
 {
        if (unlikely(!ptr->addr))
                return;
@@ -329,12 +322,12 @@ static void iwl_trans_pcie_queue_stuck_timer(unsigned long data)
 }
 
 static int iwl_trans_txq_alloc(struct iwl_trans *trans,
-                               struct iwl_tx_queue *txq, int slots_num,
-                               u32 txq_id)
+                              struct iwl_tx_queue *txq, int slots_num,
+                              u32 txq_id)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX;
        int i;
-       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
        if (WARN_ON(txq->entries || txq->tfds))
                return -EINVAL;
@@ -435,7 +428,7 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id)
 
        spin_lock_bh(&txq->lock);
        while (q->write_ptr != q->read_ptr) {
-               iwlagn_txq_free_tfd(trans, txq, dma_dir);
+               iwl_txq_free_tfd(trans, txq, dma_dir);
                q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);
        }
        spin_unlock_bh(&txq->lock);
@@ -455,6 +448,7 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id)
        struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id];
        struct device *dev = trans->dev;
        int i;
+
        if (WARN_ON(!txq))
                return;
 
@@ -574,11 +568,11 @@ error:
 }
 static int iwl_tx_init(struct iwl_trans *trans)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        int ret;
        int txq_id, slots_num;
        unsigned long flags;
        bool alloc = false;
-       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
        if (!trans_pcie->txq) {
                ret = iwl_trans_tx_alloc(trans);
@@ -643,10 +637,9 @@ static void iwl_set_pwr_vmain(struct iwl_trans *trans)
 
 static u16 iwl_pciexp_link_ctrl(struct iwl_trans *trans)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        int pos;
        u16 pci_lnk_ctl;
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
 
        struct pci_dev *pci_dev = trans_pcie->pci_dev;
 
@@ -700,14 +693,14 @@ static int iwl_apm_init(struct iwl_trans *trans)
 
        /* Disable L0S exit timer (platform NMI Work/Around) */
        iwl_set_bit(trans, CSR_GIO_CHICKEN_BITS,
-                         CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
+                   CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
 
        /*
         * Disable L0s without affecting L1;
         *  don't wait for ICH L0s (ICH bug W/A)
         */
        iwl_set_bit(trans, CSR_GIO_CHICKEN_BITS,
-                         CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
+                   CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
 
        /* Set FH wait threshold to maximum (HW error during stress W/A) */
        iwl_set_bit(trans, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL);
@@ -717,7 +710,7 @@ static int iwl_apm_init(struct iwl_trans *trans)
         * wake device's PCI Express link L1a -> L0s
         */
        iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
-                                   CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A);
+                   CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A);
 
        iwl_apm_config(trans);
 
@@ -738,8 +731,8 @@ static int iwl_apm_init(struct iwl_trans *trans)
         * and accesses to uCode SRAM.
         */
        ret = iwl_poll_bit(trans, CSR_GP_CNTRL,
-                       CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
-                       CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
+                          CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
+                          CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
        if (ret < 0) {
                IWL_DEBUG_INFO(trans, "Failed to init the card\n");
                goto out;
@@ -773,8 +766,8 @@ static int iwl_apm_stop_master(struct iwl_trans *trans)
        iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
 
        ret = iwl_poll_bit(trans, CSR_RESET,
-                       CSR_RESET_REG_FLAG_MASTER_DISABLED,
-                       CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
+                          CSR_RESET_REG_FLAG_MASTER_DISABLED,
+                          CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
        if (ret)
                IWL_WARN(trans, "Master Disable Timed Out, 100 usec\n");
 
@@ -816,8 +809,7 @@ static int iwl_nic_init(struct iwl_trans *trans)
        iwl_apm_init(trans);
 
        /* Set interrupt coalescing calibration timer to default (512 usecs) */
-       iwl_write8(trans, CSR_INT_COALESCING,
-               IWL_HOST_INT_CALIB_TIMEOUT_DEF);
+       iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_CALIB_TIMEOUT_DEF);
 
        spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
 
@@ -836,8 +828,8 @@ static int iwl_nic_init(struct iwl_trans *trans)
 
        if (trans->cfg->base_params->shadow_reg_enable) {
                /* enable shadow regs in HW */
-               iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL,
-                       0x800FFFFF);
+               iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, 0x800FFFFF);
+               IWL_DEBUG_INFO(trans, "Enabling shadow registers in device\n");
        }
 
        return 0;
@@ -851,13 +843,13 @@ static int iwl_set_hw_ready(struct iwl_trans *trans)
        int ret;
 
        iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
-               CSR_HW_IF_CONFIG_REG_BIT_NIC_READY);
+                   CSR_HW_IF_CONFIG_REG_BIT_NIC_READY);
 
        /* See if we got it */
        ret = iwl_poll_bit(trans, CSR_HW_IF_CONFIG_REG,
-                               CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
-                               CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
-                               HW_READY_TIMEOUT);
+                          CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
+                          CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
+                          HW_READY_TIMEOUT);
 
        IWL_DEBUG_INFO(trans, "hardware%s ready\n", ret < 0 ? " not" : "");
        return ret;
@@ -877,11 +869,11 @@ static int iwl_prepare_card_hw(struct iwl_trans *trans)
 
        /* If HW is not ready, prepare the conditions to check again */
        iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
-                       CSR_HW_IF_CONFIG_REG_PREPARE);
+                   CSR_HW_IF_CONFIG_REG_PREPARE);
 
        ret = iwl_poll_bit(trans, CSR_HW_IF_CONFIG_REG,
-                       ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE,
-                       CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000);
+                          ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE,
+                          CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000);
 
        if (ret < 0)
                return ret;
@@ -908,32 +900,33 @@ static int iwl_load_section(struct iwl_trans *trans, u8 section_num,
        trans_pcie->ucode_write_complete = false;
 
        iwl_write_direct32(trans,
-               FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
-               FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE);
+                          FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
+                          FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE);
 
        iwl_write_direct32(trans,
-               FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), dst_addr);
+                          FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL),
+                          dst_addr);
 
        iwl_write_direct32(trans,
                FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL),
                phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK);
 
        iwl_write_direct32(trans,
-               FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL),
-               (iwl_get_dma_hi_addr(phy_addr)
-                       << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt);
+                          FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL),
+                          (iwl_get_dma_hi_addr(phy_addr)
+                               << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt);
 
        iwl_write_direct32(trans,
-               FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL),
-               1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM |
-               1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX |
-               FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID);
+                          FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL),
+                          1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM |
+                          1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX |
+                          FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID);
 
        iwl_write_direct32(trans,
-               FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
-               FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE       |
-               FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE    |
-               FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD);
+                          FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
+                          FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE    |
+                          FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE |
+                          FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD);
 
        IWL_DEBUG_FW(trans, "[%d] uCode section being loaded...\n",
                     section_num);
@@ -1070,7 +1063,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
                           reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
 
        iwl_write_prph(trans, SCD_QUEUECHAIN_SEL,
-               SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie));
+                      SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie));
        iwl_write_prph(trans, SCD_AGGR_SEL, 0);
 
        /* initiate the queues */
@@ -1091,7 +1084,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
        }
 
        iwl_write_prph(trans, SCD_INTERRUPT_MASK,
-                       IWL_MASK(0, trans->cfg->base_params->num_of_queues));
+                      IWL_MASK(0, trans->cfg->base_params->num_of_queues));
 
        /* Activate all Tx DMA/FIFO channels */
        iwl_trans_txq_set_sched(trans, IWL_MASK(0, 7));
@@ -1115,7 +1108,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
 
        /* Enable L1-Active */
        iwl_clear_bits_prph(trans, APMG_PCIDEV_STT_REG,
-                         APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
+                           APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
 }
 
 static void iwl_trans_pcie_fw_alive(struct iwl_trans *trans)
@@ -1129,9 +1122,9 @@ static void iwl_trans_pcie_fw_alive(struct iwl_trans *trans)
  */
 static int iwl_trans_tx_stop(struct iwl_trans *trans)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        int ch, txq_id, ret;
        unsigned long flags;
-       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
        /* Turn off all Tx DMA fifos */
        spin_lock_irqsave(&trans_pcie->irq_lock, flags);
@@ -1143,13 +1136,13 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans)
                iwl_write_direct32(trans,
                                   FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0);
                ret = iwl_poll_direct_bit(trans, FH_TSSR_TX_STATUS_REG,
-                                   FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch),
-                                   1000);
+                       FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), 1000);
                if (ret < 0)
-                       IWL_ERR(trans, "Failing on timeout while stopping"
-                           " DMA channel %d [0x%08x]", ch,
-                           iwl_read_direct32(trans,
-                                             FH_TSSR_TX_STATUS_REG));
+                       IWL_ERR(trans,
+                               "Failing on timeout while stopping DMA channel %d [0x%08x]",
+                               ch,
+                               iwl_read_direct32(trans,
+                                                 FH_TSSR_TX_STATUS_REG));
        }
        spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
 
@@ -1168,8 +1161,8 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans)
 
 static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
 {
-       unsigned long flags;
        struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+       unsigned long flags;
 
        /* tell the device to stop sending interrupts */
        spin_lock_irqsave(&trans_pcie->irq_lock, flags);
@@ -1199,7 +1192,7 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
 
        /* Make sure (redundant) we've released our request to stay awake */
        iwl_clear_bit(trans, CSR_GP_CNTRL,
-                       CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+                     CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
 
        /* Stop the device, and put it in low power state */
        iwl_apm_stop(trans);
@@ -1273,8 +1266,9 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
        txq->entries[q->write_ptr].cmd = dev_cmd;
 
        dev_cmd->hdr.cmd = REPLY_TX;
-       dev_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) |
-                               INDEX_TO_SEQ(q->write_ptr)));
+       dev_cmd->hdr.sequence =
+               cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) |
+                           INDEX_TO_SEQ(q->write_ptr)));
 
        /* Set up first empty entry in queue's array of Tx/cmd buffers */
        out_meta = &txq->entries[q->write_ptr].meta;
@@ -1339,7 +1333,7 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
 
        /* take back ownership of DMA buffer to enable update */
        dma_sync_single_for_cpu(trans->dev, txcmd_phys, firstlen,
-                       DMA_BIDIRECTIONAL);
+                               DMA_BIDIRECTIONAL);
        tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys);
        tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys);
 
@@ -1351,7 +1345,7 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
        iwl_trans_txq_update_byte_cnt_tbl(trans, txq, le16_to_cpu(tx_cmd->len));
 
        dma_sync_single_for_device(trans->dev, txcmd_phys, firstlen,
-                       DMA_BIDIRECTIONAL);
+                                  DMA_BIDIRECTIONAL);
 
        trace_iwlwifi_dev_tx(trans->dev,
                             &((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr],
@@ -1390,8 +1384,7 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
 
 static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        int err;
        bool hw_rfkill;
 
@@ -1404,7 +1397,7 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
                iwl_alloc_isr_ict(trans);
 
                err = request_irq(trans_pcie->irq, iwl_isr_ict, IRQF_SHARED,
-                       DRV_NAME, trans);
+                                 DRV_NAME, trans);
                if (err) {
                        IWL_ERR(trans, "Error allocating IRQ %d\n",
                                trans_pcie->irq);
@@ -1442,9 +1435,9 @@ error:
 static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans,
                                   bool op_mode_leaving)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        bool hw_rfkill;
        unsigned long flags;
-       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
        iwl_apm_stop(trans);
 
@@ -1548,8 +1541,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans,
 
 void iwl_trans_pcie_free(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
        iwl_trans_pcie_tx_free(trans);
 #ifndef CONFIG_IWLWIFI_IDI
@@ -1811,8 +1803,8 @@ static const struct file_operations iwl_dbgfs_##name##_ops = {            \
 };
 
 static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
-                                               char __user *user_buf,
-                                               size_t count, loff_t *ppos)
+                                      char __user *user_buf,
+                                      size_t count, loff_t *ppos)
 {
        struct iwl_trans *trans = file->private_data;
        struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
@@ -1848,11 +1840,11 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
 }
 
 static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
-                                               char __user *user_buf,
-                                               size_t count, loff_t *ppos) {
+                                      char __user *user_buf,
+                                      size_t count, loff_t *ppos)
+{
        struct iwl_trans *trans = file->private_data;
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rx_queue *rxq = &trans_pcie->rxq;
        char buf[256];
        int pos = 0;
@@ -1876,11 +1868,10 @@ static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
 
 static ssize_t iwl_dbgfs_interrupt_read(struct file *file,
                                        char __user *user_buf,
-                                       size_t count, loff_t *ppos) {
-
+                                       size_t count, loff_t *ppos)
+{
        struct iwl_trans *trans = file->private_data;
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
 
        int pos = 0;
@@ -1938,8 +1929,7 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
                                         size_t count, loff_t *ppos)
 {
        struct iwl_trans *trans = file->private_data;
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
 
        char buf[8];
@@ -1959,8 +1949,8 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
 }
 
 static ssize_t iwl_dbgfs_csr_write(struct file *file,
-                                        const char __user *user_buf,
-                                        size_t count, loff_t *ppos)
+                                  const char __user *user_buf,
+                                  size_t count, loff_t *ppos)
 {
        struct iwl_trans *trans = file->private_data;
        char buf[8];
@@ -1980,8 +1970,8 @@ static ssize_t iwl_dbgfs_csr_write(struct file *file,
 }
 
 static ssize_t iwl_dbgfs_fh_reg_read(struct file *file,
-                                        char __user *user_buf,
-                                        size_t count, loff_t *ppos)
+                                    char __user *user_buf,
+                                    size_t count, loff_t *ppos)
 {
        struct iwl_trans *trans = file->private_data;
        char *buf;
@@ -2024,7 +2014,7 @@ DEBUGFS_WRITE_FILE_OPS(fw_restart);
  *
  */
 static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,
-                                       struct dentry *dir)
+                                        struct dentry *dir)
 {
        DEBUGFS_ADD_FILE(rx_queue, dir, S_IRUSR);
        DEBUGFS_ADD_FILE(tx_queue, dir, S_IRUSR);
@@ -2036,9 +2026,10 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,
 }
 #else
 static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,
-                                       struct dentry *dir)
-{ return 0; }
-
+                                        struct dentry *dir)
+{
+       return 0;
+}
 #endif /*CONFIG_IWLWIFI_DEBUGFS */
 
 static const struct iwl_trans_ops trans_ops_pcie = {
@@ -2083,7 +2074,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
        int err;
 
        trans = kzalloc(sizeof(struct iwl_trans) +
-                            sizeof(struct iwl_trans_pcie), GFP_KERNEL);
+                       sizeof(struct iwl_trans_pcie), GFP_KERNEL);
 
        if (WARN_ON(!trans))
                return NULL;
@@ -2099,7 +2090,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
        /* W/A - seems to solve weird behavior. We need to remove this if we
         * don't want to stay in L1 all the time. This wastes a lot of power */
        pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
-                               PCIE_LINK_STATE_CLKPM);
+                              PCIE_LINK_STATE_CLKPM);
 
        if (pci_enable_device(pdev)) {
                err = -ENODEV;
@@ -2115,7 +2106,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
                err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
                if (!err)
                        err = pci_set_consistent_dma_mask(pdev,
-                                                       DMA_BIT_MASK(32));
+                                                         DMA_BIT_MASK(32));
                /* both attempts failed: */
                if (err) {
                        dev_printk(KERN_ERR, &pdev->dev,
@@ -2138,13 +2129,13 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
        }
 
        dev_printk(KERN_INFO, &pdev->dev,
-               "pci_resource_len = 0x%08llx\n",
-               (unsigned long long) pci_resource_len(pdev, 0));
+                  "pci_resource_len = 0x%08llx\n",
+                  (unsigned long long) pci_resource_len(pdev, 0));
        dev_printk(KERN_INFO, &pdev->dev,
-               "pci_resource_base = %p\n", trans_pcie->hw_base);
+                  "pci_resource_base = %p\n", trans_pcie->hw_base);
 
        dev_printk(KERN_INFO, &pdev->dev,
-               "HW Revision ID = 0x%X\n", pdev->revision);
+                  "HW Revision ID = 0x%X\n", pdev->revision);
 
        /* We disable the RETRY_TIMEOUT register (0x41) to keep
         * PCI Tx retries from interfering with C3 CPU state */
@@ -2153,7 +2144,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
        err = pci_enable_msi(pdev);
        if (err)
                dev_printk(KERN_ERR, &pdev->dev,
-                       "pci_enable_msi failed(0X%x)", err);
+                          "pci_enable_msi failed(0X%x)", err);
 
        trans->dev = &pdev->dev;
        trans_pcie->irq = pdev->irq;
@@ -2185,4 +2176,3 @@ out_no_pci:
        kfree(trans);
        return NULL;
 }
-
index 79a1e7ae4995d615b2e46370bd786350239ecf73..0aeeb7ce91c7373510d0bec56d4309a3a65e2203 100644 (file)
@@ -154,6 +154,9 @@ struct iwl_cmd_header {
        __le16 sequence;
 } __packed;
 
+/* iwl_cmd_header flags value */
+#define IWL_CMD_FAILED_MSK 0x40
+
 
 #define FH_RSCSR_FRAME_SIZE_MSK                0x00003FFF      /* bits 0-13 */
 #define FH_RSCSR_FRAME_INVALID         0x55550000
@@ -280,6 +283,8 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
 
 #define MAX_NO_RECLAIM_CMDS    6
 
+#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
+
 /*
  * Maximum number of HW queues the transport layer
  * currently supports
index 9348521e083275f6dff971cc5c8283a68cacf1c5..6403f49da41946284242e432843466a7f40a0e8d 100644 (file)
@@ -51,6 +51,7 @@
  * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390)
  * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392)
  * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662)
+ * RF5360 2.4G 1T1R
  * RF5370 2.4G 1T1R
  * RF5390 2.4G 1T1R
  */
@@ -67,6 +68,7 @@
 #define RF3320                         0x000b
 #define RF3322                         0x000c
 #define RF3053                         0x000d
+#define RF5360                         0x5360
 #define RF5370                         0x5370
 #define RF5372                         0x5372
 #define RF5390                         0x5390
index dfc90d34be6d31def8590d85a413a38067de8ed4..11488e743f08be808681d91551f6abd8f29beb35 100644 (file)
@@ -2060,6 +2060,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
        case RF3052:
                rt2800_config_channel_rf3052(rt2x00dev, conf, rf, info);
                break;
+       case RF5360:
        case RF5370:
        case RF5372:
        case RF5390:
@@ -2549,6 +2550,7 @@ void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev)
                rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);
                rt2800_rfcsr_write(rt2x00dev, 7, rfcsr);
                break;
+       case RF5360:
        case RF5370:
        case RF5372:
        case RF5390:
@@ -4263,6 +4265,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
        case RF3022:
        case RF3052:
        case RF3320:
+       case RF5360:
        case RF5370:
        case RF5372:
        case RF5390:
@@ -4577,6 +4580,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
                   rt2x00_rf(rt2x00dev, RF3021) ||
                   rt2x00_rf(rt2x00dev, RF3022) ||
                   rt2x00_rf(rt2x00dev, RF3320) ||
+                  rt2x00_rf(rt2x00dev, RF5360) ||
                   rt2x00_rf(rt2x00dev, RF5370) ||
                   rt2x00_rf(rt2x00dev, RF5372) ||
                   rt2x00_rf(rt2x00dev, RF5390)) {
@@ -4662,6 +4666,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
        case RF3022:
        case RF3320:
        case RF3052:
+       case RF5360:
        case RF5370:
        case RF5372:
        case RF5390:
index cad25bfebd7a4f900917057b69257f5ed8f0c5ce..206158b674268403aa46d237da3a81981a9b4bdd 100644 (file)
@@ -1188,6 +1188,7 @@ static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = {
        { PCI_DEVICE(0x1814, 0x3593) },
 #endif
 #ifdef CONFIG_RT2800PCI_RT53XX
+       { PCI_DEVICE(0x1814, 0x5360) },
        { PCI_DEVICE(0x1814, 0x5362) },
        { PCI_DEVICE(0x1814, 0x5390) },
        { PCI_DEVICE(0x1814, 0x5392) },
index bf78317a6adbfccd5e179d5a2482718880e8bfdd..20a5040728954a2203cd3450a3c12ad2b10d233d 100644 (file)
@@ -1137,6 +1137,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
 #ifdef CONFIG_RT2800USB_RT33XX
        /* Belkin */
        { USB_DEVICE(0x050d, 0x945b) },
+       /* D-Link */
+       { USB_DEVICE(0x2001, 0x3c17) },
        /* Panasonic */
        { USB_DEVICE(0x083a, 0xb511) },
        /* Philips */
@@ -1237,7 +1239,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
        /* D-Link */
        { USB_DEVICE(0x07d1, 0x3c0b) },
        { USB_DEVICE(0x07d1, 0x3c17) },
-       { USB_DEVICE(0x2001, 0x3c17) },
        /* Encore */
        { USB_DEVICE(0x203d, 0x14a1) },
        /* Gemtek */
index a6959f72745e1583525dc8c70565757123389915..85e5037a218d5e416a2d8b6d83f59dcf82b74b62 100644 (file)
  *     %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS,
  *     %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
  *     %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT.
+ *     The channel to use can be set on the interface or be given using the
+ *     %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_WIPHY_CHANNEL_TYPE attrs.
  * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
  * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface
  * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
@@ -2534,10 +2536,14 @@ enum nl80211_attr_cqm {
  *      configured threshold
  * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the
  *      configured threshold
+ * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: The device experienced beacon loss.
+ *     (Note that deauth/disassoc will still follow if the AP is not
+ *     available. This event might get used as roaming event, etc.)
  */
 enum nl80211_cqm_rssi_threshold_event {
        NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
        NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
+       NL80211_CQM_RSSI_BEACON_LOSS_EVENT,
 };
 
 
index 0289d4ce70706be603059b2ea9fdd63d57aa019e..4c90c44b8b75bef0ae78af760b76c78298d6999f 100644 (file)
@@ -404,6 +404,8 @@ struct cfg80211_beacon_data {
  *
  * Used to configure an AP interface.
  *
+ * @channel: the channel to start the AP on
+ * @channel_type: the channel type to use
  * @beacon: beacon data
  * @beacon_interval: beacon interval
  * @dtim_period: DTIM period
@@ -417,6 +419,9 @@ struct cfg80211_beacon_data {
  * @inactivity_timeout: time in seconds to determine station's inactivity.
  */
 struct cfg80211_ap_settings {
+       struct ieee80211_channel *channel;
+       enum nl80211_channel_type channel_type;
+
        struct cfg80211_beacon_data beacon;
 
        int beacon_interval, dtim_period;
@@ -826,6 +831,8 @@ struct mesh_config {
 
 /**
  * struct mesh_setup - 802.11s mesh setup configuration
+ * @channel: the channel to start the mesh network on
+ * @channel_type: the channel type to use
  * @mesh_id: the mesh ID
  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
  * @sync_method: which synchronization method to use
@@ -840,6 +847,8 @@ struct mesh_config {
  * These parameters are fixed when the mesh is created.
  */
 struct mesh_setup {
+       struct ieee80211_channel *channel;
+       enum nl80211_channel_type channel_type;
        const u8 *mesh_id;
        u8 mesh_id_len;
        u8 sync_method;
@@ -2263,7 +2272,10 @@ struct cfg80211_cached_keys;
  * @netdev: (private) Used to reference back to the netdev
  * @current_bss: (private) Used by the internal configuration code
  * @channel: (private) Used by the internal configuration code to track
- *     user-set AP, monitor and WDS channels for wireless extensions
+ *     the user-set AP, monitor and WDS channel
+ * @preset_chan: (private) Used by the internal configuration code to
+ *     track the channel to be used for AP later
+ * @preset_chantype: (private) the corresponding channel type
  * @bssid: (private) Used by the internal configuration code
  * @ssid: (private) Used by the internal configuration code
  * @ssid_len: (private) Used by the internal configuration code
@@ -2314,6 +2326,8 @@ struct wireless_dev {
 
        struct cfg80211_internal_bss *current_bss; /* associated / joined */
        struct ieee80211_channel *channel;
+       struct ieee80211_channel *preset_chan;
+       enum nl80211_channel_type preset_chantype;
 
        bool ps;
        int ps_timeout;
@@ -3359,11 +3373,14 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
                                 const u8 *frame, size_t len,
                                 int freq, int sig_dbm, gfp_t gfp);
 
-/*
+/**
  * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used
  * @wiphy: the wiphy
  * @chan: main channel
  * @channel_type: HT mode
+ *
+ * This function returns true if there is no secondary channel or the secondary
+ * channel can be used for beaconing (i.e. is not a radar channel etc.)
  */
 bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
                                  struct ieee80211_channel *chan,
index 1937c7d98304fc0ecfd6d7315c9e3cbb9e93a557..d2ed86da8e4c313c4f1be62bd105c05af511dac8 100644 (file)
@@ -1297,6 +1297,10 @@ enum ieee80211_hw_flags {
  *     reports, by default it is set to _MCS, _GI and _BW but doesn't
  *     include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only
  *     adding _BW is supported today.
+ *
+ * @netdev_features: netdev features to be set in each netdev created
+ *     from this HW. Note only HW checksum features are currently
+ *     compatible with mac80211. Other feature bits will be rejected.
  */
 struct ieee80211_hw {
        struct ieee80211_conf conf;
@@ -1319,6 +1323,7 @@ struct ieee80211_hw {
        u8 max_tx_aggregation_subframes;
        u8 offchannel_tx_hw_queue;
        u8 radiotap_mcs_details;
+       netdev_features_t netdev_features;
 };
 
 /**
@@ -3550,16 +3555,6 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
                               enum nl80211_cqm_rssi_threshold_event rssi_event,
                               gfp_t gfp);
 
-/**
- * ieee80211_get_operstate - get the operstate of the vif
- *
- * @vif: &struct ieee80211_vif pointer from the add_interface callback.
- *
- * The driver might need to know the operstate of the net_device
- * (specifically, whether the link is IF_OPER_UP after resume)
- */
-unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif);
-
 /**
  * ieee80211_chswitch_done - Complete channel switch process
  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
@@ -3839,4 +3834,28 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
  */
 int ieee80211_ave_rssi(struct ieee80211_vif *vif);
 
+/* Extra debugging macros */
+
+#ifdef CONFIG_MAC80211_HT_DEBUG
+#define ht_vdbg(fmt, ...)                      \
+       pr_debug(fmt, ##__VA_ARGS__)
+#else
+#define ht_vdbg(fmt, ...)                      \
+do {                                           \
+       if (0)                                  \
+               pr_debug(fmt, ##__VA_ARGS__);   \
+} while (0)
+#endif
+
+#ifdef CONFIG_MAC80211_IBSS_DEBUG
+#define ibss_vdbg(fmt, ...)                    \
+       pr_debug(fmt, ##__VA_ARGS__)
+#else
+#define ibss_vdbg(fmt, ...)                    \
+do {                                           \
+       if (0)                                  \
+               pr_debug(fmt, ##__VA_ARGS__);   \
+} while (0)
+#endif
+
 #endif /* MAC80211_H */
index fdf9e61d0651fab74e2836593a872586cd8efec3..72607174ea5a4af158855f588b767b5c4c86d973 100644 (file)
@@ -417,72 +417,6 @@ static struct attribute_group netstat_group = {
        .name  = "statistics",
        .attrs  = netstat_attrs,
 };
-
-#ifdef CONFIG_WIRELESS_EXT_SYSFS
-/* helper function that does all the locking etc for wireless stats */
-static ssize_t wireless_show(struct device *d, char *buf,
-                            ssize_t (*format)(const struct iw_statistics *,
-                                              char *))
-{
-       struct net_device *dev = to_net_dev(d);
-       const struct iw_statistics *iw;
-       ssize_t ret = -EINVAL;
-
-       if (!rtnl_trylock())
-               return restart_syscall();
-       if (dev_isalive(dev)) {
-               iw = get_wireless_stats(dev);
-               if (iw)
-                       ret = (*format)(iw, buf);
-       }
-       rtnl_unlock();
-
-       return ret;
-}
-
-/* show function template for wireless fields */
-#define WIRELESS_SHOW(name, field, format_string)                      \
-static ssize_t format_iw_##name(const struct iw_statistics *iw, char *buf) \
-{                                                                      \
-       return sprintf(buf, format_string, iw->field);                  \
-}                                                                      \
-static ssize_t show_iw_##name(struct device *d,                                \
-                             struct device_attribute *attr, char *buf) \
-{                                                                      \
-       return wireless_show(d, buf, format_iw_##name);                 \
-}                                                                      \
-static DEVICE_ATTR(name, S_IRUGO, show_iw_##name, NULL)
-
-WIRELESS_SHOW(status, status, fmt_hex);
-WIRELESS_SHOW(link, qual.qual, fmt_dec);
-WIRELESS_SHOW(level, qual.level, fmt_dec);
-WIRELESS_SHOW(noise, qual.noise, fmt_dec);
-WIRELESS_SHOW(nwid, discard.nwid, fmt_dec);
-WIRELESS_SHOW(crypt, discard.code, fmt_dec);
-WIRELESS_SHOW(fragment, discard.fragment, fmt_dec);
-WIRELESS_SHOW(misc, discard.misc, fmt_dec);
-WIRELESS_SHOW(retries, discard.retries, fmt_dec);
-WIRELESS_SHOW(beacon, miss.beacon, fmt_dec);
-
-static struct attribute *wireless_attrs[] = {
-       &dev_attr_status.attr,
-       &dev_attr_link.attr,
-       &dev_attr_level.attr,
-       &dev_attr_noise.attr,
-       &dev_attr_nwid.attr,
-       &dev_attr_crypt.attr,
-       &dev_attr_fragment.attr,
-       &dev_attr_retries.attr,
-       &dev_attr_misc.attr,
-       &dev_attr_beacon.attr,
-       NULL
-};
-
-static struct attribute_group wireless_group = {
-       .name = "wireless",
-       .attrs = wireless_attrs,
-};
-#endif
 #endif /* CONFIG_SYSFS */
 
 #ifdef CONFIG_RPS
@@ -1463,14 +1397,6 @@ int netdev_register_kobject(struct net_device *net)
                groups++;
 
        *groups++ = &netstat_group;
-#ifdef CONFIG_WIRELESS_EXT_SYSFS
-       if (net->ieee80211_ptr)
-               *groups++ = &wireless_group;
-#ifdef CONFIG_WIRELESS_EXT
-       else if (net->wireless_handlers)
-               *groups++ = &wireless_group;
-#endif
-#endif
 #endif /* CONFIG_SYSFS */
 
        error = device_add(dev);
index c649188314cce99c17fca198e75d597c24701197..32ef11d69798322bd92a84414f444892452c063c 100644 (file)
@@ -74,18 +74,15 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
 
        RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL);
 
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG
-              "Rx BA session stop requested for %pM tid %u %s reason: %d\n",
-              sta->sta.addr, tid,
-              initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator",
-              (int)reason);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
+       ht_vdbg("Rx BA session stop requested for %pM tid %u %s reason: %d\n",
+               sta->sta.addr, tid,
+               initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator",
+               (int)reason);
 
        if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP,
                             &sta->sta, tid, NULL, 0))
-               printk(KERN_DEBUG "HW problem - can not stop rx "
-                               "aggregation for tid %d\n", tid);
+               pr_debug("HW problem - can not stop rx aggregation for tid %d\n",
+                        tid);
 
        /* check if this is a self generated aggregation halt */
        if (initiator == WLAN_BACK_RECIPIENT && tx)
@@ -160,9 +157,8 @@ static void sta_rx_agg_session_timer_expired(unsigned long data)
        }
        rcu_read_unlock();
 
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid);
-#endif
+       ht_vdbg("rx session timer expired on tid %d\n", (u16)*ptid);
+
        set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired);
        ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work);
 }
@@ -249,10 +245,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
        status = WLAN_STATUS_REQUEST_DECLINED;
 
        if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Suspend in progress. "
-                      "Denying ADDBA request\n");
-#endif
+               ht_vdbg("Suspend in progress - Denying ADDBA request\n");
                goto end_no_lock;
        }
 
@@ -324,10 +317,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
 
        ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START,
                               &sta->sta, tid, &start_seq_num, 0);
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-
+       ht_vdbg("Rx A-MPDU request on tid %d result %d\n", tid, ret);
        if (ret) {
                kfree(tid_agg_rx->reorder_buf);
                kfree(tid_agg_rx->reorder_time);
index 7cf07158805c198e827af160a9f705881c4b20fa..da07f01cfe4d155e7339b30fca4a4377dc3b7608 100644 (file)
@@ -184,10 +184,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
 
        spin_unlock_bh(&sta->lock);
 
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
-              sta->sta.addr, tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
+       ht_vdbg("Tx BA session stop requested for %pM tid %u\n",
+               sta->sta.addr, tid);
 
        del_timer_sync(&tid_tx->addba_resp_timer);
        del_timer_sync(&tid_tx->session_timer);
@@ -253,17 +251,12 @@ static void sta_addba_resp_timer_expired(unsigned long data)
        if (!tid_tx ||
            test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) {
                rcu_read_unlock();
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "timer expired on tid %d but we are not "
-                               "(or no longer) expecting addBA response there\n",
+               ht_vdbg("timer expired on tid %d but we are not (or no longer) expecting addBA response there\n",
                        tid);
-#endif
                return;
        }
 
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid);
-#endif
+       ht_vdbg("addBA response timer expired on tid %d\n", tid);
 
        ieee80211_stop_tx_ba_session(&sta->sta, tid);
        rcu_read_unlock();
@@ -372,10 +365,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
        ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START,
                               &sta->sta, tid, &start_seq_num, 0);
        if (ret) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "BA request denied - HW unavailable for"
-                                       " tid %d\n", tid);
-#endif
+               ht_vdbg("BA request denied - HW unavailable for tid %d\n", tid);
                spin_lock_bh(&sta->lock);
                ieee80211_agg_splice_packets(sdata, tid_tx, tid);
                ieee80211_assign_tid_tx(sta, tid, NULL);
@@ -388,9 +378,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
 
        /* activate the timer for the recipient's addBA response */
        mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL);
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid);
-#endif
+       ht_vdbg("activated addBA response timer on tid %d\n", tid);
 
        spin_lock_bh(&sta->lock);
        sta->ampdu_mlme.last_addba_req_time[tid] = jiffies;
@@ -437,9 +425,7 @@ static void sta_tx_agg_session_timer_expired(unsigned long data)
 
        rcu_read_unlock();
 
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "tx session timer expired on tid %d\n", (u16)*ptid);
-#endif
+       ht_vdbg("tx session timer expired on tid %d\n", (u16)*ptid);
 
        ieee80211_stop_tx_ba_session(&sta->sta, *ptid);
 }
@@ -463,10 +449,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
            (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW))
                return -EINVAL;
 
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Open BA session requested for %pM tid %u\n",
-              pubsta->addr, tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
+       ht_vdbg("Open BA session requested for %pM tid %u\n",
+               pubsta->addr, tid);
 
        if (sdata->vif.type != NL80211_IFTYPE_STATION &&
            sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
@@ -476,10 +460,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
                return -EINVAL;
 
        if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "BA sessions blocked. "
-                      "Denying BA session request\n");
-#endif
+               ht_vdbg("BA sessions blocked - Denying BA session request\n");
                return -EINVAL;
        }
 
@@ -497,10 +478,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
         */
        if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC &&
            !sta->sta.ht_cap.ht_supported) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "BA request denied - IBSS STA %pM"
-                      "does not advertise HT support\n", pubsta->addr);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
+               ht_vdbg("BA request denied - IBSS STA %pM does not advertise HT support\n",
+                       pubsta->addr);
                return -EINVAL;
        }
 
@@ -520,12 +499,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
        if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES &&
            time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] +
                        HT_AGG_RETRIES_PERIOD)) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "BA request denied - "
-                      "waiting a grace period after %d failed requests "
-                      "on tid %u\n",
-                      sta->ampdu_mlme.addba_req_num[tid], tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
+               ht_vdbg("BA request denied - waiting a grace period after %d failed requests on tid %u\n",
+                       sta->ampdu_mlme.addba_req_num[tid], tid);
                ret = -EBUSY;
                goto err_unlock_sta;
        }
@@ -533,10 +508,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
        tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
        /* check if the TID is not in aggregation flow already */
        if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "BA request denied - session is not "
-                                "idle on tid %u\n", tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
+               ht_vdbg("BA request denied - session is not idle on tid %u\n",
+                       tid);
                ret = -EAGAIN;
                goto err_unlock_sta;
        }
@@ -591,9 +564,7 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local,
 
        tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
 
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Aggregation is on for tid %d\n", tid);
-#endif
+       ht_vdbg("Aggregation is on for tid %d\n", tid);
 
        drv_ampdu_action(local, sta->sdata,
                         IEEE80211_AMPDU_TX_OPERATIONAL,
@@ -627,10 +598,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
        trace_api_start_tx_ba_cb(sdata, ra, tid);
 
        if (tid >= STA_TID_NUM) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
-                               tid, STA_TID_NUM);
-#endif
+               ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
                return;
        }
 
@@ -638,9 +606,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
        sta = sta_info_get_bss(sdata, ra);
        if (!sta) {
                mutex_unlock(&local->sta_mtx);
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Could not find station: %pM\n", ra);
-#endif
+               ht_vdbg("Could not find station: %pM\n", ra);
                return;
        }
 
@@ -648,9 +614,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
        tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
 
        if (WARN_ON(!tid_tx)) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "addBA was not requested!\n");
-#endif
+               ht_vdbg("addBA was not requested!\n");
                goto unlock;
        }
 
@@ -750,25 +714,17 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
        trace_api_stop_tx_ba_cb(sdata, ra, tid);
 
        if (tid >= STA_TID_NUM) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
-                               tid, STA_TID_NUM);
-#endif
+               ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
                return;
        }
 
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Stopping Tx BA session for %pM tid %d\n",
-              ra, tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
+       ht_vdbg("Stopping Tx BA session for %pM tid %d\n", ra, tid);
 
        mutex_lock(&local->sta_mtx);
 
        sta = sta_info_get_bss(sdata, ra);
        if (!sta) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Could not find station: %pM\n", ra);
-#endif
+               ht_vdbg("Could not find station: %pM\n", ra);
                goto unlock;
        }
 
@@ -777,9 +733,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
        tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
 
        if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n");
-#endif
+               ht_vdbg("unexpected callback to A-MPDU stop\n");
                goto unlock_sta;
        }
 
@@ -855,17 +809,13 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
                goto out;
 
        if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid);
-#endif
+               ht_vdbg("wrong addBA response token, tid %d\n", tid);
                goto out;
        }
 
        del_timer_sync(&tid_tx->addba_resp_timer);
 
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid);
-#endif
+       ht_vdbg("switched off addBA timer for tid %d\n", tid);
 
        /*
         * addba_resp_timer may have fired before we got here, and
@@ -874,11 +824,8 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
         */
        if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) ||
            test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG
-                      "got addBA resp for tid %d but we already gave up\n",
-                      tid);
-#endif
+               ht_vdbg("got addBA resp for tid %d but we already gave up\n",
+                       tid);
                goto out;
        }
 
index e9cecca5c44d1a4b9134de59c6ee9afb7418e0e5..50aea1ac7e03985017ab32cd6b5837fe77cd208e 100644 (file)
@@ -674,6 +674,41 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
        return ret;
 }
 
+static int ieee80211_set_channel(struct wiphy *wiphy,
+                                struct net_device *netdev,
+                                struct ieee80211_channel *chan,
+                                enum nl80211_channel_type channel_type)
+{
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata = NULL;
+
+       if (netdev)
+               sdata = IEEE80211_DEV_TO_SUB_IF(netdev);
+
+       switch (ieee80211_get_channel_mode(local, NULL)) {
+       case CHAN_MODE_HOPPING:
+               return -EBUSY;
+       case CHAN_MODE_FIXED:
+               if (local->oper_channel != chan)
+                       return -EBUSY;
+               if (!sdata && local->_oper_channel_type == channel_type)
+                       return 0;
+               break;
+       case CHAN_MODE_UNDEFINED:
+               break;
+       }
+
+       if (!ieee80211_set_channel_type(local, sdata, channel_type))
+               return -EBUSY;
+
+       local->oper_channel = chan;
+
+       /* auto-detects changes */
+       ieee80211_hw_config(local, 0);
+
+       return 0;
+}
+
 static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
                                    const u8 *resp, size_t resp_len)
 {
@@ -788,6 +823,11 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
        if (old)
                return -EALREADY;
 
+       err = ieee80211_set_channel(wiphy, dev, params->channel,
+                                   params->channel_type);
+       if (err)
+               return err;
+
        /*
         * Apply control port protocol, this allows us to
         * not encrypt dynamic WEP control frames.
@@ -1558,6 +1598,12 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
        err = copy_mesh_setup(ifmsh, setup);
        if (err)
                return err;
+
+       err = ieee80211_set_channel(wiphy, dev, setup->channel,
+                                   setup->channel_type);
+       if (err)
+               return err;
+
        ieee80211_start_mesh(sdata);
 
        return 0;
@@ -1677,55 +1723,6 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy,
        return 0;
 }
 
-static int ieee80211_set_channel(struct wiphy *wiphy,
-                                struct net_device *netdev,
-                                struct ieee80211_channel *chan,
-                                enum nl80211_channel_type channel_type)
-{
-       struct ieee80211_local *local = wiphy_priv(wiphy);
-       struct ieee80211_sub_if_data *sdata = NULL;
-       struct ieee80211_channel *old_oper;
-       enum nl80211_channel_type old_oper_type;
-       enum nl80211_channel_type old_vif_oper_type= NL80211_CHAN_NO_HT;
-
-       if (netdev)
-               sdata = IEEE80211_DEV_TO_SUB_IF(netdev);
-
-       switch (ieee80211_get_channel_mode(local, NULL)) {
-       case CHAN_MODE_HOPPING:
-               return -EBUSY;
-       case CHAN_MODE_FIXED:
-               if (local->oper_channel != chan)
-                       return -EBUSY;
-               if (!sdata && local->_oper_channel_type == channel_type)
-                       return 0;
-               break;
-       case CHAN_MODE_UNDEFINED:
-               break;
-       }
-
-       if (sdata)
-               old_vif_oper_type = sdata->vif.bss_conf.channel_type;
-       old_oper_type = local->_oper_channel_type;
-
-       if (!ieee80211_set_channel_type(local, sdata, channel_type))
-               return -EBUSY;
-
-       old_oper = local->oper_channel;
-       local->oper_channel = chan;
-
-       /* Update driver if changes were actually made. */
-       if ((old_oper != local->oper_channel) ||
-           (old_oper_type != local->_oper_channel_type))
-               ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
-
-       if (sdata && sdata->vif.type != NL80211_IFTYPE_MONITOR &&
-           old_vif_oper_type != sdata->vif.bss_conf.channel_type)
-               ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT);
-
-       return 0;
-}
-
 #ifdef CONFIG_PM
 static int ieee80211_suspend(struct wiphy *wiphy,
                             struct cfg80211_wowlan *wowlan)
@@ -2304,7 +2301,8 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
 
        IEEE80211_SKB_CB(skb)->flags = flags;
 
-       if (flags & IEEE80211_TX_CTL_TX_OFFCHAN)
+       if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL &&
+           flags & IEEE80211_TX_CTL_TX_OFFCHAN)
                IEEE80211_SKB_CB(skb)->hw_queue =
                        local->hw.offchannel_tx_hw_queue;
 
@@ -2349,8 +2347,9 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
                /* modify cookie to prevent API mismatches */
                *cookie ^= 2;
                IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_TX_OFFCHAN;
-               IEEE80211_SKB_CB(skb)->hw_queue =
-                       local->hw.offchannel_tx_hw_queue;
+               if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)
+                       IEEE80211_SKB_CB(skb)->hw_queue =
+                               local->hw.offchannel_tx_hw_queue;
                local->hw_roc_skb = skb;
                local->hw_roc_skb_for_status = skb;
                mutex_unlock(&local->mtx);
@@ -2677,7 +2676,7 @@ static int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
                return -EINVAL;
 
 #ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG
-       printk(KERN_DEBUG "TDLS mgmt action %d peer %pM\n", action_code, peer);
+       pr_debug("TDLS mgmt action %d peer %pM\n", action_code, peer);
 #endif
 
        skb = dev_alloc_skb(local->hw.extra_tx_headroom +
@@ -2788,7 +2787,7 @@ static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
                return -EINVAL;
 
 #ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG
-       printk(KERN_DEBUG "TDLS oper %d peer %pM\n", oper, peer);
+       pr_debug("TDLS oper %d peer %pM\n", oper, peer);
 #endif
 
        switch (oper) {
index c76cf7230c7db06c646c4b13b14b46bf670a0afa..f0f87e5a1d354eef6a705deba7a15c21b491093f 100644 (file)
@@ -41,6 +41,10 @@ __ieee80211_get_channel_mode(struct ieee80211_local *local,
                        if (!sdata->u.ap.beacon)
                                continue;
                        break;
+               case NL80211_IFTYPE_MESH_POINT:
+                       if (!sdata->wdev.mesh_id_len)
+                               continue;
+                       break;
                default:
                        break;
                }
index 7ed433c66d684a8c07168b7fb182d46c8b22060e..1a3b36154e73c8abbbfc9f74d18a904da51e0226 100644 (file)
@@ -685,6 +685,6 @@ void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)
 
        sprintf(buf, "netdev:%s", sdata->name);
        if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf))
-               printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs "
+               pr_err("mac80211: debugfs: failed to rename debugfs "
                       "dir to %s\n", buf);
 }
index 33d9d0c3e3d06ce70e831643473dc34ac201deed..725cb4be229dec4359830a4db5152ace6c56e2e7 100644 (file)
@@ -82,8 +82,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
 
        local->oper_channel = chan;
        channel_type = ifibss->channel_type;
-       if (channel_type > NL80211_CHAN_HT20 &&
-           !cfg80211_can_beacon_sec_chan(local->hw.wiphy, chan, channel_type))
+       if (!cfg80211_can_beacon_sec_chan(local->hw.wiphy, chan, channel_type))
                channel_type = NL80211_CHAN_HT20;
        if (!ieee80211_set_channel_type(local, sdata, channel_type)) {
                /* can only fail due to HT40+/- mismatch */
@@ -281,11 +280,8 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta,
        if (sta_info_insert_rcu(sta))
                return sta_info_get(sdata, addr);
        if (auth) {
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-               printk(KERN_DEBUG "TX Auth SA=%pM DA=%pM BSSID=%pM"
-                      "(auth_transaction=1)\n", sdata->vif.addr,
-                      sdata->u.ibss.bssid, addr);
-#endif
+               ibss_vdbg("TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n",
+                         sdata->vif.addr, sdata->u.ibss.bssid, addr);
                ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0,
                                    addr, sdata->u.ibss.bssid, NULL, 0, 0);
        }
@@ -355,11 +351,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
 
        if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
                return;
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-       printk(KERN_DEBUG "%s: RX Auth SA=%pM DA=%pM BSSID=%pM."
-              "(auth_transaction=%d)\n",
-              sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction);
-#endif
+       ibss_vdbg("%s: RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n",
+                 sdata->name, mgmt->sa, mgmt->da, mgmt->bssid,
+                 auth_transaction);
        sta_info_destroy_addr(sdata, mgmt->sa);
        ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false);
        rcu_read_unlock();
@@ -422,15 +416,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
                                        ieee80211_mandatory_rates(local, band);
 
                                if (sta->sta.supp_rates[band] != prev_rates) {
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-                                       printk(KERN_DEBUG
-                                               "%s: updated supp_rates set "
-                                               "for %pM based on beacon"
-                                               "/probe_resp (0x%x -> 0x%x)\n",
-                                               sdata->name, sta->sta.addr,
-                                               prev_rates,
-                                               sta->sta.supp_rates[band]);
-#endif
+                                       ibss_vdbg("%s: updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n",
+                                                 sdata->name, sta->sta.addr,
+                                                 prev_rates,
+                                                 sta->sta.supp_rates[band]);
                                        rates_updated = true;
                                }
                        } else {
@@ -545,22 +534,16 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
                rx_timestamp = drv_get_tsf(local, sdata);
        }
 
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-       printk(KERN_DEBUG "RX beacon SA=%pM BSSID="
-              "%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
-              mgmt->sa, mgmt->bssid,
-              (unsigned long long)rx_timestamp,
-              (unsigned long long)beacon_timestamp,
-              (unsigned long long)(rx_timestamp - beacon_timestamp),
-              jiffies);
-#endif
+       ibss_vdbg("RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
+                 mgmt->sa, mgmt->bssid,
+                 (unsigned long long)rx_timestamp,
+                 (unsigned long long)beacon_timestamp,
+                 (unsigned long long)(rx_timestamp - beacon_timestamp),
+                 jiffies);
 
        if (beacon_timestamp > rx_timestamp) {
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-               printk(KERN_DEBUG "%s: beacon TSF higher than "
-                      "local TSF - IBSS merge with BSSID %pM\n",
-                      sdata->name, mgmt->bssid);
-#endif
+               ibss_vdbg("%s: beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n",
+                         sdata->name, mgmt->bssid);
                ieee80211_sta_join_ibss(sdata, bss);
                supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL);
                ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
@@ -662,8 +645,8 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
        if (ifibss->fixed_channel)
                return;
 
-       printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
-              "IBSS networks with same SSID (merge)\n", sdata->name);
+       pr_debug("%s: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n",
+                sdata->name);
 
        ieee80211_request_internal_scan(sdata,
                        ifibss->ssid, ifibss->ssid_len, NULL);
@@ -691,8 +674,8 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
                bssid[0] |= 0x02;
        }
 
-       printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n",
-              sdata->name, bssid);
+       pr_debug("%s: Creating new IBSS network, BSSID %pM\n",
+                sdata->name, bssid);
 
        capability = WLAN_CAPABILITY_IBSS;
 
@@ -723,10 +706,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
        lockdep_assert_held(&ifibss->mtx);
 
        active_ibss = ieee80211_sta_active_ibss(sdata);
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-       printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n",
-              sdata->name, active_ibss);
-#endif /* CONFIG_MAC80211_IBSS_DEBUG */
+       ibss_vdbg("%s: sta_find_ibss (active_ibss=%d)\n",
+                 sdata->name, active_ibss);
 
        if (active_ibss)
                return;
@@ -749,29 +730,23 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
                struct ieee80211_bss *bss;
 
                bss = (void *)cbss->priv;
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-               printk(KERN_DEBUG "   sta_find_ibss: selected %pM current "
-                      "%pM\n", cbss->bssid, ifibss->bssid);
-#endif /* CONFIG_MAC80211_IBSS_DEBUG */
-
-               printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM"
-                      " based on configured SSID\n",
-                      sdata->name, cbss->bssid);
+               ibss_vdbg("   sta_find_ibss: selected %pM current %pM\n",
+                         cbss->bssid, ifibss->bssid);
+               pr_debug("%s: Selected IBSS BSSID %pM based on configured SSID\n",
+                        sdata->name, cbss->bssid);
 
                ieee80211_sta_join_ibss(sdata, bss);
                ieee80211_rx_bss_put(local, bss);
                return;
        }
 
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-       printk(KERN_DEBUG "   did not try to join ibss\n");
-#endif /* CONFIG_MAC80211_IBSS_DEBUG */
+       ibss_vdbg("   did not try to join ibss\n");
 
        /* Selected IBSS not found in current scan results - try to scan */
        if (time_after(jiffies, ifibss->last_scan_completed +
                                        IEEE80211_SCAN_INTERVAL)) {
-               printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to "
-                      "join\n", sdata->name);
+               pr_debug("%s: Trigger new scan to find an IBSS to join\n",
+                        sdata->name);
 
                ieee80211_request_internal_scan(sdata,
                                ifibss->ssid, ifibss->ssid_len,
@@ -785,9 +760,9 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
                                ieee80211_sta_create_ibss(sdata);
                                return;
                        }
-                       printk(KERN_DEBUG "%s: IBSS not allowed on"
-                              " %d MHz\n", sdata->name,
-                              local->hw.conf.channel->center_freq);
+                       pr_debug("%s: IBSS not allowed on %d MHz\n",
+                                sdata->name,
+                                local->hw.conf.channel->center_freq);
 
                        /* No IBSS found - decrease scan interval and continue
                         * scanning. */
@@ -822,12 +797,9 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
 
        tx_last_beacon = drv_tx_last_beacon(local);
 
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-       printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM"
-              " (tx_last_beacon=%d)\n",
-              sdata->name, mgmt->sa, mgmt->da,
-              mgmt->bssid, tx_last_beacon);
-#endif /* CONFIG_MAC80211_IBSS_DEBUG */
+       ibss_vdbg("%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n",
+                 sdata->name, mgmt->sa, mgmt->da,
+                 mgmt->bssid, tx_last_beacon);
 
        if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
                return;
@@ -840,11 +812,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
        pos = mgmt->u.probe_req.variable;
        if (pos[0] != WLAN_EID_SSID ||
            pos + 2 + pos[1] > end) {
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-               printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq "
-                      "from %pM\n",
-                      sdata->name, mgmt->sa);
-#endif
+               ibss_vdbg("%s: Invalid SSID IE in ProbeReq from %pM\n",
+                         sdata->name, mgmt->sa);
                return;
        }
        if (pos[1] != 0 &&
@@ -861,10 +830,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
 
        resp = (struct ieee80211_mgmt *) skb->data;
        memcpy(resp->da, mgmt->sa, ETH_ALEN);
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-       printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n",
-              sdata->name, resp->da);
-#endif /* CONFIG_MAC80211_IBSS_DEBUG */
+       ibss_vdbg("%s: Sending ProbeResp to %pM\n", sdata->name, resp->da);
        IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
        ieee80211_tx_skb(sdata, skb);
 }
index 3f3cd50fff16ec637b23f3a25bdf6ed4a8146296..8c026abcb8d9cdf1fbf3d93acb3fdf3a5e8cf047 100644 (file)
@@ -399,7 +399,6 @@ struct ieee80211_mgd_auth_data {
 struct ieee80211_mgd_assoc_data {
        struct cfg80211_bss *bss;
        const u8 *supp_rates;
-       const u8 *ht_operation_ie;
 
        unsigned long timeout;
        int tries;
@@ -414,6 +413,8 @@ struct ieee80211_mgd_assoc_data {
        bool sent_assoc;
        bool synced;
 
+       u8 ap_ht_param;
+
        size_t ie_len;
        u8 ie[];
 };
index 8664111d05663d47678f2088f4169a6ab80fdb96..ede5f4959904cd06261354757bd6879fdf6a937f 100644 (file)
@@ -58,7 +58,7 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
        }
 
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-       printk(KERN_DEBUG "%s: setting MTU %d\n", dev->name, new_mtu);
+       pr_debug("%s: setting MTU %d\n", dev->name, new_mtu);
 #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
        dev->mtu = new_mtu;
        return 0;
@@ -1238,7 +1238,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
 
                if (__ffs64(mask) + hweight64(mask) != fls64(mask)) {
                        /* not a contiguous mask ... not handled now! */
-                       printk(KERN_DEBUG "not contiguous\n");
+                       pr_debug("not contiguous\n");
                        break;
                }
 
@@ -1364,6 +1364,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
                        sdata->u.mgd.use_4addr = params->use_4addr;
        }
 
+       ndev->features |= local->hw.netdev_features;
+
        ret = register_netdevice(ndev);
        if (ret)
                goto fail;
index f5548e953259e6f517ed19a77286e8d7e0e1e531..779ac613ee57a1dd9003d426a5e4b9e4d3d4c24f 100644 (file)
@@ -682,6 +682,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        enum ieee80211_band band;
        int channels, max_bitrates;
        bool supp_ht;
+       netdev_features_t feature_whitelist;
        static const u32 cipher_suites[] = {
                /* keep WEP first, it may be removed below */
                WLAN_CIPHER_SUITE_WEP40,
@@ -708,6 +709,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        if ((hw->flags & IEEE80211_HW_SCAN_WHILE_IDLE) && !local->ops->hw_scan)
                return -EINVAL;
 
+       /* Only HW csum features are currently compatible with mac80211 */
+       feature_whitelist = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+                           NETIF_F_HW_CSUM;
+       if (WARN_ON(hw->netdev_features & ~feature_whitelist))
+               return -EINVAL;
+
        if (hw->max_report_rates == 0)
                hw->max_report_rates = hw->max_rates;
 
index 2913113c5833f220c5708af7d8686ab4196c3d50..7cf19509fb682f21d69716a7352b345127ed3f4c 100644 (file)
@@ -524,8 +524,7 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata,
        bool free_plinks;
 
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-       printk(KERN_DEBUG "%s: running mesh housekeeping\n",
-              sdata->name);
+       pr_debug("%s: running mesh housekeeping\n", sdata->name);
 #endif
 
        ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT);
index 9b59658e865094ffc3b8aafd29b777205a1a81de..fa7c58035246f37e6148f1a43a177dfba1e9fb51 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifdef CONFIG_MAC80211_VERBOSE_MHWMP_DEBUG
 #define mhwmp_dbg(fmt, args...) \
-       printk(KERN_DEBUG "Mesh HWMP (%s): " fmt "\n", sdata->name, ##args)
+       pr_debug("Mesh HWMP (%s): " fmt "\n", sdata->name, ##args)
 #else
 #define mhwmp_dbg(fmt, args...)   do { (void)(0); } while (0)
 #endif
index b39224d8255cb17701c19dbde7f80c00430abfc5..572f706fd65b5481faa70d72166d16741f2a3755 100644 (file)
@@ -19,7 +19,7 @@
 #include "mesh.h"
 
 #ifdef CONFIG_MAC80211_VERBOSE_MPATH_DEBUG
-#define mpath_dbg(fmt, args...)        printk(KERN_DEBUG fmt, ##args)
+#define mpath_dbg(fmt, args...)        pr_debug(fmt, ##args)
 #else
 #define mpath_dbg(fmt, args...)        do { (void)(0); } while (0)
 #endif
index 60ef235c9d9bd139d061301e49540003f8188a57..be4fad128c34d3ced45fdc7da3b26b01199b0eba 100644 (file)
@@ -14,7 +14,7 @@
 #include "mesh.h"
 
 #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
-#define mpl_dbg(fmt, args...)  printk(KERN_DEBUG fmt, ##args)
+#define mpl_dbg(fmt, args...)  pr_debug(fmt, ##args)
 #else
 #define mpl_dbg(fmt, args...)  do { (void)(0); } while (0)
 #endif
index 38d30e8ce6dc08f647777b6da179cc7dee56141b..0ccdad49f9870d3d0bf0c723f61cd53731875058 100644 (file)
@@ -14,7 +14,7 @@
 
 #ifdef CONFIG_MAC80211_VERBOSE_MESH_SYNC_DEBUG
 #define msync_dbg(fmt, args...) \
-       printk(KERN_DEBUG "Mesh sync (%s): " fmt "\n", sdata->name, ##args)
+       pr_debug("Mesh sync (%s): " fmt "\n", sdata->name, ##args)
 #else
 #define msync_dbg(fmt, args...)   do { (void)(0); } while (0)
 #endif
index d94627c2929cacdedba3b05491c23e5e27ed425d..da6bd81fec6dddbfb14b007c875ff533550b1956 100644 (file)
@@ -258,12 +258,11 @@ static int ieee80211_compatible_rates(const u8 *supp_rates, int supp_rates_len,
 }
 
 static void ieee80211_add_ht_ie(struct ieee80211_sub_if_data *sdata,
-                               struct sk_buff *skb, const u8 *ht_oper_ie,
+                               struct sk_buff *skb, u8 ap_ht_param,
                                struct ieee80211_supported_band *sband,
                                struct ieee80211_channel *channel,
                                enum ieee80211_smps_mode smps)
 {
-       struct ieee80211_ht_operation *ht_oper;
        u8 *pos;
        u32 flags = channel->flags;
        u16 cap;
@@ -271,21 +270,13 @@ static void ieee80211_add_ht_ie(struct ieee80211_sub_if_data *sdata,
 
        BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap));
 
-       if (!ht_oper_ie)
-               return;
-
-       if (ht_oper_ie[1] < sizeof(struct ieee80211_ht_operation))
-               return;
-
        memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap));
        ieee80211_apply_htcap_overrides(sdata, &ht_cap);
 
-       ht_oper = (struct ieee80211_ht_operation *)(ht_oper_ie + 2);
-
        /* determine capability flags */
        cap = ht_cap.cap;
 
-       switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
+       switch (ap_ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
        case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
                if (flags & IEEE80211_CHAN_NO_HT40PLUS) {
                        cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
@@ -509,7 +500,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
        }
 
        if (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
-               ieee80211_add_ht_ie(sdata, skb, assoc_data->ht_operation_ie,
+               ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param,
                                    sband, local->oper_channel, ifmgd->ap_smps);
 
        /* if present, add any custom non-vendor IEs that go after HT */
@@ -1585,6 +1576,8 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
                net_dbg_ratelimited("%s: detected beacon loss from AP - sending probe request\n",
                                    sdata->name);
 #endif
+       ieee80211_cqm_rssi_notify(&sdata->vif,
+               NL80211_CQM_RSSI_BEACON_LOSS_EVENT, GFP_KERNEL);
 
        /*
         * The driver/our work has already reported this event or the
@@ -1667,8 +1660,7 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata)
 
        memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
 
-       printk(KERN_DEBUG "%s: Connection to AP %pM lost.\n",
-              sdata->name, bssid);
+       pr_debug("%s: Connection to AP %pM lost\n", sdata->name, bssid);
 
        ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
                               WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
@@ -1802,9 +1794,10 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
                return RX_MGMT_NONE;
 
        if (status_code != WLAN_STATUS_SUCCESS) {
-               printk(KERN_DEBUG "%s: %pM denied authentication (status %d)\n",
-                      sdata->name, mgmt->sa, status_code);
-               goto out;
+               pr_debug("%s: %pM denied authentication (status %d)\n",
+                        sdata->name, mgmt->sa, status_code);
+               ieee80211_destroy_auth_data(sdata, false);
+               return RX_MGMT_CFG80211_RX_AUTH;
        }
 
        switch (ifmgd->auth_data->algorithm) {
@@ -1825,8 +1818,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
                return RX_MGMT_NONE;
        }
 
-       printk(KERN_DEBUG "%s: authenticated\n", sdata->name);
- out:
+       pr_debug("%s: authenticated\n", sdata->name);
        ifmgd->auth_data->done = true;
        ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
        run_again(ifmgd, ifmgd->auth_data->timeout);
@@ -1839,8 +1831,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
                goto out_err;
        }
        if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {
-               printk(KERN_DEBUG "%s: failed moving %pM to auth\n",
-                      sdata->name, bssid);
+               pr_debug("%s: failed moving %pM to auth\n", sdata->name, bssid);
                goto out_err;
        }
        mutex_unlock(&sdata->local->sta_mtx);
@@ -1874,8 +1865,8 @@ ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
 
        reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
 
-       printk(KERN_DEBUG "%s: deauthenticated from %pM (Reason: %u)\n",
-                       sdata->name, bssid, reason_code);
+       pr_debug("%s: deauthenticated from %pM (Reason: %u)\n",
+                sdata->name, bssid, reason_code);
 
        ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
 
@@ -1905,8 +1896,8 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
 
        reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
 
-       printk(KERN_DEBUG "%s: disassociated from %pM (Reason: %u)\n",
-                       sdata->name, mgmt->sa, reason_code);
+       pr_debug("%s: disassociated from %pM (Reason: %u)\n",
+                sdata->name, mgmt->sa, reason_code);
 
        ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
 
@@ -1998,17 +1989,15 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
        capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
 
        if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14)))
-               printk(KERN_DEBUG
-                      "%s: invalid AID value 0x%x; bits 15:14 not set\n",
-                      sdata->name, aid);
+               pr_debug("%s: invalid AID value 0x%x; bits 15:14 not set\n",
+                        sdata->name, aid);
        aid &= ~(BIT(15) | BIT(14));
 
        ifmgd->broken_ap = false;
 
        if (aid == 0 || aid > IEEE80211_MAX_AID) {
-               printk(KERN_DEBUG
-                      "%s: invalid AID value %d (out of range), turn off PS\n",
-                      sdata->name, aid);
+               pr_debug("%s: invalid AID value %d (out of range), turn off PS\n",
+                        sdata->name, aid);
                aid = 0;
                ifmgd->broken_ap = true;
        }
@@ -2017,8 +2006,8 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
        ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
 
        if (!elems.supp_rates) {
-               printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n",
-                      sdata->name);
+               pr_debug("%s: no SuppRates element in AssocResp\n",
+                        sdata->name);
                return false;
        }
 
@@ -2058,9 +2047,8 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
        if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
                err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
        if (err) {
-               printk(KERN_DEBUG
-                      "%s: failed to move station %pM to desired state\n",
-                      sdata->name, sta->sta.addr);
+               pr_debug("%s: failed to move station %pM to desired state\n",
+                        sdata->name, sta->sta.addr);
                WARN_ON(__sta_info_destroy(sta));
                mutex_unlock(&sdata->local->sta_mtx);
                return false;
@@ -2143,10 +2131,9 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
        status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
        aid = le16_to_cpu(mgmt->u.assoc_resp.aid);
 
-       printk(KERN_DEBUG "%s: RX %sssocResp from %pM (capab=0x%x "
-              "status=%d aid=%d)\n",
-              sdata->name, reassoc ? "Rea" : "A", mgmt->sa,
-              capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
+       pr_debug("%s: RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n",
+                sdata->name, reassoc ? "Rea" : "A", mgmt->sa,
+                capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
 
        pos = mgmt->u.assoc_resp.variable;
        ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
@@ -2157,9 +2144,8 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
                u32 tu, ms;
                tu = get_unaligned_le32(elems.timeout_int + 1);
                ms = tu * 1024 / 1000;
-               printk(KERN_DEBUG "%s: %pM rejected association temporarily; "
-                      "comeback duration %u TU (%u ms)\n",
-                      sdata->name, mgmt->sa, tu, ms);
+               pr_debug("%s: %pM rejected association temporarily; comeback duration %u TU (%u ms)\n",
+                        sdata->name, mgmt->sa, tu, ms);
                assoc_data->timeout = jiffies + msecs_to_jiffies(ms);
                if (ms > IEEE80211_ASSOC_TIMEOUT)
                        run_again(ifmgd, assoc_data->timeout);
@@ -2169,11 +2155,11 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
        *bss = assoc_data->bss;
 
        if (status_code != WLAN_STATUS_SUCCESS) {
-               printk(KERN_DEBUG "%s: %pM denied association (code=%d)\n",
-                      sdata->name, mgmt->sa, status_code);
+               pr_debug("%s: %pM denied association (code=%d)\n",
+                        sdata->name, mgmt->sa, status_code);
                ieee80211_destroy_assoc_data(sdata, false);
        } else {
-               printk(KERN_DEBUG "%s: associated\n", sdata->name);
+               pr_debug("%s: associated\n", sdata->name);
 
                if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
                        /* oops -- internal error -- send timeout for now */
@@ -2281,7 +2267,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
        if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies &&
            ether_addr_equal(mgmt->bssid, ifmgd->auth_data->bss->bssid)) {
                /* got probe response, continue with auth */
-               printk(KERN_DEBUG "%s: direct probe responded\n", sdata->name);
+               pr_debug("%s: direct probe responded\n", sdata->name);
                ifmgd->auth_data->tries = 0;
                ifmgd->auth_data->timeout = jiffies;
                run_again(ifmgd, ifmgd->auth_data->timeout);
@@ -2645,8 +2631,8 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
        auth_data->tries++;
 
        if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) {
-               printk(KERN_DEBUG "%s: authentication with %pM timed out\n",
-                      sdata->name, auth_data->bss->bssid);
+               pr_debug("%s: authentication with %pM timed out\n",
+                        sdata->name, auth_data->bss->bssid);
 
                /*
                 * Most likely AP is not in the range so remove the
@@ -2658,9 +2644,9 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
        }
 
        if (auth_data->bss->proberesp_ies) {
-               printk(KERN_DEBUG "%s: send auth to %pM (try %d/%d)\n",
-                      sdata->name, auth_data->bss->bssid, auth_data->tries,
-                      IEEE80211_AUTH_MAX_TRIES);
+               pr_debug("%s: send auth to %pM (try %d/%d)\n",
+                        sdata->name, auth_data->bss->bssid, auth_data->tries,
+                        IEEE80211_AUTH_MAX_TRIES);
 
                auth_data->expected_transaction = 2;
                ieee80211_send_auth(sdata, 1, auth_data->algorithm,
@@ -2670,9 +2656,9 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
        } else {
                const u8 *ssidie;
 
-               printk(KERN_DEBUG "%s: direct probe to %pM (try %d/%i)\n",
-                      sdata->name, auth_data->bss->bssid, auth_data->tries,
-                      IEEE80211_AUTH_MAX_TRIES);
+               pr_debug("%s: direct probe to %pM (try %d/%i)\n",
+                        sdata->name, auth_data->bss->bssid, auth_data->tries,
+                        IEEE80211_AUTH_MAX_TRIES);
 
                ssidie = ieee80211_bss_get_ie(auth_data->bss, WLAN_EID_SSID);
                if (!ssidie)
@@ -2700,8 +2686,8 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata)
 
        assoc_data->tries++;
        if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) {
-               printk(KERN_DEBUG "%s: association with %pM timed out\n",
-                      sdata->name, assoc_data->bss->bssid);
+               pr_debug("%s: association with %pM timed out\n",
+                        sdata->name, assoc_data->bss->bssid);
 
                /*
                 * Most likely AP is not in the range so remove the
@@ -2712,9 +2698,9 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata)
                return -ETIMEDOUT;
        }
 
-       printk(KERN_DEBUG "%s: associate with %pM (try %d/%d)\n",
-              sdata->name, assoc_data->bss->bssid, assoc_data->tries,
-              IEEE80211_ASSOC_MAX_TRIES);
+       pr_debug("%s: associate with %pM (try %d/%d)\n",
+                sdata->name, assoc_data->bss->bssid, assoc_data->tries,
+                IEEE80211_ASSOC_MAX_TRIES);
        ieee80211_send_assoc(sdata);
 
        assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT;
@@ -3085,13 +3071,10 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
                         * since we look at probe response/beacon data here
                         * it should be OK.
                         */
-                       printk(KERN_DEBUG
-                              "%s: Wrong control channel: center-freq: %d"
-                              " ht-cfreq: %d ht->primary_chan: %d"
-                              " band: %d. Disabling HT.\n",
-                              sdata->name, cbss->channel->center_freq,
-                              ht_cfreq, ht_oper->primary_chan,
-                              cbss->channel->band);
+                       pr_debug("%s: Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n",
+                                sdata->name, cbss->channel->center_freq,
+                                ht_cfreq, ht_oper->primary_chan,
+                                cbss->channel->band);
                        ht_oper = NULL;
                }
        }
@@ -3115,9 +3098,8 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
        if (!ieee80211_set_channel_type(local, sdata, channel_type)) {
                /* can only fail due to HT40+/- mismatch */
                channel_type = NL80211_CHAN_HT20;
-               printk(KERN_DEBUG
-                      "%s: disabling 40 MHz due to multi-vif mismatch\n",
-                      sdata->name);
+               pr_debug("%s: disabling 40 MHz due to multi-vif mismatch\n",
+                        sdata->name);
                ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ;
                WARN_ON(!ieee80211_set_channel_type(local, sdata,
                                                    channel_type));
@@ -3146,9 +3128,8 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
                 * we can connect -- with a warning.
                 */
                if (!basic_rates && min_rate_index >= 0) {
-                       printk(KERN_DEBUG
-                              "%s: No basic rates, using min rate instead.\n",
-                              sdata->name);
+                       pr_debug("%s: No basic rates, using min rate instead\n",
+                                sdata->name);
                        basic_rates = BIT(min_rate_index);
                }
 
@@ -3174,9 +3155,8 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
                err = sta_info_insert(sta);
                sta = NULL;
                if (err) {
-                       printk(KERN_DEBUG
-                              "%s: failed to insert STA entry for the AP (error %d)\n",
-                              sdata->name, err);
+                       pr_debug("%s: failed to insert STA entry for the AP (error %d)\n",
+                                sdata->name, err);
                        return err;
                }
        } else
@@ -3254,8 +3234,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
        if (ifmgd->associated)
                ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
 
-       printk(KERN_DEBUG "%s: authenticate with %pM\n",
-              sdata->name, req->bss->bssid);
+       pr_debug("%s: authenticate with %pM\n", sdata->name, req->bss->bssid);
 
        err = ieee80211_prep_connection(sdata, req->bss, false);
        if (err)
@@ -3290,7 +3269,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_bss *bss = (void *)req->bss->priv;
        struct ieee80211_mgd_assoc_data *assoc_data;
        struct ieee80211_supported_band *sband;
-       const u8 *ssidie;
+       const u8 *ssidie, *ht_ie;
        int i, err;
 
        ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID);
@@ -3377,8 +3356,13 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
                          (local->hw.queues >= IEEE80211_NUM_ACS);
        assoc_data->supp_rates = bss->supp_rates;
        assoc_data->supp_rates_len = bss->supp_rates_len;
-       assoc_data->ht_operation_ie =
-               ieee80211_bss_get_ie(req->bss, WLAN_EID_HT_OPERATION);
+
+       ht_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_HT_OPERATION);
+       if (ht_ie && ht_ie[1] >= sizeof(struct ieee80211_ht_operation))
+               assoc_data->ap_ht_param =
+                       ((struct ieee80211_ht_operation *)(ht_ie + 2))->ht_param;
+       else
+               ifmgd->flags |= IEEE80211_STA_DISABLE_11N;
 
        if (bss->wmm_used && bss->uapsd_supported &&
            (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)) {
@@ -3425,8 +3409,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
                 * Wait up to one beacon interval ...
                 * should this be more if we miss one?
                 */
-               printk(KERN_DEBUG "%s: waiting for beacon from %pM\n",
-                      sdata->name, ifmgd->bssid);
+               pr_debug("%s: waiting for beacon from %pM\n",
+                        sdata->name, ifmgd->bssid);
                assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval);
        } else {
                assoc_data->have_beacon = true;
@@ -3445,8 +3429,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
                                corrupt_type = "beacon";
                } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP)
                        corrupt_type = "probe response";
-               printk(KERN_DEBUG "%s: associating with AP with corrupt %s\n",
-                      sdata->name, corrupt_type);
+               pr_debug("%s: associating with AP with corrupt %s\n",
+                        sdata->name, corrupt_type);
        }
 
        err = 0;
@@ -3475,9 +3459,8 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
                return 0;
        }
 
-       printk(KERN_DEBUG
-              "%s: deauthenticating from %pM by local choice (reason=%d)\n",
-              sdata->name, req->bssid, req->reason_code);
+       pr_debug("%s: deauthenticating from %pM by local choice (reason=%d)\n",
+                sdata->name, req->bssid, req->reason_code);
 
        if (ifmgd->associated &&
            ether_addr_equal(ifmgd->associated->bssid, req->bssid))
@@ -3519,8 +3502,8 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
                return -ENOLINK;
        }
 
-       printk(KERN_DEBUG "%s: disassociating from %pM by local choice (reason=%d)\n",
-              sdata->name, req->bss->bssid, req->reason_code);
+       pr_debug("%s: disassociating from %pM by local choice (reason=%d)\n",
+                sdata->name, req->bss->bssid, req->reason_code);
 
        memcpy(bssid, req->bss->bssid, ETH_ALEN);
        ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DISASSOC,
@@ -3561,10 +3544,3 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
        cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, gfp);
 }
 EXPORT_SYMBOL(ieee80211_cqm_rssi_notify);
-
-unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif)
-{
-       struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
-       return sdata->dev->operstate;
-}
-EXPORT_SYMBOL(ieee80211_get_operstate);
index 7bcecf73aafbf9dadb87a2c8a114e3eb92490131..6fd2cb0838c475003c59e7e3eb406f5030596a38 100644 (file)
@@ -1137,22 +1137,22 @@ static void ap_sta_ps_start(struct sta_info *sta)
        if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
                drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-       printk(KERN_DEBUG "%s: STA %pM aid %d enters power save mode\n",
-              sdata->name, sta->sta.addr, sta->sta.aid);
+       pr_debug("%s: STA %pM aid %d enters power save mode\n",
+                sdata->name, sta->sta.addr, sta->sta.aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
 }
 
 static void ap_sta_ps_end(struct sta_info *sta)
 {
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-       printk(KERN_DEBUG "%s: STA %pM aid %d exits power save mode\n",
-              sta->sdata->name, sta->sta.addr, sta->sta.aid);
+       pr_debug("%s: STA %pM aid %d exits power save mode\n",
+                sta->sdata->name, sta->sta.addr, sta->sta.aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
 
        if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-               printk(KERN_DEBUG "%s: STA %pM aid %d driver-ps-blocked\n",
-                      sta->sdata->name, sta->sta.addr, sta->sta.aid);
+               pr_debug("%s: STA %pM aid %d driver-ps-blocked\n",
+                        sta->sdata->name, sta->sta.addr, sta->sta.aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
                return;
        }
@@ -1387,12 +1387,10 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
                struct ieee80211_hdr *hdr =
                        (struct ieee80211_hdr *) entry->skb_list.next->data;
-               printk(KERN_DEBUG "%s: RX reassembly removed oldest "
-                      "fragment entry (idx=%d age=%lu seq=%d last_frag=%d "
-                      "addr1=%pM addr2=%pM\n",
-                      sdata->name, idx,
-                      jiffies - entry->first_frag_time, entry->seq,
-                      entry->last_frag, hdr->addr1, hdr->addr2);
+               pr_debug("%s: RX reassembly removed oldest fragment entry (idx=%d age=%lu seq=%d last_frag=%d addr1=%pM addr2=%pM\n",
+                        sdata->name, idx,
+                        jiffies - entry->first_frag_time, entry->seq,
+                        entry->last_frag, hdr->addr1, hdr->addr2);
 #endif
                __skb_queue_purge(&entry->skb_list);
        }
index de455f8bbb91c0ffbedd2c911623380946d07d0b..77dcf2f89d4286d779f32c434d48079af95736b6 100644 (file)
@@ -333,9 +333,8 @@ static int sta_info_insert_drv_state(struct ieee80211_local *local,
        }
 
        if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
-               printk(KERN_DEBUG
-                      "%s: failed to move IBSS STA %pM to state %d (%d) - keeping it anyway.\n",
-                      sdata->name, sta->sta.addr, state + 1, err);
+               pr_debug("%s: failed to move IBSS STA %pM to state %d (%d) - keeping it anyway\n",
+                        sdata->name, sta->sta.addr, state + 1, err);
                err = 0;
        }
 
@@ -619,8 +618,7 @@ static bool sta_info_cleanup_expire_buffered_ac(struct ieee80211_local *local,
 
                local->total_ps_buffered--;
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-               printk(KERN_DEBUG "Buffered frame expired (STA %pM)\n",
-                      sta->sta.addr);
+               pr_debug("Buffered frame expired (STA %pM)\n", sta->sta.addr);
 #endif
                dev_kfree_skb(skb);
        }
@@ -889,10 +887,8 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
                        continue;
 
                if (time_after(jiffies, sta->last_rx + exp_time)) {
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-                       printk(KERN_DEBUG "%s: expiring inactive STA %pM\n",
-                              sdata->name, sta->sta.addr);
-#endif
+                       ibss_vdbg("%s: expiring inactive STA %pM\n",
+                                 sdata->name, sta->sta.addr);
                        WARN_ON(__sta_info_destroy(sta));
                }
        }
@@ -991,9 +987,8 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
        sta_info_recalc_tim(sta);
 
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-       printk(KERN_DEBUG "%s: STA %pM aid %d sending %d filtered/%d PS frames "
-              "since STA not sleeping anymore\n", sdata->name,
-              sta->sta.addr, sta->sta.aid, filtered, buffered);
+       pr_debug("%s: STA %pM aid %d sending %d filtered/%d PS frames since STA not sleeping anymore\n",
+                sdata->name, sta->sta.addr, sta->sta.aid, filtered, buffered);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
 }
 
@@ -1385,8 +1380,8 @@ int sta_info_move_state(struct sta_info *sta,
        }
 
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-       printk(KERN_DEBUG "%s: moving STA %pM to state %d\n",
-               sta->sdata->name, sta->sta.addr, new_state);
+       pr_debug("%s: moving STA %pM to state %d\n",
+                sta->sdata->name, sta->sta.addr, new_state);
 #endif
 
        /*
index 28cfa981cfb13cfca0307687e3c3a144c5ed2d77..63a76901506840fd40849e0c44c7befb972cbc56 100644 (file)
@@ -589,7 +589,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
        /* send frame to monitor interfaces now */
        rtap_len = ieee80211_tx_radiotap_len(info);
        if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
-               printk(KERN_ERR "ieee80211_tx_status: headroom too small\n");
+               pr_err("ieee80211_tx_status: headroom too small\n");
                dev_kfree_skb(skb);
                return;
        }
index 51077a956a83cdb025955bbfe367237a6784d136..68be47ca208fcaf7b8b6d0cf05ab6ec4525049d7 100644 (file)
@@ -263,12 +263,11 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
 #ifdef CONFIG_MAC80211_TKIP_DEBUG
        {
                int i;
-               printk(KERN_DEBUG "TKIP decrypt: data(len=%zd)", payload_len);
+               pr_debug("TKIP decrypt: data(len=%zd)", payload_len);
                for (i = 0; i < payload_len; i++)
                        printk(" %02x", payload[i]);
                printk("\n");
-               printk(KERN_DEBUG "TKIP decrypt: iv16=%04x iv32=%08x\n",
-                      iv16, iv32);
+               pr_debug("TKIP decrypt: iv16=%04x iv32=%08x\n", iv16, iv32);
        }
 #endif
 
@@ -283,11 +282,10 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
             (iv32 == key->u.tkip.rx[queue].iv32 &&
              iv16 <= key->u.tkip.rx[queue].iv16))) {
 #ifdef CONFIG_MAC80211_TKIP_DEBUG
-               printk(KERN_DEBUG "TKIP replay detected for RX frame from "
-                      "%pM (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n",
-                      ta,
-                      iv32, iv16, key->u.tkip.rx[queue].iv32,
-                      key->u.tkip.rx[queue].iv16);
+               pr_debug("TKIP replay detected for RX frame from %pM (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n",
+                        ta, iv32, iv16,
+                        key->u.tkip.rx[queue].iv32,
+                        key->u.tkip.rx[queue].iv16);
 #endif
                return TKIP_DECRYPT_REPLAY;
        }
@@ -306,13 +304,12 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
                {
                        int i;
                        u8 key_offset = NL80211_TKIP_DATA_OFFSET_ENCR_KEY;
-                       printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=%pM"
-                              " TK=", ta);
+                       pr_debug("TKIP decrypt: Phase1 TA=%pM TK=", ta);
                        for (i = 0; i < 16; i++)
                                printk("%02x ",
                                       key->conf.key[key_offset + i]);
                        printk("\n");
-                       printk(KERN_DEBUG "TKIP decrypt: P1K=");
+                       pr_debug("TKIP decrypt: P1K=");
                        for (i = 0; i < 5; i++)
                                printk("%04x ", key->u.tkip.rx[queue].p1k[i]);
                        printk("\n");
@@ -336,7 +333,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
 #ifdef CONFIG_MAC80211_TKIP_DEBUG
        {
                int i;
-               printk(KERN_DEBUG "TKIP decrypt: Phase2 rc4key=");
+               pr_debug("TKIP decrypt: Phase2 rc4key=");
                for (i = 0; i < 16; i++)
                        printk("%02x ", rc4key[i]);
                printk("\n");
index e453212fa17f741bc380b2cbdabe59ee4f6df5d7..af25c4e7ec5cf445b47a1244c0414f643aa19401 100644 (file)
@@ -297,9 +297,8 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
                if (unlikely(!assoc &&
                             ieee80211_is_data(hdr->frame_control))) {
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-                       printk(KERN_DEBUG "%s: dropped data frame to not "
-                              "associated station %pM\n",
-                              tx->sdata->name, hdr->addr1);
+                       pr_debug("%s: dropped data frame to not associated station %pM\n",
+                                tx->sdata->name, hdr->addr1);
 #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
                        I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);
                        return TX_DROP;
@@ -467,8 +466,8 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
                }
 
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
-               printk(KERN_DEBUG "STA %pM aid %d: PS buffer for AC %d\n",
-                      sta->sta.addr, sta->sta.aid, ac);
+               pr_debug("STA %pM aid %d: PS buffer for AC %d\n",
+                        sta->sta.addr, sta->sta.aid, ac);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
                if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
                        purge_old_ps_buffers(tx->local);
@@ -502,9 +501,8 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
        }
 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
        else if (unlikely(test_sta_flag(sta, WLAN_STA_PS_STA))) {
-               printk(KERN_DEBUG
-                      "%s: STA %pM in PS mode, but polling/in SP -> send frame\n",
-                      tx->sdata->name, sta->sta.addr);
+               pr_debug("%s: STA %pM in PS mode, but polling/in SP -> send frame\n",
+                        tx->sdata->name, sta->sta.addr);
        }
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
 
index 2e4444fedbe0143430fdaffdd58c8793ee6da9de..4d2b1ec6516ff7f2e96c3ecee6bca4062c1d3a80 100644 (file)
@@ -114,24 +114,10 @@ config CFG80211_WEXT
        bool "cfg80211 wireless extensions compatibility"
        depends on CFG80211
        select WEXT_CORE
-       default y
        help
          Enable this option if you need old userspace for wireless
          extensions with cfg80211-based drivers.
 
-config WIRELESS_EXT_SYSFS
-       bool "Wireless extensions sysfs files"
-       depends on WEXT_CORE && SYSFS
-       help
-         This option enables the deprecated wireless statistics
-         files in /sys/class/net/*/wireless/. The same information
-         is available via the ioctls as well.
-
-         Say N. If you know you have ancient tools requiring it,
-         like very old versions of hal (prior to 0.5.12 release),
-         say Y and update the tools as soon as possible as this
-         option will be removed soon.
-
 config LIB80211
        tristate "Common routines for IEEE802.11 drivers"
        default n
index 884801ac4dd07a24db5b46c3df52fe44d81e2eec..20b87d895722b6190bad6ee87a916b9b49ac6cde 100644 (file)
@@ -60,7 +60,7 @@ bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
                diff = -20;
                break;
        default:
-               return false;
+               return true;
        }
 
        sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff);
@@ -107,21 +107,11 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
                     wdev->iftype == NL80211_IFTYPE_AP ||
                     wdev->iftype == NL80211_IFTYPE_AP_VLAN ||
                     wdev->iftype == NL80211_IFTYPE_MESH_POINT ||
-                    wdev->iftype == NL80211_IFTYPE_P2P_GO)) {
-               switch (channel_type) {
-               case NL80211_CHAN_HT40PLUS:
-               case NL80211_CHAN_HT40MINUS:
-                       if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, chan,
-                                                         channel_type)) {
-                               printk(KERN_DEBUG
-                                      "cfg80211: Secondary channel not "
-                                      "allowed to initiate communication\n");
-                               return -EINVAL;
-                       }
-                       break;
-               default:
-                       break;
-               }
+                    wdev->iftype == NL80211_IFTYPE_P2P_GO) &&
+           !cfg80211_can_beacon_sec_chan(&rdev->wiphy, chan, channel_type)) {
+               printk(KERN_DEBUG
+                      "cfg80211: Secondary channel not allowed to beacon\n");
+               return -EINVAL;
        }
 
        result = rdev->ops->set_channel(&rdev->wiphy,
index 8523f3878677518be3e46e3230903e2d90ba3ae0..1d3d24126946b33154d9bf8e71a6a14cdc16aa4b 100644 (file)
@@ -303,14 +303,17 @@ extern const struct mesh_config default_mesh_config;
 extern const struct mesh_setup default_mesh_setup;
 int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
                         struct net_device *dev,
-                        const struct mesh_setup *setup,
+                        struct mesh_setup *setup,
                         const struct mesh_config *conf);
 int cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
                       struct net_device *dev,
-                      const struct mesh_setup *setup,
+                      struct mesh_setup *setup,
                       const struct mesh_config *conf);
 int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
                        struct net_device *dev);
+int cfg80211_set_mesh_freq(struct cfg80211_registered_device *rdev,
+                          struct wireless_dev *wdev, int freq,
+                          enum nl80211_channel_type channel_type);
 
 /* MLME */
 int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
index 2749cb86b4625142d53fa44e6145a011012fb478..2e3b700eba327acb3138f0934c9f818cd7b64be4 100644 (file)
@@ -65,6 +65,9 @@ const struct mesh_config default_mesh_config = {
 };
 
 const struct mesh_setup default_mesh_setup = {
+       /* cfg80211_join_mesh() will pick a channel if needed */
+       .channel = NULL,
+       .channel_type = NL80211_CHAN_NO_HT,
        .sync_method = IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET,
        .path_sel_proto = IEEE80211_PATH_PROTOCOL_HWMP,
        .path_metric = IEEE80211_PATH_METRIC_AIRTIME,
@@ -75,7 +78,7 @@ const struct mesh_setup default_mesh_setup = {
 
 int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
                         struct net_device *dev,
-                        const struct mesh_setup *setup,
+                        struct mesh_setup *setup,
                         const struct mesh_config *conf)
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -101,6 +104,51 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
        if (!rdev->ops->join_mesh)
                return -EOPNOTSUPP;
 
+       if (!setup->channel) {
+               /* if no channel explicitly given, use preset channel */
+               setup->channel = wdev->preset_chan;
+               setup->channel_type = wdev->preset_chantype;
+       }
+
+       if (!setup->channel) {
+               /* if we don't have that either, use the first usable channel */
+               enum ieee80211_band band;
+
+               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+                       struct ieee80211_supported_band *sband;
+                       struct ieee80211_channel *chan;
+                       int i;
+
+                       sband = rdev->wiphy.bands[band];
+                       if (!sband)
+                               continue;
+
+                       for (i = 0; i < sband->n_channels; i++) {
+                               chan = &sband->channels[i];
+                               if (chan->flags & (IEEE80211_CHAN_NO_IBSS |
+                                                  IEEE80211_CHAN_PASSIVE_SCAN |
+                                                  IEEE80211_CHAN_DISABLED |
+                                                  IEEE80211_CHAN_RADAR))
+                                       continue;
+                               setup->channel = chan;
+                               break;
+                       }
+
+                       if (setup->channel)
+                               break;
+               }
+
+               /* no usable channel ... */
+               if (!setup->channel)
+                       return -EINVAL;
+
+               setup->channel_type = NL80211_CHAN_NO_HT;
+       }
+
+       if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, setup->channel,
+                                         setup->channel_type))
+               return -EINVAL;
+
        err = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
        if (!err) {
                memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len);
@@ -112,7 +160,7 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
 
 int cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
                       struct net_device *dev,
-                      const struct mesh_setup *setup,
+                      struct mesh_setup *setup,
                       const struct mesh_config *conf)
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -125,6 +173,45 @@ int cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
        return err;
 }
 
+int cfg80211_set_mesh_freq(struct cfg80211_registered_device *rdev,
+                          struct wireless_dev *wdev, int freq,
+                          enum nl80211_channel_type channel_type)
+{
+       struct ieee80211_channel *channel;
+
+       /*
+        * Workaround for libertas (only!), it puts the interface
+        * into mesh mode but doesn't implement join_mesh. Instead,
+        * it is configured via sysfs and then joins the mesh when
+        * you set the channel. Note that the libertas mesh isn't
+        * compatible with 802.11 mesh.
+        */
+       if (!rdev->ops->join_mesh) {
+               int err;
+
+               if (!netif_running(wdev->netdev))
+                       return -ENETDOWN;
+               wdev_lock(wdev);
+               err = cfg80211_set_freq(rdev, wdev, freq, channel_type);
+               wdev_unlock(wdev);
+
+               return err;
+       }
+
+       if (wdev->mesh_id_len)
+               return -EBUSY;
+
+       channel = rdev_freq_to_chan(rdev, freq, channel_type);
+       if (!channel || !cfg80211_can_beacon_sec_chan(&rdev->wiphy,
+                                                     channel,
+                                                     channel_type)) {
+               return -EINVAL;
+       }
+       wdev->preset_chan = channel;
+       wdev->preset_chantype = channel_type;
+       return 0;
+}
+
 void cfg80211_notify_new_peer_candidate(struct net_device *dev,
                const u8 *macaddr, const u8* ie, u8 ie_len, gfp_t gfp)
 {
index 206465dc0cab403cede6c0f9b9321c4e3b696d7a..b22f1f876881b6c174bbd7fc14079147daeac78b 100644 (file)
@@ -921,7 +921,12 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
                if (nla_put_u32(msg, i, NL80211_CMD_SET_WIPHY_NETNS))
                        goto nla_put_failure;
        }
-       CMD(set_channel, SET_CHANNEL);
+       if (dev->ops->set_channel || dev->ops->start_ap ||
+           dev->ops->join_mesh) {
+               i++;
+               if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL))
+                       goto nla_put_failure;
+       }
        CMD(set_wds_peer, SET_WDS_PEER);
        if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) {
                CMD(tdls_mgmt, TDLS_MGMT);
@@ -1162,10 +1167,15 @@ static int parse_txq_params(struct nlattr *tb[],
 static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev)
 {
        /*
-        * You can only set the channel explicitly for AP, mesh
-        * and WDS type interfaces; all others have their channel
-        * managed via their respective "establish a connection"
-        * command (connect, join, ...)
+        * You can only set the channel explicitly for WDS interfaces,
+        * all others have their channel managed via their respective
+        * "establish a connection" command (connect, join, ...)
+        *
+        * For AP/GO and mesh mode, the channel can be set with the
+        * channel userspace API, but is only stored and passed to the
+        * low-level driver when the AP starts or the mesh is joined.
+        * This is for backward compatibility, userspace can also give
+        * the channel in the start-ap or join-mesh commands instead.
         *
         * Monitors are special as they are normally slaved to
         * whatever else is going on, so they behave as though
@@ -1173,7 +1183,6 @@ static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev)
         */
        return !wdev ||
                wdev->iftype == NL80211_IFTYPE_AP ||
-               wdev->iftype == NL80211_IFTYPE_WDS ||
                wdev->iftype == NL80211_IFTYPE_MESH_POINT ||
                wdev->iftype == NL80211_IFTYPE_MONITOR ||
                wdev->iftype == NL80211_IFTYPE_P2P_GO;
@@ -1204,6 +1213,7 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
                                 struct wireless_dev *wdev,
                                 struct genl_info *info)
 {
+       struct ieee80211_channel *channel;
        enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
        u32 freq;
        int result;
@@ -1221,7 +1231,28 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
        freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
 
        mutex_lock(&rdev->devlist_mtx);
-       if (wdev) {
+       if (wdev) switch (wdev->iftype) {
+       case NL80211_IFTYPE_AP:
+       case NL80211_IFTYPE_P2P_GO:
+               if (wdev->beacon_interval) {
+                       result = -EBUSY;
+                       break;
+               }
+               channel = rdev_freq_to_chan(rdev, freq, channel_type);
+               if (!channel || !cfg80211_can_beacon_sec_chan(&rdev->wiphy,
+                                                             channel,
+                                                             channel_type)) {
+                       result = -EINVAL;
+                       break;
+               }
+               wdev->preset_chan = channel;
+               wdev->preset_chantype = channel_type;
+               result = 0;
+               break;
+       case NL80211_IFTYPE_MESH_POINT:
+               result = cfg80211_set_mesh_freq(rdev, wdev, freq, channel_type);
+               break;
+       default:
                wdev_lock(wdev);
                result = cfg80211_set_freq(rdev, wdev, freq, channel_type);
                wdev_unlock(wdev);
@@ -1310,8 +1341,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
                result = 0;
 
                mutex_lock(&rdev->mtx);
-       } else if (netif_running(netdev) &&
-                  nl80211_can_set_dev_channel(netdev->ieee80211_ptr))
+       } else if (nl80211_can_set_dev_channel(netdev->ieee80211_ptr))
                wdev = netdev->ieee80211_ptr;
        else
                wdev = NULL;
@@ -2299,6 +2329,29 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
                        info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]);
        }
 
+       if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
+               enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
+
+               if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] &&
+                   !nl80211_valid_channel_type(info, &channel_type))
+                       return -EINVAL;
+
+               params.channel = rdev_freq_to_chan(rdev,
+                       nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]),
+                       channel_type);
+               if (!params.channel)
+                       return -EINVAL;
+               params.channel_type = channel_type;
+       } else if (wdev->preset_chan) {
+               params.channel = wdev->preset_chan;
+               params.channel_type = wdev->preset_chantype;
+       } else
+               return -EINVAL;
+
+       if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, params.channel,
+                                         params.channel_type))
+               return -EINVAL;
+
        err = rdev->ops->start_ap(&rdev->wiphy, dev, &params);
        if (!err)
                wdev->beacon_interval = params.beacon_interval;
@@ -6032,6 +6085,24 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
                        return err;
        }
 
+       if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
+               enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
+
+               if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] &&
+                   !nl80211_valid_channel_type(info, &channel_type))
+                       return -EINVAL;
+
+               setup.channel = rdev_freq_to_chan(rdev,
+                       nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]),
+                       channel_type);
+               if (!setup.channel)
+                       return -EINVAL;
+               setup.channel_type = channel_type;
+       } else {
+               /* cfg80211_join_mesh() will sort it out */
+               setup.channel = NULL;
+       }
+
        return cfg80211_join_mesh(rdev, dev, &setup, &cfg);
 }
 
index 6a6181a673ca07a378a4b524f88249de78b661e4..faeb03548aa45a1378904a5a09031ddaa6213c67 100644 (file)
@@ -796,8 +796,6 @@ static int cfg80211_wext_siwfreq(struct net_device *dev,
        case NL80211_IFTYPE_ADHOC:
                return cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra);
        case NL80211_IFTYPE_MONITOR:
-       case NL80211_IFTYPE_WDS:
-       case NL80211_IFTYPE_MESH_POINT:
                freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
                if (freq < 0)
                        return freq;
@@ -809,6 +807,17 @@ static int cfg80211_wext_siwfreq(struct net_device *dev,
                wdev_unlock(wdev);
                mutex_unlock(&rdev->devlist_mtx);
                return err;
+       case NL80211_IFTYPE_MESH_POINT:
+               freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
+               if (freq < 0)
+                       return freq;
+               if (freq == 0)
+                       return -EINVAL;
+               mutex_lock(&rdev->devlist_mtx);
+               err = cfg80211_set_mesh_freq(rdev, wdev, freq,
+                                            NL80211_CHAN_NO_HT);
+               mutex_unlock(&rdev->devlist_mtx);
+               return err;
        default:
                return -EOPNOTSUPP;
        }
This page took 0.105928 seconds and 5 git commands to generate.