]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
authorDavid S. Miller <davem@davemloft.net>
Fri, 2 Jul 2010 00:34:14 +0000 (17:34 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Jul 2010 00:34:14 +0000 (17:34 -0700)
Conflicts:
drivers/net/wireless/libertas/host.h

13 files changed:
1  2 
drivers/net/wireless/at76c50x-usb.c
drivers/net/wireless/at76c50x-usb.h
drivers/net/wireless/iwlwifi/iwl-commands.h
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/libertas/host.h
drivers/net/wireless/libertas/rx.c
drivers/net/wireless/mac80211_hwsim.c
drivers/net/wireless/rndis_wlan.c
include/net/cfg80211.h
net/mac80211/cfg.c
net/mac80211/ieee80211_i.h
net/mac80211/rx.c
net/wireless/nl80211.c

index 429b281d40d16f0a3b401a27768b13b2c4d38699,98328b7f83324e7a975138f8c26fd0054d2db5c0..cd8caeab86ea97873521e8c72517b523f9721ff7
@@@ -7,6 -7,7 +7,7 @@@
   * Copyright (c) 2004 Balint Seeber <n0_5p4m_p13453@hotmail.com>
   * Copyright (c) 2007 Guido Guenther <agx@sigxcpu.org>
   * Copyright (c) 2007 Kalle Valo <kalle.valo@iki.fi>
+  * Copyright (c) 2010 Sebastian Smolorz <sesmo@gmx.net>
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License as
@@@ -305,7 -306,7 +306,7 @@@ struct dfu_status 
        unsigned char poll_timeout[3];
        unsigned char state;
        unsigned char string;
 -} __attribute__((packed));
 +} __packed;
  
  static inline int at76_is_intersil(enum board_type board)
  {
@@@ -1649,6 -1650,58 +1650,58 @@@ exit
                return NULL;
  }
  
+ static int at76_join(struct at76_priv *priv)
+ {
+       struct at76_req_join join;
+       int ret;
+       memset(&join, 0, sizeof(struct at76_req_join));
+       memcpy(join.essid, priv->essid, priv->essid_size);
+       join.essid_size = priv->essid_size;
+       memcpy(join.bssid, priv->bssid, ETH_ALEN);
+       join.bss_type = INFRASTRUCTURE_MODE;
+       join.channel = priv->channel;
+       join.timeout = cpu_to_le16(2000);
+       at76_dbg(DBG_MAC80211, "%s: sending CMD_JOIN", __func__);
+       ret = at76_set_card_command(priv->udev, CMD_JOIN, &join,
+                                   sizeof(struct at76_req_join));
+       if (ret < 0) {
+               printk(KERN_ERR "%s: at76_set_card_command failed: %d\n",
+                      wiphy_name(priv->hw->wiphy), ret);
+               return 0;
+       }
+       ret = at76_wait_completion(priv, CMD_JOIN);
+       at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret);
+       if (ret != CMD_STATUS_COMPLETE) {
+               printk(KERN_ERR "%s: at76_wait_completion failed: %d\n",
+                      wiphy_name(priv->hw->wiphy), ret);
+               return 0;
+       }
+       at76_set_pm_mode(priv);
+       return 0;
+ }
+ static void at76_work_join_bssid(struct work_struct *work)
+ {
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             work_join_bssid);
+       if (priv->device_unplugged)
+               return;
+       mutex_lock(&priv->mtx);
+       if (is_valid_ether_addr(priv->bssid))
+               at76_join(priv);
+       mutex_unlock(&priv->mtx);
+ }
  static void at76_mac80211_tx_callback(struct urb *urb)
  {
        struct at76_priv *priv = urb->context;
@@@ -1686,6 -1739,7 +1739,7 @@@ static int at76_mac80211_tx(struct ieee
        struct at76_priv *priv = hw->priv;
        struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
        int padding, submit_len, ret;
  
        at76_dbg(DBG_MAC80211, "%s()", __func__);
                return NETDEV_TX_BUSY;
        }
  
+       /* The following code lines are important when the device is going to
+        * authenticate with a new bssid. The driver must send CMD_JOIN before
+        * an authentication frame is transmitted. For this to succeed, the
+        * correct bssid of the AP must be known. As mac80211 does not inform
+        * drivers about the bssid prior to the authentication process the
+        * following workaround is necessary. If the TX frame is an
+        * authentication frame extract the bssid and send the CMD_JOIN. */
+       if (mgmt->frame_control & cpu_to_le16(IEEE80211_STYPE_AUTH)) {
+               if (compare_ether_addr(priv->bssid, mgmt->bssid)) {
+                       memcpy(priv->bssid, mgmt->bssid, ETH_ALEN);
+                       ieee80211_queue_work(hw, &priv->work_join_bssid);
+                       return NETDEV_TX_BUSY;
+               }
+       }
        ieee80211_stop_queues(hw);
  
        at76_ledtrig_tx_activity();     /* tell ledtrigger we send a packet */
@@@ -1770,6 -1839,7 +1839,7 @@@ static void at76_mac80211_stop(struct i
        at76_dbg(DBG_MAC80211, "%s()", __func__);
  
        cancel_delayed_work(&priv->dwork_hw_scan);
+       cancel_work_sync(&priv->work_join_bssid);
        cancel_work_sync(&priv->work_set_promisc);
  
        mutex_lock(&priv->mtx);
@@@ -1818,42 -1888,6 +1888,6 @@@ static void at76_remove_interface(struc
        at76_dbg(DBG_MAC80211, "%s()", __func__);
  }
  
- static int at76_join(struct at76_priv *priv)
- {
-       struct at76_req_join join;
-       int ret;
-       memset(&join, 0, sizeof(struct at76_req_join));
-       memcpy(join.essid, priv->essid, priv->essid_size);
-       join.essid_size = priv->essid_size;
-       memcpy(join.bssid, priv->bssid, ETH_ALEN);
-       join.bss_type = INFRASTRUCTURE_MODE;
-       join.channel = priv->channel;
-       join.timeout = cpu_to_le16(2000);
-       at76_dbg(DBG_MAC80211, "%s: sending CMD_JOIN", __func__);
-       ret = at76_set_card_command(priv->udev, CMD_JOIN, &join,
-                                   sizeof(struct at76_req_join));
-       if (ret < 0) {
-               printk(KERN_ERR "%s: at76_set_card_command failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
-               return 0;
-       }
-       ret = at76_wait_completion(priv, CMD_JOIN);
-       at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret);
-       if (ret != CMD_STATUS_COMPLETE) {
-               printk(KERN_ERR "%s: at76_wait_completion failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
-               return 0;
-       }
-       at76_set_pm_mode(priv);
-       return 0;
- }
  static void at76_dwork_hw_scan(struct work_struct *work)
  {
        struct at76_priv *priv = container_of(work, struct at76_priv,
@@@ -2107,6 -2141,7 +2141,7 @@@ static struct at76_priv *at76_alloc_new
        mutex_init(&priv->mtx);
        INIT_WORK(&priv->work_set_promisc, at76_work_set_promisc);
        INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx);
+       INIT_WORK(&priv->work_join_bssid, at76_work_join_bssid);
        INIT_DELAYED_WORK(&priv->dwork_hw_scan, at76_dwork_hw_scan);
  
        tasklet_init(&priv->rx_tasklet, at76_rx_tasklet, 0);
@@@ -2508,5 -2543,6 +2543,6 @@@ MODULE_AUTHOR("Balint Seeber <n0_5p4m_p
  MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>");
  MODULE_AUTHOR("Guido Guenther <agx@sigxcpu.org>");
  MODULE_AUTHOR("Kalle Valo <kalle.valo@iki.fi>");
+ MODULE_AUTHOR("Sebastian Smolorz <sesmo@gmx.net>");
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
index 972ea0fc1a0b3ec3740b0f75edd452d8e5705005,db89d72df4f3f6b47586a2b660a062ed5c92b949..4a37447dfc01e14e4a97210c9c0500b4a31dad16
@@@ -99,7 -99,7 +99,7 @@@ struct hwcfg_r505 
        u8 reserved2[14];
        u8 cr15_values[14];
        u8 reserved3[3];
 -} __attribute__((packed));
 +} __packed;
  
  struct hwcfg_rfmd {
        u8 cr20_values[14];
        u8 low_power_values[14];
        u8 normal_power_values[14];
        u8 reserved1[3];
 -} __attribute__((packed));
 +} __packed;
  
  struct hwcfg_intersil {
        u8 mac_addr[ETH_ALEN];
        u8 pidvid[4];
        u8 regulatory_domain;
        u8 reserved[1];
 -} __attribute__((packed));
 +} __packed;
  
  union at76_hwcfg {
        struct hwcfg_intersil i;
@@@ -149,14 -149,14 +149,14 @@@ struct at76_card_config 
        u8 ssid_len;
        u8 short_preamble;
        __le16 beacon_period;
 -} __attribute__((packed));
 +} __packed;
  
  struct at76_command {
        u8 cmd;
        u8 reserved;
        __le16 size;
        u8 data[0];
 -} __attribute__((packed));
 +} __packed;
  
  /* Length of Atmel-specific Rx header before 802.11 frame */
  #define AT76_RX_HDRLEN offsetof(struct at76_rx_buffer, packet)
@@@ -171,7 -171,7 +171,7 @@@ struct at76_rx_buffer 
        u8 noise_level;
        __le32 rx_time;
        u8 packet[IEEE80211_MAX_FRAG_THRESHOLD];
 -} __attribute__((packed));
 +} __packed;
  
  /* Length of Atmel-specific Tx header before 802.11 frame */
  #define AT76_TX_HDRLEN offsetof(struct at76_tx_buffer, packet)
@@@ -182,7 -182,7 +182,7 @@@ struct at76_tx_buffer 
        u8 padding;
        u8 reserved[4];
        u8 packet[IEEE80211_MAX_FRAG_THRESHOLD];
 -} __attribute__((packed));
 +} __packed;
  
  /* defines for scan_type below */
  #define SCAN_TYPE_ACTIVE      0
@@@ -198,7 -198,7 +198,7 @@@ struct at76_req_scan 
        __le16 max_channel_time;
        u8 essid_size;
        u8 international_scan;
 -} __attribute__((packed));
 +} __packed;
  
  struct at76_req_ibss {
        u8 bssid[ETH_ALEN];
        u8 channel;
        u8 essid_size;
        u8 reserved[3];
 -} __attribute__((packed));
 +} __packed;
  
  struct at76_req_join {
        u8 bssid[ETH_ALEN];
        __le16 timeout;
        u8 essid_size;
        u8 reserved;
 -} __attribute__((packed));
 +} __packed;
  
  struct set_mib_buffer {
        u8 type;
                __le16 word;
                u8 addr[ETH_ALEN];
        } data;
 -} __attribute__((packed));
 +} __packed;
  
  struct mib_local {
        u16 reserved0;
        u16 reserved2;
        u8 preamble_type;
        u16 reserved3;
 -} __attribute__((packed));
 +} __packed;
  
  struct mib_mac_addr {
        u8 mac_addr[ETH_ALEN];
        u8 res[2];              /* ??? */
        u8 group_addr[4][ETH_ALEN];
        u8 group_addr_status[4];
 -} __attribute__((packed));
 +} __packed;
  
  struct mib_mac {
        __le32 max_tx_msdu_lifetime;
        u8 desired_bssid[ETH_ALEN];
        u8 desired_bsstype;     /* ad-hoc or infrastructure */
        u8 reserved2;
 -} __attribute__((packed));
 +} __packed;
  
  struct mib_mac_mgmt {
        __le16 beacon_period;
        u8 multi_domain_capability_enabled;
        u8 country_string[3];
        u8 reserved[3];
 -} __attribute__((packed));
 +} __packed;
  
  struct mib_mac_wep {
        u8 privacy_invoked;     /* 0 disable encr., 1 enable encr */
        __le32 wep_excluded_count;
        u8 wep_default_keyvalue[WEP_KEYS][WEP_LARGE_KEY_LEN];
        u8 encryption_level;    /* 1 for 40bit, 2 for 104bit encryption */
 -} __attribute__((packed));
 +} __packed;
  
  struct mib_phy {
        __le32 ed_threshold;
        u8 current_cca_mode;
        u8 phy_type;
        u8 current_reg_domain;
 -} __attribute__((packed));
 +} __packed;
  
  struct mib_fw_version {
        u8 major;
        u8 minor;
        u8 patch;
        u8 build;
 -} __attribute__((packed));
 +} __packed;
  
  struct mib_mdomain {
        u8 tx_powerlevel[14];
        u8 channel_list[14];    /* 0 for invalid channels */
 -} __attribute__((packed));
 +} __packed;
  
  struct at76_fw_header {
        __le32 crc;             /* CRC32 of the whole image */
        __le32 int_fw_len;      /* internal firmware image length */
        __le32 ext_fw_offset;   /* external firmware image offset */
        __le32 ext_fw_len;      /* external firmware image length */
 -} __attribute__((packed));
 +} __packed;
  
  /* a description of a regulatory domain and the allowed channels */
  struct reg_domain {
@@@ -387,6 -387,7 +387,7 @@@ struct at76_priv 
        /* work queues */
        struct work_struct work_set_promisc;
        struct work_struct work_submit_rx;
+       struct work_struct work_join_bssid;
        struct delayed_work dwork_hw_scan;
  
        struct tasklet_struct rx_tasklet;
index 28b1098334f7e805813d0ac87477d3093d8e4a83,a304f771bcc387b22487b6150af29c95d923cee2..acf8e980b1fe242208b3c3901b98e899f1df1703
@@@ -227,7 -227,7 +227,7 @@@ struct iwl_cmd_header 
  
        /* command or response/notification data follows immediately */
        u8 data[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /**
  struct iwl3945_tx_power {
        u8 tx_gain;             /* gain for analog radio */
        u8 dsp_atten;           /* gain for DSP */
 -} __attribute__ ((packed));
 +} __packed;
  
  /**
   * struct iwl3945_power_per_rate
@@@ -258,7 -258,7 +258,7 @@@ struct iwl3945_power_per_rate 
        u8 rate;                /* plcp */
        struct iwl3945_tx_power tpc;
        u8 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  /**
   * iwlagn rate_n_flags bit fields
@@@ -389,7 -389,7 +389,7 @@@ union iwl4965_tx_power_dual_stream 
   */
  struct tx_power_dual_stream {
        __le32 dw;
 -} __attribute__ ((packed));
 +} __packed;
  
  /**
   * struct iwl4965_tx_power_db
   */
  struct iwl4965_tx_power_db {
        struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES];
 -} __attribute__ ((packed));
 +} __packed;
  
  /**
   * Command REPLY_TX_POWER_DBM_CMD = 0x98
@@@ -412,7 -412,7 +412,7 @@@ struct iwl5000_tx_power_dbm_cmd 
        u8 flags;
        s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */
        u8 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  /**
   * Command TX_ANT_CONFIGURATION_CMD = 0x98
   */
  struct iwl_tx_ant_config_cmd {
        __le32 valid;
 -} __attribute__ ((packed));
 +} __packed;
  
  /******************************************************************************
   * (0a)
@@@ -478,7 -478,7 +478,7 @@@ struct iwl_init_alive_resp 
        __le32 therm_r4[2];     /* signed */
        __le32 tx_atten[5][2];  /* signed MIMO gain comp, 5 freq groups,
                                 * 2 Tx chains */
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /**
@@@ -570,7 -570,7 +570,7 @@@ struct iwl_alive_resp 
        __le32 error_event_table_ptr;   /* SRAM address for error log */
        __le32 timestamp;
        __le32 is_valid;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_ERROR = 0x2 (response only, not a command)
@@@ -582,7 -582,7 +582,7 @@@ struct iwl_error_resp 
        __le16 bad_cmd_seq_num;
        __le32 error_info;
        __le64 timestamp;
 -} __attribute__ ((packed));
 +} __packed;
  
  /******************************************************************************
   * (1)
@@@ -718,7 -718,7 +718,7 @@@ struct iwl3945_rxon_cmd 
        __le32 filter_flags;
        __le16 channel;
        __le16 reserved5;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl4965_rxon_cmd {
        u8 node_addr[6];
        __le16 channel;
        u8 ofdm_ht_single_stream_basic_rates;
        u8 ofdm_ht_dual_stream_basic_rates;
 -} __attribute__ ((packed));
 +} __packed;
  
  /* 5000 HW just extend this command */
  struct iwl_rxon_cmd {
        u8 reserved5;
        __le16 acquisition_data;
        __le16 reserved6;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
@@@ -774,7 -774,7 +774,7 @@@ struct iwl3945_rxon_assoc_cmd 
        u8 ofdm_basic_rates;
        u8 cck_basic_rates;
        __le16 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl4965_rxon_assoc_cmd {
        __le32 flags;
        u8 ofdm_ht_dual_stream_basic_rates;
        __le16 rx_chain_select_flags;
        __le16 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl5000_rxon_assoc_cmd {
        __le32 flags;
        __le16 rx_chain_select_flags;
        __le16 acquisition_data;
        __le32 reserved3;
 -} __attribute__ ((packed));
 +} __packed;
  
  #define IWL_CONN_MAX_LISTEN_INTERVAL  10
  #define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
@@@ -816,7 -816,7 +816,7 @@@ struct iwl_rxon_time_cmd 
        __le32 beacon_init_val;
        __le16 listen_interval;
        __le16 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
@@@ -829,7 -829,7 +829,7 @@@ struct iwl3945_channel_switch_cmd 
        __le32 rxon_filter_flags;
        __le32 switch_time;
        struct iwl3945_power_per_rate power[IWL_MAX_RATES];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl4965_channel_switch_cmd {
        u8 band;
        __le32 rxon_filter_flags;
        __le32 switch_time;
        struct iwl4965_tx_power_db tx_power;
 -} __attribute__ ((packed));
 +} __packed;
  
  /**
   * struct iwl5000_channel_switch_cmd
@@@ -860,7 -860,7 +860,7 @@@ struct iwl5000_channel_switch_cmd 
        __le32 rxon_filter_flags;
        __le32 switch_time;
        __le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
 -} __attribute__ ((packed));
 +} __packed;
  
  /**
   * struct iwl6000_channel_switch_cmd
@@@ -881,7 -881,7 +881,7 @@@ struct iwl6000_channel_switch_cmd 
        __le32 rxon_filter_flags;
        __le32 switch_time;
        __le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES];
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
@@@ -890,7 -890,7 +890,7 @@@ struct iwl_csa_notification 
        __le16 band;
        __le16 channel;
        __le32 status;          /* 0 - OK, 1 - fail */
 -} __attribute__ ((packed));
 +} __packed;
  
  /******************************************************************************
   * (2)
@@@ -920,7 -920,7 +920,7 @@@ struct iwl_ac_qos 
        u8 aifsn;
        u8 reserved1;
        __le16 edca_txop;
 -} __attribute__ ((packed));
 +} __packed;
  
  /* QoS flags defines */
  #define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01)
  struct iwl_qosparam_cmd {
        __le32 qos_flags;
        struct iwl_ac_qos ac[AC_NUM];
 -} __attribute__ ((packed));
 +} __packed;
  
  /******************************************************************************
   * (3)
@@@ -1014,7 -1014,7 +1014,7 @@@ struct iwl4965_keyinfo 
        u8 key_offset;
        u8 reserved2;
        u8 key[16];             /* 16-byte unicast decryption key */
 -} __attribute__ ((packed));
 +} __packed;
  
  /* 5000 */
  struct iwl_keyinfo {
        __le64 tx_secur_seq_cnt;
        __le64 hw_tkip_mic_rx_key;
        __le64 hw_tkip_mic_tx_key;
 -} __attribute__ ((packed));
 +} __packed;
  
  /**
   * struct sta_id_modify
@@@ -1048,7 -1048,7 +1048,7 @@@ struct sta_id_modify 
        u8 sta_id;
        u8 modify_mask;
        __le16 reserved2;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_ADD_STA = 0x18 (command)
@@@ -1102,7 -1102,7 +1102,7 @@@ struct iwl3945_addsta_cmd 
        /* Starting Sequence Number for added block-ack support.
         * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
        __le16 add_immediate_ba_ssn;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl4965_addsta_cmd {
        u8 mode;                /* 1: modify existing, 0: add new station */
        __le16 sleep_tx_count;
  
        __le16 reserved2;
 -} __attribute__ ((packed));
 +} __packed;
  
  /* 5000 */
  struct iwl_addsta_cmd {
        __le16 sleep_tx_count;
  
        __le16 reserved2;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  #define ADD_STA_SUCCESS_MSK           0x1
   */
  struct iwl_add_sta_resp {
        u8 status;      /* ADD_STA_* */
 -} __attribute__ ((packed));
 +} __packed;
  
  #define REM_STA_SUCCESS_MSK              0x1
  /*
   */
  struct iwl_rem_sta_resp {
        u8 status;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   *  REPLY_REM_STA = 0x19 (command)
@@@ -1207,7 -1207,7 +1207,7 @@@ struct iwl_rem_sta_cmd 
        u8 reserved[3];
        u8 addr[ETH_ALEN]; /* MAC addr of the first station */
        u8 reserved2[2];
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_WEP_KEY = 0x20
@@@ -1219,7 -1219,7 +1219,7 @@@ struct iwl_wep_key 
        u8 key_size;
        u8 reserved2[3];
        u8 key[16];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_wep_cmd {
        u8 num_keys;
        u8 flags;
        u8 reserved;
        struct iwl_wep_key key[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  #define WEP_KEY_WEP_TYPE 1
  #define WEP_KEYS_MAX 4
@@@ -1281,7 -1281,7 +1281,7 @@@ struct iwl3945_rx_frame_stats 
        __le16 sig_avg;
        __le16 noise_diff;
        u8 payload[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl3945_rx_frame_hdr {
        __le16 channel;
        u8 rate;
        __le16 len;
        u8 payload[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl3945_rx_frame_end {
        __le32 status;
        __le64 timestamp;
        __le32 beacon_timestamp;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_3945_RX = 0x1b (response only, not a command)
@@@ -1310,7 -1310,7 +1310,7 @@@ struct iwl3945_rx_frame 
        struct iwl3945_rx_frame_stats stats;
        struct iwl3945_rx_frame_hdr hdr;
        struct iwl3945_rx_frame_end end;
 -} __attribute__ ((packed));
 +} __packed;
  
  #define IWL39_RX_FRAME_SIZE   (4 + sizeof(struct iwl3945_rx_frame))
  
@@@ -1326,7 -1326,7 +1326,7 @@@ struct iwl4965_rx_non_cfg_phy 
        __le16 agc_info;        /* agc code 0:6, agc dB 7:13, reserved 14:15 */
        u8 rssi_info[6];        /* we use even entries, 0/2/4 for A/B/C rssi */
        u8 pad[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  
  #define IWL50_RX_RES_PHY_CNT 8
  
  struct iwl5000_non_cfg_phy {
        __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT];  /* up to 8 phy entries */
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /*
@@@ -1364,12 -1364,12 +1364,12 @@@ struct iwl_rx_phy_res 
        __le32 rate_n_flags;    /* RATE_MCS_* */
        __le16 byte_count;      /* frame's byte-count */
        __le16 reserved3;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_rx_mpdu_res_start {
        __le16 byte_count;
        __le16 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /******************************************************************************
  
  /* REPLY_TX Tx flags field */
  
- /* 1: Use RTS/CTS protocol or CTS-to-self if spec allows it
+ /*
+  * 1: Use RTS/CTS protocol or CTS-to-self if spec allows it
   * before this frame. if CTS-to-self required check
-  * RXON_FLG_SELF_CTS_EN status. */
- #define TX_CMD_FLG_RTS_CTS_MSK cpu_to_le32(1 << 0)
+  * RXON_FLG_SELF_CTS_EN status.
+  * unused in 3945/4965, used in 5000 series and after
+  */
+ #define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0)
  
- /* 1: Use Request-To-Send protocol before this frame.
-  * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
+ /*
+  * 1: Use Request-To-Send protocol before this frame.
+  * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
+  * used in 3945/4965, unused in 5000 series and after
+  */
  #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
  
- /* 1: Transmit Clear-To-Send to self before this frame.
+ /*
+  * 1: Transmit Clear-To-Send to self before this frame.
   * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
-  * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
+  * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
+  * used in 3945/4965, unused in 5000 series and after
+  */
  #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
  
  /* 1: Expect ACK from receiving station
   * Set when Txing a block-ack request frame.  Also set TX_CMD_FLG_ACK_MSK. */
  #define TX_CMD_FLG_IMM_BA_RSP_MASK  cpu_to_le32(1 << 6)
  
- /* 1: Frame requires full Tx-Op protection.
-  * Set this if either RTS or CTS Tx Flag gets set. */
+ /*
+  * 1: Frame requires full Tx-Op protection.
+  * Set this if either RTS or CTS Tx Flag gets set.
+  * used in 3945/4965, unused in 5000 series and after
+  */
  #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
  
  /* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
@@@ -1556,7 -1568,7 +1568,7 @@@ struct iwl3945_tx_cmd 
         */
        u8 payload[0];
        struct ieee80211_hdr hdr[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_TX = 0x1c (response)
@@@ -1568,7 -1580,7 +1580,7 @@@ struct iwl3945_tx_resp 
        u8 rate;
        __le32 wireless_media_time;
        __le32 status;          /* TX status */
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /*
@@@ -1580,7 -1592,7 +1592,7 @@@ struct iwl_dram_scratch 
        u8 try_cnt;             /* Tx attempts */
        u8 bt_kill_cnt;         /* Tx attempts blocked by Bluetooth device */
        __le16 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_tx_cmd {
        /*
         */
        u8 payload[0];
        struct ieee80211_hdr hdr[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  /* TX command response is sent after *3945* transmission attempts.
   *
@@@ -1825,7 -1837,7 +1837,7 @@@ enum 
  struct agg_tx_status {
        __le16 status;
        __le16 sequence;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl4965_tx_resp {
        u8 frame_count;         /* 1 no aggregation, >1 aggregation */
                __le32 status;
                struct agg_tx_status agg_status[0]; /* for each agg frame */
        } u;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * definitions for initial rate index field
@@@ -1926,7 -1938,7 +1938,7 @@@ struct iwl5000_tx_resp 
         */
        struct agg_tx_status status;    /* TX status (in aggregation -
                                         * status of 1st frame) */
 -} __attribute__ ((packed));
 +} __packed;
  /*
   * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
   *
@@@ -1944,7 -1956,7 +1956,7 @@@ struct iwl_compressed_ba_resp 
        __le64 bitmap;
        __le16 scd_flow;
        __le16 scd_ssn;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
@@@ -1957,14 -1969,14 +1969,14 @@@ struct iwl3945_txpowertable_cmd 
        u8 reserved;
        __le16 channel;
        struct iwl3945_power_per_rate power[IWL_MAX_RATES];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl4965_txpowertable_cmd {
        u8 band;                /* 0: 5 GHz, 1: 2.4 GHz */
        u8 reserved;
        __le16 channel;
        struct iwl4965_tx_power_db tx_power;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /**
@@@ -1986,13 -1998,13 +1998,13 @@@ struct iwl3945_rate_scaling_info 
        __le16 rate_n_flags;
        u8 try_cnt;
        u8 next_rate_index;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl3945_rate_scaling_cmd {
        u8 table_id;
        u8 reserved[3];
        struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
@@@ -2039,7 -2051,7 +2051,7 @@@ struct iwl_link_qual_general_params 
         * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
         */
        u8 start_rate_index[LINK_QUAL_AC_NUM];
 -} __attribute__ ((packed));
 +} __packed;
  
  #define LINK_QUAL_AGG_TIME_LIMIT_DEF  (4000) /* 4 milliseconds */
  #define LINK_QUAL_AGG_TIME_LIMIT_MAX  (65535)
@@@ -2080,7 -2092,7 +2092,7 @@@ struct iwl_link_qual_agg_params 
        u8 agg_frame_cnt_limit;
  
        __le32 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
@@@ -2286,7 -2298,7 +2298,7 @@@ struct iwl_link_quality_cmd 
                __le32 rate_n_flags;    /* RATE_MCS_*, IWL_RATE_* */
        } rs_table[LINK_QUAL_MAX_RETRY_NUM];
        __le32 reserved2;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * BT configuration enable flags:
@@@ -2327,7 -2339,7 +2339,7 @@@ struct iwl_bt_cmd 
        u8 reserved;
        __le32 kill_ack_mask;
        __le32 kill_cts_mask;
 -} __attribute__ ((packed));
 +} __packed;
  
  /******************************************************************************
   * (6)
@@@ -2352,7 -2364,7 +2364,7 @@@ struct iwl_measure_channel 
        u8 channel;             /* channel to measure */
        u8 type;                /* see enum iwl_measure_type */
        __le16 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
@@@ -2371,7 -2383,7 +2383,7 @@@ struct iwl_spectrum_cmd 
        __le16 channel_count;   /* minimum 1, maximum 10 */
        __le16 reserved3;
        struct iwl_measure_channel channels[10];
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
@@@ -2382,7 -2394,7 +2394,7 @@@ struct iwl_spectrum_resp 
        __le16 status;          /* 0 - command will be handled
                                 * 1 - cannot handle (conflicts with another
                                 *     measurement) */
 -} __attribute__ ((packed));
 +} __packed;
  
  enum iwl_measurement_state {
        IWL_MEASUREMENT_START = 0,
@@@ -2405,13 -2417,13 +2417,13 @@@ enum iwl_measurement_status 
  struct iwl_measurement_histogram {
        __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
        __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM];  /* in 1usec counts */
 -} __attribute__ ((packed));
 +} __packed;
  
  /* clear channel availability counters */
  struct iwl_measurement_cca_counters {
        __le32 ofdm;
        __le32 cck;
 -} __attribute__ ((packed));
 +} __packed;
  
  enum iwl_measure_type {
        IWL_MEASURE_BASIC = (1 << 0),
@@@ -2447,7 -2459,7 +2459,7 @@@ struct iwl_spectrum_notification 
        struct iwl_measurement_histogram histogram;
        __le32 stop_time;       /* lower 32-bits of TSF */
        __le32 status;          /* see iwl_measurement_status */
 -} __attribute__ ((packed));
 +} __packed;
  
  /******************************************************************************
   * (7)
@@@ -2503,7 -2515,7 +2515,7 @@@ struct iwl3945_powertable_cmd 
        __le32 rx_data_timeout;
        __le32 tx_data_timeout;
        __le32 sleep_interval[IWL_POWER_VEC_SIZE];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_powertable_cmd {
        __le16 flags;
        __le32 tx_data_timeout;
        __le32 sleep_interval[IWL_POWER_VEC_SIZE];
        __le32 keep_alive_beacons;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
@@@ -2526,7 -2538,7 +2538,7 @@@ struct iwl_sleep_notification 
        __le32 sleep_time;
        __le32 tsf_low;
        __le32 bcon_timer;
 -} __attribute__ ((packed));
 +} __packed;
  
  /* Sleep states.  3945 and 4965 identical. */
  enum {
  #define CARD_STATE_CMD_HALT    0x02   /* Power down permanently */
  struct iwl_card_state_cmd {
        __le32 status;          /* CARD_STATE_CMD_* request new power state */
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
   */
  struct iwl_card_state_notif {
        __le32 flags;
 -} __attribute__ ((packed));
 +} __packed;
  
  #define HW_CARD_DISABLED   0x01
  #define SW_CARD_DISABLED   0x02
@@@ -2569,14 -2581,14 +2581,14 @@@ struct iwl_ct_kill_config 
        __le32   reserved;
        __le32   critical_temperature_M;
        __le32   critical_temperature_R;
 -}  __attribute__ ((packed));
 +}  __packed;
  
  /* 1000, and 6x00 */
  struct iwl_ct_kill_throttling_config {
        __le32   critical_temperature_exit;
        __le32   reserved;
        __le32   critical_temperature_enter;
 -}  __attribute__ ((packed));
 +}  __packed;
  
  /******************************************************************************
   * (8)
@@@ -2621,7 -2633,7 +2633,7 @@@ struct iwl3945_scan_channel 
        struct iwl3945_tx_power tpc;
        __le16 active_dwell;    /* in 1024-uSec TU (time units), typ 5-50 */
        __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
 -} __attribute__ ((packed));
 +} __packed;
  
  /* set number of direct probes u8 type */
  #define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
@@@ -2640,7 -2652,7 +2652,7 @@@ struct iwl_scan_channel 
        u8 dsp_atten;           /* gain for DSP */
        __le16 active_dwell;    /* in 1024-uSec TU (time units), typ 5-50 */
        __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
 -} __attribute__ ((packed));
 +} __packed;
  
  /* set number of direct probes __le32 type */
  #define IWL_SCAN_PROBE_MASK(n)        cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
@@@ -2657,7 -2669,7 +2669,7 @@@ struct iwl_ssid_ie 
        u8 id;
        u8 len;
        u8 ssid[32];
 -} __attribute__ ((packed));
 +} __packed;
  
  #define PROBE_OPTION_MAX_3945         4
  #define PROBE_OPTION_MAX              20
@@@ -2763,7 -2775,7 +2775,7 @@@ struct iwl3945_scan_cmd 
         * before requesting another scan.
         */
        u8 data[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_scan_cmd {
        __le16 len;
         * before requesting another scan.
         */
        u8 data[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  /* Can abort will notify by complete notification with abort status. */
  #define CAN_ABORT_STATUS      cpu_to_le32(0x1)
   */
  struct iwl_scanreq_notification {
        __le32 status;          /* 1: okay, 2: cannot fulfill request */
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
@@@ -2832,7 -2844,7 +2844,7 @@@ struct iwl_scanstart_notification 
        u8 band;
        u8 reserved[2];
        __le32 status;
 -} __attribute__ ((packed));
 +} __packed;
  
  #define  SCAN_OWNER_STATUS 0x1;
  #define  MEASURE_OWNER_STATUS 0x2;
@@@ -2848,7 -2860,7 +2860,7 @@@ struct iwl_scanresults_notification 
        __le32 tsf_low;
        __le32 tsf_high;
        __le32 statistics[NUMBER_OF_STATISTICS];
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
@@@ -2860,7 -2872,7 +2872,7 @@@ struct iwl_scancomplete_notification 
        u8 last_channel;
        __le32 tsf_low;
        __le32 tsf_high;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /******************************************************************************
@@@ -2878,14 -2890,14 +2890,14 @@@ struct iwl3945_beacon_notif 
        __le32 low_tsf;
        __le32 high_tsf;
        __le32 ibss_mgr_status;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl4965_beacon_notif {
        struct iwl4965_tx_resp beacon_notify_hdr;
        __le32 low_tsf;
        __le32 high_tsf;
        __le32 ibss_mgr_status;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
@@@ -2897,7 -2909,7 +2909,7 @@@ struct iwl3945_tx_beacon_cmd 
        u8 tim_size;
        u8 reserved1;
        struct ieee80211_hdr frame[0];  /* beacon frame */
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_tx_beacon_cmd {
        struct iwl_tx_cmd tx;
        u8 tim_size;
        u8 reserved1;
        struct ieee80211_hdr frame[0];  /* beacon frame */
 -} __attribute__ ((packed));
 +} __packed;
  
  /******************************************************************************
   * (10)
@@@ -2931,7 -2943,7 +2943,7 @@@ struct rate_histogram 
                __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
                __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
        } failed;
 -} __attribute__ ((packed));
 +} __packed;
  
  /* statistics command response */
  
@@@ -2951,7 -2963,7 +2963,7 @@@ struct iwl39_statistics_rx_phy 
        __le32 rxe_frame_limit_overrun;
        __le32 sent_ack_cnt;
        __le32 sent_cts_cnt;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl39_statistics_rx_non_phy {
        __le32 bogus_cts;       /* CTS received when not expecting CTS */
                                 * filtering process */
        __le32 non_channel_beacons;     /* beacons with our bss id but not on
                                         * our serving channel */
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl39_statistics_rx {
        struct iwl39_statistics_rx_phy ofdm;
        struct iwl39_statistics_rx_phy cck;
        struct iwl39_statistics_rx_non_phy general;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl39_statistics_tx {
        __le32 preamble_cnt;
        __le32 ack_timeout;
        __le32 expected_ack_cnt;
        __le32 actual_ack_cnt;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct statistics_dbg {
        __le32 burst_check;
        __le32 burst_count;
        __le32 reserved[4];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl39_statistics_div {
        __le32 tx_on_a;
        __le32 tx_on_b;
        __le32 exec_time;
        __le32 probe_time;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl39_statistics_general {
        __le32 temperature;
        __le32 slots_idle;
        __le32 ttl_timestamp;
        struct iwl39_statistics_div div;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct statistics_rx_phy {
        __le32 ina_cnt;
        __le32 mh_format_err;
        __le32 re_acq_main_rssi_sum;
        __le32 reserved3;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct statistics_rx_ht_phy {
        __le32 plcp_err;
        __le32 agg_mpdu_cnt;
        __le32 agg_cnt;
        __le32 unsupport_mcs;
 -} __attribute__ ((packed));
 +} __packed;
  
  #define INTERFERENCE_DATA_AVAILABLE      cpu_to_le32(1)
  
@@@ -3074,14 -3086,14 +3086,14 @@@ struct statistics_rx_non_phy 
        __le32 beacon_energy_a;
        __le32 beacon_energy_b;
        __le32 beacon_energy_c;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct statistics_rx {
        struct statistics_rx_phy ofdm;
        struct statistics_rx_phy cck;
        struct statistics_rx_non_phy general;
        struct statistics_rx_ht_phy ofdm_ht;
 -} __attribute__ ((packed));
 +} __packed;
  
  /**
   * struct statistics_tx_power - current tx power
@@@ -3095,7 -3107,7 +3107,7 @@@ struct statistics_tx_power 
        u8 ant_b;
        u8 ant_c;
        u8 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct statistics_tx_non_phy_agg {
        __le32 ba_timeout;
        __le32 underrun;
        __le32 bt_prio_kill;
        __le32 rx_ba_rsp_cnt;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct statistics_tx {
        __le32 preamble_cnt;
         */
        struct statistics_tx_power tx_power;
        __le32 reserved1;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  struct statistics_div {
        __le32 probe_time;
        __le32 reserved1;
        __le32 reserved2;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct statistics_general {
        __le32 temperature;   /* radio temperature */
        __le32 num_of_sos_states;
        __le32 reserved2;
        __le32 reserved3;
 -} __attribute__ ((packed));
 +} __packed;
  
  #define UCODE_STATISTICS_CLEAR_MSK            (0x1 << 0)
  #define UCODE_STATISTICS_FREQUENCY_MSK                (0x1 << 1)
  #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
  struct iwl_statistics_cmd {
        __le32 configuration_flags;     /* IWL_STATS_CONF_* */
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
@@@ -3213,14 -3225,14 +3225,14 @@@ struct iwl3945_notif_statistics 
        struct iwl39_statistics_rx rx;
        struct iwl39_statistics_tx tx;
        struct iwl39_statistics_general general;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_notif_statistics {
        __le32 flag;
        struct statistics_rx rx;
        struct statistics_tx tx;
        struct statistics_general general;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /*
@@@ -3252,7 -3264,7 +3264,7 @@@ struct iwl_missed_beacon_notif 
        __le32 total_missed_becons;
        __le32 num_expected_beacons;
        __le32 num_recvd_beacons;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /******************************************************************************
  struct iwl_sensitivity_cmd {
        __le16 control;                 /* always use "1" */
        __le16 table[HD_TABLE_SIZE];    /* use HD_* as index */
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /**
@@@ -3535,31 -3547,31 +3547,31 @@@ struct iwl_calib_cfg_elmnt_s 
        __le32 send_res;
        __le32 apply_res;
        __le32 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_calib_cfg_status_s {
        struct iwl_calib_cfg_elmnt_s once;
        struct iwl_calib_cfg_elmnt_s perd;
        __le32 flags;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_calib_cfg_cmd {
        struct iwl_calib_cfg_status_s ucd_calib_cfg;
        struct iwl_calib_cfg_status_s drv_calib_cfg;
        __le32 reserved1;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_calib_hdr {
        u8 op_code;
        u8 first_group;
        u8 groups_num;
        u8 data_valid;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_calib_cmd {
        struct iwl_calib_hdr hdr;
        u8 data[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  /* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
  struct iwl_calib_diff_gain_cmd {
        s8 diff_gain_b;
        s8 diff_gain_c;
        u8 reserved1;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_calib_xtal_freq_cmd {
        struct iwl_calib_hdr hdr;
        u8 cap_pin1;
        u8 cap_pin2;
        u8 pad[2];
 -} __attribute__ ((packed));
 +} __packed;
  
  /* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
  struct iwl_calib_chain_noise_reset_cmd {
@@@ -3589,7 -3601,7 +3601,7 @@@ struct iwl_calib_chain_noise_gain_cmd 
        u8 delta_gain_1;
        u8 delta_gain_2;
        u8 pad[2];
 -} __attribute__ ((packed));
 +} __packed;
  
  /******************************************************************************
   * (12)
@@@ -3612,7 -3624,7 +3624,7 @@@ struct iwl_led_cmd 
        u8 on;                  /* # intervals on while blinking;
                                 * "0", regardless of "off", turns LED off */
        u8 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * station priority table entries
@@@ -3748,7 -3760,7 +3760,7 @@@ struct iwl_wimax_coex_event_entry 
        u8 win_medium_prio;
        u8 reserved;
        u8 flags;
 -} __attribute__ ((packed));
 +} __packed;
  
  /* COEX flag masks */
  
@@@ -3765,7 -3777,7 +3777,7 @@@ struct iwl_wimax_coex_cmd 
        u8 flags;
        u8 reserved[3];
        struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS];
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * Coexistence MEDIUM NOTIFICATION
  struct iwl_coex_medium_notification {
        __le32 status;
        __le32 events;
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * Coexistence EVENT  Command
@@@ -3809,11 -3821,11 +3821,11 @@@ struct iwl_coex_event_cmd 
        u8 flags;
        u8 event;
        __le16 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct iwl_coex_event_resp {
        __le32 status;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /******************************************************************************
@@@ -3857,7 -3869,7 +3869,7 @@@ struct iwl_rx_packet 
                __le32 status;
                u8 raw[0];
        } u;
 -} __attribute__ ((packed));
 +} __packed;
  
  int iwl_agn_check_rxon_cmd(struct iwl_priv *priv);
  
index 338b5177029de2867c5bca4bf70a5632fbcca8e8,df07a144c78686ed882d02ffa227218c7e245deb..728752aa1bb528ce46de02518c06f9544b66e949
@@@ -138,7 -138,7 +138,7 @@@ struct iwl_queue 
                                * space more than this */
        int high_mark;         /* high watermark, stop queue if free
                                * space less than this */
 -} __attribute__ ((packed));
 +} __packed;
  
  /* One for each TFD */
  struct iwl_tx_info {
@@@ -324,8 -324,8 +324,8 @@@ struct iwl_device_cmd 
                struct iwl_tx_cmd tx;
                struct iwl6000_channel_switch_cmd chswitch;
                u8 payload[DEF_CMD_PAYLOAD_SIZE];
 -      } __attribute__ ((packed)) cmd;
 -} __attribute__ ((packed));
 +      } __packed cmd;
 +} __packed;
  
  #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))
  
@@@ -577,7 -577,7 +577,7 @@@ struct iwl_ucode_tlv 
        __le16 alternative;     /* see comment */
        __le32 length;          /* not including type/length fields */
        u8 data[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  #define IWL_TLV_UCODE_MAGIC   0x0a4c5749
  
@@@ -1036,11 -1036,12 +1036,12 @@@ struct iwl_event_log 
   * This is the threshold value of plcp error rate per 100mSecs.  It is
   * used to set and check for the validity of plcp_delta.
   */
- #define IWL_MAX_PLCP_ERR_THRESHOLD_MIN        (0)
+ #define IWL_MAX_PLCP_ERR_THRESHOLD_MIN        (1)
  #define IWL_MAX_PLCP_ERR_THRESHOLD_DEF        (50)
  #define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF   (100)
  #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF       (200)
  #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX        (255)
+ #define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE    (0)
  
  #define IWL_DELAY_NEXT_FORCE_RF_RESET  (HZ*3)
  #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5)
@@@ -1224,13 -1225,6 +1225,6 @@@ struct iwl_priv 
        struct iwl_power_mgr power_data;
        struct iwl_tt_mgmt thermal_throttle;
  
-       struct iwl_notif_statistics statistics;
- #ifdef CONFIG_IWLWIFI_DEBUGFS
-       struct iwl_notif_statistics accum_statistics;
-       struct iwl_notif_statistics delta_statistics;
-       struct iwl_notif_statistics max_delta;
- #endif
        /* context information */
        u8 bssid[ETH_ALEN]; /* used only on 3945 but filled by core */
  
  
                        u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
                        u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
+                       struct iwl_notif_statistics statistics;
+ #ifdef CONFIG_IWLWIFI_DEBUGFS
+                       struct iwl_notif_statistics accum_statistics;
+                       struct iwl_notif_statistics delta_statistics;
+                       struct iwl_notif_statistics max_delta;
+ #endif
                } _agn;
  #endif
        };
index 3bd5d3b6037ab8ac0cb09a14ed8d1c1b13c29c0a,112fbf167dc81045bd878ff760947cf53c5352ec..db8e209878c1ec3054d495d56d33dd4ba9b21bb8
@@@ -326,7 -326,7 +326,7 @@@ struct txpd 
        u8 pktdelay_2ms;
        /* reserved */
        u8 reserved1;
 -} __attribute__ ((packed));
 +} __packed;
  
  /* RxPD Descriptor */
  struct rxpd {
                        u8 bss_type;
                        /* BSS number */
                        u8 bss_num;
 -              } __attribute__ ((packed)) bss;
 -      } __attribute__ ((packed)) u;
 +              } __packed bss;
 +      } __packed u;
  
        /* SNR */
        u8 snr;
        /* Pkt Priority */
        u8 priority;
        u8 reserved[3];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_header {
        __le16 command;
        __le16 size;
        __le16 seqnum;
        __le16 result;
 -} __attribute__ ((packed));
 +} __packed;
  
  /* Generic structure to hold all key types. */
  struct enc_key {
  struct lbs_offset_value {
        u32 offset;
        u32 value;
 -} __attribute__ ((packed));
 +} __packed;
  
+ #define MRVDRV_MAX_TRIPLET_802_11D              83
+ #define COUNTRY_CODE_LEN                        3
+ struct mrvl_ie_domain_param_set {
+       struct mrvl_ie_header header;
+       u8 countrycode[COUNTRY_CODE_LEN];
+       struct ieee80211_country_ie_triplet triplet[1];
+ } __attribute__ ((packed));
+ struct cmd_ds_802_11d_domain_info {
+       __le16 action;
+       struct mrvl_ie_domain_param_set domain;
+ } __attribute__ ((packed));
+ struct lbs_802_11d_domain_reg {
+       /** Country code*/
+       u8 country_code[COUNTRY_CODE_LEN];
+       /** No. of triplet*/
+       u8 no_triplet;
+       struct ieee80211_country_ie_triplet triplet[MRVDRV_MAX_TRIPLET_802_11D];
+ } __attribute__ ((packed));
  /*
   * Define data structure for CMD_GET_HW_SPEC
   * This structure defines the response for the GET_HW_SPEC command
@@@ -426,7 -450,7 +450,7 @@@ struct cmd_ds_get_hw_spec 
  
        /*FW/HW capability */
        __le32 fwcapinfo;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_subscribe_event {
        struct cmd_header hdr;
         * bump this up a bit.
         */
        uint8_t tlv[128];
 -} __attribute__ ((packed));
 +} __packed;
  
  /*
   * This scan handle Country Information IE(802.11d compliant)
@@@ -452,7 -476,7 +476,7 @@@ struct cmd_ds_802_11_scan 
        uint8_t bsstype;
        uint8_t bssid[ETH_ALEN];
        uint8_t tlvbuffer[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_scan_rsp {
        struct cmd_header hdr;
        __le16 bssdescriptsize;
        uint8_t nr_sets;
        uint8_t bssdesc_and_tlvbuffer[0];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_get_log {
        struct cmd_header hdr;
        __le32 fcserror;
        __le32 txframe;
        __le32 wepundecryptable;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_mac_control {
        struct cmd_header hdr;
        __le16 action;
        u16 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_mac_multicast_adr {
        struct cmd_header hdr;
        __le16 action;
        __le16 nr_of_adrs;
        u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_authenticate {
        struct cmd_header hdr;
        u8 bssid[ETH_ALEN];
        u8 authtype;
        u8 reserved[10];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_deauthenticate {
        struct cmd_header hdr;
  
        u8 macaddr[ETH_ALEN];
        __le16 reasoncode;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_associate {
        struct cmd_header hdr;
        __le16 bcnperiod;
        u8 dtimperiod;
        u8 iebuf[512];    /* Enough for required and most optional IEs */
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_associate_response {
        struct cmd_header hdr;
        __le16 statuscode;
        __le16 aid;
        u8 iebuf[512];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_set_wep {
        struct cmd_header hdr;
        /* 40, 128bit or TXWEP */
        uint8_t keytype[4];
        uint8_t keymaterial[4][16];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_snmp_mib {
        struct cmd_header hdr;
        __le16 oid;
        __le16 bufsize;
        u8 value[128];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_mac_reg_access {
        __le16 action;
        __le16 offset;
        __le32 value;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_bbp_reg_access {
        __le16 action;
        __le16 offset;
        u8 value;
        u8 reserved[3];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_rf_reg_access {
        __le16 action;
        __le16 offset;
        u8 value;
        u8 reserved[3];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_radio_control {
        struct cmd_header hdr;
  
        __le16 action;
        __le16 control;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_beacon_control {
        __le16 action;
        __le16 beacon_enable;
        __le16 beacon_period;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_sleep_params {
        struct cmd_header hdr;
  
        /* reserved field, should be set to zero */
        __le16 reserved;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_rf_channel {
        struct cmd_header hdr;
        __le16 rftype;      /* unused */
        __le16 reserved;    /* unused */
        u8 channellist[32]; /* unused */
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_rssi {
        /* weighting factor */
        __le16 reserved_0;
        __le16 reserved_1;
        __le16 reserved_2;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_rssi_rsp {
        __le16 SNR;
        __le16 noisefloor;
        __le16 avgSNR;
        __le16 avgnoisefloor;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_mac_address {
        struct cmd_header hdr;
  
        __le16 action;
        u8 macadd[ETH_ALEN];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_rf_tx_power {
        struct cmd_header hdr;
        __le16 curlevel;
        s8 maxlevel;
        s8 minlevel;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_monitor_mode {
        __le16 action;
        __le16 mode;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_set_boot2_ver {
        struct cmd_header hdr;
  
        __le16 action;
        __le16 version;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_fw_wake_method {
        struct cmd_header hdr;
  
        __le16 action;
        __le16 method;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_ps_mode {
        __le16 action;
        __le16 multipledtim;
        __le16 reserved;
        __le16 locallisteninterval;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_confirm_sleep {
        struct cmd_header hdr;
        __le16 multipledtim;
        __le16 reserved;
        __le16 locallisteninterval;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_data_rate {
        struct cmd_header hdr;
        __le16 action;
        __le16 reserved;
        u8 rates[MAX_RATES];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_rate_adapt_rateset {
        struct cmd_header hdr;
        __le16 action;
        __le16 enablehwauto;
        __le16 bitmap;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_ad_hoc_start {
        struct cmd_header hdr;
        __le16 capability;
        u8 rates[MAX_RATES];
        u8 tlv_memory_size_pad[100];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_ad_hoc_result {
        struct cmd_header hdr;
  
        u8 pad[3];
        u8 bssid[ETH_ALEN];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct adhoc_bssdesc {
        u8 bssid[ETH_ALEN];
         * Adhoc join command and will cause a binary layout mismatch with
         * the firmware
         */
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_ad_hoc_join {
        struct cmd_header hdr;
        struct adhoc_bssdesc bss;
        __le16 failtimeout;   /* Reserved on v9 and later */
        __le16 probedelay;    /* Reserved on v9 and later */
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_ad_hoc_stop {
        struct cmd_header hdr;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_enable_rsn {
        struct cmd_header hdr;
  
        __le16 action;
        __le16 enable;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct MrvlIEtype_keyParamSet {
        /* type ID */
  
        /* key material of size keylen */
        u8 key[32];
 -} __attribute__ ((packed));
 +} __packed;
  
  #define MAX_WOL_RULES                 16
  
@@@ -797,7 -821,7 +821,7 @@@ struct host_wol_rule 
        __le16 reserve;
        __be32 sig_mask;
        __be32 signature;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct wol_config {
        uint8_t action;
        uint8_t no_rules_in_cmd;
        uint8_t result;
        struct host_wol_rule rule[MAX_WOL_RULES];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_host_sleep {
        struct cmd_header hdr;
        uint8_t gpio;
        uint16_t gap;
        struct wol_config wol_conf;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  
@@@ -822,7 -846,7 +846,7 @@@ struct cmd_ds_802_11_key_material 
  
        __le16 action;
        struct MrvlIEtype_keyParamSet keyParamSet[2];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_eeprom_access {
        struct cmd_header hdr;
        /* firmware says it returns a maximum of 20 bytes */
  #define LBS_EEPROM_READ_LEN 20
        u8 value[LBS_EEPROM_READ_LEN];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_tpc_cfg {
        struct cmd_header hdr;
        int8_t P1;
        int8_t P2;
        uint8_t usesnr;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  struct cmd_ds_802_11_pa_cfg {
        int8_t P0;
        int8_t P1;
        int8_t P2;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  struct cmd_ds_802_11_led_ctrl {
        __le16 action;
        __le16 numled;
        u8 data[256];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_802_11_afc {
        __le16 afc_auto;
                        __le16 carrier_offset; /* signed */
                };
        };
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_tx_rate_query {
        __le16 txrate;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_get_tsf {
        __le64 tsfvalue;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_bt_access {
        __le16 action;
        __le32 id;
        u8 addr1[ETH_ALEN];
        u8 addr2[ETH_ALEN];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_fwt_access {
        __le16 action;
        __le32 snr;
        __le32 references;
        u8 prec[ETH_ALEN];
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_mesh_config {
        struct cmd_header hdr;
        __le16 type;
        __le16 length;
        u8 data[128];   /* last position reserved */
 -} __attribute__ ((packed));
 +} __packed;
  
  struct cmd_ds_mesh_access {
        struct cmd_header hdr;
  
        __le16 action;
        __le32 data[32];        /* last position reserved */
 -} __attribute__ ((packed));
 +} __packed;
  
  /* Number of stats counters returned by the firmware */
  #define MESH_STATS_NUM 8
@@@ -949,6 -973,9 +973,9 @@@ struct cmd_ds_command 
                struct cmd_ds_bbp_reg_access bbpreg;
                struct cmd_ds_rf_reg_access rfreg;
  
+               struct cmd_ds_802_11d_domain_info domaininfo;
+               struct cmd_ds_802_11d_domain_info domaininforesp;
                struct cmd_ds_802_11_tpc_cfg tpccfg;
                struct cmd_ds_802_11_afc afc;
                struct cmd_ds_802_11_led_ctrl ledgpio;
                struct cmd_ds_fwt_access fwt;
                struct cmd_ds_802_11_beacon_control bcn_ctrl;
        } params;
 -} __attribute__ ((packed));
 +} __packed;
  #endif
index 1c63f8ce73494ecc328f71262e08688fcdbe71f5,2163df01caedb4623836fc7756c6302016b9a072..a4d0bca9ef2c8aeac99f629b955d8056eaaa4c66
@@@ -4,18 -4,19 +4,19 @@@
  #include <linux/etherdevice.h>
  #include <linux/slab.h>
  #include <linux/types.h>
+ #include <net/cfg80211.h>
  
+ #include "defs.h"
  #include "host.h"
  #include "radiotap.h"
  #include "decl.h"
  #include "dev.h"
- #include "wext.h"
  
  struct eth803hdr {
        u8 dest_addr[6];
        u8 src_addr[6];
        u16 h803_len;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct rfc1042hdr {
        u8 llc_dsap;
        u8 llc_ctrl;
        u8 snap_oui[3];
        u16 snap_type;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct rxpackethdr {
        struct eth803hdr eth803_hdr;
        struct rfc1042hdr rfc1042_hdr;
 -} __attribute__ ((packed));
 +} __packed;
  
  struct rx80211packethdr {
        struct rxpd rx_pd;
        void *eth80211_hdr;
 -} __attribute__ ((packed));
 +} __packed;
  
  static int process_rxed_802_11_packet(struct lbs_private *priv,
        struct sk_buff *skb);
  
- /**
-  *  @brief    This function computes the avgSNR .
-  *
-  *  @param    priv    A pointer to struct lbs_private structure
-  *  @return   avgSNR
-  */
- static u8 lbs_getavgsnr(struct lbs_private *priv)
- {
-       u8 i;
-       u16 temp = 0;
-       if (priv->numSNRNF == 0)
-               return 0;
-       for (i = 0; i < priv->numSNRNF; i++)
-               temp += priv->rawSNR[i];
-       return (u8) (temp / priv->numSNRNF);
- }
- /**
-  *  @brief    This function computes the AvgNF
-  *
-  *  @param    priv    A pointer to struct lbs_private structure
-  *  @return   AvgNF
-  */
- static u8 lbs_getavgnf(struct lbs_private *priv)
- {
-       u8 i;
-       u16 temp = 0;
-       if (priv->numSNRNF == 0)
-               return 0;
-       for (i = 0; i < priv->numSNRNF; i++)
-               temp += priv->rawNF[i];
-       return (u8) (temp / priv->numSNRNF);
- }
- /**
-  *  @brief    This function save the raw SNR/NF to our internel buffer
-  *
-  *  @param    priv    A pointer to struct lbs_private structure
-  *  @param    prxpd   A pointer to rxpd structure of received packet
-  *  @return   n/a
-  */
- static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd)
- {
-       if (priv->numSNRNF < DEFAULT_DATA_AVG_FACTOR)
-               priv->numSNRNF++;
-       priv->rawSNR[priv->nextSNRNF] = p_rx_pd->snr;
-       priv->rawNF[priv->nextSNRNF] = p_rx_pd->nf;
-       priv->nextSNRNF++;
-       if (priv->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR)
-               priv->nextSNRNF = 0;
- }
- /**
-  *  @brief    This function computes the RSSI in received packet.
-  *
-  *  @param    priv    A pointer to struct lbs_private structure
-  *  @param    prxpd   A pointer to rxpd structure of received packet
-  *  @return   n/a
-  */
- static void lbs_compute_rssi(struct lbs_private *priv, struct rxpd *p_rx_pd)
- {
-       lbs_deb_enter(LBS_DEB_RX);
-       lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf);
-       lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n",
-              priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
-              priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
-       priv->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr;
-       priv->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf;
-       lbs_save_rawSNRNF(priv, p_rx_pd);
-       priv->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE;
-       priv->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE;
-       lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n",
-              priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
-              priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
-       priv->RSSI[TYPE_RXPD][TYPE_NOAVG] =
-           CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_NOAVG],
-                    priv->NF[TYPE_RXPD][TYPE_NOAVG]);
-       priv->RSSI[TYPE_RXPD][TYPE_AVG] =
-           CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
-                    priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
-       lbs_deb_leave(LBS_DEB_RX);
- }
  /**
   *  @brief This function processes received packet and forwards it
   *  to kernel/upper layer
@@@ -154,7 -63,7 +63,7 @@@ int lbs_process_rxed_packet(struct lbs_
  
        skb->ip_summed = CHECKSUM_NONE;
  
-       if (priv->monitormode)
+       if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR)
                return process_rxed_802_11_packet(priv, skb);
  
        p_rx_pd = (struct rxpd *) skb->data;
         */
        skb_pull(skb, hdrchop);
  
-       /* Take the data rate from the rxpd structure
-        * only if the rate is auto
-        */
-       if (priv->enablehwauto)
-               priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate);
-       lbs_compute_rssi(priv, p_rx_pd);
+       priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate);
  
        lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
        dev->stats.rx_bytes += skb->len;
@@@ -352,20 -255,18 +255,18 @@@ static int process_rxed_802_11_packet(s
        pradiotap_hdr = (void *)skb_push(skb, sizeof(struct rx_radiotap_hdr));
        memcpy(pradiotap_hdr, &radiotap_hdr, sizeof(struct rx_radiotap_hdr));
  
-       /* Take the data rate from the rxpd structure
-        * only if the rate is auto
-        */
-       if (priv->enablehwauto)
-               priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate);
-       lbs_compute_rssi(priv, prxpd);
+       priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate);
  
        lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
        dev->stats.rx_bytes += skb->len;
        dev->stats.rx_packets++;
  
-       skb->protocol = eth_type_trans(skb, priv->rtap_net_dev);
-       netif_rx(skb);
+       skb->protocol = eth_type_trans(skb, priv->dev);
+       if (in_interrupt())
+               netif_rx(skb);
+       else
+               netif_rx_ni(skb);
  
        ret = 0;
  
index 49a7dfb4809a1e5a5f71b9551908a03b147b23ee,af50895e4bb0756649ebbcf60b9280b0c9f0187f..e7f299dc9ef5b20966bad49042e77ce228f7a3cc
@@@ -317,7 -317,7 +317,7 @@@ struct hwsim_radiotap_hdr 
        u8 rt_rate;
        __le16 rt_channel;
        __le16 rt_chbitmask;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  static netdev_tx_t hwsim_mon_xmit(struct sk_buff *skb,
@@@ -1291,6 -1291,11 +1291,11 @@@ static int __init init_mac80211_hwsim(v
                hw->wiphy->n_addresses = 2;
                hw->wiphy->addresses = data->addresses;
  
+               if (fake_hw_scan) {
+                       hw->wiphy->max_scan_ssids = 255;
+                       hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
+               }
                hw->channel_change_time = 1;
                hw->queues = 4;
                hw->wiphy->interface_modes =
index 5e7f344b000d57741a8a789a4927cd76fccd773c,5e26edb57d822c45145f62fbf1cecb4e04134db8..719573bbbf81fce6e21560465702cbff814847f4
@@@ -238,19 -238,19 +238,19 @@@ struct ndis_80211_auth_request 
        u8 bssid[6];
        u8 padding[2];
        __le32 flags;
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_pmkid_candidate {
        u8 bssid[6];
        u8 padding[2];
        __le32 flags;
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_pmkid_cand_list {
        __le32 version;
        __le32 num_candidates;
        struct ndis_80211_pmkid_candidate candidate_list[0];
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_status_indication {
        __le32 status_type;
                struct ndis_80211_auth_request          auth_request[0];
                struct ndis_80211_pmkid_cand_list       cand_list;
        } u;
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_ssid {
        __le32 length;
        u8 essid[NDIS_802_11_LENGTH_SSID];
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_conf_freq_hop {
        __le32 length;
        __le32 hop_pattern;
        __le32 hop_set;
        __le32 dwell_time;
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_conf {
        __le32 length;
        __le32 atim_window;
        __le32 ds_config;
        struct ndis_80211_conf_freq_hop fh_config;
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_bssid_ex {
        __le32 length;
        u8 rates[NDIS_802_11_LENGTH_RATES_EX];
        __le32 ie_length;
        u8 ies[0];
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_bssid_list_ex {
        __le32 num_items;
        struct ndis_80211_bssid_ex bssid[0];
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_fixed_ies {
        u8 timestamp[8];
        __le16 beacon_interval;
        __le16 capabilities;
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_wep_key {
        __le32 size;
        __le32 index;
        __le32 length;
        u8 material[32];
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_key {
        __le32 size;
        u8 padding[6];
        u8 rsc[8];
        u8 material[32];
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_remove_key {
        __le32 size;
        __le32 index;
        u8 bssid[6];
        u8 padding[2];
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_config_param {
        __le32 name_offs;
        __le32 type;
        __le32 value_offs;
        __le32 value_length;
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_assoc_info {
        __le32 length;
        } resp_ie;
        __le32 resp_ie_length;
        __le32 offset_resp_ies;
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_auth_encr_pair {
        __le32 auth_mode;
        __le32 encr_mode;
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_capability {
        __le32 length;
        __le32 num_pmkids;
        __le32 num_auth_encr_pair;
        struct ndis_80211_auth_encr_pair auth_encr_pair[0];
 -} __attribute__((packed));
 +} __packed;
  
  struct ndis_80211_bssid_info {
        u8 bssid[6];
@@@ -520,8 -520,9 +520,9 @@@ static int rndis_scan(struct wiphy *wip
  
  static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed);
  
- static int rndis_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type,
-                               int dbm);
+ static int rndis_set_tx_power(struct wiphy *wiphy,
+                             enum nl80211_tx_power_setting type,
+                             int mbm);
  static int rndis_get_tx_power(struct wiphy *wiphy, int *dbm);
  
  static int rndis_connect(struct wiphy *wiphy, struct net_device *dev,
@@@ -1856,20 -1857,25 +1857,25 @@@ static int rndis_set_wiphy_params(struc
        return 0;
  }
  
- static int rndis_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type,
-                               int dbm)
+ static int rndis_set_tx_power(struct wiphy *wiphy,
+                             enum nl80211_tx_power_setting type,
+                             int mbm)
  {
        struct rndis_wlan_private *priv = wiphy_priv(wiphy);
        struct usbnet *usbdev = priv->usbdev;
  
-       netdev_dbg(usbdev->net, "%s(): type:0x%x dbm:%i\n",
-                  __func__, type, dbm);
+       netdev_dbg(usbdev->net, "%s(): type:0x%x mbm:%i\n",
+                  __func__, type, mbm);
+       if (mbm < 0 || (mbm % 100))
+               return -ENOTSUPP;
  
        /* Device doesn't support changing txpower after initialization, only
         * turn off/on radio. Support 'auto' mode and setting same dBm that is
         * currently used.
         */
-       if (type == TX_POWER_AUTOMATIC || dbm == get_bcm4320_power_dbm(priv)) {
+       if (type == NL80211_TX_POWER_AUTOMATIC ||
+           MBM_TO_DBM(mbm) == get_bcm4320_power_dbm(priv)) {
                if (!priv->radio_on)
                        disassociate(usbdev, true); /* turn on radio */
  
diff --combined include/net/cfg80211.h
index 9c45b905aefc90092f38f4badc4294689c994777,9b8b3f486ec81bedb2880baeee9c12140cfd3688..168fe530b214dfd0a301017fd3988b359b55301b
@@@ -875,19 -875,6 +875,6 @@@ enum wiphy_params_flags 
        WIPHY_PARAM_COVERAGE_CLASS      = 1 << 4,
  };
  
- /**
-  * enum tx_power_setting - TX power adjustment
-  *
-  * @TX_POWER_AUTOMATIC: the dbm parameter is ignored
-  * @TX_POWER_LIMITED: limit TX power by the dbm parameter
-  * @TX_POWER_FIXED: fix TX power to the dbm parameter
-  */
- enum tx_power_setting {
-       TX_POWER_AUTOMATIC,
-       TX_POWER_LIMITED,
-       TX_POWER_FIXED,
- };
  /*
   * cfg80211_bitrate_mask - masks for bitrate control
   */
@@@ -1149,7 -1136,7 +1136,7 @@@ struct cfg80211_ops 
        int     (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
  
        int     (*set_tx_power)(struct wiphy *wiphy,
-                               enum tx_power_setting type, int dbm);
+                               enum nl80211_tx_power_setting type, int mbm);
        int     (*get_tx_power)(struct wiphy *wiphy, int *dbm);
  
        int     (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
@@@ -1371,15 -1358,26 +1358,15 @@@ struct wiphy 
        char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
  };
  
 -#ifdef CONFIG_NET_NS
  static inline struct net *wiphy_net(struct wiphy *wiphy)
  {
 -      return wiphy->_net;
 +      return read_pnet(&wiphy->_net);
  }
  
  static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
  {
 -      wiphy->_net = net;
 +      write_pnet(&wiphy->_net, net);
  }
 -#else
 -static inline struct net *wiphy_net(struct wiphy *wiphy)
 -{
 -      return &init_net;
 -}
 -
 -static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
 -{
 -}
 -#endif
  
  /**
   * wiphy_priv - return priv from wiphy
diff --combined net/mac80211/cfg.c
index ed8c9f5be94f7e2173ef574cf78bb8ed6a351384,e55970bf2ba06f6afdb7d80988f5ffa77f51fffe..9eb02a34088989d68ff9ec499b0541ed3c962c85
@@@ -413,9 -413,6 +413,6 @@@ static int ieee80211_dump_survey(struc
  {
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  
-       if (!local->ops->get_survey)
-               return -EOPNOTSUPP;
        return drv_get_survey(local, idx, survey);
  }
  
@@@ -598,7 -595,7 +595,7 @@@ struct iapp_layer2_update 
        u8 ssap;                /* 0 */
        u8 control;
        u8 xid_info[3];
 -} __attribute__ ((packed));
 +} __packed;
  
  static void ieee80211_send_layer2_update(struct sta_info *sta)
  {
@@@ -1329,28 -1326,28 +1326,28 @@@ static int ieee80211_set_wiphy_params(s
  }
  
  static int ieee80211_set_tx_power(struct wiphy *wiphy,
-                                 enum tx_power_setting type, int dbm)
+                                 enum nl80211_tx_power_setting type, int mbm)
  {
        struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_channel *chan = local->hw.conf.channel;
        u32 changes = 0;
  
        switch (type) {
-       case TX_POWER_AUTOMATIC:
+       case NL80211_TX_POWER_AUTOMATIC:
                local->user_power_level = -1;
                break;
-       case TX_POWER_LIMITED:
-               if (dbm < 0)
-                       return -EINVAL;
-               local->user_power_level = dbm;
+       case NL80211_TX_POWER_LIMITED:
+               if (mbm < 0 || (mbm % 100))
+                       return -EOPNOTSUPP;
+               local->user_power_level = MBM_TO_DBM(mbm);
                break;
-       case TX_POWER_FIXED:
-               if (dbm < 0)
-                       return -EINVAL;
+       case NL80211_TX_POWER_FIXED:
+               if (mbm < 0 || (mbm % 100))
+                       return -EOPNOTSUPP;
                /* TODO: move to cfg80211 when it knows the channel */
-               if (dbm > chan->max_power)
+               if (MBM_TO_DBM(mbm) > chan->max_power)
                        return -EINVAL;
-               local->user_power_level = dbm;
+               local->user_power_level = MBM_TO_DBM(mbm);
                break;
        }
  
index 6f905f153ed7e43aa5b5c56c791946a93e81e907,f9251d50192cbe29414ba7d281c5b8e7c82297a0..a3649a86a784fc088bd6d32927e59d3eb2c288c4
@@@ -855,6 -855,8 +855,8 @@@ struct ieee80211_local 
         * this will override whatever chosen by mac80211 internally.
         */
        int dynamic_ps_forced_timeout;
+       int dynamic_ps_user_timeout;
+       bool disable_dynamic_ps;
  
        int user_power_level; /* in dBm */
        int power_constr_level; /* in dBm */
@@@ -1091,7 -1093,7 +1093,7 @@@ struct ieee80211_tx_status_rtap_hdr 
        u8 padding_for_rate;
        __le16 tx_flags;
        u8 data_retries;
 -} __attribute__ ((packed));
 +} __packed;
  
  
  /* HT */
diff --combined net/mac80211/rx.c
index a8aa0f2411a2dc60b562b88a7b55349baa3bf32e,d70e1a9c435401e070ab02f74c10096f087ce8d2..fa0f37e4afe4901226b0ccd668ae6a88c136eeb2
@@@ -293,7 -293,7 +293,7 @@@ ieee80211_rx_monitor(struct ieee80211_l
                        skb2 = skb_clone(skb, GFP_ATOMIC);
                        if (skb2) {
                                skb2->dev = prev_dev;
-                               netif_rx(skb2);
+                               netif_receive_skb(skb2);
                        }
                }
  
  
        if (prev_dev) {
                skb->dev = prev_dev;
-               netif_rx(skb);
+               netif_receive_skb(skb);
        } else
                dev_kfree_skb(skb);
  
@@@ -1578,7 -1578,7 +1578,7 @@@ ieee80211_deliver_skb(struct ieee80211_
                        /* deliver to local stack */
                        skb->protocol = eth_type_trans(skb, dev);
                        memset(skb->cb, 0, sizeof(skb->cb));
-                       netif_rx(skb);
+                       netif_receive_skb(skb);
                }
        }
  
@@@ -2056,11 -2056,11 +2056,11 @@@ ieee80211_rx_h_action(struct ieee80211_
        nskb = skb_copy_expand(rx->skb, local->hw.extra_tx_headroom, 0,
                               GFP_ATOMIC);
        if (nskb) {
-               struct ieee80211_mgmt *mgmt = (void *)nskb->data;
+               struct ieee80211_mgmt *nmgmt = (void *)nskb->data;
  
-               mgmt->u.action.category |= 0x80;
-               memcpy(mgmt->da, mgmt->sa, ETH_ALEN);
-               memcpy(mgmt->sa, rx->sdata->vif.addr, ETH_ALEN);
+               nmgmt->u.action.category |= 0x80;
+               memcpy(nmgmt->da, nmgmt->sa, ETH_ALEN);
+               memcpy(nmgmt->sa, rx->sdata->vif.addr, ETH_ALEN);
  
                memset(nskb->cb, 0, sizeof(nskb->cb));
  
@@@ -2194,7 -2194,7 +2194,7 @@@ static void ieee80211_rx_cooked_monitor
                u8 rate_or_pad;
                __le16 chan_freq;
                __le16 chan_flags;
 -      } __attribute__ ((packed)) *rthdr;
 +      } __packed *rthdr;
        struct sk_buff *skb = rx->skb, *skb2;
        struct net_device *prev_dev = NULL;
        struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
                        skb2 = skb_clone(skb, GFP_ATOMIC);
                        if (skb2) {
                                skb2->dev = prev_dev;
-                               netif_rx(skb2);
+                               netif_receive_skb(skb2);
                        }
                }
  
  
        if (prev_dev) {
                skb->dev = prev_dev;
-               netif_rx(skb);
+               netif_receive_skb(skb);
                skb = NULL;
        } else
                goto out_free_skb;
diff --combined net/wireless/nl80211.c
index 6b41d15c4a05b354b1e571e6132a4e6c3904bc3f,a999fc154623783c453f6625f186d47a386fe101..85285b43d3744c5abeef766ba86a6558f974b477
@@@ -153,6 -153,9 +153,9 @@@ static const struct nla_policy nl80211_
        [NL80211_ATTR_CQM] = { .type = NLA_NESTED, },
        [NL80211_ATTR_LOCAL_STATE_CHANGE] = { .type = NLA_FLAG },
        [NL80211_ATTR_AP_ISOLATE] = { .type = NLA_U8 },
+       [NL80211_ATTR_WIPHY_TX_POWER_SETTING] = { .type = NLA_U32 },
+       [NL80211_ATTR_WIPHY_TX_POWER_LEVEL] = { .type = NLA_U32 },
  };
  
  /* policy for the attributes */
@@@ -869,6 -872,34 +872,34 @@@ static int nl80211_set_wiphy(struct sk_
                        goto bad_res;
        }
  
+       if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) {
+               enum nl80211_tx_power_setting type;
+               int idx, mbm = 0;
+               if (!rdev->ops->set_tx_power) {
+                       return -EOPNOTSUPP;
+                       goto bad_res;
+               }
+               idx = NL80211_ATTR_WIPHY_TX_POWER_SETTING;
+               type = nla_get_u32(info->attrs[idx]);
+               if (!info->attrs[NL80211_ATTR_WIPHY_TX_POWER_LEVEL] &&
+                   (type != NL80211_TX_POWER_AUTOMATIC)) {
+                       result = -EINVAL;
+                       goto bad_res;
+               }
+               if (type != NL80211_TX_POWER_AUTOMATIC) {
+                       idx = NL80211_ATTR_WIPHY_TX_POWER_LEVEL;
+                       mbm = nla_get_u32(info->attrs[idx]);
+               }
+               result = rdev->ops->set_tx_power(&rdev->wiphy, type, mbm);
+               if (result)
+                       goto bad_res;
+       }
        changed = 0;
  
        if (info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]) {
@@@ -1107,7 -1138,7 +1138,7 @@@ static int nl80211_valid_4addr(struct c
                               enum nl80211_iftype iftype)
  {
        if (!use_4addr) {
 -              if (netdev && netdev->br_port)
 +              if (netdev && (netdev->priv_flags & IFF_BRIDGE_PORT))
                        return -EBUSY;
                return 0;
        }