Pārlūkot izejas kodu

qcacmn: iot_sim frame drop support for disassoc and deauth

Add iot_sim frame drop support disassoc and deauth frames.

Change-Id: I26fb606d49a05754f1175c36b8fb14d1003c75f0
CRs-Fixed: 2765421
Jayachandran Sreekumaran 4 gadi atpakaļ
vecāks
revīzija
107f53c315

+ 32 - 0
iot_sim/core/iot_sim_common.c

@@ -518,6 +518,38 @@ iot_sim_get_index_for_action_frm(uint8_t *frm, uint8_t *cat_type,
 			return QDF_STATUS_E_FAULT;
 		}
 		break;
+	case IEEE80211_ACTION_CAT_RADIO:
+		*cat_type = CAT_RADIO;
+		*act_type = action;
+		break;
+	case IEEE80211_ACTION_CAT_FAST_BSS_TRNST:
+		*cat_type = CAT_FAST_BSS_TRNST;
+		*act_type = action;
+		break;
+	case IEEE80211_ACTION_CAT_SPECTRUM:
+		*cat_type = CAT_SPECTRUM;
+		*act_type = action;
+		break;
+	case IEEE80211_ACTION_CAT_QOS:
+		*cat_type = CAT_QOS;
+		*act_type = action;
+		break;
+	case IEEE80211_ACTION_CAT_DLS:
+		*cat_type = CAT_DLS;
+		*act_type = action;
+		break;
+	case IEEE80211_ACTION_CAT_HT:
+		*cat_type = CAT_HT;
+		*act_type = action;
+		break;
+	case IEEE80211_ACTION_CAT_WNM:
+		*cat_type = CAT_WNM;
+		*act_type = action;
+		break;
+	case IEEE80211_ACTION_CAT_VHT:
+		*cat_type = CAT_VHT;
+		*act_type = action;
+		break;
 	default:
 		return QDF_STATUS_E_FAULT;
 	}

+ 9 - 1
iot_sim/core/iot_sim_defs_i.h

@@ -76,15 +76,23 @@
 #define N_FRAME_SUBTYPE 0xF
 #define MAX_SEQ 0x4
 #define MAX_PEER_COUNT 0x2
-#define MAX_ACTION 0x3
+#define MAX_ACTION 0x1B
 #define RX_STATUS_SIZE 0x96
 #define IOT_SIM_DEBUGFS_FILE_NUM 3
 #define FRAME_TYPE_IS_BEACON(type, subtype) ((type) == 0 && (subtype) == 8)
 #define FRAME_TYPE_IS_ACTION(type, subtype) ((type) == 0 && (subtype) == 13)
 
 enum iot_sim_action_cat_type {
+	CAT_SPECTRUM,
+	CAT_QOS,
+	CAT_DLS,
 	CAT_BA,
+	CAT_RADIO,
+	CAT_FAST_BSS_TRNST,
+	CAT_HT,
 	CAT_SA_QUERY,
+	CAT_WNM,
+	CAT_VHT,
 	IOT_SIM_MAX_CAT,
 };
 

+ 12 - 2
iot_sim/core/iot_sim_utils.c

@@ -309,6 +309,7 @@ QDF_STATUS iot_sim_frame_update(struct wlan_objmgr_pdev *pdev, qdf_nbuf_t nbuf,
 	struct iot_sim_rule_per_peer *peer_rule;
 	struct ieee80211_frame *wh = (struct ieee80211_frame *)buf;
 	struct qdf_mac_addr *mac_addr;
+	bool deauth_disassoc = false;
 
 	isc = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_IOT_SIM_COMP);
 	if (!isc) {
@@ -334,6 +335,10 @@ QDF_STATUS iot_sim_frame_update(struct wlan_objmgr_pdev *pdev, qdf_nbuf_t nbuf,
 		  subtype == IEEE80211_FC0_SUBTYPE_REASSOC_RESP))
 	/* Assoc/Reassoc response frame */
 		fixed_param_len = 6;
+	else if (type == IEEE80211_FC0_TYPE_MGT &&
+		 (subtype == IEEE80211_FC0_SUBTYPE_DEAUTH ||
+		  subtype == IEEE80211_FC0_SUBTYPE_DISASSOC))
+		deauth_disassoc = true;
 	else if (type == IEEE80211_FC0_TYPE_MGT &&
 		 subtype == IEEE80211_FC0_SUBTYPE_ACTION) {
 	/* Action frame */
@@ -400,8 +405,13 @@ QDF_STATUS iot_sim_frame_update(struct wlan_objmgr_pdev *pdev, qdf_nbuf_t nbuf,
 							     param);
 		}
 
-		if (status == QDF_STATUS_E_NOSUPPORT)
-			goto norule;
+		if (status == QDF_STATUS_E_NOSUPPORT) {
+			if (deauth_disassoc && piot_sim_rule->drop) {
+				status = QDF_STATUS_E_NULL_VALUE;
+				iot_sim_debug("iot_sim: frame to be dropped");
+			} else
+				goto norule;
+		}
 	} else {
 		status = iot_sim_apply_delay_drop_rule(piot_sim_rule,
 						       nbuf, rx_param);

+ 6 - 4
umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_main.c

@@ -183,7 +183,7 @@ QDF_STATUS iot_sim_mgmt_tx_update(struct wlan_objmgr_psoc *psoc,
 				  qdf_nbuf_t buf)
 {
 	struct wlan_lmac_if_rx_ops *rx_ops;
-	QDF_STATUS status;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
 	rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
 	if (!rx_ops) {
@@ -196,11 +196,13 @@ QDF_STATUS iot_sim_mgmt_tx_update(struct wlan_objmgr_psoc *psoc,
 								    NULL,
 								    true,
 								    NULL);
-		if (QDF_IS_STATUS_ERROR(status))
-			mgmt_txrx_err("iot_sim_cmd_handler returned failure");
+		if (status == QDF_STATUS_E_NULL_VALUE)
+			mgmt_txrx_err("iot_sim frame drop");
+		else
+			status = QDF_STATUS_SUCCESS;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 #else
 QDF_STATUS iot_sim_mgmt_tx_update(struct wlan_objmgr_psoc *psoc,