mirror of
https://github.com/nxp-imx/mwifiex.git
synced 2025-01-15 16:25:35 +00:00
mxm_wifiex: fix P2P test fail on kernel higher than L5.12
P2P test will fail(deadlock) on kernel higher than L5.12, error log like below: root@imx8mmevk:~# wpa_cli -i p2p0 p2p_group_add freq=2412 [ 47.284346] Add virtual interface p2p-p2p0-0 'P2P_GROUP_ADD freq=2412' command timed out. This is because the upgarded kernel change the netdevs registration/unregistration semantics, new kernel require the drivers to call cfg80211_(un)register_netdevice() when this is happening due to a cfg80211 request. For more details, please refer to the upstream patch: https://lore.kernel.org/linux-wireless/20210122161942.cf2f4b65e4e9.Ida8234e50da13eb675b557bac52a713ad4eddf71@changeid/ Signed-off-by: Sherry Sun <sherry.sun@nxp.com> Approved-by: Tian Yang <yang.tian@nxp.com>
This commit is contained in:
parent
8c4e48738c
commit
3ba7550231
1 changed files with 16 additions and 0 deletions
|
@ -1651,12 +1651,20 @@ int woal_cfg80211_add_virt_if(struct wiphy *wiphy,
|
||||||
woal_cfg80211_init_p2p_client(new_priv);
|
woal_cfg80211_init_p2p_client(new_priv);
|
||||||
else if (type == NL80211_IFTYPE_P2P_GO)
|
else if (type == NL80211_IFTYPE_P2P_GO)
|
||||||
woal_cfg80211_init_p2p_go(new_priv);
|
woal_cfg80211_init_p2p_go(new_priv);
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
|
||||||
|
ret = cfg80211_register_netdevice(ndev);
|
||||||
|
#else
|
||||||
ret = register_netdevice(ndev);
|
ret = register_netdevice(ndev);
|
||||||
|
#endif
|
||||||
if (ret) {
|
if (ret) {
|
||||||
handle->priv[new_priv->bss_index] = NULL;
|
handle->priv[new_priv->bss_index] = NULL;
|
||||||
handle->priv_num--;
|
handle->priv_num--;
|
||||||
if (ndev->reg_state == NETREG_REGISTERED) {
|
if (ndev->reg_state == NETREG_REGISTERED) {
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
|
||||||
|
cfg80211_unregister_netdevice(ndev);
|
||||||
|
#else
|
||||||
unregister_netdevice(ndev);
|
unregister_netdevice(ndev);
|
||||||
|
#endif
|
||||||
free_netdev(ndev);
|
free_netdev(ndev);
|
||||||
ndev = NULL;
|
ndev = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1837,7 +1845,11 @@ int woal_cfg80211_del_virt_if(struct wiphy *wiphy, struct net_device *dev)
|
||||||
vir_priv->phandle->priv[vir_priv->bss_index] = NULL;
|
vir_priv->phandle->priv[vir_priv->bss_index] = NULL;
|
||||||
priv->phandle->priv_num--;
|
priv->phandle->priv_num--;
|
||||||
if (dev->reg_state == NETREG_REGISTERED)
|
if (dev->reg_state == NETREG_REGISTERED)
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
|
||||||
|
cfg80211_unregister_netdevice(dev);
|
||||||
|
#else
|
||||||
unregister_netdevice(dev);
|
unregister_netdevice(dev);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1876,7 +1888,11 @@ void woal_remove_virtual_interface(moal_handle *handle)
|
||||||
netif_device_detach(priv->netdev);
|
netif_device_detach(priv->netdev);
|
||||||
if (priv->netdev->reg_state ==
|
if (priv->netdev->reg_state ==
|
||||||
NETREG_REGISTERED)
|
NETREG_REGISTERED)
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
|
||||||
|
cfg80211_unregister_netdevice(priv->netdev);
|
||||||
|
#else
|
||||||
unregister_netdevice(priv->netdev);
|
unregister_netdevice(priv->netdev);
|
||||||
|
#endif
|
||||||
handle->priv[i] = NULL;
|
handle->priv[i] = NULL;
|
||||||
vir_intf++;
|
vir_intf++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue