From 0e8a2c655847127cb9004c463b03055900ad6fa8 Mon Sep 17 00:00:00 2001 From: psimha Date: Mon, 9 Apr 2018 17:48:15 -0700 Subject: [PATCH] qcacmn: Get NSS info from SS bitmap Get NSS info from a the MIMO SS bitmap within msdu_start info Change-Id: I794b093783b5f1ffc7faf335da84cbc07375d520 CRs-Fixed: 2215660 --- dp/wifi3.0/hal_rx.h | 15 ++++++++++++++- qdf/inc/qdf_util.h | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/dp/wifi3.0/hal_rx.h b/dp/wifi3.0/hal_rx.h index 17ba35e9e2ea..eb84f5b81a1b 100644 --- a/dp/wifi3.0/hal_rx.h +++ b/dp/wifi3.0/hal_rx.h @@ -1532,10 +1532,23 @@ hal_rx_msdu_start_nss_get(uint8_t *buf) return nss; } #else +#define HAL_RX_MSDU_START_MIMO_SS_BITMAP(_rx_msdu_start) \ + (_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_msdu_start),\ + RX_MSDU_START_5_MIMO_SS_BITMAP_OFFSET)), \ + RX_MSDU_START_5_MIMO_SS_BITMAP_MASK, \ + RX_MSDU_START_5_MIMO_SS_BITMAP_LSB)) + static inline uint32_t hal_rx_msdu_start_nss_get(uint8_t *buf) { - return 0; + struct rx_pkt_tlvs *pkt_tlvs = (struct rx_pkt_tlvs *)buf; + struct rx_msdu_start *msdu_start = + &pkt_tlvs->msdu_start_tlv.rx_msdu_start; + uint8_t mimo_ss_bitmap; + + mimo_ss_bitmap = HAL_RX_MSDU_START_MIMO_SS_BITMAP(msdu_start); + + return qdf_get_hweight8(mimo_ss_bitmap); } #endif diff --git a/qdf/inc/qdf_util.h b/qdf/inc/qdf_util.h index 8b878f667f67..a66fbb5b8377 100644 --- a/qdf/inc/qdf_util.h +++ b/qdf/inc/qdf_util.h @@ -576,6 +576,22 @@ int qdf_get_cpu(void) return __qdf_get_cpu(); } +/** + * qdf_get_hweight8() - count num of 1's in bitmap + * @value: input bitmap + * + * Count num of 1's set in the bitmap + * + * Return: num of 1's + */ +static inline +unsigned int qdf_get_hweight8(unsigned int w) +{ + unsigned int res = w - ((w >> 1) & 0x55); + res = (res & 0x33) + ((res >> 2) & 0x33); + return (res + (res >> 4)) & 0x0F; +} + /** * qdf_device_init_wakeup() - allow a device to wake up the aps system * @qdf_dev: the qdf device context