qcacld-3.0: Add support to install key api's on wdevs

For MLO, add support to hdd install key api's
on wdevs without netdev. Add changes under config
flag "CFG80211_KEY_INSTALL_SUPPORT_ON_WDEV".

Change-Id: I67de2ba36dd86f0814c820756d5f49b765defda6
CRs-Fixed: 3017312
This commit is contained in:
Amruta Kulkarni
2021-08-18 14:06:51 -07:00
committed by Madan Koyyalamudi
parent 59e39f1a2b
commit c2d7ba4b01

View File

@@ -170,6 +170,7 @@
#include "wlan_hdd_cm_api.h"
#include "wlan_roam_debug.h"
#include "wlan_hdd_avoid_freq_ext.h"
#include "qdf_util.h"
#define g_mode_rates_size (12)
#define a_mode_rates_size (8)
@@ -18933,6 +18934,34 @@ static int __wlan_hdd_cfg80211_add_key(struct wiphy *wiphy,
return errno;
}
#ifdef CFG80211_KEY_INSTALL_SUPPORT_ON_WDEV
static int wlan_hdd_cfg80211_add_key(struct wiphy *wiphy,
struct wireless_dev *wdev,
u8 key_index, bool pairwise,
const u8 *mac_addr,
struct key_params *params)
{
int errno = -EINVAL;
struct osif_vdev_sync *vdev_sync;
struct hdd_adapter *adapter = qdf_container_of(wdev,
struct hdd_adapter,
wdev);
if (!adapter || wlan_hdd_validate_vdev_id(adapter->vdev_id))
return errno;
errno = osif_vdev_sync_op_start(adapter->dev, &vdev_sync);
if (errno)
return errno;
errno = __wlan_hdd_cfg80211_add_key(wiphy, adapter->dev, key_index,
pairwise, mac_addr, params);
osif_vdev_sync_op_stop(vdev_sync);
return errno;
}
#else
static int wlan_hdd_cfg80211_add_key(struct wiphy *wiphy,
struct net_device *ndev,
u8 key_index, bool pairwise,
@@ -18953,6 +18982,7 @@ static int wlan_hdd_cfg80211_add_key(struct wiphy *wiphy,
return errno;
}
#endif
/*
* FUNCTION: __wlan_hdd_cfg80211_get_key
@@ -19044,6 +19074,37 @@ static int __wlan_hdd_cfg80211_get_key(struct wiphy *wiphy,
return 0;
}
#ifdef CFG80211_KEY_INSTALL_SUPPORT_ON_WDEV
static int wlan_hdd_cfg80211_get_key(struct wiphy *wiphy,
struct wireless_dev *wdev,
u8 key_index, bool pairwise,
const u8 *mac_addr, void *cookie,
void (*callback)(void *cookie,
struct key_params *)
)
{
int errno = -EINVAL;
struct osif_vdev_sync *vdev_sync;
struct hdd_adapter *adapter = qdf_container_of(wdev,
struct hdd_adapter,
wdev);
if (!adapter || wlan_hdd_validate_vdev_id(adapter->vdev_id))
return errno;
errno = osif_vdev_sync_op_start(adapter->dev, &vdev_sync);
if (errno)
return errno;
errno = __wlan_hdd_cfg80211_get_key(wiphy, adapter->dev, key_index,
pairwise, mac_addr, cookie,
callback);
osif_vdev_sync_op_stop(vdev_sync);
return errno;
}
#else
static int wlan_hdd_cfg80211_get_key(struct wiphy *wiphy,
struct net_device *ndev,
u8 key_index, bool pairwise,
@@ -19066,6 +19127,7 @@ static int wlan_hdd_cfg80211_get_key(struct wiphy *wiphy,
return errno;
}
#endif
/**
* __wlan_hdd_cfg80211_del_key() - Delete the encryption key for station
@@ -19099,7 +19161,7 @@ static int __wlan_hdd_cfg80211_del_key(struct wiphy *wiphy,
/**
* wlan_hdd_cfg80211_del_key() - cfg80211 delete key handler function
* @wiphy: Pointer to wiphy structure.
* @dev: Pointer to net_device structure.
* @wdev: Pointer to wireless_dev structure.
* @key_index: key index
* @pairwise: pairwise
* @mac_addr: mac address
@@ -19110,10 +19172,37 @@ static int __wlan_hdd_cfg80211_del_key(struct wiphy *wiphy,
*
* Return: 0 for success, error number on failure.
*/
#ifdef CFG80211_KEY_INSTALL_SUPPORT_ON_WDEV
static int wlan_hdd_cfg80211_del_key(struct wiphy *wiphy,
struct net_device *dev,
u8 key_index,
bool pairwise, const u8 *mac_addr)
struct wireless_dev *wdev,
u8 key_index,
bool pairwise, const u8 *mac_addr)
{
int errno = -EINVAL;
struct osif_vdev_sync *vdev_sync;
struct hdd_adapter *adapter = qdf_container_of(wdev,
struct hdd_adapter,
wdev);
if (!adapter || wlan_hdd_validate_vdev_id(adapter->vdev_id))
return errno;
errno = osif_vdev_sync_op_start(adapter->dev, &vdev_sync);
if (errno)
return errno;
errno = __wlan_hdd_cfg80211_del_key(wiphy, adapter->dev, key_index,
pairwise, mac_addr);
osif_vdev_sync_op_stop(vdev_sync);
return errno;
}
#else
static int wlan_hdd_cfg80211_del_key(struct wiphy *wiphy,
struct net_device *dev,
u8 key_index,
bool pairwise, const u8 *mac_addr)
{
int errno;
struct osif_vdev_sync *vdev_sync;
@@ -19129,7 +19218,7 @@ static int wlan_hdd_cfg80211_del_key(struct wiphy *wiphy,
return errno;
}
#endif
static int __wlan_hdd_cfg80211_set_default_key(struct wiphy *wiphy,
struct net_device *ndev,
u8 key_index,
@@ -19219,6 +19308,34 @@ out:
return ret;
}
#ifdef CFG80211_KEY_INSTALL_SUPPORT_ON_WDEV
static int wlan_hdd_cfg80211_set_default_key(struct wiphy *wiphy,
struct wireless_dev *wdev,
u8 key_index,
bool unicast, bool multicast)
{
int errno = -EINVAL;
struct osif_vdev_sync *vdev_sync;
struct hdd_adapter *adapter = qdf_container_of(wdev,
struct hdd_adapter,
wdev);
if (!adapter || wlan_hdd_validate_vdev_id(adapter->vdev_id))
return errno;
errno = osif_vdev_sync_op_start(adapter->dev, &vdev_sync);
if (errno)
return errno;
errno = __wlan_hdd_cfg80211_set_default_key(wiphy, adapter->dev,
key_index, unicast,
multicast);
osif_vdev_sync_op_stop(vdev_sync);
return errno;
}
#else
static int wlan_hdd_cfg80211_set_default_key(struct wiphy *wiphy,
struct net_device *ndev,
u8 key_index,
@@ -19238,6 +19355,7 @@ static int wlan_hdd_cfg80211_set_default_key(struct wiphy *wiphy,
return errno;
}
#endif
#if defined (CFG80211_BIGTK_CONFIGURATION_SUPPORT) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0))
@@ -19249,6 +19367,32 @@ static int _wlan_hdd_cfg80211_set_default_beacon_key(struct wiphy *wiphy,
return 0;
}
#ifdef CFG80211_KEY_INSTALL_SUPPORT_ON_WDEV
static int wlan_hdd_cfg80211_set_default_beacon_key(struct wiphy *wiphy,
struct wireless_dev *wdev,
u8 key_index)
{
int errno = -EINVAL;
struct osif_vdev_sync *vdev_sync;
struct hdd_adapter *adapter = qdf_container_of(wdev,
struct hdd_adapter,
wdev);
if (!adapter || wlan_hdd_validate_vdev_id(adapter->vdev_id))
return errno;
errno = osif_vdev_sync_op_start(adapter->dev, &vdev_sync);
if (errno)
return errno;
errno = _wlan_hdd_cfg80211_set_default_beacon_key(wiphy, adapter->dev,
key_index);
osif_vdev_sync_op_stop(vdev_sync);
return errno;
}
#else
static int wlan_hdd_cfg80211_set_default_beacon_key(struct wiphy *wiphy,
struct net_device *ndev,
u8 key_index)
@@ -19268,6 +19412,7 @@ static int wlan_hdd_cfg80211_set_default_beacon_key(struct wiphy *wiphy,
return errno;
}
#endif
#endif
#ifdef FEATURE_MONITOR_MODE_SUPPORT
static
@@ -19522,8 +19667,8 @@ static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
* Return: 0
*/
static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *netdev,
u8 key_index)
struct net_device *netdev,
u8 key_index)
{
hdd_enter();
return 0;
@@ -19533,14 +19678,39 @@ static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
* wlan_hdd_set_default_mgmt_key() - SSR wrapper for
* wlan_hdd_set_default_mgmt_key
* @wiphy: pointer to wiphy
* @netdev: pointer to net_device structure
* @wdev: pointer to wireless_device structure
* @key_index: key index
*
* Return: 0 on success, error number on failure
*/
#ifdef CFG80211_KEY_INSTALL_SUPPORT_ON_WDEV
static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *netdev,
u8 key_index)
struct wireless_dev *wdev,
u8 key_index)
{
int errno = -EINVAL;
struct osif_vdev_sync *vdev_sync;
struct hdd_adapter *adapter = qdf_container_of(wdev,
struct hdd_adapter,
wdev);
if (!adapter || wlan_hdd_validate_vdev_id(adapter->vdev_id))
return errno;
errno = osif_vdev_sync_op_start(adapter->dev, &vdev_sync);
if (errno)
return errno;
errno = __wlan_hdd_set_default_mgmt_key(wiphy, adapter->dev, key_index);
osif_vdev_sync_op_stop(vdev_sync);
return errno;
}
#else
static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *netdev,
u8 key_index)
{
int errno;
struct osif_vdev_sync *vdev_sync;
@@ -19555,6 +19725,7 @@ static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
return errno;
}
#endif
/**
* Default val of cwmin, this value is used to overide the