0004-Fix-struct-station_parameters-Linux-6.1-build-failur.patch 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. From 5f022c4d3be32493d500be82f51032ef4fb3cdc0 Mon Sep 17 00:00:00 2001
  2. From: Giulio Benetti <giulio.benetti@benettiengineering.com>
  3. Date: Wed, 28 Dec 2022 21:08:45 +0100
  4. Subject: [PATCH] Fix struct station_parameters Linux 6.1 build failure
  5. Starting from Linux 6.1 struct station_parameters has changed by moving
  6. some member to its child struct link_station_parameters. Let's extract the
  7. values of the needed members into local values at the beginning of
  8. functions and substitute the member access with the local variables.
  9. [Upstream status: https://github.com/embeddedTS/wilc3000-external-module/pull/2]
  10. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
  11. ---
  12. cfg80211.c | 48 ++++++++++++++++++++++++++++++++----------------
  13. hif.c | 44 ++++++++++++++++++++++++++++++++------------
  14. 2 files changed, 64 insertions(+), 28 deletions(-)
  15. diff --git a/cfg80211.c b/cfg80211.c
  16. index 57c777d..bdd480c 100644
  17. --- a/cfg80211.c
  18. +++ b/cfg80211.c
  19. @@ -1866,6 +1866,14 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
  20. struct wilc_vif *vif = netdev_priv(dev);
  21. struct wilc_priv *priv = &vif->priv;
  22. u8 *assoc_bss = priv->assoc_stainfo.sta_associated_bss[params->aid];
  23. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
  24. + struct link_station_parameters *link_sta_params = &params->link_sta_params;
  25. + const struct ieee80211_ht_cap *ht_capa = link_sta_params->ht_capa;
  26. + u8 supported_rates_len = link_sta_params->supported_rates_len;
  27. +#else
  28. + const struct ieee80211_ht_cap *ht_capa = params->ht_capa;
  29. + u8 supported_rates_len = params->supported_rates_len;
  30. +#endif
  31. if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) {
  32. memcpy(assoc_bss, mac, ETH_ALEN);
  33. @@ -1879,27 +1887,27 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
  34. params->aid);
  35. PRINT_INFO(vif->ndev, HOSTAPD_DBG,
  36. "Number of supported rates = %d\n",
  37. - params->supported_rates_len);
  38. + supported_rates_len);
  39. PRINT_INFO(vif->ndev, CFG80211_DBG, "IS HT supported = %d\n",
  40. - (!params->ht_capa) ? false : true);
  41. + (!ht_capa) ? false : true);
  42. - if (params->ht_capa) {
  43. + if (ht_capa) {
  44. PRINT_INFO(vif->ndev, CFG80211_DBG,
  45. "Capability Info = %d\n",
  46. - params->ht_capa->cap_info);
  47. + ht_capa->cap_info);
  48. PRINT_INFO(vif->ndev, CFG80211_DBG,
  49. "AMPDU Params = %d\n",
  50. - params->ht_capa->ampdu_params_info);
  51. + ht_capa->ampdu_params_info);
  52. PRINT_INFO(vif->ndev, CFG80211_DBG,
  53. "HT Extended params= %d\n",
  54. - params->ht_capa->extended_ht_cap_info);
  55. + ht_capa->extended_ht_cap_info);
  56. PRINT_INFO(vif->ndev, CFG80211_DBG,
  57. "Tx Beamforming Cap= %d\n",
  58. - params->ht_capa->tx_BF_cap_info);
  59. + ht_capa->tx_BF_cap_info);
  60. PRINT_INFO(vif->ndev, CFG80211_DBG,
  61. "Antenna selection info = %d\n",
  62. - params->ht_capa->antenna_selection_info);
  63. + ht_capa->antenna_selection_info);
  64. }
  65. PRINT_INFO(vif->ndev, CFG80211_DBG, "Flag Mask = %d\n",
  66. @@ -1966,6 +1974,14 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
  67. {
  68. int ret = 0;
  69. struct wilc_vif *vif = netdev_priv(dev);
  70. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
  71. + struct link_station_parameters *link_sta_params = &params->link_sta_params;
  72. + const struct ieee80211_ht_cap *ht_capa = link_sta_params->ht_capa;
  73. + u8 supported_rates_len = link_sta_params->supported_rates_len;
  74. +#else
  75. + const struct ieee80211_ht_cap *ht_capa = params->ht_capa;
  76. + u8 supported_rates_len = params->supported_rates_len;
  77. +#endif
  78. PRINT_D(vif->ndev, CFG80211_DBG, "Change station parameters\n");
  79. @@ -1976,25 +1992,25 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
  80. params->aid);
  81. PRINT_INFO(vif->ndev, CFG80211_DBG,
  82. "Number of supported rates = %d\n",
  83. - params->supported_rates_len);
  84. + supported_rates_len);
  85. PRINT_INFO(vif->ndev, CFG80211_DBG, "IS HT supported = %d\n",
  86. - (!params->ht_capa) ? false : true);
  87. - if (params->ht_capa) {
  88. + (!ht_capa) ? false : true);
  89. + if (ht_capa) {
  90. PRINT_INFO(vif->ndev, CFG80211_DBG,
  91. "Capability Info = %d\n",
  92. - params->ht_capa->cap_info);
  93. + ht_capa->cap_info);
  94. PRINT_INFO(vif->ndev, CFG80211_DBG,
  95. "AMPDU Params = %d\n",
  96. - params->ht_capa->ampdu_params_info);
  97. + ht_capa->ampdu_params_info);
  98. PRINT_INFO(vif->ndev, CFG80211_DBG,
  99. "HT Extended params= %d\n",
  100. - params->ht_capa->extended_ht_cap_info);
  101. + ht_capa->extended_ht_cap_info);
  102. PRINT_INFO(vif->ndev, CFG80211_DBG,
  103. "Tx Beamforming Cap= %d\n",
  104. - params->ht_capa->tx_BF_cap_info);
  105. + ht_capa->tx_BF_cap_info);
  106. PRINT_INFO(vif->ndev, CFG80211_DBG,
  107. "Antenna selection info = %d\n",
  108. - params->ht_capa->antenna_selection_info);
  109. + ht_capa->antenna_selection_info);
  110. }
  111. PRINT_INFO(vif->ndev, CFG80211_DBG, "Flag Mask = %d\n",
  112. params->sta_flags_mask);
  113. diff --git a/hif.c b/hif.c
  114. index 3f672a0..1a7365b 100644
  115. --- a/hif.c
  116. +++ b/hif.c
  117. @@ -2249,6 +2249,16 @@ int wilc_add_station(struct wilc_vif *vif, const u8 *mac,
  118. int result;
  119. struct host_if_msg *msg;
  120. struct add_sta_param *sta_params;
  121. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
  122. + struct link_station_parameters *link_sta_params = &params->link_sta_params;
  123. + const struct ieee80211_ht_cap *ht_capa = link_sta_params->ht_capa;
  124. + u8 supported_rates_len = link_sta_params->supported_rates_len;
  125. + const u8 *supported_rates = link_sta_params->supported_rates;
  126. +#else
  127. + const struct ieee80211_ht_cap *ht_capa = params->ht_capa;
  128. + u8 supported_rates_len = params->supported_rates_len;
  129. + const u8 *supported_rates = params->supported_rates;
  130. +#endif
  131. PRINT_INFO(vif->ndev, HOSTINF_DBG,
  132. "Setting adding station message queue params\n");
  133. @@ -2260,20 +2270,20 @@ int wilc_add_station(struct wilc_vif *vif, const u8 *mac,
  134. sta_params = &msg->body.add_sta_info;
  135. memcpy(sta_params->bssid, mac, ETH_ALEN);
  136. sta_params->aid = params->aid;
  137. - if (!params->ht_capa) {
  138. + if (!ht_capa) {
  139. sta_params->ht_supported = false;
  140. } else {
  141. sta_params->ht_supported = true;
  142. - memcpy(&sta_params->ht_capa, params->ht_capa,
  143. + memcpy(&sta_params->ht_capa, ht_capa,
  144. sizeof(struct ieee80211_ht_cap));
  145. }
  146. sta_params->flags_mask = params->sta_flags_mask;
  147. sta_params->flags_set = params->sta_flags_set;
  148. - sta_params->supported_rates_len = params->supported_rates_len;
  149. - if (params->supported_rates_len > 0) {
  150. - sta_params->supported_rates = kmemdup(params->supported_rates,
  151. - params->supported_rates_len,
  152. + sta_params->supported_rates_len = supported_rates_len;
  153. + if (supported_rates_len > 0) {
  154. + sta_params->supported_rates = kmemdup(supported_rates,
  155. + supported_rates_len,
  156. GFP_KERNEL);
  157. if (!sta_params->supported_rates) {
  158. kfree(msg);
  159. @@ -2397,6 +2407,16 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
  160. int result;
  161. struct host_if_msg *msg;
  162. struct add_sta_param *sta_params;
  163. +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
  164. + struct link_station_parameters *link_sta_params = &params->link_sta_params;
  165. + const struct ieee80211_ht_cap *ht_capa = link_sta_params->ht_capa;
  166. + u8 supported_rates_len = link_sta_params->supported_rates_len;
  167. + const u8 *supported_rates = link_sta_params->supported_rates;
  168. +#else
  169. + const struct ieee80211_ht_cap *ht_capa = params->ht_capa;
  170. + u8 supported_rates_len = params->supported_rates_len;
  171. + const u8 *supported_rates = params->supported_rates;
  172. +#endif
  173. PRINT_INFO(vif->ndev, HOSTINF_DBG,
  174. "Setting editing station message queue params\n");
  175. @@ -2408,20 +2428,20 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
  176. sta_params = &msg->body.edit_sta_info;
  177. memcpy(sta_params->bssid, mac, ETH_ALEN);
  178. sta_params->aid = params->aid;
  179. - if (!params->ht_capa) {
  180. + if (!ht_capa) {
  181. sta_params->ht_supported = false;
  182. } else {
  183. sta_params->ht_supported = true;
  184. - memcpy(&sta_params->ht_capa, params->ht_capa,
  185. + memcpy(&sta_params->ht_capa, ht_capa,
  186. sizeof(struct ieee80211_ht_cap));
  187. }
  188. sta_params->flags_mask = params->sta_flags_mask;
  189. sta_params->flags_set = params->sta_flags_set;
  190. - sta_params->supported_rates_len = params->supported_rates_len;
  191. - if (params->supported_rates_len > 0) {
  192. - sta_params->supported_rates = kmemdup(params->supported_rates,
  193. - params->supported_rates_len,
  194. + sta_params->supported_rates_len = supported_rates_len;
  195. + if (supported_rates_len > 0) {
  196. + sta_params->supported_rates = kmemdup(supported_rates,
  197. + supported_rates_len,
  198. GFP_KERNEL);
  199. if (!sta_params->supported_rates) {
  200. kfree(msg);
  201. --
  202. 2.34.1