From cde63cdd017ea60177c2c363fb79398b5aa0697f Mon Sep 17 00:00:00 2001 From: Disha Das Date: Tue, 10 Dec 2019 10:21:16 +0530 Subject: [PATCH] qcacmn: Obtain current PN number for a peer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On rekey, the STA resets it’s PN to 0 but, the AP sends out pending traffic with old PN values before it resets the PN as well. This causes traffic to stall and hence, TSC (transmit sequence counter) should not be set to zero during rekey. Instead, obtain last PN number for a non-bss peer while configuring new key and pass the values to hostap. Change-Id: I4a604f23944c941c6ade2f57ab03781bc78f7b40 --- umac/cmn_services/crypto/inc/wlan_crypto_global_def.h | 5 +++++ umac/cmn_services/crypto/src/wlan_crypto_def_i.h | 2 ++ umac/cmn_services/crypto/src/wlan_crypto_global_api.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h b/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h index 34bea3450e89..607cc781d300 100644 --- a/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h +++ b/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h @@ -94,6 +94,8 @@ #define WLAN_CRYPTO_KEY_SWDECRYPT (0x100) /* host-based demic */ #define WLAN_CRYPTO_KEY_SWDEMIC (0x200) +/* get pn from fw for key */ +#define WLAN_CRYPTO_KEY_GET_PN (0x400) #define WLAN_CRYPTO_KEY_SWCRYPT (WLAN_CRYPTO_KEY_SWENCRYPT \ | WLAN_CRYPTO_KEY_SWDECRYPT) @@ -352,6 +354,7 @@ struct wlan_crypto_req_key { * @delkey: function pointer to delkey in hw * @defaultkey: function pointer to set default key * @set_key: converged function pointer to set key in hw + * @getpn: function pointer to get current pn value of peer */ struct wlan_lmac_if_crypto_tx_ops { @@ -369,6 +372,8 @@ struct wlan_lmac_if_crypto_tx_ops { QDF_STATUS (*set_key)(struct wlan_objmgr_vdev *vdev, struct wlan_crypto_key *key, enum wlan_crypto_key_type key_type); + QDF_STATUS(*getpn)(struct wlan_objmgr_vdev *vdev, + uint8_t *macaddr, uint32_t key_type); }; /** diff --git a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h index adfdb5f29270..e08968bd99ad 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h +++ b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h @@ -171,6 +171,8 @@ static inline void wlan_crypto_put_be64(u8 *a, u64 val) (psoc->soc_cb.tx_ops.crypto_tx_ops.defaultkey) #define WLAN_CRYPTO_TX_OPS_SET_KEY(psoc) \ ((psoc)->soc_cb.tx_ops.crypto_tx_ops.set_key) +#define WLAN_CRYPTO_TX_OPS_GETPN(psoc) \ + ((psoc)->soc_cb.tx_ops.crypto_tx_ops.getpn) /* unalligned little endian access */ #ifndef LE_READ_2 diff --git a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c index 4087c4cfd2ef..22793fd0ce4b 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c +++ b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c @@ -968,6 +968,10 @@ QDF_STATUS wlan_crypto_getkey(struct wlan_objmgr_vdev *vdev, return QDF_STATUS_E_NOENT; } key = wlan_crypto_peer_getkey(peer, req_key->keyix); + if (WLAN_CRYPTO_TX_OPS_GETPN(psoc) && + (req_key->flags & WLAN_CRYPTO_KEY_GET_PN)) + WLAN_CRYPTO_TX_OPS_GETPN(psoc)(vdev, mac_addr, + req_key->type); wlan_objmgr_peer_release_ref(peer, WLAN_CRYPTO_ID); if (!key) return QDF_STATUS_E_INVAL;