qcacld-3.0: Add API to get/set chan width for EasyMesh

Add API to get/set chan width for EasyMesh.

Change-Id: I118baf627dc926dc0f4f1e354090521b5959535a
CRs-Fixed: 3034717
This commit is contained in:
bings 2021-09-16 17:04:36 +08:00 committed by Madan Koyyalamudi
parent 6921a0560c
commit 11469a4df6
5 changed files with 211 additions and 7 deletions

View File

@ -8853,12 +8853,19 @@ static int hdd_set_elna_bypass(struct hdd_adapter *adapter,
}
#endif
static uint32_t hdd_nl80211_chwidth_to_bonding_mode(uint8_t nl80211_chwidth)
/**
* hdd_mac_chwidth_to_bonding_mode() - get bonding_mode from chan width
* @chwidth: chan width
*
* Return: bonding mode
*/
static uint32_t hdd_mac_chwidth_to_bonding_mode(
enum eSirMacHTChannelWidth chwidth)
{
uint32_t bonding_mode;
switch (nl80211_chwidth) {
case NL80211_CHAN_WIDTH_20:
switch (chwidth) {
case eHT_CHANNEL_WIDTH_20MHZ:
bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
break;
default:
@ -8868,6 +8875,16 @@ static uint32_t hdd_nl80211_chwidth_to_bonding_mode(uint8_t nl80211_chwidth)
return bonding_mode;
}
int hdd_set_mac_chan_width(struct hdd_adapter *adapter,
enum eSirMacHTChannelWidth chwidth)
{
uint32_t bonding_mode;
bonding_mode = hdd_mac_chwidth_to_bonding_mode(chwidth);
return hdd_update_channel_width(adapter, chwidth, bonding_mode);
}
/**
* hdd_set_channel_width() - set channel width
*
@ -8881,7 +8898,6 @@ static int hdd_set_channel_width(struct hdd_adapter *adapter,
{
uint8_t nl80211_chwidth;
enum eSirMacHTChannelWidth chwidth;
uint32_t bonding_mode;
nl80211_chwidth = nla_get_u8(attr);
chwidth = hdd_nl80211_chwidth_to_chwidth(nl80211_chwidth);
@ -8890,9 +8906,7 @@ static int hdd_set_channel_width(struct hdd_adapter *adapter,
return -EINVAL;
}
bonding_mode = hdd_nl80211_chwidth_to_bonding_mode(nl80211_chwidth);
return hdd_update_channel_width(adapter, chwidth, bonding_mode);
return hdd_set_mac_chan_width(adapter, chwidth);
}
/**

View File

@ -795,6 +795,16 @@ static inline void hdd_send_update_owe_info_event(struct hdd_adapter *adapter,
int hdd_set_phy_mode(struct hdd_adapter *adapter,
enum qca_wlan_vendor_phy_mode vendor_phy_mode);
/**
* hdd_set_mac_chan_width() - set channel width
* @adapter: Handle to hdd_adapter
* @chwidth: given channel width
*
* Return: 0 on success, negative errno on failure
*/
int hdd_set_mac_chan_width(struct hdd_adapter *adapter,
enum eSirMacHTChannelWidth chwidth);
/**
* hdd_is_legacy_connection() - Is adapter connection is legacy
* @adapter: Handle to hdd_adapter

View File

@ -61,6 +61,138 @@ static uint32_t hdd_son_is_acs_in_progress(struct wlan_objmgr_vdev *vdev)
return in_progress;
}
/**
* hdd_son_chan_width_to_chan_width() - translate son chan width
* to mac chan width
* @son_chwidth: son chan width
*
* Return: mac chan width
*/
static enum eSirMacHTChannelWidth hdd_son_chan_width_to_chan_width(
enum ieee80211_cwm_width son_chwidth)
{
enum eSirMacHTChannelWidth chwidth;
switch (son_chwidth) {
case IEEE80211_CWM_WIDTH20:
chwidth = eHT_CHANNEL_WIDTH_20MHZ;
break;
case IEEE80211_CWM_WIDTH40:
chwidth = eHT_CHANNEL_WIDTH_40MHZ;
break;
case IEEE80211_CWM_WIDTH80:
chwidth = eHT_CHANNEL_WIDTH_80MHZ;
break;
case IEEE80211_CWM_WIDTH160:
chwidth = eHT_CHANNEL_WIDTH_160MHZ;
break;
case IEEE80211_CWM_WIDTH80_80:
chwidth = eHT_CHANNEL_WIDTH_80P80MHZ;
break;
default:
chwidth = eHT_MAX_CHANNEL_WIDTH;
}
return chwidth;
}
/**
* hdd_son_set_chwidth() - set son chan width
* @vdev: vdev
* @son_chwidth: son chan width
*
* Return: 0 on success, negative errno on failure
*/
static int hdd_son_set_chwidth(struct wlan_objmgr_vdev *vdev,
enum ieee80211_cwm_width son_chwidth)
{
enum eSirMacHTChannelWidth chwidth;
struct hdd_adapter *adapter;
if (!vdev) {
hdd_err("null vdev");
return -EINVAL;
}
adapter = wlan_hdd_get_adapter_from_objmgr(vdev);
if (!adapter) {
hdd_err("null adapter");
return -EINVAL;
}
chwidth = hdd_son_chan_width_to_chan_width(son_chwidth);
return hdd_set_mac_chan_width(adapter, chwidth);
}
/**
* hdd_chan_width_to_son_chwidth() - translate mac chan width
* to son chan width
* @chwidth: mac chan width
*
* Return: son chan width
*/
static enum ieee80211_cwm_width hdd_chan_width_to_son_chwidth(
enum eSirMacHTChannelWidth chwidth)
{
enum ieee80211_cwm_width son_chwidth;
switch (chwidth) {
case eHT_CHANNEL_WIDTH_20MHZ:
son_chwidth = IEEE80211_CWM_WIDTH20;
break;
case eHT_CHANNEL_WIDTH_40MHZ:
son_chwidth = IEEE80211_CWM_WIDTH40;
break;
case eHT_CHANNEL_WIDTH_80MHZ:
son_chwidth = IEEE80211_CWM_WIDTH80;
break;
case eHT_CHANNEL_WIDTH_160MHZ:
son_chwidth = IEEE80211_CWM_WIDTH160;
break;
case eHT_CHANNEL_WIDTH_80P80MHZ:
son_chwidth = IEEE80211_CWM_WIDTH80_80;
break;
default:
son_chwidth = IEEE80211_CWM_WIDTHINVALID;
}
return son_chwidth;
}
/**
* hdd_son_get_chwidth() - get chan width
* @vdev: vdev
*
* Return: son chan width
*/
static enum ieee80211_cwm_width hdd_son_get_chwidth(
struct wlan_objmgr_vdev *vdev)
{
enum eSirMacHTChannelWidth chwidth;
struct hdd_adapter *adapter;
enum ieee80211_cwm_width son_chwidth = IEEE80211_CWM_WIDTHINVALID;
if (!vdev) {
hdd_err("null vdev");
return son_chwidth;
}
adapter = wlan_hdd_get_adapter_from_objmgr(vdev);
if (!adapter) {
hdd_err("null adapter");
return son_chwidth;
}
chwidth = wma_cli_get_command(adapter->vdev_id, WMI_VDEV_PARAM_CHWIDTH,
VDEV_CMD);
if (chwidth < 0) {
hdd_err("Failed to get chwidth");
return son_chwidth;
}
return hdd_chan_width_to_son_chwidth(chwidth);
}
/**
* hdd_son_chan_ext_offset_to_chan_type() - translate son chan extend offset
* to chan type
@ -1143,6 +1275,8 @@ void hdd_son_register_callbacks(struct hdd_context *hdd_ctx)
cb_obj.os_if_set_phymode = hdd_son_set_phymode;
cb_obj.os_if_get_phymode = hdd_son_get_phymode;
cb_obj.os_if_get_rx_nss = hdd_son_get_rx_nss;
cb_obj.os_if_set_chwidth = hdd_son_set_chwidth;
cb_obj.os_if_get_chwidth = hdd_son_get_chwidth;
os_if_son_register_hdd_callbacks(hdd_ctx->psoc, &cb_obj);
}

View File

@ -51,6 +51,8 @@
* @os_if_add_acl_mac: add mac to acl
* @os_if_del_acl_mac: del mac from acl
* @os_if_kickout_mac: kickout sta with given mac
* @os_if_set_chwidth: set chan width
* @os_if_get_chwidth: get chan width
*/
struct son_callbacks {
uint32_t (*os_if_is_acs_in_progress)(struct wlan_objmgr_vdev *vdev);
@ -85,6 +87,10 @@ struct son_callbacks {
struct qdf_mac_addr *acl_mac);
int (*os_if_kickout_mac)(struct wlan_objmgr_vdev *vdev,
struct qdf_mac_addr *acl_mac);
int (*os_if_set_chwidth)(struct wlan_objmgr_vdev *vdev,
enum ieee80211_cwm_width son_chwidth);
enum ieee80211_cwm_width (*os_if_get_chwidth)(
struct wlan_objmgr_vdev *vdev);
};
/**
@ -434,4 +440,21 @@ int os_if_son_del_acl_mac(struct wlan_objmgr_vdev *vdev,
int os_if_son_kickout_mac(struct wlan_objmgr_vdev *vdev,
struct qdf_mac_addr *mac);
/**
* os_if_son_set_chwidth() - set chan width
* @vdev: vdev
* @son_chwidth: son chan width
*
* Return: 0 on success, negative errno on failure
*/
int os_if_son_set_chwidth(struct wlan_objmgr_vdev *vdev,
enum ieee80211_cwm_width son_chwidth);
/**
* os_if_son_get_chwidth() - get chan width
* @vdev: vdev
*
* Return: son chan width
*/
enum ieee80211_cwm_width os_if_son_get_chwidth(struct wlan_objmgr_vdev *vdev);
#endif

View File

@ -830,6 +830,29 @@ bool os_if_son_acl_is_probe_wh_set(struct wlan_objmgr_vdev *vdev,
qdf_export_symbol(os_if_son_acl_is_probe_wh_set);
int os_if_son_set_chwidth(struct wlan_objmgr_vdev *vdev,
enum ieee80211_cwm_width son_chwidth)
{
if (!vdev) {
osif_err("null vdev");
return -EINVAL;
}
return g_son_os_if_cb.os_if_set_chwidth(vdev, son_chwidth);
}
qdf_export_symbol(os_if_son_set_chwidth);
enum ieee80211_cwm_width os_if_son_get_chwidth(struct wlan_objmgr_vdev *vdev)
{
if (!vdev) {
osif_err("null vdev");
return 0;
}
return g_son_os_if_cb.os_if_get_chwidth(vdev);
}
qdf_export_symbol(os_if_son_get_chwidth);
u_int8_t os_if_son_get_rx_streams(struct wlan_objmgr_vdev *vdev)
{
if (!vdev) {