Эх сурвалжийг харах

qcacmn: Featurize P2P Listen Offload

P2P Listen offload is not a requirement for Genoa, hence featurize
P2P listen offload code to save memory foot-print for Genoa.

Change-Id: I3c32b4ee2b37421e49acee4bd20d36e7a8a3bf77
CRs-Fixed: 2304555
Rachit Kankane 6 жил өмнө
parent
commit
898f6ff055

+ 14 - 2
os_if/linux/p2p/src/wlan_cfg80211_p2p.c

@@ -168,6 +168,7 @@ fail:
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_P2P_ID);
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * wlan_p2p_lo_event_callback() - Callback for listen offload event
  * @user_data: pointer to soc object
@@ -238,6 +239,18 @@ fail:
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_P2P_ID);
 }
 
+static inline void wlan_p2p_init_lo_event(struct p2p_start_param *start_param,
+					  struct wlan_objmgr_psoc *psoc)
+{
+	start_param->lo_event_cb = wlan_p2p_lo_event_callback;
+	start_param->lo_event_cb_data = psoc;
+}
+#else
+static inline void wlan_p2p_init_lo_event(struct p2p_start_param *start_param,
+					  struct wlan_objmgr_psoc *psoc)
+{
+}
+#endif /* FEATURE_P2P_LISTEN_OFFLOAD */
 /**
  * wlan_p2p_event_callback() - Callback for P2P event
  * @user_data: pointer to soc object
@@ -321,8 +334,7 @@ QDF_STATUS wlan_p2p_start(struct wlan_objmgr_psoc *psoc)
 	start_param.event_cb_data = psoc;
 	start_param.tx_cnf_cb = wlan_p2p_action_tx_cnf_callback;
 	start_param.tx_cnf_cb_data = psoc;
-	start_param.lo_event_cb = wlan_p2p_lo_event_callback;
-	start_param.lo_event_cb_data = psoc;
+	wlan_p2p_init_lo_event(&start_param, psoc);
 
 	return ucfg_p2p_psoc_start(psoc, &start_param);
 }

+ 38 - 35
target_if/p2p/inc/target_if_p2p.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018 The Linux Foundation. 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
@@ -29,13 +29,7 @@ struct wlan_objmgr_psoc;
 struct p2p_ps_config;
 struct p2p_lo_start;
 
-/**
- * target_if_p2p_register_tx_ops() - Register P2P component TX OPS
- * @tx_ops: lmac if transmit ops
- *
- * Return: None
- */
-void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 
 /**
  * target_if_p2p_register_lo_event_handler() - Register lo event handler
@@ -50,76 +44,85 @@ QDF_STATUS target_if_p2p_register_lo_event_handler(
 	struct wlan_objmgr_psoc *psoc, void *arg);
 
 /**
- * target_if_p2p_register_noa_event_handler() - Register noa event handler
+ * target_if_p2p_unregister_lo_event_handler() - Unregister lo event handler
  * @psoc: soc object
  * @arg: additional argument
  *
- * Target interface API to register P2P noa event handler.
+ * Target interface API to unregister P2P listen offload event handler.
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
-QDF_STATUS target_if_p2p_register_noa_event_handler(
+QDF_STATUS target_if_p2p_unregister_lo_event_handler(
 	struct wlan_objmgr_psoc *psoc, void *arg);
 
 /**
- * target_if_p2p_unregister_lo_event_handler() - Unregister lo event handler
+ * target_if_p2p_lo_start() - Start listen offload
  * @psoc: soc object
- * @arg: additional argument
+ * @lo_start: lo start information
  *
- * Target interface API to unregister P2P listen offload event handler.
+ * Target interface API to start listen offload.
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
-QDF_STATUS target_if_p2p_unregister_lo_event_handler(
-	struct wlan_objmgr_psoc *psoc, void *arg);
+QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc,
+				  struct p2p_lo_start *lo_start);
 
 /**
- * target_if_p2p_unregister_noa_event_handler() - Unregister noa event handler
+ * target_if_p2p_lo_stop() - Stop listen offload
  * @psoc: soc object
- * @arg: additional argument
+ * @vdev_id: vdev id
  *
- * Target interface API to unregister P2P listen offload event handler.
+ * Target interface API to stop listen offload.
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
-QDF_STATUS target_if_p2p_unregister_noa_event_handler(
-	struct wlan_objmgr_psoc *psoc, void *arg);
+QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc,
+				 uint32_t vdev_id);
+#endif
 
 /**
- * target_if_p2p_set_ps() - Set power save
+ * target_if_p2p_register_tx_ops() - Register P2P component TX OPS
+ * @tx_ops: lmac if transmit ops
+ *
+ * Return: None
+ */
+void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
+
+/**
+ * target_if_p2p_register_noa_event_handler() - Register noa event handler
  * @psoc: soc object
  * @arg: additional argument
  *
- * Target interface API to set power save.
+ * Target interface API to register P2P noa event handler.
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
-QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc,
-	struct p2p_ps_config *ps_config);
+QDF_STATUS target_if_p2p_register_noa_event_handler(
+	struct wlan_objmgr_psoc *psoc, void *arg);
 
 /**
- * target_if_p2p_lo_start() - Start listen offload
+ * target_if_p2p_unregister_noa_event_handler() - Unregister noa event handler
  * @psoc: soc object
- * @lo_start: lo start information
+ * @arg: additional argument
  *
- * Target interface API to start listen offload.
+ * Target interface API to unregister P2P listen offload event handler.
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
-QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc,
-	struct p2p_lo_start *lo_start);
+QDF_STATUS target_if_p2p_unregister_noa_event_handler(
+	struct wlan_objmgr_psoc *psoc, void *arg);
 
 /**
- * target_if_p2p_lo_stop() - Stop listen offload
+ * target_if_p2p_set_ps() - Set power save
  * @psoc: soc object
- * @vdev_id: vdev id
+ * @arg: additional argument
  *
- * Target interface API to stop listen offload.
+ * Target interface API to set power save.
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
-QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc,
-	uint32_t vdev_id);
+QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc,
+				struct p2p_ps_config *ps_config);
 
 /**
  * target_if_p2p_set_noa() - Disable / Enable NOA

+ 98 - 86
target_if/p2p/src/target_if_p2p.c

@@ -32,6 +32,18 @@ target_if_psoc_get_p2p_rx_ops(struct wlan_objmgr_psoc *psoc)
 	return &(psoc->soc_cb.rx_ops.p2p);
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
+static inline void
+target_if_p2p_lo_register_tx_ops(struct wlan_lmac_if_p2p_tx_ops *p2p_tx_ops)
+{
+	p2p_tx_ops->lo_start = target_if_p2p_lo_start;
+	p2p_tx_ops->lo_stop = target_if_p2p_lo_stop;
+	p2p_tx_ops->reg_lo_ev_handler =
+			target_if_p2p_register_lo_event_handler;
+	p2p_tx_ops->unreg_lo_ev_handler =
+			target_if_p2p_unregister_lo_event_handler;
+}
+
 /**
  * target_p2p_lo_event_handler() - WMI callback for lo stop event
  * @scn:       pointer to scn
@@ -98,6 +110,90 @@ static int target_p2p_lo_event_handler(ol_scn_t scn, uint8_t *data,
 	return qdf_status_to_os_return(status);
 }
 
+QDF_STATUS target_if_p2p_register_lo_event_handler(
+	struct wlan_objmgr_psoc *psoc, void *arg)
+{
+	int status;
+	wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc);
+
+	target_if_debug("psoc:%pK, arg:%pK", psoc, arg);
+
+	if (!wmi_handle) {
+		target_if_err("Invalid wmi handle");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	status = wmi_unified_register_event(wmi_handle,
+					    wmi_p2p_lo_stop_event_id,
+					    target_p2p_lo_event_handler);
+
+	target_if_debug("wmi register lo event handle, status:%d", status);
+
+	return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS target_if_p2p_unregister_lo_event_handler(
+	struct wlan_objmgr_psoc *psoc, void *arg)
+{
+	int status;
+	wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc);
+
+	target_if_debug("psoc:%pK, arg:%pK", psoc, arg);
+
+	if (!wmi_handle) {
+		target_if_err("Invalid wmi handle");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	status = wmi_unified_unregister_event(wmi_handle,
+					      wmi_p2p_lo_stop_event_id);
+
+	target_if_debug("wmi unregister lo event handle, status:%d", status);
+
+	return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc,
+				  struct p2p_lo_start *lo_start)
+{
+	wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc);
+
+	if (!wmi_handle) {
+		target_if_err("Invalid wmi handle");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!lo_start) {
+		target_if_err("lo start parameters is null");
+		return QDF_STATUS_E_INVAL;
+	}
+	target_if_debug("psoc:%pK, vdev_id:%d", psoc, lo_start->vdev_id);
+
+	return wmi_unified_p2p_lo_start_cmd(wmi_handle, lo_start);
+}
+
+QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc,
+				 uint32_t vdev_id)
+{
+	wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc);
+
+	target_if_debug("psoc:%pK, vdev_id:%d", psoc, vdev_id);
+
+	if (!wmi_handle) {
+		target_if_err("Invalid wmi handle");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	return wmi_unified_p2p_lo_stop_cmd(wmi_handle,
+			(uint8_t)vdev_id);
+}
+#else
+static inline void
+target_if_p2p_lo_register_tx_ops(struct wlan_lmac_if_p2p_tx_ops *p2p_tx_ops)
+{
+}
+#endif /* FEATURE_P2P_LISTEN_OFFLOAD */
+
 /**
  * target_p2p_noa_event_handler() - WMI callback for noa event
  * @scn:       pointer to scn
@@ -164,29 +260,6 @@ static int target_p2p_noa_event_handler(ol_scn_t scn, uint8_t *data,
 	return qdf_status_to_os_return(status);
 }
 
-QDF_STATUS target_if_p2p_register_lo_event_handler(
-	struct wlan_objmgr_psoc *psoc, void *arg)
-{
-	int status;
-	wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc);
-
-	target_if_debug("psoc:%pK, arg:%pK", psoc, arg);
-
-	if (!wmi_handle) {
-		target_if_err("Invalid wmi handle");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	status = wmi_unified_register_event(wmi_handle,
-			wmi_p2p_lo_stop_event_id,
-			target_p2p_lo_event_handler);
-
-	target_if_debug("wmi register lo event handle, status:%d",
-		status);
-
-	return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE;
-}
-
 QDF_STATUS target_if_p2p_register_noa_event_handler(
 	struct wlan_objmgr_psoc *psoc, void *arg)
 {
@@ -210,28 +283,6 @@ QDF_STATUS target_if_p2p_register_noa_event_handler(
 	return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE;
 }
 
-QDF_STATUS target_if_p2p_unregister_lo_event_handler(
-	struct wlan_objmgr_psoc *psoc, void *arg)
-{
-	int status;
-	wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc);
-
-	target_if_debug("psoc:%pK, arg:%pK", psoc, arg);
-
-	if (!wmi_handle) {
-		target_if_err("Invalid wmi handle");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	status = wmi_unified_unregister_event(wmi_handle,
-			wmi_p2p_lo_stop_event_id);
-
-	target_if_debug("wmi unregister lo event handle, status:%d",
-		status);
-
-	return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE;
-}
-
 QDF_STATUS target_if_p2p_unregister_noa_event_handler(
 	struct wlan_objmgr_psoc *psoc, void *arg)
 {
@@ -297,41 +348,6 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc,
 	return status;
 }
 
-QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc,
-	struct p2p_lo_start *lo_start)
-{
-	wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc);
-
-	if (!wmi_handle) {
-		target_if_err("Invalid wmi handle");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	if (!lo_start) {
-		target_if_err("lo start parameters is null");
-		return QDF_STATUS_E_INVAL;
-	}
-	target_if_debug("psoc:%pK, vdev_id:%d", psoc, lo_start->vdev_id);
-
-	return wmi_unified_p2p_lo_start_cmd(wmi_handle, lo_start);
-}
-
-QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc,
-	uint32_t vdev_id)
-{
-	wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc);
-
-	target_if_debug("psoc:%pK, vdev_id:%d", psoc, vdev_id);
-
-	if (!wmi_handle) {
-		target_if_err("Invalid wmi handle");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	return wmi_unified_p2p_lo_stop_cmd(wmi_handle,
-			(uint8_t)vdev_id);
-}
-
 QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc,
 	uint32_t vdev_id, bool disable_noa)
 {
@@ -363,15 +379,11 @@ void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 
 	p2p_tx_ops = &tx_ops->p2p;
 	p2p_tx_ops->set_ps = target_if_p2p_set_ps;
-	p2p_tx_ops->lo_start = target_if_p2p_lo_start;
-	p2p_tx_ops->lo_stop = target_if_p2p_lo_stop;
 	p2p_tx_ops->set_noa = target_if_p2p_set_noa;
-	p2p_tx_ops->reg_lo_ev_handler =
-			target_if_p2p_register_lo_event_handler;
 	p2p_tx_ops->reg_noa_ev_handler =
 			target_if_p2p_register_noa_event_handler;
-	p2p_tx_ops->unreg_lo_ev_handler =
-			target_if_p2p_unregister_lo_event_handler;
 	p2p_tx_ops->unreg_noa_ev_handler =
 			target_if_p2p_unregister_noa_event_handler;
+	/* register P2P listen offload callbacks */
+	target_if_p2p_lo_register_tx_ops(p2p_tx_ops);
 }

+ 8 - 4
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -213,18 +213,20 @@ struct p2p_lo_start;
 struct wlan_lmac_if_p2p_tx_ops {
 	QDF_STATUS (*set_ps)(struct wlan_objmgr_psoc *psoc,
 		struct p2p_ps_config *ps_config);
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 	QDF_STATUS (*lo_start)(struct wlan_objmgr_psoc *psoc,
 		struct p2p_lo_start *lo_start);
 	QDF_STATUS (*lo_stop)(struct wlan_objmgr_psoc *psoc,
 		uint32_t vdev_id);
-	QDF_STATUS (*set_noa)(struct wlan_objmgr_psoc *psoc,
-		uint32_t vdev_id, bool disable_noa);
 	QDF_STATUS (*reg_lo_ev_handler)(struct wlan_objmgr_psoc *psoc,
 			void *arg);
-	QDF_STATUS (*reg_noa_ev_handler)(struct wlan_objmgr_psoc *psoc,
-			void *arg);
 	QDF_STATUS (*unreg_lo_ev_handler)(struct wlan_objmgr_psoc *psoc,
 			void *arg);
+#endif
+	QDF_STATUS (*set_noa)(struct wlan_objmgr_psoc *psoc,
+			      uint32_t vdev_id, bool disable_noa);
+	QDF_STATUS (*reg_noa_ev_handler)(struct wlan_objmgr_psoc *psoc,
+					 void *arg);
 	QDF_STATUS (*unreg_noa_ev_handler)(struct wlan_objmgr_psoc *psoc,
 			void *arg);
 };
@@ -828,8 +830,10 @@ struct p2p_lo_event;
  * @noa_ev_handler:   function pointer to give noa event
  */
 struct wlan_lmac_if_p2p_rx_ops {
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 	QDF_STATUS (*lo_ev_handler)(struct wlan_objmgr_psoc *psoc,
 		struct p2p_lo_event *event_info);
+#endif
 	QDF_STATUS (*noa_ev_handler)(struct wlan_objmgr_psoc *psoc,
 		struct p2p_noa_info *event_info);
 };

+ 8 - 0
umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c

@@ -292,6 +292,7 @@ static void wlan_lmac_if_umac_reg_rx_ops_register(
 }
 
 #ifdef CONVERGED_P2P_ENABLE
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 static void wlan_lmac_if_umac_rx_ops_register_p2p(
 				struct wlan_lmac_if_rx_ops *rx_ops)
 {
@@ -299,6 +300,13 @@ static void wlan_lmac_if_umac_rx_ops_register_p2p(
 	rx_ops->p2p.noa_ev_handler = tgt_p2p_noa_event_cb;
 }
 #else
+static void wlan_lmac_if_umac_rx_ops_register_p2p(
+				struct wlan_lmac_if_rx_ops *rx_ops)
+{
+	rx_ops->p2p.noa_ev_handler = tgt_p2p_noa_event_cb;
+}
+#endif
+#else
 static void wlan_lmac_if_umac_rx_ops_register_p2p(
 				struct wlan_lmac_if_rx_ops *rx_ops)
 {

+ 17 - 2
umac/p2p/core/src/wlan_p2p_main.c

@@ -789,6 +789,20 @@ QDF_STATUS p2p_psoc_object_close(struct wlan_objmgr_psoc *soc)
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
+static inline void p2p_init_lo_event(struct p2p_start_param *start_param,
+				     struct p2p_start_param *req)
+{
+	start_param->lo_event_cb = req->lo_event_cb;
+	start_param->lo_event_cb_data = req->lo_event_cb_data;
+}
+#else
+static inline void p2p_init_lo_event(struct p2p_start_param *start_param,
+				     struct p2p_start_param *req)
+{
+}
+#endif
+
 QDF_STATUS p2p_psoc_start(struct wlan_objmgr_psoc *soc,
 	struct p2p_start_param *req)
 {
@@ -818,8 +832,7 @@ QDF_STATUS p2p_psoc_start(struct wlan_objmgr_psoc *soc,
 	start_param->event_cb_data = req->event_cb_data;
 	start_param->tx_cnf_cb = req->tx_cnf_cb;
 	start_param->tx_cnf_cb_data = req->tx_cnf_cb_data;
-	start_param->lo_event_cb = req->lo_event_cb;
-	start_param->lo_event_cb_data = req->lo_event_cb_data;
+	p2p_init_lo_event(start_param, req);
 	p2p_soc_obj->start_param = start_param;
 
 	wlan_p2p_init_connection_status(p2p_soc_obj);
@@ -995,6 +1008,7 @@ QDF_STATUS p2p_process_evt(struct scheduler_msg *msg)
 	return status;
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 QDF_STATUS p2p_process_lo_stop(
 	struct p2p_lo_stop_event *lo_stop_event)
 {
@@ -1034,6 +1048,7 @@ QDF_STATUS p2p_process_lo_stop(
 
 	return QDF_STATUS_SUCCESS;
 }
+#endif
 
 QDF_STATUS p2p_process_noa(struct p2p_noa_event *noa_event)
 {

+ 8 - 1
umac/p2p/core/src/wlan_p2p_main.h

@@ -354,6 +354,7 @@ QDF_STATUS p2p_process_cmd(struct scheduler_msg *msg);
  */
 QDF_STATUS p2p_process_evt(struct scheduler_msg *msg);
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * p2p_process_lo_stop() - Process lo stop event
  * @lo_stop_event: listen offload stop event information
@@ -365,7 +366,13 @@ QDF_STATUS p2p_process_evt(struct scheduler_msg *msg);
  */
 QDF_STATUS p2p_process_lo_stop(
 	struct p2p_lo_stop_event *lo_stop_event);
-
+#else
+static inline QDF_STATUS p2p_process_lo_stop(
+	struct p2p_lo_stop_event *lo_stop_event)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 /**
  * p2p_process_noa() - Process noa event
  * @noa_event: noa event information

+ 34 - 19
umac/p2p/dispatcher/inc/wlan_p2p_tgt_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018 The Linux Foundation. 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
@@ -34,6 +34,20 @@ struct p2p_lo_event;
 struct mgmt_rx_event_params;
 enum mgmt_frame_type;
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
+
+/**
+ * tgt_p2p_lo_event_cb() - Listen offload stop request
+ * @psoc: soc object
+ * @event_info: lo stop event buffer
+ *
+ * This function gets called from target interface.
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success
+ */
+QDF_STATUS tgt_p2p_lo_event_cb(struct wlan_objmgr_psoc *psoc,
+			       struct p2p_lo_event *event_info);
+
 /**
  * tgt_p2p_register_lo_ev_handler() - register lo event
  * @psoc: soc object
@@ -46,25 +60,38 @@ QDF_STATUS tgt_p2p_register_lo_ev_handler(
 	struct wlan_objmgr_psoc *psoc);
 
 /**
- * tgt_p2p_register_noa_ev_handler() - register noa event
+ * tgt_p2p_unregister_lo_ev_handler() - unregister lo event
  * @psoc: soc object
  *
- * p2p tgt api to register noa event handler.
+ * p2p tgt api to unregister listen offload event handler.
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
-QDF_STATUS tgt_p2p_register_noa_ev_handler(
+QDF_STATUS tgt_p2p_unregister_lo_ev_handler(
 	struct wlan_objmgr_psoc *psoc);
+#else
+static inline QDF_STATUS tgt_p2p_register_lo_ev_handler(
+	struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS tgt_p2p_unregister_lo_ev_handler(
+	struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 
 /**
- * tgt_p2p_unregister_lo_ev_handler() - unregister lo event
+ * tgt_p2p_register_noa_ev_handler() - register noa event
  * @psoc: soc object
  *
- * p2p tgt api to unregister listen offload event handler.
+ * p2p tgt api to register noa event handler.
  *
  * Return: QDF_STATUS_SUCCESS - in case of success
  */
-QDF_STATUS tgt_p2p_unregister_lo_ev_handler(
+QDF_STATUS tgt_p2p_register_noa_ev_handler(
 	struct wlan_objmgr_psoc *psoc);
 
 /**
@@ -151,16 +178,4 @@ QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc,
 QDF_STATUS tgt_p2p_noa_event_cb(struct wlan_objmgr_psoc *psoc,
 		struct p2p_noa_info *event_info);
 
-/**
- * tgt_p2p_lo_event_cb() - Listen offload stop request
- * @psoc: soc object
- * @event_info: lo stop event buffer
- *
- * This function gets called from target interface.
- *
- * Return: QDF_STATUS_SUCCESS - in case of success
- */
-QDF_STATUS tgt_p2p_lo_event_cb(struct wlan_objmgr_psoc *psoc,
-	struct p2p_lo_event *event_info);
-
 #endif /* _WLAN_P2P_TGT_API_H_ */

+ 4 - 0
umac/p2p/dispatcher/inc/wlan_p2p_ucfg_api.h

@@ -110,8 +110,10 @@ struct p2p_start_param {
 	void *event_cb_data;
 	p2p_action_tx_cnf_callback tx_cnf_cb;
 	void *tx_cnf_cb_data;
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 	p2p_lo_event_callback lo_event_cb;
 	void *lo_event_cb_data;
+#endif
 };
 
 /**
@@ -277,6 +279,7 @@ QDF_STATUS ucfg_p2p_mgmt_tx_cancel(struct wlan_objmgr_psoc *soc,
 QDF_STATUS ucfg_p2p_set_ps(struct wlan_objmgr_psoc *soc,
 	struct p2p_ps_config *ps_config);
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * ucfg_p2p_lo_start() - Listen offload start request
  * @soc: soc context
@@ -301,6 +304,7 @@ QDF_STATUS ucfg_p2p_lo_start(struct wlan_objmgr_psoc *soc,
  */
 QDF_STATUS ucfg_p2p_lo_stop(struct wlan_objmgr_psoc *soc,
 	uint32_t vdev_id);
+#endif
 
 /**
  * p2p_peer_authorized() - Process peer authorized event

+ 57 - 55
umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c

@@ -43,6 +43,7 @@ wlan_psoc_get_p2p_tx_ops(struct wlan_objmgr_psoc *psoc)
 	return &(psoc->soc_cb.tx_ops.p2p);
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 QDF_STATUS tgt_p2p_register_lo_ev_handler(
 	struct wlan_objmgr_psoc *psoc)
 {
@@ -58,31 +59,79 @@ QDF_STATUS tgt_p2p_register_lo_ev_handler(
 	return status;
 }
 
-QDF_STATUS tgt_p2p_register_noa_ev_handler(
+QDF_STATUS tgt_p2p_unregister_lo_ev_handler(
 	struct wlan_objmgr_psoc *psoc)
 {
 	struct wlan_lmac_if_p2p_tx_ops *p2p_ops;
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 
 	p2p_ops = wlan_psoc_get_p2p_tx_ops(psoc);
-	if (p2p_ops && p2p_ops->reg_noa_ev_handler) {
-		status = p2p_ops->reg_noa_ev_handler(psoc, NULL);
-		p2p_debug("register noa event, status:%d", status);
+	if (p2p_ops && p2p_ops->unreg_lo_ev_handler) {
+		status = p2p_ops->unreg_lo_ev_handler(psoc, NULL);
+		p2p_debug("unregister lo event, status:%d", status);
 	}
 
 	return status;
 }
 
-QDF_STATUS tgt_p2p_unregister_lo_ev_handler(
+QDF_STATUS tgt_p2p_lo_event_cb(struct wlan_objmgr_psoc *psoc,
+			       struct p2p_lo_event *event_info)
+{
+	struct p2p_lo_stop_event *lo_stop_event;
+	struct scheduler_msg msg = {0};
+	struct p2p_soc_priv_obj *p2p_soc_obj;
+
+	p2p_debug("soc:%pK, event_info:%pK", psoc, event_info);
+
+	if (!psoc) {
+		p2p_err("psoc context passed is NULL");
+		if (event_info)
+			qdf_mem_free(event_info);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
+						WLAN_UMAC_COMP_P2P);
+	if (!p2p_soc_obj) {
+		p2p_err("p2p soc object is NULL");
+		if (event_info)
+			qdf_mem_free(event_info);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!event_info) {
+		p2p_err("invalid lo stop event information");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	lo_stop_event = qdf_mem_malloc(sizeof(*lo_stop_event));
+	if (!lo_stop_event) {
+		p2p_err("Failed to allocate p2p lo stop event");
+		qdf_mem_free(event_info);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	lo_stop_event->p2p_soc_obj = p2p_soc_obj;
+	lo_stop_event->lo_event = event_info;
+	msg.type = P2P_EVENT_LO_STOPPED;
+	msg.bodyptr = lo_stop_event;
+	msg.callback = p2p_process_evt;
+	scheduler_post_msg(QDF_MODULE_ID_TARGET_IF, &msg);
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* FEATURE_P2P_LISTEN_OFFLOAD */
+
+QDF_STATUS tgt_p2p_register_noa_ev_handler(
 	struct wlan_objmgr_psoc *psoc)
 {
 	struct wlan_lmac_if_p2p_tx_ops *p2p_ops;
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 
 	p2p_ops = wlan_psoc_get_p2p_tx_ops(psoc);
-	if (p2p_ops && p2p_ops->unreg_lo_ev_handler) {
-		status = p2p_ops->unreg_lo_ev_handler(psoc, NULL);
-		p2p_debug("unregister lo event, status:%d", status);
+	if (p2p_ops && p2p_ops->reg_noa_ev_handler) {
+		status = p2p_ops->reg_noa_ev_handler(psoc, NULL);
+		p2p_debug("register noa event, status:%d", status);
 	}
 
 	return status;
@@ -288,50 +337,3 @@ QDF_STATUS  tgt_p2p_noa_event_cb(struct wlan_objmgr_psoc *psoc,
 
 	return QDF_STATUS_SUCCESS;
 }
-
-QDF_STATUS tgt_p2p_lo_event_cb(struct wlan_objmgr_psoc *psoc,
-		struct p2p_lo_event *event_info)
-{
-	struct p2p_lo_stop_event *lo_stop_event;
-	struct scheduler_msg msg = {0};
-	struct p2p_soc_priv_obj *p2p_soc_obj;
-
-	p2p_debug("soc:%pK, event_info:%pK", psoc, event_info);
-
-	if (!psoc) {
-		p2p_err("psoc context passed is NULL");
-		if (event_info)
-			qdf_mem_free(event_info);
-		return QDF_STATUS_E_INVAL;
-	}
-
-	p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
-			WLAN_UMAC_COMP_P2P);
-	if (!p2p_soc_obj) {
-		p2p_err("p2p soc object is NULL");
-		if (event_info)
-			qdf_mem_free(event_info);
-		return QDF_STATUS_E_INVAL;
-	}
-
-	if (!event_info) {
-		p2p_err("invalid lo stop event information");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	lo_stop_event = qdf_mem_malloc(sizeof(*lo_stop_event));
-	if (!lo_stop_event) {
-		p2p_err("Failed to allocate p2p lo stop event");
-		qdf_mem_free(event_info);
-		return QDF_STATUS_E_NOMEM;
-	}
-
-	lo_stop_event->p2p_soc_obj = p2p_soc_obj;
-	lo_stop_event->lo_event = event_info;
-	msg.type = P2P_EVENT_LO_STOPPED;
-	msg.bodyptr = lo_stop_event;
-	msg.callback = p2p_process_evt;
-	scheduler_post_msg(QDF_MODULE_ID_TARGET_IF, &msg);
-
-	return QDF_STATUS_SUCCESS;
-}

+ 2 - 0
umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c

@@ -463,6 +463,7 @@ QDF_STATUS ucfg_p2p_set_ps(struct wlan_objmgr_psoc *soc,
 	return status;
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 QDF_STATUS ucfg_p2p_lo_start(struct wlan_objmgr_psoc *soc,
 	struct p2p_lo_start *p2p_lo_start)
 {
@@ -511,6 +512,7 @@ QDF_STATUS ucfg_p2p_lo_stop(struct wlan_objmgr_psoc *soc,
 
 	return status;
 }
+#endif
 
 QDF_STATUS  ucfg_p2p_set_noa(struct wlan_objmgr_psoc *soc,
 	uint32_t vdev_id, bool disable_noa)

+ 2 - 0
wmi/inc/wmi_unified_api.h

@@ -574,11 +574,13 @@ QDF_STATUS wmi_unified_set_p2pgo_noa_req_cmd(void *wmi_hdl,
 			struct p2p_ps_params *noa);
 
 #ifdef CONVERGED_P2P_ENABLE
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 QDF_STATUS wmi_unified_p2p_lo_start_cmd(void *wmi_hdl,
 			struct p2p_lo_start *param);
 
 QDF_STATUS wmi_unified_p2p_lo_stop_cmd(void *wmi_hdl, uint8_t vdev_id);
 #endif
+#endif
 
 QDF_STATUS wmi_unified_set_smps_params(void *wmi_hdl, uint8_t vdev_id,
 			       int value);

+ 3 - 1
wmi/inc/wmi_unified_priv.h

@@ -343,7 +343,7 @@ QDF_STATUS (*send_set_p2pgo_oppps_req_cmd)(wmi_unified_t wmi_handle,
 QDF_STATUS (*send_set_p2pgo_noa_req_cmd)(wmi_unified_t wmi_handle,
 			struct p2p_ps_params *noa);
 
-#ifdef CONVERGED_P2P_ENABLE
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 QDF_STATUS (*send_p2p_lo_start_cmd)(wmi_unified_t wmi_handle,
 			struct p2p_lo_start *param);
 
@@ -1276,8 +1276,10 @@ QDF_STATUS (*extract_swba_noa_info)(wmi_unified_t wmi_handle, void *evt_buf,
 	    uint32_t idx, wmi_host_p2p_noa_info *p2p_desc);
 
 #ifdef CONVERGED_P2P_ENABLE
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 QDF_STATUS (*extract_p2p_lo_stop_ev_param)(wmi_unified_t wmi_handle,
 	void *evt_buf, struct p2p_lo_event *param);
+#endif
 
 QDF_STATUS (*extract_p2p_noa_ev_param)(wmi_unified_t wmi_handle,
 	void *evt_buf, struct p2p_noa_info *param);

+ 5 - 3
wmi/src/wmi_unified_api.c

@@ -1032,7 +1032,7 @@ QDF_STATUS wmi_unified_set_p2pgo_noa_req_cmd(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
-#ifdef CONVERGED_P2P_ENABLE
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * wmi_unified_p2p_lo_start_cmd() - send p2p lo start request to fw
  * @wmi_hdl: wmi handle
@@ -1073,13 +1073,13 @@ QDF_STATUS wmi_unified_p2p_lo_stop_cmd(void *wmi_hdl, uint8_t vdev_id)
 		return QDF_STATUS_E_INVAL;
 	}
 
-	if (wmi_handle->ops->send_p2p_lo_start_cmd)
+	if (wmi_handle->ops->send_p2p_lo_stop_cmd)
 		return wmi_handle->ops->send_p2p_lo_stop_cmd(wmi_handle,
 				  vdev_id);
 
 	return QDF_STATUS_E_FAILURE;
 }
-#endif /* End of CONVERGED_P2P_ENABLE */
+#endif /* End of FEATURE_P2P_LISTEN_OFFLOAD*/
 
 /**
  * wmi_get_temperature() - get pdev temperature req
@@ -5791,6 +5791,7 @@ QDF_STATUS wmi_extract_swba_noa_info(void *wmi_hdl, void *evt_buf,
 }
 
 #ifdef CONVERGED_P2P_ENABLE
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * wmi_extract_p2p_lo_stop_ev_param() - extract p2p lo stop param from event
  * @wmi_handle: wmi handle
@@ -5815,6 +5816,7 @@ QDF_STATUS wmi_extract_p2p_lo_stop_ev_param(void *wmi_hdl, void *evt_buf,
 
 	return QDF_STATUS_E_FAILURE;
 }
+#endif
 
 /**
  * wmi_extract_p2p_noa_ev_param() - extract p2p noa param from event

+ 7 - 3
wmi/src/wmi_unified_tlv.c

@@ -3704,7 +3704,7 @@ end:
 	return status;
 }
 
-#ifdef CONVERGED_P2P_ENABLE
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * send_p2p_lo_start_cmd_tlv() - send p2p lo start request to fw
  * @wmi_handle: wmi handle
@@ -3845,7 +3845,7 @@ static QDF_STATUS send_p2p_lo_stop_cmd_tlv(wmi_unified_t wmi_handle,
 
 	return QDF_STATUS_SUCCESS;
 }
-#endif /* End of CONVERGED_P2P_ENABLE */
+#endif /* End of FEATURE_P2P_LISTEN_OFFLOAD */
 
 /**
  * send_get_temperature_cmd_tlv() - get pdev temperature req
@@ -18549,6 +18549,7 @@ static QDF_STATUS extract_p2p_noa_ev_param_tlv(
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 /**
  * extract_p2p_lo_stop_ev_param_tlv() - extract p2p lo stop
  * information from event
@@ -18585,6 +18586,7 @@ static QDF_STATUS extract_p2p_lo_stop_ev_param_tlv(
 
 	return QDF_STATUS_SUCCESS;
 }
+#endif
 #endif /* End of CONVERGED_P2P_ENABLE */
 
 /**
@@ -21959,7 +21961,7 @@ struct wmi_ops tlv_ops =  {
 	.send_get_temperature_cmd = send_get_temperature_cmd_tlv,
 	.send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv,
 	.send_set_p2pgo_noa_req_cmd = send_set_p2pgo_noa_req_cmd_tlv,
-#ifdef CONVERGED_P2P_ENABLE
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 	.send_p2p_lo_start_cmd = send_p2p_lo_start_cmd_tlv,
 	.send_p2p_lo_stop_cmd = send_p2p_lo_stop_cmd_tlv,
 #endif
@@ -22244,8 +22246,10 @@ struct wmi_ops tlv_ops =  {
 	.extract_swba_noa_info = extract_swba_noa_info_tlv,
 #ifdef CONVERGED_P2P_ENABLE
 	.extract_p2p_noa_ev_param = extract_p2p_noa_ev_param_tlv,
+#ifdef FEATURE_P2P_LISTEN_OFFLOAD
 	.extract_p2p_lo_stop_ev_param =
 				extract_p2p_lo_stop_ev_param_tlv,
+#endif
 #endif
 	.extract_offchan_data_tx_compl_param =
 				extract_offchan_data_tx_compl_param_tlv,