Quellcode durchsuchen

qcacld-3.0: Add API to get sta information for EasyMesh

Add API to get sta information for EasyMesh.

Change-Id: I12e7eaae3562ca35b33f0637a33e784b912ca8a3
CRs-Fixed: 3044736
bings vor 3 Jahren
Ursprung
Commit
53a13ccb3a

+ 2 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -1597,6 +1597,8 @@ static void hdd_fill_station_info(struct hdd_adapter *adapter,
 	 */
 	is_dot11_mode_abgn = true;
 	stainfo->ecsa_capable = event->ecsa_capable;
+	stainfo->ext_cap = event->ext_cap;
+	stainfo->supported_band = event->supported_band;
 
 	if (event->vht_caps.present) {
 		stainfo->vht_present = true;

+ 116 - 0
core/hdd/src/wlan_hdd_son.c

@@ -1001,6 +1001,120 @@ static enum ieee80211_phymode hdd_son_get_phymode(struct wlan_objmgr_vdev *vdev)
 	return hdd_phymode_chwidth_freq_to_son_phymode(phymode, chwidth, freq);
 }
 
+/**
+ * hdd_son_per_sta_len() - get sta information length
+ * @sta_info: pointer to hdd_station_info
+ *
+ * TD: Certain IE may be provided for sta info
+ *
+ * Return: the size which is needed for given sta info
+ */
+static uint32_t hdd_son_per_sta_len(struct hdd_station_info *sta_info)
+{
+	return qdf_roundup(sizeof(struct ieee80211req_sta_info),
+			   sizeof(uint32_t));
+}
+
+/**
+ * hdd_son_get_sta_space() - how many space are needed for given vdev
+ * @vdev: vdev
+ *
+ * Return: space needed for given vdev to provide sta info
+ */
+static uint32_t hdd_son_get_sta_space(struct wlan_objmgr_vdev *vdev)
+{
+	struct hdd_adapter *adapter;
+	struct hdd_station_info *sta_info = NULL;
+	uint32_t space = 0;
+
+	if (!vdev) {
+		hdd_err("null vdev");
+		return space;
+	}
+	adapter = wlan_hdd_get_adapter_from_objmgr(vdev);
+	if (!adapter) {
+		hdd_err("null adapter");
+		return space;
+	}
+
+	hdd_for_each_sta_ref(adapter->sta_info_list, sta_info,
+			     STA_INFO_SOFTAP_GET_STA_INFO) {
+		if (!qdf_is_macaddr_broadcast(&sta_info->sta_mac))
+			space += hdd_son_per_sta_len(sta_info);
+
+		hdd_put_sta_info_ref(&adapter->sta_info_list,
+				     &sta_info, true,
+				     STA_INFO_SOFTAP_GET_STA_INFO);
+	}
+	hdd_debug("sta list space %u", space);
+
+	return space;
+}
+
+/**
+ * hdd_son_get_stalist() - get connected station list
+ * @vdev: vdev
+ * @si: pointer to ieee80211req_sta_info
+ * @space: space left
+ *
+ * Return: void
+ */
+static void hdd_son_get_sta_list(struct wlan_objmgr_vdev *vdev,
+				 struct ieee80211req_sta_info *si,
+				 uint32_t *space)
+{
+	struct hdd_adapter *adapter;
+	struct hdd_station_info *sta_info = NULL;
+	uint32_t len;
+
+	if (!vdev) {
+		hdd_err("null vdev");
+		return;
+	}
+	adapter = wlan_hdd_get_adapter_from_objmgr(vdev);
+	if (!adapter) {
+		hdd_err("null adapter");
+		return;
+	}
+
+	hdd_for_each_sta_ref(adapter->sta_info_list, sta_info,
+			     STA_INFO_SOFTAP_GET_STA_INFO) {
+		if (!qdf_is_macaddr_broadcast(&sta_info->sta_mac)) {
+			len = hdd_son_per_sta_len(sta_info);
+
+			if (len > *space) {
+				/* no more space if left */
+				hdd_put_sta_info_ref(
+					&adapter->sta_info_list,
+					&sta_info, true,
+					STA_INFO_SOFTAP_GET_STA_INFO);
+				hdd_err("space %u, length %u", *space, len);
+
+				return;
+			}
+
+			qdf_mem_copy(si->isi_macaddr, &sta_info->sta_mac,
+				     QDF_MAC_ADDR_SIZE);
+			si->isi_ext_cap = sta_info->ext_cap;
+			si->isi_operating_bands = sta_info->supported_band;
+			si->isi_assoc_time = sta_info->assoc_ts;
+			si->isi_rssi = sta_info->rssi;
+			si->isi_len = len;
+			si->isi_ie_len = 0;
+			si = (struct ieee80211req_sta_info *)(((uint8_t *)si) +
+			     len);
+			*space -= len;
+			hdd_debug("sta " QDF_MAC_ADDR_FMT " ext_cap %u op band %u rssi %d len %u",
+				  QDF_MAC_ADDR_REF(si->isi_macaddr),
+				  si->isi_ext_cap, si->isi_operating_bands,
+				  si->isi_rssi, si->isi_len);
+		}
+		hdd_put_sta_info_ref(&adapter->sta_info_list,
+				     &sta_info, true,
+				     STA_INFO_SOFTAP_GET_STA_INFO);
+	}
+}
+
 /**
  * hdd_son_set_acl_policy() - set son acl policy
  * @vdev: vdev
@@ -1414,6 +1528,8 @@ void hdd_son_register_callbacks(struct hdd_context *hdd_ctx)
 	cb_obj.os_if_get_chwidth = hdd_son_get_chwidth;
 	cb_obj.os_if_deauth_sta = hdd_son_deauth_sta;
 	cb_obj.os_if_modify_acl = hdd_son_modify_acl;
+	cb_obj.os_if_get_sta_list = hdd_son_get_sta_list;
+	cb_obj.os_if_get_sta_space = hdd_son_get_sta_space;
 
 	os_if_son_register_hdd_callbacks(hdd_ctx->psoc, &cb_obj);
 

+ 5 - 0
core/hdd/src/wlan_hdd_sta_info.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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
@@ -177,6 +178,8 @@ char *sta_info_string_from_dbgid(wlan_sta_info_dbgid id);
  * @nss: Number of spatial streams supported
  * @rate_flags: Rate Flags for this connection
  * @ecsa_capable: Extended CSA capabilities
+ * @ext_cap: The first 4 bytes of Extended capabilities IE
+ * @supported_band: sta band capabilities bitmap from supporting opclass
  * @max_phy_rate: Calcuated maximum phy rate based on mode, nss, mcs etc.
  * @tx_packets: The number of frames from host to firmware
  * @tx_bytes: Bytes send to current station
@@ -244,6 +247,8 @@ struct hdd_station_info {
 	uint8_t   nss;
 	uint32_t  rate_flags;
 	uint8_t   ecsa_capable;
+	uint32_t ext_cap;
+	uint8_t supported_band;
 	uint32_t max_phy_rate;
 	uint32_t tx_packets;
 	uint64_t tx_bytes;

+ 2 - 0
core/mac/inc/sir_api.h

@@ -1069,6 +1069,8 @@ struct assoc_ind {
 	uint8_t tx_mcs_map;
 	/* Extended CSA capability of station */
 	uint8_t ecsa_capable;
+	uint32_t ext_cap;
+	uint8_t supported_band;
 	tDot11fIEHTCaps HTCaps;
 	tDot11fIEVHTCaps VHTCaps;
 	bool he_caps_present;

+ 24 - 1
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -3002,6 +3002,8 @@ bool lim_fill_lim_assoc_ind_params(
 	bool wme_enable;
 	struct wlan_objmgr_vdev *vdev;
 	struct vdev_mlme_obj *mlme_obj;
+	uint8_t country_iso[REG_ALPHA2_LEN + 1];
+	tDot11fIESuppOperatingClasses *oper_class;
 
 	if (!session_entry->parsedAssocReq) {
 		pe_err(" Parsed Assoc req is NULL");
@@ -3195,9 +3197,30 @@ bool lim_fill_lim_assoc_ind_params(
 		assoc_ind->max_mcs_idx = maxidx;
 	}
 	fill_mlm_assoc_ind_vht(assoc_req, sta_ds, assoc_ind);
-	if (assoc_req->ExtCap.present)
+	if (assoc_req->ExtCap.present) {
 		assoc_ind->ecsa_capable =
 		((struct s_ext_cap *)assoc_req->ExtCap.bytes)->ext_chan_switch;
+		if (assoc_req->ExtCap.num_bytes >= sizeof(assoc_ind->ext_cap))
+			qdf_mem_copy(&assoc_ind->ext_cap,
+				     assoc_req->ExtCap.bytes,
+				     sizeof(assoc_ind->ext_cap));
+		else
+			qdf_mem_copy(&assoc_ind->ext_cap,
+				     assoc_req->ExtCap.bytes,
+				     assoc_req->ExtCap.num_bytes);
+	}
+
+	if (assoc_req->supp_operating_classes.present) {
+		oper_class = &assoc_req->supp_operating_classes;
+		qdf_mem_zero(country_iso, sizeof(country_iso));
+		country_iso[2] = OP_CLASS_GLOBAL;
+		assoc_ind->supported_band =
+				wlan_reg_get_band_cap_from_op_class(
+						country_iso,
+						oper_class->num_classes,
+						oper_class->classes);
+	}
+
 	/* updates VHT information in assoc indication */
 	if (assoc_req->VHTCaps.present)
 		qdf_mem_copy(&assoc_ind->vht_caps, &assoc_req->VHTCaps,

+ 3 - 0
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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
@@ -786,6 +787,8 @@ lim_fill_sme_assoc_ind_params(
 	sme_assoc_ind->rx_mcs_map = assoc_ind->rx_mcs_map;
 	sme_assoc_ind->tx_mcs_map = assoc_ind->tx_mcs_map;
 	sme_assoc_ind->ecsa_capable = assoc_ind->ecsa_capable;
+	sme_assoc_ind->ext_cap = assoc_ind->ext_cap;
+	sme_assoc_ind->supported_band = assoc_ind->supported_band;
 
 	if (assoc_ind->ht_caps.present)
 		sme_assoc_ind->HTCaps = assoc_ind->ht_caps;

+ 3 - 0
core/mac/src/pe/lim/lim_types.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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
@@ -240,6 +241,8 @@ typedef struct sLimMlmAssocInd {
 	uint8_t rx_mcs_map;
 	uint8_t tx_mcs_map;
 	uint8_t ecsa_capable;
+	uint32_t ext_cap;
+	uint8_t supported_band;
 
 	tDot11fIEHTCaps ht_caps;
 	tDot11fIEVHTCaps vht_caps;

+ 2 - 0
core/sap/inc/sap_api.h

@@ -278,6 +278,8 @@ typedef struct sap_StationAssocReassocCompleteEvent_s {
 	uint8_t rx_mcs_map;
 	uint8_t tx_mcs_map;
 	uint8_t ecsa_capable;
+	uint32_t ext_cap;
+	uint8_t supported_band;
 	tDot11fIEHTCaps ht_caps;
 	tDot11fIEVHTCaps vht_caps;
 	tSirMacCapabilityInfo capability_info;

+ 2 - 0
core/sap/src/sap_fsm.c

@@ -2062,6 +2062,8 @@ QDF_STATUS sap_signal_hdd_event(struct sap_context *sap_ctx,
 		reassoc_complete->rx_mcs_map = csr_roaminfo->rx_mcs_map;
 		reassoc_complete->tx_mcs_map = csr_roaminfo->tx_mcs_map;
 		reassoc_complete->ecsa_capable = csr_roaminfo->ecsa_capable;
+		reassoc_complete->ext_cap = csr_roaminfo->ext_cap;
+		reassoc_complete->supported_band = csr_roaminfo->supported_band;
 		if (csr_roaminfo->ht_caps.present)
 			reassoc_complete->ht_caps = csr_roaminfo->ht_caps;
 		if (csr_roaminfo->vht_caps.present)

+ 5 - 0
core/sme/inc/csr_api.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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
@@ -582,6 +583,8 @@ struct csr_roam_info {
 	uint8_t tx_mcs_map;
 	/* Extended capabilities of STA */
 	uint8_t ecsa_capable;
+	uint32_t ext_cap;
+	uint8_t supported_band;
 	int rssi;
 	int tx_rate;
 	int rx_rate;
@@ -625,6 +628,8 @@ typedef struct sSirSmeAssocIndToUpperLayerCnf {
 	uint8_t tx_mcs_map;
 	/* Extended capabilities of STA */
 	uint8_t              ecsa_capable;
+	uint32_t ext_cap;
+	uint8_t supported_band;
 
 	uint32_t ies_len;
 	uint8_t *ies;

+ 6 - 0
core/sme/src/csr/csr_api_roam.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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
@@ -3689,6 +3690,9 @@ void csr_roam_joined_state_msg_processor(struct mac_context *mac, void *msg_buf)
 		roam_info->rx_mcs_map = pUpperLayerAssocCnf->rx_mcs_map;
 		roam_info->tx_mcs_map = pUpperLayerAssocCnf->tx_mcs_map;
 		roam_info->ecsa_capable = pUpperLayerAssocCnf->ecsa_capable;
+		roam_info->ext_cap = pUpperLayerAssocCnf->ext_cap;
+		roam_info->supported_band =
+					pUpperLayerAssocCnf->supported_band;
 		if (pUpperLayerAssocCnf->ht_caps.present)
 			roam_info->ht_caps = pUpperLayerAssocCnf->ht_caps;
 		if (pUpperLayerAssocCnf->vht_caps.present)
@@ -4221,6 +4225,8 @@ csr_send_assoc_ind_to_upper_layer_cnf_msg(struct mac_context *mac,
 	cnf->rx_mcs_map = ind->rx_mcs_map;
 	cnf->tx_mcs_map = ind->tx_mcs_map;
 	cnf->ecsa_capable = ind->ecsa_capable;
+	cnf->ext_cap = ind->ext_cap;
+	cnf->supported_band = ind->supported_band;
 	if (ind->HTCaps.present)
 		cnf->ht_caps = ind->HTCaps;
 	if (ind->VHTCaps.present)

+ 25 - 0
os_if/son/inc/os_if_son.h

@@ -56,6 +56,8 @@
  * @os_if_kickout_mac: kickout sta with given mac
  * @os_if_set_chwidth: set chan width
  * @os_if_get_chwidth: get chan width
+ * @os_if_get_sta_list: get sta list
+ * @os_if_get_sta_space: get sta space
  * @os_if_deauth_sta: Deauths the target peer
  * @os_if_modify_acl: Add/Del target peer in ACL
  */
@@ -96,6 +98,10 @@ struct son_callbacks {
 				 enum ieee80211_cwm_width son_chwidth);
 	enum ieee80211_cwm_width (*os_if_get_chwidth)(
 				struct wlan_objmgr_vdev *vdev);
+	void (*os_if_get_sta_list)(struct wlan_objmgr_vdev *vdev,
+				   struct ieee80211req_sta_info *req,
+				   uint32_t *space);
+	uint32_t (*os_if_get_sta_space)(struct wlan_objmgr_vdev *vdev);
 	void (*os_if_deauth_sta)(struct wlan_objmgr_vdev *vdev,
 				 uint8_t *peer_mac,
 				 bool ignore_frame);
@@ -449,6 +455,25 @@ ieee80211_acl_cmd os_if_son_get_acl_policy(struct wlan_objmgr_vdev *vdev);
 int os_if_son_add_acl_mac(struct wlan_objmgr_vdev *vdev,
 			  struct qdf_mac_addr *acl_mac);
 
+/**
+ * os_if_son_get_sta_space() - get sta space
+ * @vdev: target vdev
+ *
+ * Return: bytes which is needed to fill sta information
+ */
+uint32_t os_if_son_get_sta_space(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * os_if_son_get_sta_list() - get sta list
+ * @vdev: target vdev
+ * @si: pointer to ieee80211req_sta_info
+ * @space: space left
+ *
+ * Return: void
+ */
+void os_if_son_get_sta_list(struct wlan_objmgr_vdev *vdev,
+			    struct ieee80211req_sta_info *si, uint32_t *space);
+
 /**
  * os_if_son_del_acl_mac() - del mac from acl
  * @vdev: vdev

+ 41 - 0
os_if/son/src/os_if_son.c

@@ -947,6 +947,47 @@ bool os_if_son_vdev_is_wds(struct wlan_objmgr_vdev *vdev)
 
 qdf_export_symbol(os_if_son_vdev_is_wds);
 
+uint32_t os_if_son_get_sta_space(struct wlan_objmgr_vdev *vdev)
+{
+	uint32_t sta_space;
+
+	if (!vdev) {
+		osif_err("null vdev");
+		return 0;
+	}
+
+	sta_space = g_son_os_if_cb.os_if_get_sta_space(vdev);
+	osif_debug("need space %u", sta_space);
+
+	return sta_space;
+}
+
+qdf_export_symbol(os_if_son_get_sta_space);
+
+void os_if_son_get_sta_list(struct wlan_objmgr_vdev *vdev,
+			    struct ieee80211req_sta_info *si, uint32_t *space)
+{
+	if (!vdev) {
+		osif_err("null vdev");
+		return;
+	}
+
+	if (!si) {
+		osif_err("null si");
+		return;
+	}
+	if (!space || *space == 0) {
+		osif_err("invalid input space");
+		return;
+	}
+
+	g_son_os_if_cb.os_if_get_sta_list(vdev, si, space);
+
+	osif_debug("left space %u", *space);
+}
+
+qdf_export_symbol(os_if_son_get_sta_list);
+
 void os_if_son_deauth_peer_sta(struct wlan_objmgr_vdev *vdev,
 			       uint8_t *peer_mac,
 			       bool ignore_frame)