qcacld-3.0: Add support to get bus message size

qcacld-2.0 to qcacld-3.0 propagation

This commit allows the upper layers to query  driver for max
message size between the host & firmware using vendor command.

Change-Id: I21db90c854e6105f00c27dec9389f2cafd4f6508
CRs-Fixed: 965244
This commit is contained in:
Rajeev Kumar Sirasanagandla 2016-09-09 13:46:09 +05:30 • committed by qcabuildsw
commit 478730010a
6 changed files with 115 additions and 0 deletions

View file

@ -1509,6 +1509,7 @@ struct hdd_context_s {
bool start_modules_in_progress;
bool update_mac_addr_to_fw;
struct acs_dfs_policy acs_policy;
uint16_t wmi_max_len;
};
/*---------------------------------------------------------------------------

View file

@ -7513,6 +7513,88 @@ static int wlan_hdd_cfg80211_get_wakelock_stats(struct wiphy *wiphy,
return ret;
}
/**
* __wlan_hdd_cfg80211_get_bus_size() - Get WMI Bus size
* @wiphy: wiphy structure pointer
* @wdev: Wireless device structure pointer
* @data: Pointer to the data received
* @data_len: Length of @data
*
* This function reads wmi max bus size and fill in the skb with
* NL attributes and send up the NL event.
* Return: 0 on success; errno on failure
*/
static int
__wlan_hdd_cfg80211_get_bus_size(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
int ret_val;
struct sk_buff *skb;
uint32_t nl_buf_len;
ENTER();
ret_val = wlan_hdd_validate_context(hdd_ctx);
if (ret_val)
return ret_val;
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EINVAL;
}
hdd_info("WMI Max Bus size: %d", hdd_ctx->wmi_max_len);
nl_buf_len = NLMSG_HDRLEN;
nl_buf_len += (sizeof(hdd_ctx->wmi_max_len) + NLA_HDRLEN);
skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
if (!skb) {
hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
return -ENOMEM;
}
if (nla_put_u16(skb, QCA_WLAN_VENDOR_ATTR_DRV_INFO_BUS_SIZE,
hdd_ctx->wmi_max_len)) {
hdd_err("nla put failure");
goto nla_put_failure;
}
cfg80211_vendor_cmd_reply(skb);
EXIT();
return 0;
nla_put_failure:
kfree_skb(skb);
return -EINVAL;
}
/**
* wlan_hdd_cfg80211_get_bus_size() - SSR Wrapper to Get Bus size
* @wiphy: wiphy structure pointer
* @wdev: Wireless device structure pointer
* @data: Pointer to the data received
* @data_len: Length of @data
*
* Return: 0 on success; errno on failure
*/
static int wlan_hdd_cfg80211_get_bus_size(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
int ret;
cds_ssr_protect(__func__);
ret = __wlan_hdd_cfg80211_get_bus_size(wiphy, wdev, data, data_len);
cds_ssr_unprotect(__func__);
return ret;
}
/**
*__wlan_hdd_cfg80211_setband() - set band
* @wiphy: Pointer to wireless phy
@ -8243,6 +8325,14 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
WIPHY_VENDOR_CMD_NEED_RUNNING,
.doit = wlan_hdd_cfg80211_get_wakelock_stats
},
{
.info.vendor_id = QCA_NL80211_VENDOR_ID,
.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_BUS_SIZE,
.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
WIPHY_VENDOR_CMD_NEED_NETDEV |
WIPHY_VENDOR_CMD_NEED_RUNNING,
.doit = wlan_hdd_cfg80211_get_bus_size
},
{
.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SETBAND,
.flags = WIPHY_VENDOR_CMD_NEED_WDEV |

View file

@ -383,6 +383,7 @@ enum qca_nl80211_vendor_subcmds {
QCA_NL80211_VENDOR_SUBCMD_ND_OFFLOAD = 82,
QCA_NL80211_VENDOR_SUBCMD_PACKET_FILTER = 83,
QCA_NL80211_VENDOR_SUBCMD_GET_BUS_SIZE = 84,
QCA_NL80211_VENDOR_SUBCMD_GET_WAKE_REASON_STATS = 85,
@ -2875,6 +2876,22 @@ enum qca_wlan_vendor_attr_p2p_listen_offload {
QCA_WLAN_VENDOR_ATTR_P2P_LISTEN_OFFLOAD_AFTER_LAST - 1
};
/**
* enum qca_wlan_vendor_drv_info - WLAN driver info
* @QCA_WLAN_VENDOR_ATTR_DRV_INFO_INVALID: Invalid
* @QCA_WLAN_VENDOR_ATTR_DRV_INFO_BUS_SIZE: Maximum Message size info
* between Firmware & Host.
*/
enum qca_wlan_vendor_drv_info {
QCA_WLAN_VENDOR_ATTR_DRV_INFO_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_DRV_INFO_BUS_SIZE,
/* keep last */
QCA_WLAN_VENDOR_ATTR_DRV_INFO_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_DRV_INFO_MAX =
QCA_WLAN_VENDOR_ATTR_DRV_INFO_AFTER_LAST - 1,
};
struct cfg80211_bss *wlan_hdd_cfg80211_update_bss_db(hdd_adapter_t *pAdapter,
tCsrRoamInfo *pRoamInfo);

View file

@ -1482,6 +1482,8 @@ void hdd_update_tgt_cfg(void *context, void *param)
if (hdd_ctx->bpf_enabled)
hdd_ctx->config->maxWoWFilters = WMA_STA_WOW_DEFAULT_PTRN_MAX;
hdd_ctx->wmi_max_len = cfg->wmi_max_len;
/* Configure NAN datapath features */
hdd_nan_datapath_target_config(hdd_ctx, cfg);
}

View file

@ -175,5 +175,6 @@ struct wma_tgt_cfg {
bool nan_datapath_enabled;
#endif
bool sub_20_support;
uint16_t wmi_max_len;
};
#endif /* WMA_TGT_CFG_H */

View file

@ -82,6 +82,8 @@
#define WMA_LOG_COMPLETION_TIMER 10000 /* 10 seconds */
#define WMI_TLV_HEADROOM 128
static uint32_t g_fw_wlan_feat_caps;
/**
@ -4043,6 +4045,8 @@ static void wma_update_hdd_cfg(tp_wma_handle wma_handle)
wma_update_ra_rate_limit(wma_handle, &tgt_cfg);
tgt_cfg.fine_time_measurement_cap =
wma_handle->fine_time_measurement_cap;
tgt_cfg.wmi_max_len = wmi_get_max_msg_len(wma_handle->wmi_handle)
- WMI_TLV_HEADROOM;
wma_setup_egap_support(&tgt_cfg, wma_handle);
wma_update_hdd_cfg_ndp(wma_handle, &tgt_cfg);