From 76b2a2f291098ff681ae99731bad27533ae43f4a Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Wed, 15 Mar 2017 19:12:20 +0800 Subject: [PATCH 01/14] qcacmn: Defines os and target interfaces Defines API and callbacks of os interface for P2P component. At the same time, defines API of target interface. Change-Id: Ice1c86ecba1f2410d965d9f84923589f229a1864 CRs-Fixed: 2013763 --- inc/target_if_p2p.h | 124 ++++++++++++++++++++ src/target_if_p2p.c | 279 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 403 insertions(+) create mode 100644 inc/target_if_p2p.h create mode 100644 src/target_if_p2p.c diff --git a/inc/target_if_p2p.h b/inc/target_if_p2p.h new file mode 100644 index 000000000000..9d3c33583a53 --- /dev/null +++ b/inc/target_if_p2p.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2017 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 + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: offload lmac interface APIs for P2P + */ + +#ifndef _TARGET_IF_P2P_H_ +#define _TARGET_IF_P2P_H_ + +#include + +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); + +/** + * target_if_p2p_register_lo_event_handler() - Register lo event handler + * @psoc: soc object + * @arg: additional argument + * + * Target interface API to register P2P listen offload event handler. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +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 + * @psoc: soc object + * @arg: additional argument + * + * Target interface API to register P2P noa event handler. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS target_if_p2p_register_noa_event_handler( + struct wlan_objmgr_psoc *psoc, void *arg); + +/** + * target_if_p2p_unregister_lo_event_handler() - Unregister lo event handler + * @psoc: soc object + * @arg: additional argument + * + * Target interface API to unregister P2P listen offload event handler. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS target_if_p2p_unregister_lo_event_handler( + struct wlan_objmgr_psoc *psoc, void *arg); + +/** + * target_if_p2p_unregister_noa_event_handler() - Unregister noa event handler + * @psoc: soc object + * @arg: additional argument + * + * Target interface API to unregister P2P listen offload event handler. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS target_if_p2p_unregister_noa_event_handler( + struct wlan_objmgr_psoc *psoc, void *arg); + +/** + * target_if_p2p_set_ps() - Set power save + * @psoc: soc object + * @arg: additional argument + * + * Target interface API to set power save. + * + * 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); + +/** + * target_if_p2p_lo_start() - Start listen offload + * @psoc: soc object + * @lo_start: lo start information + * + * Target interface API to start listen offload. + * + * 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); + +/** + * target_if_p2p_lo_stop() - Stop listen offload + * @psoc: soc object + * @vdev_id: vdev id + * + * Target interface API to stop listen offload. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, + uint32_t vdev_id); + +#endif /* _TARGET_IF_P2P_H_ */ diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c new file mode 100644 index 000000000000..9df8498ec270 --- /dev/null +++ b/src/target_if_p2p.c @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2017 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 + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: offload lmac interface APIs definitions for P2P + */ + +#include +#include +#include "target_if.h" +#include "target_if_p2p.h" + +static inline struct wlan_lmac_if_p2p_rx_ops * +target_if_psoc_get_p2p_rx_ops(struct wlan_objmgr_psoc *psoc) +{ + return &(psoc->soc_cb.rx_ops.p2p); +} + +/** + * target_p2p_lo_event_handler() - WMI callback for lo stop event + * @scn: + * @event_buf: event buffer + * @len: buffer length + * + * This function gets called from WMI when triggered wmi event + * wmi_p2p_lo_stop_event_id. + * + * Return: 0 - success + * others - failure + */ +static int target_p2p_lo_event_handler(ol_scn_t scn, uint8_t *data, + uint32_t datalen) +{ + struct wlan_objmgr_psoc *psoc; + struct wmi_unified *wmi_handle; + struct p2p_lo_event *event_info; + struct wlan_lmac_if_p2p_rx_ops *p2p_rx_ops; + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + target_if_info("scn:%p, data:%p, datalen:%d", scn, data, datalen); + + if (!scn || !data) { + target_if_err("scn: 0x%p, data: 0x%p", scn, data); + return -EINVAL; + } + + psoc = target_if_get_psoc_from_scn_hdl(scn); + if (!psoc) { + target_if_err("null psoc"); + return -EINVAL; + } + + wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc); + if (!wmi_handle) { + target_if_err("null wmi handle"); + return -EINVAL; + } + + event_info = qdf_mem_malloc(sizeof(*event_info)); + if (!event_info) { + target_if_err("Failed to allocate p2p lo event"); + return -ENOMEM; + } + + /*TODO, extract wmi lo stop event */ + + p2p_rx_ops = target_if_psoc_get_p2p_rx_ops(psoc); + if (p2p_rx_ops->lo_ev_handler) { + status = p2p_rx_ops->lo_ev_handler(psoc, event_info); + target_if_debug("call lo event handler, status:%d", + status); + } + + return qdf_status_to_os_return(status); +} + +/** + * target_p2p_noa_event_handler() - WMI callback for noa event + * @scn: + * @event_buf: event buffer + * @len: buffer length + * + * This function gets called from WMI when triggered WMI event + * wmi_p2p_noa_event_id. + * + * Return: 0 - success + * others - failure + */ +static int target_p2p_noa_event_handler(ol_scn_t scn, uint8_t *data, + uint32_t datalen) +{ + struct wlan_objmgr_psoc *psoc; + struct wmi_unified *wmi_handle; + struct p2p_noa_info *event_info; + struct wlan_lmac_if_p2p_rx_ops *p2p_rx_ops; + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + target_if_info("scn:%p, data:%p, datalen:%d", scn, data, datalen); + + if (!scn || !data) { + target_if_err("scn: 0x%p, data: 0x%p", scn, data); + return -EINVAL; + } + + psoc = target_if_get_psoc_from_scn_hdl(scn); + if (!psoc) { + target_if_err("null psoc"); + return -EINVAL; + } + + wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc); + if (!wmi_handle) { + target_if_err("null wmi handle"); + return -EINVAL; + } + + event_info = qdf_mem_malloc(sizeof(*event_info)); + if (!event_info) { + target_if_err("Failed to allocate p2p noa information"); + return -ENOMEM; + } + + /*TODO, extract wmi noa event */ + + p2p_rx_ops = target_if_psoc_get_p2p_rx_ops(psoc); + if (p2p_rx_ops->noa_ev_handler) { + status = p2p_rx_ops->noa_ev_handler(psoc, event_info); + target_if_debug("call noa event handler, status:%d", + status); + } + + 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 = wlan_psoc_get_tgt_if_handle(psoc); + + target_if_info("psoc:%p, arg:%p", psoc, arg); + + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return QDF_STATUS_E_INVAL; + } + + status = wmi_unified_register_event_handler(wmi_handle, + wmi_p2p_lo_stop_event_id, target_p2p_lo_event_handler, + WMI_RX_UMAC_CTX); + + target_if_info("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) +{ + int status; + wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + + target_if_info("psoc:%p, arg:%p", psoc, arg); + + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return QDF_STATUS_E_INVAL; + } + + status = wmi_unified_register_event_handler(wmi_handle, + wmi_p2p_noa_event_id, target_p2p_noa_event_handler, + WMI_RX_UMAC_CTX); + + target_if_info("wmi register noa 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 = wlan_psoc_get_tgt_if_handle(psoc); + + target_if_info("psoc:%p, arg:%p", psoc, arg); + + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return QDF_STATUS_E_INVAL; + } + + status = wmi_unified_unregister_event_handler(wmi_handle, + wmi_p2p_lo_stop_event_id); + + target_if_info("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) +{ + int status; + wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + + target_if_info("psoc:%p, arg:%p", psoc, arg); + + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return QDF_STATUS_E_INVAL; + } + + status = wmi_unified_unregister_event_handler(wmi_handle, + wmi_p2p_noa_event_id); + + target_if_info("wmi unregister noa event handle, status:%d", + status); + + return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE; +} + +QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, + struct p2p_ps_config *ps_config) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, + struct p2p_lo_start *lo_start) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, + uint32_t vdev_id) +{ + return QDF_STATUS_SUCCESS; +} + +void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) +{ + struct wlan_lmac_if_p2p_tx_ops *p2p_tx_ops; + + if (!tx_ops) { + target_if_err("lmac tx_ops is null"); + return; + } + + 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->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; +} From 31675f53b882cd99dd526921cf75a08315ff6429 Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Mon, 13 Mar 2017 20:17:34 +0800 Subject: [PATCH 02/14] qcacmn: WMI changes for P2P component Update WMI layer to adopt to converged P2P component. Change-Id: Ia031476f7ee6071d2e15010fc3f7c998df9995dd CRs-Fixed: 2011217 --- src/target_if_p2p.c | 120 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 96 insertions(+), 24 deletions(-) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index 9df8498ec270..dee2c8c0eca8 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -33,9 +33,9 @@ target_if_psoc_get_p2p_rx_ops(struct wlan_objmgr_psoc *psoc) /** * target_p2p_lo_event_handler() - WMI callback for lo stop event - * @scn: + * @scn: pointer to scn * @event_buf: event buffer - * @len: buffer length + * @len: buffer length * * This function gets called from WMI when triggered wmi event * wmi_p2p_lo_stop_event_id. @@ -52,7 +52,7 @@ static int target_p2p_lo_event_handler(ol_scn_t scn, uint8_t *data, struct wlan_lmac_if_p2p_rx_ops *p2p_rx_ops; QDF_STATUS status = QDF_STATUS_E_FAILURE; - target_if_info("scn:%p, data:%p, datalen:%d", scn, data, datalen); + target_if_debug("scn:%p, data:%p, datalen:%d", scn, data, datalen); if (!scn || !data) { target_if_err("scn: 0x%p, data: 0x%p", scn, data); @@ -77,7 +77,12 @@ static int target_p2p_lo_event_handler(ol_scn_t scn, uint8_t *data, return -ENOMEM; } - /*TODO, extract wmi lo stop event */ + if (wmi_extract_p2p_lo_stop_ev_param(wmi_handle, data, + event_info)) { + target_if_err("Failed to extract wmi p2p lo stop event"); + qdf_mem_free(event_info); + return -EINVAL; + } p2p_rx_ops = target_if_psoc_get_p2p_rx_ops(psoc); if (p2p_rx_ops->lo_ev_handler) { @@ -91,9 +96,9 @@ static int target_p2p_lo_event_handler(ol_scn_t scn, uint8_t *data, /** * target_p2p_noa_event_handler() - WMI callback for noa event - * @scn: + * @scn: pointer to scn * @event_buf: event buffer - * @len: buffer length + * @len: buffer length * * This function gets called from WMI when triggered WMI event * wmi_p2p_noa_event_id. @@ -110,7 +115,7 @@ static int target_p2p_noa_event_handler(ol_scn_t scn, uint8_t *data, struct wlan_lmac_if_p2p_rx_ops *p2p_rx_ops; QDF_STATUS status = QDF_STATUS_E_FAILURE; - target_if_info("scn:%p, data:%p, datalen:%d", scn, data, datalen); + target_if_debug("scn:%p, data:%p, datalen:%d", scn, data, datalen); if (!scn || !data) { target_if_err("scn: 0x%p, data: 0x%p", scn, data); @@ -131,11 +136,16 @@ static int target_p2p_noa_event_handler(ol_scn_t scn, uint8_t *data, event_info = qdf_mem_malloc(sizeof(*event_info)); if (!event_info) { - target_if_err("Failed to allocate p2p noa information"); + target_if_err("failed to allocate p2p noa information"); return -ENOMEM; } - /*TODO, extract wmi noa event */ + if (wmi_extract_p2p_noa_ev_param(wmi_handle, data, + event_info)) { + target_if_err("failed to extract wmi p2p noa event"); + qdf_mem_free(event_info); + return -EINVAL; + } p2p_rx_ops = target_if_psoc_get_p2p_rx_ops(psoc); if (p2p_rx_ops->noa_ev_handler) { @@ -153,7 +163,7 @@ QDF_STATUS target_if_p2p_register_lo_event_handler( int status; wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); - target_if_info("psoc:%p, arg:%p", psoc, arg); + target_if_debug("psoc:%p, arg:%p", psoc, arg); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -161,10 +171,11 @@ QDF_STATUS target_if_p2p_register_lo_event_handler( } status = wmi_unified_register_event_handler(wmi_handle, - wmi_p2p_lo_stop_event_id, target_p2p_lo_event_handler, + WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID, + target_p2p_lo_event_handler, WMI_RX_UMAC_CTX); - target_if_info("wmi register lo event handle, status:%d", + target_if_debug("wmi register lo event handle, status:%d", status); return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE; @@ -176,7 +187,7 @@ QDF_STATUS target_if_p2p_register_noa_event_handler( int status; wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); - target_if_info("psoc:%p, arg:%p", psoc, arg); + target_if_debug("psoc:%p, arg:%p", psoc, arg); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -184,10 +195,10 @@ QDF_STATUS target_if_p2p_register_noa_event_handler( } status = wmi_unified_register_event_handler(wmi_handle, - wmi_p2p_noa_event_id, target_p2p_noa_event_handler, + WMI_P2P_NOA_EVENTID, target_p2p_noa_event_handler, WMI_RX_UMAC_CTX); - target_if_info("wmi register noa event handle, status:%d", + target_if_debug("wmi register noa event handle, status:%d", status); return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE; @@ -199,7 +210,7 @@ QDF_STATUS target_if_p2p_unregister_lo_event_handler( int status; wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); - target_if_info("psoc:%p, arg:%p", psoc, arg); + target_if_debug("psoc:%p, arg:%p", psoc, arg); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -207,9 +218,9 @@ QDF_STATUS target_if_p2p_unregister_lo_event_handler( } status = wmi_unified_unregister_event_handler(wmi_handle, - wmi_p2p_lo_stop_event_id); + WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID); - target_if_info("wmi unregister lo event handle, status:%d", + target_if_debug("wmi unregister lo event handle, status:%d", status); return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE; @@ -221,7 +232,7 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( int status; wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); - target_if_info("psoc:%p, arg:%p", psoc, arg); + target_if_debug("psoc:%p, arg:%p", psoc, arg); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -229,9 +240,9 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( } status = wmi_unified_unregister_event_handler(wmi_handle, - wmi_p2p_noa_event_id); + WMI_P2P_NOA_EVENTID); - target_if_info("wmi unregister noa event handle, status:%d", + target_if_debug("wmi unregister noa event handle, status:%d", status); return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE; @@ -240,19 +251,80 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, struct p2p_ps_config *ps_config) { - return QDF_STATUS_SUCCESS; + struct p2p_ps_params cmd; + QDF_STATUS status; + wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + + target_if_debug("psoc:%p, vdev_id:%d, opp_ps:%d", psoc, + ps_config->vdev_id, ps_config->opp_ps); + + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return QDF_STATUS_E_INVAL; + } + + if (!ps_config) { + target_if_err("ps config parameters is null"); + return QDF_STATUS_E_INVAL; + } + + cmd.opp_ps = ps_config->opp_ps; + cmd.ctwindow = ps_config->ct_window; + cmd.count = ps_config->count; + cmd.duration = ps_config->duration; + cmd.interval = ps_config->interval; + cmd.single_noa_duration = ps_config->single_noa_duration; + cmd.ps_selection = ps_config->ps_selection; + cmd.session_id = ps_config->vdev_id; + + if (ps_config->opp_ps) + status = wmi_unified_set_p2pgo_oppps_req(wmi_handle, + &cmd); + else + status = wmi_unified_set_p2pgo_noa_req_cmd(wmi_handle, + &cmd); + + if (status != QDF_STATUS_SUCCESS) + target_if_err("Failed to send set uapsd param, %d", + status); + + return status; } QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, struct p2p_lo_start *lo_start) { - return QDF_STATUS_SUCCESS; + wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + + target_if_debug("psoc:%p, vdev_id:%d", psoc, lo_start->vdev_id); + + 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; + } + + 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) { - return QDF_STATUS_SUCCESS; + wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + + target_if_debug("psoc:%p, 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); } void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) From 8ae831eadab397cde7e60e1e4703144766fc40ee Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Mon, 27 Mar 2017 13:34:18 +0800 Subject: [PATCH 03/14] qcacmn: Move to common wmi event id for P2P Since new wmi API to allow components to move to common event id, P2P add related changes to use common wmi event id. Change-Id: I67b9fb7cba992b06ffdfc09a1243e6f5f2c29fed CRs-Fixed: 2025109 --- src/target_if_p2p.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index dee2c8c0eca8..c19fea4605cb 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -170,10 +170,9 @@ QDF_STATUS target_if_p2p_register_lo_event_handler( return QDF_STATUS_E_INVAL; } - status = wmi_unified_register_event_handler(wmi_handle, - WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID, - target_p2p_lo_event_handler, - WMI_RX_UMAC_CTX); + 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); @@ -194,9 +193,9 @@ QDF_STATUS target_if_p2p_register_noa_event_handler( return QDF_STATUS_E_INVAL; } - status = wmi_unified_register_event_handler(wmi_handle, - WMI_P2P_NOA_EVENTID, target_p2p_noa_event_handler, - WMI_RX_UMAC_CTX); + status = wmi_unified_register_event(wmi_handle, + wmi_p2p_noa_event_id, + target_p2p_noa_event_handler); target_if_debug("wmi register noa event handle, status:%d", status); @@ -217,8 +216,8 @@ QDF_STATUS target_if_p2p_unregister_lo_event_handler( return QDF_STATUS_E_INVAL; } - status = wmi_unified_unregister_event_handler(wmi_handle, - WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID); + status = wmi_unified_unregister_event(wmi_handle, + wmi_p2p_lo_stop_event_id); target_if_debug("wmi unregister lo event handle, status:%d", status); @@ -239,8 +238,8 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( return QDF_STATUS_E_INVAL; } - status = wmi_unified_unregister_event_handler(wmi_handle, - WMI_P2P_NOA_EVENTID); + status = wmi_unified_unregister_event(wmi_handle, + wmi_p2p_noa_event_id); target_if_debug("wmi unregister noa event handle, status:%d", status); From 289076ba96d538f04809312589b10c52bb397109 Mon Sep 17 00:00:00 2001 From: Rachit Kankane Date: Wed, 19 Apr 2017 11:49:18 +0530 Subject: [PATCH 04/14] qcacmn: P2P protocol changes to Disable/Enable NOA P2P-GO whenever goes offchannel, issues NOA. With this behavior, we have issue whenever legacy STA connects to P2P-GO since legacy STA does not understand NOA. To handle this case, changes are done in p2p protocol component and the revised behavior will be: 1. By default no change in NOA. 2. Whenever first legacy STA connects to GO, p2p protocol component disables NOA (i.e. P2P-GO will issue Self-CTS whenever it goes off-channel). 3. Whenever last legacy STA disconnects from GO, p2p protocol component enables NOA (i.e. P2P-GO will issue NOA whenever it goes off-channel). Change-Id: I113950ac3fa99ca68fcafcfe4c6095cf4b2def43 CRs-Fixed: 2035609 --- inc/target_if_p2p.h | 13 +++++++++++++ src/target_if_p2p.c | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/inc/target_if_p2p.h b/inc/target_if_p2p.h index 9d3c33583a53..dcb46b9519e9 100644 --- a/inc/target_if_p2p.h +++ b/inc/target_if_p2p.h @@ -121,4 +121,17 @@ QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id); +/** + * target_if_p2p_set_noa() - Disable / Enable NOA + * @psoc: soc object + * @vdev_id: vdev id + * @disable_noa: TRUE - Disable NoA, FALSE - Enable NoA + * + * Target interface API to Disable / Enable P2P NOA. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc, + uint32_t vdev_id, bool disable_noa); + #endif /* _TARGET_IF_P2P_H_ */ diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index c19fea4605cb..70680ecab1be 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -326,6 +326,26 @@ QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, (uint8_t)vdev_id); } +QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc, + uint32_t vdev_id, bool disable_noa) +{ + struct vdev_set_params param; + wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return QDF_STATUS_E_INVAL; + } + + target_if_debug("psoc:%p, vdev_id:%d disable_noa:%d", + psoc, vdev_id, disable_noa); + param.if_id = vdev_id; + param.param_id = WMI_VDEV_PARAM_DISABLE_NOA_P2P_GO; + param.param_value = (uint32_t)disable_noa; + + return wmi_unified_vdev_set_param_send(wmi_handle, ¶m); +} + void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) { struct wlan_lmac_if_p2p_tx_ops *p2p_tx_ops; @@ -339,6 +359,7 @@ void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) 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 = From 084b544a68a9acede48b8e8b9dd4ac3ae415d544 Mon Sep 17 00:00:00 2001 From: Vivek Date: Sun, 4 Jun 2017 23:12:00 +0530 Subject: [PATCH 05/14] qcacmn: Add target information details to target_iflayer Add a new target_psoc_info structure in the target if layer with the following members wmi_handle target_type target_version target_revision Also update the psoc data member tgt_if_handle to point to target_psoc_info instead of pointing to WMI handle directly. Updated all calls to psoc_get_tgt_if_handle to target_if_get_wmi_handle which inturn calls psoc_get_tgt_if_handle and getting the tgt_if_handle returns the WMI handle CRs-Fixed: 2048277 Change-Id: Icb02d5f3c09f7f9bb7eff4d814ef3ce90ddb84bd --- src/target_if_p2p.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index 70680ecab1be..a101d127835e 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -161,7 +161,7 @@ QDF_STATUS target_if_p2p_register_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); target_if_debug("psoc:%p, arg:%p", psoc, arg); @@ -184,7 +184,7 @@ QDF_STATUS target_if_p2p_register_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); target_if_debug("psoc:%p, arg:%p", psoc, arg); @@ -207,7 +207,7 @@ QDF_STATUS target_if_p2p_unregister_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); target_if_debug("psoc:%p, arg:%p", psoc, arg); @@ -229,7 +229,7 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); target_if_debug("psoc:%p, arg:%p", psoc, arg); @@ -252,7 +252,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, { struct p2p_ps_params cmd; QDF_STATUS status; - wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); target_if_debug("psoc:%p, vdev_id:%d, opp_ps:%d", psoc, ps_config->vdev_id, ps_config->opp_ps); @@ -293,7 +293,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, struct p2p_lo_start *lo_start) { - wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); target_if_debug("psoc:%p, vdev_id:%d", psoc, lo_start->vdev_id); @@ -313,7 +313,7 @@ QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id) { - wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); target_if_debug("psoc:%p, vdev_id:%d", psoc, vdev_id); @@ -330,7 +330,7 @@ QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, bool disable_noa) { struct vdev_set_params param; - wmi_unified_t wmi_handle = wlan_psoc_get_tgt_if_handle(psoc); + wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); From e2142700d7fb5beca8ea161fdc4d4aefb358f567 Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Tue, 9 May 2017 19:47:37 +0800 Subject: [PATCH 06/14] qcacmn: fix implict memory leak Fix implict memory leak in P2P target if layer. Change-Id: Ic7dbf6673b67ec34e060b785c59dd3a99b855f6d CRs-Fixed: 2055496 --- src/target_if_p2p.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index a101d127835e..430a306a4eb4 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -89,6 +89,9 @@ static int target_p2p_lo_event_handler(ol_scn_t scn, uint8_t *data, status = p2p_rx_ops->lo_ev_handler(psoc, event_info); target_if_debug("call lo event handler, status:%d", status); + } else { + qdf_mem_free(event_info); + target_if_debug("no valid lo event handler"); } return qdf_status_to_os_return(status); @@ -152,6 +155,9 @@ static int target_p2p_noa_event_handler(ol_scn_t scn, uint8_t *data, status = p2p_rx_ops->noa_ev_handler(psoc, event_info); target_if_debug("call noa event handler, status:%d", status); + } else { + qdf_mem_free(event_info); + target_if_debug("no valid noa event handler"); } return qdf_status_to_os_return(status); From d1f5b2d71fe13dfed798971d8522c49479dfe9b3 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Mon, 18 Sep 2017 10:09:05 -0700 Subject: [PATCH 07/14] qcacmn: target_if: Replace instances of unadorned %p Replace instances of unadorned %p in target_if. Change-Id: I1c8a1b98be2d12fcf8e1fadf4a889268dfe37058 CRs-Fixed: 2111274 --- src/target_if_p2p.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index 430a306a4eb4..5f03401c389c 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -52,10 +52,10 @@ static int target_p2p_lo_event_handler(ol_scn_t scn, uint8_t *data, struct wlan_lmac_if_p2p_rx_ops *p2p_rx_ops; QDF_STATUS status = QDF_STATUS_E_FAILURE; - target_if_debug("scn:%p, data:%p, datalen:%d", scn, data, datalen); + target_if_debug("scn:%pK, data:%pK, datalen:%d", scn, data, datalen); if (!scn || !data) { - target_if_err("scn: 0x%p, data: 0x%p", scn, data); + target_if_err("scn: 0x%pK, data: 0x%pK", scn, data); return -EINVAL; } @@ -118,10 +118,10 @@ static int target_p2p_noa_event_handler(ol_scn_t scn, uint8_t *data, struct wlan_lmac_if_p2p_rx_ops *p2p_rx_ops; QDF_STATUS status = QDF_STATUS_E_FAILURE; - target_if_debug("scn:%p, data:%p, datalen:%d", scn, data, datalen); + target_if_debug("scn:%pK, data:%pK, datalen:%d", scn, data, datalen); if (!scn || !data) { - target_if_err("scn: 0x%p, data: 0x%p", scn, data); + target_if_err("scn: 0x%pK, data: 0x%pK", scn, data); return -EINVAL; } @@ -169,7 +169,7 @@ QDF_STATUS target_if_p2p_register_lo_event_handler( int status; wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); - target_if_debug("psoc:%p, arg:%p", psoc, arg); + target_if_debug("psoc:%pK, arg:%pK", psoc, arg); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -192,7 +192,7 @@ QDF_STATUS target_if_p2p_register_noa_event_handler( int status; wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); - target_if_debug("psoc:%p, arg:%p", psoc, arg); + target_if_debug("psoc:%pK, arg:%pK", psoc, arg); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -215,7 +215,7 @@ QDF_STATUS target_if_p2p_unregister_lo_event_handler( int status; wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); - target_if_debug("psoc:%p, arg:%p", psoc, arg); + target_if_debug("psoc:%pK, arg:%pK", psoc, arg); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -237,7 +237,7 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( int status; wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); - target_if_debug("psoc:%p, arg:%p", psoc, arg); + target_if_debug("psoc:%pK, arg:%pK", psoc, arg); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -260,7 +260,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, QDF_STATUS status; wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); - target_if_debug("psoc:%p, vdev_id:%d, opp_ps:%d", psoc, + target_if_debug("psoc:%pK, vdev_id:%d, opp_ps:%d", psoc, ps_config->vdev_id, ps_config->opp_ps); if (!wmi_handle) { @@ -301,7 +301,7 @@ QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, { wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); - target_if_debug("psoc:%p, vdev_id:%d", psoc, lo_start->vdev_id); + target_if_debug("psoc:%pK, vdev_id:%d", psoc, lo_start->vdev_id); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -321,7 +321,7 @@ QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, { wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); - target_if_debug("psoc:%p, vdev_id:%d", psoc, vdev_id); + target_if_debug("psoc:%pK, vdev_id:%d", psoc, vdev_id); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -343,7 +343,7 @@ QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_INVAL; } - target_if_debug("psoc:%p, vdev_id:%d disable_noa:%d", + target_if_debug("psoc:%pK, vdev_id:%d disable_noa:%d", psoc, vdev_id, disable_noa); param.if_id = vdev_id; param.param_id = WMI_VDEV_PARAM_DISABLE_NOA_P2P_GO; From 21399d2a8e99627156352401c9f747af1791cf4a Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Thu, 4 Jan 2018 16:25:06 -0800 Subject: [PATCH 08/14] qcacmn: Fix potential NULL dereference in P2P 1) Check for validity of ps_config before dereferencing. 2) Check for validity of lo_start before dereferencing. 3) Initialize tmp_p2p_ie before using it. Change-Id: I4cd5bcb025e63d727e5535921a4e4121d618ee36 CRs-Fixed: 2160760 --- src/target_if_p2p.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index 5f03401c389c..000a91758692 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -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 @@ -260,9 +260,6 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, QDF_STATUS status; wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); - target_if_debug("psoc:%pK, vdev_id:%d, opp_ps:%d", psoc, - ps_config->vdev_id, ps_config->opp_ps); - if (!wmi_handle) { target_if_err("Invalid wmi handle"); return QDF_STATUS_E_INVAL; @@ -273,6 +270,9 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_INVAL; } + target_if_debug("psoc:%pK, vdev_id:%d, opp_ps:%d", psoc, + ps_config->vdev_id, ps_config->opp_ps); + cmd.opp_ps = ps_config->opp_ps; cmd.ctwindow = ps_config->ct_window; cmd.count = ps_config->count; @@ -301,8 +301,6 @@ QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, { wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); - target_if_debug("psoc:%pK, vdev_id:%d", psoc, lo_start->vdev_id); - if (!wmi_handle) { target_if_err("Invalid wmi handle"); return QDF_STATUS_E_INVAL; @@ -312,6 +310,7 @@ QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, 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); } From a8f08ee4637c5790e3b6f5eaa54658608555e795 Mon Sep 17 00:00:00 2001 From: Srinivas Pitla Date: Mon, 22 Jan 2018 16:10:33 +0530 Subject: [PATCH 09/14] qcacmn: Define API to get component handles Introduce APIs set and get component handles Change-Id: I8bfcd802f10b8ecf9908a02d492f1ad757d8f7ec CRs-Fixed: 2177109 --- src/target_if_p2p.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index 000a91758692..6f6b306e5e6b 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -24,6 +24,7 @@ #include #include "target_if.h" #include "target_if_p2p.h" +#include "init_deinit_ucfg.h" static inline struct wlan_lmac_if_p2p_rx_ops * target_if_psoc_get_p2p_rx_ops(struct wlan_objmgr_psoc *psoc) @@ -167,7 +168,7 @@ QDF_STATUS target_if_p2p_register_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -190,7 +191,7 @@ QDF_STATUS target_if_p2p_register_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -213,7 +214,7 @@ QDF_STATUS target_if_p2p_unregister_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -235,7 +236,7 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -258,7 +259,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, { struct p2p_ps_params cmd; QDF_STATUS status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -299,7 +300,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, struct p2p_lo_start *lo_start) { - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -318,7 +319,7 @@ QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id) { - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, vdev_id:%d", psoc, vdev_id); @@ -335,7 +336,7 @@ QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, bool disable_noa) { struct vdev_set_params param; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); From 59cc7659b10866e5910ec6dd17e6954f6588f894 Mon Sep 17 00:00:00 2001 From: Akshay Kosigi Date: Tue, 6 Feb 2018 16:02:25 +0530 Subject: [PATCH 10/14] qcacmn: Replace void pointers with appropriate/common structure types Void pointer usage may lead to memory corruption due to wrong pointer is typecasted. Hence define structure for all, and modules internally typecasting based on their type Change-Id: I6271ed8aa3f94254fd85f41962f23ea36895154e CRs-Fixed: 2182452 --- src/target_if_p2p.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index 6f6b306e5e6b..03741472dd45 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -66,7 +66,7 @@ static int target_p2p_lo_event_handler(ol_scn_t scn, uint8_t *data, return -EINVAL; } - wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc); + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); if (!wmi_handle) { target_if_err("null wmi handle"); return -EINVAL; @@ -132,7 +132,7 @@ static int target_p2p_noa_event_handler(ol_scn_t scn, uint8_t *data, return -EINVAL; } - wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc); + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); if (!wmi_handle) { target_if_err("null wmi handle"); return -EINVAL; @@ -168,7 +168,7 @@ QDF_STATUS target_if_p2p_register_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -191,7 +191,7 @@ QDF_STATUS target_if_p2p_register_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -214,7 +214,7 @@ QDF_STATUS target_if_p2p_unregister_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -236,7 +236,7 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -259,7 +259,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, { struct p2p_ps_params cmd; QDF_STATUS status; - wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -300,7 +300,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, struct p2p_lo_start *lo_start) { - wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -319,7 +319,7 @@ QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id) { - wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, vdev_id:%d", psoc, vdev_id); @@ -336,7 +336,7 @@ QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, bool disable_noa) { struct vdev_set_params param; - wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); From 6e91ab86948fa0d9c8c17d6cca4833a863413a0f Mon Sep 17 00:00:00 2001 From: Akshay Kosigi Date: Wed, 28 Feb 2018 22:37:24 +0530 Subject: [PATCH 11/14] qcacmn: Replace ucfg prefix with lmac Replace functions with ucfg as prefix in init_deinit_ucfg file with lmac as prefix Change-Id: I90d77dd5ddae4854ea68eeb67dc1b4fc356c2fe3 CRs-Fixed: 2182449 --- src/target_if_p2p.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index 03741472dd45..746b4f6cb81a 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -24,7 +24,7 @@ #include #include "target_if.h" #include "target_if_p2p.h" -#include "init_deinit_ucfg.h" +#include "init_deinit_lmac.h" static inline struct wlan_lmac_if_p2p_rx_ops * target_if_psoc_get_p2p_rx_ops(struct wlan_objmgr_psoc *psoc) @@ -168,7 +168,7 @@ QDF_STATUS target_if_p2p_register_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -191,7 +191,7 @@ QDF_STATUS target_if_p2p_register_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -214,7 +214,7 @@ QDF_STATUS target_if_p2p_unregister_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -236,7 +236,7 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -259,7 +259,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, { struct p2p_ps_params cmd; QDF_STATUS status; - wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -300,7 +300,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, struct p2p_lo_start *lo_start) { - wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -319,7 +319,7 @@ QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id) { - wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); target_if_debug("psoc:%pK, vdev_id:%d", psoc, vdev_id); @@ -336,7 +336,7 @@ QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, bool disable_noa) { struct vdev_set_params param; - wmi_unified_t wmi_handle = ucfg_get_wmi_unified_hdl(psoc); + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); From 8c188ac0931b88fbfda1d2e0c8b57b553f78ac44 Mon Sep 17 00:00:00 2001 From: Rachit Kankane Date: Tue, 31 Jul 2018 16:26:38 +0530 Subject: [PATCH 12/14] 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 --- inc/target_if_p2p.h | 93 +++++++++++----------- src/target_if_p2p.c | 184 +++++++++++++++++++++++--------------------- 2 files changed, 146 insertions(+), 131 deletions(-) diff --git a/inc/target_if_p2p.h b/inc/target_if_p2p.h index dcb46b9519e9..1306e781554b 100644 --- a/inc/target_if_p2p.h +++ b/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 @@ -49,18 +43,6 @@ void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); 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 - * @psoc: soc object - * @arg: additional argument - * - * Target interface API to register P2P noa event handler. - * - * Return: QDF_STATUS_SUCCESS - in case of success - */ -QDF_STATUS target_if_p2p_register_noa_event_handler( - struct wlan_objmgr_psoc *psoc, void *arg); - /** * target_if_p2p_unregister_lo_event_handler() - Unregister lo event handler * @psoc: soc object @@ -73,6 +55,51 @@ 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_lo_start() - Start listen offload + * @psoc: soc object + * @lo_start: lo start information + * + * Target interface API to start listen offload. + * + * 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); + +/** + * target_if_p2p_lo_stop() - Stop listen offload + * @psoc: soc object + * @vdev_id: vdev id + * + * Target interface API to stop listen offload. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, + uint32_t vdev_id); +#endif + +/** + * 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 register P2P noa event handler. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS target_if_p2p_register_noa_event_handler( + struct wlan_objmgr_psoc *psoc, void *arg); + /** * target_if_p2p_unregister_noa_event_handler() - Unregister noa event handler * @psoc: soc object @@ -95,31 +122,7 @@ QDF_STATUS target_if_p2p_unregister_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); - -/** - * target_if_p2p_lo_start() - Start listen offload - * @psoc: soc object - * @lo_start: lo start information - * - * Target interface API to start listen offload. - * - * 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); - -/** - * target_if_p2p_lo_stop() - Stop listen offload - * @psoc: soc object - * @vdev_id: vdev id - * - * Target interface API to stop listen offload. - * - * Return: QDF_STATUS_SUCCESS - in case of success - */ -QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, - uint32_t vdev_id); + struct p2p_ps_config *ps_config); /** * target_if_p2p_set_noa() - Disable / Enable NOA diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index 746b4f6cb81a..af30938c89f7 100644 --- a/src/target_if_p2p.c +++ b/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); } From f0f79ffbd3bb6d98134d37d636f5b06a89631cb4 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Wed, 19 Sep 2018 23:35:14 -0400 Subject: [PATCH 13/14] qcacmn: Action frame random mac addr tx support 1. Send add random mac addr rx filter WMI command to target 2. Add/Del the active random mac addr entry 3. Clear random mac addr from target if not active Change-Id: I9dcbdc20b76d9865da7a8db6ee013bf5e44e4407 CRs-Fixed: 2322097 --- src/target_if_p2p.c | 85 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/target_if_p2p.c b/src/target_if_p2p.c index af30938c89f7..dbce5991f92f 100644 --- a/src/target_if_p2p.c +++ b/src/target_if_p2p.c @@ -368,6 +368,87 @@ QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc, return wmi_unified_vdev_set_param_send(wmi_handle, ¶m); } +static int target_p2p_mac_rx_filter_event_handler(ol_scn_t scn, uint8_t *data, + uint32_t datalen) +{ + struct wlan_objmgr_psoc *psoc; + struct wmi_unified *wmi_handle; + struct p2p_set_mac_filter_evt event_info; + struct wlan_lmac_if_p2p_rx_ops *p2p_rx_ops; + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + if (!scn || !data) { + target_if_err("scn: 0x%pK, data: 0x%pK", scn, data); + return -EINVAL; + } + + psoc = target_if_get_psoc_from_scn_hdl(scn); + if (!psoc) { + target_if_err("null psoc"); + return -EINVAL; + } + + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + if (!wmi_handle) { + target_if_err("null wmi handle"); + return -EINVAL; + } + + if (wmi_extract_mac_addr_rx_filter_evt_param(wmi_handle, data, + &event_info)) { + target_if_err("failed to extract wmi p2p noa event"); + return -EINVAL; + } + target_if_debug("vdev_id %d status %d", event_info.vdev_id, + event_info.status); + p2p_rx_ops = target_if_psoc_get_p2p_rx_ops(psoc); + if (p2p_rx_ops && p2p_rx_ops->add_mac_addr_filter_evt_handler) + status = p2p_rx_ops->add_mac_addr_filter_evt_handler( + psoc, &event_info); + else + target_if_debug("no add mac addr filter event handler"); + + return qdf_status_to_os_return(status); +} + +static QDF_STATUS target_if_p2p_register_macaddr_rx_filter_evt_handler( + struct wlan_objmgr_psoc *psoc, bool reg) +{ + int status; + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); + + target_if_debug("psoc:%pK, register %d mac addr rx evt", psoc, reg); + + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return QDF_STATUS_E_INVAL; + } + if (reg) + status = wmi_unified_register_event( + wmi_handle, + wmi_vdev_add_macaddr_rx_filter_event_id, + target_p2p_mac_rx_filter_event_handler); + else + status = wmi_unified_unregister_event( + wmi_handle, + wmi_vdev_add_macaddr_rx_filter_event_id); + + return status == 0 ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE; +} + +static QDF_STATUS target_if_p2p_set_mac_addr_rx_filter_cmd( + struct wlan_objmgr_psoc *psoc, struct p2p_set_mac_filter *param) +{ + 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; + } + + return wmi_send_set_mac_addr_rx_filter_cmd(wmi_handle, param); +} + void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) { struct wlan_lmac_if_p2p_tx_ops *p2p_tx_ops; @@ -384,6 +465,10 @@ void target_if_p2p_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) target_if_p2p_register_noa_event_handler; p2p_tx_ops->unreg_noa_ev_handler = target_if_p2p_unregister_noa_event_handler; + p2p_tx_ops->reg_mac_addr_rx_filter_handler = + target_if_p2p_register_macaddr_rx_filter_evt_handler; + p2p_tx_ops->set_mac_addr_rx_filter_cmd = + target_if_p2p_set_mac_addr_rx_filter_cmd; /* register P2P listen offload callbacks */ target_if_p2p_lo_register_tx_ops(p2p_tx_ops); } From 7f1b42dbad527faf1d8851c115c0e3b66214da73 Mon Sep 17 00:00:00 2001 From: Linux Build Service Account Date: Tue, 4 Dec 2018 15:34:44 +0530 Subject: [PATCH 14/14] Move target_if/p2p to components/target_if/p2p Change-Id: I1ea8a2cc9f31223407fac0925b74e3c5a37bc6e5 --- {inc => components/target_if/p2p/inc}/target_if_p2p.h | 0 {src => components/target_if/p2p/src}/target_if_p2p.c | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {inc => components/target_if/p2p/inc}/target_if_p2p.h (100%) rename {src => components/target_if/p2p/src}/target_if_p2p.c (100%) diff --git a/inc/target_if_p2p.h b/components/target_if/p2p/inc/target_if_p2p.h similarity index 100% rename from inc/target_if_p2p.h rename to components/target_if/p2p/inc/target_if_p2p.h diff --git a/src/target_if_p2p.c b/components/target_if/p2p/src/target_if_p2p.c similarity index 100% rename from src/target_if_p2p.c rename to components/target_if/p2p/src/target_if_p2p.c