fix: support Linux 7.4 cfg80211 key type

Linux 7.4 replaces the bool pairwise parameter of the cfg80211 add_key,
get_key and del_key operations with enum nl80211_key_type, so the driver
no longer builds against it (three incompatible function pointer types
in rwnx_main.c).

For 7.4 and newer the three callbacks take the key type; add_key, the
only one that uses the flag, derives pairwise from it
(NL80211_KEYTYPE_PAIRWISE), so the key is installed exactly as before.
Older kernels keep the existing signatures.

Built with DKMS against 7.4.0-rc1 (CachyOS) and 7.3.1, and used on 7.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012SzrKCtbbm4dpBdvmx6rPE
This commit is contained in:
MastaGandClaude Opus 5.5 committed 2026-11-06 18:11:52 +01:00
1 parent 2e75f8885a
commit 03b3edf4e3
1 file changed
+19
+19
View File
@@ -2969,7 +2969,12 @@ static int rwnx_cfg80211_add_key(struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) #if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
int link_id, int link_id,
#endif #endif
#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 4, 0)
u8 key_index, enum nl80211_key_type key_type,
const u8 *mac_addr,
#else
u8 key_index, bool pairwise, const u8 *mac_addr, u8 key_index, bool pairwise, const u8 *mac_addr,
#endif
struct key_params *params) struct key_params *params)
{ {
struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy); struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy);
@@ -2983,6 +2988,10 @@ static int rwnx_cfg80211_add_key(struct wiphy *wiphy,
u8_l cipher = 0; u8_l cipher = 0;
struct rwnx_sta *sta = NULL; struct rwnx_sta *sta = NULL;
struct rwnx_key *rwnx_key; struct rwnx_key *rwnx_key;
#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 4, 0)
/* Linux 7.4 passes the key type instead of a pairwise flag */
bool pairwise = key_type == NL80211_KEYTYPE_PAIRWISE;
#endif
RWNX_DBG(RWNX_FN_ENTRY_STR); RWNX_DBG(RWNX_FN_ENTRY_STR);
@@ -3094,7 +3103,12 @@ static int rwnx_cfg80211_get_key(struct wiphy *wiphy,
int link_id, int link_id,
#endif #endif
#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 4, 0)
u8 key_index, enum nl80211_key_type key_type,
const u8 *mac_addr,
#else
u8 key_index, bool pairwise, const u8 *mac_addr, u8 key_index, bool pairwise, const u8 *mac_addr,
#endif
void *cookie, void *cookie,
void (*callback)(void *cookie, struct key_params*)) void (*callback)(void *cookie, struct key_params*))
{ {
@@ -3118,7 +3132,12 @@ static int rwnx_cfg80211_del_key(struct wiphy *wiphy,
int link_id, int link_id,
#endif #endif
#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 4, 0)
u8 key_index, enum nl80211_key_type key_type,
const u8 *mac_addr)
#else
u8 key_index, bool pairwise, const u8 *mac_addr) u8 key_index, bool pairwise, const u8 *mac_addr)
#endif
{ {
struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy); struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy);
#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) #if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)