| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * spectrum management |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 8 | 9 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> |
|---|
| 9 | 10 | * Copyright 2007-2008, Intel Corporation |
|---|
| 10 | 11 | * Copyright 2008, Johannes Berg <johannes@sipsolutions.net> |
|---|
| 11 | | - * Copyright (C) 2018 Intel Corporation |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 14 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 15 | | - * published by the Free Software Foundation. |
|---|
| 12 | + * Copyright (C) 2018, 2020 Intel Corporation |
|---|
| 16 | 13 | */ |
|---|
| 17 | 14 | |
|---|
| 18 | 15 | #include <linux/ieee80211.h> |
|---|
| .. | .. |
|---|
| 25 | 22 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, |
|---|
| 26 | 23 | struct ieee802_11_elems *elems, |
|---|
| 27 | 24 | enum nl80211_band current_band, |
|---|
| 25 | + u32 vht_cap_info, |
|---|
| 28 | 26 | u32 sta_flags, u8 *bssid, |
|---|
| 29 | 27 | struct ieee80211_csa_ie *csa_ie) |
|---|
| 30 | 28 | { |
|---|
| .. | .. |
|---|
| 135 | 133 | } |
|---|
| 136 | 134 | |
|---|
| 137 | 135 | if (wide_bw_chansw_ie) { |
|---|
| 136 | + u8 new_seg1 = wide_bw_chansw_ie->new_center_freq_seg1; |
|---|
| 138 | 137 | struct ieee80211_vht_operation vht_oper = { |
|---|
| 139 | 138 | .chan_width = |
|---|
| 140 | 139 | wide_bw_chansw_ie->new_channel_width, |
|---|
| 141 | 140 | .center_freq_seg0_idx = |
|---|
| 142 | 141 | wide_bw_chansw_ie->new_center_freq_seg0, |
|---|
| 143 | | - .center_freq_seg1_idx = |
|---|
| 144 | | - wide_bw_chansw_ie->new_center_freq_seg1, |
|---|
| 142 | + .center_freq_seg1_idx = new_seg1, |
|---|
| 145 | 143 | /* .basic_mcs_set doesn't matter */ |
|---|
| 144 | + }; |
|---|
| 145 | + struct ieee80211_ht_operation ht_oper = { |
|---|
| 146 | + .operation_mode = |
|---|
| 147 | + cpu_to_le16(new_seg1 << |
|---|
| 148 | + IEEE80211_HT_OP_MODE_CCFS2_SHIFT), |
|---|
| 146 | 149 | }; |
|---|
| 147 | 150 | |
|---|
| 148 | 151 | /* default, for the case of IEEE80211_VHT_CHANWIDTH_USE_HT, |
|---|
| .. | .. |
|---|
| 151 | 154 | new_vht_chandef = csa_ie->chandef; |
|---|
| 152 | 155 | |
|---|
| 153 | 156 | /* ignore if parsing fails */ |
|---|
| 154 | | - if (!ieee80211_chandef_vht_oper(&vht_oper, &new_vht_chandef)) |
|---|
| 157 | + if (!ieee80211_chandef_vht_oper(&sdata->local->hw, |
|---|
| 158 | + vht_cap_info, |
|---|
| 159 | + &vht_oper, &ht_oper, |
|---|
| 160 | + &new_vht_chandef)) |
|---|
| 155 | 161 | new_vht_chandef.chan = NULL; |
|---|
| 156 | 162 | |
|---|
| 157 | 163 | if (sta_flags & IEEE80211_STA_DISABLE_80P80MHZ && |
|---|
| .. | .. |
|---|
| 174 | 180 | csa_ie->chandef = new_vht_chandef; |
|---|
| 175 | 181 | } |
|---|
| 176 | 182 | |
|---|
| 183 | + if (elems->max_channel_switch_time) |
|---|
| 184 | + csa_ie->max_switch_time = |
|---|
| 185 | + (elems->max_channel_switch_time[0] << 0) | |
|---|
| 186 | + (elems->max_channel_switch_time[1] << 8) | |
|---|
| 187 | + (elems->max_channel_switch_time[2] << 16); |
|---|
| 188 | + |
|---|
| 177 | 189 | return 0; |
|---|
| 178 | 190 | } |
|---|
| 179 | 191 | |
|---|