From 7426e12395238796b454b197d8ae9ac190e3a39f Mon Sep 17 00:00:00 2001 From: Jesse Taube Date: Mon, 20 Mar 2023 18:11:17 -0400 Subject: [PATCH] Fix 6.1 cfg80211_ops changes cfg80211_ops structure has changed in 6.1 kernel. This patch fixes the build errors. Add ifdef for 6.1 kernel so function definitions are updated to match the new structure. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e7a7b84e33178db4a839c5e1773247be17597c1f Signed-off-by: Jesse Taube --- esp_hosted_ng/host/esp_cfg80211.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/esp_hosted_ng/host/esp_cfg80211.c b/esp_hosted_ng/host/esp_cfg80211.c index c5579ca..6fa92b9 100644 --- a/esp_hosted_ng/host/esp_cfg80211.c +++ b/esp_hosted_ng/host/esp_cfg80211.c @@ -314,8 +314,15 @@ static ESP_MGMT_TX_PROTOTYPE() return 0; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +/* e7a7b84e33178db4a839c5e1773247be17597c1f wifi: cfg80211: Add link_id parameter to various key operations for MLO */ +static int esp_cfg80211_set_default_key(struct wiphy *wiphy, + struct net_device *dev, int link_id, + u8 key_index, bool unicast, bool multicast) +#else static int esp_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *dev, u8 key_index, bool unicast, bool multicast) +#endif { struct esp_wifi_device *priv = NULL; @@ -333,8 +340,14 @@ static int esp_cfg80211_set_default_key(struct wiphy *wiphy, return cmd_set_default_key(priv, key_index); } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +/* e7a7b84e33178db4a839c5e1773247be17597c1f wifi: cfg80211: Add link_id parameter to various key operations for MLO */ +static int esp_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, + int link_id, u8 key_index, bool pairwise, const u8 *mac_addr) +#else static int esp_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, u8 key_index, bool pairwise, const u8 *mac_addr) +#endif { struct esp_wifi_device *priv = NULL; @@ -353,9 +366,16 @@ static int esp_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, return cmd_del_key(priv, key_index, pairwise, mac_addr); } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +/* e7a7b84e33178db4a839c5e1773247be17597c1f wifi: cfg80211: Add link_id parameter to various key operations for MLO */ +static int esp_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, + int link_id, u8 key_index, bool pairwise, const u8 *mac_addr, + struct key_params *params) +#else static int esp_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, u8 key_index, bool pairwise, const u8 *mac_addr, struct key_params *params) +#endif { struct esp_wifi_device *priv = NULL; @@ -371,9 +391,14 @@ static int esp_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, } printk(KERN_INFO "%s\n", __func__); - if (params->key_len == 0) + if (params->key_len == 0) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +/* e7a7b84e33178db4a839c5e1773247be17597c1f wifi: cfg80211: Add link_id parameter to various key operations for MLO */ + return esp_cfg80211_del_key(wiphy, dev, -1, key_index, pairwise, mac_addr); +#else return esp_cfg80211_del_key(wiphy, dev, key_index, pairwise, mac_addr); - +#endif + } return cmd_add_key(priv, key_index, pairwise, mac_addr, params); } -- 2.42.0