diff --git a/umac/p2p/core/src/wlan_p2p_main.c b/umac/p2p/core/src/wlan_p2p_main.c index fb8fac1b83e0..9d62e5b6a0a5 100644 --- a/umac/p2p/core/src/wlan_p2p_main.c +++ b/umac/p2p/core/src/wlan_p2p_main.c @@ -29,9 +29,59 @@ #include "wlan_p2p_public_struct.h" #include "wlan_p2p_ucfg_api.h" #include "wlan_p2p_tgt_api.h" -#include "../inc/wlan_p2p_main.h" -#include "../inc/wlan_p2p_roc.h" -#include "../inc/wlan_p2p_off_chan_tx.h" +#include "wlan_p2p_main.h" +#include "wlan_p2p_roc.h" +#include "wlan_p2p_off_chan_tx.h" + +/** + * p2p_get_cmd_type_str() - parse cmd to string + * @cmd_type: P2P cmd type + * + * This function parse P2P cmd to string. + * + * Return: command string + */ +static char *p2p_get_cmd_type_str(enum p2p_cmd_type cmd_type) +{ + switch (cmd_type) { + case P2P_ROC_REQ: + return "P2P roc request"; + case P2P_CANCEL_ROC_REQ: + return "P2P cancel roc request"; + case P2P_MGMT_TX: + return "P2P mgmt tx request"; + case P2P_MGMT_TX_CANCEL: + return "P2P cancel mgmt tx request"; + default: + return "Invalid P2P command"; + } +} + +/** + * p2p_get_event_type_str() - parase event to string + * @event_type: P2P event type + * + * This function parse P2P event to string. + * + * Return: event string + */ +static char *p2p_get_event_type_str(enum p2p_event_type event_type) +{ + switch (event_type) { + case P2P_EVENT_SCAN_EVENT: + return "P2P scan event"; + case P2P_EVENT_MGMT_TX_ACK_CNF: + return "P2P mgmt tx ack event"; + case P2P_EVENT_RX_MGMT: + return "P2P mgmt rx event"; + case P2P_EVENT_LO_STOPPED: + return "P2P lo stop event"; + case P2P_EVENT_NOA: + return "P2P noa event"; + default: + return "Invalid P2P event"; + } +} /** * p2p_psoc_obj_create_notification() - Function to allocate per P2P @@ -60,6 +110,7 @@ static QDF_STATUS p2p_psoc_obj_create_notification( p2p_err("Failed to allocate p2p soc private object"); return QDF_STATUS_E_NOMEM; } + p2p_soc_obj->soc = soc; status = wlan_objmgr_psoc_component_obj_attach(soc, @@ -71,6 +122,8 @@ static QDF_STATUS p2p_psoc_obj_create_notification( return status; } + p2p_info("p2p soc object create successful, %p", p2p_soc_obj); + return QDF_STATUS_SUCCESS; } @@ -102,12 +155,17 @@ static QDF_STATUS p2p_psoc_obj_destroy_notification( return QDF_STATUS_E_FAILURE; } + p2p_soc_obj->soc = NULL; + status = wlan_objmgr_psoc_component_obj_detach(soc, WLAN_UMAC_COMP_P2P, p2p_soc_obj); if (status != QDF_STATUS_SUCCESS) { p2p_err("Failed to detach p2p component, %d", status); return status; } + + p2p_info("destroy p2p soc object, %p", p2p_soc_obj); + qdf_mem_free(p2p_soc_obj); return QDF_STATUS_SUCCESS; @@ -139,7 +197,9 @@ static QDF_STATUS p2p_vdev_obj_create_notification( p2p_err("Failed to allocate p2p vdev object"); return QDF_STATUS_E_NOMEM; } + p2p_vdev_obj->vdev = vdev; + status = wlan_objmgr_vdev_component_obj_attach(vdev, WLAN_UMAC_COMP_P2P, p2p_vdev_obj, QDF_STATUS_SUCCESS); @@ -150,6 +210,8 @@ static QDF_STATUS p2p_vdev_obj_create_notification( return status; } + p2p_info("p2p vdev object create successful, %p", p2p_vdev_obj); + return QDF_STATUS_SUCCESS; } @@ -181,6 +243,8 @@ static QDF_STATUS p2p_vdev_obj_destroy_notification( return QDF_STATUS_E_FAILURE; } + p2p_vdev_obj->vdev = NULL; + status = wlan_objmgr_vdev_component_obj_detach(vdev, WLAN_UMAC_COMP_P2P, p2p_vdev_obj); if (status != QDF_STATUS_SUCCESS) { @@ -188,6 +252,12 @@ static QDF_STATUS p2p_vdev_obj_destroy_notification( return status; } + p2p_info("destroy p2p vdev object, p2p vdev obj:%p, noa info:%p", + p2p_vdev_obj, p2p_vdev_obj->noa_info); + + if (p2p_vdev_obj->noa_info) + qdf_mem_free(p2p_vdev_obj->noa_info); + qdf_mem_free(p2p_vdev_obj); return QDF_STATUS_SUCCESS; @@ -206,7 +276,7 @@ QDF_STATUS p2p_component_init(void) goto err_reg_psoc_create; } - status = wlan_objmgr_register_psoc_delete_handler( + status = wlan_objmgr_register_psoc_destroy_handler( WLAN_UMAC_COMP_P2P, p2p_psoc_obj_destroy_notification, NULL); @@ -224,7 +294,7 @@ QDF_STATUS p2p_component_init(void) goto err_reg_vdev_create; } - status = wlan_objmgr_register_vdev_delete_handler( + status = wlan_objmgr_register_vdev_destroy_handler( WLAN_UMAC_COMP_P2P, p2p_vdev_obj_destroy_notification, NULL); @@ -240,7 +310,7 @@ err_reg_vdev_delete: wlan_objmgr_unregister_vdev_create_handler(WLAN_UMAC_COMP_P2P, p2p_vdev_obj_create_notification, NULL); err_reg_vdev_create: - wlan_objmgr_unregister_psoc_delete_handler(WLAN_UMAC_COMP_P2P, + wlan_objmgr_unregister_psoc_destroy_handler(WLAN_UMAC_COMP_P2P, p2p_psoc_obj_destroy_notification, NULL); err_reg_psoc_delete: wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_P2P, @@ -264,7 +334,7 @@ QDF_STATUS p2p_component_deinit(void) ret_status = status; } - status = wlan_objmgr_unregister_vdev_delete_handler( + status = wlan_objmgr_unregister_vdev_destroy_handler( WLAN_UMAC_COMP_P2P, p2p_vdev_obj_destroy_notification, NULL); @@ -284,7 +354,7 @@ QDF_STATUS p2p_component_deinit(void) ret_status = status; } - status = wlan_objmgr_unregister_psoc_delete_handler( + status = wlan_objmgr_unregister_psoc_destroy_handler( WLAN_UMAC_COMP_P2P, p2p_psoc_obj_destroy_notification, NULL); @@ -299,7 +369,7 @@ QDF_STATUS p2p_component_deinit(void) return ret_status; } -QDF_STATUS p2p_psoc_open(struct wlan_objmgr_psoc *soc) +QDF_STATUS p2p_psoc_object_open(struct wlan_objmgr_psoc *soc) { struct p2p_soc_priv_obj *p2p_soc_obj; @@ -326,7 +396,7 @@ QDF_STATUS p2p_psoc_open(struct wlan_objmgr_psoc *soc) return QDF_STATUS_SUCCESS; } -QDF_STATUS p2p_psoc_close(struct wlan_objmgr_psoc *soc) +QDF_STATUS p2p_psoc_object_close(struct wlan_objmgr_psoc *soc) { struct p2p_soc_priv_obj *p2p_soc_obj; @@ -431,7 +501,9 @@ QDF_STATUS p2p_process_cmd(struct scheduler_msg *msg) { QDF_STATUS status; - p2p_info("msg type %d", msg->type); + p2p_info("msg type %d, %s", msg->type, + p2p_get_cmd_type_str(msg->type)); + if (msg->bodyptr == NULL) { p2p_err("Invalid message body"); return QDF_STATUS_E_INVAL; @@ -474,7 +546,9 @@ QDF_STATUS p2p_process_evt(struct scheduler_msg *msg) { QDF_STATUS status; - p2p_info("msg type %d", msg->type); + p2p_info("msg type %d, %s", msg->type, + p2p_get_event_type_str(msg->type)); + if (msg->bodyptr == NULL) { p2p_err("Invalid message body"); return QDF_STATUS_E_INVAL; diff --git a/umac/p2p/core/inc/wlan_p2p_main.h b/umac/p2p/core/src/wlan_p2p_main.h similarity index 86% rename from umac/p2p/core/inc/wlan_p2p_main.h rename to umac/p2p/core/src/wlan_p2p_main.h index 23daf7f2f2f5..6b6a35506d21 100644 --- a/umac/p2p/core/inc/wlan_p2p_main.h +++ b/umac/p2p/core/src/wlan_p2p_main.h @@ -27,8 +27,8 @@ #include #include -#define P2P_MAX_NOA_DESC 4 #define MAX_QUEUE_LENGTH 20 +#define P2P_MODULE_NAME "P2P" #define p2p_log(level, args...) \ QDF_TRACE(QDF_MODULE_ID_P2P, level, ## args) @@ -51,6 +51,7 @@ struct p2p_tx_cnf; struct p2p_rx_mgmt_frame; struct p2p_lo_event; struct p2p_start_param; +struct p2p_noa_info; /** * enum p2p_cmd_type - P2P request type @@ -82,38 +83,6 @@ enum p2p_event_type { P2P_EVENT_NOA, }; -/** - * struct noa_descriptor - noa descriptor - * @type_count: 255: continuous schedule, 0: reserved - * @duration: Absent period duration in micro seconds - * @interval: Absent period interval in micro seconds - * @start_time: 32 bit tsf time when in starts - */ -struct noa_descriptor { - uint8_t type_count; - uint32_t duration; - uint32_t interval; - uint32_t start_time; -}; - -/** - * struct p2p_noa_info - p2p noa information - * @index: Identifies instance of NOA su element - * @opps_ps: Opps ps state of the AP - * @ct_window: Ct window in TUs - * @num_descriptors: Number of NOA descriptors - * @noa_desc: Noa descriptors - * @vdev_id: Vdev id - */ -struct p2p_noa_info { - uint8_t index; - uint8_t opps_ps; - uint8_t ct_window; - uint8_t num_desc; - struct noa_descriptor noa_desc[P2P_MAX_NOA_DESC]; - uint32_t vdev_id; -}; - /** * struct p2p_tx_conf_event - p2p tx confirm event * @p2p_soc_obj: p2p soc private object @@ -204,24 +173,24 @@ QDF_STATUS p2p_component_init(void); QDF_STATUS p2p_component_deinit(void); /** - * p2p_psoc_open() - Open P2P component + * p2p_psoc_object_open() - Open P2P component * @soc: soc context * * This function initialize p2p psoc object * * Return: QDF_STATUS_SUCCESS - in case of success */ -QDF_STATUS p2p_psoc_open(struct wlan_objmgr_psoc *soc); +QDF_STATUS p2p_psoc_object_open(struct wlan_objmgr_psoc *soc); /** - * p2p_psoc_close() - Close P2P component + * p2p_psoc_object_close() - Close P2P component * @soc: soc context * * This function de-init p2p psoc object. * * Return: QDF_STATUS_SUCCESS - in case of success */ -QDF_STATUS p2p_psoc_close(struct wlan_objmgr_psoc *soc); +QDF_STATUS p2p_psoc_object_close(struct wlan_objmgr_psoc *soc); /** * p2p_psoc_start() - Start P2P component diff --git a/umac/p2p/core/src/wlan_p2p_off_chan_tx.c b/umac/p2p/core/src/wlan_p2p_off_chan_tx.c index 649bcb894fb2..99ceaff00ab1 100644 --- a/umac/p2p/core/src/wlan_p2p_off_chan_tx.c +++ b/umac/p2p/core/src/wlan_p2p_off_chan_tx.c @@ -21,7 +21,7 @@ */ #include -#include "../inc/wlan_p2p_off_chan_tx.h" +#include "wlan_p2p_off_chan_tx.h" QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx) { diff --git a/umac/p2p/core/inc/wlan_p2p_off_chan_tx.h b/umac/p2p/core/src/wlan_p2p_off_chan_tx.h similarity index 100% rename from umac/p2p/core/inc/wlan_p2p_off_chan_tx.h rename to umac/p2p/core/src/wlan_p2p_off_chan_tx.h diff --git a/umac/p2p/core/src/wlan_p2p_roc.c b/umac/p2p/core/src/wlan_p2p_roc.c index 29399c4007dd..62fcb2f21d90 100644 --- a/umac/p2p/core/src/wlan_p2p_roc.c +++ b/umac/p2p/core/src/wlan_p2p_roc.c @@ -20,7 +20,7 @@ * DOC: This file contains RoC API definitions */ -#include "../inc/wlan_p2p_roc.h" +#include "wlan_p2p_roc.h" QDF_STATUS p2p_process_roc_req(struct p2p_roc_context *roc_ctx) { diff --git a/umac/p2p/core/inc/wlan_p2p_roc.h b/umac/p2p/core/src/wlan_p2p_roc.h similarity index 98% rename from umac/p2p/core/inc/wlan_p2p_roc.h rename to umac/p2p/core/src/wlan_p2p_roc.h index b166d7ae35bf..af733c0673ff 100644 --- a/umac/p2p/core/inc/wlan_p2p_roc.h +++ b/umac/p2p/core/src/wlan_p2p_roc.h @@ -122,13 +122,13 @@ QDF_STATUS p2p_process_cancel_roc_req( /** * p2p_scan_event_cb() - Process scan event * @vdev: vdev associated to this scan event - * @event: event type + * @event: event information * @arg: registered arguments * * This function handles P2P scan event and deliver P2P event to HDD * layer by registered callback. * - * Return: QDF_STATUS_SUCCESS - in case of success + * Return: None */ void p2p_scan_event_cb(struct wlan_objmgr_vdev *vdev, struct scan_event *event, void *arg); diff --git a/umac/p2p/dispatcher/inc/wlan_p2p_public_struct.h b/umac/p2p/dispatcher/inc/wlan_p2p_public_struct.h index 97bd3b305a60..c17d5a940156 100644 --- a/umac/p2p/dispatcher/inc/wlan_p2p_public_struct.h +++ b/umac/p2p/dispatcher/inc/wlan_p2p_public_struct.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved. + * 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 @@ -25,6 +25,8 @@ #include +#define P2P_MAX_NOA_DESC 4 + /** * struct p2p_roc_req - P2P roc request * @vdev_id: Vdev id on which this request has come @@ -171,7 +173,7 @@ struct p2p_lo_start { /** * struct p2p_lo_event - * @vdev_id: Vdev id + * @vdev_id: vdev id * @reason_code: reason code */ struct p2p_lo_event { @@ -179,4 +181,36 @@ struct p2p_lo_event { uint32_t reason_code; }; +/** + * struct noa_descriptor - noa descriptor + * @type_count: 255: continuous schedule, 0: reserved + * @duration: Absent period duration in micro seconds + * @interval: Absent period interval in micro seconds + * @start_time: 32 bit tsf time when in starts + */ +struct noa_descriptor { + uint32_t type_count; + uint32_t duration; + uint32_t interval; + uint32_t start_time; +}; + +/** + * struct p2p_noa_info - p2p noa information + * @index: identifies instance of NOA su element + * @opps_ps: opps ps state of the AP + * @ct_window: ct window in TUs + * @vdev_id: vdev id + * @num_descriptors: number of NOA descriptors + * @noa_desc: noa descriptors + */ +struct p2p_noa_info { + uint32_t index; + uint32_t opps_ps; + uint32_t ct_window; + uint32_t vdev_id; + uint32_t num_desc; + struct noa_descriptor noa_desc[P2P_MAX_NOA_DESC]; +}; + #endif /* _WLAN_P2P_PUBLIC_STRUCT_H_ */ diff --git a/umac/p2p/dispatcher/inc/wlan_p2p_tgt_api.h b/umac/p2p/dispatcher/inc/wlan_p2p_tgt_api.h index 133443ca3f1f..b5dc946ac92b 100644 --- a/umac/p2p/dispatcher/inc/wlan_p2p_tgt_api.h +++ b/umac/p2p/dispatcher/inc/wlan_p2p_tgt_api.h @@ -28,20 +28,23 @@ struct scan_event; struct wlan_objmgr_psoc; struct wlan_objmgr_peer; +struct p2p_noa_info; +struct p2p_lo_event; +struct mgmt_rx_event_params; enum mgmt_frame_type; /** * tgt_p2p_scan_event_cb() - Callback for scan event - * @vdev: vdev id - * @event: event type + * @vdev: vdev object + * @event: event information * @arg: registered arguments * * This function gets called from scan component when getting P2P * scan event. * - * Return: QDF_STATUS_SUCCESS - in case of success + * Return: None */ -QDF_STATUS tgt_p2p_scan_event_cb(uint8_t vdev, +void tgt_p2p_scan_event_cb(struct wlan_objmgr_vdev *vdev, struct scan_event *event, void *arg); /** @@ -79,7 +82,7 @@ QDF_STATUS tgt_p2p_mgmt_ota_comp_cb(void *context, qdf_nbuf_t buf, * @psoc: soc context * @peer: peer context * @buf: rx buffer - * @params: rx parameters + * @mgmt_rx_params: mgmt rx parameters * @frm_type: frame type * * This function gets called from mgmt tx/rx component when rx mgmt @@ -87,39 +90,32 @@ QDF_STATUS tgt_p2p_mgmt_ota_comp_cb(void *context, qdf_nbuf_t buf, * * Return: QDF_STATUS_SUCCESS - in case of success */ -QDF_STATUS tgt_p2p_mgmt_frame_rx_cb( - struct wlan_objmgr_psoc *psoc, - struct wlan_objmgr_peer *peer, - qdf_nbuf_t buf, void *params, +QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc, + struct wlan_objmgr_peer *peer, qdf_nbuf_t buf, + struct mgmt_rx_event_params *mgmt_rx_params, enum mgmt_frame_type frm_type); - /** * tgt_p2p_noa_event_cb() - Callback for noa event - * @data: - * @event_buf: event buffer - * @len: buffer length + * @psoc: soc object + * @event_info: noa event information * - * This function gets called from WMI when triggered WMI event - * WMI_P2P_NOA_EVENTID. + * This function gets called from target interface. * - * Return: 0 - success - * others - failure + * Return: QDF_STATUS_SUCCESS - in case of success */ -int tgt_p2p_noa_event_cb(void *data, uint8_t *event_buf, - uint32_t len); +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 - * @data: - * @event_buf: event buffer - * @len: buffer length + * @psoc: soc object + * @event_info: lo stop event buffer * - * This function gets called from WMI when triggered WMI event - * WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID. + * This function gets called from target interface. * - * Return: 0 - success - * others - failure + * Return: QDF_STATUS_SUCCESS - in case of success */ -int tgt_p2p_lo_event_cb(void *data, uint8_t *event_buf, uint32_t len); +QDF_STATUS tgt_p2p_lo_event_cb(struct wlan_objmgr_psoc *psoc, + struct p2p_lo_event *event_info); #endif /* _WLAN_P2P_TGT_API_H_ */ diff --git a/umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c b/umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c index d22b325d06c1..b87af0bed613 100644 --- a/umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c +++ b/umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c @@ -22,15 +22,14 @@ #include #include +#include #include "wlan_p2p_tgt_api.h" -#include "../../core/inc/wlan_p2p_main.h" +#include "wlan_p2p_public_struct.h" +#include "../../core/src/wlan_p2p_main.h" -QDF_STATUS tgt_p2p_scan_event_cb(uint8_t vdev, +void tgt_p2p_scan_event_cb(struct wlan_objmgr_vdev *vdev, struct scan_event *event, void *arg) { - /* call p2p_process_scan_event directly*/ - /* since this is from target thread */ - return QDF_STATUS_SUCCESS; } QDF_STATUS tgt_p2p_mgmt_download_comp_cb(void *context, @@ -45,22 +44,22 @@ QDF_STATUS tgt_p2p_mgmt_ota_comp_cb(void *context, qdf_nbuf_t buf, return QDF_STATUS_SUCCESS; } -QDF_STATUS tgt_p2p_mgmt_frame_rx_cb( - struct wlan_objmgr_psoc *psoc, - struct wlan_objmgr_peer *peer, - qdf_nbuf_t buf, void *params, +QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc, + struct wlan_objmgr_peer *peer, qdf_nbuf_t buf, + struct mgmt_rx_event_params *mgmt_rx_params, enum mgmt_frame_type frm_type) { return QDF_STATUS_SUCCESS; } -int tgt_p2p_noa_event_cb(void *data, uint8_t *event_buf, - uint32_t len) +QDF_STATUS tgt_p2p_noa_event_cb(struct wlan_objmgr_psoc *psoc, + struct p2p_noa_info *event_info) { - return 0; + return QDF_STATUS_SUCCESS; } -int tgt_p2p_lo_event_cb(void *data, uint8_t *event_buf, uint32_t len) +QDF_STATUS tgt_p2p_lo_event_cb(struct wlan_objmgr_psoc *psoc, + struct p2p_lo_event *event_info) { - return 0; + return QDF_STATUS_SUCCESS; } diff --git a/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c b/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c index 8f2fd599f23e..86e98fcc5881 100644 --- a/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c +++ b/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c @@ -20,12 +20,12 @@ * DOC: This file contains p2p north bound interface definitions */ +#include #include +#include #include "wlan_p2p_ucfg_api.h" #include "wlan_p2p_public_struct.h" -#include "../../core/inc/wlan_p2p_main.h" -#include "../../core/inc/wlan_p2p_roc.h" -#include "../../core/inc/wlan_p2p_off_chan_tx.h" +#include "../../core/src/wlan_p2p_main.h" QDF_STATUS ucfg_p2p_init(void) { @@ -39,12 +39,12 @@ QDF_STATUS ucfg_p2p_deinit(void) QDF_STATUS ucfg_p2p_psoc_open(struct wlan_objmgr_psoc *soc) { - return p2p_psoc_open(soc); + return p2p_psoc_object_open(soc); } QDF_STATUS ucfg_p2p_psoc_close(struct wlan_objmgr_psoc *soc) { - return p2p_psoc_close(soc); + return p2p_psoc_object_close(soc); } QDF_STATUS ucfg_p2p_psoc_start(struct wlan_objmgr_psoc *soc,