buildroot/package/wilc-driver/0004-Fix-struct-station_par...

217 lines
8.5 KiB
Diff

From 5f022c4d3be32493d500be82f51032ef4fb3cdc0 Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Wed, 28 Dec 2022 21:08:45 +0100
Subject: [PATCH] Fix struct station_parameters Linux 6.1 build failure
Starting from Linux 6.1 struct station_parameters has changed by moving
some member to its child struct link_station_parameters. Let's extract the
values of the needed members into local values at the beginning of
functions and substitute the member access with the local variables.
[Upstream status: https://github.com/embeddedTS/wilc3000-external-module/pull/2]
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
cfg80211.c | 48 ++++++++++++++++++++++++++++++++----------------
hif.c | 44 ++++++++++++++++++++++++++++++++------------
2 files changed, 64 insertions(+), 28 deletions(-)
diff --git a/cfg80211.c b/cfg80211.c
index 57c777d..bdd480c 100644
--- a/cfg80211.c
+++ b/cfg80211.c
@@ -1866,6 +1866,14 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
struct wilc_vif *vif = netdev_priv(dev);
struct wilc_priv *priv = &vif->priv;
u8 *assoc_bss = priv->assoc_stainfo.sta_associated_bss[params->aid];
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+ struct link_station_parameters *link_sta_params = &params->link_sta_params;
+ const struct ieee80211_ht_cap *ht_capa = link_sta_params->ht_capa;
+ u8 supported_rates_len = link_sta_params->supported_rates_len;
+#else
+ const struct ieee80211_ht_cap *ht_capa = params->ht_capa;
+ u8 supported_rates_len = params->supported_rates_len;
+#endif
if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) {
memcpy(assoc_bss, mac, ETH_ALEN);
@@ -1879,27 +1887,27 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
params->aid);
PRINT_INFO(vif->ndev, HOSTAPD_DBG,
"Number of supported rates = %d\n",
- params->supported_rates_len);
+ supported_rates_len);
PRINT_INFO(vif->ndev, CFG80211_DBG, "IS HT supported = %d\n",
- (!params->ht_capa) ? false : true);
+ (!ht_capa) ? false : true);
- if (params->ht_capa) {
+ if (ht_capa) {
PRINT_INFO(vif->ndev, CFG80211_DBG,
"Capability Info = %d\n",
- params->ht_capa->cap_info);
+ ht_capa->cap_info);
PRINT_INFO(vif->ndev, CFG80211_DBG,
"AMPDU Params = %d\n",
- params->ht_capa->ampdu_params_info);
+ ht_capa->ampdu_params_info);
PRINT_INFO(vif->ndev, CFG80211_DBG,
"HT Extended params= %d\n",
- params->ht_capa->extended_ht_cap_info);
+ ht_capa->extended_ht_cap_info);
PRINT_INFO(vif->ndev, CFG80211_DBG,
"Tx Beamforming Cap= %d\n",
- params->ht_capa->tx_BF_cap_info);
+ ht_capa->tx_BF_cap_info);
PRINT_INFO(vif->ndev, CFG80211_DBG,
"Antenna selection info = %d\n",
- params->ht_capa->antenna_selection_info);
+ ht_capa->antenna_selection_info);
}
PRINT_INFO(vif->ndev, CFG80211_DBG, "Flag Mask = %d\n",
@@ -1966,6 +1974,14 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
{
int ret = 0;
struct wilc_vif *vif = netdev_priv(dev);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+ struct link_station_parameters *link_sta_params = &params->link_sta_params;
+ const struct ieee80211_ht_cap *ht_capa = link_sta_params->ht_capa;
+ u8 supported_rates_len = link_sta_params->supported_rates_len;
+#else
+ const struct ieee80211_ht_cap *ht_capa = params->ht_capa;
+ u8 supported_rates_len = params->supported_rates_len;
+#endif
PRINT_D(vif->ndev, CFG80211_DBG, "Change station parameters\n");
@@ -1976,25 +1992,25 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
params->aid);
PRINT_INFO(vif->ndev, CFG80211_DBG,
"Number of supported rates = %d\n",
- params->supported_rates_len);
+ supported_rates_len);
PRINT_INFO(vif->ndev, CFG80211_DBG, "IS HT supported = %d\n",
- (!params->ht_capa) ? false : true);
- if (params->ht_capa) {
+ (!ht_capa) ? false : true);
+ if (ht_capa) {
PRINT_INFO(vif->ndev, CFG80211_DBG,
"Capability Info = %d\n",
- params->ht_capa->cap_info);
+ ht_capa->cap_info);
PRINT_INFO(vif->ndev, CFG80211_DBG,
"AMPDU Params = %d\n",
- params->ht_capa->ampdu_params_info);
+ ht_capa->ampdu_params_info);
PRINT_INFO(vif->ndev, CFG80211_DBG,
"HT Extended params= %d\n",
- params->ht_capa->extended_ht_cap_info);
+ ht_capa->extended_ht_cap_info);
PRINT_INFO(vif->ndev, CFG80211_DBG,
"Tx Beamforming Cap= %d\n",
- params->ht_capa->tx_BF_cap_info);
+ ht_capa->tx_BF_cap_info);
PRINT_INFO(vif->ndev, CFG80211_DBG,
"Antenna selection info = %d\n",
- params->ht_capa->antenna_selection_info);
+ ht_capa->antenna_selection_info);
}
PRINT_INFO(vif->ndev, CFG80211_DBG, "Flag Mask = %d\n",
params->sta_flags_mask);
diff --git a/hif.c b/hif.c
index 3f672a0..1a7365b 100644
--- a/hif.c
+++ b/hif.c
@@ -2249,6 +2249,16 @@ int wilc_add_station(struct wilc_vif *vif, const u8 *mac,
int result;
struct host_if_msg *msg;
struct add_sta_param *sta_params;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+ struct link_station_parameters *link_sta_params = &params->link_sta_params;
+ const struct ieee80211_ht_cap *ht_capa = link_sta_params->ht_capa;
+ u8 supported_rates_len = link_sta_params->supported_rates_len;
+ const u8 *supported_rates = link_sta_params->supported_rates;
+#else
+ const struct ieee80211_ht_cap *ht_capa = params->ht_capa;
+ u8 supported_rates_len = params->supported_rates_len;
+ const u8 *supported_rates = params->supported_rates;
+#endif
PRINT_INFO(vif->ndev, HOSTINF_DBG,
"Setting adding station message queue params\n");
@@ -2260,20 +2270,20 @@ int wilc_add_station(struct wilc_vif *vif, const u8 *mac,
sta_params = &msg->body.add_sta_info;
memcpy(sta_params->bssid, mac, ETH_ALEN);
sta_params->aid = params->aid;
- if (!params->ht_capa) {
+ if (!ht_capa) {
sta_params->ht_supported = false;
} else {
sta_params->ht_supported = true;
- memcpy(&sta_params->ht_capa, params->ht_capa,
+ memcpy(&sta_params->ht_capa, ht_capa,
sizeof(struct ieee80211_ht_cap));
}
sta_params->flags_mask = params->sta_flags_mask;
sta_params->flags_set = params->sta_flags_set;
- sta_params->supported_rates_len = params->supported_rates_len;
- if (params->supported_rates_len > 0) {
- sta_params->supported_rates = kmemdup(params->supported_rates,
- params->supported_rates_len,
+ sta_params->supported_rates_len = supported_rates_len;
+ if (supported_rates_len > 0) {
+ sta_params->supported_rates = kmemdup(supported_rates,
+ supported_rates_len,
GFP_KERNEL);
if (!sta_params->supported_rates) {
kfree(msg);
@@ -2397,6 +2407,16 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
int result;
struct host_if_msg *msg;
struct add_sta_param *sta_params;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+ struct link_station_parameters *link_sta_params = &params->link_sta_params;
+ const struct ieee80211_ht_cap *ht_capa = link_sta_params->ht_capa;
+ u8 supported_rates_len = link_sta_params->supported_rates_len;
+ const u8 *supported_rates = link_sta_params->supported_rates;
+#else
+ const struct ieee80211_ht_cap *ht_capa = params->ht_capa;
+ u8 supported_rates_len = params->supported_rates_len;
+ const u8 *supported_rates = params->supported_rates;
+#endif
PRINT_INFO(vif->ndev, HOSTINF_DBG,
"Setting editing station message queue params\n");
@@ -2408,20 +2428,20 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
sta_params = &msg->body.edit_sta_info;
memcpy(sta_params->bssid, mac, ETH_ALEN);
sta_params->aid = params->aid;
- if (!params->ht_capa) {
+ if (!ht_capa) {
sta_params->ht_supported = false;
} else {
sta_params->ht_supported = true;
- memcpy(&sta_params->ht_capa, params->ht_capa,
+ memcpy(&sta_params->ht_capa, ht_capa,
sizeof(struct ieee80211_ht_cap));
}
sta_params->flags_mask = params->sta_flags_mask;
sta_params->flags_set = params->sta_flags_set;
- sta_params->supported_rates_len = params->supported_rates_len;
- if (params->supported_rates_len > 0) {
- sta_params->supported_rates = kmemdup(params->supported_rates,
- params->supported_rates_len,
+ sta_params->supported_rates_len = supported_rates_len;
+ if (supported_rates_len > 0) {
+ sta_params->supported_rates = kmemdup(supported_rates,
+ supported_rates_len,
GFP_KERNEL);
if (!sta_params->supported_rates) {
kfree(msg);
--
2.34.1