From ddd2902b3224c17c94f93c00bcad7adde8c2ecb6 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Thu, 21 Oct 2021 15:54:49 +0800 Subject: [PATCH] qcacld-3.0: Use API p2p_status_update to update p2p conn status Refine p2p connection status update, use API p2p_status_update to update p2p connection status. Change-Id: Ica1b1cfc56c09e10664cd9130d5bfacc83e2763a CRs-Fixed: 3076205 --- p2p/core/src/wlan_p2p_main.c | 39 +++++++++++++++++------------ p2p/core/src/wlan_p2p_main.h | 10 ++++++++ p2p/core/src/wlan_p2p_off_chan_tx.c | 39 ++++++++++++++++++----------- 3 files changed, 58 insertions(+), 30 deletions(-) diff --git a/p2p/core/src/wlan_p2p_main.c b/p2p/core/src/wlan_p2p_main.c index 95f5696c25..f1ac4845f1 100644 --- a/p2p/core/src/wlan_p2p_main.c +++ b/p2p/core/src/wlan_p2p_main.c @@ -1307,6 +1307,13 @@ void p2p_peer_authorized(struct wlan_objmgr_vdev *vdev, uint8_t *mac_addr) } #ifdef WLAN_FEATURE_P2P_DEBUG + +void p2p_status_update(struct p2p_soc_priv_obj *p2p_soc_obj, + enum p2p_connection_status status) +{ + p2p_soc_obj->connection_status = status; +} + static struct p2p_soc_priv_obj * get_p2p_soc_obj_by_vdev(struct wlan_objmgr_vdev *vdev) { @@ -1355,14 +1362,14 @@ QDF_STATUS p2p_status_scan(struct wlan_objmgr_vdev *vdev) switch (p2p_soc_obj->connection_status) { case P2P_GO_NEG_COMPLETED: case P2P_GO_NEG_PROCESS: - p2p_soc_obj->connection_status = - P2P_CLIENT_CONNECTING_STATE_1; + p2p_status_update(p2p_soc_obj, + P2P_CLIENT_CONNECTING_STATE_1); p2p_debug("[P2P State] Changing state from Go nego completed to Connection is started"); p2p_debug("P2P Scanning is started for 8way Handshake"); break; case P2P_CLIENT_DISCONNECTED_STATE: - p2p_soc_obj->connection_status = - P2P_CLIENT_CONNECTING_STATE_2; + p2p_status_update(p2p_soc_obj, + P2P_CLIENT_CONNECTING_STATE_2); p2p_debug("[P2P State] Changing state from Disconnected state to Connection is started"); p2p_debug("P2P Scanning is started for 4way Handshake"); break; @@ -1391,8 +1398,8 @@ QDF_STATUS p2p_status_connect(struct wlan_objmgr_vdev *vdev) p2p_debug("connection status:%d", p2p_soc_obj->connection_status); switch (p2p_soc_obj->connection_status) { case P2P_CLIENT_CONNECTING_STATE_1: - p2p_soc_obj->connection_status = - P2P_CLIENT_CONNECTED_STATE_1; + p2p_status_update(p2p_soc_obj, + P2P_CLIENT_CONNECTED_STATE_1); p2p_debug("[P2P State] Changing state from Connecting state to Connected State for 8-way Handshake"); break; case P2P_CLIENT_DISCONNECTED_STATE: @@ -1403,8 +1410,8 @@ QDF_STATUS p2p_status_connect(struct wlan_objmgr_vdev *vdev) */ /* fallthrough */ case P2P_CLIENT_CONNECTING_STATE_2: - p2p_soc_obj->connection_status = - P2P_CLIENT_COMPLETED_STATE; + p2p_status_update(p2p_soc_obj, + P2P_CLIENT_COMPLETED_STATE); p2p_debug("[P2P State] Changing state from Connecting state to P2P Client Connection Completed"); break; default: @@ -1432,12 +1439,12 @@ QDF_STATUS p2p_status_disconnect(struct wlan_objmgr_vdev *vdev) p2p_debug("connection status:%d", p2p_soc_obj->connection_status); switch (p2p_soc_obj->connection_status) { case P2P_CLIENT_CONNECTED_STATE_1: - p2p_soc_obj->connection_status = - P2P_CLIENT_DISCONNECTED_STATE; + p2p_status_update(p2p_soc_obj, + P2P_CLIENT_DISCONNECTED_STATE); p2p_debug("[P2P State] 8 way Handshake completed and moved to disconnected state"); break; case P2P_CLIENT_COMPLETED_STATE: - p2p_soc_obj->connection_status = P2P_NOT_ACTIVE; + p2p_status_update(p2p_soc_obj, P2P_NOT_ACTIVE); p2p_debug("[P2P State] P2P Client is removed and moved to inactive state"); break; default: @@ -1467,13 +1474,13 @@ QDF_STATUS p2p_status_start_bss(struct wlan_objmgr_vdev *vdev) p2p_debug("connection status:%d", p2p_soc_obj->connection_status); switch (p2p_soc_obj->connection_status) { case P2P_GO_NEG_COMPLETED: - p2p_soc_obj->connection_status = - P2P_GO_COMPLETED_STATE; + p2p_status_update(p2p_soc_obj, + P2P_GO_COMPLETED_STATE); p2p_debug("[P2P State] From Go nego completed to Non-autonomous Group started"); break; case P2P_NOT_ACTIVE: - p2p_soc_obj->connection_status = - P2P_GO_COMPLETED_STATE; + p2p_status_update(p2p_soc_obj, + P2P_GO_COMPLETED_STATE); p2p_debug("[P2P State] From Inactive to Autonomous Group started"); break; default: @@ -1502,7 +1509,7 @@ QDF_STATUS p2p_status_stop_bss(struct wlan_objmgr_vdev *vdev) p2p_debug("connection status:%d", p2p_soc_obj->connection_status); if (p2p_soc_obj->connection_status == P2P_GO_COMPLETED_STATE) { - p2p_soc_obj->connection_status = P2P_NOT_ACTIVE; + p2p_status_update(p2p_soc_obj, P2P_NOT_ACTIVE); p2p_debug("[P2P State] From GO completed to Inactive state GO got removed"); } diff --git a/p2p/core/src/wlan_p2p_main.h b/p2p/core/src/wlan_p2p_main.h index 09f4966865..20295c890b 100644 --- a/p2p/core/src/wlan_p2p_main.h +++ b/p2p/core/src/wlan_p2p_main.h @@ -190,6 +190,16 @@ enum p2p_connection_status { P2P_CLIENT_CONNECTING_STATE_2, P2P_CLIENT_COMPLETED_STATE }; + +/** + * p2p_status_update() - Update p2p connection status + * @p2p_soc_obj: p2p priv object + * @status: p2p connection status + * + * Return: void + */ +void p2p_status_update(struct p2p_soc_priv_obj *p2p_soc_obj, + enum p2p_connection_status status); #endif /** diff --git a/p2p/core/src/wlan_p2p_off_chan_tx.c b/p2p/core/src/wlan_p2p_off_chan_tx.c index cba349b5cc..73c1b072f3 100644 --- a/p2p/core/src/wlan_p2p_off_chan_tx.c +++ b/p2p/core/src/wlan_p2p_off_chan_tx.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -875,15 +876,20 @@ static QDF_STATUS p2p_tx_update_connection_status( QDF_MAC_ADDR_REF(mac_to)); if ((tx_frame_info->public_action_type == - P2P_PUBLIC_ACTION_PROV_DIS_REQ) && - (p2p_soc_obj->connection_status == P2P_NOT_ACTIVE)) { - p2p_soc_obj->connection_status = P2P_GO_NEG_PROCESS; + P2P_PUBLIC_ACTION_PROV_DIS_REQ) || + (tx_frame_info->public_action_type == + P2P_PUBLIC_ACTION_INVIT_REQ) || + (tx_frame_info->public_action_type == + P2P_PUBLIC_ACTION_NEG_REQ) || + (tx_frame_info->public_action_type == + P2P_PUBLIC_ACTION_NEG_RSP)) { + p2p_status_update(p2p_soc_obj, P2P_GO_NEG_PROCESS); p2p_debug("[P2P State]Inactive state to GO negotiation progress state"); } else if ((tx_frame_info->public_action_type == - P2P_PUBLIC_ACTION_NEG_CNF) && - (p2p_soc_obj->connection_status == - P2P_GO_NEG_PROCESS)) { - p2p_soc_obj->connection_status = P2P_GO_NEG_COMPLETED; + P2P_PUBLIC_ACTION_NEG_CNF) || + (tx_frame_info->public_action_type == + P2P_PUBLIC_ACTION_INVIT_RSP)) { + p2p_status_update(p2p_soc_obj, P2P_GO_NEG_COMPLETED); p2p_debug("[P2P State]GO nego progress to GO nego completed state"); } @@ -919,20 +925,25 @@ static QDF_STATUS p2p_rx_update_connection_status( QDF_MAC_ADDR_REF(mac_from)); if ((rx_frame_info->public_action_type == - P2P_PUBLIC_ACTION_PROV_DIS_REQ) && - (p2p_soc_obj->connection_status == P2P_NOT_ACTIVE)) { - p2p_soc_obj->connection_status = P2P_GO_NEG_PROCESS; + P2P_PUBLIC_ACTION_PROV_DIS_REQ) || + (rx_frame_info->public_action_type == + P2P_PUBLIC_ACTION_NEG_REQ) || + (rx_frame_info->public_action_type == + P2P_PUBLIC_ACTION_NEG_RSP)) { + p2p_status_update(p2p_soc_obj, P2P_GO_NEG_PROCESS); p2p_info("[P2P State]Inactive state to GO negotiation progress state"); - } else if ((rx_frame_info->public_action_type == - P2P_PUBLIC_ACTION_NEG_CNF) && + } else if (((rx_frame_info->public_action_type == + P2P_PUBLIC_ACTION_NEG_CNF) || + (rx_frame_info->public_action_type == + P2P_PUBLIC_ACTION_INVIT_RSP)) && (p2p_soc_obj->connection_status == P2P_GO_NEG_PROCESS)) { - p2p_soc_obj->connection_status = P2P_GO_NEG_COMPLETED; + p2p_status_update(p2p_soc_obj, P2P_GO_NEG_COMPLETED); p2p_info("[P2P State]GO negotiation progress to GO negotiation completed state"); } else if ((rx_frame_info->public_action_type == P2P_PUBLIC_ACTION_INVIT_REQ) && (p2p_soc_obj->connection_status == P2P_NOT_ACTIVE)) { - p2p_soc_obj->connection_status = P2P_GO_NEG_COMPLETED; + p2p_status_update(p2p_soc_obj, P2P_GO_NEG_COMPLETED); p2p_info("[P2P State]Inactive state to GO negotiation completed state Autonomous GO formation"); }