ath9k: Show channel type in debugfs.
Subsystems (2)
PATCH 1/3 ath9k: Show channel type in debugfs.
From: Ben Greear <[email protected]>
---
:100644 100644 25ea746... c3f495b... M drivers/net/wireless/ath/ath9k/debug.c
drivers/net/wireless/ath/ath9k/debug.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/debug.c +21 -2
@@ -398,12 +398,30 @@ static const char * ath_wiphy_state_str(enum ath_wiphy_state state)return "?" ; } +static const char *channel_type_str (enum nl80211_channel_type t) +{ +switch (t) { +case NL80211_CHAN_NO_HT : +return "no ht" ; +case NL80211_CHAN_HT20 : +return "ht20" ; +case NL80211_CHAN_HT40MINUS : +return "ht40-" ; +case NL80211_CHAN_HT40PLUS : +return "ht40+" ; +default : +return "???" ; + } +} +static ssize_t read_file_wiphy (struct file *file,char __user *user_buf,size_t count,loff_t *ppos) {struct ath_softc *sc = file->private_data;struct ath_wiphy *aphy = sc->pri_wiphy;struct ieee80211_channel *chan = aphy->hw->conf.channel; +struct ieee80211_conf *conf = &(aphy->hw->conf); +char buf[512 ];unsigned int len =0 ;int i;
@@ -411,11 +429,12 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,u32 tmp; len +=snprintf (buf + len,sizeof (buf) - len, -"primary: %s (%s chan=%d ht=%d)\n" , +"primary: %s (%s chan=%d channel-type: %d (%s))\n" ,wiphy_name (sc->pri_wiphy->hw->wiphy),ath_wiphy_state_str (sc->pri_wiphy->state),ieee80211_frequency_to_channel (chan->center_freq), - aphy->chan_is_ht); + conf->channel_type, +channel_type_str (conf->channel_type));put_unaligned_le32 (REG_READ_D (sc->sc_ah,AR_STA_ID0 ), addr);put_unaligned_le16 (REG_READ_D (sc->sc_ah,AR_STA_ID1 ) &0xffff , addr +4 );
Signature · 1 line
1.7.2.3
PATCH 2/3 mac80211: Show configured channel-type in netdev debugfs.
From: Ben Greear <[email protected]>
---
:100644 100644 872adb8... 4cffbf6... M net/mac80211/debugfs_netdev.c
net/mac80211/debugfs_netdev.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
net/mac80211/debugfs_netdev.c +6 -0
@@ -149,6 +149,7 @@ IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ], HEX);IEEE80211_IF_FILE (flags, flags,HEX );IEEE80211_IF_FILE (state, state,LHEX ); +IEEE80211_IF_FILE (channel_type, vif.bss_conf.channel_type,DEC );/* STA attributes */ IEEE80211_IF_FILE (bssid, u.mgd.bssid,MAC );
@@ -289,6 +290,7 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)DEBUGFS_ADD (drop_unencrypted);DEBUGFS_ADD (flags);DEBUGFS_ADD (state); +DEBUGFS_ADD (channel_type);DEBUGFS_ADD (rc_rateidx_mask_2ghz);DEBUGFS_ADD (rc_rateidx_mask_5ghz);
@@ -304,6 +306,7 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata)DEBUGFS_ADD (drop_unencrypted);DEBUGFS_ADD (flags);DEBUGFS_ADD (state); +DEBUGFS_ADD (channel_type);DEBUGFS_ADD (rc_rateidx_mask_2ghz);DEBUGFS_ADD (rc_rateidx_mask_5ghz);
@@ -317,6 +320,7 @@ static void add_wds_files(struct ieee80211_sub_if_data *sdata)DEBUGFS_ADD (drop_unencrypted);DEBUGFS_ADD (flags);DEBUGFS_ADD (state); +DEBUGFS_ADD (channel_type);DEBUGFS_ADD (rc_rateidx_mask_2ghz);DEBUGFS_ADD (rc_rateidx_mask_5ghz);
@@ -328,6 +332,7 @@ static void add_vlan_files(struct ieee80211_sub_if_data *sdata)DEBUGFS_ADD (drop_unencrypted);DEBUGFS_ADD (flags);DEBUGFS_ADD (state); +DEBUGFS_ADD (channel_type);DEBUGFS_ADD (rc_rateidx_mask_2ghz);DEBUGFS_ADD (rc_rateidx_mask_5ghz); }
@@ -336,6 +341,7 @@ static void add_monitor_files(struct ieee80211_sub_if_data *sdata) {DEBUGFS_ADD (flags);DEBUGFS_ADD (state); +DEBUGFS_ADD (channel_type); }#ifdef CONFIG_MAC80211_MESH
Signature · 1 line
1.7.2.3
PATCH 3/3 mac80211: Warn users if HT fails because of freq mismatch.
In reply to [email protected]From: Ben Greear <[email protected]>
I have a netgear WNDR3700 that appears to have an off-by-four bug in how it fills out the hti->control_chan (I configure the AP to channel 11, it reports 15 as control_chan).
Poke a message into the kernel logs to give users a clue as to why they are not getting the expected channel-type or rate.
---
:100644 100644 3221069... 7daabbe... M net/mac80211/mlme.c
net/mac80211/mlme.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-)
net/mac80211/mlme.c +22 -4
@@ -161,6 +161,7 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,struct ieee80211_supported_band *sband;struct sta_info *sta;u32 changed =0 ; +int hti_cfreq;u16 ht_opmode;bool enable_ht = true;enum nl80211_channel_type prev_chantype;
@@ -174,10 +175,27 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,if (!sband->ht_cap.ht_supported) enable_ht = false; -/* check that channel matches the right operating channel */ -if (local->hw.conf.channel->center_freq != -ieee80211_channel_to_frequency (hti->control_chan, sband->band)) - enable_ht = false; +if (enable_ht) { + hti_cfreq =ieee80211_channel_to_frequency (hti->control_chan, + sband->band); +/* check that channel matches the right operating channel */ +if (local->hw.conf.channel->center_freq != hti_cfreq) { +/* Some APs mess this up, evidently. +* Netgear WNDR3700 sometimes reports 4 higher than +* the actual channel, for instance. +*/ +printk (KERN_DEBUG +"%s: Wrong control channel in association" +" response: configured center-freq: %d" +" hti-cfreq: %d hti->control_chan: %d" +" band: %d. Disabling HT.\n" , + sdata->name, + local->hw.conf.channel->center_freq, + hti_cfreq, hti->control_chan, + sband->band); + enable_ht = false; + } + }if (enable_ht) { channel_type =NL80211_CHAN_HT20 ;
Signature · 1 line
1.7.2.3