Browse Source

qcacmn: Fix TWT rx frames capture in packet capture mode

Currently the TWT rx frames are dropped in
tgt_mgmt_txrx_rx_frame_handler considering them as unspecified
packets as action category for TWT is not defined.

Define TWT action category so that the TWT frames will not be
considered as unspecified frames and dropped while processing.

Change-Id: I2d9c01e89029bcbb379a5a9c77a7d101de155d6a
CRs-Fixed: 3087275
Vulupala Shashank Reddy 3 years ago
parent
commit
f31ce2f1c1

+ 17 - 0
umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h

@@ -489,6 +489,17 @@ enum vht_actioncode {
 	VHT_ACTION_OPMODE_NOTIF,
 };
 
+/**
+ * enum twt_actioncode - twt action frames
+ * @TWT_SETUP: twt set up action frame
+ * @TWT_INFORMATION: twt information action frame
+ */
+enum twt_actioncode {
+	TWT_SETUP = 6,
+	TWT_TEARDOWN = 7,
+	TWT_INFORMATION = 11,
+};
+
 /**
  * struct action_frm_hdr - action frame header
  * @action_category: action category
@@ -621,6 +632,9 @@ struct action_frm_hdr {
  * @MGMT_ACTION_MCSC_RSP: MCSC response frame
  * @MGMT_FRAME_TYPE_ALL:         mgmt frame type for all type of frames
  * @MGMT_CTRL_FRAME: Control Frames
+ * @MGMT_ACTION_TWT_SETUP: TWT setup frame
+ * @MGMT_ACTION_TWT_TEARDOWN: TWT teardown frame
+ * @MGMT_ACTION_TWT_INFORMATION: TWT information frame
  * @MGMT_MAX_FRAME_TYPE:         max. mgmt frame types
  */
 enum mgmt_frame_type {
@@ -747,6 +761,9 @@ enum mgmt_frame_type {
 	MGMT_ACTION_MCSC_RSP,
 	MGMT_FRAME_TYPE_ALL,
 	MGMT_CTRL_FRAME,
+	MGMT_ACTION_TWT_SETUP,
+	MGMT_ACTION_TWT_TEARDOWN,
+	MGMT_ACTION_TWT_INFORMATION,
 	MGMT_MAX_FRAME_TYPE,
 };
 

+ 37 - 0
umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 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
@@ -756,6 +757,38 @@ mgmt_get_rvs_action_subtype(uint8_t action_code)
 	return frm_type;
 }
 
+/**
+ * mgmt_get_twt_action_subtype() - gets twt action subtype
+ * @action_code: action code
+ *
+ * This function returns the subtype for twt action
+ * category.
+ *
+ * Return: mgmt frame type
+ */
+static enum mgmt_frame_type
+mgmt_get_twt_action_subtype(uint8_t action_code)
+{
+	enum mgmt_frame_type frm_type;
+
+	switch (action_code) {
+	case TWT_SETUP:
+		frm_type = MGMT_ACTION_TWT_SETUP;
+		break;
+	case TWT_TEARDOWN:
+		frm_type = MGMT_ACTION_TWT_TEARDOWN;
+		break;
+	case TWT_INFORMATION:
+		frm_type = MGMT_ACTION_TWT_INFORMATION;
+		break;
+	default:
+		frm_type = MGMT_FRM_UNSPECIFIED;
+		break;
+	}
+
+	return frm_type;
+}
+
 /**
  * mgmt_txrx_get_action_frm_subtype() - gets action frm subtype
  * @mpdu_data_ptr: pointer to mpdu data
@@ -842,6 +875,10 @@ mgmt_txrx_get_action_frm_subtype(uint8_t *mpdu_data_ptr)
 		frm_type =
 			mgmt_get_rvs_action_subtype(action_hdr->action_code);
 		break;
+	case ACTION_CATEGORY_USIG:
+		frm_type =
+			mgmt_get_twt_action_subtype(action_hdr->action_code);
+		break;
 	default:
 		frm_type = MGMT_FRM_UNSPECIFIED;
 		break;