Skip to content

Commit

Permalink
[RTL8852BU] Update for upstream change
Browse files Browse the repository at this point in the history
netif_napi_add() => netif_napi_add_weight()
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b48b89f

Add missing new argument to cfg80211_ch_switch_notify()
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b8c9024

roam_info.bssid => roam_info.links[0].bssid
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=efbabc1

cfg80211_rtw_*_key(): add int link_id
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e7a7b84

struct wireless_dev: current_bss => connected
lwfinger/rtl8723du@39c864c

REGULATORY_IGNORE_STALE_KICKOFF undeclared:
morrownr/88x2bu-20210702#165

Signed-off-by: MichaIng <micha@dietpi.com>
  • Loading branch information
MichaIng committed Jan 23, 2024
1 parent 40015d6 commit 1319320
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
39 changes: 36 additions & 3 deletions drivers/staging/rtl8852bu/os_dep/linux/ioctl_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset,

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
if (started) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0, 0, false);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0))

/* --- cfg80211_ch_switch_started_notfiy() ---
* A new parameter, bool quiet, is added from Linux kernel v5.11,
Expand All @@ -504,7 +506,11 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset,
if (!rtw_cfg80211_allow_ch_switch_notify(adapter))
goto exit;

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0);
#else
cfg80211_ch_switch_notify(adapter->pnetdev, &chdef);
#endif

#else
int freq = rtw_ch2freq(ch);
Expand Down Expand Up @@ -1188,7 +1194,7 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
#endif

#if defined(CPTCFG_VERSION) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
roam_info.bssid = cur_network->network.MacAddress;
roam_info.links[0].bssid = cur_network->network.MacAddress;
roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2;
roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2;
roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6;
Expand Down Expand Up @@ -1935,6 +1941,9 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
}

static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
, int link_id
#endif
, u8 key_index
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
, bool pairwise
Expand Down Expand Up @@ -2097,6 +2106,9 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
}

static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
, int link_id
#endif
, u8 keyid
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
, bool pairwise
Expand Down Expand Up @@ -2285,7 +2297,9 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
}

static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
int link_id, u8 key_index, bool pairwise, const u8 *mac_addr)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
u8 key_index, bool pairwise, const u8 *mac_addr)
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */
u8 key_index, const u8 *mac_addr)
Expand All @@ -2305,7 +2319,11 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
}

static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
struct net_device *ndev, int link_id, u8 key_index
#else
struct net_device *ndev, u8 key_index
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE)
, bool unicast, bool multicast
#endif
Expand Down Expand Up @@ -2353,7 +2371,11 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30))
int cfg80211_rtw_set_default_mgmt_key(struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
struct net_device *ndev, int link_id, u8 key_index)
#else
struct net_device *ndev, u8 key_index)
#endif
{
#define SET_DEF_KEY_PARAM_FMT " key_index=%d"
#define SET_DEF_KEY_PARAM_ARG , key_index
Expand Down Expand Up @@ -5417,7 +5439,11 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd
return ret;
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id)
#else
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
#endif
{
_adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);

Expand Down Expand Up @@ -6366,6 +6392,9 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
static int cfg80211_rtw_get_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
unsigned int link_id,
#endif
struct cfg80211_chan_def *chandef)
{
_adapter *padapter = wiphy_to_adapter(wiphy);
Expand Down Expand Up @@ -10785,7 +10814,11 @@ void rtw_wdev_unregister(struct wireless_dev *wdev)
rtw_cfg80211_indicate_scan_done(adapter, _TRUE);

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 2)
if (wdev->current_bss) {
#else
if (wdev->connected) {
#endif
RTW_INFO(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter));
rtw_cfg80211_indicate_disconnect(adapter, 0, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8852bu/os_dep/linux/os_intfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ int rtw_ndev_init(struct net_device *dev)
rtw_adapter_proc_init(dev);

#ifdef CONFIG_RTW_NAPI
netif_napi_add(dev, &adapter->napi, rtw_recv_napi_poll, RTL_NAPI_WEIGHT);
netif_napi_add_weight(dev, &adapter->napi, rtw_recv_napi_poll, RTL_NAPI_WEIGHT);
#endif /* CONFIG_RTW_NAPI */

return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8852bu/os_dep/linux/wifi_regd.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ int rtw_regd_init(struct wiphy *wiphy)
wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS;
#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 39))
wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF;
#endif

Expand Down

0 comments on commit 1319320

Please sign in to comment.