2012-12-05 04:12:50

by Marco Porsch

[permalink] [raw]
Subject: [RFC] mac80211_hwsim: dont modify TBTT if beacon is already enabled

If the beacon is already enabled, do not modify the beacon timer. This causes
a hard TBTT adjustment and may cause mischief for powersave or synchronization.

Signed-off-by: Marco Porsch <[email protected]>
---
drivers/net/wireless/mac80211_hwsim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index bc763d2..abfa7e6 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1174,7 +1174,7 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
data->power_level = conf->power_level;
if (!data->started || !data->beacon_int)
del_timer(&data->beacon_timer);
- else
+ else if (!timer_pending(&data->beacon_timer))
mod_timer(&data->beacon_timer, jiffies + data->beacon_int);

return 0;
--
1.7.9.5



2012-12-05 23:04:36

by Marco Porsch

[permalink] [raw]
Subject: [PATCH] mac80211: dont drop mesh peering frames from unknown STA

Previously, mesh peering frames from a STA without a station entry were being
dropped.

Mesh Peering Open and Co. frames (WLAN_CATEGORY_SELF_PROTECTED) although from
a yet unknown STA are valid mesh peering frames. The STA entry will followingly
be created in mesh_peer_init.
The problem was previously worked around since both STA receive the beacons
of one another which create the STA entry. Yet, this creates an unnecessary
delay and beacons may not be received if either node is in PS mode.

Signed-off-by: Marco Porsch <[email protected]>
---
net/mac80211/rx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 8d267ec..89bfbbb 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2319,7 +2319,8 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
if (len < IEEE80211_MIN_ACTION_SIZE)
return RX_DROP_UNUSABLE;

- if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC)
+ if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC &&
+ mgmt->u.action.category != WLAN_CATEGORY_SELF_PROTECTED)
return RX_DROP_UNUSABLE;

if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
--
1.7.9.5


2012-12-07 17:52:02

by Marco Porsch

[permalink] [raw]
Subject: Re: [RFC] mac80211_hwsim: dont modify TBTT if beacon is already enabled

On 12/05/2012 12:26 PM, Thomas Pedersen wrote:> On Tue, Dec 4, 2012 at
8:12 PM, Marco Porsch
> <[email protected]> wrote:
>> If the beacon is already enabled, do not modify the beacon timer.
This causes
>> a hard TBTT adjustment and may cause mischief for powersave or
synchronization.j
>
> It might be clearer if you explain this patch actually defers "TBTT"
> adjustment until the next beacon.

This commit is supposed to not change the TBTT at all, if the beacon is
not enabled/disabled. Or do I misunderstand you here? Please clarify.

>> Signed-off-by: Marco Porsch <[email protected]>
>> ---
>> drivers/net/wireless/mac80211_hwsim.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/mac80211_hwsim.c
b/drivers/net/wireless/mac80211_hwsim.c
>> index bc763d2..abfa7e6 100644
>> --- a/drivers/net/wireless/mac80211_hwsim.c
>> +++ b/drivers/net/wireless/mac80211_hwsim.c
>> @@ -1174,7 +1174,7 @@ static int mac80211_hwsim_config(struct
ieee80211_hw *hw, u32 changed)
>> data->power_level = conf->power_level;
>> if (!data->started || !data->beacon_int)
>> del_timer(&data->beacon_timer);
>> - else
>> + else if (!timer_pending(&data->beacon_timer))
>> mod_timer(&data->beacon_timer, jiffies +
data->beacon_int);
>
> There is an immediate beacon timer adjustment in
> mac80211_hwsim_bss_info_changed() as well.

But that other one really has to change the TBTT because it changes the
beacon interval.

--Marco


Attachments:
marco_porsch.vcf (420.00 B)
smime.p7s (4.98 kB)
S/MIME Cryptographic Signature
Download all attachments

2012-12-07 20:22:20

by Thomas Pedersen

[permalink] [raw]
Subject: Re: [RFC] mac80211_hwsim: dont modify TBTT if beacon is already enabled

On Fri, Dec 7, 2012 at 9:51 AM, Marco Porsch
<[email protected]> wrote:
> On 12/05/2012 12:26 PM, Thomas Pedersen wrote:> On Tue, Dec 4, 2012 at 8:12
> PM, Marco Porsch
>
>> <[email protected]> wrote:
>>> If the beacon is already enabled, do not modify the beacon timer. This
>>> causes
>>> a hard TBTT adjustment and may cause mischief for powersave or
>>> synchronization.j
>>
>> It might be clearer if you explain this patch actually defers "TBTT"
>> adjustment until the next beacon.
>
> This commit is supposed to not change the TBTT at all, if the beacon is not
> enabled/disabled. Or do I misunderstand you here? Please clarify.

That's right, but I think in general you want to defer TBTT
adjustment until next beacon and that it's worth adding that fix to
this patch. See the comment below.

>>> Signed-off-by: Marco Porsch <[email protected]>
>>> ---
>>> drivers/net/wireless/mac80211_hwsim.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/wireless/mac80211_hwsim.c
>>> b/drivers/net/wireless/mac80211_hwsim.c
>>> index bc763d2..abfa7e6 100644
>>> --- a/drivers/net/wireless/mac80211_hwsim.c
>>> +++ b/drivers/net/wireless/mac80211_hwsim.c
>>> @@ -1174,7 +1174,7 @@ static int mac80211_hwsim_config(struct
>>> ieee80211_hw *hw, u32 changed)
>>> data->power_level = conf->power_level;
>>> if (!data->started || !data->beacon_int)
>>> del_timer(&data->beacon_timer);
>>> - else
>>> + else if (!timer_pending(&data->beacon_timer))
>>> mod_timer(&data->beacon_timer, jiffies +
>>> data->beacon_int);
>>
>> There is an immediate beacon timer adjustment in
>> mac80211_hwsim_bss_info_changed() as well.
>
> But that other one really has to change the TBTT because it changes the
> beacon interval.

Yes, but if you don't check whether the timer is already pending you
will beacon at a different TBTT than advertised in the last beacon. If
the beacon timer is not modified immediately, it will reschedule
itself based on the new beacon interval after the next beacon.

Thomas

2012-12-05 20:26:40

by Thomas Pedersen

[permalink] [raw]
Subject: Re: [RFC] mac80211_hwsim: dont modify TBTT if beacon is already enabled

On Tue, Dec 4, 2012 at 8:12 PM, Marco Porsch
<[email protected]> wrote:
> If the beacon is already enabled, do not modify the beacon timer. This causes
> a hard TBTT adjustment and may cause mischief for powersave or synchronization.j

It might be clearer if you explain this patch actually defers "TBTT"
adjustment until the next beacon.

> Signed-off-by: Marco Porsch <[email protected]>
> ---
> drivers/net/wireless/mac80211_hwsim.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
> index bc763d2..abfa7e6 100644
> --- a/drivers/net/wireless/mac80211_hwsim.c
> +++ b/drivers/net/wireless/mac80211_hwsim.c
> @@ -1174,7 +1174,7 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
> data->power_level = conf->power_level;
> if (!data->started || !data->beacon_int)
> del_timer(&data->beacon_timer);
> - else
> + else if (!timer_pending(&data->beacon_timer))
> mod_timer(&data->beacon_timer, jiffies + data->beacon_int);

There is an immediate beacon timer adjustment in
mac80211_hwsim_bss_info_changed() as well.

Thomas

2012-12-06 13:00:39

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: dont drop mesh peering frames from unknown STA

On Wed, 2012-12-05 at 15:04 -0800, Marco Porsch wrote:
> Previously, mesh peering frames from a STA without a station entry were being
> dropped.
>
> Mesh Peering Open and Co. frames (WLAN_CATEGORY_SELF_PROTECTED) although from
> a yet unknown STA are valid mesh peering frames. The STA entry will followingly
> be created in mesh_peer_init.
> The problem was previously worked around since both STA receive the beacons
> of one another which create the STA entry. Yet, this creates an unnecessary
> delay and beacons may not be received if either node is in PS mode.

Applied.

johannes