qcacmn: APIs to convert phy_ch_width to nl80211_chan_width and vice-versa

Add Spectral APIs to convert channel width values
from enum phy_ch_width to nl80211_chan_width and
vice-versa.

CRs-Fixed: 3029184
Change-Id: I60fb7fb04b943b0d70c569ff6587e5e8efd7722b
This commit is contained in:
Jhalak Naik
2021-09-02 11:48:57 +05:30
committad av Madan Koyyalamudi
förälder 92f93cb246
incheckning b65b4ae703
6 ändrade filer med 150 tillägg och 5 borttagningar

Visa fil

@@ -18,6 +18,7 @@
*/
#include <os_if_spectral_netlink.h>
#include <wlan_cfg80211_spectral.h>
#include <spectral_cmn_api_i.h>
#include <spectral_defs_i.h>
#include <wlan_nlink_srv.h>
@@ -600,6 +601,8 @@ os_if_spectral_netlink_init(struct wlan_objmgr_pdev *pdev)
nl_cb.send_nl_bcast = os_if_spectral_nl_bcast_msg;
nl_cb.send_nl_unicast = os_if_spectral_nl_unicast_msg;
nl_cb.free_sbuff = os_if_spectral_free_skb;
nl_cb.convert_to_phy_ch_width = wlan_spectral_get_phy_ch_width;
nl_cb.convert_to_nl_ch_width = wlan_spectral_get_nl80211_chwidth;
if (sptrl_ctx->sptrlc_register_netlink_cb)
sptrl_ctx->sptrlc_register_netlink_cb(pdev, &nl_cb);

Visa fil

@@ -201,6 +201,112 @@ convert_spectral_err_code_internal_to_nl
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_11BE
int
wlan_spectral_get_nl80211_chwidth(uint8_t phy_chwidth)
{
switch ((enum phy_ch_width)phy_chwidth) {
case CH_WIDTH_5MHZ:
return NL80211_CHAN_WIDTH_5;
case CH_WIDTH_10MHZ:
return NL80211_CHAN_WIDTH_10;
case CH_WIDTH_20MHZ:
return NL80211_CHAN_WIDTH_20;
case CH_WIDTH_40MHZ:
return NL80211_CHAN_WIDTH_40;
case CH_WIDTH_80MHZ:
return NL80211_CHAN_WIDTH_80;
case CH_WIDTH_160MHZ:
return NL80211_CHAN_WIDTH_160;
case CH_WIDTH_80P80MHZ:
return NL80211_CHAN_WIDTH_80P80;
case CH_WIDTH_320MHZ:
case CH_WIDTH_MAX:
return NL80211_CHAN_WIDTH_320;
case CH_WIDTH_INVALID:
default:
osif_err("Invalid spectral channel width %u", phy_chwidth);
return -EINVAL;
}
}
uint8_t
wlan_spectral_get_phy_ch_width(uint8_t nl_chwidth)
{
switch ((enum nl80211_chan_width)nl_chwidth) {
case NL80211_CHAN_WIDTH_5:
return CH_WIDTH_5MHZ;
case NL80211_CHAN_WIDTH_10:
return CH_WIDTH_10MHZ;
case NL80211_CHAN_WIDTH_20:
return CH_WIDTH_20MHZ;
case NL80211_CHAN_WIDTH_40:
return CH_WIDTH_40MHZ;
case NL80211_CHAN_WIDTH_80:
return CH_WIDTH_80MHZ;
case NL80211_CHAN_WIDTH_160:
return CH_WIDTH_160MHZ;
case NL80211_CHAN_WIDTH_80P80:
return CH_WIDTH_80P80MHZ;
case NL80211_CHAN_WIDTH_320:
return CH_WIDTH_320MHZ;
default:
osif_err("Invalid nl80211 channel width %u", nl_chwidth);
return CH_WIDTH_INVALID;
}
}
#else
int
wlan_spectral_get_nl80211_chwidth(uint8_t phy_chwidth)
{
switch ((enum phy_ch_width)phy_chwidth) {
case CH_WIDTH_5MHZ:
return NL80211_CHAN_WIDTH_5;
case CH_WIDTH_10MHZ:
return NL80211_CHAN_WIDTH_10;
case CH_WIDTH_20MHZ:
return NL80211_CHAN_WIDTH_20;
case CH_WIDTH_40MHZ:
return NL80211_CHAN_WIDTH_40;
case CH_WIDTH_80MHZ:
return NL80211_CHAN_WIDTH_80;
case CH_WIDTH_160MHZ:
case CH_WIDTH_MAX:
return NL80211_CHAN_WIDTH_160;
case CH_WIDTH_80P80MHZ:
return NL80211_CHAN_WIDTH_80P80;
case CH_WIDTH_INVALID:
default:
osif_err("Invalid spectral channel width %u", phy_chwidth);
return -EINVAL;
}
}
uint8_t
wlan_spectral_get_phy_ch_width(uint8_t nl_chwidth)
{
switch ((enum nl80211_chan_width)nl_chwidth) {
case NL80211_CHAN_WIDTH_5:
return CH_WIDTH_5MHZ;
case NL80211_CHAN_WIDTH_10:
return CH_WIDTH_10MHZ;
case NL80211_CHAN_WIDTH_20:
return CH_WIDTH_20MHZ;
case NL80211_CHAN_WIDTH_40:
return CH_WIDTH_40MHZ;
case NL80211_CHAN_WIDTH_80:
return CH_WIDTH_80MHZ;
case NL80211_CHAN_WIDTH_160:
return CH_WIDTH_160MHZ;
case NL80211_CHAN_WIDTH_80P80:
return CH_WIDTH_80P80MHZ;
default:
osif_err("Invalid nl80211 channel width %u", nl_chwidth);
return CH_WIDTH_INVALID;
}
}
#endif /* WLAN_FEATURE_11BE */
#ifdef DIRECT_BUF_RX_DEBUG
QDF_STATUS wlan_cfg80211_spectral_scan_dma_debug_config(
struct wlan_objmgr_pdev *pdev,