summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajeev Kumar Sirasanagandla <rsirasan@codeaurora.org>2016-09-09 13:46:09 +0530
committerqcabuildsw <qcabuildsw@localhost>2016-10-03 17:37:02 -0700
commit478730010a2190ae8a0f7575904c3f580fc79dab (patch)
tree1672b0ccff9c3c4ed78df55835c7964bd3593d33
parent1ab0a3db60f0bb8e6c35b2a5e317f9e2d2d06476 (diff)
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
-rw-r--r--core/hdd/inc/wlan_hdd_main.h1
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c90
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.h17
-rw-r--r--core/hdd/src/wlan_hdd_main.c2
-rw-r--r--core/wma/inc/wma_tgt_cfg.h1
-rw-r--r--core/wma/src/wma_main.c4
6 files changed, 115 insertions, 0 deletions
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h
index d649737380ff..82ffec3376fe 100644
--- a/core/hdd/inc/wlan_hdd_main.h
+++ b/core/hdd/inc/wlan_hdd_main.h
@@ -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;
};
/*---------------------------------------------------------------------------
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index e17753c2ec29..434f9a366fdc 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -7514,6 +7514,88 @@ static int wlan_hdd_cfg80211_get_wakelock_stats(struct wiphy *wiphy,
}
/**
+ * __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
* @wdev: Pointer to wireless device
@@ -8244,6 +8326,14 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
.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 |
WIPHY_VENDOR_CMD_NEED_NETDEV |
diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h
index c7ec0ce1a771..f735f8ebb1de 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.h
+++ b/core/hdd/src/wlan_hdd_cfg80211.h
@@ -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);
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index c058df7c2544..8b85b66e8820 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -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);
}
diff --git a/core/wma/inc/wma_tgt_cfg.h b/core/wma/inc/wma_tgt_cfg.h
index b49e69cd5955..7e9b68837142 100644
--- a/core/wma/inc/wma_tgt_cfg.h
+++ b/core/wma/inc/wma_tgt_cfg.h
@@ -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 */
diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c
index b4559cf27472..939bd532673f 100644
--- a/core/wma/src/wma_main.c
+++ b/core/wma/src/wma_main.c
@@ -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);