qcacmn: Add crypto api's for individual link

Currently crypto module is using vdev to get
and delete the crypto key, However there is a need to get
and delete the crypto key based on psoc level.
The change is to use psoc handler for retrieving and deleting
the key.
Change-Id: I4fcf0fd5c7d9d5a579c092c43117594f7d9fc6a3
CRs-Fixed: 3561978
This commit is contained in:
Aasir Rasheed
2023-07-17 18:38:59 +05:30
کامیت شده توسط Rahul Choudhary
والد 0c2398d0c5
کامیت cc94ae4317
4فایلهای تغییر یافته به همراه134 افزوده شده و 2 حذف شده

مشاهده پرونده

@@ -896,7 +896,7 @@ QDF_STATUS
wlan_crypto_save_ml_sta_key(struct wlan_objmgr_psoc *psoc,
uint8_t key_index,
struct wlan_crypto_key *crypto_key,
struct qdf_mac_addr *link_addr, int8_t link_id);
struct qdf_mac_addr *link_addr, uint8_t link_id);
/**
* wlan_crypto_save_key() - Allocate memory for storing key
@@ -910,6 +910,19 @@ QDF_STATUS wlan_crypto_save_key(struct wlan_objmgr_vdev *vdev,
uint8_t key_index,
struct wlan_crypto_key *crypto_key);
/**
* wlan_crypto_get_ml_sta_link_key() - Get the stored key info
* by link id
* @psoc: psoc handler
* @key_index: key index
* @link_addr: link address
* @link_id: link id
*/
struct wlan_crypto_key *wlan_crypto_get_ml_sta_link_key(
struct wlan_objmgr_psoc *psoc,
uint8_t key_index,
struct qdf_mac_addr *link_addr,
uint8_t link_id);
/**
* wlan_crypto_get_key() - Get the stored key information
* @vdev: vdev object

مشاهده پرونده

@@ -650,4 +650,15 @@ wlan_crypto_key_entry * crypto_hash_find_by_linkid_and_macaddr(
struct crypto_psoc_priv_obj *psoc,
uint8_t link_id,
uint8_t *mac_addr);
/**
* wlan_crypto_free_key_by_link_id - free key by link id
* @psoc: psoc handler
* @link_addr: link address
* @link_id: link id
*/
void wlan_crypto_free_key_by_link_id(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *link_addr,
uint8_t link_id);
#endif /* end of _WLAN_CRYPTO_DEF_I_H_ */

مشاهده پرونده

@@ -4290,11 +4290,12 @@ static bool is_mlo_adv_enable(void)
#endif
#ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
QDF_STATUS wlan_crypto_save_ml_sta_key(
struct wlan_objmgr_psoc *psoc,
uint8_t key_index,
struct wlan_crypto_key *crypto_key,
struct qdf_mac_addr *link_addr, int8_t link_id)
struct qdf_mac_addr *link_addr, uint8_t link_id)
{
struct crypto_psoc_priv_obj *crypto_psoc_obj;
int status = QDF_STATUS_SUCCESS;
@@ -4327,6 +4328,16 @@ QDF_STATUS wlan_crypto_save_ml_sta_key(
crypto_key->valid = true;
return QDF_STATUS_SUCCESS;
}
#else
QDF_STATUS wlan_crypto_save_ml_sta_key(
struct wlan_objmgr_psoc *psoc,
uint8_t key_index,
struct wlan_crypto_key *crypto_key,
struct qdf_mac_addr *link_addr, uint8_t link_id)
{
return QDF_STATUS_SUCCESS;
}
#endif
static QDF_STATUS wlan_crypto_save_key_sta(struct wlan_objmgr_vdev *vdev,
uint8_t key_index,
@@ -4414,6 +4425,62 @@ QDF_STATUS wlan_crypto_save_key(struct wlan_objmgr_vdev *vdev,
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
struct wlan_crypto_key *wlan_crypto_get_ml_sta_link_key(
struct wlan_objmgr_psoc *psoc,
uint8_t key_index,
struct qdf_mac_addr *link_addr, uint8_t link_id)
{
struct crypto_psoc_priv_obj *crypto_psoc_obj;
struct wlan_crypto_key_entry *key_entry = NULL;
crypto_debug("crypto get key index %d link_id %d ", key_index, link_id);
if (!psoc) {
crypto_err("psoc NULL");
return NULL;
}
if (!link_addr) {
crypto_err("link_addr NULL");
return NULL;
}
crypto_psoc_obj = wlan_objmgr_psoc_get_comp_private_obj(
psoc,
WLAN_UMAC_COMP_CRYPTO);
if (!crypto_psoc_obj) {
crypto_err("crypto_psoc_obj NULL");
return NULL;
}
key_entry = crypto_hash_find_by_linkid_and_macaddr(
crypto_psoc_obj,
link_id,
(uint8_t *)link_addr);
if (key_entry) {
if (key_index < WLAN_CRYPTO_MAXKEYIDX)
return key_entry->keys.key[key_index];
else if (is_igtk(key_index))
return key_entry->keys.igtk_key[key_index
- WLAN_CRYPTO_MAXKEYIDX];
else
return key_entry->keys.bigtk_key[key_index
- WLAN_CRYPTO_MAXKEYIDX
- WLAN_CRYPTO_MAXIGTKKEYIDX];
}
return NULL;
}
#else
struct wlan_crypto_key *wlan_crypto_get_ml_sta_link_key(
struct wlan_objmgr_psoc *psoc,
uint8_t key_index,
struct qdf_mac_addr *link_addr, uint8_t link_id)
{
return NULL;
}
#endif
static struct wlan_crypto_key *wlan_crypto_get_ml_key_sta(
struct wlan_objmgr_vdev *vdev,
uint8_t key_index)

مشاهده پرونده

@@ -631,6 +631,47 @@ void wlan_crypto_free_vdev_key(struct wlan_objmgr_vdev *vdev)
}
#endif
#ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
void wlan_crypto_free_key_by_link_id(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *link_addr,
uint8_t link_id)
{
struct wlan_crypto_key_entry *hash_entry;
struct crypto_psoc_priv_obj *crypto_psoc_obj;
TAILQ_HEAD(, wlan_crypto_key_entry) free_list;
TAILQ_INIT(&free_list);
crypto_psoc_obj = wlan_objmgr_psoc_get_comp_private_obj(
psoc,
WLAN_UMAC_COMP_CRYPTO);
if (!crypto_psoc_obj) {
crypto_err("crypto_psoc_obj NULL");
return;
}
if (!crypto_psoc_obj->crypto_key_holder.mask)
return;
if (!crypto_psoc_obj->crypto_key_holder.bins)
return;
if (!qdf_atomic_read(&crypto_psoc_obj->crypto_key_cnt))
return;
qdf_mutex_acquire(&crypto_psoc_obj->crypto_key_lock);
hash_entry = crypto_hash_find_by_linkid_and_macaddr(
crypto_psoc_obj, link_id,
(uint8_t *)link_addr);
if (hash_entry) {
crypto_remove_entry(crypto_psoc_obj, hash_entry, &free_list);
crypto_free_list(crypto_psoc_obj, &free_list);
}
qdf_mutex_release(&crypto_psoc_obj->crypto_key_lock);
}
#endif
static QDF_STATUS wlan_crypto_vdev_obj_destroy_handler(
struct wlan_objmgr_vdev *vdev,
void *arg)