diff --git a/core/src/wlan_p2p_main.c b/core/src/wlan_p2p_main.c index 32c9fb0b5b76..a09edbbc57e6 100644 --- a/core/src/wlan_p2p_main.c +++ b/core/src/wlan_p2p_main.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 @@ -820,6 +820,7 @@ QDF_STATUS p2p_psoc_object_open(struct wlan_objmgr_psoc *soc) } qdf_runtime_lock_init(&p2p_soc_obj->roc_runtime_lock); + p2p_soc_obj->cur_roc_vdev_id = P2P_INVALID_VDEV_ID; p2p_register_pmo_handler(); p2p_debug("p2p psoc object open successful"); diff --git a/core/src/wlan_p2p_main.h b/core/src/wlan_p2p_main.h index 17e6bedc0786..7f0950abb24b 100644 --- a/core/src/wlan_p2p_main.h +++ b/core/src/wlan_p2p_main.h @@ -32,6 +32,7 @@ #define MAX_QUEUE_LENGTH 20 #define P2P_NOA_ATTR_IND 0x1090 #define P2P_MODULE_NAME "P2P" +#define P2P_INVALID_VDEV_ID 0xFFFFFFFF #define p2p_log(level, args...) \ QDF_TRACE(QDF_MODULE_ID_P2P, level, ## args) @@ -167,6 +168,7 @@ enum p2p_connection_status { * @cancel_roc_done: Cancel roc done event * @roc_runtime_lock: Runtime lock for roc request * @p2p_cb: Callbacks to protocol stack + * @cur_roc_vdev_id: Vdev id of current roc * @connection_status:Global P2P connection status */ struct p2p_soc_priv_obj { @@ -179,6 +181,7 @@ struct p2p_soc_priv_obj { qdf_event_t cancel_roc_done; qdf_runtime_lock_t roc_runtime_lock; struct p2p_protocol_callbacks p2p_cb; + uint32_t cur_roc_vdev_id; #ifdef WLAN_FEATURE_P2P_DEBUG enum p2p_connection_status connection_status; #endif diff --git a/core/src/wlan_p2p_roc.c b/core/src/wlan_p2p_roc.c index d2d94d453d6c..bfc7bd184cf6 100644 --- a/core/src/wlan_p2p_roc.c +++ b/core/src/wlan_p2p_roc.c @@ -380,7 +380,8 @@ fail: return status; } - status = p2p_mgmt_rx_ops(roc_ctx->p2p_soc_obj->soc, true); + p2p_soc_obj->cur_roc_vdev_id = roc_ctx->vdev_id; + status = p2p_mgmt_rx_ops(p2p_soc_obj->soc, true); if (status != QDF_STATUS_SUCCESS) p2p_err("Failed to register mgmt rx callback, status:%d", status); @@ -520,6 +521,7 @@ static QDF_STATUS p2p_process_scan_complete_evt( p2p_err("Failed to destroy roc timer"); status = p2p_mgmt_rx_ops(p2p_soc_obj->soc, false); + p2p_soc_obj->cur_roc_vdev_id = P2P_INVALID_VDEV_ID; if (status != QDF_STATUS_SUCCESS) p2p_err("Failed to deregister mgmt rx callback"); diff --git a/dispatcher/src/wlan_p2p_tgt_api.c b/dispatcher/src/wlan_p2p_tgt_api.c index 84cd4673a50d..1762cf2b7618 100644 --- a/dispatcher/src/wlan_p2p_tgt_api.c +++ b/dispatcher/src/wlan_p2p_tgt_api.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 @@ -185,9 +185,7 @@ QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc, struct p2p_rx_mgmt_event *rx_mgmt_event; struct p2p_soc_priv_obj *p2p_soc_obj; struct scheduler_msg msg = {0}; - struct wlan_frame_hdr *wh; struct wlan_objmgr_vdev *vdev; - struct p2p_roc_context *roc_ctx; uint32_t vdev_id; uint8_t *pdata; @@ -208,13 +206,12 @@ QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc, } if (!peer) { - roc_ctx = p2p_find_current_roc_ctx(p2p_soc_obj); - if (!roc_ctx) { - p2p_err("current roc ctx is null, can't get vdev id"); + if (p2p_soc_obj->cur_roc_vdev_id == P2P_INVALID_VDEV_ID) { + p2p_err("vdev id of current roc invalid"); qdf_nbuf_free(buf); return QDF_STATUS_E_FAILURE; } else { - vdev_id = roc_ctx->vdev_id; + vdev_id = p2p_soc_obj->cur_roc_vdev_id; } } else { vdev = wlan_peer_get_vdev(peer); @@ -241,7 +238,6 @@ QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_NOMEM; } - wh = (struct wlan_frame_hdr *)qdf_nbuf_data(buf); pdata = (uint8_t *)qdf_nbuf_data(buf); rx_mgmt->frame_len = mgmt_rx_params->buf_len; rx_mgmt->rx_chan = mgmt_rx_params->channel;