* [PATCH] ath9k: Improve debugfs printout for stations.
From: greearb @ 2011-11-03 18:33 UTC (permalink / raw)
To: linux-wireless, ath9k-devel; +Cc: Ben Greear
From: Ben Greear <greearb@candelatech.com>
Add interface address so it can be mapped to a local
interface. Add max-ampdu and mpdu-density.
Print out the tid->baw_size
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 1c269f5... 3d3b44f... M drivers/net/wireless/ath/ath9k/ath9k.h
:100644 100644 327aa28... 8e7e57c... M drivers/net/wireless/ath/ath9k/debug.c
:100644 100644 93fbe6f... f8c87d3... M drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/ath9k.h | 1 +
drivers/net/wireless/ath/ath9k/debug.c | 13 +++++++++----
drivers/net/wireless/ath/ath9k/main.c | 6 ++++--
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 1c269f5..3d3b44f 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -252,6 +252,7 @@ struct ath_node {
#ifdef CONFIG_ATH9K_DEBUGFS
struct list_head list; /* for sc->nodes */
struct ieee80211_sta *sta; /* station struct we're part of */
+ struct ieee80211_vif *vif; /* interface with which we're associated */
#endif
struct ath_atx_tid tid[WME_NUM_TID];
struct ath_atx_ac ac[WME_NUM_AC];
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 327aa28..8e7e57c 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -708,24 +708,29 @@ static ssize_t read_file_stations(struct file *file, char __user *user_buf,
len += snprintf(buf + len, size - len,
"Stations:\n"
- " tid: addr sched paused buf_q-empty an ac\n"
+ " tid: addr sched paused buf_q-empty an ac baw\n"
" ac: addr sched tid_q-empty txq\n");
spin_lock(&sc->nodes_lock);
list_for_each_entry(an, &sc->nodes, list) {
+ unsigned short ma = an->maxampdu;
+ if (ma == 0)
+ ma = 65535; /* see ath_lookup_rate */
len += snprintf(buf + len, size - len,
- "%pM\n", an->sta->addr);
+ "iface: %pM sta: %pM max-ampdu: %hu mpdu-density: %uus\n",
+ an->vif->addr, an->sta->addr, ma,
+ (unsigned int)(an->mpdudensity));
if (len >= size)
goto done;
for (q = 0; q < WME_NUM_TID; q++) {
struct ath_atx_tid *tid = &(an->tid[q]);
len += snprintf(buf + len, size - len,
- " tid: %p %s %s %i %p %p\n",
+ " tid: %p %s %s %i %p %p %hu\n",
tid, tid->sched ? "sched" : "idle",
tid->paused ? "paused" : "running",
skb_queue_empty(&tid->buf_q),
- tid->an, tid->ac);
+ tid->an, tid->ac, tid->baw_size);
if (len >= size)
goto done;
}
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 93fbe6f..f8c87d3 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -630,7 +630,8 @@ set_timer:
}
}
-static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta)
+static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta,
+ struct ieee80211_vif *vif)
{
struct ath_node *an;
an = (struct ath_node *)sta->drv_priv;
@@ -640,6 +641,7 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta)
list_add(&an->list, &sc->nodes);
spin_unlock(&sc->nodes_lock);
an->sta = sta;
+ an->vif = vif;
#endif
if (sc->sc_flags & SC_OP_TXAGGR) {
ath_tx_node_init(sc, an);
@@ -1798,7 +1800,7 @@ static int ath9k_sta_add(struct ieee80211_hw *hw,
struct ath_node *an = (struct ath_node *) sta->drv_priv;
struct ieee80211_key_conf ps_key = { };
- ath_node_attach(sc, sta);
+ ath_node_attach(sc, sta, vif);
if (vif->type != NL80211_IFTYPE_AP &&
vif->type != NL80211_IFTYPE_AP_VLAN)
--
1.7.3.4
^ permalink raw reply related
* Re: [wireless-next PATCH 1/5] mac80211: Support forcing station to disable 11n.
From: Ben Greear @ 2011-11-03 18:17 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1320309058.3950.7.camel@jlt3.sipsolutions.net>
On 11/03/2011 01:30 AM, Johannes Berg wrote:
> On Wed, 2011-11-02 at 23:04 -0700, Ben Greear wrote:
>
>> I think I made at least most of the other changes you were asking
>> for, but I'm still baffled about what to do about fullmac drivers.
>>
>> Based on the comment above, if I simply left out the mac80211 stuff
>> then the new values passed in to the associate/connect logic will just
>> be ignored.
>>
>> So, I suppose the fullmac drivers will just silently ignore the new
>> variables as well. I looked, but didn't figure out where fullmac
>> connects into the cfg80211 logic. If I can find it, then I could
>> add explicit checks for the new variables and return failure if
>> they are set..but I'm not sure that is any better than just silently
>> ignoring them anyway.
>
> So I think just ignoring it would be a bad idea, because you have no way
> to know whether or not the values were used afterwards. That might be
> sufficient for you right now, but typically becomes a support problem at
> some point because people try it and can't figure out what part broke.
> That's why I think silently ignoring something like that is not a good
> idea.
>
> Hence the typical handling of this with a wiphy flag that you set and if
> it's unset but userspace is requesting this you reject the command.
So back to the capabilities flag like I added in the -v2 patch?
Do you want one flag for each thing (set-mcs, disable-ht,
disable-ht40, set-mpdu, set-msdu), or maybe one flag for all of
this: set-ht-cap
My opinion remains that we should silently ignore un-supported
values..this way user-space works with the same config on old and new
kernels. In future patches, we can report the actual settings via
netlink or similar.
But, I can add logic in user-space to detect kernel versions and
such and deal with this.
So, please tell me how you want it done. If it's capabilities flags,
that is fine with me.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Felix Fietkau @ 2011-11-03 18:15 UTC (permalink / raw)
To: Zefir Kurtisi; +Cc: linux-wireless, ath9k-devel, rodrigue
In-Reply-To: <4EB2D6DE.3050207@neratec.com>
On 2011-11-03 7:01 PM, Zefir Kurtisi wrote:
> Hi Felix,
>
> while I was waiting for your feedback on my related patch, I assumed
> you're okay with having those rx filter flags preserved in ath_calcrxfilter.
I did send some feedback on the rx filter preserve patch. I think it's
unnecessary and should be left out. If calcrxfilter properly returns the
ATH9K_RX_FILTER_PHYRADAR flag where necessary, then no preserve logic is
needed.
> I'll check your proposal for v3.
>
> BTW, as the comment says, it is TODO enable radar detection only for
> DFS channels. Beside the lack of the management module to provide the
> relevant information, it comes handy to test pulse detection on non-DFS
> channels without the need to modify hostapd ;)
Yeah, but it would be nice to split hardware capability from runtime
state early on.
- Felix
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Zefir Kurtisi @ 2011-11-03 18:01 UTC (permalink / raw)
To: Felix Fietkau; +Cc: linux-wireless, ath9k-devel, rodrigue
In-Reply-To: <4EB2AF36.9070608@openwrt.org>
On 11/03/2011 04:11 PM, Felix Fietkau wrote:
> On 2011-11-03 2:55 PM, Zefir Kurtisi wrote:
>> This patch integrates the DFS module into ath9k, including
>> * building the module into ath9k_hw
>> * setting up DFS debugfs
>> * defining HW capability flag for DFS support
>> * setting this flag by DFS supporting devices
>> (so far: AR_SREV_9280_20_OR_LATER, TBC)
>> * setting PHYRADAR rx filter flag to enable radar
>> pulse reporting
>> * forward radar PHY errors to dfs module
>>
>> This is WIP and at its current stage is limited to test ath9k
>> pulse detection capabilities. The DFS pattern matching is
>> TBD in the higher layers and is not part of this patch.
>>
>> CONFIG_ATH9K_DFS must be set to enable pulse detection.
>>
>> Signed-off-by: Zefir Kurtisi<zefir.kurtisi@neratec.com>
>> ---
>> drivers/net/wireless/ath/ath9k/Makefile | 2 ++
>> drivers/net/wireless/ath/ath9k/debug.c | 3 +++
>> drivers/net/wireless/ath/ath9k/debug.h | 2 ++
>> drivers/net/wireless/ath/ath9k/hw.c | 12 ++++++++++++
>> drivers/net/wireless/ath/ath9k/hw.h | 1 +
>> drivers/net/wireless/ath/ath9k/main.c | 17 +++++++++++++++++
>> drivers/net/wireless/ath/ath9k/recv.c | 18 +++++++++++++-----
>> 7 files changed, 50 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
>> index d3b92ce..4d70aab 100644
>> --- a/drivers/net/wireless/ath/ath9k/main.c
>> +++ b/drivers/net/wireless/ath/ath9k/main.c
>> @@ -305,6 +305,23 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
>> ath9k_hw_antdiv_comb_conf_set(ah,&div_ant_conf);
>> }
>>
>> + if (ah->caps.hw_caps&& ATH9K_HW_CAP_DFS) {
>> + /**
>> + * enable radar pulse detection
>> + *
>> + * TODO: do this only for DFS channels
>> + */
>> + ah->private_ops.set_radar_params(ah,&ah->radar_conf);
>> + ath9k_hw_setrxfilter(ah,
>> + ath9k_hw_getrxfilter(ah) | ATH9K_RX_FILTER_PHYRADAR);
>> + ath_dbg(common, ATH_DBG_DFS,
>> + "DFS radar detection enabled for channel %d\n",
>> + ah->curchan->channel);
>> + } else {
>> + ath9k_hw_setrxfilter(ah,
>> + ath9k_hw_getrxfilter(ah)& ~ATH9K_RX_FILTER_PHYRADAR);
>> + }
>> +
> Please drop this chunk of code and move the check to ath_calcrxfilter, which gets called after every reset anyway. Also, use a separate flag in sc->flags for actually enabling DFS. Even if the chip has DFS support, we don't always want to enable it - especially not on 2.4 GHz or indoor 5 GHz channels.
>
> - Felix
>
Hi Felix,
while I was waiting for your feedback on my related patch, I assumed you're okay with having those rx filter flags preserved in ath_calcrxfilter.
I'll check your proposal for v3.
BTW, as the comment says, it is TODO enable radar detection only for DFS channels. Beside the lack of the management module to provide the relevant information, it comes handy to test pulse detection on non-DFS channels without the need to modify hostapd ;)
Thanks,
Zefir
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Zefir Kurtisi @ 2011-11-03 17:46 UTC (permalink / raw)
To: Felix Fietkau; +Cc: Christian Lamparter, linux-wireless, ath9k-devel, rodrigue
In-Reply-To: <4EB2CFB3.2060802@openwrt.org>
On 11/03/2011 06:30 PM, Felix Fietkau wrote:
> On 2011-11-03 6:25 PM, Zefir Kurtisi wrote:
>> On 11/03/2011 04:51 PM, Christian Lamparter wrote:
>>> On Thursday, November 03, 2011 02:55:53 PM Zefir Kurtisi wrote:
>>>> [...]
>>> where? There's no kconfig option, yet it has the CONFIG_ perifx.
>>> So people will be looking for it.
>>>
>>> This is exactly why I made such a big fuss about CONFIG_XYZ issue last time.
>>> <http://www.mail-archive.com/ath9k-devel@lists.ath9k.org/msg06825.html>
>>> Just drop the ifdef.
>>>
>>>
>> Hi Christian,
>>
>> I just followed Luis' request to follow the regulatory statement and
>> make non regulatory certified code unusable by the 'common user'.
>>
>> Therefore, not (yet) selectable as a kconfig option, but for devs and
>> testers to be easily enabled.
>>
>> At this stage, removing the ifdef would not harm, because all the
>> code does is counting events. But for the long run I understand it is
>> a sensitive topic and requires to be disabled (at least as default
>> setting).
> I don't think it's a sensitive topic at all. Just leave out all the ifdef stuff. In the long run when we actually get to the part where we can test a full DFS implementation, the only thing that needs to be left out for normal users is the flag announcing support for it.
>
> - Felix
Yes, and that's what is done here: just let the HW pretend having no DFS capabilities until enabled.
Anyhow, DFS channels operation is not supported so far (and will be controlled) by hostapd, it's therefore safe to remove the remaining ifdef in v3.
Thanks
Zefir
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Felix Fietkau @ 2011-11-03 17:30 UTC (permalink / raw)
To: Zefir Kurtisi; +Cc: Christian Lamparter, linux-wireless, ath9k-devel, rodrigue
In-Reply-To: <4EB2CE96.4060702@neratec.com>
On 2011-11-03 6:25 PM, Zefir Kurtisi wrote:
> On 11/03/2011 04:51 PM, Christian Lamparter wrote:
>> On Thursday, November 03, 2011 02:55:53 PM Zefir Kurtisi wrote:
>>> This patch integrates the DFS module into ath9k, including
>>> * building the module into ath9k_hw
>>> * setting up DFS debugfs
>>> * defining HW capability flag for DFS support
>>> * setting this flag by DFS supporting devices
>>> (so far: AR_SREV_9280_20_OR_LATER, TBC)
>>> * setting PHYRADAR rx filter flag to enable radar
>>> pulse reporting
>>> * forward radar PHY errors to dfs module
>>>
>>> This is WIP and at its current stage is limited to test ath9k
>>> pulse detection capabilities. The DFS pattern matching is
>>> TBD in the higher layers and is not part of this patch.
>>>
>>> CONFIG_ATH9K_DFS must be set to enable pulse detection.
>> where? There's no kconfig option, yet it has the CONFIG_ perifx.
>> So people will be looking for it.
>>
>> This is exactly why I made such a big fuss about CONFIG_XYZ issue last time.
>> <http://www.mail-archive.com/ath9k-devel@lists.ath9k.org/msg06825.html>
>> Just drop the ifdef.
>>
>>
> Hi Christian,
>
> I just followed Luis' request to follow the regulatory statement and
> make non regulatory certified code unusable by the 'common user'.
>
> Therefore, not (yet) selectable as a kconfig option, but for devs and
> testers to be easily enabled.
>
> At this stage, removing the ifdef would not harm, because all the
> code does is counting events. But for the long run I understand it is
> a sensitive topic and requires to be disabled (at least as default
> setting).
I don't think it's a sensitive topic at all. Just leave out all the
ifdef stuff. In the long run when we actually get to the part where we
can test a full DFS implementation, the only thing that needs to be left
out for normal users is the flag announcing support for it.
- Felix
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Zefir Kurtisi @ 2011-11-03 17:25 UTC (permalink / raw)
To: Christian Lamparter; +Cc: linux-wireless, ath9k-devel, rodrigue, nbd
In-Reply-To: <201111031651.46073.chunkeey@googlemail.com>
On 11/03/2011 04:51 PM, Christian Lamparter wrote:
> On Thursday, November 03, 2011 02:55:53 PM Zefir Kurtisi wrote:
>> This patch integrates the DFS module into ath9k, including
>> * building the module into ath9k_hw
>> * setting up DFS debugfs
>> * defining HW capability flag for DFS support
>> * setting this flag by DFS supporting devices
>> (so far: AR_SREV_9280_20_OR_LATER, TBC)
>> * setting PHYRADAR rx filter flag to enable radar
>> pulse reporting
>> * forward radar PHY errors to dfs module
>>
>> This is WIP and at its current stage is limited to test ath9k
>> pulse detection capabilities. The DFS pattern matching is
>> TBD in the higher layers and is not part of this patch.
>>
>> CONFIG_ATH9K_DFS must be set to enable pulse detection.
> where? There's no kconfig option, yet it has the CONFIG_ perifx.
> So people will be looking for it.
>
> This is exactly why I made such a big fuss about CONFIG_XYZ issue last time.
> <http://www.mail-archive.com/ath9k-devel@lists.ath9k.org/msg06825.html>
> Just drop the ifdef.
>
>
Hi Christian,
I just followed Luis' request to follow the regulatory statement and make non regulatory certified code unusable by the 'common user'.
Therefore, not (yet) selectable as a kconfig option, but for devs and testers to be easily enabled.
At this stage, removing the ifdef would not harm, because all the code does is counting events. But for the long run I understand it is a sensitive topic and requires to be disabled (at least as default setting).
I'll consider your feedback for v3, thanks. Just clarify whether you do not like the CONFIG_ prefix or the fact that it can't be enabled.
> Regards,
> Chr
Cheers
Zefir
^ permalink raw reply
* Re: [PATCH v3 1/3] mac80211: Support forcing station to disable HT (802.11n).
From: Ben Greear @ 2011-11-03 17:18 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1320309465.3950.14.camel@jlt3.sipsolutions.net>
On 11/03/2011 01:37 AM, Johannes Berg wrote:
> On Wed, 2011-11-02 at 22:55 -0700, greearb@candelatech.com wrote:
>> From: Ben Greear<greearb@candelatech.com>
>>
>> This allows a user to configure a wifi station interface
>> to disable the HT features, even if the AP and NIC supports it.
>
> I like this version much better. Some nitpicks:
>
>
>> +#define ASSOC_REQ_DISABLE_HT (1<<0) /* Disable HT (802.11n) */
>
> You could use an enum to use kernel-doc notation here.
Sure, will do.
>> @@ -1053,6 +1056,7 @@ struct cfg80211_assoc_request {
>> size_t ie_len;
>> struct cfg80211_crypto_settings crypto;
>> bool use_mfp;
>> + u32 flags;
>
> Seems like it might be good for use_mfp to become a flag? Anyway,
> internal APIs are easy to change.
Yes, but I've been beat over the head enough to know not to mix
this kind of cleanup into my patches :)
Will do a follow-on patch after I get my changes in.
>> --- a/net/mac80211/mlme.c
>> +++ b/net/mac80211/mlme.c
>
> I'd rather split this up into cfg80211/mac80211. In fact, maybe
> splitting it into one cfg80211 and one mac80211 patch, instead of three
> different patches that span both might be worthwhile?
I really don't care either way. Just let me know how you want it
and I'll split it up thus. Just please do not change your mind later,
splitting patches is nothing but work :P
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCH v3 3/3] mac80211: Allow overriding some HT information.
From: Ben Greear @ 2011-11-03 17:13 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1320310045.3950.23.camel@jlt3.sipsolutions.net>
On 11/03/2011 01:47 AM, Johannes Berg wrote:
> On Wed, 2011-11-02 at 22:55 -0700, greearb@candelatech.com wrote:
>
>> -void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
>> +void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
>> + struct ieee80211_sta_ht_cap *ht_cap,
>> + int min_rates)
>> +{
>> + u8 *scaps = (u8 *)(&sdata->u.mgd.ht_capa.mcs.rx_mask);
>> + u8 *smask = (u8 *)(&sdata->u.mgd.ht_capa_mask.mcs.rx_mask);
>> + int i;
>> +
>> + /* check for HT over-rides, MCS rates first. */
>> + for (i = 0; i< IEEE80211_HT_MCS_MASK_LEN; i++) {
>> + int q;
>> + for (q = 0; q< 8; q++) {
>> + /*
>> + * We always need to advert at least MCS0-7, to
>> + * be a compliant HT station, for instance
>> + */
>> + if (((i * 8 + q)>= min_rates)&&
>> + (smask[i]& (1<<q))) {
>> + if (!(scaps[i]& (1<<q))) {
>> + /*
>> + * Can only disable rates, not force
>> + * new ones
>> + */
>> + ht_cap->mcs.rx_mask[i]&= ~(1<<q);
>> + }
>> + }
>> + }
>> + }
>> +
>> + /* Force removal of HT-40 capabilities? */
>> + if (sdata->u.mgd.flags& IEEE80211_STA_DISABLE_HT40) {
>> + ht_cap->cap&= ~(IEEE80211_HT_CAP_SUP_WIDTH_20_40
>> + | IEEE80211_HT_CAP_SGI_40);
>> + }
>
> Here's another argument for splitting the patches differently -- this
> ought to be part of the disable HT40 patch.
One thing I could do is move patch 3 to be the first patch. That gives this method
reason to exist, but I can leave out the disable-HT40 parts and (re)add that in
the disable-ht40 patch.
>> + /* Allow user to decrease AMPDU factor */
>> + if (sdata->u.mgd.ht_capa_mask.ampdu_params_info&
>> + IEEE80211_HT_AMPDU_PARM_FACTOR) {
>> + u16 n = sdata->u.mgd.ht_capa.ampdu_params_info
>> + & IEEE80211_HT_AMPDU_PARM_FACTOR;
>> + if (n< ht_cap->ampdu_factor)
>> + ht_cap->ampdu_factor = n;
>> + }
>> +
>> + /* Set the AMPDU density. */
>> + if (sdata->u.mgd.ht_capa_mask.ampdu_params_info&
>> + IEEE80211_HT_AMPDU_PARM_DENSITY)
>> + ht_cap->ampdu_density =
>> + (sdata->u.mgd.ht_capa.ampdu_params_info&
>> + IEEE80211_HT_AMPDU_PARM_DENSITY)
>> + >> IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT;
>> +}
>
> The AMPDU density should only allow increasing.
>
> I think a lot of this validation should live in cfg80211 so if another
> driver wants to implement it, this kind of thing is already covered.
The ath9k driver supports 0, and then every value that corresponds to 1us or higher.
If you set it to 1/2us, for instance, it just quietly rounds up to 1us. It defaults
to 8, so it appears valid to decrease or increase this value.
So, we'd either need to have cfg80211 somehow query the driver for valid
settings to do precise checks on what is valid or not.
I think at some point, for esoteric settings such as this, the user is
just going to have to be somewhat aware of what their hardware is capable
of.
>> + memcpy(&ht_cap,&sband->ht_cap, sizeof(ht_cap));
>> + /*
>> + * This is for an association attempt, and stations must
>> + * support at least the first 8 MCS rates. See section 20.1.1
>> + * of the 802.11n spec for details.
>> + */
>
> I think cfg80211 should probably just reject other configuration
> attempts.
It's valid to force a lower rate (mcs-1, for instance), but we just need to
advertise that we support mcs0-7. We *could* allow individually setting
advertise-mcs-rates v/s allow-mcs-rates, but that may be useful to exactly
no one :)
>
>> + [NL80211_ATTR_HT_CAPABILITY_MASK] = {
>> + .type = NLA_BINARY,
>> + .len = NL80211_HT_CAPABILITY_LEN
>> + },
>
> My mistake -- remove the type, it should be just the length for proper
> checking.
>
>
> I think there's a lot of data in the ht_cap struct that you don't use,
> is that right? If so you should reject it being configured. I'm also not
> quite sure why you support both disable-HT40, and then this setting here
> that has SUP_WIDTH_20_40 too.
If I add rejection like this, it will make writing backwards compat user
space very difficult. It would be similar to rejecting unknown netlink
attributes, for instance.
I was thinking that if ht-40 is disabled, then I should clear both the
IEEE80211_HT_CAP_SUP_WIDTH_20_40 and the IEEE80211_HT_CAP_SGI_40 from
the capabilities. Perhaps there are other flags I should clear as well?
> I'm more and more coming to the conclusion that it would be clearer to
> make separate configuration items for the various things. Most
> capabilities you could only disable (greenfield, ...) except for maybe
> 40mhz-intol, so maybe that would be easier as a separate u16 attribute
> "disable these HT capabilities"?
It seemed like more work for not much gain to me, but I don't mind splitting
it out into separate netlink configurables if you want.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCH] ath6kl: Do not hide ath6kl_wmi_addkey_cmd() error values
From: Kalle Valo @ 2011-11-03 17:08 UTC (permalink / raw)
To: Jouni Malinen; +Cc: linux-wireless
In-Reply-To: <20111102214647.GA31265@jouni.qca.qualcomm.com>
On 11/02/2011 11:46 PM, Jouni Malinen wrote:
> Instead of converting any error to EIO, just return the real error
> value to upper layers.
Thanks, applied.
Kalle
^ permalink raw reply
* Re: [PATCH 2/3] ath6kl: Fix key configuration to copy at most seq_len from seq
From: Kalle Valo @ 2011-11-03 17:05 UTC (permalink / raw)
To: Jouni Malinen; +Cc: linux-wireless
In-Reply-To: <20111102214555.GA31245@jouni.qca.qualcomm.com>
On 11/02/2011 11:45 PM, Jouni Malinen wrote:
> There is no guarantee on the caller using 8-octet buffer for
> key->seq, so better follow the key->seq_len parameter on figuring
> out how many octets to copy.
Thanks, I applied this patch. As discussed privately, "2/3" was just a
leftover and I ignored it.
Kalle
^ permalink raw reply
* Re: [PATCH] ath6kl: Remove unused WMI crypto defines
From: Kalle Valo @ 2011-11-03 17:02 UTC (permalink / raw)
To: Jouni Malinen; +Cc: linux-wireless
In-Reply-To: <20111102214414.GA31225@jouni.qca.qualcomm.com>
On 11/02/2011 11:44 PM, Jouni Malinen wrote:
> Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Thanks, applied.
Kalle
^ permalink raw reply
* Re: [PATCH] ath6kl: add suspend_cutpower module parameter
From: Kalle Valo @ 2011-11-03 16:58 UTC (permalink / raw)
To: Kalle Valo; +Cc: linux-wireless
In-Reply-To: <20111103101831.15206.39020.stgit@localhost6.localdomain6>
On 11/03/2011 12:18 PM, Kalle Valo wrote:
> This is to force ath6kl to power off hardware during suspend even if
> sdio support keep power. This is needed, for example, when sdio
> controller is buggy or maximum powersaving is desired.
>
> Usage:
>
> insmod ath6kl.ko suspend_cutpower=1
Applied.
Kalle
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Mohammed Shafi @ 2011-11-03 16:57 UTC (permalink / raw)
To: Zefir Kurtisi; +Cc: linux-wireless, ath9k-devel, rodrigue, nbd
In-Reply-To: <4EB2C516.1020703@neratec.com>
On Thu, Nov 3, 2011 at 10:15 PM, Zefir Kurtisi
<zefir.kurtisi@neratec.com> wrote:
> On 11/03/2011 04:27 PM, Mohammed Shafi wrote:
>> Hi Zefir,
>>
> Hello Mohammed,
>
>> On Thu, Nov 3, 2011 at 7:25 PM, Zefir Kurtisi <zefir.kurtisi@neratec.com> wrote:
>>> [...]
>>>
>>> + if (ah->caps.hw_caps && ATH9K_HW_CAP_DFS) {
>>> + /**
>>> + * enable radar pulse detection
>>> + *
>>> + * TODO: do this only for DFS channels
>>> + */
>>> + ah->private_ops.set_radar_params(ah, &ah->radar_conf);
>>
>> can we do this something like ath9k_hw_set_radar_params?
>> why we need a seperate debug file for dfs, had i missed something?
>>
> My first proposal included the DFS statistics in debug.c, but Luis asked me to keep it separated (see http://www.mail-archive.com/ath9k-devel@lists.ath9k.org/msg06821.html). I'm fine with both approaches, just let me know.
oh ok. please follow up with Luis's approach. thanks.
>
> I'll add a ath9k_hw_set_radar_params() in v3.
>
>
> Thanks,
> Zefir
>
--
shafi
^ permalink raw reply
* Re: [PATCH] ath6kl: don't power down hardware when interface is down
From: Kalle Valo @ 2011-11-03 16:56 UTC (permalink / raw)
To: Kalle Valo; +Cc: linux-wireless
In-Reply-To: <20111103095357.10733.85983.stgit@localhost6.localdomain6>
On 11/03/2011 11:53 AM, Kalle Valo wrote:
> Jouni reported that my patch "ath6kl: power down hardware when interface
> is down" caused a regression on his x86 boxes and scan didn't work anymore.
> I was able to reproduce the problem by disabling all debug messages.
>
> So there has to be a race condition somewhere in the code and disable the
> functionality until the race is fixed. Now hardware is powered from the
> point where module is loaded until it's removed.
Applied.
Kalle
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Zefir Kurtisi @ 2011-11-03 16:45 UTC (permalink / raw)
To: Mohammed Shafi; +Cc: linux-wireless, ath9k-devel, rodrigue, nbd
In-Reply-To: <CAD2nsn2SBVnQF4oTP4X3HR7O=uBKAViW+w-fV67YjbVN1j=3PQ@mail.gmail.com>
On 11/03/2011 04:27 PM, Mohammed Shafi wrote:
> Hi Zefir,
>
Hello Mohammed,
> On Thu, Nov 3, 2011 at 7:25 PM, Zefir Kurtisi <zefir.kurtisi@neratec.com> wrote:
>> [...]
>>
>> + if (ah->caps.hw_caps && ATH9K_HW_CAP_DFS) {
>> + /**
>> + * enable radar pulse detection
>> + *
>> + * TODO: do this only for DFS channels
>> + */
>> + ah->private_ops.set_radar_params(ah, &ah->radar_conf);
>
> can we do this something like ath9k_hw_set_radar_params?
> why we need a seperate debug file for dfs, had i missed something?
>
My first proposal included the DFS statistics in debug.c, but Luis asked me to keep it separated (see http://www.mail-archive.com/ath9k-devel@lists.ath9k.org/msg06821.html). I'm fine with both approaches, just let me know.
I'll add a ath9k_hw_set_radar_params() in v3.
Thanks,
Zefir
^ permalink raw reply
* Re: [RFC v2 1/2] ath9k: add DFS radar pulse processing
From: Zefir Kurtisi @ 2011-11-03 16:26 UTC (permalink / raw)
To: Mohammed Shafi; +Cc: linux-wireless, ath9k-devel, rodrigue, nbd
In-Reply-To: <CAD2nsn0PJqm3gCOiReUhJ3UGChWJZuy_pUnpu_rDUcshAcQWfQ@mail.gmail.com>
On 11/03/2011 04:56 PM, Mohammed Shafi wrote:
> On Thu, Nov 3, 2011 at 7:25 PM, Zefir Kurtisi <zefir.kurtisi@neratec.com> wrote:
>> [...]
>> + switch (are->pulse_bw_info) {
>> + case 0:
>
> can we define some macro for this. thanks!
>
Ok.
^ permalink raw reply
* Re: [RFC v2 1/2] ath9k: add DFS radar pulse processing
From: Zefir Kurtisi @ 2011-11-03 16:25 UTC (permalink / raw)
To: Mohammed Shafi; +Cc: linux-wireless, ath9k-devel, rodrigue, nbd
In-Reply-To: <CAD2nsn32rYs4ikwkJOwqfw5gtBU_o8wVGF2WG5-kjFGcTW-rjQ@mail.gmail.com>
On 11/03/2011 04:54 PM, Mohammed Shafi wrote:
> On Thu, Nov 3, 2011 at 7:25 PM, Zefir Kurtisi <zefir.kurtisi@neratec.com> wrote:
>> [...]
>> +static bool postprocess_radar_event(struct ath_softc *sc,
>> + struct ath_radar_data *are, struct dfs_radar_pulse *drp)
>
> ath9k_postprocess_radar_event would be better?
>
Ok (I don't mind, as it's static anyhow.).
^ permalink raw reply
* Re: [RFC v2 1/2] ath9k: add DFS radar pulse processing
From: Mohammed Shafi @ 2011-11-03 15:56 UTC (permalink / raw)
To: Zefir Kurtisi; +Cc: linux-wireless, ath9k-devel, rodrigue, nbd
In-Reply-To: <1320328553-28066-2-git-send-email-zefir.kurtisi@neratec.com>
On Thu, Nov 3, 2011 at 7:25 PM, Zefir Kurtisi <zefir.kurtisi@neratec.com> wrote:
> This initial DFS module provides basic functionality to deal with
> radar pulses reported by the DFS HW pattern detector.
>
> The reported data is evaluated and basic plausibility checks are
> performed to filter false pulses. Passing radar pulses are
> forwarded to pattern detectors (not part of this patch).
>
> The patch also includes
> * new debug level ATH_DBG_DFS
> * debugfs DFS radar statistics
>
> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
> ---
> drivers/net/wireless/ath/ath.h | 2 +
> drivers/net/wireless/ath/ath9k/dfs.c | 192 ++++++++++++++++++++++++++++
> drivers/net/wireless/ath/ath9k/dfs.h | 24 ++++
> drivers/net/wireless/ath/ath9k/dfs_debug.c | 89 +++++++++++++
> drivers/net/wireless/ath/ath9k/dfs_debug.h | 59 +++++++++
> 5 files changed, 366 insertions(+), 0 deletions(-)
> create mode 100644 drivers/net/wireless/ath/ath9k/dfs.c
> create mode 100644 drivers/net/wireless/ath/ath9k/dfs.h
> create mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.c
> create mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.h
>
> diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
> index 46d6926..e38fcad 100644
> --- a/drivers/net/wireless/ath/ath.h
> +++ b/drivers/net/wireless/ath/ath.h
> @@ -215,6 +215,7 @@ do { \
> * @ATH_DBG_HWTIMER: hardware timer handling
> * @ATH_DBG_BTCOEX: bluetooth coexistance
> * @ATH_DBG_BSTUCK: stuck beacons
> + * @ATH_DBG_DFS: radar datection
> * @ATH_DBG_ANY: enable all debugging
> *
> * The debug level is used to control the amount and type of debugging output
> @@ -240,6 +241,7 @@ enum ATH_DEBUG {
> ATH_DBG_BTCOEX = 0x00002000,
> ATH_DBG_WMI = 0x00004000,
> ATH_DBG_BSTUCK = 0x00008000,
> + ATH_DBG_DFS = 0x00010000,
> ATH_DBG_ANY = 0xffffffff
> };
>
> diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
> new file mode 100644
> index 0000000..9d3c8b9
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath9k/dfs.c
> @@ -0,0 +1,192 @@
> +/*
> + * Copyright (c) 2008-2011 Atheros Communications Inc.
> + * Copyright (c) 2011 Neratec Solutions AG
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#include "hw.h"
> +#include "hw-ops.h"
> +#include "ath9k.h"
> +#include "dfs.h"
> +#include "dfs_debug.h"
> +
> +/* pulse duration reported is scaled with 1000/800 us */
> +#define AR93X_NSECS_PER_DUR 800
> +static u32 dur_to_usecs(u32 dur)
> +{
> + return (dur * AR93X_NSECS_PER_DUR + 500) / 1000;
> +}
> +
> +/* internal struct to pass radar data */
> +struct ath_radar_data {
> + u8 pulse_bw_info;
> + u8 rssi;
> + u8 ext_rssi;
> + u8 pulse_length_ext;
> + u8 pulse_length_pri;
> +};
> +
> +/* TODO: move into or synchronize this with generic header
> + * as soon as IF is defined */
> +struct dfs_radar_pulse {
> + u16 freq;
> + u64 ts;
> + u32 width;
> + u8 rssi;
> +};
> +
> +#define PRI_CH_RADAR_FOUND 0x01
> +#define EXT_CH_RADAR_FOUND 0x02
> +static bool postprocess_radar_event(struct ath_softc *sc,
> + struct ath_radar_data *are, struct dfs_radar_pulse *drp)
> +{
> + u8 rssi;
> + u16 dur;
> +
> + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_DFS,
> + "pulse_bw_info=0x%x, pri,ext len/rssi=(%u/%u, %u/%u)\n",
> + are->pulse_bw_info,
> + are->pulse_length_pri, are->rssi,
> + are->pulse_length_ext, are->ext_rssi);
> +
> + /* Only the last 2 bits of the BW info are relevant, they indicate
> + which channel the radar was detected in.*/
> + are->pulse_bw_info &= 0x03;
> +
> + switch (are->pulse_bw_info) {
> + case 0:
can we define some macro for this. thanks!
> + /* Bogus bandwidth info received in descriptor,
> + so ignore this PHY error */
> + DFS_STAT_INC(sc, bwinfo_discards);
> + return false;
> + case PRI_CH_RADAR_FOUND:
> + /* radar in ctrl channel */
> + dur = are->pulse_length_pri;
> + DFS_STAT_INC(sc, pri_phy_errors);
> + /* cannot use ctrl channel RSSI
> + * if extension channel is stronger */
> + rssi = (are->ext_rssi >= (are->rssi + 3)) ? 0 : are->rssi;
> + break;
> + case EXT_CH_RADAR_FOUND:
> + /* radar in extension channel */
> + dur = are->pulse_length_ext;
> + DFS_STAT_INC(sc, ext_phy_errors);
> + /* cannot use extension channel RSSI
> + * if control channel is stronger */
> + rssi = (are->rssi >= (are->ext_rssi + 12)) ? 0 : are->ext_rssi;
> + break;
> + case (PRI_CH_RADAR_FOUND | EXT_CH_RADAR_FOUND):
> + /*
> + * Conducted testing, when pulse is on DC, both pri and ext
> + * durations are reported to be same
> + *
> + * Radiated testing, when pulse is on DC, different pri and
> + * ext durations are reported, so take the larger of the two
> + * */
> + if (are->pulse_length_ext >= are->pulse_length_pri)
> + dur = are->pulse_length_ext;
> + else
> + dur = are->pulse_length_pri;
> + DFS_STAT_INC(sc, dc_phy_errors);
> +
> + /* when both are present use stronger one */
> + rssi = (are->rssi < are->ext_rssi) ? are->ext_rssi : are->rssi;
> + break;
> + }
> +
> + if (rssi == 0) {
> + DFS_STAT_INC(sc, rssi_discards);
> + return false;
> + }
> +
> + /*
> + * TODO: check chirping pulses
> + */
> +
> + /* convert duration to usecs */
> + drp->width = dur_to_usecs(dur);
> + drp->rssi = rssi;
> +
> + DFS_STAT_INC(sc, pulses_detected);
> + return true;
> +}
> +
> +
> +/*
> + * DFS: check PHY-error for radar pulse and feed the detector
> + */
> +void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
> + struct ath_rx_status *rs, u64 mactime)
> +{
> + struct ath_radar_data ard;
> + u16 datalen;
> + char *vdata_end;
> + struct dfs_radar_pulse drp;
> + struct ath_hw *ah = sc->sc_ah;
> + struct ath_common *common = ath9k_hw_common(ah);
> +
> + if ((!(rs->rs_phyerr != ATH9K_PHYERR_RADAR)) &&
> + (!(rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT))) {
> + ath_dbg(common, ATH_DBG_DFS,
> + "Error: rs_phyer=0x%x not a radar error\n",
> + rs->rs_phyerr);
> + return;
> + }
> +
> + datalen = rs->rs_datalen;
> + if (datalen == 0) {
> + DFS_STAT_INC(sc, datalen_discards);
> + return;
> + }
> +
> + ard.rssi = rs->rs_rssi_ctl0;
> + ard.ext_rssi = rs->rs_rssi_ext0;
> +
> + /* hardware stores this as 8 bit signed value.
> + * we will cap it at 0 if it is a negative number
> + */
> + if (ard.rssi & 0x80)
> + ard.rssi = 0;
> + if (ard.ext_rssi & 0x80)
> + ard.ext_rssi = 0;
> +
> + vdata_end = (char *)data + datalen;
> + ard.pulse_bw_info = vdata_end[-1];
> + ard.pulse_length_ext = vdata_end[-2];
> + ard.pulse_length_pri = vdata_end[-3];
> +
> + ath_dbg(common, ATH_DBG_DFS,
> + "bw_info=%d, length_pri=%d, length_ext=%d, "
> + "rssi_pri=%d, rssi_ext=%d\n",
> + ard.pulse_bw_info, ard.pulse_length_pri, ard.pulse_length_ext,
> + ard.rssi, ard.ext_rssi);
> +
> + drp.freq = ah->curchan->channel;
> + drp.ts = mactime;
> + if (postprocess_radar_event(sc, &ard, &drp)) {
> + static u64 last_ts;
> + ath_dbg(common, ATH_DBG_DFS,
> + "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
> + "width=%d, rssi=%d, delta_ts=%llu\n",
> + drp.freq, drp.ts, drp.width, drp.rssi, drp.ts-last_ts);
> + last_ts = drp.ts;
> + /*
> + * TODO: forward pulse to pattern detector
> + *
> + * ieee80211_add_radar_pulse(drp.freq, drp.ts,
> + * drp.width, drp.rssi);
> + */
> + }
> +}
> +EXPORT_SYMBOL(ath9k_dfs_process_phyerr);
> diff --git a/drivers/net/wireless/ath/ath9k/dfs.h b/drivers/net/wireless/ath/ath9k/dfs.h
> new file mode 100644
> index 0000000..4d95cad
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath9k/dfs.h
> @@ -0,0 +1,24 @@
> +/*
> + * Copyright (c) 2008-2011 Atheros Communications Inc.
> + * Copyright (c) 2011 Neratec Solutions AG
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#ifndef ATH9K_DFS_H
> +#define ATH9K_DFS_H
> +
> +void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
> + struct ath_rx_status *rs, u64 mactime);
> +
> +#endif /* ATH9K_DFS_H */
> diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c
> new file mode 100644
> index 0000000..3c03552
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright (c) 2008-2011 Atheros Communications Inc.
> + * Copyright (c) 2011 Neratec Solutions AG
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +
> +#include <linux/debugfs.h>
> +
> +#include "ath9k.h"
> +#include "dfs_debug.h"
> +
> +
> +#if defined(CONFIG_ATH9K_DEBUGFS)
> +
> +#define ATH9K_DFS_STAT(s, p) \
> + len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \
> + sc->debug.stats.dfs_stats.p);
> +
> +static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct ath_softc *sc = file->private_data;
> + struct ath9k_hw_version *hw_ver = &sc->sc_ah->hw_version;
> + char *buf;
> + unsigned int len = 0, size = 8000;
> + ssize_t retval = 0;
> +
> + buf = kzalloc(size, GFP_KERNEL);
> + if (buf == NULL)
> + return -ENOMEM;
> +
> + len += snprintf(buf + len, size - len, "DFS support for "
> + "macVersion = 0x%x, macRev = 0x%x: %s\n",
> + hw_ver->macVersion, hw_ver->macRev,
> + (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ?
> + "enabled" : "disabled");
> + ATH9K_DFS_STAT("DFS pulses detected ", pulses_detected);
> + ATH9K_DFS_STAT("Datalen discards ", datalen_discards);
> + ATH9K_DFS_STAT("RSSI discards ", rssi_discards);
> + ATH9K_DFS_STAT("BW info discards ", bwinfo_discards);
> + ATH9K_DFS_STAT("Primary channel pulses ", pri_phy_errors);
> + ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors);
> + ATH9K_DFS_STAT("Dual channel pulses ", dc_phy_errors);
> +
> + if (len > size)
> + len = size;
> +
> + retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
> + kfree(buf);
> +
> + return retval;
> +}
> +
> +static int ath9k_dfs_debugfs_open(struct inode *inode, struct file *file)
> +{
> + file->private_data = inode->i_private;
> + return 0;
> +}
> +
> +
> +static const struct file_operations fops_dfs_stats = {
> + .read = read_file_dfs,
> + .open = ath9k_dfs_debugfs_open,
> + .owner = THIS_MODULE,
> + .llseek = default_llseek,
> +};
> +
> +
> +void ath9k_dfs_init_debug(struct ath_softc *sc)
> +{
> + debugfs_create_file("dfs_stats", S_IRUSR,
> + sc->debug.debugfs_phy, sc, &fops_dfs_stats);
> +}
> +EXPORT_SYMBOL(ath9k_dfs_init_debug);
> +
> +#endif /* CONFIG_ATH9K_DEBUGFS */
> +
> diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.h b/drivers/net/wireless/ath/ath9k/dfs_debug.h
> new file mode 100644
> index 0000000..079cf53
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.h
> @@ -0,0 +1,59 @@
> +/*
> + * Copyright (c) 2008-2011 Atheros Communications Inc.
> + * Copyright (c) 2011 Neratec Solutions AG
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +
> +#ifndef DFS_DEBUG_H
> +#define DFS_DEBUG_H
> +
> +#include "hw.h"
> +
> +/**
> + * struct ath_dfs_stats - DFS Statistics
> + *
> + * @pulses_detected: No. of pulses detected so far
> + * @datalen_discards: No. of pulses discarded due to invalid datalen
> + * @rssi_discards: No. of pulses discarded due to invalid RSSI
> + * @bwinfo_discards: No. of pulses discarded due to invalid BW info
> + * @pri_phy_errors: No. of pulses reported for primary channel
> + * @ext_phy_errors: No. of pulses reported for extension channel
> + * @dc_phy_errors: No. of pulses reported for primary + extension channel
> + */
> +struct ath_dfs_stats {
> + u32 pulses_detected;
> + u32 datalen_discards;
> + u32 rssi_discards;
> + u32 bwinfo_discards;
> + u32 pri_phy_errors;
> + u32 ext_phy_errors;
> + u32 dc_phy_errors;
> +};
> +
> +
> +#if defined(CONFIG_ATH9K_DEBUGFS)
> +
> +#define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++)
> +void ath9k_dfs_init_debug(struct ath_softc *sc);
> +
> +#else
> +
> +#define DFS_STAT_INC(sc, c) do { } while (0)
> +static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { }
> +
> +#endif
> +
> +
> +#endif /* DFS_DEBUG_H */
> --
> 1.7.4.1
>
> --
> 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
>
--
shafi
^ permalink raw reply
* Re: [RFC v2 1/2] ath9k: add DFS radar pulse processing
From: Mohammed Shafi @ 2011-11-03 15:54 UTC (permalink / raw)
To: Zefir Kurtisi; +Cc: linux-wireless, ath9k-devel, rodrigue, nbd
In-Reply-To: <1320328553-28066-2-git-send-email-zefir.kurtisi@neratec.com>
On Thu, Nov 3, 2011 at 7:25 PM, Zefir Kurtisi <zefir.kurtisi@neratec.com> wrote:
> This initial DFS module provides basic functionality to deal with
> radar pulses reported by the DFS HW pattern detector.
>
> The reported data is evaluated and basic plausibility checks are
> performed to filter false pulses. Passing radar pulses are
> forwarded to pattern detectors (not part of this patch).
>
> The patch also includes
> * new debug level ATH_DBG_DFS
> * debugfs DFS radar statistics
>
> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
> ---
> drivers/net/wireless/ath/ath.h | 2 +
> drivers/net/wireless/ath/ath9k/dfs.c | 192 ++++++++++++++++++++++++++++
> drivers/net/wireless/ath/ath9k/dfs.h | 24 ++++
> drivers/net/wireless/ath/ath9k/dfs_debug.c | 89 +++++++++++++
> drivers/net/wireless/ath/ath9k/dfs_debug.h | 59 +++++++++
> 5 files changed, 366 insertions(+), 0 deletions(-)
> create mode 100644 drivers/net/wireless/ath/ath9k/dfs.c
> create mode 100644 drivers/net/wireless/ath/ath9k/dfs.h
> create mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.c
> create mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.h
>
> diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
> index 46d6926..e38fcad 100644
> --- a/drivers/net/wireless/ath/ath.h
> +++ b/drivers/net/wireless/ath/ath.h
> @@ -215,6 +215,7 @@ do { \
> * @ATH_DBG_HWTIMER: hardware timer handling
> * @ATH_DBG_BTCOEX: bluetooth coexistance
> * @ATH_DBG_BSTUCK: stuck beacons
> + * @ATH_DBG_DFS: radar datection
> * @ATH_DBG_ANY: enable all debugging
> *
> * The debug level is used to control the amount and type of debugging output
> @@ -240,6 +241,7 @@ enum ATH_DEBUG {
> ATH_DBG_BTCOEX = 0x00002000,
> ATH_DBG_WMI = 0x00004000,
> ATH_DBG_BSTUCK = 0x00008000,
> + ATH_DBG_DFS = 0x00010000,
> ATH_DBG_ANY = 0xffffffff
> };
>
> diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
> new file mode 100644
> index 0000000..9d3c8b9
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath9k/dfs.c
> @@ -0,0 +1,192 @@
> +/*
> + * Copyright (c) 2008-2011 Atheros Communications Inc.
> + * Copyright (c) 2011 Neratec Solutions AG
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#include "hw.h"
> +#include "hw-ops.h"
> +#include "ath9k.h"
> +#include "dfs.h"
> +#include "dfs_debug.h"
> +
> +/* pulse duration reported is scaled with 1000/800 us */
> +#define AR93X_NSECS_PER_DUR 800
> +static u32 dur_to_usecs(u32 dur)
> +{
> + return (dur * AR93X_NSECS_PER_DUR + 500) / 1000;
> +}
> +
> +/* internal struct to pass radar data */
> +struct ath_radar_data {
> + u8 pulse_bw_info;
> + u8 rssi;
> + u8 ext_rssi;
> + u8 pulse_length_ext;
> + u8 pulse_length_pri;
> +};
> +
> +/* TODO: move into or synchronize this with generic header
> + * as soon as IF is defined */
> +struct dfs_radar_pulse {
> + u16 freq;
> + u64 ts;
> + u32 width;
> + u8 rssi;
> +};
> +
> +#define PRI_CH_RADAR_FOUND 0x01
> +#define EXT_CH_RADAR_FOUND 0x02
> +static bool postprocess_radar_event(struct ath_softc *sc,
> + struct ath_radar_data *are, struct dfs_radar_pulse *drp)
ath9k_postprocess_radar_event would be better?
> +{
> + u8 rssi;
> + u16 dur;
> +
> + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_DFS,
> + "pulse_bw_info=0x%x, pri,ext len/rssi=(%u/%u, %u/%u)\n",
> + are->pulse_bw_info,
> + are->pulse_length_pri, are->rssi,
> + are->pulse_length_ext, are->ext_rssi);
> +
> + /* Only the last 2 bits of the BW info are relevant, they indicate
> + which channel the radar was detected in.*/
> + are->pulse_bw_info &= 0x03;
> +
> + switch (are->pulse_bw_info) {
> + case 0:
> + /* Bogus bandwidth info received in descriptor,
> + so ignore this PHY error */
> + DFS_STAT_INC(sc, bwinfo_discards);
> + return false;
> + case PRI_CH_RADAR_FOUND:
> + /* radar in ctrl channel */
> + dur = are->pulse_length_pri;
> + DFS_STAT_INC(sc, pri_phy_errors);
> + /* cannot use ctrl channel RSSI
> + * if extension channel is stronger */
> + rssi = (are->ext_rssi >= (are->rssi + 3)) ? 0 : are->rssi;
> + break;
> + case EXT_CH_RADAR_FOUND:
> + /* radar in extension channel */
> + dur = are->pulse_length_ext;
> + DFS_STAT_INC(sc, ext_phy_errors);
> + /* cannot use extension channel RSSI
> + * if control channel is stronger */
> + rssi = (are->rssi >= (are->ext_rssi + 12)) ? 0 : are->ext_rssi;
> + break;
> + case (PRI_CH_RADAR_FOUND | EXT_CH_RADAR_FOUND):
> + /*
> + * Conducted testing, when pulse is on DC, both pri and ext
> + * durations are reported to be same
> + *
> + * Radiated testing, when pulse is on DC, different pri and
> + * ext durations are reported, so take the larger of the two
> + * */
> + if (are->pulse_length_ext >= are->pulse_length_pri)
> + dur = are->pulse_length_ext;
> + else
> + dur = are->pulse_length_pri;
> + DFS_STAT_INC(sc, dc_phy_errors);
> +
> + /* when both are present use stronger one */
> + rssi = (are->rssi < are->ext_rssi) ? are->ext_rssi : are->rssi;
> + break;
> + }
> +
> + if (rssi == 0) {
> + DFS_STAT_INC(sc, rssi_discards);
> + return false;
> + }
> +
> + /*
> + * TODO: check chirping pulses
> + */
> +
> + /* convert duration to usecs */
> + drp->width = dur_to_usecs(dur);
> + drp->rssi = rssi;
> +
> + DFS_STAT_INC(sc, pulses_detected);
> + return true;
> +}
> +
> +
> +/*
> + * DFS: check PHY-error for radar pulse and feed the detector
> + */
> +void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
> + struct ath_rx_status *rs, u64 mactime)
> +{
> + struct ath_radar_data ard;
> + u16 datalen;
> + char *vdata_end;
> + struct dfs_radar_pulse drp;
> + struct ath_hw *ah = sc->sc_ah;
> + struct ath_common *common = ath9k_hw_common(ah);
> +
> + if ((!(rs->rs_phyerr != ATH9K_PHYERR_RADAR)) &&
> + (!(rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT))) {
> + ath_dbg(common, ATH_DBG_DFS,
> + "Error: rs_phyer=0x%x not a radar error\n",
> + rs->rs_phyerr);
> + return;
> + }
> +
> + datalen = rs->rs_datalen;
> + if (datalen == 0) {
> + DFS_STAT_INC(sc, datalen_discards);
> + return;
> + }
> +
> + ard.rssi = rs->rs_rssi_ctl0;
> + ard.ext_rssi = rs->rs_rssi_ext0;
> +
> + /* hardware stores this as 8 bit signed value.
> + * we will cap it at 0 if it is a negative number
> + */
> + if (ard.rssi & 0x80)
> + ard.rssi = 0;
> + if (ard.ext_rssi & 0x80)
> + ard.ext_rssi = 0;
> +
> + vdata_end = (char *)data + datalen;
> + ard.pulse_bw_info = vdata_end[-1];
> + ard.pulse_length_ext = vdata_end[-2];
> + ard.pulse_length_pri = vdata_end[-3];
> +
> + ath_dbg(common, ATH_DBG_DFS,
> + "bw_info=%d, length_pri=%d, length_ext=%d, "
> + "rssi_pri=%d, rssi_ext=%d\n",
> + ard.pulse_bw_info, ard.pulse_length_pri, ard.pulse_length_ext,
> + ard.rssi, ard.ext_rssi);
> +
> + drp.freq = ah->curchan->channel;
> + drp.ts = mactime;
> + if (postprocess_radar_event(sc, &ard, &drp)) {
> + static u64 last_ts;
> + ath_dbg(common, ATH_DBG_DFS,
> + "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
> + "width=%d, rssi=%d, delta_ts=%llu\n",
> + drp.freq, drp.ts, drp.width, drp.rssi, drp.ts-last_ts);
> + last_ts = drp.ts;
> + /*
> + * TODO: forward pulse to pattern detector
> + *
> + * ieee80211_add_radar_pulse(drp.freq, drp.ts,
> + * drp.width, drp.rssi);
> + */
> + }
> +}
> +EXPORT_SYMBOL(ath9k_dfs_process_phyerr);
> diff --git a/drivers/net/wireless/ath/ath9k/dfs.h b/drivers/net/wireless/ath/ath9k/dfs.h
> new file mode 100644
> index 0000000..4d95cad
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath9k/dfs.h
> @@ -0,0 +1,24 @@
> +/*
> + * Copyright (c) 2008-2011 Atheros Communications Inc.
> + * Copyright (c) 2011 Neratec Solutions AG
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#ifndef ATH9K_DFS_H
> +#define ATH9K_DFS_H
> +
> +void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
> + struct ath_rx_status *rs, u64 mactime);
> +
> +#endif /* ATH9K_DFS_H */
> diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c
> new file mode 100644
> index 0000000..3c03552
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright (c) 2008-2011 Atheros Communications Inc.
> + * Copyright (c) 2011 Neratec Solutions AG
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +
> +#include <linux/debugfs.h>
> +
> +#include "ath9k.h"
> +#include "dfs_debug.h"
> +
> +
> +#if defined(CONFIG_ATH9K_DEBUGFS)
> +
> +#define ATH9K_DFS_STAT(s, p) \
> + len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \
> + sc->debug.stats.dfs_stats.p);
> +
> +static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct ath_softc *sc = file->private_data;
> + struct ath9k_hw_version *hw_ver = &sc->sc_ah->hw_version;
> + char *buf;
> + unsigned int len = 0, size = 8000;
> + ssize_t retval = 0;
> +
> + buf = kzalloc(size, GFP_KERNEL);
> + if (buf == NULL)
> + return -ENOMEM;
> +
> + len += snprintf(buf + len, size - len, "DFS support for "
> + "macVersion = 0x%x, macRev = 0x%x: %s\n",
> + hw_ver->macVersion, hw_ver->macRev,
> + (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ?
> + "enabled" : "disabled");
> + ATH9K_DFS_STAT("DFS pulses detected ", pulses_detected);
> + ATH9K_DFS_STAT("Datalen discards ", datalen_discards);
> + ATH9K_DFS_STAT("RSSI discards ", rssi_discards);
> + ATH9K_DFS_STAT("BW info discards ", bwinfo_discards);
> + ATH9K_DFS_STAT("Primary channel pulses ", pri_phy_errors);
> + ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors);
> + ATH9K_DFS_STAT("Dual channel pulses ", dc_phy_errors);
> +
> + if (len > size)
> + len = size;
> +
> + retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
> + kfree(buf);
> +
> + return retval;
> +}
> +
> +static int ath9k_dfs_debugfs_open(struct inode *inode, struct file *file)
> +{
> + file->private_data = inode->i_private;
> + return 0;
> +}
> +
> +
> +static const struct file_operations fops_dfs_stats = {
> + .read = read_file_dfs,
> + .open = ath9k_dfs_debugfs_open,
> + .owner = THIS_MODULE,
> + .llseek = default_llseek,
> +};
> +
> +
> +void ath9k_dfs_init_debug(struct ath_softc *sc)
> +{
> + debugfs_create_file("dfs_stats", S_IRUSR,
> + sc->debug.debugfs_phy, sc, &fops_dfs_stats);
> +}
> +EXPORT_SYMBOL(ath9k_dfs_init_debug);
> +
> +#endif /* CONFIG_ATH9K_DEBUGFS */
> +
> diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.h b/drivers/net/wireless/ath/ath9k/dfs_debug.h
> new file mode 100644
> index 0000000..079cf53
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.h
> @@ -0,0 +1,59 @@
> +/*
> + * Copyright (c) 2008-2011 Atheros Communications Inc.
> + * Copyright (c) 2011 Neratec Solutions AG
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +
> +#ifndef DFS_DEBUG_H
> +#define DFS_DEBUG_H
> +
> +#include "hw.h"
> +
> +/**
> + * struct ath_dfs_stats - DFS Statistics
> + *
> + * @pulses_detected: No. of pulses detected so far
> + * @datalen_discards: No. of pulses discarded due to invalid datalen
> + * @rssi_discards: No. of pulses discarded due to invalid RSSI
> + * @bwinfo_discards: No. of pulses discarded due to invalid BW info
> + * @pri_phy_errors: No. of pulses reported for primary channel
> + * @ext_phy_errors: No. of pulses reported for extension channel
> + * @dc_phy_errors: No. of pulses reported for primary + extension channel
> + */
> +struct ath_dfs_stats {
> + u32 pulses_detected;
> + u32 datalen_discards;
> + u32 rssi_discards;
> + u32 bwinfo_discards;
> + u32 pri_phy_errors;
> + u32 ext_phy_errors;
> + u32 dc_phy_errors;
> +};
> +
> +
> +#if defined(CONFIG_ATH9K_DEBUGFS)
> +
> +#define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++)
> +void ath9k_dfs_init_debug(struct ath_softc *sc);
> +
> +#else
> +
> +#define DFS_STAT_INC(sc, c) do { } while (0)
> +static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { }
> +
> +#endif
> +
> +
> +#endif /* DFS_DEBUG_H */
> --
> 1.7.4.1
>
> --
> 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
>
--
shafi
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Christian Lamparter @ 2011-11-03 15:51 UTC (permalink / raw)
To: Zefir Kurtisi; +Cc: linux-wireless, ath9k-devel, rodrigue, nbd
In-Reply-To: <1320328553-28066-3-git-send-email-zefir.kurtisi@neratec.com>
On Thursday, November 03, 2011 02:55:53 PM Zefir Kurtisi wrote:
> This patch integrates the DFS module into ath9k, including
> * building the module into ath9k_hw
> * setting up DFS debugfs
> * defining HW capability flag for DFS support
> * setting this flag by DFS supporting devices
> (so far: AR_SREV_9280_20_OR_LATER, TBC)
> * setting PHYRADAR rx filter flag to enable radar
> pulse reporting
> * forward radar PHY errors to dfs module
>
> This is WIP and at its current stage is limited to test ath9k
> pulse detection capabilities. The DFS pattern matching is
> TBD in the higher layers and is not part of this patch.
>
> CONFIG_ATH9K_DFS must be set to enable pulse detection.
where? There's no kconfig option, yet it has the CONFIG_ perifx.
So people will be looking for it.
This is exactly why I made such a big fuss about CONFIG_XYZ issue last time.
<http://www.mail-archive.com/ath9k-devel@lists.ath9k.org/msg06825.html>
Just drop the ifdef.
> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
> ---
> drivers/net/wireless/ath/ath9k/Makefile | 2 ++
> drivers/net/wireless/ath/ath9k/debug.c | 3 +++
> drivers/net/wireless/ath/ath9k/debug.h | 2 ++
> drivers/net/wireless/ath/ath9k/hw.c | 12 ++++++++++++
> drivers/net/wireless/ath/ath9k/hw.h | 1 +
> drivers/net/wireless/ath/ath9k/main.c | 17 +++++++++++++++++
> drivers/net/wireless/ath/ath9k/recv.c | 18 +++++++++++++-----
> 7 files changed, 50 insertions(+), 5 deletions(-)
>
> --- a/drivers/net/wireless/ath/ath9k/hw.c
> +++ b/drivers/net/wireless/ath/ath9k/hw.c
> @@ -2333,6 +2333,18 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
> pCap->pcie_lcr_offset = 0x80;
> }
>
> +#ifdef CONFIG_ATH9K_DFS
> + /*
> + * enable radar detection on DFS supporting devices
> + */
> + if (AR_SREV_9280_20_OR_LATER(ah)) {
> + /*
> + * TODO: check for which chip-sets we want to support DFS
> + */
> + pCap->hw_caps |= ATH9K_HW_CAP_DFS;
> + }
> +#endif
> +
> tx_chainmask = pCap->tx_chainmask;
> rx_chainmask = pCap->rx_chainmask;
> while (tx_chainmask || rx_chainmask) {
Regards,
Chr
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Mohammed Shafi @ 2011-11-03 15:27 UTC (permalink / raw)
To: Zefir Kurtisi; +Cc: linux-wireless, ath9k-devel, rodrigue, nbd
In-Reply-To: <1320328553-28066-3-git-send-email-zefir.kurtisi@neratec.com>
Hi Zefir,
On Thu, Nov 3, 2011 at 7:25 PM, Zefir Kurtisi <zefir.kurtisi@neratec.com> wrote:
> This patch integrates the DFS module into ath9k, including
> * building the module into ath9k_hw
> * setting up DFS debugfs
> * defining HW capability flag for DFS support
> * setting this flag by DFS supporting devices
> (so far: AR_SREV_9280_20_OR_LATER, TBC)
> * setting PHYRADAR rx filter flag to enable radar
> pulse reporting
> * forward radar PHY errors to dfs module
>
> This is WIP and at its current stage is limited to test ath9k
> pulse detection capabilities. The DFS pattern matching is
> TBD in the higher layers and is not part of this patch.
>
> CONFIG_ATH9K_DFS must be set to enable pulse detection.
>
> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
> ---
> drivers/net/wireless/ath/ath9k/Makefile | 2 ++
> drivers/net/wireless/ath/ath9k/debug.c | 3 +++
> drivers/net/wireless/ath/ath9k/debug.h | 2 ++
> drivers/net/wireless/ath/ath9k/hw.c | 12 ++++++++++++
> drivers/net/wireless/ath/ath9k/hw.h | 1 +
> drivers/net/wireless/ath/ath9k/main.c | 17 +++++++++++++++++
> drivers/net/wireless/ath/ath9k/recv.c | 18 +++++++++++++-----
> 7 files changed, 50 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile
> index 36ed3c4..1f260a5 100644
> --- a/drivers/net/wireless/ath/ath9k/Makefile
> +++ b/drivers/net/wireless/ath/ath9k/Makefile
> @@ -29,6 +29,8 @@ ath9k_hw-y:= \
> eeprom_9287.o \
> ani.o \
> btcoex.o \
> + dfs.o \
> + dfs_debug.o \
> mac.o \
> ar9002_mac.o \
> ar9003_mac.o \
> diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
> index 138ae09..6642108 100644
> --- a/drivers/net/wireless/ath/ath9k/debug.c
> +++ b/drivers/net/wireless/ath/ath9k/debug.c
> @@ -1633,6 +1633,9 @@ int ath9k_init_debug(struct ath_hw *ah)
> debugfs_create_file("debug", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
> sc, &fops_debug);
> #endif
> +
> + ath9k_dfs_init_debug(sc);
> +
> debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc,
> &fops_dma);
> debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
> diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
> index 4f6c939..f70735a 100644
> --- a/drivers/net/wireless/ath/ath9k/debug.h
> +++ b/drivers/net/wireless/ath/ath9k/debug.h
> @@ -19,6 +19,7 @@
>
> #include "hw.h"
> #include "rc.h"
> +#include "dfs_debug.h"
>
> struct ath_txq;
> struct ath_buf;
> @@ -180,6 +181,7 @@ struct ath_stats {
> struct ath_interrupt_stats istats;
> struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES];
> struct ath_rx_stats rxstats;
> + struct ath_dfs_stats dfs_stats;
> u32 reset[__RESET_TYPE_MAX];
> };
>
> diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
> index 76dbc85..0f2fb42 100644
> --- a/drivers/net/wireless/ath/ath9k/hw.c
> +++ b/drivers/net/wireless/ath/ath9k/hw.c
> @@ -2333,6 +2333,18 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
> pCap->pcie_lcr_offset = 0x80;
> }
>
> +#ifdef CONFIG_ATH9K_DFS
> + /*
> + * enable radar detection on DFS supporting devices
> + */
> + if (AR_SREV_9280_20_OR_LATER(ah)) {
> + /*
> + * TODO: check for which chip-sets we want to support DFS
> + */
> + pCap->hw_caps |= ATH9K_HW_CAP_DFS;
> + }
> +#endif
> +
> tx_chainmask = pCap->tx_chainmask;
> rx_chainmask = pCap->rx_chainmask;
> while (tx_chainmask || rx_chainmask) {
> diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
> index 9dbc3cd..4f02f83 100644
> --- a/drivers/net/wireless/ath/ath9k/hw.h
> +++ b/drivers/net/wireless/ath/ath9k/hw.h
> @@ -204,6 +204,7 @@ enum ath9k_hw_caps {
> ATH9K_HW_CAP_5GHZ = BIT(14),
> ATH9K_HW_CAP_APM = BIT(15),
> ATH9K_HW_CAP_RTT = BIT(16),
> + ATH9K_HW_CAP_DFS = BIT(17),
> };
>
> struct ath9k_hw_capabilities {
> diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
> index d3b92ce..4d70aab 100644
> --- a/drivers/net/wireless/ath/ath9k/main.c
> +++ b/drivers/net/wireless/ath/ath9k/main.c
> @@ -305,6 +305,23 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
> ath9k_hw_antdiv_comb_conf_set(ah, &div_ant_conf);
> }
>
> + if (ah->caps.hw_caps && ATH9K_HW_CAP_DFS) {
> + /**
> + * enable radar pulse detection
> + *
> + * TODO: do this only for DFS channels
> + */
> + ah->private_ops.set_radar_params(ah, &ah->radar_conf);
can we do this something like ath9k_hw_set_radar_params?
why we need a seperate debug file for dfs, had i missed something?
> + ath9k_hw_setrxfilter(ah,
> + ath9k_hw_getrxfilter(ah) | ATH9K_RX_FILTER_PHYRADAR);
> + ath_dbg(common, ATH_DBG_DFS,
> + "DFS radar detection enabled for channel %d\n",
> + ah->curchan->channel);
> + } else {
> + ath9k_hw_setrxfilter(ah,
> + ath9k_hw_getrxfilter(ah) & ~ATH9K_RX_FILTER_PHYRADAR);
> + }
> +
> ieee80211_wake_queues(sc->hw);
>
> return true;
> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
> index a46e6ab..5dfd081 100644
> --- a/drivers/net/wireless/ath/ath9k/recv.c
> +++ b/drivers/net/wireless/ath/ath9k/recv.c
> @@ -17,6 +17,7 @@
> #include <linux/dma-mapping.h>
> #include "ath9k.h"
> #include "ar9003_mac.h"
> +#include "dfs.h"
>
> #define SKB_CB_ATHBUF(__skb) (*((struct ath_buf **)__skb->cb))
>
> @@ -1865,11 +1866,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
> if (sc->sc_flags & SC_OP_RXFLUSH)
> goto requeue_drop_frag;
>
> - retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
> - rxs, &decrypt_error);
> - if (retval)
> - goto requeue_drop_frag;
> -
> rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;
> if (rs.rs_tstamp > tsf_lower &&
> unlikely(rs.rs_tstamp - tsf_lower > 0x10000000))
> @@ -1879,6 +1875,18 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
> unlikely(tsf_lower - rs.rs_tstamp > 0x10000000))
> rxs->mactime += 0x100000000ULL;
>
> + if ((ah->caps.hw_caps & ATH9K_HW_CAP_DFS) &&
> + (rs.rs_status & ATH9K_RXERR_PHY) &&
> + (rs.rs_phyerr == ATH9K_PHYERR_RADAR)) {
> + /* DFS: check for radar pulse */
> + ath9k_dfs_process_phyerr(sc, hdr, &rs, rxs->mactime);
> + }
> +
> + retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
> + rxs, &decrypt_error);
> + if (retval)
> + goto requeue_drop_frag;
> +
> /* Ensure we always have an skb to requeue once we are done
> * processing the current buffer's skb */
> requeue_skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC);
> --
> 1.7.4.1
>
> --
> 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
>
--
shafi
^ permalink raw reply
* Re: [PATCH] cfg80211: merge in beacon ies of hidden bss.
From: Eliad Peller @ 2011-11-03 15:14 UTC (permalink / raw)
To: Dmitry Tarnyagin; +Cc: linux-wireless, Johannes Berg
In-Reply-To: <CAMG6FYiV8F=MFBeUQCGSj__h=REVLMvTZCvLEvDPT7GP2KWsWw@mail.gmail.com>
hi Dmitry,
On Wed, Nov 2, 2011 at 8:19 PM, Dmitry Tarnyagin <abi.dmitryt@gmail.com> wrote:
> The problem with PSM when a hidden SSID was used was originally
> reported by Juuso Oikarinen.
>
> - When generally scanning, the AP is getting a bss entry with
> a zero SSID.
> - When associationg, a probe-req is sent to the AP with the SSID,
> and as a result a probe-responseis received with the hidden
> SSID in place. As a consequence, a second bss entry is created
> for the AP, now with the real SSID.
> - After association, mac80211 executes ieee80211_recalc_ps(),
> but does not switch to powersave becuse the beacon-ies are missing.
>
> As result, the STA does not ever enter PSM.
>
> The patch merges in beacon ies of hidden bss from beacon to the probe
> response, creating a consistant set of ies in place.
>
> Signed-off-by: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
> ---
[...]
> +static int cmp_hidden_bss(struct cfg80211_bss *a,
> + struct cfg80211_bss *b)
> +{
> + const u8 *ie1;
> + const u8 *ie2;
> + size_t ielen;
> + int i;
> + int r;
> +
> + r = cmp_bss_core(a, b);
> + if (r)
> + return r;
> +
> + ie1 = cfg80211_find_ie(WLAN_EID_SSID,
> + a->information_elements,
> + a->len_information_elements);
> + ie2 = cfg80211_find_ie(WLAN_EID_SSID,
> + b->information_elements,
> + b->len_information_elements);
> + if (!ie1 && !ie2)
> + return 0;
> + if (!ie1 || !ie2)
> + return -1;
> +
> + ielen = min(ie1[1], ie2[1]);
> + for (i = 0; i < ielen; ++i)
> + if (ie2[i + 2])
> + return -1;
> +
> + return ie2[1] - ie1[1];
you don't account for the ssid = "" case.
> +static int
> +merge_hidden_ies(struct cfg80211_internal_bss *res,
> + struct cfg80211_internal_bss *hidden)
> +{
> + if (unlikely(res->pub.beacon_ies))
> + return -EALREADY;
> + if (WARN_ON(!hidden->pub.beacon_ies))
> + return -EINVAL;
> +
> + res->pub.beacon_ies = kmalloc(hidden->pub.len_beacon_ies, GFP_ATOMIC);
> + if (unlikely(!res->pub.beacon_ies))
> + return -ENOMEM;
> +
> + res->beacon_ies_allocated = true;
> + res->pub.len_beacon_ies = hidden->pub.len_beacon_ies;
> + memcpy(res->pub.beacon_ies, hidden->pub.beacon_ies,
> + res->pub.len_beacon_ies);
> +
> + return 0;
> +}
> +
i think the "merge" here is a bit misleading - there is no actual merge.
you copy the beacon_ies from the beacon, but we still end up with 2 bss nodes.
your solution does workaround the specific psm problem, but we still
end up with a duplicate bss conf node that will never get updated
(because the beacons will update the "original" bss node).
i guess this problem already exists with the current code.
not sure what is the correct way solve it, though.
maybe check for both the hidden name and the actual name?
Eliad.
^ permalink raw reply
* Re: b43 scans wifi networks with old firmware only.
From: Larry Finger @ 2011-11-03 15:12 UTC (permalink / raw)
To: roman-vl; +Cc: linux-wireless
In-Reply-To: <48883.148.106.128.38.1320319313.metamail@webmail.meta.ua>
On 11/03/2011 06:21 AM, Roman V.Leon. wrote:
> Hello Gents.
> I have problem with b43 driver 5.100.138, it's not scanning networks for
> unknown reason. I have broadcom wifi card PCIID is 14e4:4315, linux kern
> ver. is 3.0. When i'm trying to launch iwlist scan, i'm getting "no scan
> results".
>
> for example:
> sudo ifconfig wlan0 up
> sudo iwlist wlan0 scan
> No scan results.
>
> With the older driver 5.10.56.2808, i see normal scan results. If you need
> any more information, i will send.
The condition you report is known. Broadcom changed the TX/RX header structure
with firmware versions greater than 600, as shown by a 'dmesg | grep firmware'.
Those changes are not implemented in b43 until kernel 3.2.
These numbers are not b43 driver numbers, nor are they firmware numbers reported
by b43. They are the versions of Broadcom drivers.
If you look at
http://wireless.kernel.org/en/users/Drivers/b43#firmwareinstallation, you will
see that firmware should be extracted from Broadcom driver 5.100.138 "if you are
using kernel 3.2 or newer". For older kernels you should extract firmware from
the 5.10.56.27.3 of the Broadcom proprietary driver. Of course, 5.10.56.2808
will also work.
You could also get those changes by employing a bleeding-edge version of
compat-wireless. In that case, firmware from 5.100.138 would work.
Larry
^ permalink raw reply
* Re: [RFC v2 2/2] ath9k: integrate initial DFS module
From: Felix Fietkau @ 2011-11-03 15:11 UTC (permalink / raw)
To: Zefir Kurtisi; +Cc: linux-wireless, ath9k-devel, rodrigue
In-Reply-To: <1320328553-28066-3-git-send-email-zefir.kurtisi@neratec.com>
On 2011-11-03 2:55 PM, Zefir Kurtisi wrote:
> This patch integrates the DFS module into ath9k, including
> * building the module into ath9k_hw
> * setting up DFS debugfs
> * defining HW capability flag for DFS support
> * setting this flag by DFS supporting devices
> (so far: AR_SREV_9280_20_OR_LATER, TBC)
> * setting PHYRADAR rx filter flag to enable radar
> pulse reporting
> * forward radar PHY errors to dfs module
>
> This is WIP and at its current stage is limited to test ath9k
> pulse detection capabilities. The DFS pattern matching is
> TBD in the higher layers and is not part of this patch.
>
> CONFIG_ATH9K_DFS must be set to enable pulse detection.
>
> Signed-off-by: Zefir Kurtisi<zefir.kurtisi@neratec.com>
> ---
> drivers/net/wireless/ath/ath9k/Makefile | 2 ++
> drivers/net/wireless/ath/ath9k/debug.c | 3 +++
> drivers/net/wireless/ath/ath9k/debug.h | 2 ++
> drivers/net/wireless/ath/ath9k/hw.c | 12 ++++++++++++
> drivers/net/wireless/ath/ath9k/hw.h | 1 +
> drivers/net/wireless/ath/ath9k/main.c | 17 +++++++++++++++++
> drivers/net/wireless/ath/ath9k/recv.c | 18 +++++++++++++-----
> 7 files changed, 50 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
> index d3b92ce..4d70aab 100644
> --- a/drivers/net/wireless/ath/ath9k/main.c
> +++ b/drivers/net/wireless/ath/ath9k/main.c
> @@ -305,6 +305,23 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
> ath9k_hw_antdiv_comb_conf_set(ah,&div_ant_conf);
> }
>
> + if (ah->caps.hw_caps&& ATH9K_HW_CAP_DFS) {
> + /**
> + * enable radar pulse detection
> + *
> + * TODO: do this only for DFS channels
> + */
> + ah->private_ops.set_radar_params(ah,&ah->radar_conf);
> + ath9k_hw_setrxfilter(ah,
> + ath9k_hw_getrxfilter(ah) | ATH9K_RX_FILTER_PHYRADAR);
> + ath_dbg(common, ATH_DBG_DFS,
> + "DFS radar detection enabled for channel %d\n",
> + ah->curchan->channel);
> + } else {
> + ath9k_hw_setrxfilter(ah,
> + ath9k_hw_getrxfilter(ah)& ~ATH9K_RX_FILTER_PHYRADAR);
> + }
> +
Please drop this chunk of code and move the check to ath_calcrxfilter,
which gets called after every reset anyway. Also, use a separate flag in
sc->flags for actually enabling DFS. Even if the chip has DFS support,
we don't always want to enable it - especially not on 2.4 GHz or indoor
5 GHz channels.
- Felix
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox