From 360f0419df809b388b94bbb74b6f65648450b24a Mon Sep 17 00:00:00 2001 From: Rhythm Patwa Date: Sun, 14 Jun 2020 18:28:26 -0700 Subject: [PATCH] qcacmn: Add support to handle frames with HT/VHT/HE control field Add support to handle the case where the peer transmits a frame with HT/VHT/HE control field included. Change-Id: I2b0d04ffa12a983a6c22e0a0bcbdfffa8fd48dcb CRs-fixed: 2754234 --- .../cmn_defs/inc/wlan_cmn_ieee80211.h | 2 ++ umac/cmn_services/crypto/src/wlan_crypto_def_i.h | 6 ++++++ .../dispatcher/src/wlan_mgmt_txrx_tgt_api.c | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h index 7376743178..8658263397 100644 --- a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h +++ b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h @@ -26,10 +26,12 @@ #include #define IEEE80211_CCMP_HEADERLEN 8 +#define IEEE80211_HT_CTRL_LEN 4 #define IEEE80211_CCMP_MICLEN 8 #define WLAN_IEEE80211_GCMP_HEADERLEN 8 #define WLAN_IEEE80211_GCMP_MICLEN 16 #define IEEE80211_FC1_WEP 0x40 +#define IEEE80211_FC1_ORDER 0x80 #define WLAN_HDR_IV_LEN 3 #define WLAN_HDR_EXT_IV_BIT 0x20 #define WLAN_HDR_EXT_IV_LEN 4 diff --git a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h index 221806d7f1..7baf0f237b 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h +++ b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h @@ -523,6 +523,12 @@ static inline uint8_t ieee80211_hdrsize(const void *data) if (hdr->i_fc[1] & WLAN_FC1_ORDER) size += (sizeof(uint8_t)*4); } + if (((WLAN_FC0_GET_STYPE(hdr->i_fc[0]) + == WLAN_FC0_STYPE_ACTION))) { + /* Action frame with Order bit set indicates an HTC frame */ + if (hdr->i_fc[1] & WLAN_FC1_ORDER) + size += (sizeof(uint8_t)*4); + } return size; } diff --git a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c index 0d6b470ae0..abf8465e56 100644 --- a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c +++ b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c @@ -1036,6 +1036,7 @@ QDF_STATUS tgt_mgmt_txrx_rx_frame_handler( struct mgmt_rx_handler *rx_handler_head = NULL, *rx_handler_tail = NULL; u_int8_t *data, *ivp = NULL; uint16_t buflen; + uint16_t len = 0; QDF_STATUS status = QDF_STATUS_SUCCESS; bool is_from_addr_valid, is_bssid_valid; @@ -1099,13 +1100,25 @@ QDF_STATUS tgt_mgmt_txrx_rx_frame_handler( /* mpdu_data_ptr is pointer to action header */ mpdu_data_ptr = (uint8_t *)qdf_nbuf_data(buf) + sizeof(struct ieee80211_frame); + + if (wh->i_fc[1] & IEEE80211_FC1_ORDER) { + /* Adjust the offset taking into consideration HT control field + * length, in the case when peer sends a frame with HT/VHT/HE + * ctrl field in the header(when frame is transmitted in TB + * PPDU format). + */ + mpdu_data_ptr += IEEE80211_HT_CTRL_LEN; + len = IEEE80211_HT_CTRL_LEN; + mgmt_txrx_debug_rl("HT control field present!"); + } + if ((wh->i_fc[1] & IEEE80211_FC1_WEP) && !qdf_is_macaddr_group((struct qdf_mac_addr *)wh->i_addr1) && !qdf_is_macaddr_broadcast((struct qdf_mac_addr *)wh->i_addr1)) { if (buflen > (sizeof(struct ieee80211_frame) + WLAN_HDR_EXT_IV_LEN)) - ivp = data + sizeof(struct ieee80211_frame); + ivp = data + sizeof(struct ieee80211_frame) + len; /* Set mpdu_data_ptr based on EXT IV bit * if EXT IV bit set, CCMP using PMF 8 bytes of IV is present