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
此提交包含在:
Amruta Kulkarni
2021-08-18 14:06:51 -07:00
提交者 Madan Koyyalamudi
父節點 59e39f1a2b
當前提交 c2d7ba4b01

查看文件

@@ -170,6 +170,7 @@
#include "wlan_hdd_cm_api.h" #include "wlan_hdd_cm_api.h"
#include "wlan_roam_debug.h" #include "wlan_roam_debug.h"
#include "wlan_hdd_avoid_freq_ext.h" #include "wlan_hdd_avoid_freq_ext.h"
#include "qdf_util.h"
#define g_mode_rates_size (12) #define g_mode_rates_size (12)
#define a_mode_rates_size (8) #define a_mode_rates_size (8)
@@ -18933,6 +18934,34 @@ static int __wlan_hdd_cfg80211_add_key(struct wiphy *wiphy,
return errno; 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, static int wlan_hdd_cfg80211_add_key(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
u8 key_index, bool pairwise, u8 key_index, bool pairwise,
@@ -18953,6 +18982,7 @@ static int wlan_hdd_cfg80211_add_key(struct wiphy *wiphy,
return errno; return errno;
} }
#endif
/* /*
* FUNCTION: __wlan_hdd_cfg80211_get_key * FUNCTION: __wlan_hdd_cfg80211_get_key
@@ -19044,6 +19074,37 @@ static int __wlan_hdd_cfg80211_get_key(struct wiphy *wiphy,
return 0; 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, static int wlan_hdd_cfg80211_get_key(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
u8 key_index, bool pairwise, u8 key_index, bool pairwise,
@@ -19066,6 +19127,7 @@ static int wlan_hdd_cfg80211_get_key(struct wiphy *wiphy,
return errno; return errno;
} }
#endif
/** /**
* __wlan_hdd_cfg80211_del_key() - Delete the encryption key for station * __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 * wlan_hdd_cfg80211_del_key() - cfg80211 delete key handler function
* @wiphy: Pointer to wiphy structure. * @wiphy: Pointer to wiphy structure.
* @dev: Pointer to net_device structure. * @wdev: Pointer to wireless_dev structure.
* @key_index: key index * @key_index: key index
* @pairwise: pairwise * @pairwise: pairwise
* @mac_addr: mac address * @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. * 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, static int wlan_hdd_cfg80211_del_key(struct wiphy *wiphy,
struct net_device *dev, struct wireless_dev *wdev,
u8 key_index, u8 key_index,
bool pairwise, const u8 *mac_addr) 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; int errno;
struct osif_vdev_sync *vdev_sync; struct osif_vdev_sync *vdev_sync;
@@ -19129,7 +19218,7 @@ static int wlan_hdd_cfg80211_del_key(struct wiphy *wiphy,
return errno; return errno;
} }
#endif
static int __wlan_hdd_cfg80211_set_default_key(struct wiphy *wiphy, static int __wlan_hdd_cfg80211_set_default_key(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
u8 key_index, u8 key_index,
@@ -19219,6 +19308,34 @@ out:
return ret; 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, static int wlan_hdd_cfg80211_set_default_key(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
u8 key_index, u8 key_index,
@@ -19238,6 +19355,7 @@ static int wlan_hdd_cfg80211_set_default_key(struct wiphy *wiphy,
return errno; return errno;
} }
#endif
#if defined (CFG80211_BIGTK_CONFIGURATION_SUPPORT) || \ #if defined (CFG80211_BIGTK_CONFIGURATION_SUPPORT) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0)) (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; 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, static int wlan_hdd_cfg80211_set_default_beacon_key(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
u8 key_index) u8 key_index)
@@ -19268,6 +19412,7 @@ static int wlan_hdd_cfg80211_set_default_beacon_key(struct wiphy *wiphy,
return errno; return errno;
} }
#endif #endif
#endif
#ifdef FEATURE_MONITOR_MODE_SUPPORT #ifdef FEATURE_MONITOR_MODE_SUPPORT
static static
@@ -19522,8 +19667,8 @@ static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
* Return: 0 * Return: 0
*/ */
static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *netdev, struct net_device *netdev,
u8 key_index) u8 key_index)
{ {
hdd_enter(); hdd_enter();
return 0; 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() - SSR wrapper for
* wlan_hdd_set_default_mgmt_key * wlan_hdd_set_default_mgmt_key
* @wiphy: pointer to wiphy * @wiphy: pointer to wiphy
* @netdev: pointer to net_device structure * @wdev: pointer to wireless_device structure
* @key_index: key index * @key_index: key index
* *
* Return: 0 on success, error number on failure * 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, static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *netdev, struct wireless_dev *wdev,
u8 key_index) 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; int errno;
struct osif_vdev_sync *vdev_sync; struct osif_vdev_sync *vdev_sync;
@@ -19555,6 +19725,7 @@ static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
return errno; return errno;
} }
#endif
/** /**
* Default val of cwmin, this value is used to overide the * Default val of cwmin, this value is used to overide the