qcacmn: Support phyid conversion map for wmi_handle
Support phyid conversion map for dynamic mode switch. Change-Id: I02aa1831bf48ca1365354d0ab9ebc240fa116043 CRs-Fixed: 2601427
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -459,8 +459,9 @@ void
|
||||
wmi_flush_endpoint(wmi_unified_t wmi_handle);
|
||||
|
||||
/**
|
||||
* wmi_pdev_id_conversion_enable() - API to enable pdev_id conversion in WMI
|
||||
* By default pdev_id conversion is not done in WMI.
|
||||
* wmi_pdev_id_conversion_enable() - API to enable pdev_id and phy_id
|
||||
* conversion in WMI. By default pdev_id and
|
||||
* phyid conversion is not done in WMI.
|
||||
* This API can be used enable conversion in WMI.
|
||||
* @param wmi_handle : handle to WMI
|
||||
* @param *pdev_id_map : pdev conversion map
|
||||
@@ -468,7 +469,8 @@ wmi_flush_endpoint(wmi_unified_t wmi_handle);
|
||||
* Return none
|
||||
*/
|
||||
void wmi_pdev_id_conversion_enable(wmi_unified_t wmi_handle,
|
||||
uint32_t *pdev_id_map, uint8_t size);
|
||||
uint32_t *pdev_id_map,
|
||||
uint8_t size);
|
||||
|
||||
/**
|
||||
* API to handle wmi rx event after UMAC has taken care of execution
|
||||
|
@@ -1848,6 +1848,10 @@ uint32_t (*convert_pdev_id_host_to_target)(wmi_unified_t wmi_handle,
|
||||
uint32_t pdev_id);
|
||||
uint32_t (*convert_pdev_id_target_to_host)(wmi_unified_t wmi_handle,
|
||||
uint32_t pdev_id);
|
||||
uint32_t (*convert_phy_id_host_to_target)(wmi_unified_t wmi_handle,
|
||||
uint32_t phy_id);
|
||||
uint32_t (*convert_phy_id_target_to_host)(wmi_unified_t wmi_handle,
|
||||
uint32_t phy_id);
|
||||
|
||||
/*
|
||||
* For MCL, convert_pdev_id_host_to_target returns legacy pdev id value.
|
||||
@@ -1864,6 +1868,11 @@ uint32_t (*convert_host_pdev_id_to_target)(wmi_unified_t wmi_handle,
|
||||
uint32_t (*convert_target_pdev_id_to_host)(wmi_unified_t wmi_handle,
|
||||
uint32_t pdev_id);
|
||||
|
||||
uint32_t (*convert_host_phy_id_to_target)(wmi_unified_t wmi_handle,
|
||||
uint32_t phy_id);
|
||||
uint32_t (*convert_target_phy_id_to_host)(wmi_unified_t wmi_handle,
|
||||
uint32_t phy_id);
|
||||
|
||||
QDF_STATUS (*send_user_country_code_cmd)(wmi_unified_t wmi_handle,
|
||||
uint8_t pdev_id, struct cc_regdmn_s *rd);
|
||||
|
||||
@@ -1955,7 +1964,8 @@ QDF_STATUS
|
||||
uint8_t idx, uint8_t rpt_idx);
|
||||
|
||||
void (*wmi_pdev_id_conversion_enable)(wmi_unified_t wmi_handle,
|
||||
uint32_t *pdev_map, uint8_t size);
|
||||
uint32_t *pdev_map,
|
||||
uint8_t size);
|
||||
void (*send_time_stamp_sync_cmd)(wmi_unified_t wmi_handle);
|
||||
void (*wmi_free_allocated_event)(uint32_t cmd_event_id,
|
||||
void **wmi_cmd_struct_ptr);
|
||||
@@ -2203,6 +2213,8 @@ struct wmi_unified {
|
||||
#endif /*WMI_EXT_DBG*/
|
||||
uint32_t *cmd_pdev_id_map;
|
||||
uint32_t *evt_pdev_id_map;
|
||||
uint32_t *cmd_phy_id_map;
|
||||
uint32_t *evt_phy_id_map;
|
||||
qdf_atomic_t num_stats_over_qmi;
|
||||
};
|
||||
|
||||
@@ -2233,7 +2245,10 @@ struct wmi_soc {
|
||||
uint32_t soc_idx;
|
||||
uint32_t cmd_pdev_id_map[WMI_MAX_RADIOS];
|
||||
uint32_t evt_pdev_id_map[WMI_MAX_RADIOS];
|
||||
uint32_t cmd_phy_id_map[WMI_MAX_RADIOS];
|
||||
uint32_t evt_phy_id_map[WMI_MAX_RADIOS];
|
||||
bool is_pdev_is_map_enable;
|
||||
bool is_phy_id_map_enable;
|
||||
#ifdef WMI_INTERFACE_EVENT_LOGGING
|
||||
uint32_t buf_offset_command;
|
||||
uint32_t buf_offset_event;
|
||||
|
@@ -2630,6 +2630,8 @@ void *wmi_unified_get_pdev_handle(struct wmi_soc *soc, uint32_t pdev_idx)
|
||||
wmi_handle->soc = soc;
|
||||
wmi_handle->cmd_pdev_id_map = soc->cmd_pdev_id_map;
|
||||
wmi_handle->evt_pdev_id_map = soc->evt_pdev_id_map;
|
||||
wmi_handle->cmd_phy_id_map = soc->cmd_phy_id_map;
|
||||
wmi_handle->evt_phy_id_map = soc->evt_phy_id_map;
|
||||
wmi_interface_logging_init(wmi_handle, pdev_idx);
|
||||
qdf_atomic_init(&wmi_handle->pending_cmds);
|
||||
qdf_atomic_init(&wmi_handle->is_target_suspended);
|
||||
@@ -2740,6 +2742,8 @@ void *wmi_unified_attach(void *scn_handle,
|
||||
wmi_handle->scn_handle = scn_handle;
|
||||
wmi_handle->cmd_pdev_id_map = soc->cmd_pdev_id_map;
|
||||
wmi_handle->evt_pdev_id_map = soc->evt_pdev_id_map;
|
||||
wmi_handle->cmd_phy_id_map = soc->cmd_phy_id_map;
|
||||
wmi_handle->evt_phy_id_map = soc->evt_phy_id_map;
|
||||
soc->scn_handle = scn_handle;
|
||||
qdf_atomic_init(&wmi_handle->pending_cmds);
|
||||
qdf_atomic_init(&wmi_handle->is_target_suspended);
|
||||
@@ -3161,8 +3165,8 @@ wmi_flush_endpoint(wmi_unified_t wmi_handle)
|
||||
qdf_export_symbol(wmi_flush_endpoint);
|
||||
|
||||
/**
|
||||
* wmi_pdev_id_conversion_enable() - API to enable pdev_id conversion in WMI
|
||||
* By default pdev_id conversion is not done in WMI.
|
||||
* wmi_pdev_id_conversion_enable() - API to enable pdev_id/phy_id conversion
|
||||
* in WMI. By default pdev_id conversion is not done in WMI.
|
||||
* This API can be used enable conversion in WMI.
|
||||
* @param wmi_handle : handle to WMI
|
||||
* @param pdev_map : pointer to pdev_map
|
||||
@@ -3170,7 +3174,8 @@ qdf_export_symbol(wmi_flush_endpoint);
|
||||
* Return none
|
||||
*/
|
||||
void wmi_pdev_id_conversion_enable(wmi_unified_t wmi_handle,
|
||||
uint32_t *pdev_id_map, uint8_t size)
|
||||
uint32_t *pdev_id_map,
|
||||
uint8_t size)
|
||||
{
|
||||
if (wmi_handle->target_type == WMI_TLV_TARGET)
|
||||
wmi_handle->ops->wmi_pdev_id_conversion_enable(wmi_handle,
|
||||
|
@@ -554,6 +554,42 @@ static uint32_t convert_target_pdev_id_to_host_pdev_id(wmi_unified_t wmi_handle,
|
||||
return WMI_HOST_PDEV_ID_INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert_host_phy_id_to_target_phy_id() - Convert phy_id from
|
||||
* host to target defines.
|
||||
* @wmi_handle: pointer to wmi_handle
|
||||
* @param phy_id: host pdev_id to be converted.
|
||||
* Return: target phy_id after conversion.
|
||||
*/
|
||||
static uint32_t convert_host_phy_id_to_target_phy_id(wmi_unified_t wmi_handle,
|
||||
uint32_t phy_id)
|
||||
{
|
||||
if (!wmi_handle->soc->is_phy_id_map_enable ||
|
||||
phy_id >= WMI_MAX_RADIOS) {
|
||||
return phy_id;
|
||||
}
|
||||
|
||||
return wmi_handle->cmd_phy_id_map[phy_id];
|
||||
}
|
||||
|
||||
/**
|
||||
* convert_target_phy_id_to_host_phy_id() - Convert phy_id from
|
||||
* target to host defines.
|
||||
* @wmi_handle: pointer to wmi_handle
|
||||
* @param phy_id: target phy_id to be converted.
|
||||
* Return: host phy_id after conversion.
|
||||
*/
|
||||
static uint32_t convert_target_phy_id_to_host_phy_id(wmi_unified_t wmi_handle,
|
||||
uint32_t phy_id)
|
||||
{
|
||||
if (!wmi_handle->soc->is_phy_id_map_enable ||
|
||||
phy_id >= WMI_MAX_RADIOS) {
|
||||
return phy_id;
|
||||
}
|
||||
|
||||
return wmi_handle->evt_phy_id_map[phy_id];
|
||||
}
|
||||
|
||||
/**
|
||||
* wmi_tlv_pdev_id_conversion_enable() - Enable pdev_id conversion
|
||||
*
|
||||
@@ -570,6 +606,9 @@ static void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle,
|
||||
wmi_handle->cmd_pdev_id_map[i] = pdev_id_map[i];
|
||||
wmi_handle->evt_pdev_id_map[i] =
|
||||
WMI_HOST_PDEV_ID_INVALID;
|
||||
wmi_handle->cmd_phy_id_map[i] = pdev_id_map[i] - 1;
|
||||
wmi_handle->evt_phy_id_map[i] =
|
||||
WMI_HOST_PDEV_ID_INVALID;
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
@@ -578,16 +617,29 @@ static void wmi_tlv_pdev_id_conversion_enable(wmi_unified_t wmi_handle,
|
||||
wmi_handle->evt_pdev_id_map
|
||||
[wmi_handle->cmd_pdev_id_map[i] - 1] = i;
|
||||
}
|
||||
if (wmi_handle->cmd_phy_id_map[i] !=
|
||||
WMI_HOST_PDEV_ID_INVALID) {
|
||||
wmi_handle->evt_phy_id_map
|
||||
[wmi_handle->cmd_phy_id_map[i]] = i;
|
||||
}
|
||||
}
|
||||
wmi_handle->soc->is_pdev_is_map_enable = true;
|
||||
wmi_handle->soc->is_phy_id_map_enable = true;
|
||||
} else {
|
||||
wmi_handle->soc->is_pdev_is_map_enable = false;
|
||||
wmi_handle->soc->is_phy_id_map_enable = false;
|
||||
}
|
||||
|
||||
wmi_handle->ops->convert_pdev_id_host_to_target =
|
||||
convert_host_pdev_id_to_target_pdev_id;
|
||||
wmi_handle->ops->convert_pdev_id_target_to_host =
|
||||
convert_target_pdev_id_to_host_pdev_id;
|
||||
|
||||
/* phy_id convert function assignments */
|
||||
wmi_handle->ops->convert_phy_id_host_to_target =
|
||||
convert_host_phy_id_to_target_phy_id;
|
||||
wmi_handle->ops->convert_phy_id_target_to_host =
|
||||
convert_target_phy_id_to_host_phy_id;
|
||||
}
|
||||
|
||||
/* copy_vdev_create_pdev_id() - copy pdev from host params to target command
|
||||
@@ -10892,7 +10944,8 @@ static QDF_STATUS extract_reg_chan_list_update_event_tlv(
|
||||
reg_info->phybitmap = chan_list_event_hdr->phybitmap;
|
||||
reg_info->offload_enabled = true;
|
||||
reg_info->num_phy = chan_list_event_hdr->num_phy;
|
||||
reg_info->phy_id = chan_list_event_hdr->phy_id;
|
||||
reg_info->phy_id = wmi_handle->ops->convert_phy_id_target_to_host(
|
||||
wmi_handle, chan_list_event_hdr->phy_id);
|
||||
reg_info->ctry_code = chan_list_event_hdr->country_id;
|
||||
reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code;
|
||||
if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS)
|
||||
@@ -11368,6 +11421,36 @@ static uint32_t convert_target_pdev_id_to_host_pdev_id_legacy(
|
||||
return pdev_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert_host_phy_id_to_target_phy_id_legacy() - Convert phy_id from
|
||||
* host to target defines. For legacy there is not conversion
|
||||
* required. Just return phy_id as it is.
|
||||
* @param pdev_id: host phy_id to be converted.
|
||||
* Return: target phy_id after conversion.
|
||||
*/
|
||||
static uint32_t convert_host_phy_id_to_target_phy_id_legacy(
|
||||
wmi_unified_t wmi_handle,
|
||||
uint32_t phy_id)
|
||||
{
|
||||
/*No conversion required*/
|
||||
return phy_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert_target_phy_id_to_host_phy_id_legacy() - Convert phy_id from
|
||||
* target to host defines. For legacy there is not conversion
|
||||
* required. Just return phy_id as it is.
|
||||
* @param pdev_id: target phy_id to be converted.
|
||||
* Return: host phy_id after conversion.
|
||||
*/
|
||||
static uint32_t convert_target_phy_id_to_host_phy_id_legacy(
|
||||
wmi_unified_t wmi_handle,
|
||||
uint32_t phy_id)
|
||||
{
|
||||
/*No conversion required*/
|
||||
return phy_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* send_set_country_cmd_tlv() - WMI scan channel list function
|
||||
* @param wmi_handle : handle to WMI.
|
||||
@@ -13025,6 +13108,16 @@ struct wmi_ops tlv_ops = {
|
||||
.convert_target_pdev_id_to_host =
|
||||
convert_target_pdev_id_to_host_pdev_id,
|
||||
|
||||
.convert_phy_id_host_to_target =
|
||||
convert_host_phy_id_to_target_phy_id_legacy,
|
||||
.convert_phy_id_target_to_host =
|
||||
convert_target_phy_id_to_host_phy_id_legacy,
|
||||
|
||||
.convert_host_phy_id_to_target =
|
||||
convert_host_phy_id_to_target_phy_id,
|
||||
.convert_target_phy_id_to_host =
|
||||
convert_target_phy_id_to_host_phy_id,
|
||||
|
||||
.send_start_11d_scan_cmd = send_start_11d_scan_cmd_tlv,
|
||||
.send_stop_11d_scan_cmd = send_stop_11d_scan_cmd_tlv,
|
||||
.extract_reg_11d_new_country_event =
|
||||
|
Reference in New Issue
Block a user