Browse Source

qcacld-3.0: Use connection manager api to get connection state

Currently api hdd_conn_get_connection_state does not use
connection manager to get the connection state. With this
change use connection manager api to get the connection
state.

Change-Id: I313e353cf1ae8f233044645daeab9fb5bdb6b64e
CRs-Fixed: 2859574
Ashish Kumar Dhanotiya 4 years ago
parent
commit
fef818649e

+ 0 - 16
core/hdd/inc/wlan_hdd_assoc.h

@@ -220,22 +220,6 @@ bool hdd_is_fils_connection(struct hdd_context *hdd_ctx,
 void hdd_conn_set_connection_state(struct hdd_adapter *adapter,
 				   eConnectionState conn_state);
 
-/**
- * hdd_conn_is_connected() - Function to check connection status
- * @sta_ctx:    pointer to global HDD Station context
- *
- * Return: false if any errors encountered, true otherwise
- */
-bool hdd_conn_is_connected(struct hdd_station_ctx *sta_ctx);
-
-/**
- * hdd_adapter_is_connected_sta() - check if @adapter is a connected station
- * @adapter: the adapter to check
- *
- * Return: true if @adapter is a connected station
- */
-bool hdd_adapter_is_connected_sta(struct hdd_adapter *adapter);
-
 /**
  * hdd_conn_get_connected_band() - get current connection radio band
  * @adapter: HDD adapter

+ 0 - 46
core/hdd/src/wlan_hdd_assoc.c

@@ -351,52 +351,6 @@ void hdd_conn_set_connection_state(struct hdd_adapter *adapter,
 
 }
 
-/**
- * hdd_conn_get_connection_state() - get connection state
- * @adapter: pointer to the adapter
- * @pConnState: pointer to connection state
- *
- * This function updates the global HDD station context connection state.
- *
- * Return: true if (Infra Associated)
- *	and sets output parameter pConnState;
- *	false otherwise
- */
-static inline bool
-hdd_conn_get_connection_state(struct hdd_station_ctx *sta_ctx,
-			      eConnectionState *out_state)
-{
-	eConnectionState state = sta_ctx->conn_info.conn_state;
-
-	if (out_state)
-		*out_state = state;
-
-	switch (state) {
-	case eConnectionState_Associated:
-	case eConnectionState_NdiConnected:
-		return true;
-	default:
-		return false;
-	}
-}
-
-bool hdd_conn_is_connected(struct hdd_station_ctx *sta_ctx)
-{
-	return hdd_conn_get_connection_state(sta_ctx, NULL);
-}
-
-bool hdd_adapter_is_connected_sta(struct hdd_adapter *adapter)
-{
-	switch (adapter->device_mode) {
-	case QDF_STA_MODE:
-	case QDF_P2P_CLIENT_MODE:
-	case QDF_NDI_MODE:
-		return hdd_conn_is_connected(&adapter->session.station);
-	default:
-		return false;
-	}
-}
-
 enum band_info hdd_conn_get_connected_band(struct hdd_adapter *adapter)
 {
 	struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);

+ 3 - 3
core/hdd/src/wlan_hdd_bcn_recv.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -280,7 +280,7 @@ static int hdd_handle_beacon_reporting_stop_op(struct hdd_context *hdd_ctx,
 		return errno;
 	}
 
-	if (hdd_adapter_is_connected_sta(adapter))
+	if (hdd_cm_is_vdev_associated(adapter))
 		/* Add beacon filter */
 		if (hdd_add_beacon_filter(adapter)) {
 			hdd_err("Beacon filter addition failed");
@@ -330,7 +330,7 @@ static int __wlan_hdd_cfg80211_bcn_rcv_op(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
-	if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+	if (!hdd_cm_is_vdev_associated(adapter)) {
 		hdd_err("STA not in connected state");
 		return -EINVAL;
 	}

+ 2 - 2
core/hdd/src/wlan_hdd_bus_bandwidth.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -131,7 +131,7 @@ bbm_get_bus_bw_level_vote(struct hdd_adapter *adapter,
 	case QDF_STA_MODE:
 	case QDF_P2P_CLIENT_MODE:
 		sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-		if (!hdd_conn_is_connected(sta_ctx))
+		if (!hdd_cm_is_vdev_associated(adapter))
 			break;
 
 		dot11_mode = hdd_convert_cfgdot11mode_to_80211mode(sta_ctx->

+ 3 - 3
core/hdd/src/wlan_hdd_cfg80211.c

@@ -5801,7 +5801,7 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx,
 			 *  if STA is already connected on DFS channel,
 			 *  do not disable scan on dfs channels
 			 */
-			if (hdd_conn_is_connected(sta_ctx) &&
+			if (hdd_cm_is_vdev_associated(adapter) &&
 			    (CHANNEL_STATE_DFS ==
 			     wlan_reg_get_channel_state_for_freq(
 				hdd_ctx->pdev,
@@ -10928,7 +10928,7 @@ wlan_hdd_add_tx_ptrn(struct hdd_adapter *adapter, struct hdd_context *hdd_ctx,
 	uint16_t eth_type = htons(ETH_P_IP);
 	mac_handle_t mac_handle;
 
-	if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+	if (!hdd_cm_is_vdev_associated(adapter)) {
 		hdd_err("Not in Connected state!");
 		return -ENOTSUPP;
 	}
@@ -24232,7 +24232,7 @@ static int __wlan_hdd_cfg80211_get_channel(struct wiphy *wiphy,
 	    (adapter->device_mode == QDF_P2P_CLIENT_MODE)) {
 		struct hdd_station_ctx *sta_ctx;
 
-		if (!hdd_adapter_is_connected_sta(adapter))
+		if (!hdd_cm_is_vdev_associated(adapter))
 			return -EINVAL;
 
 		sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);

+ 2 - 2
core/hdd/src/wlan_hdd_debugfs.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -348,7 +348,7 @@ static ssize_t __wcnss_patterngen_write(struct net_device *net_dev,
 	 */
 	hdd_debug("device mode %d", adapter->device_mode);
 	if ((QDF_STA_MODE == adapter->device_mode) &&
-	    (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter)))) {
+	    (!hdd_cm_is_vdev_associated(adapter))) {
 		hdd_err("Not in Connected state!");
 		goto failure;
 	}

+ 1 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -3023,7 +3023,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
 	 */
 	if (sta_adapter && conc_rule1) {
 		sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(sta_adapter);
-		if (hdd_conn_is_connected(sta_ctx)) {
+		if (hdd_cm_is_vdev_associated(sta_adapter)) {
 			hdd_err("Channel switch not allowed after STA connection with conc_custom_rule1 enabled");
 			return -EBUSY;
 		}

+ 2 - 2
core/hdd/src/wlan_hdd_ioctl.c

@@ -5138,7 +5138,7 @@ static int drv_cmd_ccx_beacon_req(struct hdd_adapter *adapter,
 		goto exit;
 	}
 
-	if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+	if (!hdd_cm_is_vdev_associated(adapter)) {
 		hdd_debug("Not associated");
 
 		if (!req.numBcnReqIe)
@@ -5768,7 +5768,7 @@ static int hdd_set_rx_filter(struct hdd_adapter *adapter, bool action,
 	if (((adapter->device_mode == QDF_STA_MODE) ||
 		(adapter->device_mode == QDF_P2P_CLIENT_MODE)) &&
 		adapter->mc_addr_list.mc_cnt &&
-		hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+		hdd_cm_is_vdev_associated(adapter)) {
 
 
 		filter = qdf_mem_malloc(sizeof(*filter));

+ 7 - 8
core/hdd/src/wlan_hdd_main.c

@@ -4345,7 +4345,7 @@ static int __hdd_open(struct net_device *dev)
 	}
 
 	set_bit(DEVICE_IFACE_OPENED, &adapter->event_flags);
-	if (hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+	if (hdd_cm_is_vdev_associated(adapter)) {
 		hdd_debug("Enabling Tx Queues");
 		/* Enable TX queues only when we are connected */
 		wlan_hdd_netif_queue_control(adapter,
@@ -5576,8 +5576,7 @@ bool hdd_is_vdev_in_conn_state(struct hdd_adapter *adapter)
 	case QDF_STA_MODE:
 	case QDF_P2P_CLIENT_MODE:
 	case QDF_P2P_DEVICE_MODE:
-		return hdd_conn_is_connected(
-				WLAN_HDD_GET_STATION_CTX_PTR(adapter));
+		return hdd_cm_is_vdev_associated(adapter);
 	case QDF_SAP_MODE:
 	case QDF_P2P_GO_MODE:
 		return (test_bit(SOFTAP_BSS_STARTED,
@@ -7111,7 +7110,7 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
 		      adapter->device_mode == QDF_P2P_CLIENT_MODE) &&
 		      !hdd_cm_is_disconnected(adapter))
 #else
-		    hdd_conn_is_connected(sta_ctx) ||
+		    hdd_cm_is_vdev_associated(adapter) ||
 		    hdd_cm_is_connecting(adapter)
 #endif
 		    ) {
@@ -10377,7 +10376,7 @@ static void __hdd_bus_bw_work_handler(struct hdd_context *hdd_ctx)
 					   adapter->prev_tx_bytes);
 
 		if (adapter->device_mode == QDF_STA_MODE &&
-		   hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter)))
+		   hdd_cm_is_vdev_associated(adapter))
 			hdd_send_mscs_action_frame(hdd_ctx, adapter);
 
 		if (adapter->device_mode == QDF_SAP_MODE ||
@@ -10528,7 +10527,7 @@ __hdd_adapter_param_update_work(struct hdd_adapter *adapter)
 	 * done at multiple places or entry points, instead its preferred to
 	 * check the connection state and skip the operation here.
 	 */
-	if (!hdd_adapter_is_connected_sta(adapter))
+	if (!hdd_cm_is_vdev_associated(adapter))
 		return;
 
 	hdd_netdev_update_features(adapter);
@@ -15432,7 +15431,7 @@ wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter,
 
 		if (cur_adapter->vdev_id != adapter->vdev_id &&
 		    adapter->device_mode == QDF_STA_MODE &&
-		    hdd_conn_is_connected(sta_ctx)) {
+		    hdd_cm_is_vdev_associated(adapter)) {
 			hdd_debug("%d Disable roaming", adapter->vdev_id);
 			sme_stop_roaming(hdd_ctx->mac_handle,
 					 adapter->vdev_id,
@@ -15461,7 +15460,7 @@ wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter,
 
 		if (cur_adapter->vdev_id != adapter->vdev_id &&
 		    adapter->device_mode == QDF_STA_MODE &&
-		    hdd_conn_is_connected(sta_ctx)) {
+		    hdd_cm_is_vdev_associated(adapter)) {
 			hdd_debug("%d Enable roaming", adapter->vdev_id);
 			sme_start_roaming(hdd_ctx->mac_handle,
 					  adapter->vdev_id,

+ 2 - 2
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -141,7 +141,7 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
 			break;
 		case QDF_P2P_CLIENT_MODE:
 			sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-			if (hdd_conn_is_connected(sta_ctx) ||
+			if (hdd_cm_is_vdev_associated(adapter) ||
 			    hdd_cm_is_connecting(adapter)) {
 				hdd_adapter_dev_put_debug(adapter, dbgid);
 				if (next_adapter)
@@ -181,7 +181,7 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
 			break;
 		case QDF_P2P_CLIENT_MODE:
 			sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-			if (hdd_conn_is_connected(sta_ctx) ||
+			if (hdd_cm_is_vdev_associated(adapter) ||
 			    hdd_cm_is_connecting(adapter)) {
 				hdd_adapter_dev_put_debug(adapter, dbgid);
 				if (next_adapter)

+ 4 - 4
core/hdd/src/wlan_hdd_power.c

@@ -1204,7 +1204,7 @@ void hdd_enable_mc_addr_filtering(struct hdd_adapter *adapter,
 	if (wlan_hdd_validate_context(hdd_ctx))
 		return;
 
-	if (!hdd_adapter_is_connected_sta(adapter))
+	if (!hdd_cm_is_vdev_associated(adapter))
 		return;
 
 	status = ucfg_pmo_enable_mc_addr_filtering_in_fwr(hdd_ctx->psoc,
@@ -1224,7 +1224,7 @@ void hdd_disable_mc_addr_filtering(struct hdd_adapter *adapter,
 	if (wlan_hdd_validate_context(hdd_ctx))
 		return;
 
-	if (!hdd_adapter_is_connected_sta(adapter))
+	if (!hdd_cm_is_vdev_associated(adapter))
 		return;
 
 	status = ucfg_pmo_disable_mc_addr_filtering_in_fwr(hdd_ctx->psoc,
@@ -1249,7 +1249,7 @@ void hdd_disable_and_flush_mc_addr_list(struct hdd_adapter *adapter,
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	QDF_STATUS status;
 
-	if (!hdd_adapter_is_connected_sta(adapter))
+	if (!hdd_cm_is_vdev_associated(adapter))
 		goto flush_mc_list;
 
 	/* disable mc list first because the mc list is cached in PMO */
@@ -2374,7 +2374,7 @@ static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
 
 	status = wlan_hdd_set_powersave(adapter, allow_power_save, timeout);
 
-	if (hdd_adapter_is_connected_sta(adapter)) {
+	if (hdd_cm_is_vdev_associated(adapter)) {
 		hdd_debug("vdev mode %d enable dhcp protection",
 			  adapter->device_mode);
 		allow_power_save ? hdd_stop_dhcp_ind(adapter) :

+ 2 - 2
core/hdd/src/wlan_hdd_rssi_monitor.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -84,7 +84,7 @@ __wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy,
 	if (ret)
 		return ret;
 
-	if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+	if (!hdd_cm_is_vdev_associated(adapter)) {
 		hdd_err("Not in Connected state!");
 		return -ENOTSUPP;
 	}

+ 9 - 8
core/hdd/src/wlan_hdd_station_info.c

@@ -376,11 +376,12 @@ static int hdd_convert_dot11mode(uint32_t dot11mode)
  * Return: Success(0) or reason code for failure
  */
 static int32_t hdd_add_tx_bitrate(struct sk_buff *skb,
-				  struct hdd_station_ctx *hdd_sta_ctx,
+				  struct hdd_adapter *adapter,
 				  int idx)
 {
 	struct nlattr *nla_attr;
 	uint32_t bitrate, bitrate_compat;
+	struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 
 	nla_attr = nla_nest_start(skb, idx);
 	if (!nla_attr) {
@@ -389,12 +390,12 @@ static int32_t hdd_add_tx_bitrate(struct sk_buff *skb,
 	}
 
 	/* cfg80211_calculate_bitrate will return 0 for mcs >= 32 */
-	if (hdd_conn_is_connected(hdd_sta_ctx))
+	if (hdd_cm_is_vdev_associated(adapter))
 		bitrate = cfg80211_calculate_bitrate(
-				&hdd_sta_ctx->cache_conn_info.max_tx_bitrate);
+				&sta_ctx->cache_conn_info.max_tx_bitrate);
 	else
 		bitrate = cfg80211_calculate_bitrate(
-					&hdd_sta_ctx->cache_conn_info.txrate);
+					&sta_ctx->cache_conn_info.txrate);
 	/* report 16-bit bitrate only if we can */
 	bitrate_compat = bitrate < (1UL << 16) ? bitrate : 0;
 
@@ -418,7 +419,7 @@ static int32_t hdd_add_tx_bitrate(struct sk_buff *skb,
 	}
 
 	if (nla_put_u8(skb, NL80211_RATE_INFO_VHT_NSS,
-		       hdd_sta_ctx->cache_conn_info.txrate.nss)) {
+		      sta_ctx->cache_conn_info.txrate.nss)) {
 		hdd_err("put fail");
 		goto fail;
 	}
@@ -427,7 +428,7 @@ static int32_t hdd_add_tx_bitrate(struct sk_buff *skb,
 	hdd_nofl_debug(
 		"STA Tx rate info:: bitrate:%d, bitrate_compat:%d, NSS:%d",
 		bitrate, bitrate_compat,
-		hdd_sta_ctx->cache_conn_info.txrate.nss);
+		sta_ctx->cache_conn_info.txrate.nss);
 
 	return 0;
 fail:
@@ -526,10 +527,10 @@ static int32_t hdd_add_sta_info(struct sk_buff *skb,
 		hdd_err("put fail");
 		goto fail;
 	}
-	if (hdd_conn_is_connected(hdd_sta_ctx))
+	if (hdd_cm_is_vdev_associated(adapter))
 		hdd_get_max_tx_bitrate(hdd_ctx, adapter);
 
-	if (hdd_add_tx_bitrate(skb, hdd_sta_ctx, NL80211_STA_INFO_TX_BITRATE)) {
+	if (hdd_add_tx_bitrate(skb, adapter, NL80211_STA_INFO_TX_BITRATE)) {
 		hdd_err("hdd_add_tx_bitrate failed");
 		goto fail;
 	}

+ 1 - 1
core/hdd/src/wlan_hdd_subnet_detect.c

@@ -96,7 +96,7 @@ static int __wlan_hdd_cfg80211_set_gateway_params(struct wiphy *wiphy,
 		return -ENOTSUPP;
 	}
 
-	if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+	if (!hdd_cm_is_vdev_associated(adapter)) {
 		hdd_debug("Received GW param update in disconnected state!");
 		return -ENOTSUPP;
 	}

+ 1 - 1
core/hdd/src/wlan_hdd_sysfs.c

@@ -406,7 +406,7 @@ static ssize_t __show_beacon_reception_stats(struct net_device *net_dev,
 		return -ENOTSUPP;
 	}
 
-	if (!hdd_adapter_is_connected_sta(adapter)) {
+	if (!hdd_cm_is_vdev_associated(adapter)) {
 		hdd_err("Adapter is not in connected state");
 		return -EINVAL;
 	}

+ 2 - 2
core/hdd/src/wlan_hdd_wext.c

@@ -7924,7 +7924,7 @@ static int __iw_set_host_offload(struct net_device *dev,
 	if (0 != ret)
 		return ret;
 
-	if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+	if (!hdd_cm_is_vdev_associated(adapter)) {
 		hdd_err("dev is not in CONNECTED state, ignore!!!");
 		return -EINVAL;
 	}
@@ -8178,7 +8178,7 @@ static int __iw_set_packet_filter_params(struct net_device *dev,
 		return -ENOTSUPP;
 	}
 
-	if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+	if (!hdd_cm_is_vdev_associated(adapter)) {
 		hdd_err("Packet filter not supported in disconnected state");
 		return -ENOTSUPP;
 	}