qcacmn: Send rf path WMI command

Prepare and Send WMI command to fw to set the rf path. Also, add module
ID for rf path switch for qdf log prints.

CRs-Fixed: 3568221
Change-Id: I7ef0ffe66eaed837424699641d3e5b8537cd0304
This commit is contained in:
Krunalsinh Padhar
2023-04-27 12:20:53 -07:00
committed by Rahul Choudhary
parent f7142b0fd4
commit d3e95e7607
7 changed files with 147 additions and 0 deletions

View File

@@ -816,6 +816,20 @@ uint16_t wmi_get_max_msg_len(wmi_unified_t wmi_handle);
QDF_STATUS wmi_unified_soc_set_hw_mode_cmd(wmi_unified_t wmi_handle,
uint32_t hw_mode_index);
/**
* wmi_unified_soc_set_rf_path_cmd() - WMI_PDEV_SET_RF_PATH_CMDID to FW
* @wmi_handle: wmi handle
* @rf_path_index: RF path index to switch to
* @pdev_id: pdev id
*
* Request RF path change to WLAN firmware
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_unified_soc_set_rf_path_cmd(wmi_unified_t wmi_handle,
uint32_t rf_path_index,
uint8_t pdev_id);
/**
* wmi_unified_extract_hw_mode_resp() - Extract HW mode change response
* @wmi: WMI handle
@@ -829,6 +843,19 @@ wmi_unified_extract_hw_mode_resp(wmi_unified_t wmi,
void *evt_buf,
uint32_t *cmd_status);
/**
* wmi_unified_extract_rf_path_resp() - Extract RF path change response
* @wmi: WMI handle
* @evt_buf: Buffer holding event data
* @cmd_status: command status
*
* Return: QDF_STATUS_SUCCESS if success, else returns proper error code.
*/
QDF_STATUS
wmi_unified_extract_rf_path_resp(wmi_unified_t wmi,
void *evt_buf,
uint32_t *cmd_status);
/**
* wmi_unified_extract_roam_trigger_stats() - Extract roam trigger related
* stats

View File

@@ -5346,6 +5346,7 @@ typedef enum {
#ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE
wmi_peer_ptqm_migration_response_eventid,
#endif
wmi_pdev_set_rf_path_resp_eventid,
wmi_events_max,
} wmi_conv_event_id;

View File

@@ -581,6 +581,10 @@ QDF_STATUS
(*send_pdev_set_hw_mode_cmd)(wmi_unified_t wmi_handle,
uint32_t hw_mode_index);
QDF_STATUS
(*send_pdev_set_rf_path_cmd)(wmi_unified_t wmi_handle,
uint32_t hw_mode_index, uint8_t pdev_id);
QDF_STATUS (*send_suspend_cmd)(wmi_unified_t wmi_handle,
struct suspend_params *param,
uint8_t mac_id);
@@ -2859,6 +2863,9 @@ QDF_STATUS (*send_rtt_pasn_deauth_cmd)(wmi_unified_t wmi_handle,
QDF_STATUS (*extract_hw_mode_resp_event)(wmi_unified_t wmi_handle,
void *evt_buf, uint32_t *cmd_status);
QDF_STATUS (*extract_rf_path_resp)(wmi_unified_t wmi_handle,
void *evt_buf, uint32_t *cmd_status);
#ifdef WLAN_FEATURE_ELNA
QDF_STATUS (*send_set_elna_bypass_cmd)(wmi_unified_t wmi_handle,
struct set_elna_bypass_request *req);

View File

@@ -75,6 +75,19 @@ QDF_STATUS wmi_unified_soc_set_hw_mode_cmd(wmi_unified_t wmi_handle,
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_soc_set_rf_path_cmd(wmi_unified_t wmi_handle,
uint32_t rf_path_index,
uint8_t pdev_id)
{
if (wmi_handle->ops->send_pdev_set_rf_path_cmd)
return wmi_handle->ops->send_pdev_set_rf_path_cmd(
wmi_handle,
rf_path_index,
pdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_vdev_create_send(wmi_unified_t wmi_handle,
uint8_t macaddr[QDF_MAC_ADDR_SIZE],
struct vdev_create_params *param)
@@ -3582,6 +3595,18 @@ QDF_STATUS wmi_unified_extract_hw_mode_resp(wmi_unified_t wmi,
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_extract_rf_path_resp(wmi_unified_t wmi,
void *evt_buf,
uint32_t *cmd_status)
{
if (wmi->ops->extract_rf_path_resp)
return wmi->ops->extract_rf_path_resp(wmi,
evt_buf,
cmd_status);
return QDF_STATUS_E_FAILURE;
}
#ifdef FEATURE_ANI_LEVEL_REQUEST
QDF_STATUS wmi_unified_ani_level_cmd_send(wmi_unified_t wmi_handle,
uint32_t *freqs,

View File

@@ -2533,6 +2533,54 @@ static QDF_STATUS send_pdev_set_hw_mode_cmd_tlv(wmi_unified_t wmi_handle,
return QDF_STATUS_SUCCESS;
}
/**
* send_pdev_set_rf_path_cmd_tlv() - Send WMI_PDEV_SET_RF_PATH_CMDID to FW
* @wmi_handle: wmi handle
* @rf_path_index: the rf path mode to be selected
* @pdev_id: pdev id
*
* Provides notification to the WLAN firmware that host driver is requesting a
* rf path change.
*
* Return: Success if the cmd is sent successfully to the firmware
*/
static QDF_STATUS send_pdev_set_rf_path_cmd_tlv(wmi_unified_t wmi_handle,
uint32_t rf_path_index,
uint8_t pdev_id)
{
wmi_pdev_set_rf_path_cmd_fixed_param *cmd;
wmi_buf_t buf;
uint32_t len;
len = sizeof(*cmd);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf)
return QDF_STATUS_E_NOMEM;
cmd = (wmi_pdev_set_rf_path_cmd_fixed_param *)wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_pdev_set_rf_path_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_pdev_set_rf_path_cmd_fixed_param));
cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
wmi_handle,
pdev_id);
cmd->rf_path = rf_path_index;
wmi_debug("HW mode index:%d", cmd->rf_path);
wmi_mtrace(WMI_PDEV_SET_RF_PATH_CMDID, NO_SESSION, 0);
if (wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_PDEV_SET_RF_PATH_CMDID)) {
wmi_err("Failed to send WMI_PDEV_SET_RF_PATH_CMDID");
wmi_buf_free(buf);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
/**
* send_suspend_cmd_tlv() - WMI suspend function
* @wmi_handle: handle to WMI.
@@ -18789,6 +18837,37 @@ extract_hw_mode_resp_event_status_tlv(wmi_unified_t wmi_handle, void *evt_buf,
return QDF_STATUS_SUCCESS;
}
/**
* extract_rf_path_resp_tlv() - Extract RF path change status
* @wmi_handle: wmi handle
* @evt_buf: pointer to event buffer
* @cmd_status: status of RF path change request
*
* Return: QDF_STATUS_SUCCESS on success or proper error code.
*/
static QDF_STATUS
extract_rf_path_resp_tlv(wmi_unified_t wmi_handle, void *evt_buf,
uint32_t *cmd_status)
{
WMI_PDEV_SET_RF_PATH_RESP_EVENTID_param_tlvs *param_buf;
wmi_pdev_set_rf_path_event_fixed_param *fixed_param;
param_buf = (WMI_PDEV_SET_RF_PATH_RESP_EVENTID_param_tlvs *)evt_buf;
if (!param_buf) {
wmi_err("Invalid RF path event buffer");
return QDF_STATUS_E_INVAL;
}
fixed_param = param_buf->fixed_param;
if (!fixed_param) {
wmi_err("Invalid fixed param");
return QDF_STATUS_E_INVAL;
}
*cmd_status = fixed_param->status;
return QDF_STATUS_SUCCESS;
}
#ifdef FEATURE_ANI_LEVEL_REQUEST
static QDF_STATUS send_ani_level_cmd_tlv(wmi_unified_t wmi_handle,
uint32_t *freqs,
@@ -20966,6 +21045,7 @@ struct wmi_ops tlv_ops = {
.send_pdev_param_cmd = send_pdev_param_cmd_tlv,
.send_multiple_pdev_param_cmd = send_multiple_pdev_param_cmd_tlv,
.send_pdev_set_hw_mode_cmd = send_pdev_set_hw_mode_cmd_tlv,
.send_pdev_set_rf_path_cmd = send_pdev_set_rf_path_cmd_tlv,
.send_suspend_cmd = send_suspend_cmd_tlv,
.send_resume_cmd = send_resume_cmd_tlv,
.send_wow_enable_cmd = send_wow_enable_cmd_tlv,
@@ -21437,6 +21517,7 @@ struct wmi_ops tlv_ops = {
.send_egid_info_cmd = send_egid_info_cmd_tlv,
.extract_csa_ie_received_ev_params =
extract_csa_ie_received_ev_params_tlv,
.extract_rf_path_resp = extract_rf_path_resp_tlv,
};
#ifdef WLAN_FEATURE_11BE_MLO
@@ -21966,6 +22047,8 @@ static void populate_tlv_events_id(WMI_EVT_ID *event_ids)
event_ids[wmi_peer_ptqm_migration_response_eventid] =
WMI_MLO_PRIMARY_LINK_PEER_MIGRATION_EVENTID;
#endif
event_ids[wmi_pdev_set_rf_path_resp_eventid] =
WMI_PDEV_SET_RF_PATH_RESP_EVENTID;
}
#ifdef WLAN_FEATURE_LINK_LAYER_STATS