From 99a58d3b1a700c5dec44e0efe96afcc5ceb52159 Mon Sep 17 00:00:00 2001 From: Gyanranjan Hazarika Date: Fri, 22 Dec 2017 21:56:17 -0800 Subject: [PATCH] qcacmn: Add support for setaddbaresp cmd for HE Addba recieve/response logic has been implemented in host for HE instead of in FW like VHT. setaddbaresp is not hooked to the dp module yet to set the addba response from userspace. Implement the required logic for HE to support this command. Change-Id: I49cceca299db06d41f2cafa690f5ba59e01f1f4a CRs-fixed: 2163475 --- dp/inc/cdp_txrx_cmn.h | 19 ++++++++++++++++++- dp/inc/cdp_txrx_ops.h | 3 +++ dp/wifi3.0/dp_internal.h | 2 ++ dp/wifi3.0/dp_main.c | 1 + dp/wifi3.0/dp_peer.c | 24 ++++++++++++++++++++++-- dp/wifi3.0/dp_types.h | 4 +++- 6 files changed, 49 insertions(+), 4 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index f58fac3737a6..19fdab259a1e 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -773,6 +773,23 @@ static inline int cdp_delba_process(ol_txrx_soc_handle soc, tid, reasoncode); } +static inline void cdp_set_addbaresponse(ol_txrx_soc_handle soc, + void *peer_handle, int tid, uint16_t statuscode) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->set_addba_response) + return; + + soc->ops->cmn_drv_ops->set_addba_response(peer_handle, tid, statuscode); +} + /** * cdp_get_peer_mac_addr_frm_id: function to return vdev id and and peer * mac address diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index f0fee7f235f8..69b41765a025 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -198,6 +198,9 @@ struct cdp_cmn_ops { int (*delba_process)(void *peer_handle, int tid, uint16_t reasoncode); + void (*set_addba_response)(void *peer_handle, + uint8_t tid, uint16_t statuscode); + uint8_t (*get_peer_mac_addr_frm_id)(struct cdp_soc_t *soc_handle, uint16_t peer_id, uint8_t *mac_addr); diff --git a/dp/wifi3.0/dp_internal.h b/dp/wifi3.0/dp_internal.h index 09db1a95028e..55fe7ecb8ffd 100644 --- a/dp/wifi3.0/dp_internal.h +++ b/dp/wifi3.0/dp_internal.h @@ -351,6 +351,8 @@ extern int dp_addba_requestprocess_wifi3(void *peer_handle, extern void dp_addba_responsesetup_wifi3(void *peer_handle, uint8_t tid, uint8_t *dialogtoken, uint16_t *statuscode, uint16_t *buffersize, uint16_t *batimeout); +extern void dp_set_addba_response(void *peer_handle, uint8_t tid, + uint16_t statuscode); extern int dp_delba_process_wifi3(void *peer_handle, int tid, uint16_t reasoncode); diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 8e863e811984..5780ae6d9328 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -5895,6 +5895,7 @@ static struct cdp_cmn_ops dp_ops_cmn = { .addba_requestprocess = dp_addba_requestprocess_wifi3, .addba_responsesetup = dp_addba_responsesetup_wifi3, .delba_process = dp_delba_process_wifi3, + .set_addba_response = dp_set_addba_response, .get_peer_mac_addr_frm_id = dp_get_peer_mac_addr_frm_id, .flush_cache_rx_queue = NULL, /* TODO: get API's for dscp-tid need to be added*/ diff --git a/dp/wifi3.0/dp_peer.c b/dp/wifi3.0/dp_peer.c index e4ac50e44ba1..686b976061ca 100644 --- a/dp/wifi3.0/dp_peer.c +++ b/dp/wifi3.0/dp_peer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-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 @@ -1392,9 +1392,13 @@ int dp_addba_requestprocess_wifi3(void *peer_handle, return QDF_STATUS_E_FAILURE; } + if (rx_tid->userstatuscode != IEEE80211_STATUS_SUCCESS) + rx_tid->statuscode = rx_tid->userstatuscode; + else + rx_tid->statuscode = IEEE80211_STATUS_SUCCESS; + rx_tid->ba_win_size = buffersize; rx_tid->dialogtoken = dialogtoken; - rx_tid->statuscode = QDF_STATUS_SUCCESS; rx_tid->ba_status = DP_RX_BA_ACTIVE; rx_tid->num_of_addba_req++; @@ -1426,6 +1430,22 @@ void dp_addba_responsesetup_wifi3(void *peer_handle, uint8_t tid, *batimeout = 0; } +/* +* dp_set_addba_response() – Set a user defined ADDBA response status code +* +* @peer: Datapath peer handle +* @tid: TID number +* @statuscode: response status code to be set +*/ +void dp_set_addba_response(void *peer_handle, uint8_t tid, + uint16_t statuscode) +{ + struct dp_peer *peer = (struct dp_peer *)peer_handle; + struct dp_rx_tid *rx_tid = &peer->rx_tid[tid]; + + rx_tid->userstatuscode = statuscode; +} + /* * dp_rx_delba_process_wifi3() – Process DELBA from peer * @peer: Datapath peer handle diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 5b55699f3e49..f10a68afa561 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-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 @@ -443,6 +443,8 @@ struct dp_rx_tid { uint32_t defrag_timeout_ms; uint16_t dialogtoken; uint16_t statuscode; + /* user defined ADDBA response status code */ + uint16_t userstatuscode; }; /* per interrupt context */