From c5665daa14ac4585f344018ab349a462cfa417cb Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Thu, 11 Jan 2024 12:36:15 +0530 Subject: [PATCH 1/2] [nrf fromtree] net: mgmt: Update app of TWT teardown status Update user/app status of TWT teardown sessions. Signed-off-by: Ajay Parida (cherry picked from commit 3053484dcb646066fe738050d9d5e4c314f1235f) --- include/zephyr/net/wifi.h | 8 ++++++++ include/zephyr/net/wifi_mgmt.h | 2 ++ subsys/net/l2/wifi/wifi_shell.c | 9 +++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index 5c7d5b493fa..c49d6ad0f66 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -345,6 +345,14 @@ enum wifi_twt_fail_reason { WIFI_TWT_FAIL_FLOW_ALREADY_EXISTS, }; +/** Wi-Fi Target Wake Time (TWT) teradown status. */ +enum wifi_twt_teardown_status { + /** TWT teardown success */ + WIFI_TWT_TEARDOWN_SUCCESS = 0, + /** TWT teardown failure */ + WIFI_TWT_TEARDOWN_FAILED, +}; + /** @cond INTERNAL_HIDDEN */ static const char * const wifi_twt_err_code_tbl[] = { [WIFI_TWT_FAIL_UNSPECIFIED] = "Unspecified", diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index f6ae631a830..0c64cab3c01 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -470,6 +470,8 @@ struct wifi_twt_params { enum wifi_twt_setup_cmd setup_cmd; /** TWT setup response status, see enum wifi_twt_setup_resp_status */ enum wifi_twt_setup_resp_status resp_status; + /** TWT teardown cmd status, see enum wifi_twt_teardown_status */ + enum wifi_twt_teardown_status teardown_status; /** Dialog token, used to map requests to responses */ uint8_t dialog_token; /** Flow ID, used to map setup with teardown */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1f13ae864ae..44f507f6e02 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -293,8 +293,13 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) (const struct wifi_twt_params *)cb->info; if (resp->operation == WIFI_TWT_TEARDOWN) { - print(context.sh, SHELL_NORMAL, "TWT teardown received for flow ID %d\n", - resp->flow_id); + if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { + print(context.sh, SHELL_NORMAL, "TWT teardown received for flow ID %d\n", + resp->flow_id); + } else { + print(context.sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", + resp->flow_id); + } return; } From cb346cbe131a0570eae9eca8dcddefb5c5911357 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Wed, 17 Jan 2024 14:49:00 +0530 Subject: [PATCH 2/2] [nrf fromtree] net: mgmt: Print correct TWT teardown status message Print success message for TWT teardown successful case. Signed-off-by: Ajay Parida (cherry picked from commit 4d854a193e4958659669afadad621f86636b0bff) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 44f507f6e02..70b4f96d861 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -294,7 +294,7 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) if (resp->operation == WIFI_TWT_TEARDOWN) { if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { - print(context.sh, SHELL_NORMAL, "TWT teardown received for flow ID %d\n", + print(context.sh, SHELL_NORMAL, "TWT teardown succeeded for flow ID %d\n", resp->flow_id); } else { print(context.sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n",