Merge pull request #290 from CGarces/kernel_6.1

Fix kernel 6.1 compilation
This commit is contained in:
Carlos Garcés 2022-10-26 10:07:11 +02:00 committed by GitHub
commit 2181717490
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 12 deletions

View File

@ -29,8 +29,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
kernel_version: ${{fromJson(needs.commontasks.outputs.matrix)}} kernel_version: ${{fromJson(needs.commontasks.outputs.matrix)}}
gcc_version: [9, 10, 11] gcc_version: [9, 10, 12]
#kernel_version: [5.15-rc3,5.14.10] # kernel_version: [6.1-rc1]
steps: steps:
- name: Check Versions - name: Check Versions
id: check_version id: check_version
@ -38,7 +38,7 @@ jobs:
run: | run: |
echo ::set-output name=skip_build::False echo ::set-output name=skip_build::False
dpkg --compare-versions "${{matrix.kernel_version}}" "ge" "5.15" dpkg --compare-versions "${{matrix.kernel_version}}" "ge" "5.15"
if [ $? -eq "0" ] && [ ${{matrix.gcc_version}} -lt 11 ]; if [ $? -eq "0" ] && [ ${{matrix.gcc_version}} -lt 12 ];
then then
echo "GCC version not compatible" echo "GCC version not compatible"
echo ::set-output name=skip_build::True echo ::set-output name=skip_build::True

View File

@ -439,7 +439,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 (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
if (started) { 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_notify(adapter->pnetdev, &chdef, 0, false); cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0, false);
#else #else
cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0); cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0);
@ -1693,6 +1695,9 @@ exit:
} }
static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev 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 , u8 key_index
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
, bool pairwise , bool pairwise
@ -1837,6 +1842,9 @@ addkey_end:
} }
static int cfg80211_rtw_get_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 , u8 keyid
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
, bool pairwise , bool pairwise
@ -2002,6 +2010,9 @@ exit:
} }
static int cfg80211_rtw_del_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(6, 1, 0))
int link_id,
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
u8 key_index, bool pairwise, const u8 *mac_addr) u8 key_index, bool pairwise, const u8 *mac_addr)
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */ #else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */
@ -2022,10 +2033,14 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
} }
static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
struct net_device *ndev, u8 key_index struct net_device *ndev,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
int link_id,
#endif
u8 key_index
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE)
, bool unicast, bool multicast , bool unicast, bool multicast
#endif #endif
) )
{ {
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
@ -2070,7 +2085,11 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30))
int cfg80211_rtw_set_default_mgmt_key(struct wiphy *wiphy, int cfg80211_rtw_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *ndev, u8 key_index) struct net_device *ndev,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
int link_id,
#endif
u8 key_index)
{ {
#define SET_DEF_KEY_PARAM_FMT " key_index=%d" #define SET_DEF_KEY_PARAM_FMT " key_index=%d"
#define SET_DEF_KEY_PARAM_ARG , key_index #define SET_DEF_KEY_PARAM_ARG , key_index

View File

@ -1673,7 +1673,11 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name)
u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj); u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj);
#ifdef CONFIG_RTW_NAPI #ifdef CONFIG_RTW_NAPI
netif_napi_add(ndev, &adapter->napi, rtw_recv_napi_poll, RTL_NAPI_WEIGHT); netif_napi_add(ndev, &adapter->napi, rtw_recv_napi_poll
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
, RTL_NAPI_WEIGHT
#endif
);
#endif /* CONFIG_RTW_NAPI */ #endif /* CONFIG_RTW_NAPI */
#if defined(CONFIG_IOCTL_CFG80211) #if defined(CONFIG_IOCTL_CFG80211)

View File

@ -1617,8 +1617,9 @@ u64 rtw_division64(u64 x, u64 y)
inline u32 rtw_random32(void) inline u32 rtw_random32(void)
{ {
#ifdef PLATFORM_LINUX #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) return get_random_u32();
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
return prandom_u32(); return prandom_u32();
#elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) #elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
u32 random_int; u32 random_int;
@ -1627,7 +1628,6 @@ inline u32 rtw_random32(void)
#else #else
return random32(); return random32();
#endif #endif
#endif
} }
void rtw_buf_free(u8 **buf, u32 *buf_len) void rtw_buf_free(u8 **buf, u32 *buf_len)