Browse Source

qcacmn: Add new API to fetch ML IE info

In order to provide the info about common info len and BSS
param change count, add API util_get_mlie_common_info_len()
and util_get_bvmlie_bssparamchangecnt().

Change-Id: I0f5fea2265cbb8f1df265542af7009d624a0129b
CRs-Fixed: 3202491
Paul Zhang 3 năm trước cách đây
mục cha
commit
aeacfe3922
2 tập tin đã thay đổi với 161 bổ sung1 xóa
  1. 60 1
      umac/mlo_mgr/inc/utils_mlo.h
  2. 101 0
      umac/mlo_mgr/src/utils_mlo.c

+ 60 - 1
umac/mlo_mgr/inc/utils_mlo.h

@@ -189,6 +189,51 @@ QDF_STATUS
 util_get_bvmlie_primary_linkid(uint8_t *mlieseq, qdf_size_t mlieseqlen,
 			       bool *linkidfound, uint8_t *linkid);
 
+/**
+ * util_get_mlie_common_info_len() - Get the MLD common info len
+ * @mlieseq: Starting address of the Multi-Link element or Multi-Link element
+ * fragment sequence
+ * @mlieseqlen: Total length of the Multi-Link element or Multi-Link element
+ * fragment sequence
+ * @commoninfo_len: Pointer to the location where the value of the MLD common
+ * info len should be updated. This should be ignored by the caller if the
+ * function returns error.
+ *
+ * Get the MLD common info len from Multi-Link element transmitted by the AP.
+ *
+ * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
+ * the reason for error in the case of failure
+ */
+QDF_STATUS
+util_get_mlie_common_info_len(uint8_t *mlieseq, qdf_size_t mlieseqlen,
+			      uint8_t *commoninfo_len);
+
+/**
+ * util_get_bvmlie_bssparamchangecnt() - Get the MLD BSS PARAM Change Count
+ * @mlieseq: Starting address of the Multi-Link element or Multi-Link element
+ * fragment sequence
+ * @mlieseqlen: Total length of the Multi-Link element or Multi-Link element
+ * fragment sequence
+ * @bssparamchangecntfound: Pointer to the location where a boolean status
+ * should be updated indicating whether the MLD BSS PARAM Change Count was
+ * found or not. This should be ignored by the caller if the function
+ * returns error.
+ * @bssparamchangecnt: Pointer to the location where the value of the MLD BSS
+ * PARAM Change Count should be updated. This should be ignored by the caller
+ * if the function returns error, or if the function indicates that the MLD
+ * BSS PARAM Change Count was not found.
+ *
+ * Get the MLD BSS PARAM Change Count from Multi-Link element transmitted
+ * by the AP.
+ *
+ * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
+ * the reason for error in the case of failure
+ */
+QDF_STATUS
+util_get_bvmlie_bssparamchangecnt(uint8_t *mlieseq, qdf_size_t mlieseqlen,
+				  bool *bssparamchangecntfound,
+				  uint8_t *bssparamchangecnt);
+
 /**
  * util_get_bvmlie_mldcap - Get the MLD capabilities from a given Basic
  * variant Multi-Link element or element fragment sequence, of the AP that
@@ -276,9 +321,23 @@ util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
 	return QDF_STATUS_E_NOSUPPORT;
 }
 
+static inline QDF_STATUS
+util_get_mlie_common_info_len(uint8_t *mlieseq, qdf_size_t mlieseqlen,
+			      uint8_t *commoninfo_len)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline QDF_STATUS
+util_get_bvmlie_bssparamchangecnt(uint8_t *mlieseq, qdf_size_t mlieseqlen,
+				  bool *bssparamchangecntfound,
+				  uint8_t *bssparamchangecnt)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
 static inline QDF_STATUS
 util_get_bvmlie_mldmacaddr(uint8_t *mlieseq, qdf_size_t mlieseqlen,
-			   bool *mldmacaddrfound,
 			   struct qdf_mac_addr *mldmacaddr)
 {
 	return QDF_STATUS_E_NOSUPPORT;

+ 101 - 0
umac/mlo_mgr/src/utils_mlo.c

@@ -2181,6 +2181,107 @@ util_find_mlie(uint8_t *buf, qdf_size_t buflen, uint8_t **mlieseq,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+util_get_mlie_common_info_len(uint8_t *mlieseq, qdf_size_t mlieseqlen,
+			      uint8_t *commoninfo_len)
+{
+	struct wlan_ie_multilink *mlie_fixed;
+	enum wlan_ml_variant variant;
+	uint16_t mlcontrol;
+
+	if (!mlieseq || !mlieseqlen || !commoninfo_len)
+		return QDF_STATUS_E_NULL_VALUE;
+
+	if (mlieseqlen < sizeof(struct wlan_ie_multilink))
+		return QDF_STATUS_E_INVAL;
+
+	mlie_fixed = (struct wlan_ie_multilink *)mlieseq;
+
+	if (mlie_fixed->elem_id != WLAN_ELEMID_EXTN_ELEM ||
+	    mlie_fixed->elem_id_ext != WLAN_EXTN_ELEMID_MULTI_LINK)
+		return QDF_STATUS_E_INVAL;
+
+	mlcontrol = qdf_le16_to_cpu(mlie_fixed->mlcontrol);
+
+	variant = QDF_GET_BITS(mlcontrol, WLAN_ML_CTRL_TYPE_IDX,
+			       WLAN_ML_CTRL_TYPE_BITS);
+
+	if (variant != WLAN_ML_VARIANT_BASIC)
+		return QDF_STATUS_E_INVAL;
+
+	/* Common Info starts at mlieseq + sizeof(struct wlan_ie_multilink).
+	 * Check if there is sufficient space in the buffer for the Common Info
+	 * Length and MLD MAC address.
+	 */
+	if ((sizeof(struct wlan_ie_multilink) + WLAN_ML_BV_CINFO_LENGTH_SIZE +
+	    QDF_MAC_ADDR_SIZE) > mlieseqlen)
+		return QDF_STATUS_E_PROTO;
+
+	*commoninfo_len = *(mlieseq + sizeof(struct wlan_ie_multilink));
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+util_get_bvmlie_bssparamchangecnt(uint8_t *mlieseq, qdf_size_t mlieseqlen,
+				  bool *bssparamchangecntfound,
+				  uint8_t *bssparamchangecnt)
+{
+	struct wlan_ie_multilink *mlie_fixed;
+	enum wlan_ml_variant variant;
+	uint16_t mlcontrol;
+	uint16_t presencebitmap;
+	uint8_t *commoninfo;
+	qdf_size_t commoninfolen;
+
+	if (!mlieseq || !mlieseqlen || !bssparamchangecntfound ||
+	    !bssparamchangecnt)
+		return QDF_STATUS_E_NULL_VALUE;
+
+	*bssparamchangecntfound = false;
+	*bssparamchangecnt = 0;
+
+	if (mlieseqlen < sizeof(struct wlan_ie_multilink))
+		return QDF_STATUS_E_INVAL;
+
+	mlie_fixed = (struct wlan_ie_multilink *)mlieseq;
+
+	if (mlie_fixed->elem_id != WLAN_ELEMID_EXTN_ELEM ||
+	    mlie_fixed->elem_id_ext != WLAN_EXTN_ELEMID_MULTI_LINK)
+		return QDF_STATUS_E_INVAL;
+
+	mlcontrol = qdf_le16_to_cpu(mlie_fixed->mlcontrol);
+
+	variant = QDF_GET_BITS(mlcontrol, WLAN_ML_CTRL_TYPE_IDX,
+			       WLAN_ML_CTRL_TYPE_BITS);
+
+	if (variant != WLAN_ML_VARIANT_BASIC)
+		return QDF_STATUS_E_NOSUPPORT;
+
+	presencebitmap = QDF_GET_BITS(mlcontrol, WLAN_ML_CTRL_PBM_IDX,
+				      WLAN_ML_CTRL_PBM_BITS);
+
+	commoninfo = mlieseq + sizeof(struct wlan_ie_multilink);
+	commoninfolen = WLAN_ML_BV_CINFO_LENGTH_SIZE;
+
+	commoninfolen += QDF_MAC_ADDR_SIZE;
+
+	if (presencebitmap & WLAN_ML_BV_CTRL_PBM_LINKIDINFO_P) {
+		commoninfolen += WLAN_ML_BV_CINFO_LINKIDINFO_SIZE;
+
+		if ((sizeof(struct wlan_ie_multilink) + commoninfolen) >
+				mlieseqlen)
+			return QDF_STATUS_E_PROTO;
+	}
+
+	if (presencebitmap & WLAN_ML_BV_CTRL_PBM_BSSPARAMCHANGECNT_P) {
+		*bssparamchangecntfound = true;
+		*bssparamchangecnt = *(commoninfo + commoninfolen);
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS
 util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
 		      int *variant)