qcacld-3.0: sta interface supports to tx p2p action frames

Required sta interface to support to tx p2p action frames, this is
part of customer requirement.

Change-Id: I1ebebce4d70dcba34427bb2276cd3e1cc23c2bd8
CRs-Fixed: 2388414
diff --git a/Kbuild b/Kbuild
index 20acd16..6dbce1f 100644
--- a/Kbuild
+++ b/Kbuild
@@ -2212,6 +2212,13 @@
 cppflags-y += -DRX_THREAD_PRIORITY
 endif
 
+ifeq ($(CONFIG_SUPPORT_P2P_BY_ONE_INTF_WLAN), y)
+#sta support to tx P2P action frames
+cppflags-y += -DSUPPORT_P2P_BY_ONE_INTF_WLAN
+else
+#Open P2P device interface only for non-Mobile router use cases
+cppflags-$(CONFIG_WLAN_OPEN_P2P_INTERFACE) += -DWLAN_OPEN_P2P_INTERFACE
+endif
 
 #Enable wbuff
 cppflags-$(CONFIG_WLAN_WBUFF) += -DWLAN_FEATURE_WBUFF
@@ -2251,9 +2258,6 @@
 #Disable STA-AP Mode DFS support
 cppflags-$(CONFIG_FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE) += -DFEATURE_WLAN_STA_AP_MODE_DFS_DISABLE
 
-#Open P2P device interface only for non-Mobile router use cases
-cppflags-$(CONFIG_WLAN_OPEN_P2P_INTERFACE) += -DWLAN_OPEN_P2P_INTERFACE
-
 #Enable 2.4 GHz social channels in 5 GHz only mode for p2p usage
 cppflags-$(CONFIG_WLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY) += -DWLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY
 
diff --git a/components/p2p/core/src/wlan_p2p_off_chan_tx.c b/components/p2p/core/src/wlan_p2p_off_chan_tx.c
index 1495c31..442e78b 100644
--- a/components/p2p/core/src/wlan_p2p_off_chan_tx.c
+++ b/components/p2p/core/src/wlan_p2p_off_chan_tx.c
@@ -95,6 +95,7 @@
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
+#ifdef SUPPORT_P2P_BY_ONE_INTF_WLAN
 static QDF_STATUS p2p_vdev_check_valid(struct tx_action_context *tx_ctx)
 {
 	enum QDF_OPMODE mode;
@@ -105,8 +106,41 @@
 
 	p2p_soc_obj = tx_ctx->p2p_soc_obj;
 	psoc = p2p_soc_obj->soc;
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc,
-			tx_ctx->vdev_id, WLAN_P2P_ID);
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(
+			psoc, tx_ctx->vdev_id, WLAN_P2P_ID);
+	if (!vdev) {
+		p2p_err("null vdev object");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	mode = wlan_vdev_mlme_get_opmode(vdev);
+	p2p_debug("vdev mode:%d", mode);
+
+	/* drop probe response for go, sap */
+	if ((mode == QDF_SAP_MODE ||
+	     mode == QDF_P2P_GO_MODE) &&
+	    tx_ctx->frame_info.sub_type == P2P_MGMT_PROBE_RSP) {
+		p2p_debug("drop probe response, mode:%d", mode);
+		status = QDF_STATUS_E_FAILURE;
+	}
+
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_P2P_ID);
+
+	return status;
+}
+#else
+static QDF_STATUS p2p_vdev_check_valid(struct tx_action_context *tx_ctx)
+{
+	enum QDF_OPMODE mode;
+	struct wlan_objmgr_vdev *vdev;
+	struct wlan_objmgr_psoc *psoc;
+	struct p2p_soc_priv_obj *p2p_soc_obj;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
+
+	p2p_soc_obj = tx_ctx->p2p_soc_obj;
+	psoc = p2p_soc_obj->soc;
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(
+			psoc, tx_ctx->vdev_id, WLAN_P2P_ID);
 	if (!vdev) {
 		p2p_err("null vdev object");
 		return QDF_STATUS_E_INVAL;
@@ -117,9 +151,9 @@
 
 	/* drop probe response for sta, go, sap */
 	if ((mode == QDF_STA_MODE ||
-		mode == QDF_SAP_MODE ||
-		mode == QDF_P2P_GO_MODE) &&
-		tx_ctx->frame_info.sub_type == P2P_MGMT_PROBE_RSP) {
+	     mode == QDF_SAP_MODE ||
+	     mode == QDF_P2P_GO_MODE) &&
+	    tx_ctx->frame_info.sub_type == P2P_MGMT_PROBE_RSP) {
 		p2p_debug("drop probe response, mode:%d", mode);
 		status = QDF_STATUS_E_FAILURE;
 	}
@@ -128,6 +162,7 @@
 
 	return status;
 }
+#endif /* SUPPORT_P2P_BY_ONE_INTF_WLAN */
 
 /**
  * p2p_get_p2pie_ptr() - get the pointer to p2p ie