mxm_wifiex: fix the build errors with the API changes on next-20220719 kernel tag

There are many cfg80211 common api and struct changes on next-20220719
kernel tag, which is based on v5.19-rc7 Linus tree tag with the for-next
branch patches on each kernel IP repo, target for v6.0 kernel version.
So need to change the local wifi driver accordingly to avoid the build
errors.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
This commit is contained in:
Sherry Sun 2022-08-17 18:57:14 +08:00
parent 30f40263eb
commit 9a15e44e49
6 changed files with 174 additions and 4 deletions

View file

@ -1148,7 +1148,11 @@ int woal_cfg80211_change_virtual_intf(struct wiphy *wiphy,
#endif /* WIFI_DIRECT_SUPPORT */
#if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
if (priv->bss_type == MLAN_BSS_TYPE_UAP) {
#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE
woal_cfg80211_del_beacon(wiphy, dev, 0);
#else
woal_cfg80211_del_beacon(wiphy, dev);
#endif
bss_role = MLAN_BSS_ROLE_STA;
woal_cfg80211_bss_role_cfg(priv, MLAN_ACT_SET,
&bss_role);
@ -2115,6 +2119,9 @@ done:
* @return 0 -- success, otherwise fail
*/
int woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE
unsigned int link_id,
#endif
const u8 *peer,
const struct cfg80211_bitrate_mask *mask)
{
@ -4789,7 +4796,11 @@ void woal_cfg80211_notify_channel(moal_private *priv,
#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE
if (MLAN_STATUS_SUCCESS ==
woal_chandef_create(priv, &chandef, pchan_info)) {
#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE
cfg80211_ch_switch_notify(priv->netdev, &chandef, 0);
#else
cfg80211_ch_switch_notify(priv->netdev, &chandef);
#endif
priv->channel = pchan_info->channel;
#ifdef UAP_CFG80211
moal_memcpy_ext(priv->phandle, &priv->chan, &chandef,

View file

@ -164,6 +164,9 @@ int woal_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev);
#endif
int woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE
unsigned int link_id,
#endif
const u8 *peer,
const struct cfg80211_bitrate_mask *mask);
#if KERNEL_VERSION(2, 6, 38) <= CFG80211_VERSION_CODE
@ -430,7 +433,11 @@ int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
struct beacon_parameters *params);
#endif
#if KERNEL_VERSION(5, 19, 0) <= CFG80211_VERSION_CODE
int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id);
#else
int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev);
#endif
int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
#if KERNEL_VERSION(3, 19, 0) <= CFG80211_VERSION_CODE
struct station_del_parameters *param);

View file

@ -969,7 +969,11 @@ static void woal_hang_work_queue(struct work_struct *work)
#ifdef STA_CFG80211
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev &&
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
priv->wdev->connected) {
#else
priv->wdev->current_bss) {
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
if (priv->host_mlme)
woal_host_mlme_disconnect(
@ -5688,7 +5692,11 @@ int woal_close(struct net_device *dev)
woal_cancel_scan(priv, MOAL_IOCTL_WAIT);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev->connected) {
#else
if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev->current_bss) {
#endif
priv->cfg_disconnect = MTRUE;
cfg80211_disconnected(priv->netdev, 0, NULL, 0,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
@ -8642,7 +8650,11 @@ t_void woal_send_disconnect_to_system(moal_private *priv,
if (IS_STA_CFG80211(cfg80211_wext)) {
spin_lock_irqsave(&priv->connect_lock, flags);
if (!priv->cfg_disconnect && !priv->cfg_connect && priv->wdev &&
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
priv->wdev->connected) {
#else
priv->wdev->current_bss) {
#endif
PRINTM(MMSG,
"wlan: Disconnected from " MACSTR
": Reason code %d\n",

View file

@ -3361,7 +3361,11 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent)
PRINTM(MMSG,
"Channel Under Nop: notify cfg80211 new channel=%d\n",
priv->channel);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
cfg80211_ch_switch_notify(priv->netdev, &priv->chan, 0);
#else
cfg80211_ch_switch_notify(priv->netdev, &priv->chan);
#endif
priv->chan_under_nop = MFALSE;
}
#endif
@ -3682,7 +3686,11 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent)
PRINTM(MEVENT,
"HostMlme %s: Receive deauth/disassociate\n",
priv->netdev->name);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (!priv->wdev->connected) {
#else
if (!priv->wdev->current_bss) {
#endif
PRINTM(MEVENT,
"HostMlme: Drop deauth/disassociate, current_bss = null\n");
break;
@ -4052,7 +4060,11 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent)
roam_info =
kzalloc(sizeof(struct cfg80211_roam_info), GFP_ATOMIC);
if (roam_info) {
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
roam_info->links[0].bssid = priv->cfg_bssid;
#else
roam_info->bssid = priv->cfg_bssid;
#endif
roam_info->req_ie = req_ie;
roam_info->req_ie_len = ie_len;
roam_info->resp_ie = pinfo->rsp_ie;

View file

@ -111,6 +111,9 @@ static int woal_cfg80211_dump_survey(struct wiphy *wiphy,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
static int woal_cfg80211_get_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
unsigned int link_id,
#endif
struct cfg80211_chan_def *chandef);
#endif
static int woal_cfg80211_set_power_mgmt(struct wiphy *wiphy,
@ -2489,6 +2492,11 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv,
struct cfg80211_bss *bss = NULL;
unsigned long flags;
u8 *assoc_req_buf = NULL;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
struct cfg80211_rx_assoc_resp resp = {
.uapsd_queues = -1,
};
#endif
if (priv) {
if (priv->auth_flag & HOST_MLME_ASSOC_DONE) {
@ -2545,6 +2553,16 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv,
assoc_info
->assoc_req_buf;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
resp.links[0].bss = bss;
resp.buf = assoc_info->assoc_resp_buf;
resp.len = assoc_info->assoc_resp_len;
resp.req_ies = assoc_req_buf;
resp.req_ies_len = assoc_info->assoc_req_len;
mutex_lock(&priv->wdev->mtx);
cfg80211_rx_assoc_resp(priv->netdev, &resp);
mutex_unlock(&priv->wdev->mtx);
#else
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
mutex_lock(&priv->wdev->mtx);
cfg80211_rx_assoc_resp(
@ -2577,6 +2595,7 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv,
assoc_info->assoc_resp_len);
#endif
#endif
#endif
#endif
}
}
@ -5347,7 +5366,11 @@ static int woal_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
if (priv->media_connected == MFALSE) {
PRINTM(MMSG, " Already disconnected\n");
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (priv->wdev->connected &&
#else
if (priv->wdev->current_bss &&
#endif
(priv->wdev->iftype == NL80211_IFTYPE_STATION ||
priv->wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) {
priv->cfg_disconnect = MTRUE;
@ -5675,6 +5698,9 @@ done:
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
static int woal_cfg80211_get_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
unsigned int link_id,
#endif
struct cfg80211_chan_def *chandef)
{
moal_private *priv = (moal_private *)woal_get_netdev_priv(wdev->netdev);
@ -8552,7 +8578,11 @@ int woal_cfg80211_update_ft_ies(struct wiphy *wiphy, struct net_device *dev,
passoc_rsp = (IEEEtypes_AssocRsp_t *)
assoc_rsp->assoc_resp_buf;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
roam_info.links[0].bssid = priv->cfg_bssid;
#else
roam_info.bssid = priv->cfg_bssid;
#endif
roam_info.req_ie = priv->sme_current.ie;
roam_info.req_ie_len = priv->sme_current.ie_len;
roam_info.resp_ie = passoc_rsp->ie_buffer;
@ -9020,7 +9050,11 @@ void woal_start_roaming(moal_private *priv)
}
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
roam_info.links[0].bssid = priv->cfg_bssid;
#else
roam_info.bssid = priv->cfg_bssid;
#endif
roam_info.req_ie = ie;
roam_info.req_ie_len = ie_len;
roam_info.resp_ie = passoc_rsp->ie_buffer;
@ -9095,23 +9129,44 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev,
if (params->ext_capab_len)
req_len += sizeof(MrvlIEtypesHeader_t) + params->ext_capab_len;
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.supported_rates_len)
req_len += sizeof(MrvlIEtypesHeader_t) +
params->link_sta_params.supported_rates_len;
#else
if (params->supported_rates_len)
req_len += sizeof(MrvlIEtypesHeader_t) +
params->supported_rates_len;
#endif
if (params->uapsd_queues || params->max_sp)
req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(qosinfo);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.ht_capa)
#else
if (params->ht_capa)
#endif
req_len += sizeof(MrvlIEtypesHeader_t) +
sizeof(struct ieee80211_ht_cap);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.vht_capa)
#else
if (params->vht_capa)
#endif
req_len += sizeof(MrvlIEtypesHeader_t) +
sizeof(struct ieee80211_vht_cap);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.opmode_notif_used)
req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(u8);
#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
if (params->opmode_notif_used)
req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(u8);
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.he_capa_len)
req_len += sizeof(MrvlExtIEtypesHeader_t) + params->link_sta_params.he_capa_len;
#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
if (params->he_capa_len)
req_len += sizeof(MrvlExtIEtypesHeader_t) + params->he_capa_len;
#endif
@ -9161,12 +9216,24 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev,
tlv = (MrvlIEtypes_Data_t *)pos;
}
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.supported_rates_len) {
#else
if (params->supported_rates_len) {
#endif
tlv = (MrvlIEtypes_Data_t *)pos;
tlv->header.type = SUPPORTED_RATES;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
tlv->header.len = params->link_sta_params.supported_rates_len;
#else
tlv->header.len = params->supported_rates_len;
#endif
moal_memcpy_ext(priv->phandle, tlv->data,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
params->link_sta_params.supported_rates, tlv->header.len,
#else
params->supported_rates, tlv->header.len,
#endif
tlv->header.len);
pos += sizeof(MrvlIEtypesHeader_t) + tlv->header.len;
bss->param.sta_info.tlv_len +=
@ -9185,22 +9252,38 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev,
sizeof(MrvlIEtypesHeader_t) + tlv->header.len;
tlv = (MrvlIEtypes_Data_t *)pos;
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.ht_capa) {
#else
if (params->ht_capa) {
#endif
tlv = (MrvlIEtypes_Data_t *)pos;
tlv->header.type = HT_CAPABILITY;
tlv->header.len = sizeof(struct ieee80211_ht_cap);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
moal_memcpy_ext(priv->phandle, tlv->data, params->link_sta_params.ht_capa,
#else
moal_memcpy_ext(priv->phandle, tlv->data, params->ht_capa,
#endif
tlv->header.len, tlv->header.len);
pos += sizeof(MrvlIEtypesHeader_t) + tlv->header.len;
bss->param.sta_info.tlv_len +=
sizeof(MrvlIEtypesHeader_t) + tlv->header.len;
tlv = (MrvlIEtypes_Data_t *)pos;
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.vht_capa) {
#else
if (params->vht_capa) {
#endif
tlv = (MrvlIEtypes_Data_t *)pos;
tlv->header.type = VHT_CAPABILITY;
tlv->header.len = sizeof(struct ieee80211_vht_cap);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
moal_memcpy_ext(priv->phandle, tlv->data, params->link_sta_params.vht_capa,
#else
moal_memcpy_ext(priv->phandle, tlv->data, params->vht_capa,
#endif
tlv->header.len, tlv->header.len);
pos += sizeof(MrvlIEtypesHeader_t) + tlv->header.len;
bss->param.sta_info.tlv_len +=
@ -9208,11 +9291,19 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev,
tlv = (MrvlIEtypes_Data_t *)pos;
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.opmode_notif_used) {
#else
if (params->opmode_notif_used) {
#endif
tlv = (MrvlIEtypes_Data_t *)pos;
tlv->header.type = OPER_MODE_NTF;
tlv->header.len = sizeof(u8);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
moal_memcpy_ext(priv->phandle, tlv->data, &params->link_sta_params.opmode_notif,
#else
moal_memcpy_ext(priv->phandle, tlv->data, &params->opmode_notif,
#endif
tlv->header.len, tlv->header.len);
pos += sizeof(MrvlIEtypesHeader_t) + tlv->header.len;
bss->param.sta_info.tlv_len +=
@ -9220,7 +9311,21 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev,
tlv = (MrvlIEtypes_Data_t *)pos;
}
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
if (params->link_sta_params.he_capa_len) {
ext_tlv = (MrvlExtIEtypes_Data_t *)pos;
ext_tlv->header.type = EXTENSION;
ext_tlv->header.len = params->link_sta_params.he_capa_len + sizeof(u8);
ext_tlv->header.ext_id = HE_CAPABILITY;
moal_memcpy_ext(priv->phandle, ext_tlv->data,
(u8 *)params->link_sta_params.he_capa, params->link_sta_params.he_capa_len,
params->link_sta_params.he_capa_len);
pos += sizeof(MrvlExtIEtypesHeader_t) + params->link_sta_params.he_capa_len;
bss->param.sta_info.tlv_len +=
sizeof(MrvlExtIEtypesHeader_t) + params->link_sta_params.he_capa_len;
tlv = (MrvlIEtypes_Data_t *)pos;
}
#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
if (params->he_capa_len) {
ext_tlv = (MrvlExtIEtypes_Data_t *)pos;
ext_tlv->header.type = EXTENSION;

View file

@ -2344,15 +2344,30 @@ int woal_cfg80211_del_virtual_intf(struct wiphy *wiphy,
}
}
if (vir_priv && vir_priv->bss_type == MLAN_BSS_TYPE_UAP) {
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
woal_cfg80211_del_beacon(wiphy, dev, 0);
#else
woal_cfg80211_del_beacon(wiphy, dev);
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
vir_priv->wdev->links[0].ap.beacon_interval = 0;
#else
vir_priv->wdev->beacon_interval = 0;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
memset(&vir_priv->wdev->links[0].ap.chandef, 0,
sizeof(vir_priv->wdev->links[0].ap.chandef));
#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
memset(&vir_priv->wdev->chandef, 0,
sizeof(vir_priv->wdev->chandef));
#endif
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
vir_priv->wdev->u.ap.ssid_len = 0;
#else
vir_priv->wdev->ssid_len = 0;
#endif
PRINTM(MMSG, "Skip del UAP virtual interface %s",
dev->name);
}
@ -2627,7 +2642,11 @@ done:
*
* @return 0 -- success, otherwise fail
*/
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id)
#else
int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
#endif
{
moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
int ret = 0;
@ -3317,7 +3336,11 @@ static void woal_switch_uap_channel(moal_private *priv, t_u8 wait_option)
priv->channel = uap_channel.channel;
moal_memcpy_ext(priv->phandle, &priv->chan, &priv->csa_chan,
sizeof(struct cfg80211_chan_def), sizeof(priv->chan));
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
cfg80211_ch_switch_notify(priv->netdev, &priv->chan, 0);
#else
cfg80211_ch_switch_notify(priv->netdev, &priv->chan);
#endif
if (priv->uap_tx_blocked) {
if (!netif_carrier_ok(priv->netdev))
netif_carrier_on(priv->netdev);