diff options
author | Avinash Patil <patila@marvell.com> | 2014-02-07 19:30:42 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-02-12 15:36:26 -0500 |
commit | 7f445d0435017ba0daeb83574028fc16c68df1f5 (patch) | |
tree | eb0829c4e7374827fcf44298753a6d150a780aab | |
parent | be104b916caf36af7e664b61149389b96c1c0ff6 (diff) |
mwifiex: parse API version from FW
This patch adds support to parse FW API version TLVs.
Currently only API version for key_material is supported.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/mwifiex/cmdevt.c | 45 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/fw.h | 13 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/init.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 1 |
4 files changed, 60 insertions, 1 deletions
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 7711b11a9812..21544602043c 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -1455,7 +1455,10 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv, | |||
1455 | { | 1455 | { |
1456 | struct host_cmd_ds_get_hw_spec *hw_spec = &resp->params.hw_spec; | 1456 | struct host_cmd_ds_get_hw_spec *hw_spec = &resp->params.hw_spec; |
1457 | struct mwifiex_adapter *adapter = priv->adapter; | 1457 | struct mwifiex_adapter *adapter = priv->adapter; |
1458 | int i; | 1458 | struct mwifiex_ie_types_header *tlv; |
1459 | struct hw_spec_fw_api_rev *api_rev; | ||
1460 | u16 resp_size, api_id; | ||
1461 | int i, left_len, parsed_len = 0; | ||
1459 | 1462 | ||
1460 | adapter->fw_cap_info = le32_to_cpu(hw_spec->fw_cap_info); | 1463 | adapter->fw_cap_info = le32_to_cpu(hw_spec->fw_cap_info); |
1461 | 1464 | ||
@@ -1513,6 +1516,46 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv, | |||
1513 | adapter->is_hw_11ac_capable = false; | 1516 | adapter->is_hw_11ac_capable = false; |
1514 | } | 1517 | } |
1515 | 1518 | ||
1519 | resp_size = le16_to_cpu(resp->size) - S_DS_GEN; | ||
1520 | if (resp_size > sizeof(struct host_cmd_ds_get_hw_spec)) { | ||
1521 | /* we have variable HW SPEC information */ | ||
1522 | left_len = resp_size - sizeof(struct host_cmd_ds_get_hw_spec); | ||
1523 | while (left_len > sizeof(struct mwifiex_ie_types_header)) { | ||
1524 | tlv = (void *)&hw_spec->tlvs + parsed_len; | ||
1525 | switch (le16_to_cpu(tlv->type)) { | ||
1526 | case TLV_TYPE_FW_API_REV: | ||
1527 | api_rev = (struct hw_spec_fw_api_rev *)tlv; | ||
1528 | api_id = le16_to_cpu(api_rev->api_id); | ||
1529 | switch (api_id) { | ||
1530 | case KEY_API_VER_ID: | ||
1531 | adapter->fw_key_api_major_ver = | ||
1532 | api_rev->major_ver; | ||
1533 | adapter->fw_key_api_minor_ver = | ||
1534 | api_rev->minor_ver; | ||
1535 | dev_dbg(adapter->dev, | ||
1536 | "fw_key_api v%d.%d\n", | ||
1537 | adapter->fw_key_api_major_ver, | ||
1538 | adapter->fw_key_api_minor_ver); | ||
1539 | break; | ||
1540 | default: | ||
1541 | dev_warn(adapter->dev, | ||
1542 | "Unknown FW api_id: %d\n", | ||
1543 | api_id); | ||
1544 | break; | ||
1545 | } | ||
1546 | break; | ||
1547 | default: | ||
1548 | dev_warn(adapter->dev, | ||
1549 | "Unknown GET_HW_SPEC TLV type: %#x\n", | ||
1550 | le16_to_cpu(tlv->type)); | ||
1551 | break; | ||
1552 | } | ||
1553 | parsed_len += le16_to_cpu(tlv->len) + | ||
1554 | sizeof(struct mwifiex_ie_types_header); | ||
1555 | left_len -= parsed_len; | ||
1556 | } | ||
1557 | } | ||
1558 | |||
1516 | dev_dbg(adapter->dev, "info: GET_HW_SPEC: fw_release_number- %#x\n", | 1559 | dev_dbg(adapter->dev, "info: GET_HW_SPEC: fw_release_number- %#x\n", |
1517 | adapter->fw_release_number); | 1560 | adapter->fw_release_number); |
1518 | dev_dbg(adapter->dev, "info: GET_HW_SPEC: permanent addr: %pM\n", | 1561 | dev_dbg(adapter->dev, "info: GET_HW_SPEC: permanent addr: %pM\n", |
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 2344abdeaf6d..5808f238f1cd 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -159,6 +159,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
159 | #define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 145) | 159 | #define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 145) |
160 | #define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146) | 160 | #define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146) |
161 | #define TLV_TYPE_COALESCE_RULE (PROPRIETARY_TLV_BASE_ID + 154) | 161 | #define TLV_TYPE_COALESCE_RULE (PROPRIETARY_TLV_BASE_ID + 154) |
162 | #define TLV_TYPE_FW_API_REV (PROPRIETARY_TLV_BASE_ID + 199) | ||
162 | 163 | ||
163 | #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 | 164 | #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 |
164 | 165 | ||
@@ -751,6 +752,17 @@ struct host_cmd_ds_802_11_ps_mode_enh { | |||
751 | } params; | 752 | } params; |
752 | } __packed; | 753 | } __packed; |
753 | 754 | ||
755 | enum FW_API_VER_ID { | ||
756 | KEY_API_VER_ID = 1, | ||
757 | }; | ||
758 | |||
759 | struct hw_spec_fw_api_rev { | ||
760 | struct mwifiex_ie_types_header header; | ||
761 | __le16 api_id; | ||
762 | u8 major_ver; | ||
763 | u8 minor_ver; | ||
764 | } __packed; | ||
765 | |||
754 | struct host_cmd_ds_get_hw_spec { | 766 | struct host_cmd_ds_get_hw_spec { |
755 | __le16 hw_if_version; | 767 | __le16 hw_if_version; |
756 | __le16 version; | 768 | __le16 version; |
@@ -772,6 +784,7 @@ struct host_cmd_ds_get_hw_spec { | |||
772 | __le32 reserved_6; | 784 | __le32 reserved_6; |
773 | __le32 dot_11ac_dev_cap; | 785 | __le32 dot_11ac_dev_cap; |
774 | __le32 dot_11ac_mcs_support; | 786 | __le32 dot_11ac_mcs_support; |
787 | u8 tlvs[0]; | ||
775 | } __packed; | 788 | } __packed; |
776 | 789 | ||
777 | struct host_cmd_ds_802_11_rssi_info { | 790 | struct host_cmd_ds_802_11_rssi_info { |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index 9dc8059778a0..a4cd2cb066ed 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -283,6 +283,8 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) | |||
283 | adapter->max_mgmt_ie_index = MAX_MGMT_IE_INDEX; | 283 | adapter->max_mgmt_ie_index = MAX_MGMT_IE_INDEX; |
284 | adapter->empty_tx_q_cnt = 0; | 284 | adapter->empty_tx_q_cnt = 0; |
285 | adapter->ext_scan = true; | 285 | adapter->ext_scan = true; |
286 | adapter->fw_key_api_major_ver = 0; | ||
287 | adapter->fw_key_api_minor_ver = 0; | ||
286 | } | 288 | } |
287 | 289 | ||
288 | /* | 290 | /* |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 82754ed94a8a..de115fa745cb 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -801,6 +801,7 @@ struct mwifiex_adapter { | |||
801 | atomic_t pending_bridged_pkts; | 801 | atomic_t pending_bridged_pkts; |
802 | struct semaphore *card_sem; | 802 | struct semaphore *card_sem; |
803 | bool ext_scan; | 803 | bool ext_scan; |
804 | u8 fw_key_api_major_ver, fw_key_api_minor_ver; | ||
804 | }; | 805 | }; |
805 | 806 | ||
806 | int mwifiex_init_lock_list(struct mwifiex_adapter *adapter); | 807 | int mwifiex_init_lock_list(struct mwifiex_adapter *adapter); |