qcacmn: Add pdev_id in pdev commands and events

pdev_id is used to get the pdev for which the event is recieved. Add this
in extract APIs to fetch the pdev from pdev_ids and use it for further
processing. This is change is part of changes required to support
multi-radio.

Change-Id: Iadda098ccb31be5e8e43083158802abe49ac01b4
CRs-Fixed: 2003898
This commit is contained in:
Kiran Venkatappa
2017-02-08 14:51:13 +05:30
committed by qcabuildsw
parent 7790147799
commit 8e146df771
2 changed files with 81 additions and 6 deletions

View File

@@ -38,6 +38,14 @@
#if defined(WMI_NON_TLV_SUPPORT) || defined(WMI_TLV_AND_NON_TLV_SUPPORT) #if defined(WMI_NON_TLV_SUPPORT) || defined(WMI_TLV_AND_NON_TLV_SUPPORT)
#include "wmi.h" #include "wmi.h"
#include "wmi_unified.h" #include "wmi_unified.h"
/* Pdev_id starts from 1. For backward compatability value zero is used
* for broadcast ID. pdev_id is used to distinguish the radio for which event
* is recieved. Since non-tlv target has only one radio, setting
* default pdev_id to one to keep rest of the code using WMI APIs unfiorm.
*/
#define WMI_NON_TLV_DEFAULT_PDEV_ID 1
/** /**
* send_vdev_create_cmd_non_tlv() - send VDEV create command to fw * send_vdev_create_cmd_non_tlv() - send VDEV create command to fw
* @wmi_handle: wmi handle * @wmi_handle: wmi handle
@@ -5759,6 +5767,11 @@ static QDF_STATUS extract_wds_addr_event_non_tlv(wmi_unified_t wmi_handle,
wds_ev->dest_mac[4+i] = wds_ev->dest_mac[4+i] =
((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i]; ((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i];
} }
/* vdev_id is not available in legacy. It is required only to get
* pdev, hence setting it to zero as legacy as only one pdev.
*/
wds_ev->vdev_id = 0;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -5779,7 +5792,7 @@ static QDF_STATUS extract_dcs_interference_type_non_tlv(
(wmi_dcs_interference_event_t *) evt_buf; (wmi_dcs_interference_event_t *) evt_buf;
param->interference_type = ev->interference_type; param->interference_type = ev->interference_type;
param->pdev_id = 1; param->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -5836,6 +5849,8 @@ static QDF_STATUS extract_fips_event_data_non_tlv(wmi_unified_t wmi_handle,
struct wmi_host_fips_event_param *param) struct wmi_host_fips_event_param *param)
{ {
wmi_pdev_fips_event *event = (wmi_pdev_fips_event *)evt_buf; wmi_pdev_fips_event *event = (wmi_pdev_fips_event *)evt_buf;
param->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
#ifdef BIG_ENDIAN_HOST #ifdef BIG_ENDIAN_HOST
{ {
/*****************LE to BE conversion*************************/ /*****************LE to BE conversion*************************/
@@ -5955,6 +5970,7 @@ static QDF_STATUS extract_mgmt_rx_params_non_tlv(wmi_unified_t wmi_handle,
hdr->phy_mode = ev->hdr.phy_mode; hdr->phy_mode = ev->hdr.phy_mode;
hdr->buf_len = ev->hdr.buf_len; hdr->buf_len = ev->hdr.buf_len;
hdr->status = ev->hdr.status; hdr->status = ev->hdr.status;
hdr->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
*bufp = ev->bufp; *bufp = ev->bufp;
@@ -6216,6 +6232,7 @@ static QDF_STATUS extract_pdev_tpc_config_ev_param_non_tlv(wmi_unified_t wmi_han
{ {
wmi_pdev_tpc_config_event *event = (wmi_pdev_tpc_config_event *)evt_buf; wmi_pdev_tpc_config_event *event = (wmi_pdev_tpc_config_event *)evt_buf;
param->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
param->regDomain = event->regDomain; param->regDomain = event->regDomain;
param->chanFreq = event->chanFreq; param->chanFreq = event->chanFreq;
param->phyMode = event->phyMode; param->phyMode = event->phyMode;
@@ -6264,6 +6281,8 @@ static QDF_STATUS extract_nfcal_power_ev_param_non_tlv(wmi_unified_t wmi_handle,
qdf_mem_copy(param->nfdBm, event->nfdBm, sizeof(param->nfdBm)); qdf_mem_copy(param->nfdBm, event->nfdBm, sizeof(param->nfdBm));
qdf_mem_copy(param->freqNum, event->freqNum, sizeof(param->freqNum)); qdf_mem_copy(param->freqNum, event->freqNum, sizeof(param->freqNum));
param->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -6282,6 +6301,7 @@ static QDF_STATUS extract_pdev_tpc_ev_param_non_tlv(wmi_unified_t wmi_handle,
wmi_pdev_tpc_event *event = (wmi_pdev_tpc_event *)evt_buf; wmi_pdev_tpc_event *event = (wmi_pdev_tpc_event *)evt_buf;
qdf_mem_copy(param->tpc, event->tpc, sizeof(param->tpc)); qdf_mem_copy(param->tpc, event->tpc, sizeof(param->tpc));
param->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -6346,6 +6366,7 @@ static QDF_STATUS extract_pdev_reserve_ast_ev_param_non_tlv(
(wmi_pdev_reserve_ast_entry_event *) evt_buf; (wmi_pdev_reserve_ast_entry_event *) evt_buf;
*result = ev->result; *result = ev->result;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -6488,6 +6509,7 @@ static QDF_STATUS extract_peer_sta_kickout_ev_non_tlv(wmi_unified_t wmi_handle,
/**Following not available in legacy wmi*/ /**Following not available in legacy wmi*/
ev->reason = 0; ev->reason = 0;
ev->rssi = 0; ev->rssi = 0;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -6853,6 +6875,8 @@ static QDF_STATUS extract_comb_phyerr_non_tlv(wmi_unified_t wmi_handle, void *ev
phyerr->tsf64 |= (((uint64_t) pe->hdr.tsf_u32) << 32); phyerr->tsf64 |= (((uint64_t) pe->hdr.tsf_u32) << 32);
*buf_offset = sizeof(pe->hdr); *buf_offset = sizeof(pe->hdr);
phyerr->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -6879,6 +6903,8 @@ static QDF_STATUS extract_single_phyerr_non_tlv(wmi_unified_t wmi_handle,
int n = 0; int n = 0;
uint8_t *data; uint8_t *data;
phyerr->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
n = (int) *buf_offset; n = (int) *buf_offset;
data = (uint8_t *) evt_buf; data = (uint8_t *) evt_buf;
@@ -6892,7 +6918,7 @@ static QDF_STATUS extract_single_phyerr_non_tlv(wmi_unified_t wmi_handle,
/* ensure there's at least space for the header */ /* ensure there's at least space for the header */
if ((datalen - n) < sizeof(ev->hdr)) { if ((datalen - n) < sizeof(ev->hdr)) {
qdf_print( qdf_print(
"%s: not enough space? (datalen=%d, n=%d, hdr=%d bytes\n", "%s: not enough space? (datalen=%d, n=%d, hdr=%zd bytes\n",
__func__, __func__,
datalen, datalen,
n, n,
@@ -7134,6 +7160,8 @@ static QDF_STATUS extract_composite_phyerr_non_tlv(wmi_unified_t wmi_handle,
/* XXX what should errors be? */ /* XXX what should errors be? */
} }
phyerr->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
pe = (wmi_composite_phyerr_rx_event *) evt_buf; pe = (wmi_composite_phyerr_rx_event *) evt_buf;
ph = &pe->hdr; ph = &pe->hdr;
@@ -7270,6 +7298,7 @@ static QDF_STATUS extract_all_stats_counts_non_tlv(wmi_unified_t wmi_handle,
stats_param->num_peer_stats = ev->num_peer_stats; stats_param->num_peer_stats = ev->num_peer_stats;
stats_param->num_bcnflt_stats = ev->num_bcnflt_stats; stats_param->num_bcnflt_stats = ev->num_bcnflt_stats;
stats_param->num_chan_stats = 0; stats_param->num_chan_stats = 0;
stats_param->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -7666,6 +7695,7 @@ static QDF_STATUS extract_chan_info_event_non_tlv(wmi_unified_t wmi_handle,
{ {
wmi_chan_info_event *chan_info_ev = (wmi_chan_info_event *)evt_buf; wmi_chan_info_event *chan_info_ev = (wmi_chan_info_event *)evt_buf;
chan_info->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
chan_info->err_code = chan_info_ev->err_code; chan_info->err_code = chan_info_ev->err_code;
chan_info->freq = chan_info_ev->freq; chan_info->freq = chan_info_ev->freq;
chan_info->cmd_flags = chan_info_ev->cmd_flags; chan_info->cmd_flags = chan_info_ev->cmd_flags;
@@ -7698,6 +7728,7 @@ static QDF_STATUS extract_channel_hopping_event_non_tlv(
wmi_pdev_channel_hopping_event *event = wmi_pdev_channel_hopping_event *event =
(wmi_pdev_channel_hopping_event *)evt_buf; (wmi_pdev_channel_hopping_event *)evt_buf;
ch_hopping->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter; ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter;
ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter; ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter;
@@ -7719,8 +7750,20 @@ static QDF_STATUS extract_bss_chan_info_event_non_tlv(wmi_unified_t wmi_handle,
wmi_pdev_bss_chan_info_event *event = wmi_pdev_bss_chan_info_event *event =
(wmi_pdev_bss_chan_info_event *)evt_buf; (wmi_pdev_bss_chan_info_event *)evt_buf;
qdf_mem_copy(bss_chan_info, event, bss_chan_info->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
sizeof(wmi_pdev_bss_chan_info_event)); bss_chan_info->freq = event->freq;
bss_chan_info->noise_floor = event->noise_floor;
bss_chan_info->rx_clear_count_low = event->rx_clear_count_low;
bss_chan_info->rx_clear_count_high = event->rx_clear_count_high;
bss_chan_info->cycle_count_low = event->cycle_count_low;
bss_chan_info->cycle_count_high = event->cycle_count_high;
bss_chan_info->tx_cycle_count_low = event->tx_cycle_count_low;
bss_chan_info->tx_cycle_count_high = event->tx_cycle_count_high;
bss_chan_info->rx_cycle_count_low = event->rx_cycle_count_low;
bss_chan_info->rx_cycle_count_high = event->rx_cycle_count_high;
bss_chan_info->rx_bss_cycle_count_low = event->rx_bss_cycle_count_low;
bss_chan_info->rx_bss_cycle_count_high = event->rx_bss_cycle_count_high;
bss_chan_info->reserved = event->reserved;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -7739,6 +7782,7 @@ static QDF_STATUS extract_inst_rssi_stats_event_non_tlv(
{ {
wmi_inst_stats_resp *event = (wmi_inst_stats_resp *)evt_buf; wmi_inst_stats_resp *event = (wmi_inst_stats_resp *)evt_buf;
inst_rssi_resp->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
qdf_mem_copy(inst_rssi_resp, event, sizeof(wmi_inst_stats_resp)); qdf_mem_copy(inst_rssi_resp, event, sizeof(wmi_inst_stats_resp));
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
@@ -7783,6 +7827,7 @@ static QDF_STATUS extract_atf_peer_stats_ev_non_tlv(
wmi_atf_peer_stats_event *evt = wmi_atf_peer_stats_event *evt =
(wmi_atf_peer_stats_event *)evt_buf; (wmi_atf_peer_stats_event *)evt_buf;
ev->pdev_id = WMI_NON_TLV_DEFAULT_PDEV_ID;
ev->num_atf_peers = evt->num_atf_peers; ev->num_atf_peers = evt->num_atf_peers;
ev->comp_usable_airtime = evt->comp_usable_airtime; ev->comp_usable_airtime = evt->comp_usable_airtime;
qdf_mem_copy(&ev->reserved[0], &evt->reserved[0], qdf_mem_copy(&ev->reserved[0], &evt->reserved[0],

View File

@@ -31,6 +31,30 @@
#include "wmi_unified_priv.h" #include "wmi_unified_priv.h"
#include "wmi_version_whitelist.h" #include "wmi_version_whitelist.h"
/* copy_vdev_create_pdev_id() - copy pdev from host params to target command
* buffer.
* @cmd: pointer target vdev create command buffer
* @param: pointer host params for vdev create
*
* Return: None
*/
#ifdef CONFIG_MCL
static inline void copy_vdev_create_pdev_id(
wmi_vdev_create_cmd_fixed_param * cmd,
struct vdev_create_params *param)
{
cmd->pdev_id = WMI_PDEV_ID_SOC;
}
#else
static inline void copy_vdev_create_pdev_id(
wmi_vdev_create_cmd_fixed_param * cmd,
struct vdev_create_params *param)
{
cmd->pdev_id = param->pdev_id;
}
#endif
/** /**
* send_vdev_create_cmd_tlv() - send VDEV create command to fw * send_vdev_create_cmd_tlv() - send VDEV create command to fw
* @wmi_handle: wmi handle * @wmi_handle: wmi handle
@@ -66,7 +90,7 @@ static QDF_STATUS send_vdev_create_cmd_tlv(wmi_unified_t wmi_handle,
cmd->vdev_type = param->type; cmd->vdev_type = param->type;
cmd->vdev_subtype = param->subtype; cmd->vdev_subtype = param->subtype;
cmd->num_cfg_txrx_streams = num_bands; cmd->num_cfg_txrx_streams = num_bands;
cmd->pdev_id = WMI_PDEV_ID_SOC; copy_vdev_create_pdev_id(cmd, param);
WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr); WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr);
WMI_LOGD("%s: ID = %d VAP Addr = %02x:%02x:%02x:%02x:%02x:%02x", WMI_LOGD("%s: ID = %d VAP Addr = %02x:%02x:%02x:%02x:%02x:%02x",
__func__, param->if_id, __func__, param->if_id,
@@ -2023,6 +2047,7 @@ static QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle,
cmd->vdev_id = param->vdev_id; cmd->vdev_id = param->vdev_id;
cmd->requestor = param->requestor; cmd->requestor = param->requestor;
cmd->scan_id = param->scan_id; cmd->scan_id = param->scan_id;
cmd->pdev_id = param->pdev_id;
/* stop the scan with the corresponding scan_id */ /* stop the scan with the corresponding scan_id */
cmd->req_type = param->req_type; cmd->req_type = param->req_type;
ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, ret = wmi_unified_cmd_send(wmi_handle, wmi_buf,
@@ -2142,6 +2167,7 @@ static QDF_STATUS send_scan_chan_list_cmd_tlv(wmi_unified_t wmi_handle,
WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len); WMI_LOGD("no of channels = %d, len = %d", chan_list->nallchans, len);
cmd->pdev_id = chan_list->pdev_id;
cmd->num_scan_chans = chan_list->nallchans; cmd->num_scan_chans = chan_list->nallchans;
WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)), WMITLV_SET_HDR((buf_ptr + sizeof(wmi_scan_chan_list_cmd_fixed_param)),
WMITLV_TAG_ARRAY_STRUC, WMITLV_TAG_ARRAY_STRUC,
@@ -9769,7 +9795,9 @@ void wmi_copy_resource_config(wmi_resource_config *resource_cfg,
tgt_res_cfg->num_ocb_channels; tgt_res_cfg->num_ocb_channels;
resource_cfg->num_ocb_schedules = resource_cfg->num_ocb_schedules =
tgt_res_cfg->num_ocb_schedules; tgt_res_cfg->num_ocb_schedules;
resource_cfg->bpf_instruction_size = tgt_res_cfg->bpf_instruction_size;
resource_cfg->max_bssid_rx_filters = tgt_res_cfg->max_bssid_rx_filters;
resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id;
} }
#ifdef CONFIG_MCL #ifdef CONFIG_MCL
/** /**
@@ -12345,6 +12373,7 @@ static QDF_STATUS extract_mgmt_rx_params_tlv(wmi_unified_t wmi_handle,
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
hdr->pdev_id = ev_hdr->pdev_id;
hdr->channel = ev_hdr->channel; hdr->channel = ev_hdr->channel;
hdr->snr = ev_hdr->snr; hdr->snr = ev_hdr->snr;
@@ -12524,6 +12553,7 @@ static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle,
} }
cmpl_params = param_buf->fixed_param; cmpl_params = param_buf->fixed_param;
param->pdev_id = cmpl_params->pdev_id;
param->desc_id = cmpl_params->desc_id; param->desc_id = cmpl_params->desc_id;
param->status = cmpl_params->status; param->status = cmpl_params->status;