aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-04-05 12:42:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-07 15:51:38 -0400
commit3997ff39faa184a2ff670a6792cdb89ff51cf78f (patch)
tree04dc0167b5f70aa4b6d784b52f36aade4e78eb1d /drivers/net
parent7415952ff789b1c1878119662d4dc011ac9d261e (diff)
iwlagn: add feature flags
Some new devices and microcode files will a greater variety of features, so the TLV-per-feature approach we took before will quickly make things harder to manage and increase the file size. Add a new TLV that has feature flags. Currently, it will contain: 1) a PAN feature flag, which moves from a separate TLV 2) a new BT stats bit that indicates whether the microcode image uses bluetooth statistics 3) a new MFP flag for management frame protection which can be enabled once the device/microcode supports it Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c29
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h17
3 files changed, 44 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 2f4fe16d1eea..30b8b9e1bc2e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1191,7 +1191,7 @@ static void iwl_nic_start(struct iwl_priv *priv)
1191struct iwlagn_ucode_capabilities { 1191struct iwlagn_ucode_capabilities {
1192 u32 max_probe_length; 1192 u32 max_probe_length;
1193 u32 standard_phy_calibration_size; 1193 u32 standard_phy_calibration_size;
1194 bool pan; 1194 u32 flags;
1195}; 1195};
1196 1196
1197static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); 1197static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context);
@@ -1418,7 +1418,23 @@ static int iwlagn_load_firmware(struct iwl_priv *priv,
1418 case IWL_UCODE_TLV_PAN: 1418 case IWL_UCODE_TLV_PAN:
1419 if (tlv_len) 1419 if (tlv_len)
1420 goto invalid_tlv_len; 1420 goto invalid_tlv_len;
1421 capa->pan = true; 1421 capa->flags |= IWL_UCODE_TLV_FLAGS_PAN;
1422 break;
1423 case IWL_UCODE_TLV_FLAGS:
1424 /* must be at least one u32 */
1425 if (tlv_len < sizeof(u32))
1426 goto invalid_tlv_len;
1427 /* and a proper number of u32s */
1428 if (tlv_len % sizeof(u32))
1429 goto invalid_tlv_len;
1430 /*
1431 * This driver only reads the first u32 as
1432 * right now no more features are defined,
1433 * if that changes then either the driver
1434 * will not work with the new firmware, or
1435 * it'll not take advantage of new features.
1436 */
1437 capa->flags = le32_to_cpup((__le32 *)tlv_data);
1422 break; 1438 break;
1423 case IWL_UCODE_TLV_INIT_EVTLOG_PTR: 1439 case IWL_UCODE_TLV_INIT_EVTLOG_PTR:
1424 if (tlv_len != sizeof(u32)) 1440 if (tlv_len != sizeof(u32))
@@ -1681,12 +1697,16 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1681 priv->cfg->base_params->max_event_log_size; 1697 priv->cfg->base_params->max_event_log_size;
1682 priv->_agn.inst_errlog_ptr = pieces.inst_errlog_ptr; 1698 priv->_agn.inst_errlog_ptr = pieces.inst_errlog_ptr;
1683 1699
1684 if (ucode_capa.pan) { 1700 if (ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN) {
1685 priv->valid_contexts |= BIT(IWL_RXON_CTX_PAN); 1701 priv->valid_contexts |= BIT(IWL_RXON_CTX_PAN);
1686 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN; 1702 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
1687 } else 1703 } else
1688 priv->sta_key_max_num = STA_KEY_MAX_NUM; 1704 priv->sta_key_max_num = STA_KEY_MAX_NUM;
1689 1705
1706 if (ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BTSTATS ||
1707 (priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics))
1708 priv->bt_statistics = true;
1709
1690 /* Copy images into buffers for card's bus-master reads ... */ 1710 /* Copy images into buffers for card's bus-master reads ... */
1691 1711
1692 /* Runtime instructions (first block of data in file) */ 1712 /* Runtime instructions (first block of data in file) */
@@ -2827,6 +2847,9 @@ static int iwl_mac_setup_register(struct iwl_priv *priv,
2827 hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | 2847 hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
2828 IEEE80211_HW_SUPPORTS_STATIC_SMPS; 2848 IEEE80211_HW_SUPPORTS_STATIC_SMPS;
2829 2849
2850 if (capa->flags & IWL_UCODE_TLV_FLAGS_MFP)
2851 hw->flags |= IEEE80211_HW_MFP_CAPABLE;
2852
2830 hw->sta_data_size = sizeof(struct iwl_station_priv); 2853 hw->sta_data_size = sizeof(struct iwl_station_priv);
2831 hw->vif_data_size = sizeof(struct iwl_vif_priv); 2854 hw->vif_data_size = sizeof(struct iwl_vif_priv);
2832 2855
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 696b056b070c..7b9f64ea9662 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -723,7 +723,7 @@ static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv)
723 723
724static inline bool iwl_bt_statistics(struct iwl_priv *priv) 724static inline bool iwl_bt_statistics(struct iwl_priv *priv)
725{ 725{
726 return priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics; 726 return priv->bt_statistics;
727} 727}
728 728
729extern bool bt_coex_active; 729extern bool bt_coex_active;
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 0696e7ff0f37..2f7458d3be9c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -535,6 +535,22 @@ enum iwl_ucode_tlv_type {
535 IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13, 535 IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13,
536 IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14, 536 IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14,
537 IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15, 537 IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15,
538 /* 16 and 17 reserved for future use */
539 IWL_UCODE_TLV_FLAGS = 18,
540};
541
542/**
543 * enum iwl_ucode_tlv_flag - ucode API flags
544 * @IWL_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously
545 * was a separate TLV but moved here to save space.
546 * @IWL_UCODE_TLV_FLAGS_BTSTATS: This uCode image uses BT statistics, which
547 * may be true even if the device doesn't have BT.
548 * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
549 */
550enum iwl_ucode_tlv_flag {
551 IWL_UCODE_TLV_FLAGS_PAN = BIT(0),
552 IWL_UCODE_TLV_FLAGS_BTSTATS = BIT(1),
553 IWL_UCODE_TLV_FLAGS_MFP = BIT(2),
538}; 554};
539 555
540struct iwl_ucode_tlv { 556struct iwl_ucode_tlv {
@@ -1410,6 +1426,7 @@ struct iwl_priv {
1410 bool bt_ch_announce; 1426 bool bt_ch_announce;
1411 bool bt_full_concurrent; 1427 bool bt_full_concurrent;
1412 bool bt_ant_couple_ok; 1428 bool bt_ant_couple_ok;
1429 bool bt_statistics;
1413 __le32 kill_ack_mask; 1430 __le32 kill_ack_mask;
1414 __le32 kill_cts_mask; 1431 __le32 kill_cts_mask;
1415 __le16 bt_valid; 1432 __le16 bt_valid;