From 96863531f129993669c2a9f8dffc5884605ff912 Mon Sep 17 00:00:00 2001 From: Madhvapathi Sriram Date: Fri, 20 Apr 2018 09:22:51 +0530 Subject: [PATCH] qcacmn: Add management frame over WMI support for HL transport QCN7605 requires Management frames to be transported over WMI. Enable this for HL transport too. Change-Id: I97551684224cf027beadb403ac2220fa355af986 CRs-Fixed: 2252391 --- wmi/inc/wmi_unified_param.h | 4 ++ wmi/src/wmi_unified_tlv.c | 82 +++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index c09784b9ce38..78e408618fd7 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -38,7 +38,11 @@ #define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ #define WMI_MAC_MAX_SSID_LENGTH 32 #define WMI_SCAN_MAX_NUM_SSID 0x0A +#ifndef CONFIG_HL_SUPPORT #define mgmt_tx_dl_frm_len 64 +#else +#define mgmt_tx_dl_frm_len 1532 +#endif #define WMI_SMPS_MASK_LOWER_16BITS 0xFF #define WMI_SMPS_MASK_UPPER_3BITS 0x7 #define WMI_SMPS_PARAM_VALUE_S 29 diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 02d2396019b9..c56886a8132d 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -3038,6 +3038,87 @@ static inline QDF_STATUS populate_tx_send_params(uint8_t *bufp, return status; } +#ifdef CONFIG_HL_SUPPORT +/** + * send_mgmt_cmd_tlv() - WMI scan start function + * @wmi_handle : handle to WMI. + * @param : pointer to hold mgmt cmd parameter + * + * Return: 0 on success and -ve on failure. + */ +static QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle, + struct wmi_mgmt_params *param) +{ + wmi_buf_t buf; + uint8_t *bufp; + int32_t cmd_len; + wmi_mgmt_tx_send_cmd_fixed_param *cmd; + int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ? param->frm_len : + mgmt_tx_dl_frm_len; + + if (param->frm_len > mgmt_tx_dl_frm_len) { + WMI_LOGE("%s:mgmt frame len %u exceeds %u", + __func__, param->frm_len, mgmt_tx_dl_frm_len); + return QDF_STATUS_E_INVAL; + } + + cmd_len = sizeof(wmi_mgmt_tx_send_cmd_fixed_param) + + WMI_TLV_HDR_SIZE + + roundup(bufp_len, sizeof(uint32_t)); + + buf = wmi_buf_alloc(wmi_handle, sizeof(wmi_tx_send_params) + cmd_len); + if (!buf) { + WMI_LOGE("%s:wmi_buf_alloc failed", __func__); + return QDF_STATUS_E_NOMEM; + } + + cmd = (wmi_mgmt_tx_send_cmd_fixed_param *)wmi_buf_data(buf); + bufp = (uint8_t *) cmd; + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_mgmt_tx_send_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_mgmt_tx_send_cmd_fixed_param)); + + cmd->vdev_id = param->vdev_id; + + cmd->desc_id = param->desc_id; + cmd->chanfreq = param->chanfreq; + bufp += sizeof(wmi_mgmt_tx_send_cmd_fixed_param); + WMITLV_SET_HDR(bufp, WMITLV_TAG_ARRAY_BYTE, roundup(bufp_len, + sizeof(uint32_t))); + bufp += WMI_TLV_HDR_SIZE; + qdf_mem_copy(bufp, param->pdata, bufp_len); + + cmd->frame_len = param->frm_len; + cmd->buf_len = bufp_len; + cmd->tx_params_valid = param->tx_params_valid; + + wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID, + bufp, cmd->vdev_id, cmd->chanfreq); + + bufp += roundup(bufp_len, sizeof(uint32_t)); + if (param->tx_params_valid) { + if (populate_tx_send_params(bufp, param->tx_param) != + QDF_STATUS_SUCCESS) { + WMI_LOGE("%s: Populate TX send params failed", + __func__); + goto free_buf; + } + cmd_len += sizeof(wmi_tx_send_params); + } + + if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len, + WMI_MGMT_TX_SEND_CMDID)) { + WMI_LOGE("%s: Failed to send mgmt Tx", __func__); + goto free_buf; + } + return QDF_STATUS_SUCCESS; + +free_buf: + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; +} +#else /** * send_mgmt_cmd_tlv() - WMI scan start function * @wmi_handle : handle to WMI. @@ -3129,6 +3210,7 @@ free_buf: wmi_buf_free(buf); return QDF_STATUS_E_FAILURE; } +#endif /* CONFIG_HL_SUPPORT */ /** * send_offchan_data_tx_send_cmd_tlv() - Send off-chan tx data