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
This commit is contained in:
Liangwei Dong
2021-10-21 15:54:49 +08:00
committed by Madan Koyyalamudi
parent 07418820cd
commit ddd2902b32
3 changed files with 58 additions and 30 deletions

View File

@@ -1307,6 +1307,13 @@ void p2p_peer_authorized(struct wlan_objmgr_vdev *vdev, uint8_t *mac_addr)
} }
#ifdef WLAN_FEATURE_P2P_DEBUG #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 * static struct p2p_soc_priv_obj *
get_p2p_soc_obj_by_vdev(struct wlan_objmgr_vdev *vdev) 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) { switch (p2p_soc_obj->connection_status) {
case P2P_GO_NEG_COMPLETED: case P2P_GO_NEG_COMPLETED:
case P2P_GO_NEG_PROCESS: case P2P_GO_NEG_PROCESS:
p2p_soc_obj->connection_status = p2p_status_update(p2p_soc_obj,
P2P_CLIENT_CONNECTING_STATE_1; P2P_CLIENT_CONNECTING_STATE_1);
p2p_debug("[P2P State] Changing state from Go nego completed to Connection is started"); p2p_debug("[P2P State] Changing state from Go nego completed to Connection is started");
p2p_debug("P2P Scanning is started for 8way Handshake"); p2p_debug("P2P Scanning is started for 8way Handshake");
break; break;
case P2P_CLIENT_DISCONNECTED_STATE: case P2P_CLIENT_DISCONNECTED_STATE:
p2p_soc_obj->connection_status = p2p_status_update(p2p_soc_obj,
P2P_CLIENT_CONNECTING_STATE_2; P2P_CLIENT_CONNECTING_STATE_2);
p2p_debug("[P2P State] Changing state from Disconnected state to Connection is started"); p2p_debug("[P2P State] Changing state from Disconnected state to Connection is started");
p2p_debug("P2P Scanning is started for 4way Handshake"); p2p_debug("P2P Scanning is started for 4way Handshake");
break; 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); p2p_debug("connection status:%d", p2p_soc_obj->connection_status);
switch (p2p_soc_obj->connection_status) { switch (p2p_soc_obj->connection_status) {
case P2P_CLIENT_CONNECTING_STATE_1: case P2P_CLIENT_CONNECTING_STATE_1:
p2p_soc_obj->connection_status = p2p_status_update(p2p_soc_obj,
P2P_CLIENT_CONNECTED_STATE_1; P2P_CLIENT_CONNECTED_STATE_1);
p2p_debug("[P2P State] Changing state from Connecting state to Connected State for 8-way Handshake"); p2p_debug("[P2P State] Changing state from Connecting state to Connected State for 8-way Handshake");
break; break;
case P2P_CLIENT_DISCONNECTED_STATE: case P2P_CLIENT_DISCONNECTED_STATE:
@@ -1403,8 +1410,8 @@ QDF_STATUS p2p_status_connect(struct wlan_objmgr_vdev *vdev)
*/ */
/* fallthrough */ /* fallthrough */
case P2P_CLIENT_CONNECTING_STATE_2: case P2P_CLIENT_CONNECTING_STATE_2:
p2p_soc_obj->connection_status = p2p_status_update(p2p_soc_obj,
P2P_CLIENT_COMPLETED_STATE; P2P_CLIENT_COMPLETED_STATE);
p2p_debug("[P2P State] Changing state from Connecting state to P2P Client Connection Completed"); p2p_debug("[P2P State] Changing state from Connecting state to P2P Client Connection Completed");
break; break;
default: 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); p2p_debug("connection status:%d", p2p_soc_obj->connection_status);
switch (p2p_soc_obj->connection_status) { switch (p2p_soc_obj->connection_status) {
case P2P_CLIENT_CONNECTED_STATE_1: case P2P_CLIENT_CONNECTED_STATE_1:
p2p_soc_obj->connection_status = p2p_status_update(p2p_soc_obj,
P2P_CLIENT_DISCONNECTED_STATE; P2P_CLIENT_DISCONNECTED_STATE);
p2p_debug("[P2P State] 8 way Handshake completed and moved to disconnected state"); p2p_debug("[P2P State] 8 way Handshake completed and moved to disconnected state");
break; break;
case P2P_CLIENT_COMPLETED_STATE: 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"); p2p_debug("[P2P State] P2P Client is removed and moved to inactive state");
break; break;
default: 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); p2p_debug("connection status:%d", p2p_soc_obj->connection_status);
switch (p2p_soc_obj->connection_status) { switch (p2p_soc_obj->connection_status) {
case P2P_GO_NEG_COMPLETED: case P2P_GO_NEG_COMPLETED:
p2p_soc_obj->connection_status = p2p_status_update(p2p_soc_obj,
P2P_GO_COMPLETED_STATE; P2P_GO_COMPLETED_STATE);
p2p_debug("[P2P State] From Go nego completed to Non-autonomous Group started"); p2p_debug("[P2P State] From Go nego completed to Non-autonomous Group started");
break; break;
case P2P_NOT_ACTIVE: case P2P_NOT_ACTIVE:
p2p_soc_obj->connection_status = p2p_status_update(p2p_soc_obj,
P2P_GO_COMPLETED_STATE; P2P_GO_COMPLETED_STATE);
p2p_debug("[P2P State] From Inactive to Autonomous Group started"); p2p_debug("[P2P State] From Inactive to Autonomous Group started");
break; break;
default: 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); p2p_debug("connection status:%d", p2p_soc_obj->connection_status);
if (p2p_soc_obj->connection_status == P2P_GO_COMPLETED_STATE) { 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"); p2p_debug("[P2P State] From GO completed to Inactive state GO got removed");
} }

View File

@@ -190,6 +190,16 @@ enum p2p_connection_status {
P2P_CLIENT_CONNECTING_STATE_2, P2P_CLIENT_CONNECTING_STATE_2,
P2P_CLIENT_COMPLETED_STATE 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 #endif
/** /**

View File

@@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. * 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 * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * 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)); QDF_MAC_ADDR_REF(mac_to));
if ((tx_frame_info->public_action_type == if ((tx_frame_info->public_action_type ==
P2P_PUBLIC_ACTION_PROV_DIS_REQ) && P2P_PUBLIC_ACTION_PROV_DIS_REQ) ||
(p2p_soc_obj->connection_status == P2P_NOT_ACTIVE)) { (tx_frame_info->public_action_type ==
p2p_soc_obj->connection_status = P2P_GO_NEG_PROCESS; 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"); p2p_debug("[P2P State]Inactive state to GO negotiation progress state");
} else if ((tx_frame_info->public_action_type == } else if ((tx_frame_info->public_action_type ==
P2P_PUBLIC_ACTION_NEG_CNF) && P2P_PUBLIC_ACTION_NEG_CNF) ||
(p2p_soc_obj->connection_status == (tx_frame_info->public_action_type ==
P2P_GO_NEG_PROCESS)) { P2P_PUBLIC_ACTION_INVIT_RSP)) {
p2p_soc_obj->connection_status = P2P_GO_NEG_COMPLETED; p2p_status_update(p2p_soc_obj, P2P_GO_NEG_COMPLETED);
p2p_debug("[P2P State]GO nego progress to GO nego completed state"); 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)); QDF_MAC_ADDR_REF(mac_from));
if ((rx_frame_info->public_action_type == if ((rx_frame_info->public_action_type ==
P2P_PUBLIC_ACTION_PROV_DIS_REQ) && P2P_PUBLIC_ACTION_PROV_DIS_REQ) ||
(p2p_soc_obj->connection_status == P2P_NOT_ACTIVE)) { (rx_frame_info->public_action_type ==
p2p_soc_obj->connection_status = P2P_GO_NEG_PROCESS; 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"); p2p_info("[P2P State]Inactive state to GO negotiation progress state");
} else if ((rx_frame_info->public_action_type == } else if (((rx_frame_info->public_action_type ==
P2P_PUBLIC_ACTION_NEG_CNF) && P2P_PUBLIC_ACTION_NEG_CNF) ||
(rx_frame_info->public_action_type ==
P2P_PUBLIC_ACTION_INVIT_RSP)) &&
(p2p_soc_obj->connection_status == (p2p_soc_obj->connection_status ==
P2P_GO_NEG_PROCESS)) { 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"); p2p_info("[P2P State]GO negotiation progress to GO negotiation completed state");
} else if ((rx_frame_info->public_action_type == } else if ((rx_frame_info->public_action_type ==
P2P_PUBLIC_ACTION_INVIT_REQ) && P2P_PUBLIC_ACTION_INVIT_REQ) &&
(p2p_soc_obj->connection_status == P2P_NOT_ACTIVE)) { (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"); p2p_info("[P2P State]Inactive state to GO negotiation completed state Autonomous GO formation");
} }