|
|
deb259 |
From a10ba457727c6da7a599619faeb440521eb467d4 Mon Sep 17 00:00:00 2001
|
|
|
deb259 |
From: Eugene Syromiatnikov <esyr@redhat.com>
|
|
|
deb259 |
Date: Fri, 6 Sep 2019 01:54:25 +0200
|
|
|
deb259 |
Subject: [PATCH 7/7] Revert "cfg80211: make wmm_rule part of the reg_rule
|
|
|
deb259 |
structure"
|
|
|
deb259 |
|
|
|
deb259 |
This reverts commit 38cb87ee47fb825f6c9d645c019f75b3905c0ab2.
|
|
|
deb259 |
---
|
|
|
deb259 |
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 50 +++++++++++++++++++---
|
|
|
deb259 |
include/net/cfg80211.h | 4 +-
|
|
|
deb259 |
include/net/regulatory.h | 4 +-
|
|
|
deb259 |
3 files changed, 49 insertions(+), 9 deletions(-)
|
|
|
deb259 |
|
|
|
deb259 |
Index: src/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
|
|
|
deb259 |
===================================================================
|
|
|
deb259 |
--- src.orig/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c 2019-09-06 01:58:31.263992860 +0200
|
|
|
deb259 |
+++ src/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c 2019-09-06 01:58:39.281889631 +0200
|
|
|
deb259 |
@@ -879,12 +879,15 @@
|
|
|
deb259 |
const u8 *nvm_chan = cfg->nvm_type == IWL_NVM_EXT ?
|
|
|
deb259 |
iwl_ext_nvm_channels : iwl_nvm_channels;
|
|
|
deb259 |
struct ieee80211_regdomain *regd, *copy_rd;
|
|
|
deb259 |
- int size_of_regd, regd_to_copy;
|
|
|
deb259 |
+ int size_of_regd, regd_to_copy, wmms_to_copy;
|
|
|
deb259 |
+ int size_of_wmms = 0;
|
|
|
deb259 |
struct ieee80211_reg_rule *rule;
|
|
|
deb259 |
+ struct ieee80211_wmm_rule *wmm_rule, *d_wmm, *s_wmm;
|
|
|
deb259 |
struct regdb_ptrs *regdb_ptrs;
|
|
|
deb259 |
enum nl80211_band band;
|
|
|
deb259 |
int center_freq, prev_center_freq = 0;
|
|
|
deb259 |
- int valid_rules = 0;
|
|
|
deb259 |
+ int valid_rules = 0, n_wmms = 0;
|
|
|
deb259 |
+ int i;
|
|
|
deb259 |
bool new_rule;
|
|
|
deb259 |
int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ?
|
|
|
deb259 |
IWL_NVM_NUM_CHANNELS_EXT : IWL_NVM_NUM_CHANNELS;
|
|
|
deb259 |
@@ -903,7 +906,11 @@
|
|
|
deb259 |
sizeof(struct ieee80211_regdomain) +
|
|
|
deb259 |
num_of_ch * sizeof(struct ieee80211_reg_rule);
|
|
|
deb259 |
|
|
|
deb259 |
- regd = kzalloc(size_of_regd, GFP_KERNEL);
|
|
|
deb259 |
+ if (geo_info & GEO_WMM_ETSI_5GHZ_INFO)
|
|
|
deb259 |
+ size_of_wmms =
|
|
|
deb259 |
+ num_of_ch * sizeof(struct ieee80211_wmm_rule);
|
|
|
deb259 |
+
|
|
|
deb259 |
+ regd = kzalloc(size_of_regd + size_of_wmms, GFP_KERNEL);
|
|
|
deb259 |
if (!regd)
|
|
|
deb259 |
return ERR_PTR(-ENOMEM);
|
|
|
deb259 |
|
|
|
deb259 |
@@ -917,6 +924,8 @@
|
|
|
deb259 |
regd->alpha2[0] = fw_mcc >> 8;
|
|
|
deb259 |
regd->alpha2[1] = fw_mcc & 0xff;
|
|
|
deb259 |
|
|
|
deb259 |
+ wmm_rule = (struct ieee80211_wmm_rule *)((u8 *)regd + size_of_regd);
|
|
|
deb259 |
+
|
|
|
deb259 |
for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) {
|
|
|
deb259 |
ch_flags = (u16)__le32_to_cpup(channels + ch_idx);
|
|
|
deb259 |
band = (ch_idx < NUM_2GHZ_CHANNELS) ?
|
|
|
deb259 |
@@ -970,10 +979,26 @@
|
|
|
deb259 |
band == NL80211_BAND_2GHZ)
|
|
|
deb259 |
continue;
|
|
|
deb259 |
|
|
|
deb259 |
- reg_query_regdb_wmm(regd->alpha2, center_freq, rule);
|
|
|
deb259 |
+ if (!reg_query_regdb_wmm(regd->alpha2, center_freq,
|
|
|
deb259 |
+ ®db_ptrs[n_wmms].token, wmm_rule)) {
|
|
|
deb259 |
+ /* Add only new rules */
|
|
|
deb259 |
+ for (i = 0; i < n_wmms; i++) {
|
|
|
deb259 |
+ if (regdb_ptrs[i].token ==
|
|
|
deb259 |
+ regdb_ptrs[n_wmms].token) {
|
|
|
deb259 |
+ rule->wmm_rule = regdb_ptrs[i].rule;
|
|
|
deb259 |
+ break;
|
|
|
deb259 |
+ }
|
|
|
deb259 |
+ }
|
|
|
deb259 |
+ if (i == n_wmms) {
|
|
|
deb259 |
+ rule->wmm_rule = wmm_rule;
|
|
|
deb259 |
+ regdb_ptrs[n_wmms++].rule = wmm_rule;
|
|
|
deb259 |
+ wmm_rule++;
|
|
|
deb259 |
+ }
|
|
|
deb259 |
+ }
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
regd->n_reg_rules = valid_rules;
|
|
|
deb259 |
+ regd->n_wmm_rules = n_wmms;
|
|
|
deb259 |
|
|
|
deb259 |
/*
|
|
|
deb259 |
* Narrow down regdom for unused regulatory rules to prevent hole
|
|
|
deb259 |
@@ -982,13 +1007,28 @@
|
|
|
deb259 |
regd_to_copy = sizeof(struct ieee80211_regdomain) +
|
|
|
deb259 |
valid_rules * sizeof(struct ieee80211_reg_rule);
|
|
|
deb259 |
|
|
|
deb259 |
- copy_rd = kzalloc(regd_to_copy, GFP_KERNEL);
|
|
|
deb259 |
+ wmms_to_copy = sizeof(struct ieee80211_wmm_rule) * n_wmms;
|
|
|
deb259 |
+
|
|
|
deb259 |
+ copy_rd = kzalloc(regd_to_copy + wmms_to_copy, GFP_KERNEL);
|
|
|
deb259 |
if (!copy_rd) {
|
|
|
deb259 |
copy_rd = ERR_PTR(-ENOMEM);
|
|
|
deb259 |
goto out;
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
memcpy(copy_rd, regd, regd_to_copy);
|
|
|
deb259 |
+ memcpy((u8 *)copy_rd + regd_to_copy, (u8 *)regd + size_of_regd,
|
|
|
deb259 |
+ wmms_to_copy);
|
|
|
deb259 |
+
|
|
|
deb259 |
+ d_wmm = (struct ieee80211_wmm_rule *)((u8 *)copy_rd + regd_to_copy);
|
|
|
deb259 |
+ s_wmm = (struct ieee80211_wmm_rule *)((u8 *)regd + size_of_regd);
|
|
|
deb259 |
+
|
|
|
deb259 |
+ for (i = 0; i < regd->n_reg_rules; i++) {
|
|
|
deb259 |
+ if (!regd->reg_rules[i].wmm_rule)
|
|
|
deb259 |
+ continue;
|
|
|
deb259 |
+
|
|
|
deb259 |
+ copy_rd->reg_rules[i].wmm_rule = d_wmm +
|
|
|
deb259 |
+ (regd->reg_rules[i].wmm_rule - s_wmm);
|
|
|
deb259 |
+ }
|
|
|
deb259 |
|
|
|
deb259 |
out:
|
|
|
deb259 |
kfree(regdb_ptrs);
|