Merge "qcacmn: Add API to check if HT rates is allowed"

This commit is contained in:
Linux Build Service Account 2017-06-06 02:25:50 -07:00 • committed by Gerrit - the friendly Code Review server
commit 53b85751ce
13 changed files with 293 additions and 49 deletions

View file

@ -2966,6 +2966,35 @@ enum qca_wlan_vendor_attr_config {
QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_DATA_SNR_WEIGHT = 46,
/* 32-bit unsigned value to set ack snr weight */
QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_ACK_SNR_WEIGHT = 47,
/*
* 8 bit unsigned value that is set on an AP/GO virtual interface to
* disable operations that would cause the AP/GO to leave its operating
* channel.
*
* This will restrict the scans to the AP/GO operating channel and the
* channels of the other band, if DBS is supported.A STA/CLI interface
* brought up after this setting is enabled, will be restricted to
* connecting to devices only on the AP/GO interface's operating channel
* or on the other band in DBS case. P2P supported channel list is
* modified, to only include AP interface's operating-channel and the
* channels of the other band if DBS is supported.
*
* These restrictions are only applicable as long as the AP/GO interface
* is alive. If the AP/GO interface is brought down then this
* setting/restriction is forgotten.
*
* If this variable is set on an AP/GO interface while a multi-channel
* concurrent session is active, it has no effect on the operation of
* the current interfaces, other than restricting the scan to the AP/GO
* operating channel and the other band channels if DBS is supported.
* However, if the STA is brought down and restarted then the new STA
* connection will either be formed on the AP/GO channel or on the
* other band in a DBS case. This is because of the scan being
* restricted on these channels as mentioned above.
*
* 1-Disable offchannel operations, 0-Enable offchannel operations.
*/
QCA_WLAN_VENDOR_ATTR_CONFIG_RESTRICT_OFFCHANNEL = 49,
/* keep last */
QCA_WLAN_VENDOR_ATTR_CONFIG_AFTER_LAST,

View file

@ -1018,7 +1018,8 @@ int wlan_cfg80211_scan(struct wlan_objmgr_pdev *pdev,
#endif
len += snprintf(chl + len, 5, "%d ", channel);
req->scan_req.chan_list[i] = wlan_chan_to_freq(channel);
req->scan_req.chan_list[num_chan] =
wlan_chan_to_freq(channel);
num_chan++;
}
cfg80211_notice("Channel-List: %s", chl);

View file

@ -50,6 +50,31 @@ QDF_STATUS wlan_crypto_set_param(struct wlan_objmgr_vdev *vdev,
*/
int32_t wlan_crypto_get_param(struct wlan_objmgr_vdev *vdev,
wlan_crypto_param_type param);
/**
* wlan_crypto_get_peer_param - called by ucfg to get crypto peer param
*
* @peer: peer
* @param: param to be get.
*
* This function gets called from ucfg to get peer param
*
* Return: value or -1 for failure
*/
int32_t wlan_crypto_get_peer_param(struct wlan_objmgr_peer *peer,
wlan_crypto_param_type param);
/**
* wlan_crypto_is_htallowed - called by ucfg to check if HT rates is allowed
*
* @vdev: Vdev
* @peer: Peer
*
* This function is called to check if HT rates is allowed
*
* Return: 0 for not allowed and +ve for allowed
*/
uint8_t wlan_crypto_is_htallowed(struct wlan_objmgr_vdev *vdev,
struct wlan_objmgr_peer *peer);
/**
* wlan_crypto_setkey - called by ucfg to setkey
*

View file

@ -34,6 +34,8 @@
#include "wlan_crypto_param_handling_i.h"
#include "wlan_crypto_obj_mgr_i.h"
#include <qdf_module.h>
const struct wlan_crypto_cipher *wlan_crypto_cipher_ops[WLAN_CRYPTO_CIPHER_MAX];
@ -143,29 +145,20 @@ QDF_STATUS wlan_crypto_set_param(struct wlan_objmgr_vdev *vdev,
}
/**
* wlan_crypto_get_param - called by ucfg to get crypto param
* wlan_crypto_get_param_value - called by crypto APIs to get value for param
*
* @vdev: vdev
* @param: param to be get.
* @param: Crypto param type
* @crypto_params: Crypto params struct
*
* This function gets called from ucfg to get param
* This function gets called from in-within crypto layer
*
* Return: value or -1 for failure
*/
int32_t wlan_crypto_get_param(struct wlan_objmgr_vdev *vdev,
wlan_crypto_param_type param){
static int32_t wlan_crypto_get_param_value(wlan_crypto_param_type param,
struct wlan_crypto_params *crypto_params)
{
int32_t value = -1;
struct wlan_crypto_comp_priv *crypto_priv;
struct wlan_crypto_params *crypto_params;
crypto_priv = (struct wlan_crypto_comp_priv *)
wlan_get_vdev_crypto_obj(vdev);
if (crypto_priv == NULL) {
qdf_print("%s[%d] crypto_priv NULL\n", __func__, __LINE__);
return QDF_STATUS_E_INVAL;
}
crypto_params = &(crypto_priv->crypto_params);
switch (param) {
case WLAN_CRYPTO_PARAM_AUTH_MODE:
value = wlan_crypto_get_authmode(crypto_params);
@ -195,6 +188,71 @@ int32_t wlan_crypto_get_param(struct wlan_objmgr_vdev *vdev,
return value;
}
int32_t wlan_crypto_get_param(struct wlan_objmgr_vdev *vdev,
wlan_crypto_param_type param)
{
int32_t value = -1;
struct wlan_crypto_comp_priv *crypto_priv;
struct wlan_crypto_params *crypto_params;
crypto_priv = (struct wlan_crypto_comp_priv *)
wlan_get_vdev_crypto_obj(vdev);
if (crypto_priv == NULL) {
qdf_print("%s[%d] crypto_priv NULL\n", __func__, __LINE__);
return QDF_STATUS_E_INVAL;
}
crypto_params = &(crypto_priv->crypto_params);
value = wlan_crypto_get_param_value(param, crypto_params);
return value;
}
int32_t wlan_crypto_get_peer_param(struct wlan_objmgr_peer *peer,
wlan_crypto_param_type param)
{
int32_t value = -1;
struct wlan_crypto_comp_priv *crypto_priv;
struct wlan_crypto_params *crypto_params;
crypto_params = wlan_crypto_peer_get_comp_params(peer,
&crypto_priv);
if (crypto_params == NULL) {
qdf_print("%s[%d] crypto_params NULL\n", __func__, __LINE__);
return QDF_STATUS_E_INVAL;
}
value = wlan_crypto_get_param_value(param, crypto_params);
return value;
}
uint8_t wlan_crypto_is_htallowed(struct wlan_objmgr_vdev *vdev,
struct wlan_objmgr_peer *peer)
{
int32_t ucast_cipher;
if (!(vdev || peer)) {
qdf_print("%s[%d] Invalid params\n", __func__, __LINE__);
return 0;
}
if (vdev)
ucast_cipher = wlan_crypto_get_param(vdev,
WLAN_CRYPTO_PARAM_UCAST_CIPHER);
else
ucast_cipher = wlan_crypto_get_peer_param(peer,
WLAN_CRYPTO_PARAM_UCAST_CIPHER);
return (ucast_cipher & (1 << WLAN_CRYPTO_CIPHER_WEP)) ||
((ucast_cipher & (1 << WLAN_CRYPTO_CIPHER_TKIP)) &&
!(ucast_cipher & (1 << WLAN_CRYPTO_CIPHER_AES_CCM)) &&
!(ucast_cipher & (1 << WLAN_CRYPTO_CIPHER_AES_GCM)) &&
!(ucast_cipher & (1 << WLAN_CRYPTO_CIPHER_AES_GCM_256)) &&
!(ucast_cipher & (1 << WLAN_CRYPTO_CIPHER_AES_CCM_256)));
}
qdf_export_symbol(wlan_crypto_is_htallowed);
static void initialize_send_iv(uint8_t *iv, uint8_t *init_iv)
{
int8_t i = 0;
@ -573,9 +631,9 @@ QDF_STATUS wlan_crypto_delkey(struct wlan_objmgr_vdev *vdev,
uint8_t bssid_mac[WLAN_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
if (!vdev || !macaddr || (key_idx >= WLAN_CRYPTO_MAXKEYIDX)) {
qdf_print("%s[%d] Invalid params vdev %p, macaddr %p keyidx %d",
__func__, __LINE__, vdev,
macaddr, key_idx);
qdf_print("%s[%d] Invalid params vdev %p, macaddr %p keyidx %d\n",
__func__, __LINE__, vdev,
macaddr, key_idx);
return QDF_STATUS_E_INVAL;
}
@ -673,9 +731,8 @@ QDF_STATUS wlan_crypto_default_key(struct wlan_objmgr_vdev *vdev,
wlan_vdev_obj_unlock(vdev);
if (!vdev || !macaddr || (key_idx >= WLAN_CRYPTO_MAXKEYIDX)) {
qdf_print("%s[%d] Invalid params vdev %p, macaddr %p keyidx %d",
__func__, __LINE__, vdev,
macaddr, key_idx);
qdf_print("%s[%d] Invalid params vdev %p, macaddr %p keyidx %d\n",
__func__, __LINE__, vdev, macaddr, key_idx);
return QDF_STATUS_E_INVAL;
}
if (qdf_is_macaddr_broadcast((struct qdf_mac_addr *)macaddr)) {

View file

@ -210,6 +210,8 @@
#define WLAN_VDEV_C_WME_TKIPMIC 0x00000080
/* CAPABILITY: bg scanning */
#define WLAN_VDEV_C_BGSCAN 0x00000100
/* CAPABILITY: Restrict offchannel */
#define WLAN_VDEV_C_RESTRICT_OFFCHAN 0x00000200
/* Invalid VDEV identifier */
#define WLAN_INVALID_VDEV_ID 255

View file

@ -1895,4 +1895,15 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
*/
uint32_t policy_mgr_get_hw_dbs_nss(struct wlan_objmgr_psoc *psoc,
struct dbs_nss *nss_dbs);
/**
* policy_mgr_is_dnsc_set - Check if user has set
* "Do_Not_Switch_Channel" for the vdev passed
* @vdev: vdev pointer
*
* Get "Do_Not_Switch_Channel" setting for the vdev passed.
*
* Return: true for success, else false
*/
bool policy_mgr_is_dnsc_set(struct wlan_objmgr_vdev *vdev);
#endif /* __WLAN_POLICY_MGR_API_H */

View file

@ -2408,10 +2408,23 @@ bool policy_mgr_is_hw_mode_change_after_vdev_up(struct wlan_objmgr_psoc *psoc)
return flag;
}
bool policy_mgr_vdev_mlme_is_dnsc_set(struct wlan_objmgr_vdev *vdev)
bool policy_mgr_is_dnsc_set(struct wlan_objmgr_vdev *vdev)
{
/* TODO : Check Dont_Switch_Channel status from vdev mlme caps*/
return false;
bool roffchan;
if (!vdev) {
policy_mgr_err("Invalid parameter");
return false;
}
wlan_vdev_obj_lock(vdev);
roffchan = wlan_vdev_mlme_cap_get(vdev, WLAN_VDEV_C_RESTRICT_OFFCHAN);
wlan_vdev_obj_unlock(vdev);
policy_mgr_debug("Restrict offchannel:%s",
roffchan ? "set" : "clear");
return roffchan;
}
QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
@ -2456,7 +2469,7 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
* return true.
*/
/* TODO: To be enhanced for SBS */
if (policy_mgr_vdev_mlme_is_dnsc_set(vdev)) {
if (policy_mgr_is_dnsc_set(vdev)) {
if (operating_channel == channel)
*ok = true;
else if (WLAN_REG_IS_SAME_BAND_CHANNELS(operating_channel,

View file

@ -414,16 +414,4 @@ bool policy_mgr_get_sap_conn_info(struct wlan_objmgr_psoc *psoc,
bool policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc,
uint8_t *channel, uint8_t *vdev_id,
enum policy_mgr_con_mode mode);
/**
* policy_mgr_vdev_mlme_is_dnsc_set - Check if user has set
* "Do_Not_Switch_Channel" for this vdev
* @vdev: vdev pointer
*
* Get "Do_Not_Switch_Channel" setting for this vdev
*
* Return: true for success, else false
*/
bool policy_mgr_vdev_mlme_is_dnsc_set(struct wlan_objmgr_vdev *vdev);
#endif

View file

@ -98,6 +98,7 @@ struct ath_pktlog_info {
/* Size of buffer in bytes */
int32_t buf_size;
spinlock_t log_lock;
struct mutex pktlog_mutex;
/* Threshold of TCP SACK packets for triggered stop */
int sack_thr;

View file

@ -128,6 +128,7 @@ int pktlog_alloc_buf(struct hif_opaque_softc *scn)
unsigned long vaddr;
struct page *vpg;
struct ath_pktlog_info *pl_info;
struct ath_pktlog_buf *buffer;
ol_txrx_pdev_handle pdev_txrx_handle;
pdev_txrx_handle = cds_get_context(QDF_MODULE_ID_TXRX);
@ -143,25 +144,39 @@ int pktlog_alloc_buf(struct hif_opaque_softc *scn)
page_cnt = (sizeof(*(pl_info->buf)) + pl_info->buf_size) / PAGE_SIZE;
pl_info->buf = vmalloc((page_cnt + 2) * PAGE_SIZE);
if (pl_info->buf == NULL) {
spin_lock_bh(&pl_info->log_lock);
if (pl_info->buf != NULL) {
printk(PKTLOG_TAG "Buffer is already in use\n");
spin_unlock_bh(&pl_info->log_lock);
return -EINVAL;
}
spin_unlock_bh(&pl_info->log_lock);
buffer = vmalloc((page_cnt + 2) * PAGE_SIZE);
if (buffer == NULL) {
printk(PKTLOG_TAG
"%s: Unable to allocate buffer "
"(%d pages)\n", __func__, page_cnt);
return -ENOMEM;
}
pl_info->buf = (struct ath_pktlog_buf *)
(((unsigned long)(pl_info->buf) + PAGE_SIZE - 1)
buffer = (struct ath_pktlog_buf *)
(((unsigned long)(buffer) + PAGE_SIZE - 1)
& PAGE_MASK);
for (vaddr = (unsigned long)(pl_info->buf);
vaddr < ((unsigned long)(pl_info->buf) + (page_cnt * PAGE_SIZE));
for (vaddr = (unsigned long)(buffer);
vaddr < ((unsigned long)(buffer) + (page_cnt * PAGE_SIZE));
vaddr += PAGE_SIZE) {
vpg = vmalloc_to_page((const void *)vaddr);
SetPageReserved(vpg);
}
spin_lock_bh(&pl_info->log_lock);
if (pl_info->buf != NULL)
pktlog_release_buf(pdev_txrx_handle);
pl_info->buf = buffer;
spin_unlock_bh(&pl_info->log_lock);
return 0;
}
@ -200,6 +215,7 @@ static void pktlog_cleanup(struct ath_pktlog_info *pl_info)
{
pl_info->log_state = 0;
PKTLOG_LOCK_DESTROY(pl_info);
mutex_destroy(&pl_info->pktlog_mutex);
}
/* sysctl procfs handler to enable pktlog */
@ -802,7 +818,7 @@ rd_done:
}
static ssize_t
pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
__pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
{
size_t bufhdr_size;
size_t count = 0, ret_val = 0;
@ -944,6 +960,22 @@ rd_done:
return ret_val;
}
static ssize_t
pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
{
size_t ret;
struct ath_pktlog_info *pl_info;
pl_info = (struct ath_pktlog_info *)
PDE_DATA(file->f_path.dentry->d_inode);
if (!pl_info)
return 0;
mutex_lock(&pl_info->pktlog_mutex);
ret = __pktlog_read(file, buf, nbytes, ppos);
mutex_unlock(&pl_info->pktlog_mutex);
return ret;
}
#ifndef VMALLOC_VMADDR
#define VMALLOC_VMADDR(x) ((unsigned long)(x))
#endif

View file

@ -362,6 +362,7 @@ void pktlog_init(struct hif_opaque_softc *scn)
OS_MEMZERO(pl_info, sizeof(*pl_info));
PKTLOG_LOCK_INIT(pl_info);
mutex_init(&pl_info->pktlog_mutex);
pl_info->buf_size = PKTLOG_DEFAULT_BUFSIZE;
pl_info->buf = NULL;
@ -387,7 +388,7 @@ void pktlog_init(struct hif_opaque_softc *scn)
PKTLOG_SW_EVENT_SUBSCRIBER.callback = pktlog_callback;
}
int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state,
static int __pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state,
bool ini_triggered, uint8_t user_triggered,
uint32_t is_iwpriv_command)
{
@ -505,7 +506,49 @@ int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state,
return 0;
}
int pktlog_setsize(struct hif_opaque_softc *scn, int32_t size)
int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state,
bool ini_triggered, uint8_t user_triggered,
uint32_t is_iwpriv_command)
{
struct ol_pktlog_dev_t *pl_dev;
struct ath_pktlog_info *pl_info;
struct ol_txrx_pdev_t *txrx_pdev;
int error;
if (!scn) {
printk("%s: Invalid scn context\n", __func__);
ASSERT(0);
return -EINVAL;
}
txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
if (!txrx_pdev) {
printk("%s: Invalid txrx_pdev context\n", __func__);
ASSERT(0);
return -EINVAL;
}
pl_dev = txrx_pdev->pl_dev;
if (!pl_dev) {
printk("%s: Invalid pktlog context\n", __func__);
ASSERT(0);
return -EINVAL;
}
pl_info = pl_dev->pl_info;
if (!pl_info)
return 0;
mutex_lock(&pl_info->pktlog_mutex);
error = __pktlog_enable(scn, log_state, ini_triggered,
user_triggered, is_iwpriv_command);
mutex_unlock(&pl_info->pktlog_mutex);
return error;
}
static int __pktlog_setsize(struct hif_opaque_softc *scn, int32_t size)
{
ol_txrx_pdev_handle pdev_txrx_handle =
cds_get_context(QDF_MODULE_ID_TXRX);
@ -568,6 +611,29 @@ int pktlog_setsize(struct hif_opaque_softc *scn, int32_t size)
return 0;
}
int pktlog_setsize(struct hif_opaque_softc *scn, int32_t size)
{
int status;
ol_txrx_pdev_handle pdev_txrx_handle =
cds_get_context(QDF_MODULE_ID_TXRX);
struct ol_pktlog_dev_t *pl_dev;
struct ath_pktlog_info *pl_info;
if (pdev_txrx_handle == NULL ||
pdev_txrx_handle->pl_dev == NULL ||
pdev_txrx_handle->pl_dev->pl_info == NULL)
return -EFAULT;
pl_dev = pdev_txrx_handle->pl_dev;
pl_info = pl_dev->pl_info;
mutex_lock(&pl_info->pktlog_mutex);
status = __pktlog_setsize(scn, size);
mutex_unlock(&pl_info->pktlog_mutex);
return status;
}
int pktlog_clearbuff(struct hif_opaque_softc *scn, bool clear_buff)
{
ol_txrx_pdev_handle pdev_txrx_handle =

View file

@ -7106,6 +7106,7 @@ enum WMI_HOST_CALIBRATION_STATUS {
* struct wmi_host_pdev_utf_event - Host defined struct to hold utf event data
* @data: Pointer to data
* @datalen: Data length
* @pdev_id: Pdev_id of data
*
*/
struct wmi_host_pdev_utf_event {
@ -7114,6 +7115,22 @@ struct wmi_host_pdev_utf_event {
uint32_t pdev_id;
};
/**
* struct wmi_host_utf_seg_header_info - Host defined struct to map seg info in
* UTF event
* @len: segment length
* @msgref: message reference
* @segment_info: segment info
* @pdev_id: pdev_id
*
*/
struct wmi_host_utf_seg_header_info {
uint32_t len;
uint32_t msgref;
uint32_t segment_info;
uint32_t pdev_id;
};
/**
* struct wmi_host_pdev_qvit_event - Host defined struct to hold qvit event data
* @data: Pointer to data

View file

@ -16510,13 +16510,15 @@ static QDF_STATUS extract_pdev_utf_event_tlv(wmi_unified_t wmi_handle,
struct wmi_host_pdev_utf_event *event)
{
WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf;
struct wmi_host_utf_seg_header_info *seg_hdr;
param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *)evt_buf;
event->data = param_buf->data;
event->datalen = param_buf->num_data;
seg_hdr = (struct wmi_host_utf_seg_header_info *)param_buf->data;
/* Set pdev_id=1 until FW adds support to include pdev_id */
event->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
WMI_PDEV_ID_1ST);
seg_hdr->pdev_id);
return QDF_STATUS_SUCCESS;
}