Explorar el Código

qcacld-3.0: Drop P2P Negotiation req on non-Social 2.4 GHz channel

P2P GO negotiation request is supposed to come only on
DUT listen channel.
But there may be chance of leakage on 2.4 GHz because
the ADC sampling rate is 60 MHz, DUT would receive the
attenuated (Rx BBF filter) signal 60 MHz away. So, the
req may get received in non-social channel.

fix is, add new logic to drop the P2P Go Negotiation
request if it is received on non-social channel.

Change-Id: I12ddddd47cd9b494f618b1ba9b383118221ff9d2
CRs-Fixed: 3808813
Deeksha Gupta hace 1 año
padre
commit
70cb8d3540

+ 32 - 2
components/p2p/core/src/wlan_p2p_off_chan_tx.c

@@ -809,8 +809,8 @@ static void p2p_init_frame_info(struct p2p_frame_info *frame_info)
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
-static QDF_STATUS p2p_get_frame_info(uint8_t *data_buf, uint32_t length,
-	struct p2p_frame_info *frame_info)
+QDF_STATUS p2p_get_frame_info(uint8_t *data_buf, uint32_t length,
+			      struct p2p_frame_info *frame_info)
 {
 	uint8_t type;
 	uint8_t sub_type;
@@ -897,6 +897,22 @@ static QDF_STATUS p2p_get_frame_info(uint8_t *data_buf, uint32_t length,
 	return QDF_STATUS_SUCCESS;
 }
 
+bool p2p_is_action_frame_of_p2p_type(uint8_t *data_buf, uint32_t length)
+{
+	struct p2p_frame_info frame_info = {0};
+	QDF_STATUS status;
+
+	status = p2p_get_frame_info(data_buf, length, &frame_info);
+	if (QDF_IS_STATUS_ERROR(status))
+		return false;
+
+	if (frame_info.public_action_type != P2P_PUBLIC_ACTION_NOT_SUPPORT ||
+	    frame_info.action_type != P2P_ACTION_NOT_SUPPORT)
+		return true;
+
+	return false;
+}
+
 #ifdef WLAN_FEATURE_P2P_DEBUG
 /**
  * p2p_tx_update_connection_status() - Update P2P connection status
@@ -3420,6 +3436,10 @@ QDF_STATUS p2p_process_mgmt_tx_ack_cnf(
 	return QDF_STATUS_SUCCESS;
 }
 
+#define P2P_IS_SOCIAL_CHANNEL(center_freq)	\
+	(((center_freq) == 2412) || ((center_freq) == 2437) || \
+		((center_freq) == 2462))
+
 QDF_STATUS p2p_process_rx_mgmt(
 	struct p2p_rx_mgmt_event *rx_mgmt_event)
 {
@@ -3467,6 +3487,16 @@ QDF_STATUS p2p_process_rx_mgmt(
 			p2p_debug("p2p frame, extend roc accordingly");
 			p2p_extend_roc_timer(p2p_soc_obj, &frame_info);
 		}
+
+		if (frame_info.public_action_type ==
+		    P2P_PUBLIC_ACTION_NEG_REQ &&
+		    wlan_reg_is_24ghz_ch_freq(rx_mgmt->rx_freq) &&
+		    !P2P_IS_SOCIAL_CHANNEL(rx_mgmt->rx_freq)) {
+			p2p_debug("Drop P2P Negotiation Req due to non-Social channel: %d",
+				  rx_mgmt->rx_freq);
+			qdf_mem_free(rx_mgmt);
+			return QDF_STATUS_SUCCESS;
+		}
 	}
 
 	if (rx_mgmt->frm_type == MGMT_ACTION_CATEGORY_VENDOR_SPECIFIC)

+ 23 - 1
components/p2p/core/src/wlan_p2p_off_chan_tx.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022, 2024 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
@@ -197,6 +197,28 @@ struct tx_action_context {
 	qdf_nbuf_t nbuf;
 };
 
+/**
+ * p2p_get_frame_info() - get frame information from packet
+ * @data_buf:          data buffer address
+ * @length:            buffer length
+ * @frame_info:        frame information
+ *
+ * This function gets frame information from packet.
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success
+ */
+QDF_STATUS p2p_get_frame_info(uint8_t *data_buf, uint32_t length,
+			      struct p2p_frame_info *frame_info);
+
+/**
+ * p2p_is_action_frame_of_p2p_type() - Given action frame is p2p type or not
+ * @data_buf: data buffer address
+ * @length: buffer length
+ *
+ * Return: bool
+ */
+bool p2p_is_action_frame_of_p2p_type(uint8_t *data_buf, uint32_t length);
+
 /**
  * p2p_rand_mac_tx_done() - process random mac mgmt tx done
  * @soc: soc

+ 11 - 1
components/p2p/dispatcher/inc/wlan_p2p_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 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
@@ -63,6 +63,16 @@ QDF_STATUS wlan_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev,
  */
 QDF_STATUS wlan_p2p_status_connect(struct wlan_objmgr_vdev *vdev);
 
+/**
+ * wlan_p2p_is_action_frame_of_p2p_type() - Given action frame is p2p type or
+ * not
+ * @data_buf: data buffer address
+ * @length: buffer length
+ *
+ * Return: bool
+ */
+bool wlan_p2p_is_action_frame_of_p2p_type(uint8_t *data_buf, uint32_t length);
+
 /**
  * wlan_p2p_abort_scan() - Abort on going scan on p2p interfaces
  * @pdev: pdev object

+ 9 - 1
components/p2p/dispatcher/src/wlan_p2p_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022, 2024 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
@@ -28,6 +28,7 @@
 #include "../../core/src/wlan_p2p_roc.h"
 #include <cds_utils.h>
 #include "wlan_scan_api.h"
+#include "../../core/src/wlan_p2p_off_chan_tx.h"
 
 bool wlan_p2p_check_oui_and_force_1x1(uint8_t *assoc_ie, uint32_t assoc_ie_len)
 {
@@ -76,6 +77,13 @@ QDF_STATUS wlan_p2p_status_connect(struct wlan_objmgr_vdev *vdev)
 	return p2p_status_connect(vdev);
 }
 
+bool
+wlan_p2p_is_action_frame_of_p2p_type(uint8_t *data_buf,
+				     uint32_t length)
+{
+	return p2p_is_action_frame_of_p2p_type(data_buf, length);
+}
+
 #ifdef WLAN_FEATURE_P2P_P2P_STA
 QDF_STATUS
 wlan_p2p_check_and_force_scc_go_plus_go(struct wlan_objmgr_psoc *psoc,

+ 13 - 9
core/mac/src/pe/lim/lim_process_action_frame.c

@@ -58,6 +58,7 @@
 #include "wlan_epcs_api.h"
 #include <wlan_mlo_mgr_sta.h>
 #include "wlan_mlo_mgr_public_structs.h"
+#include "wlan_p2p_api.h"
 
 #define SA_QUERY_REQ_MIN_LEN \
 (DOT11F_FF_CATEGORY_LEN + DOT11F_FF_ACTION_LEN + DOT11F_FF_TRANSACTIONID_LEN)
@@ -2294,11 +2295,9 @@ void lim_process_action_frame_no_session(struct mac_context *mac, uint8_t *pBd)
 	tpSirMacMgmtHdr mac_hdr = WMA_GET_RX_MAC_HEADER(pBd);
 	uint32_t frame_len = WMA_GET_RX_PAYLOAD_LEN(pBd);
 	uint8_t *pBody = WMA_GET_RX_MPDU_DATA(pBd);
-	uint8_t dpp_oui[] = { 0x50, 0x6F, 0x9A, 0x1A };
 	tpSirMacActionFrameHdr action_hdr = (tpSirMacActionFrameHdr) pBody;
 	tpSirMacVendorSpecificPublicActionFrameHdr vendor_specific;
 
-
 	pe_debug("Received an action frame category: %d action_id: %d",
 		 action_hdr->category, (action_hdr->category ==
 		 ACTION_CATEGORY_PUBLIC || action_hdr->category ==
@@ -2325,13 +2324,18 @@ void lim_process_action_frame_no_session(struct mac_context *mac, uint8_t *pBd)
 				return;
 			}
 
-			/* Check if it is a DPP public action frame */
-			if (qdf_mem_cmp(vendor_specific->Oui, dpp_oui, 4)) {
-				pe_debug("public action frame (Vendor specific) OUI: %x %x %x %x",
-					 vendor_specific->Oui[0],
-					 vendor_specific->Oui[1],
-					 vendor_specific->Oui[2],
-					 vendor_specific->Oui[3]);
+			pe_debug("public action frame (Vendor specific) OUI: %x %x %x %x",
+				 vendor_specific->Oui[0],
+				 vendor_specific->Oui[1],
+				 vendor_specific->Oui[2],
+				 vendor_specific->Oui[3]);
+
+			/* Drop P2P frames as they are handled by P2P module */
+			if (wlan_p2p_is_action_frame_of_p2p_type(
+						(uint8_t *)mac_hdr,
+						WMA_GET_RX_MPDU_LEN(pBd))) {
+				pe_debug("Drop P2P public action frame as already handled in p2p module");
+				return;
 			}
 		}