kernel: add missing config symbols for 4.9
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 311-ath10k-Add-support-for-160Mhz.patch
1 From: Ben Greear <greearb@candelatech.com>
2 Date: Thu, 6 Oct 2016 17:34:14 -0700
3 Subject: [PATCH] ath10k: Add support for 160Mhz.
4
5 This patch was written by Sebastian Gottschall.
6
7 Signed-off-by: Ben Greear <greearb@candelatech.com>
8 Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
9 ---
10
11 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
12 +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
13 @@ -702,6 +702,10 @@ static void ath10k_htt_rx_h_rates(struct
14 /* 80MHZ */
15 case 2:
16 status->vht_flag |= RX_VHT_FLAG_80MHZ;
17 + break;
18 + case 3:
19 + status->vht_flag |= RX_VHT_FLAG_160MHZ;
20 + break;
21 }
22
23 status->flag |= RX_FLAG_VHT;
24 @@ -926,7 +930,7 @@ static void ath10k_process_rx(struct ath
25 *status = *rx_status;
26
27 ath10k_dbg(ar, ATH10K_DBG_DATA,
28 - "rx skb %pK len %u peer %pM %s %s sn %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%llx fcs-err %i mic-err %i amsdu-more %i\n",
29 + "rx skb %pK len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%llx fcs-err %i mic-err %i amsdu-more %i\n",
30 skb,
31 skb->len,
32 ieee80211_get_SA(hdr),
33 @@ -940,6 +944,7 @@ static void ath10k_process_rx(struct ath
34 status->flag & RX_FLAG_VHT ? "vht" : "",
35 status->flag & RX_FLAG_40MHZ ? "40" : "",
36 status->vht_flag & RX_VHT_FLAG_80MHZ ? "80" : "",
37 + status->vht_flag & RX_VHT_FLAG_160MHZ ? "160" : "",
38 status->flag & RX_FLAG_SHORT_GI ? "sgi " : "",
39 status->rate_idx,
40 status->vht_nss,
41 --- a/drivers/net/wireless/ath/ath10k/mac.c
42 +++ b/drivers/net/wireless/ath/ath10k/mac.c
43 @@ -568,10 +568,14 @@ chan_to_phymode(const struct cfg80211_ch
44 case NL80211_CHAN_WIDTH_80:
45 phymode = MODE_11AC_VHT80;
46 break;
47 + case NL80211_CHAN_WIDTH_160:
48 + phymode = MODE_11AC_VHT160;
49 + break;
50 + case NL80211_CHAN_WIDTH_80P80:
51 + phymode = MODE_11AC_VHT80_80;
52 + break;
53 case NL80211_CHAN_WIDTH_5:
54 case NL80211_CHAN_WIDTH_10:
55 - case NL80211_CHAN_WIDTH_80P80:
56 - case NL80211_CHAN_WIDTH_160:
57 phymode = MODE_UNKNOWN;
58 break;
59 }
60 @@ -970,6 +974,7 @@ static int ath10k_monitor_vdev_start(str
61 arg.vdev_id = vdev_id;
62 arg.channel.freq = channel->center_freq;
63 arg.channel.band_center_freq1 = chandef->center_freq1;
64 + arg.channel.band_center_freq2 = chandef->center_freq2;
65
66 /* TODO setup this dynamically, what in case we
67 don't have any vifs? */
68 @@ -1381,6 +1386,7 @@ static int ath10k_vdev_start_restart(str
69
70 arg.channel.freq = chandef->chan->center_freq;
71 arg.channel.band_center_freq1 = chandef->center_freq1;
72 + arg.channel.band_center_freq2 = chandef->center_freq2;
73 arg.channel.mode = chan_to_phymode(chandef);
74
75 arg.channel.min_power = 0;
76 @@ -2444,6 +2450,9 @@ static void ath10k_peer_assoc_h_vht(stru
77 if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
78 arg->peer_flags |= ar->wmi.peer_flags->bw80;
79
80 + if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
81 + arg->peer_flags |= ar->wmi.peer_flags->bw160;
82 +
83 arg->peer_vht_rates.rx_max_rate =
84 __le16_to_cpu(vht_cap->vht_mcs.rx_highest);
85 arg->peer_vht_rates.rx_mcs_set =
86 @@ -2545,7 +2554,17 @@ static void ath10k_peer_assoc_h_phymode(
87 !ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) {
88 if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
89 phymode = MODE_11AC_VHT80;
90 - else if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
91 + else if (sta->bandwidth == IEEE80211_STA_RX_BW_160) {
92 + phymode = MODE_11AC_VHT160;
93 + switch (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
94 + case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ:
95 + phymode = MODE_11AC_VHT160;
96 + break;
97 + case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ:
98 + phymode = MODE_11AC_VHT80_80;
99 + break;
100 + }
101 + } else if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
102 phymode = MODE_11AC_VHT40;
103 else if (sta->bandwidth == IEEE80211_STA_RX_BW_20)
104 phymode = MODE_11AC_VHT20;
105 @@ -4277,6 +4296,10 @@ static struct ieee80211_sta_vht_cap ath1
106 vht_cap.cap |= val;
107 }
108
109 + if ((ar->vht_cap_info & IEEE80211_VHT_CAP_SHORT_GI_160) && !(ar->vht_cap_info & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) {
110 + vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
111 + }
112 +
113 mcs_map = 0;
114 for (i = 0; i < 8; i++) {
115 if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i)))
116 @@ -6913,6 +6936,9 @@ static void ath10k_sta_rc_update(struct
117 bw = WMI_PEER_CHWIDTH_80MHZ;
118 break;
119 case IEEE80211_STA_RX_BW_160:
120 + bw = WMI_PEER_CHWIDTH_160MHZ;
121 + break;
122 + default:
123 ath10k_warn(ar, "Invalid bandwidth %d in rc update for %pM\n",
124 sta->bandwidth, sta->addr);
125 bw = WMI_PEER_CHWIDTH_20MHZ;
126 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
127 +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
128 @@ -3560,6 +3560,7 @@ static const struct wmi_peer_flags_map w
129 .vht = WMI_TLV_PEER_VHT,
130 .bw80 = WMI_TLV_PEER_80MHZ,
131 .pmf = WMI_TLV_PEER_PMF,
132 + .bw160 = WMI_TLV_PEER_160MHZ,
133 };
134
135 /************/
136 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
137 +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
138 @@ -543,6 +543,7 @@ enum wmi_tlv_peer_flags {
139 WMI_TLV_PEER_VHT = 0x02000000,
140 WMI_TLV_PEER_80MHZ = 0x04000000,
141 WMI_TLV_PEER_PMF = 0x08000000,
142 + WMI_TLV_PEER_160MHZ = 0x20000000,
143 };
144
145 enum wmi_tlv_tag {
146 --- a/drivers/net/wireless/ath/ath10k/wmi.c
147 +++ b/drivers/net/wireless/ath/ath10k/wmi.c
148 @@ -1576,6 +1576,7 @@ static const struct wmi_peer_flags_map w
149 .bw80 = WMI_PEER_80MHZ,
150 .vht_2g = WMI_PEER_VHT_2G,
151 .pmf = WMI_PEER_PMF,
152 + .bw160 = WMI_PEER_160MHZ,
153 };
154
155 static const struct wmi_peer_flags_map wmi_10x_peer_flags_map = {
156 @@ -1593,6 +1594,7 @@ static const struct wmi_peer_flags_map w
157 .spatial_mux = WMI_10X_PEER_SPATIAL_MUX,
158 .vht = WMI_10X_PEER_VHT,
159 .bw80 = WMI_10X_PEER_80MHZ,
160 + .bw160 = WMI_10X_PEER_160MHZ,
161 };
162
163 static const struct wmi_peer_flags_map wmi_10_2_peer_flags_map = {
164 @@ -1612,6 +1614,7 @@ static const struct wmi_peer_flags_map w
165 .bw80 = WMI_10_2_PEER_80MHZ,
166 .vht_2g = WMI_10_2_PEER_VHT_2G,
167 .pmf = WMI_10_2_PEER_PMF,
168 + .bw160 = WMI_10_2_PEER_160MHZ,
169 };
170
171 void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch,
172 @@ -1636,7 +1639,10 @@ void ath10k_wmi_put_wmi_channel(struct w
173
174 ch->mhz = __cpu_to_le32(arg->freq);
175 ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1);
176 - ch->band_center_freq2 = 0;
177 + if (arg->mode == MODE_11AC_VHT80_80)
178 + ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq2);
179 + else
180 + ch->band_center_freq2 = 0;
181 ch->min_power = arg->min_power;
182 ch->max_power = arg->max_power;
183 ch->reg_power = arg->max_reg_power;
184 --- a/drivers/net/wireless/ath/ath10k/wmi.h
185 +++ b/drivers/net/wireless/ath/ath10k/wmi.h
186 @@ -1728,8 +1728,10 @@ enum wmi_phy_mode {
187 MODE_11AC_VHT20_2G = 11,
188 MODE_11AC_VHT40_2G = 12,
189 MODE_11AC_VHT80_2G = 13,
190 - MODE_UNKNOWN = 14,
191 - MODE_MAX = 14
192 + MODE_11AC_VHT80_80 = 14,
193 + MODE_11AC_VHT160 = 15,
194 + MODE_UNKNOWN = 16,
195 + MODE_MAX = 16
196 };
197
198 static inline const char *ath10k_wmi_phymode_str(enum wmi_phy_mode mode)
199 @@ -1757,6 +1759,10 @@ static inline const char *ath10k_wmi_phy
200 return "11ac-vht40";
201 case MODE_11AC_VHT80:
202 return "11ac-vht80";
203 + case MODE_11AC_VHT160:
204 + return "11ac-vht160";
205 + case MODE_11AC_VHT80_80:
206 + return "11ac-vht80+80";
207 case MODE_11AC_VHT20_2G:
208 return "11ac-vht20-2g";
209 case MODE_11AC_VHT40_2G:
210 @@ -1811,6 +1817,7 @@ struct wmi_channel {
211 struct wmi_channel_arg {
212 u32 freq;
213 u32 band_center_freq1;
214 + u32 band_center_freq2;
215 bool passive;
216 bool allow_ibss;
217 bool allow_ht;
218 @@ -1875,9 +1882,18 @@ enum wmi_channel_change_cause {
219 #define WMI_VHT_CAP_MAX_MPDU_LEN_MASK 0x00000003
220 #define WMI_VHT_CAP_RX_LDPC 0x00000010
221 #define WMI_VHT_CAP_SGI_80MHZ 0x00000020
222 +#define WMI_VHT_CAP_SGI_160MHZ 0x00000040
223 #define WMI_VHT_CAP_TX_STBC 0x00000080
224 #define WMI_VHT_CAP_RX_STBC_MASK 0x00000300
225 #define WMI_VHT_CAP_RX_STBC_MASK_SHIFT 8
226 +#define WMI_VHT_CAP_SU_BFER 0x00000800
227 +#define WMI_VHT_CAP_SU_BFEE 0x00001000
228 +#define WMI_VHT_CAP_MAX_CS_ANT_MASK 0x0000E000
229 +#define WMI_VHT_CAP_MAX_CS_ANT_MASK_SHIFT 13
230 +#define WMI_VHT_CAP_MAX_SND_DIM_MASK 0x00070000
231 +#define WMI_VHT_CAP_MAX_SND_DIM_MASK_SHIFT 16
232 +#define WMI_VHT_CAP_MU_BFER 0x00080000
233 +#define WMI_VHT_CAP_MU_BFEE 0x00100000
234 #define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP 0x03800000
235 #define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIFT 23
236 #define WMI_VHT_CAP_RX_FIXED_ANT 0x10000000
237 @@ -1926,6 +1942,8 @@ enum {
238 REGDMN_MODE_11AC_VHT40PLUS = 0x40000, /* 5Ghz, VHT40 + channels */
239 REGDMN_MODE_11AC_VHT40MINUS = 0x80000, /* 5Ghz VHT40 - channels */
240 REGDMN_MODE_11AC_VHT80 = 0x100000, /* 5Ghz, VHT80 channels */
241 + REGDMN_MODE_11AC_VHT160 = 0x200000, /* 5Ghz, VHT160 channels */
242 + REGDMN_MODE_11AC_VHT80_80 = 0x400000, /* 5Ghz, VHT80+80 channels */
243 REGDMN_MODE_ALL = 0xffffffff
244 };
245
246 @@ -5769,6 +5787,7 @@ enum wmi_peer_chwidth {
247 WMI_PEER_CHWIDTH_20MHZ = 0,
248 WMI_PEER_CHWIDTH_40MHZ = 1,
249 WMI_PEER_CHWIDTH_80MHZ = 2,
250 + WMI_PEER_CHWIDTH_160MHZ = 3,
251 };
252
253 enum wmi_peer_param {
254 @@ -5859,6 +5878,7 @@ struct wmi_peer_flags_map {
255 u32 bw80;
256 u32 vht_2g;
257 u32 pmf;
258 + u32 bw160;
259 };
260
261 enum wmi_peer_flags {
262 @@ -5878,6 +5898,7 @@ enum wmi_peer_flags {
263 WMI_PEER_80MHZ = 0x04000000,
264 WMI_PEER_VHT_2G = 0x08000000,
265 WMI_PEER_PMF = 0x10000000,
266 + WMI_PEER_160MHZ = 0x20000000
267 };
268
269 enum wmi_10x_peer_flags {
270 @@ -5895,6 +5916,7 @@ enum wmi_10x_peer_flags {
271 WMI_10X_PEER_SPATIAL_MUX = 0x00200000,
272 WMI_10X_PEER_VHT = 0x02000000,
273 WMI_10X_PEER_80MHZ = 0x04000000,
274 + WMI_10X_PEER_160MHZ = 0x20000000
275 };
276
277 enum wmi_10_2_peer_flags {
278 @@ -5914,6 +5936,7 @@ enum wmi_10_2_peer_flags {
279 WMI_10_2_PEER_80MHZ = 0x04000000,
280 WMI_10_2_PEER_VHT_2G = 0x08000000,
281 WMI_10_2_PEER_PMF = 0x10000000,
282 + WMI_10_2_PEER_160MHZ = 0x20000000
283 };
284
285 /*