qcacmn: Add tlv formation of some wmi vdev commands in common wmi layer

Move tlv formation of wmi vdev start/restart commands from umac to
common wmi layer.

Change-Id: Id040983068ff610e68880dd5f503edf9b9c8cff9
CRs-Fixed: 987362
This commit is contained in:
Himanshu Agarwal
2016-03-09 16:49:38 +05:30
committed by Vishwajith Upendra
parent e2082f28fd
commit 915c270701
6 changed files with 338 additions and 63 deletions

View File

@@ -245,10 +245,6 @@ QDF_STATUS wmi_unified_vdev_create_send(void *wmi_hdl,
QDF_STATUS wmi_unified_vdev_delete_send(void *wmi_hdl,
uint8_t if_id);
QDF_STATUS wmi_unified_vdev_start_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct vdev_start_params *param);
QDF_STATUS wmi_unified_vdev_restart_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct vdev_start_params *param);
@@ -263,6 +259,12 @@ QDF_STATUS wmi_unified_vdev_up_send(void *wmi_hdl,
QDF_STATUS wmi_unified_vdev_down_send(void *wmi_hdl,
uint8_t vdev_id);
QDF_STATUS wmi_unified_vdev_start_send(void *wmi_hdl,
struct vdev_start_params *req);
QDF_STATUS wmi_unified_hidden_ssid_vdev_restart_send(void *wmi_hdl,
struct hidden_ssid_vdev_restart_params *restart_params);
QDF_STATUS wmi_unified_vdev_set_param_send(void *wmi_hdl,
struct vdev_set_params *param);

View File

@@ -88,6 +88,7 @@
#define WMI_SEC_TO_MSEC(sec) (sec * 1000) /* sec to msec */
#define WMI_MSEC_TO_USEC(msec) (msec * 1000) /* msec to usec */
#define WMI_NLO_FREQ_THRESH 1000 /* in MHz */
#include "qdf_atomic.h"
/**
* struct vdev_create_params - vdev create cmd parameter
@@ -109,55 +110,6 @@ struct vdev_delete_params {
uint8_t if_id;
};
/**
* struct vdev_start_params - vdev start cmd parameter
* @beacon_intval: beacon intval
* @dtim_period: dtim period
* @max_txpow: max tx power
* @phy_ch_width chan_width: channel width
* @is_dfs: flag to check if dfs enabled
* @vdev_id: vdev id
* @chan: channel no
* @oper_mode: operating mode
* @length: length
* @ssId[32]: ssid
* @hidden_ssid: hidden ssid
* @pmf_enabled: is pmf enabled
* @vht_capable: is vht capable
* @ch_center_freq_seg0: center freq seq 0
* @ch_center_freq_seg1: center freq seq 1
* @ht_capable: is ht capable
* @dfs_pri_multiplier: DFS multiplier
* @dot11_mode: dot11 mode
* @is_half_rate: Indicates half rate channel
* @is_quarter_rate: Indicates quarter rate channel
* @preferred_tx_streams: preferred tx streams
* @preferred_rx_streams: preferred rx streams
*/
struct vdev_start_params {
uint32_t beacon_intval;
uint32_t dtim_period;
int32_t max_txpow;
bool is_dfs;
uint8_t vdev_id;
uint8_t chan;
uint8_t oper_mode;
uint8_t length;
uint8_t ssId[32];
uint8_t hidden_ssid;
uint8_t pmf_enabled;
uint8_t vht_capable;
uint8_t ch_center_freq_seg0;
uint8_t ch_center_freq_seg1;
uint8_t ht_capable;
int32_t dfs_pri_multiplier;
uint8_t dot11_mode;
bool is_half_rate;
bool is_quarter_rate;
uint32_t preferred_tx_streams;
uint32_t preferred_rx_streams;
};
/**
* struct vdev_stop_params - vdev stop cmd parameter
* @vdev_id: vdev id
@@ -184,6 +136,103 @@ struct vdev_down_params {
uint8_t vdev_id;
};
/**
* struct mac_ssid - mac ssid structure
* @length:
* @mac_ssid[WMI_MAC_MAX_SSID_LENGTH]:
*/
struct mac_ssid {
uint8_t length;
uint8_t mac_ssid[WMI_MAC_MAX_SSID_LENGTH];
} qdf_packed;
/**
* struct vdev_start_params - vdev start cmd parameter
* @vdev_id: vdev id
* @chan_freq: channel frequency
* @chan_mode: channel mode
* @band_center_freq1: center freq 1
* @band_center_freq2: center freq 2
* @flags: flags to set like pmf_enabled etc.
* @is_dfs: flag to check if dfs enabled
* @beacon_intval: beacon interval
* @dtim_period: dtim period
* @max_txpow: max tx power
* @is_restart: flag to check if it is vdev
* @ssid: ssid and ssid length info
* @preferred_tx_streams: preferred tx streams
* @preferred_rx_streams: preferred rx streams
* @intr_update: flag to check if need to update
* required wma interface params
* @intr_ssid: pointer to wma interface ssid
* @intr_flags: poiter to wma interface flags
* @requestor_id: to update requestor id
* @disable_hw_ack: to update disable hw ack flag
* @info: to update channel info
* @reg_info_1: to update min power, max power,
* reg power and reg class id
* @reg_info_2: to update antennamax
*/
struct vdev_start_params {
uint8_t vdev_id;
uint32_t chan_freq;
uint32_t chan_mode;
uint32_t band_center_freq1;
uint32_t band_center_freq2;
uint32_t flags;
bool is_dfs;
uint32_t beacon_intval;
uint32_t dtim_period;
int32_t max_txpow;
bool is_restart;
struct mac_ssid ssid;
uint32_t preferred_rx_streams;
uint32_t preferred_tx_streams;
bool intr_update;
wmi_ssid *intr_ssid;
uint32_t *intr_flags;
uint32_t *requestor_id;
uint32_t *disable_hw_ack;
uint32_t *info;
uint32_t *reg_info_1;
uint32_t *reg_info_2;
};
/**
* struct hidden_ssid_vdev_restart_params -
* vdev restart cmd parameter
* @session_id: session id
* @ssid_len: ssid length
* @ssid: ssid
* @flags: flags
* @requestor_id: requestor id
* @disable_hw_ack: flag to disable hw ack feature
* @mhz: channel frequency
* @band_center_freq1: center freq 1
* @band_center_freq2: center freq 2
* @info: channel info
* @reg_info_1: contains min power, max power,
* reg power and reg class id
* @reg_info_2: contains antennamax
* @hidden_ssid_restart_in_progress:
* flag to check if restart is in progress
*/
struct hidden_ssid_vdev_restart_params {
uint8_t session_id;
uint32_t ssid_len;
uint32_t ssid[8];
uint32_t flags;
uint32_t requestor_id;
uint32_t disable_hw_ack;
uint32_t mhz;
uint32_t band_center_freq1;
uint32_t band_center_freq2;
uint32_t info;
uint32_t reg_info_1;
uint32_t reg_info_2;
qdf_atomic_t hidden_ssid_restart_in_progress;
};
/**
* struct vdev_set_params - vdev set cmd parameter
* @if_id: vdev id
@@ -401,16 +450,6 @@ struct ap_ps_params {
uint32_t value;
};
/**
* struct mac_ssid - mac ssid structure
* @length:
* @mac_ssid[WMI_MAC_MAX_SSID_LENGTH]:
*/
struct mac_ssid {
uint8_t length;
uint8_t mac_ssid[WMI_MAC_MAX_SSID_LENGTH];
} qdf_packed;
/**
* struct scan_start_params - start scan cmd parameter
* @scan_id: scan id

View File

@@ -82,6 +82,12 @@ QDF_STATUS (*send_vdev_stop_cmd)(wmi_unified_t wmi,
QDF_STATUS (*send_vdev_down_cmd)(wmi_unified_t wmi,
uint8_t vdev_id);
QDF_STATUS (*send_vdev_start_cmd)(wmi_unified_t wmi,
struct vdev_start_params *req);
QDF_STATUS (*send_hidden_ssid_vdev_restart_cmd)(wmi_unified_t wmi_handle,
struct hidden_ssid_vdev_restart_params *restart_params);
QDF_STATUS (*send_peer_flush_tids_cmd)(wmi_unified_t wmi,
uint8_t peer_addr[IEEE80211_ADDR_LEN],
struct peer_flush_params *param);

View File

@@ -44,6 +44,12 @@ QDF_STATUS send_vdev_stop_cmd_tlv(wmi_unified_t wmi,
QDF_STATUS send_vdev_down_cmd_tlv(wmi_unified_t wmi,
uint8_t vdev_id);
QDF_STATUS send_vdev_start_cmd_tlv(wmi_unified_t wmi,
struct vdev_start_params *req);
QDF_STATUS send_hidden_ssid_vdev_restart_cmd_tlv(wmi_unified_t wmi_handle,
struct hidden_ssid_vdev_restart_params *restart_params);
QDF_STATUS send_peer_flush_tids_cmd_tlv(wmi_unified_t wmi,
uint8_t peer_addr[IEEE80211_ADDR_LEN],
struct peer_flush_params *param);

View File

@@ -111,6 +111,43 @@ QDF_STATUS wmi_unified_vdev_down_send(void *wmi_hdl, uint8_t vdev_id)
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_vdev_start_send() - send vdev start command to fw
* @wmi: wmi handle
* @vdev_id: vdev id
*
* Return: 0 for success or error code
*/
QDF_STATUS wmi_unified_vdev_start_send(void *wmi_hdl,
struct vdev_start_params *req)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_vdev_start_cmd)
return wmi_handle->ops->send_vdev_start_cmd(wmi_handle, req);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_hidden_ssid_vdev_restart_send() - restart vdev to set hidden ssid
* @wmi: wmi handle
* @restart_params: vdev restart params
*
* Return: 0 for success or error code
*/
QDF_STATUS wmi_unified_hidden_ssid_vdev_restart_send(void *wmi_hdl,
struct hidden_ssid_vdev_restart_params *restart_params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_hidden_ssid_vdev_restart_cmd)
return wmi_handle->ops->send_hidden_ssid_vdev_restart_cmd(
wmi_handle, restart_params);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_peer_flush_tids_send() - flush peer tids packets in fw
* @wmi: wmi handle

View File

@@ -181,6 +181,188 @@ QDF_STATUS send_vdev_down_cmd_tlv(wmi_unified_t wmi, uint8_t vdev_id)
return 0;
}
/**
* send_vdev_start_cmd_tlv() - send vdev start request to fw
* @wmi_handle: wmi handle
* @req: vdev start params
*
* Return: QDF status
*/
QDF_STATUS send_vdev_start_cmd_tlv(wmi_unified_t wmi_handle,
struct vdev_start_params *req)
{
wmi_vdev_start_request_cmd_fixed_param *cmd;
wmi_buf_t buf;
wmi_channel *chan;
int32_t len, ret;
uint8_t *buf_ptr;
len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE;
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMA_LOGE("%s : wmi_buf_alloc failed", __func__);
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *) wmi_buf_data(buf);
cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr;
chan = (wmi_channel *) (buf_ptr + sizeof(*cmd));
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_vdev_start_request_cmd_fixed_param));
WMITLV_SET_HDR(&chan->tlv_header, WMITLV_TAG_STRUC_wmi_channel,
WMITLV_GET_STRUCT_TLVLEN(wmi_channel));
cmd->vdev_id = req->vdev_id;
/* Fill channel info */
chan->mhz = req->chan_freq;
WMI_SET_CHANNEL_MODE(chan, req->chan_mode);
chan->band_center_freq1 = req->band_center_freq1;
chan->band_center_freq2 = req->band_center_freq2;
WMI_SET_CHANNEL_FLAG(chan, req->flags);
if (req->is_dfs)
cmd->disable_hw_ack = true;
cmd->beacon_interval = req->beacon_intval;
cmd->dtim_period = req->dtim_period;
/* FIXME: Find out min, max and regulatory power levels */
WMI_SET_CHANNEL_REG_POWER(chan, req->max_txpow);
WMI_SET_CHANNEL_MAX_TX_POWER(chan, req->max_txpow);
if (!req->is_restart) {
/* Copy the SSID */
if (req->ssid.length) {
if (req->ssid.length < sizeof(cmd->ssid.ssid))
cmd->ssid.ssid_len = req->ssid.length;
else
cmd->ssid.ssid_len = sizeof(cmd->ssid.ssid);
qdf_mem_copy(cmd->ssid.ssid, req->ssid.mac_ssid,
cmd->ssid.ssid_len);
}
}
cmd->num_noa_descriptors = 0;
cmd->preferred_rx_streams = req->preferred_rx_streams;
cmd->preferred_tx_streams = req->preferred_tx_streams;
buf_ptr = (uint8_t *) (((uintptr_t) cmd) + sizeof(*cmd) +
sizeof(wmi_channel));
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
cmd->num_noa_descriptors *
sizeof(wmi_p2p_noa_descriptor));
WMA_LOGA("\n%s: vdev_id %d freq %d chanmode %d is_dfs %d "
"beacon interval %d dtim %d center_chan %d center_freq2 %d "
"reg_info_1: 0x%x reg_info_2: 0x%x, req->max_txpow: 0x%x "
"Tx SS %d, Rx SS %d",
__func__, req->vdev_id, chan->mhz, req->chan_mode,
req->is_dfs, req->beacon_intval, cmd->dtim_period,
chan->band_center_freq1, chan->band_center_freq2,
chan->reg_info_1, chan->reg_info_2, req->max_txpow,
req->preferred_tx_streams, req->preferred_rx_streams);
/* Store vdev params in SAP mode which can be used in vdev restart */
if (req->intr_update) {
req->intr_ssid->ssid_len = cmd->ssid.ssid_len;
qdf_mem_copy(req->intr_ssid->ssid,
cmd->ssid.ssid, cmd->ssid.ssid_len);
*req->intr_flags = cmd->flags;
*req->requestor_id = cmd->requestor_id;
*req->disable_hw_ack = cmd->disable_hw_ack;
*req->info = chan->info;
*req->reg_info_1 = chan->reg_info_1;
*req->reg_info_2 = chan->reg_info_2;
}
if (req->is_restart)
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_VDEV_RESTART_REQUEST_CMDID);
else
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_VDEV_START_REQUEST_CMDID);
if (ret < 0) {
WMA_LOGP("%s: Failed to send vdev start command", __func__);
qdf_nbuf_free(buf);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
/**
* send_hidden_ssid_vdev_restart_cmd_tlv() - restart vdev to set hidden ssid
* @wmi_handle: wmi handle
* @restart_params: vdev restart params
*
* Return: 0 for success or error code
*/
QDF_STATUS send_hidden_ssid_vdev_restart_cmd_tlv(wmi_unified_t wmi_handle,
struct hidden_ssid_vdev_restart_params *restart_params)
{
wmi_vdev_start_request_cmd_fixed_param *cmd;
wmi_buf_t buf;
wmi_channel *chan;
int32_t len;
uint8_t *buf_ptr;
int32_t ret = 0;
len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE;
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMA_LOGE("%s : wmi_buf_alloc failed", __func__);
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *) wmi_buf_data(buf);
cmd = (wmi_vdev_start_request_cmd_fixed_param *) buf_ptr;
chan = (wmi_channel *) (buf_ptr + sizeof(*cmd));
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_vdev_start_request_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_vdev_start_request_cmd_fixed_param));
WMITLV_SET_HDR(&chan->tlv_header,
WMITLV_TAG_STRUC_wmi_channel,
WMITLV_GET_STRUCT_TLVLEN(wmi_channel));
cmd->vdev_id = restart_params->session_id;
cmd->ssid.ssid_len = restart_params->ssid_len;
qdf_mem_copy(cmd->ssid.ssid,
restart_params->ssid,
cmd->ssid.ssid_len);
cmd->flags = restart_params->flags;
cmd->requestor_id = restart_params->requestor_id;
cmd->disable_hw_ack = restart_params->disable_hw_ack;
chan->mhz = restart_params->mhz;
chan->band_center_freq1 =
restart_params->band_center_freq1;
chan->band_center_freq2 =
restart_params->band_center_freq2;
chan->info = restart_params->info;
chan->reg_info_1 = restart_params->reg_info_1;
chan->reg_info_2 = restart_params->reg_info_2;
cmd->num_noa_descriptors = 0;
buf_ptr = (uint8_t *) (((uint8_t *) cmd) + sizeof(*cmd) +
sizeof(wmi_channel));
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
cmd->num_noa_descriptors *
sizeof(wmi_p2p_noa_descriptor));
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_VDEV_RESTART_REQUEST_CMDID);
if (ret < 0) {
wmi_buf_free(buf);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
/**
* send_peer_flush_tids_cmd_tlv() - flush peer tids packets in fw
* @wmi: wmi handle
@@ -10007,6 +10189,9 @@ struct wmi_ops tlv_ops = {
.send_vdev_create_cmd = send_vdev_create_cmd_tlv,
.send_vdev_delete_cmd = send_vdev_delete_cmd_tlv,
.send_vdev_down_cmd = send_vdev_down_cmd_tlv,
.send_vdev_start_cmd = send_vdev_start_cmd_tlv,
.send_hidden_ssid_vdev_restart_cmd =
send_hidden_ssid_vdev_restart_cmd_tlv,
.send_peer_flush_tids_cmd = send_peer_flush_tids_cmd_tlv,
.send_peer_param_cmd = send_peer_param_cmd_tlv,
.send_vdev_up_cmd = send_vdev_up_cmd_tlv,