aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/cfg80211.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-08 17:14:50 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-26 06:42:59 -0500
commit3d9d1d6656a73ea8407734cfb00b81d14ef62d4b (patch)
tree74f8b3b4acd0b91068ebebbfaa00aaef1f7e097e /include/net/cfg80211.h
parent683b6d3b31a51956ea540df00abb0b78894924c1 (diff)
nl80211/cfg80211: support VHT channel configuration
Change nl80211 to support specifying a VHT (or HT) using the control channel frequency (as before) and new attributes for the channel width and first and second center frequency. The old channel type is of course still supported for HT. Also change the cfg80211 channel definition struct to support these by adding the relevant fields to it (and removing the _type field.) This also adds new helper functions: - cfg80211_chandef_create to create a channel def struct given the control channel and channel type, - cfg80211_chandef_identical to check if two channel definitions are identical - cfg80211_chandef_compatible to check if the given channel definitions are compatible, and return the wider of the two This isn't entirely complete, but that doesn't matter until we have a driver using it. In particular, it's missing - regulatory checks on the usable bandwidth (if that even makes sense) - regulatory TX power (database can't deal with it) - a proper channel compatibility calculation for the new channel types Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net/cfg80211.h')
-rw-r--r--include/net/cfg80211.h73
1 files changed, 69 insertions, 4 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 86f777af79e8..977da58fb7ea 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -308,21 +308,86 @@ struct key_params {
308/** 308/**
309 * struct cfg80211_chan_def - channel definition 309 * struct cfg80211_chan_def - channel definition
310 * @chan: the (control) channel 310 * @chan: the (control) channel
311 * @_type: the channel type, don't use this field, 311 * @width: channel width
312 * use cfg80211_get_chandef_type() if needed. 312 * @center_freq1: center frequency of first segment
313 * @center_freq2: center frequency of second segment
314 * (only with 80+80 MHz)
313 */ 315 */
314struct cfg80211_chan_def { 316struct cfg80211_chan_def {
315 struct ieee80211_channel *chan; 317 struct ieee80211_channel *chan;
316 enum nl80211_channel_type _type; 318 enum nl80211_chan_width width;
319 u32 center_freq1;
320 u32 center_freq2;
317}; 321};
318 322
323/**
324 * cfg80211_get_chandef_type - return old channel type from chandef
325 * @chandef: the channel definition
326 *
327 * Returns the old channel type (NOHT, HT20, HT40+/-) from a given
328 * chandef, which must have a bandwidth allowing this conversion.
329 */
319static inline enum nl80211_channel_type 330static inline enum nl80211_channel_type
320cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef) 331cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
321{ 332{
322 return chandef->_type; 333 switch (chandef->width) {
334 case NL80211_CHAN_WIDTH_20_NOHT:
335 return NL80211_CHAN_NO_HT;
336 case NL80211_CHAN_WIDTH_20:
337 return NL80211_CHAN_HT20;
338 case NL80211_CHAN_WIDTH_40:
339 if (chandef->center_freq1 > chandef->chan->center_freq)
340 return NL80211_CHAN_HT40PLUS;
341 return NL80211_CHAN_HT40MINUS;
342 default:
343 WARN_ON(1);
344 return NL80211_CHAN_NO_HT;
345 }
346}
347
348/**
349 * cfg80211_chandef_create - create channel definition using channel type
350 * @chandef: the channel definition struct to fill
351 * @channel: the control channel
352 * @chantype: the channel type
353 *
354 * Given a channel type, create a channel definition.
355 */
356void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
357 struct ieee80211_channel *channel,
358 enum nl80211_channel_type chantype);
359
360/**
361 * cfg80211_chandef_identical - check if two channel definitions are identical
362 * @chandef1: first channel definition
363 * @chandef2: second channel definition
364 *
365 * Returns %true if the channels defined by the channel definitions are
366 * identical, %false otherwise.
367 */
368static inline bool
369cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
370 const struct cfg80211_chan_def *chandef2)
371{
372 return (chandef1->chan == chandef2->chan &&
373 chandef1->width == chandef2->width &&
374 chandef1->center_freq1 == chandef2->center_freq1 &&
375 chandef1->center_freq2 == chandef2->center_freq2);
323} 376}
324 377
325/** 378/**
379 * cfg80211_chandef_compatible - check if two channel definitions are compatible
380 * @chandef1: first channel definition
381 * @chandef2: second channel definition
382 *
383 * Returns %NULL if the given channel definitions are incompatible,
384 * chandef1 or chandef2 otherwise.
385 */
386const struct cfg80211_chan_def *
387cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
388 const struct cfg80211_chan_def *chandef2);
389
390/**
326 * enum survey_info_flags - survey information flags 391 * enum survey_info_flags - survey information flags
327 * 392 *
328 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 393 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in