diff mbox

[RFC,4/8] cfg80211: Modify chandef related functions to work with 5/10MHz channels

Message ID 1394199475-5208-5-git-send-email-rostislav.lisovy@fel.cvut.cz (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Rostislav Lisovy March 7, 2014, 1:37 p.m. UTC
Signed-off-by: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz>
---
 include/net/cfg80211.h |  4 ++++
 net/wireless/chan.c    | 10 ++++++++++
 2 files changed, 14 insertions(+)

Comments

Johannes Berg March 7, 2014, 2:28 p.m. UTC | #1
On Fri, 2014-03-07 at 14:37 +0100, Rostislav Lisovy wrote:
> Signed-off-by: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz>
> ---
>  include/net/cfg80211.h |  4 ++++
>  net/wireless/chan.c    | 10 ++++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index f5ecd6c..16f19e0 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -367,6 +367,10 @@ static inline enum nl80211_channel_type
>  cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
>  {
>  	switch (chandef->width) {
> +	case NL80211_CHAN_WIDTH_5:
> +		return NL80211_CHAN_5MHZ;

NACK, this isn't needed, just fix the code to not use channel_type.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f5ecd6c..16f19e0 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -367,6 +367,10 @@  static inline enum nl80211_channel_type
 cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
 {
 	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_5:
+		return NL80211_CHAN_5MHZ;
+	case NL80211_CHAN_WIDTH_10:
+		return NL80211_CHAN_10MHZ;
 	case NL80211_CHAN_WIDTH_20_NOHT:
 		return NL80211_CHAN_NO_HT;
 	case NL80211_CHAN_WIDTH_20:
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 78559b5..0bcdd27 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -22,6 +22,14 @@  void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
 	chandef->center_freq2 = 0;
 
 	switch (chan_type) {
+	case NL80211_CHAN_5MHZ:
+		chandef->width = NL80211_CHAN_WIDTH_5;
+		chandef->center_freq1 = chan->center_freq;
+		break;
+	case NL80211_CHAN_10MHZ:
+		chandef->width = NL80211_CHAN_WIDTH_10;
+		chandef->center_freq1 = chan->center_freq;
+		break;
 	case NL80211_CHAN_NO_HT:
 		chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
 		chandef->center_freq1 = chan->center_freq;
@@ -531,12 +539,14 @@  bool cfg80211_chandef_usable(struct wiphy *wiphy,
 		width = 5;
 		break;
 	case NL80211_CHAN_WIDTH_10:
+		prohibited_flags |= IEEE80211_CHAN_NO_10MHZ;
 		width = 10;
 		break;
 	case NL80211_CHAN_WIDTH_20:
 		if (!ht_cap->ht_supported)
 			return false;
 	case NL80211_CHAN_WIDTH_20_NOHT:
+		prohibited_flags |= IEEE80211_CHAN_NO_20MHZ;
 		width = 20;
 		break;
 	case NL80211_CHAN_WIDTH_40: