Kaynağa Gözat

qcacmn: Add EPCS action frame parsing support

Add support for parsing of EPCS action frame.

Change-Id: I53c6e9fe7dd802c0b60170a3e441eb2ef5b8c659
CRs-Fixed: 3490403
Venkateswara Swamy Bandaru 2 yıl önce
ebeveyn
işleme
a86dd8a444
2 değiştirilmiş dosya ile 288 ekleme ve 0 silme
  1. 80 0
      umac/mlo_mgr/inc/wlan_mlo_epcs.h
  2. 208 0
      umac/mlo_mgr/src/wlan_mlo_epcs.c

+ 80 - 0
umac/mlo_mgr/inc/wlan_mlo_epcs.h

@@ -44,6 +44,61 @@ enum wlan_epcs_category {
 	WLAN_EPCS_CATEGORY_INVALID,
 };
 
+/**
+ * struct wlan_epcs_info - EPCS information of frame
+ * @cat: frame category
+ * @dialog_token: dialog token
+ * @status: status
+ */
+struct wlan_epcs_info {
+	enum wlan_epcs_category cat;
+	uint8_t dialog_token;
+	uint8_t status;
+};
+
+/**
+ * struct wlan_mlo_peer_epcs_policy - Peer EPCS information
+ * @enable: EPCS enable status
+ * @self_gen_dialog_token: selfgenerated dialog token
+ * @status: status
+ */
+struct wlan_mlo_peer_epcs_policy {
+	uint8_t enable;
+	uint8_t self_gen_dialog_token;
+	uint8_t status;
+};
+
+/**
+ * struct wlan_epcs_context - EPCS context if MLD
+ */
+struct wlan_epcs_context {
+};
+
+/**
+ * struct epcs_frm - EPCS action frame format
+ * @category: category
+ * @protected_eht_action: Protected EHT Action
+ * @dialog_token: Dialog Token
+ * @status_code: Status Code
+ * @req: Request frame
+ * @resp: Response frame
+ * @bytes: Priority Access Multi-Link element bytes
+ */
+struct epcs_frm {
+	uint8_t category;
+	uint8_t protected_eht_action;
+	uint8_t dialog_token;
+	union {
+		struct {
+			uint8_t bytes[0];
+		} req;
+		struct {
+			uint8_t status_code;
+			uint8_t bytes[0];
+		} resp;
+	};
+};
+
 #define epcs_alert(format, args...) \
 		QDF_TRACE_FATAL(QDF_MODULE_ID_EPCS, format, ## args)
 
@@ -62,4 +117,29 @@ enum wlan_epcs_category {
 #define epcs_rl_debug(format, args...) \
 		QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_EPCS, format, ## args)
 
+/**
+ * wlan_mlo_add_epcs_action_frame() - API to add EPCS action frame
+ * @frm: Pointer to a frame to add EPCS information
+ * @args: EPCS action frame related info
+ * @buf: Pointer to EPCS IE values
+ *
+ * Return: Pointer to the updated frame buffer
+ */
+uint8_t *wlan_mlo_add_epcs_action_frame(uint8_t *frm,
+					struct wlan_action_frame_args *args,
+					uint8_t *buf);
+
+/**
+ * wlan_mlo_parse_epcs_action_frame() - API to parse EPCS action frame
+ * @epcs: Pointer to EPCS information
+ * @action_frm: EPCS action frame
+ * @frm_len: frame length
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_mlo_parse_epcs_action_frame(struct wlan_epcs_info *epcs,
+				 struct wlan_action_frame *action_frm,
+				 uint32_t frm_len);
+
 #endif /* _WLAN_MLO_EPCS_H_ */

+ 208 - 0
umac/mlo_mgr/src/wlan_mlo_epcs.c

@@ -25,4 +25,212 @@
 #include <wlan_mlo_mgr_cmn.h>
 #include <qdf_util.h>
 #include <wlan_cm_api.h>
+#include <utils_mlo.h>
+#include <wlan_mlo_epcs.h>
 
+/**
+ * wlan_mlo_parse_epcs_request_action_frame() - API to parse EPCS request action
+ * frame.
+ * @epcs: Pointer to EPCS structure
+ * @action_frm: Pointer to action frame
+ * @frm_len: frame length
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+wlan_mlo_parse_epcs_request_action_frame(struct wlan_epcs_info *epcs,
+					 struct wlan_action_frame *action_frm,
+					 uint32_t frm_len)
+{
+	struct epcs_frm *epcs_action_frm;
+
+	/*
+	 * EPCS request action frame
+	 *
+	 *   1-byte     1-byte     1-byte    variable
+	 *--------------------------------------------
+	 * |         |           |        |          |
+	 * | Category| Protected | Dialog | PA ML IE |
+	 * |         |    EHT    | token  |          |
+	 * |         |  Action   |        |          |
+	 *--------------------------------------------
+	 */
+
+	epcs_action_frm = (struct epcs_frm *)action_frm;
+
+	epcs->cat = epcs_action_frm->protected_eht_action;
+	epcs->dialog_token = epcs_action_frm->dialog_token;
+	epcs_info("EPCS frame rcv : category:%d action:%d dialog_token:%d frmlen %d",
+		  epcs_action_frm->category,
+		  epcs_action_frm->protected_eht_action,
+		  epcs_action_frm->dialog_token, frm_len);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * wlan_mlo_parse_epcs_response_action_frame() - API to parse EPCS response
+ * action frame.
+ * @epcs: Pointer to EPCS structure
+ * @action_frm: Pointer to action frame
+ * @frm_len: frame length
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+wlan_mlo_parse_epcs_response_action_frame(struct wlan_epcs_info *epcs,
+					  struct wlan_action_frame *action_frm,
+					  uint32_t frm_len)
+{
+	struct epcs_frm *epcs_action_frm;
+
+	/*
+	 * EPCS response action frame
+	 *
+	 *   1-byte     1-byte     1-byte   1-byte   variable
+	 *----------------------------------------------------
+	 * |         |           |        |        |         |
+	 * | Category| Protected | Dialog | Status | PA   IE |
+	 * |         |    EHT    | token  |  code  |         |
+	 * |         |  Action   |        |        |         |
+	 *----------------------------------------------------
+	 */
+
+	epcs_action_frm = (struct epcs_frm *)action_frm;
+
+	epcs->cat = epcs_action_frm->protected_eht_action;
+	epcs->dialog_token = epcs_action_frm->dialog_token;
+	epcs->status = epcs_action_frm->resp.status_code;
+	epcs_info("EPCS frame rcv : category:%d action:%d dialog_token:%d status %d frmlen %d",
+		  epcs_action_frm->category,
+		  epcs_action_frm->protected_eht_action,
+		  epcs_action_frm->dialog_token,
+		  epcs_action_frm->resp.status_code, frm_len);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * wlan_mlo_parse_epcs_teardown_action_frame() - API to parse EPCS teardown
+ * action frame.
+ * @epcs: Pointer to EPCS structure
+ * @action_frm: Pointer to action frame
+ * @frm_len: frame length
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+wlan_mlo_parse_epcs_teardown_action_frame(struct wlan_epcs_info *epcs,
+					  struct wlan_action_frame *action_frm,
+					  uint32_t frm_len)
+{
+	struct epcs_frm *epcs_action_frm;
+
+	/*
+	 * EPCS teardown action frame
+	 *
+	 *   1-byte     1-byte
+	 *------------------------
+	 * |         |           |
+	 * | Category| Protected |
+	 * |         |    EHT    |
+	 * |         |  Action   |
+	 *------------------------
+	 */
+
+	epcs_action_frm = (struct epcs_frm *)action_frm;
+
+	epcs->cat = epcs_action_frm->protected_eht_action;
+	epcs_info("EPCS frame rcv : category:%d action:%d frmlen %d",
+		  epcs_action_frm->category,
+		  epcs_action_frm->protected_eht_action, frm_len);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+wlan_mlo_parse_epcs_action_frame(struct wlan_epcs_info *epcs,
+				 struct wlan_action_frame *action_frm,
+				 uint32_t frm_len)
+{
+	QDF_STATUS ret_val = QDF_STATUS_SUCCESS;
+
+	switch (action_frm->action) {
+	case WLAN_EPCS_CATEGORY_REQUEST:
+		return wlan_mlo_parse_epcs_request_action_frame(
+				epcs, action_frm, frm_len);
+	case WLAN_EPCS_CATEGORY_RESPONSE:
+		return wlan_mlo_parse_epcs_response_action_frame(
+				epcs, action_frm, frm_len);
+	case WLAN_EPCS_CATEGORY_TEARDOWN:
+		return wlan_mlo_parse_epcs_teardown_action_frame(
+				epcs, action_frm, frm_len);
+	default:
+		ret_val = QDF_STATUS_E_INVAL;
+			epcs_err("Invalid action :%d", action_frm->action);
+	}
+
+	return ret_val;
+}
+
+static uint8_t *
+wlan_mlo_add_epcs_request_action_frame(uint8_t *frm,
+				       struct wlan_action_frame_args *args,
+				       uint8_t *buf)
+{
+	*frm++ = args->category;
+	*frm++ = args->action;
+	/* Dialog token*/
+	*frm++ = args->arg1;
+
+	epcs_info("EPCS frame: category:%d action:%d dialog_token:%d",
+		  args->category, args->action, args->arg1);
+
+	/* Add priority access ml ie in caller for AP mode */
+	return frm;
+}
+
+static uint8_t *
+wlan_mlo_add_epcs_response_action_frame(uint8_t *frm,
+					struct wlan_action_frame_args *args,
+					uint8_t *buf)
+{
+	*frm++ = args->category;
+	*frm++ = args->action;
+	/* Dialog token*/
+	*frm++ = args->arg1;
+	/* Status code */
+	*frm++ = args->arg2;
+
+	epcs_info("EPCS response frame: category:%d action:%d dialog_token:%d status_code:%d",
+		  args->category, args->action, args->arg1, args->arg2);
+
+	/* Add priority access ml ie for AP mode */
+	return frm;
+}
+
+uint8_t *
+wlan_mlo_add_epcs_action_frame(uint8_t *frm,
+			       struct wlan_action_frame_args *args,
+			       uint8_t *buf)
+{
+	qdf_err("EPCS frame: category:%d action:%d ",
+		args->category, args->action);
+
+	switch (args->action) {
+	case WLAN_EPCS_CATEGORY_REQUEST:
+		return wlan_mlo_add_epcs_request_action_frame(frm, args,
+							      buf);
+	case WLAN_EPCS_CATEGORY_RESPONSE:
+		return wlan_mlo_add_epcs_response_action_frame(frm, args,
+							      buf);
+	case WLAN_EPCS_CATEGORY_TEARDOWN:
+		*frm++ = args->category;
+		*frm++ = args->action;
+		return frm;
+	default:
+		epcs_err("Invalid category:%d", args->category);
+	}
+
+	return frm;
+}