Ver Fonte

qcacld-3.0: Implement Private NL CMD handling for roaming

qcacld-2.0 to qcacld-3.0 propagation

When supplicant issues enable/disable firmware based roaming on the
basis of the Bssid modification in network block (e.g. AutoJoin modify
Network Block), that time middle-ware will issue this pvt cmd to Driver.
Driver need to disable/enable firmware roaming.
(in our current design we can enable firmware roaming by offload scan
to firmware so firmware can scan and find candidate ap when rssi threshold
meet the criteria, same way driver can stop firmware roaming by stop
offload scan to firmware).

Change-Id: I378917d9d56c4d3ef13bfe8c3bf62adc6d5e7aa6
CRs-Fixed: 1012420
Mukul Sharma há 8 anos atrás
pai
commit
69c44cd239

+ 98 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -7230,6 +7230,96 @@ static int wlan_hdd_cfg80211_setband(struct wiphy *wiphy,
 	return ret;
 }
 
+static const struct
+nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = {
+	[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = {.type = NLA_U32},
+	[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]       = {.type = NLA_BINARY,
+						 .len = QDF_MAC_ADDR_SIZE},
+};
+
+/**
+ * __wlan_hdd_cfg80211_set_fast_roaming() - enable/disable roaming
+ * @wiphy: Pointer to wireless phy
+ * @wdev: Pointer to wireless device
+ * @data: Pointer to data
+ * @data_len: Length of @data
+ *
+ * This function is used to enable/disable roaming using vendor commands
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+static int __wlan_hdd_cfg80211_set_fast_roaming(struct wiphy *wiphy,
+					    struct wireless_dev *wdev,
+					    const void *data, int data_len)
+{
+	hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
+	struct net_device *dev = wdev->netdev;
+	hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
+	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1];
+	uint32_t is_fast_roam_enabled;
+	int ret;
+
+	ENTER_DEV(dev);
+
+	ret = wlan_hdd_validate_context(hdd_ctx);
+	if (0 != ret)
+		return ret;
+
+	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
+		hdd_err("Command not allowed in FTM mode");
+		return -EINVAL;
+	}
+
+	ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len,
+			qca_wlan_vendor_attr);
+	if (ret) {
+		hdd_err("Invalid ATTR");
+		return -EINVAL;
+	}
+
+	/* Parse and fetch Enable flag */
+	if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) {
+		hdd_err("attr enable failed");
+		return -EINVAL;
+	}
+
+	is_fast_roam_enabled = nla_get_u32(
+				tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]);
+	hdd_notice("isFastRoamEnabled %d", is_fast_roam_enabled);
+
+	/* Update roaming */
+	ret = sme_config_fast_roaming(hdd_ctx->hHal, adapter->sessionId,
+					is_fast_roam_enabled);
+	if (ret)
+		hdd_err("sme_config_fast_roaming failed");
+	EXIT();
+	return ret;
+}
+
+/**
+ * wlan_hdd_cfg80211_set_fast_roaming() - enable/disable roaming
+ * @wiphy: Pointer to wireless phy
+ * @wdev: Pointer to wireless device
+ * @data: Pointer to data
+ * @data_len: Length of @data
+ *
+ * Wrapper function of __wlan_hdd_cfg80211_set_fast_roaming()
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+static int wlan_hdd_cfg80211_set_fast_roaming(struct wiphy *wiphy,
+					  struct wireless_dev *wdev,
+					  const void *data, int data_len)
+{
+	int ret;
+
+	cds_ssr_protect(__func__);
+	ret = __wlan_hdd_cfg80211_set_fast_roaming(wiphy, wdev, data, data_len);
+	cds_ssr_unprotect(__func__);
+
+	return ret;
+}
+
 const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -7785,6 +7875,14 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 					WIPHY_VENDOR_CMD_NEED_NETDEV |
 					WIPHY_VENDOR_CMD_NEED_RUNNING,
 		.doit = wlan_hdd_cfg80211_setband
+	},
+	{
+		.info.vendor_id = QCA_NL80211_VENDOR_ID,
+		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING,
+		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
+			WIPHY_VENDOR_CMD_NEED_NETDEV |
+			WIPHY_VENDOR_CMD_NEED_RUNNING,
+		.doit = wlan_hdd_cfg80211_set_fast_roaming
 	}
 };
 

+ 6 - 1
core/hdd/src/wlan_hdd_cfg80211.h

@@ -167,8 +167,9 @@ typedef enum {
  *
  * @QCA_NL80211_VENDOR_SUBCMD_UNSPEC: Unspecified
  * @QCA_NL80211_VENDOR_SUBCMD_TEST: Test
+ *	Sub commands 2 to 8 are not used
+ * @QCA_NL80211_VENDOR_SUBCMD_ROAMING: Roaming
  * @QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY: Avoid frequency.
- *	Sub commands 2 to 9 are not used
  * @QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY: DFS capability
  * @QCA_NL80211_VENDOR_SUBCMD_NAN: Nan
  * @QCA_NL80211_VENDOR_SUBCMD_STATS_EXT: Ext stats
@@ -293,6 +294,7 @@ typedef enum {
 enum qca_nl80211_vendor_subcmds {
 	QCA_NL80211_VENDOR_SUBCMD_UNSPEC = 0,
 	QCA_NL80211_VENDOR_SUBCMD_TEST = 1,
+	QCA_NL80211_VENDOR_SUBCMD_ROAMING = 9,
 	QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY = 10,
 	QCA_NL80211_VENDOR_SUBCMD_DFS_CAPABILITY = 11,
 	QCA_NL80211_VENDOR_SUBCMD_NAN = 12,
@@ -838,6 +840,8 @@ enum qca_wlan_vendor_attr_get_tdls_capabilities {
  * @QCA_WLAN_VENDOR_ATTR_STATS_EXT: Ext stats attribute which is used by
  *	QCA_NL80211_VENDOR_SUBCMD_STATS_EXT
  * @QCA_WLAN_VENDOR_ATTR_IFINDEX: After IFINDEX
+ * @QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY: Roaming policy which is used by
+ *	QCA_NL80211_VENDOR_SUBCMD_ROAMING
  * @QCA_WLAN_VENDOR_ATTR_MAC_ADDR: MAC Address attribute which is used by
  *	QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES
  * @QCA_WLAN_VENDOR_ATTR_FEATURE_FLAGS: Supported Features
@@ -852,6 +856,7 @@ enum qca_wlan_vendor_attr {
 	QCA_WLAN_VENDOR_ATTR_NAN = 2,
 	QCA_WLAN_VENDOR_ATTR_STATS_EXT = 3,
 	QCA_WLAN_VENDOR_ATTR_IFINDEX = 4,
+	QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY = 5,
 	QCA_WLAN_VENDOR_ATTR_MAC_ADDR = 6,
 	QCA_WLAN_VENDOR_ATTR_FEATURE_FLAGS = 7,
 	QCA_WLAN_VENDOR_ATTR_CONCURRENCY_CAPA = 9,

+ 4 - 0
core/sme/inc/sme_api.h

@@ -583,6 +583,10 @@ QDF_STATUS sme_update_is_fast_roam_ini_feature_enabled(tHalHandle hHal,
 		uint8_t sessionId,
 		const bool
 		isFastRoamIniFeatureEnabled);
+
+QDF_STATUS sme_config_fast_roaming(tHalHandle hal, uint8_t session_id,
+		const bool is_fast_roam_enabled);
+
 QDF_STATUS sme_update_is_mawc_ini_feature_enabled(tHalHandle hHal,
 		const bool MAWCEnabled);
 QDF_STATUS sme_stop_roaming(tHalHandle hHal, uint8_t sessionId, uint8_t reason);

+ 35 - 0
core/sme/src/common/sme_api.c

@@ -8921,6 +8921,41 @@ QDF_STATUS sme_update_is_fast_roam_ini_feature_enabled
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * sme_config_fast_roaming() - enable/disable LFR support at runtime
+ * @hal - The handle returned by macOpen.
+ * @session_id - Session Identifier
+ * @is_fast_roam_enabled - flag to enable/disable roaming
+ *
+ * When Supplicant issues enabled/disable fast roaming on the basis
+ * of the Bssid modification in network block (e.g. AutoJoin mode N/W block)
+ *
+ * Return: QDF_STATUS
+ */
+
+QDF_STATUS sme_config_fast_roaming(tHalHandle hal, uint8_t session_id,
+				   const bool is_fast_roam_enabled)
+{
+	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
+	QDF_STATUS status;
+
+	if (!mac_ctx->roam.configParam.isFastRoamIniFeatureEnabled) {
+		sms_log(mac_ctx, LOGE, FL("Fast roam is disabled through ini"));
+		if (!is_fast_roam_enabled)
+			return QDF_STATUS_SUCCESS;
+		return  QDF_STATUS_E_FAILURE;
+	}
+	status = csr_neighbor_roam_update_fast_roaming_enabled(mac_ctx,
+					 session_id, is_fast_roam_enabled);
+	if (!QDF_IS_STATUS_SUCCESS(status)) {
+		sms_log(mac_ctx, LOGE,
+			FL("csr_neighbor_roam_update_fast_roaming_enabled failed"));
+		return  QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /*--------------------------------------------------------------------------
    \brief sme_update_is_mawc_ini_feature_enabled() -
    Enable/disable LFR MAWC support at runtime