From: Felix Fietkau Date: Mon, 6 Jul 2015 10:19:02 +0000 (+0000) Subject: mac80211: Backport ath10k firmware API v5 support X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=872729c325ce5191f5d71332e98023b653a487be;p=openwrt%2Fstaging%2Fmans0n.git mac80211: Backport ath10k firmware API v5 support These patches add support for the new version 5 firmware API. Signed-off-by: Matti Laakso SVN-Revision: 46194 --- diff --git a/package/kernel/mac80211/patches/931-ath10k_add_ath10k_fw_ie_htt_op_version.patch b/package/kernel/mac80211/patches/931-ath10k_add_ath10k_fw_ie_htt_op_version.patch new file mode 100644 index 0000000000..45384ed364 --- /dev/null +++ b/package/kernel/mac80211/patches/931-ath10k_add_ath10k_fw_ie_htt_op_version.patch @@ -0,0 +1,385 @@ +diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c +index 02da72e..f3788e2 100644 +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -675,6 +675,17 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) + ath10k_dbg(ar, ATH10K_DBG_BOOT, "found fw ie wmi op version %d\n", + ar->wmi.op_version); + break; ++ case ATH10K_FW_IE_HTT_OP_VERSION: ++ if (ie_len != sizeof(u32)) ++ break; ++ ++ version = (__le32 *)data; ++ ++ ar->htt.op_version = le32_to_cpup(version); ++ ++ ath10k_dbg(ar, ATH10K_DBG_BOOT, "found fw ie htt op version %d\n", ++ ar->htt.op_version); ++ break; + default: + ath10k_warn(ar, "Unknown FW IE: %u\n", + le32_to_cpu(hdr->id)); +diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c +index 4f59ab9..f782d76 100644 +--- a/drivers/net/wireless/ath/ath10k/htt.c ++++ b/drivers/net/wireless/ath/ath10k/htt.c +@@ -22,6 +22,86 @@ + #include "core.h" + #include "debug.h" + ++static const enum htt_t2h_msg_type htt_main_t2h_msg_types[] = { ++ [HTT_MAIN_T2H_MSG_TYPE_VERSION_CONF] = HTT_T2H_MSG_TYPE_VERSION_CONF, ++ [HTT_MAIN_T2H_MSG_TYPE_RX_IND] = HTT_T2H_MSG_TYPE_RX_IND, ++ [HTT_MAIN_T2H_MSG_TYPE_RX_FLUSH] = HTT_T2H_MSG_TYPE_RX_FLUSH, ++ [HTT_MAIN_T2H_MSG_TYPE_PEER_MAP] = HTT_T2H_MSG_TYPE_PEER_MAP, ++ [HTT_MAIN_T2H_MSG_TYPE_PEER_UNMAP] = HTT_T2H_MSG_TYPE_PEER_UNMAP, ++ [HTT_MAIN_T2H_MSG_TYPE_RX_ADDBA] = HTT_T2H_MSG_TYPE_RX_ADDBA, ++ [HTT_MAIN_T2H_MSG_TYPE_RX_DELBA] = HTT_T2H_MSG_TYPE_RX_DELBA, ++ [HTT_MAIN_T2H_MSG_TYPE_TX_COMPL_IND] = HTT_T2H_MSG_TYPE_TX_COMPL_IND, ++ [HTT_MAIN_T2H_MSG_TYPE_PKTLOG] = HTT_T2H_MSG_TYPE_PKTLOG, ++ [HTT_MAIN_T2H_MSG_TYPE_STATS_CONF] = HTT_T2H_MSG_TYPE_STATS_CONF, ++ [HTT_MAIN_T2H_MSG_TYPE_RX_FRAG_IND] = HTT_T2H_MSG_TYPE_RX_FRAG_IND, ++ [HTT_MAIN_T2H_MSG_TYPE_SEC_IND] = HTT_T2H_MSG_TYPE_SEC_IND, ++ [HTT_MAIN_T2H_MSG_TYPE_TX_INSPECT_IND] = ++ HTT_T2H_MSG_TYPE_TX_INSPECT_IND, ++ [HTT_MAIN_T2H_MSG_TYPE_MGMT_TX_COMPL_IND] = ++ HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION, ++ [HTT_MAIN_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND] = ++ HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND, ++ [HTT_MAIN_T2H_MSG_TYPE_RX_PN_IND] = HTT_T2H_MSG_TYPE_RX_PN_IND, ++ [HTT_MAIN_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND] = ++ HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND, ++ [HTT_MAIN_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST, ++}; ++ ++static const enum htt_t2h_msg_type htt_10x_t2h_msg_types[] = { ++ [HTT_10X_T2H_MSG_TYPE_VERSION_CONF] = HTT_T2H_MSG_TYPE_VERSION_CONF, ++ [HTT_10X_T2H_MSG_TYPE_RX_IND] = HTT_T2H_MSG_TYPE_RX_IND, ++ [HTT_10X_T2H_MSG_TYPE_RX_FLUSH] = HTT_T2H_MSG_TYPE_RX_FLUSH, ++ [HTT_10X_T2H_MSG_TYPE_PEER_MAP] = HTT_T2H_MSG_TYPE_PEER_MAP, ++ [HTT_10X_T2H_MSG_TYPE_PEER_UNMAP] = HTT_T2H_MSG_TYPE_PEER_UNMAP, ++ [HTT_10X_T2H_MSG_TYPE_RX_ADDBA] = HTT_T2H_MSG_TYPE_RX_ADDBA, ++ [HTT_10X_T2H_MSG_TYPE_RX_DELBA] = HTT_T2H_MSG_TYPE_RX_DELBA, ++ [HTT_10X_T2H_MSG_TYPE_TX_COMPL_IND] = HTT_T2H_MSG_TYPE_TX_COMPL_IND, ++ [HTT_10X_T2H_MSG_TYPE_PKTLOG] = HTT_T2H_MSG_TYPE_PKTLOG, ++ [HTT_10X_T2H_MSG_TYPE_STATS_CONF] = HTT_T2H_MSG_TYPE_STATS_CONF, ++ [HTT_10X_T2H_MSG_TYPE_RX_FRAG_IND] = HTT_T2H_MSG_TYPE_RX_FRAG_IND, ++ [HTT_10X_T2H_MSG_TYPE_SEC_IND] = HTT_T2H_MSG_TYPE_SEC_IND, ++ [HTT_10X_T2H_MSG_TYPE_RC_UPDATE_IND] = HTT_T2H_MSG_TYPE_RC_UPDATE_IND, ++ [HTT_10X_T2H_MSG_TYPE_TX_INSPECT_IND] = HTT_T2H_MSG_TYPE_TX_INSPECT_IND, ++ [HTT_10X_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST, ++ [HTT_10X_T2H_MSG_TYPE_CHAN_CHANGE] = HTT_T2H_MSG_TYPE_CHAN_CHANGE, ++ [HTT_10X_T2H_MSG_TYPE_AGGR_CONF] = HTT_T2H_MSG_TYPE_AGGR_CONF, ++ [HTT_10X_T2H_MSG_TYPE_STATS_NOUPLOAD] = HTT_T2H_MSG_TYPE_STATS_NOUPLOAD, ++ [HTT_10X_T2H_MSG_TYPE_MGMT_TX_COMPL_IND] = ++ HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION, ++}; ++ ++static const enum htt_t2h_msg_type htt_tlv_t2h_msg_types[] = { ++ [HTT_TLV_T2H_MSG_TYPE_VERSION_CONF] = HTT_T2H_MSG_TYPE_VERSION_CONF, ++ [HTT_TLV_T2H_MSG_TYPE_RX_IND] = HTT_T2H_MSG_TYPE_RX_IND, ++ [HTT_TLV_T2H_MSG_TYPE_RX_FLUSH] = HTT_T2H_MSG_TYPE_RX_FLUSH, ++ [HTT_TLV_T2H_MSG_TYPE_PEER_MAP] = HTT_T2H_MSG_TYPE_PEER_MAP, ++ [HTT_TLV_T2H_MSG_TYPE_PEER_UNMAP] = HTT_T2H_MSG_TYPE_PEER_UNMAP, ++ [HTT_TLV_T2H_MSG_TYPE_RX_ADDBA] = HTT_T2H_MSG_TYPE_RX_ADDBA, ++ [HTT_TLV_T2H_MSG_TYPE_RX_DELBA] = HTT_T2H_MSG_TYPE_RX_DELBA, ++ [HTT_TLV_T2H_MSG_TYPE_TX_COMPL_IND] = HTT_T2H_MSG_TYPE_TX_COMPL_IND, ++ [HTT_TLV_T2H_MSG_TYPE_PKTLOG] = HTT_T2H_MSG_TYPE_PKTLOG, ++ [HTT_TLV_T2H_MSG_TYPE_STATS_CONF] = HTT_T2H_MSG_TYPE_STATS_CONF, ++ [HTT_TLV_T2H_MSG_TYPE_RX_FRAG_IND] = HTT_T2H_MSG_TYPE_RX_FRAG_IND, ++ [HTT_TLV_T2H_MSG_TYPE_SEC_IND] = HTT_T2H_MSG_TYPE_SEC_IND, ++ [HTT_TLV_T2H_MSG_TYPE_RC_UPDATE_IND] = HTT_T2H_MSG_TYPE_RC_UPDATE_IND, ++ [HTT_TLV_T2H_MSG_TYPE_TX_INSPECT_IND] = HTT_T2H_MSG_TYPE_TX_INSPECT_IND, ++ [HTT_TLV_T2H_MSG_TYPE_MGMT_TX_COMPL_IND] = ++ HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION, ++ [HTT_TLV_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND] = ++ HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND, ++ [HTT_TLV_T2H_MSG_TYPE_RX_PN_IND] = HTT_T2H_MSG_TYPE_RX_PN_IND, ++ [HTT_TLV_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND] = ++ HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND, ++ [HTT_TLV_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND] = ++ HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND, ++ [HTT_TLV_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE] = ++ HTT_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE, ++ [HTT_TLV_T2H_MSG_TYPE_CHAN_CHANGE] = HTT_T2H_MSG_TYPE_CHAN_CHANGE, ++ [HTT_TLV_T2H_MSG_TYPE_RX_OFLD_PKT_ERR] = ++ HTT_T2H_MSG_TYPE_RX_OFLD_PKT_ERR, ++ [HTT_TLV_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST, ++}; ++ + int ath10k_htt_connect(struct ath10k_htt *htt) + { + struct ath10k_htc_svc_conn_req conn_req; +@@ -66,6 +146,24 @@ int ath10k_htt_init(struct ath10k *ar) + 8 + /* llc snap */ + 2; /* ip4 dscp or ip6 priority */ + ++ switch (ar->htt.op_version) { ++ case ATH10K_FW_HTT_OP_VERSION_10_1: ++ ar->htt.t2h_msg_types = htt_10x_t2h_msg_types; ++ ar->htt.t2h_msg_types_max = HTT_10X_T2H_NUM_MSGS; ++ break; ++ case ATH10K_FW_HTT_OP_VERSION_TLV: ++ ar->htt.t2h_msg_types = htt_tlv_t2h_msg_types; ++ ar->htt.t2h_msg_types_max = HTT_TLV_T2H_NUM_MSGS; ++ break; ++ case ATH10K_FW_HTT_OP_VERSION_MAIN: ++ case ATH10K_FW_HTT_OP_VERSION_UNSET: ++ ar->htt.t2h_msg_types = htt_main_t2h_msg_types; ++ ar->htt.t2h_msg_types_max = HTT_MAIN_T2H_NUM_MSGS; ++ break; ++ case ATH10K_FW_HTT_OP_VERSION_MAX: ++ WARN_ON(1); ++ return -EINVAL; ++ } + return 0; + } + +diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h +index 874bf44..95df742 100644 +--- a/drivers/net/wireless/ath/ath10k/htt.h ++++ b/drivers/net/wireless/ath/ath10k/htt.h +@@ -26,6 +26,7 @@ + + #include "htc.h" + #include "rx_desc.h" ++#include "hw.h" + + enum htt_dbg_stats_type { + HTT_DBG_STATS_WAL_PDEV_TXRX = 1 << 0, +@@ -271,35 +272,108 @@ enum htt_mgmt_tx_status { + + /*=== target -> host messages ===============================================*/ + +-enum htt_t2h_msg_type { +- HTT_T2H_MSG_TYPE_VERSION_CONF = 0x0, +- HTT_T2H_MSG_TYPE_RX_IND = 0x1, +- HTT_T2H_MSG_TYPE_RX_FLUSH = 0x2, +- HTT_T2H_MSG_TYPE_PEER_MAP = 0x3, +- HTT_T2H_MSG_TYPE_PEER_UNMAP = 0x4, +- HTT_T2H_MSG_TYPE_RX_ADDBA = 0x5, +- HTT_T2H_MSG_TYPE_RX_DELBA = 0x6, +- HTT_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, +- HTT_T2H_MSG_TYPE_PKTLOG = 0x8, +- HTT_T2H_MSG_TYPE_STATS_CONF = 0x9, +- HTT_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, +- HTT_T2H_MSG_TYPE_SEC_IND = 0xb, +- HTT_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, +- HTT_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, +- HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION = 0xe, +- HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf, +- HTT_T2H_MSG_TYPE_RX_PN_IND = 0x10, +- HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11, +- HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND = 0x12, ++enum htt_main_t2h_msg_type { ++ HTT_MAIN_T2H_MSG_TYPE_VERSION_CONF = 0x0, ++ HTT_MAIN_T2H_MSG_TYPE_RX_IND = 0x1, ++ HTT_MAIN_T2H_MSG_TYPE_RX_FLUSH = 0x2, ++ HTT_MAIN_T2H_MSG_TYPE_PEER_MAP = 0x3, ++ HTT_MAIN_T2H_MSG_TYPE_PEER_UNMAP = 0x4, ++ HTT_MAIN_T2H_MSG_TYPE_RX_ADDBA = 0x5, ++ HTT_MAIN_T2H_MSG_TYPE_RX_DELBA = 0x6, ++ HTT_MAIN_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, ++ HTT_MAIN_T2H_MSG_TYPE_PKTLOG = 0x8, ++ HTT_MAIN_T2H_MSG_TYPE_STATS_CONF = 0x9, ++ HTT_MAIN_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, ++ HTT_MAIN_T2H_MSG_TYPE_SEC_IND = 0xb, ++ HTT_MAIN_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, ++ HTT_MAIN_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe, ++ HTT_MAIN_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf, ++ HTT_MAIN_T2H_MSG_TYPE_RX_PN_IND = 0x10, ++ HTT_MAIN_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11, ++ HTT_MAIN_T2H_MSG_TYPE_TEST, ++ /* keep this last */ ++ HTT_MAIN_T2H_NUM_MSGS ++}; ++ ++enum htt_10x_t2h_msg_type { ++ HTT_10X_T2H_MSG_TYPE_VERSION_CONF = 0x0, ++ HTT_10X_T2H_MSG_TYPE_RX_IND = 0x1, ++ HTT_10X_T2H_MSG_TYPE_RX_FLUSH = 0x2, ++ HTT_10X_T2H_MSG_TYPE_PEER_MAP = 0x3, ++ HTT_10X_T2H_MSG_TYPE_PEER_UNMAP = 0x4, ++ HTT_10X_T2H_MSG_TYPE_RX_ADDBA = 0x5, ++ HTT_10X_T2H_MSG_TYPE_RX_DELBA = 0x6, ++ HTT_10X_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, ++ HTT_10X_T2H_MSG_TYPE_PKTLOG = 0x8, ++ HTT_10X_T2H_MSG_TYPE_STATS_CONF = 0x9, ++ HTT_10X_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, ++ HTT_10X_T2H_MSG_TYPE_SEC_IND = 0xb, ++ HTT_10X_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, ++ HTT_10X_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, ++ HTT_10X_T2H_MSG_TYPE_TEST = 0xe, ++ HTT_10X_T2H_MSG_TYPE_CHAN_CHANGE = 0xf, ++ HTT_10X_T2H_MSG_TYPE_AGGR_CONF = 0x11, ++ HTT_10X_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x12, ++ HTT_10X_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0x13, ++ /* keep this last */ ++ HTT_10X_T2H_NUM_MSGS ++}; ++ ++enum htt_tlv_t2h_msg_type { ++ HTT_TLV_T2H_MSG_TYPE_VERSION_CONF = 0x0, ++ HTT_TLV_T2H_MSG_TYPE_RX_IND = 0x1, ++ HTT_TLV_T2H_MSG_TYPE_RX_FLUSH = 0x2, ++ HTT_TLV_T2H_MSG_TYPE_PEER_MAP = 0x3, ++ HTT_TLV_T2H_MSG_TYPE_PEER_UNMAP = 0x4, ++ HTT_TLV_T2H_MSG_TYPE_RX_ADDBA = 0x5, ++ HTT_TLV_T2H_MSG_TYPE_RX_DELBA = 0x6, ++ HTT_TLV_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, ++ HTT_TLV_T2H_MSG_TYPE_PKTLOG = 0x8, ++ HTT_TLV_T2H_MSG_TYPE_STATS_CONF = 0x9, ++ HTT_TLV_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, ++ HTT_TLV_T2H_MSG_TYPE_SEC_IND = 0xb, ++ HTT_TLV_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, /* deprecated */ ++ HTT_TLV_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, ++ HTT_TLV_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe, ++ HTT_TLV_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf, ++ HTT_TLV_T2H_MSG_TYPE_RX_PN_IND = 0x10, ++ HTT_TLV_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11, ++ HTT_TLV_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND = 0x12, + /* 0x13 reservd */ +- HTT_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE = 0x14, ++ HTT_TLV_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE = 0x14, ++ HTT_TLV_T2H_MSG_TYPE_CHAN_CHANGE = 0x15, ++ HTT_TLV_T2H_MSG_TYPE_RX_OFLD_PKT_ERR = 0x16, ++ HTT_TLV_T2H_MSG_TYPE_TEST, ++ /* keep this last */ ++ HTT_TLV_T2H_NUM_MSGS ++}; + +- /* FIXME: Do not depend on this event id. Numbering of this event id is +- * broken across different firmware revisions and HTT version fails to +- * indicate this. +- */ ++enum htt_t2h_msg_type { ++ HTT_T2H_MSG_TYPE_VERSION_CONF, ++ HTT_T2H_MSG_TYPE_RX_IND, ++ HTT_T2H_MSG_TYPE_RX_FLUSH, ++ HTT_T2H_MSG_TYPE_PEER_MAP, ++ HTT_T2H_MSG_TYPE_PEER_UNMAP, ++ HTT_T2H_MSG_TYPE_RX_ADDBA, ++ HTT_T2H_MSG_TYPE_RX_DELBA, ++ HTT_T2H_MSG_TYPE_TX_COMPL_IND, ++ HTT_T2H_MSG_TYPE_PKTLOG, ++ HTT_T2H_MSG_TYPE_STATS_CONF, ++ HTT_T2H_MSG_TYPE_RX_FRAG_IND, ++ HTT_T2H_MSG_TYPE_SEC_IND, ++ HTT_T2H_MSG_TYPE_RC_UPDATE_IND, ++ HTT_T2H_MSG_TYPE_TX_INSPECT_IND, ++ HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION, ++ HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND, ++ HTT_T2H_MSG_TYPE_RX_PN_IND, ++ HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND, ++ HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND, ++ HTT_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE, ++ HTT_T2H_MSG_TYPE_CHAN_CHANGE, ++ HTT_T2H_MSG_TYPE_RX_OFLD_PKT_ERR, ++ HTT_T2H_MSG_TYPE_AGGR_CONF, ++ HTT_T2H_MSG_TYPE_STATS_NOUPLOAD, + HTT_T2H_MSG_TYPE_TEST, +- + /* keep this last */ + HTT_T2H_NUM_MSGS + }; +@@ -1248,6 +1322,10 @@ struct ath10k_htt { + u8 target_version_major; + u8 target_version_minor; + struct completion target_version_received; ++ enum ath10k_fw_htt_op_version op_version; ++ ++ const enum htt_t2h_msg_type *t2h_msg_types; ++ u32 t2h_msg_types_max; + + struct { + /* +diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c +index 01a2b38..21e9253 100644 +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c +@@ -1892,6 +1892,7 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) + { + struct ath10k_htt *htt = &ar->htt; + struct htt_resp *resp = (struct htt_resp *)skb->data; ++ enum htt_t2h_msg_type type; + + /* confirm alignment */ + if (!IS_ALIGNED((unsigned long)skb->data, 4)) +@@ -1899,7 +1900,16 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) + + ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx, msg_type: 0x%0X\n", + resp->hdr.msg_type); +- switch (resp->hdr.msg_type) { ++ ++ if (resp->hdr.msg_type >= ar->htt.t2h_msg_types_max) { ++ ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx, unsupported msg_type: 0x%0X\n max: 0x%0X", ++ resp->hdr.msg_type, ar->htt.t2h_msg_types_max); ++ dev_kfree_skb_any(skb); ++ return; ++ } ++ type = ar->htt.t2h_msg_types[resp->hdr.msg_type]; ++ ++ switch (type) { + case HTT_T2H_MSG_TYPE_VERSION_CONF: { + htt->target_version_major = resp->ver_resp.major; + htt->target_version_minor = resp->ver_resp.minor; +@@ -1976,7 +1986,6 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) + break; + } + case HTT_T2H_MSG_TYPE_TEST: +- /* FIX THIS */ + break; + case HTT_T2H_MSG_TYPE_STATS_CONF: + trace_ath10k_htt_stats(ar, skb->data, skb->len); +@@ -2018,11 +2027,8 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) + return; + } + case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND: +- /* FIXME: This WMI-TLV event is overlapping with 10.2 +- * CHAN_CHANGE - both being 0xF. Neither is being used in +- * practice so no immediate action is necessary. Nevertheless +- * HTT may need an abstraction layer like WMI has one day. +- */ ++ break; ++ case HTT_T2H_MSG_TYPE_CHAN_CHANGE: + break; + default: + ath10k_warn(ar, "htt event (%d) not handled\n", +diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h +index 22c993d..c236dd3 100644 +--- a/drivers/net/wireless/ath/ath10k/hw.h ++++ b/drivers/net/wireless/ath/ath10k/hw.h +@@ -104,6 +104,11 @@ enum ath10k_fw_ie_type { + * FW API 4 and above. + */ + ATH10K_FW_IE_WMI_OP_VERSION = 5, ++ ++ /* HTT "operations" interface version, 32 bit value. Supported from ++ * FW API 5 and above. ++ */ ++ ATH10K_FW_IE_HTT_OP_VERSION = 6, + }; + + enum ath10k_fw_wmi_op_version { +@@ -119,6 +124,20 @@ enum ath10k_fw_wmi_op_version { + ATH10K_FW_WMI_OP_VERSION_MAX, + }; + ++enum ath10k_fw_htt_op_version { ++ ATH10K_FW_HTT_OP_VERSION_UNSET = 0, ++ ++ ATH10K_FW_HTT_OP_VERSION_MAIN = 1, ++ ++ /* also used in 10.2 and 10.2.4 branches */ ++ ATH10K_FW_HTT_OP_VERSION_10_1 = 2, ++ ++ ATH10K_FW_HTT_OP_VERSION_TLV = 3, ++ ++ /* keep last */ ++ ATH10K_FW_HTT_OP_VERSION_MAX, ++}; ++ + enum ath10k_hw_rev { + ATH10K_HW_QCA988X, + ATH10K_HW_QCA6174, diff --git a/package/kernel/mac80211/patches/932-ath10k_bump_up_fw_api_to_5.patch b/package/kernel/mac80211/patches/932-ath10k_bump_up_fw_api_to_5.patch new file mode 100644 index 0000000000..bb61077839 --- /dev/null +++ b/package/kernel/mac80211/patches/932-ath10k_bump_up_fw_api_to_5.patch @@ -0,0 +1,43 @@ +diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c +index f3788e2..1c74585d 100644 +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -741,6 +741,13 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar) + /* calibration file is optional, don't check for any errors */ + ath10k_fetch_cal_file(ar); + ++ ar->fw_api = 5; ++ ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); ++ ++ ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API5_FILE); ++ if (ret == 0) ++ goto success; ++ + ar->fw_api = 4; + ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api); + +diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h +index c236dd3..46e14d1 100644 +--- a/drivers/net/wireless/ath/ath10k/hw.h ++++ b/drivers/net/wireless/ath/ath10k/hw.h +@@ -78,6 +78,9 @@ enum qca6174_chip_id_rev { + /* added support for ATH10K_FW_IE_WMI_OP_VERSION */ + #define ATH10K_FW_API4_FILE "firmware-4.bin" + ++/* HTT id conflict fix for management frames over HTT */ ++#define ATH10K_FW_API5_FILE "firmware-5.bin" ++ + #define ATH10K_FW_UTF_FILE "utf.bin" + + /* includes also the null byte */ +diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c +index b4aacfa..262a84f 100644 +--- a/drivers/net/wireless/ath/ath10k/pci.c ++++ b/drivers/net/wireless/ath/ath10k/pci.c +@@ -2780,5 +2780,6 @@ MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_FW_FILE); + MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" ATH10K_FW_API2_FILE); + MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" ATH10K_FW_API3_FILE); ++MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" ATH10K_FW_API5_FILE); + MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_BOARD_DATA_FILE); + + /* QCA6174 2.1 firmware files */ diff --git a/package/kernel/mac80211/patches/933-ath10k_fix_htt_op_backwards_compatibility_for_qca6174.patch b/package/kernel/mac80211/patches/933-ath10k_fix_htt_op_backwards_compatibility_for_qca6174.patch new file mode 100644 index 0000000000..fff764647f --- /dev/null +++ b/package/kernel/mac80211/patches/933-ath10k_fix_htt_op_backwards_compatibility_for_qca6174.patch @@ -0,0 +1,47 @@ +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -1002,6 +1002,29 @@ static int ath10k_core_init_firmware_fea + return -EINVAL; + } + ++ /* Backwards compatibility for firmwares without ++ * ATH10K_FW_IE_HTT_OP_VERSION. ++ */ ++ if (ar->htt.op_version == ATH10K_FW_HTT_OP_VERSION_UNSET) { ++ switch (ar->wmi.op_version) { ++ case ATH10K_FW_WMI_OP_VERSION_MAIN: ++ ar->htt.op_version = ATH10K_FW_HTT_OP_VERSION_MAIN; ++ break; ++ case ATH10K_FW_WMI_OP_VERSION_10_1: ++ case ATH10K_FW_WMI_OP_VERSION_10_2: ++ case ATH10K_FW_WMI_OP_VERSION_10_2_4: ++ ar->htt.op_version = ATH10K_FW_HTT_OP_VERSION_10_1; ++ break; ++ case ATH10K_FW_WMI_OP_VERSION_TLV: ++ ar->htt.op_version = ATH10K_FW_HTT_OP_VERSION_TLV; ++ break; ++ case ATH10K_FW_WMI_OP_VERSION_UNSET: ++ case ATH10K_FW_WMI_OP_VERSION_MAX: ++ WARN_ON(1); ++ return -EINVAL; ++ } ++ } ++ + return 0; + } + +--- a/drivers/net/wireless/ath/ath10k/htt.c ++++ b/drivers/net/wireless/ath/ath10k/htt.c +@@ -156,11 +156,11 @@ int ath10k_htt_init(struct ath10k *ar) + ar->htt.t2h_msg_types_max = HTT_TLV_T2H_NUM_MSGS; + break; + case ATH10K_FW_HTT_OP_VERSION_MAIN: +- case ATH10K_FW_HTT_OP_VERSION_UNSET: + ar->htt.t2h_msg_types = htt_main_t2h_msg_types; + ar->htt.t2h_msg_types_max = HTT_MAIN_T2H_NUM_MSGS; + break; + case ATH10K_FW_HTT_OP_VERSION_MAX: ++ case ATH10K_FW_HTT_OP_VERSION_UNSET: + WARN_ON(1); + return -EINVAL; + }