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 f24bf9b6f7
commit c13fc7b786
2 changed files with 148 additions and 5 deletions

View File

@@ -815,6 +815,25 @@ QDF_STATUS wmi_mgmt_unified_cmd_send(void *wmi_hdl,
return QDF_STATUS_E_FAILURE; 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_unified_modem_power_state() - set modem power state to fw
* @wmi_hdl: wmi handle * @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 * wmi_extract_mgmt_tx_compl_param() - extract mgmt tx completion param
* from event * from event
* @wmi_handle: wmi handle * @wmi_hdl: wmi handle
* @param evt_buf: pointer to event buffer * @evt_buf: pointer to event buffer
* @param param: Pointer to mgmt tx completion param * @param: Pointer to mgmt tx completion param
* *
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure * 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; 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 * wmi_extract_pdev_csa_switch_count_status() - extract CSA switch count status
* from event * from event

View File

@@ -2540,6 +2540,72 @@ err1:
return QDF_STATUS_E_FAILURE; 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 * send_modem_power_state_cmd_tlv() - set modem power state to fw
* @wmi_handle: wmi handle * @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; 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 * extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count
* status tlv * status tlv
@@ -16768,6 +16865,7 @@ struct wmi_ops tlv_ops = {
.send_scan_stop_cmd = send_scan_stop_cmd_tlv, .send_scan_stop_cmd = send_scan_stop_cmd_tlv,
.send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv, .send_scan_chan_list_cmd = send_scan_chan_list_cmd_tlv,
.send_mgmt_cmd = send_mgmt_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_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_ps_mode_cmd = send_set_sta_ps_mode_cmd_tlv,
.send_set_sta_uapsd_auto_trig_cmd = .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 =
extract_p2p_lo_stop_ev_param_tlv, extract_p2p_lo_stop_ev_param_tlv,
#endif #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_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv,
.extract_all_stats_count = extract_all_stats_counts_tlv, .extract_all_stats_count = extract_all_stats_counts_tlv,
.extract_pdev_stats = extract_pdev_stats_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] = event_ids[wmi_pdev_channel_hopping_event_id] =
WMI_PDEV_CHANNEL_HOPPING_EVENTID; WMI_PDEV_CHANNEL_HOPPING_EVENTID;
event_ids[wmi_wds_peer_event_id] = WMI_WDS_PEER_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 #ifndef CONFIG_MCL