qcacmn: Add WMI APIs to send and extract offchan data tx

Add API to send offchan data TX command and extract API to get offchan
data tx completion params.

Change-Id: I1e04d50810e43cec2c700476581e518b394db582
This commit is contained in:
Kiran Venkatappa
2017-03-19 22:58:09 +05:30
committed by Sandeep Puligilla
parent 4a76dde9ad
commit fa59ee7936
5 changed files with 197 additions and 8 deletions

View File

@@ -479,6 +479,9 @@ QDF_STATUS wmi_unified_dbglog_cmd_send(void *wmi_hdl,
QDF_STATUS wmi_mgmt_unified_cmd_send(void *wmi_hdl,
struct wmi_mgmt_params *param);
QDF_STATUS wmi_offchan_data_tx_cmd_send(void *wmi_hdl,
struct wmi_offchan_data_tx_params *param);
QDF_STATUS wmi_unified_modem_power_state(void *wmi_hdl,
uint32_t param_value);
@@ -1255,6 +1258,9 @@ QDF_STATUS wmi_extract_pdev_generic_buffer_ev_param(void *wmi_hdl,
QDF_STATUS wmi_extract_mgmt_tx_compl_param(void *wmi_hdl, void *evt_buf,
wmi_host_mgmt_tx_compl_event *param);
QDF_STATUS wmi_extract_offchan_data_tx_compl_param(void *wmi_hdl, void *evt_buf,
struct wmi_host_offchan_data_tx_compl_event *param);
QDF_STATUS wmi_extract_pdev_csa_switch_count_status(void *wmi_hdl,
void *evt_buf,
struct pdev_csa_switch_count_status *param);

View File

@@ -1291,13 +1291,11 @@ struct seg_hdr_info {
* @tx_frame: management tx frame
* @frm_len: frame length
* @vdev_id: vdev id
* @tx_complete_cb: tx download callback handler
* @tx_ota_post_proc_cb: OTA complition handler
* @chanfreq: channel frequency
* @pdata: frame data
* @wmi_desc: command descriptor
* @desc_id: descriptor id relyaed back by target
* @macaddr - macaddr of peer
* @qdf_ctx: qdf context for qdf_nbuf_map
*/
struct wmi_mgmt_params {
void *tx_frame;
@@ -1310,6 +1308,28 @@ struct wmi_mgmt_params {
void *qdf_ctx;
};
/**
* struct wmi_offchan_data_tx_params - wmi offchan data tx cmd paramters
* @tx_frame: management tx frame
* @frm_len: frame length
* @vdev_id: vdev id
* @chanfreq: channel frequency
* @pdata: frame data
* @desc_id: descriptor id relyaed back by target
* @macaddr: macaddr of peer
* @qdf_ctx: qdf context for qdf_nbuf_map
*/
struct wmi_offchan_data_tx_params {
void *tx_frame;
uint16_t frm_len;
uint8_t vdev_id;
uint16_t chanfreq;
void *pdata;
uint16_t desc_id;
uint8_t *macaddr;
void *qdf_ctx;
};
/**
* struct p2p_ps_params - P2P powersave related params
* @opp_ps: opportunistic power save
@@ -4981,6 +5001,7 @@ typedef enum {
wmi_peer_delete_response_event_id,
wmi_pdev_csa_switch_count_status_event_id,
wmi_reg_chan_list_cc_event_id,
wmi_offchan_data_tx_completion_event,
wmi_events_max,
} wmi_conv_event_id;
@@ -5833,6 +5854,18 @@ typedef struct {
uint32_t pdev_id;
} wmi_host_mgmt_tx_compl_event;
/**
* struct wmi_host_offchan_data_tx_compl_event - TX completion event
* @desc_id: from tx_send_cmd
* @status: VWMI_MGMT_TX_COMP_STATUS_TYPE
* @pdev_id: pdev_id
*/
struct wmi_host_offchan_data_tx_compl_event {
uint32_t desc_id;
uint32_t status;
uint32_t pdev_id;
};
#define WMI_HOST_TIM_BITMAP_ARRAY_SIZE 17
/**

View File

@@ -293,6 +293,9 @@ QDF_STATUS (*send_scan_chan_list_cmd)(wmi_unified_t wmi_handle,
QDF_STATUS (*send_mgmt_cmd)(wmi_unified_t wmi_handle,
struct wmi_mgmt_params *param);
QDF_STATUS (*send_offchan_data_tx_cmd)(wmi_unified_t wmi_handle,
struct wmi_offchan_data_tx_params *param);
QDF_STATUS (*send_modem_power_state_cmd)(wmi_unified_t wmi_handle,
uint32_t param_value);
@@ -1098,6 +1101,10 @@ QDF_STATUS (*extract_pdev_generic_buffer_ev_param)(wmi_unified_t wmi_handle,
QDF_STATUS (*extract_mgmt_tx_compl_param)(wmi_unified_t wmi_handle,
void *evt_buf, wmi_host_mgmt_tx_compl_event *param);
QDF_STATUS (*extract_offchan_data_tx_compl_param)(wmi_unified_t wmi_handle,
void *evt_buf,
struct wmi_host_offchan_data_tx_compl_event *param);
QDF_STATUS (*extract_pdev_csa_switch_count_status)(wmi_unified_t wmi_handle,
void *evt_buf, struct pdev_csa_switch_count_status *param);

View File

@@ -815,6 +815,25 @@ QDF_STATUS wmi_mgmt_unified_cmd_send(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_offchan_data_tx_cmd_send() - Send offchan data tx cmd over wmi layer
* @wmi_hdl : handle to WMI.
* @param : pointer to hold offchan data cmd parameter
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_offchan_data_tx_cmd_send(void *wmi_hdl,
struct wmi_offchan_data_tx_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_offchan_data_tx_cmd)
return wmi_handle->ops->send_offchan_data_tx_cmd(wmi_handle,
param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_modem_power_state() - set modem power state to fw
* @wmi_hdl: wmi handle
@@ -5404,9 +5423,9 @@ QDF_STATUS wmi_extract_pdev_generic_buffer_ev_param(void *wmi_hdl,
/**
* wmi_extract_mgmt_tx_compl_param() - extract mgmt tx completion param
* from event
* @wmi_handle: wmi handle
* @param evt_buf: pointer to event buffer
* @param param: Pointer to mgmt tx completion param
* @wmi_hdl: wmi handle
* @evt_buf: pointer to event buffer
* @param: Pointer to mgmt tx completion param
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
@@ -5423,6 +5442,28 @@ QDF_STATUS wmi_extract_mgmt_tx_compl_param(void *wmi_hdl, void *evt_buf,
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_extract_offchan_data_tx_compl_param() -
* extract offchan data tx completion param from event
* @wmi_hdl: wmi handle
* @evt_buf: pointer to event buffer
* @param: Pointer to offchan data tx completion param
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_extract_offchan_data_tx_compl_param(void *wmi_hdl, void *evt_buf,
struct wmi_host_offchan_data_tx_compl_event *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->extract_offchan_data_tx_compl_param)
return wmi_handle->ops->extract_offchan_data_tx_compl_param(
wmi_handle, evt_buf, param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_extract_pdev_csa_switch_count_status() - extract CSA switch count status
* from event

View File

@@ -2540,6 +2540,72 @@ err1:
return QDF_STATUS_E_FAILURE;
}
/**
* send_offchan_data_tx_send_cmd_tlv() - Send off-chan tx data
* @wmi_handle : handle to WMI.
* @param : pointer to offchan data tx cmd parameter
*
* Return: QDF_STATUS_SUCCESS on success and error on failure.
*/
static QDF_STATUS send_offchan_data_tx_cmd_tlv(wmi_unified_t wmi_handle,
struct wmi_offchan_data_tx_params *param)
{
wmi_buf_t buf;
wmi_offchan_data_tx_send_cmd_fixed_param *cmd;
int32_t cmd_len;
uint64_t dma_addr;
void *qdf_ctx = param->qdf_ctx;
uint8_t *bufp;
int32_t bufp_len = (param->frm_len < mgmt_tx_dl_frm_len) ?
param->frm_len : mgmt_tx_dl_frm_len;
cmd_len = sizeof(wmi_offchan_data_tx_send_cmd_fixed_param) +
WMI_TLV_HDR_SIZE + roundup(bufp_len, sizeof(uint32_t));
buf = wmi_buf_alloc(wmi_handle, cmd_len);
if (!buf) {
WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_offchan_data_tx_send_cmd_fixed_param *) wmi_buf_data(buf);
bufp = (uint8_t *) cmd;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_offchan_data_tx_send_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_offchan_data_tx_send_cmd_fixed_param));
cmd->vdev_id = param->vdev_id;
cmd->desc_id = param->desc_id;
cmd->chanfreq = param->chanfreq;
bufp += sizeof(wmi_offchan_data_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);
qdf_nbuf_map_single(qdf_ctx, param->tx_frame, QDF_DMA_TO_DEVICE);
dma_addr = qdf_nbuf_get_frag_paddr(param->tx_frame, 0);
cmd->paddr_lo = (uint32_t)(dma_addr & 0xffffffff);
#if defined(HTT_PADDR64)
cmd->paddr_hi = (uint32_t)((dma_addr >> 32) & 0x1F);
#endif
cmd->frame_len = param->frm_len;
cmd->buf_len = bufp_len;
wmi_mgmt_cmd_record(wmi_handle, WMI_OFFCHAN_DATA_TX_SEND_CMDID,
bufp, cmd->vdev_id, cmd->chanfreq);
if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len,
WMI_OFFCHAN_DATA_TX_SEND_CMDID)) {
WMI_LOGE("%s: Failed to offchan data Tx", __func__);
wmi_buf_free(buf);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
/**
* send_modem_power_state_cmd_tlv() - set modem power state to fw
* @wmi_handle: wmi handle
@@ -15280,6 +15346,37 @@ static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle,
return QDF_STATUS_SUCCESS;
}
/**
* extract_offchan_data_tx_compl_param_tlv() -
* extract Offchan data tx completion event params
* @wmi_handle: wmi handle
* @param evt_buf: pointer to event buffer
* @param param: Pointer to hold offchan data TX completion params
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
static QDF_STATUS extract_offchan_data_tx_compl_param_tlv(
wmi_unified_t wmi_handle, void *evt_buf,
struct wmi_host_offchan_data_tx_compl_event *param)
{
WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *param_buf;
wmi_offchan_data_tx_compl_event_fixed_param *cmpl_params;
param_buf = (WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *)
evt_buf;
if (!param_buf) {
WMI_LOGE("%s: Invalid offchan data Tx compl event", __func__);
return QDF_STATUS_E_INVAL;
}
cmpl_params = param_buf->fixed_param;
param->pdev_id = cmpl_params->pdev_id;
param->desc_id = cmpl_params->desc_id;
param->status = cmpl_params->status;
return QDF_STATUS_SUCCESS;
}
/**
* extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count
* status tlv
@@ -16768,6 +16865,7 @@ struct wmi_ops tlv_ops = {
.send_scan_stop_cmd = send_scan_stop_cmd_tlv,
.send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv,
.send_mgmt_cmd = send_mgmt_cmd_tlv,
.send_offchan_data_tx_cmd = send_offchan_data_tx_cmd_tlv,
.send_modem_power_state_cmd = send_modem_power_state_cmd_tlv,
.send_set_sta_ps_mode_cmd = send_set_sta_ps_mode_cmd_tlv,
.send_set_sta_uapsd_auto_trig_cmd =
@@ -17023,6 +17121,8 @@ struct wmi_ops tlv_ops = {
.extract_p2p_lo_stop_ev_param =
extract_p2p_lo_stop_ev_param_tlv,
#endif
.extract_offchan_data_tx_compl_param =
extract_offchan_data_tx_compl_param_tlv,
.extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv,
.extract_all_stats_count = extract_all_stats_counts_tlv,
.extract_pdev_stats = extract_pdev_stats_tlv,
@@ -17294,6 +17394,8 @@ static void populate_tlv_events_id(uint32_t *event_ids)
event_ids[wmi_pdev_channel_hopping_event_id] =
WMI_PDEV_CHANNEL_HOPPING_EVENTID;
event_ids[wmi_wds_peer_event_id] = WMI_WDS_PEER_EVENTID;
event_ids[wmi_offchan_data_tx_completion_event] =
WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID;
}
#ifndef CONFIG_MCL