2008-08-03 11:32:08

by Tomas Winkler

[permalink] [raw]
Subject: [PATCH 1/1] mac80211: filter probes in ieee80211_rx_mgmt_probe_resp

This patch moves filtering statement from ieee80211_rx_bss_info
which is called for both beacon and probe to ieee80211_rx_mgmt_probe_resp
and save few cycles in beacon parsing.

Signed-off-by: Tomas Winkler <[email protected]>
---
net/mac80211/mlme.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 5358420..0800385 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2570,9 +2570,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
DECLARE_MAC_BUF(mac);
DECLARE_MAC_BUF(mac2);

- if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
- return; /* ignore ProbeResp to foreign address */
-
beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp);

if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id &&
@@ -2890,6 +2887,9 @@ static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev,
size_t baselen;
struct ieee802_11_elems elems;

+ if (memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
+ return; /* ignore ProbeResp to foreign address */
+
baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
if (baselen > len)
return;
--
1.5.4.1

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



2008-08-03 18:14:28

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/1] mac80211: filter probes in ieee80211_rx_mgmt_probe_resp

On Sun, 2008-08-03 at 14:32 +0300, Tomas Winkler wrote:
> This patch moves filtering statement from ieee80211_rx_bss_info
> which is called for both beacon and probe to ieee80211_rx_mgmt_probe_resp
> and save few cycles in beacon parsing.

Sounds alright to me, but maybe we should then document that
rx_bss_info() only expects data for the right BSSID?

> Signed-off-by: Tomas Winkler <[email protected]>
> ---
> net/mac80211/mlme.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 5358420..0800385 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -2570,9 +2570,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
> DECLARE_MAC_BUF(mac);
> DECLARE_MAC_BUF(mac2);
>
> - if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
> - return; /* ignore ProbeResp to foreign address */
> -
> beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp);
>
> if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id &&
> @@ -2890,6 +2887,9 @@ static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev,
> size_t baselen;
> struct ieee802_11_elems elems;
>
> + if (memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
> + return; /* ignore ProbeResp to foreign address */
> +
> baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
> if (baselen > len)
> return;


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2008-08-05 09:09:58

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/1] mac80211: filter probes in ieee80211_rx_mgmt_probe_resp

On Tue, 2008-08-05 at 10:14 +0300, Tomas Winkler wrote:
> On Sun, Aug 3, 2008 at 9:14 PM, Johannes Berg <[email protected]> wrote:
> > On Sun, 2008-08-03 at 14:32 +0300, Tomas Winkler wrote:
> >> This patch moves filtering statement from ieee80211_rx_bss_info
> >> which is called for both beacon and probe to ieee80211_rx_mgmt_probe_resp
> >> and save few cycles in beacon parsing.
> >
> > Sounds alright to me, but maybe we should then document that
> > rx_bss_info() only expects data for the right BSSID?
>
> Probes are filtered on destination address not on BSSID, to exclude
> probe responses not directed to the station.
> bss_info treats any BSSID this is what creates the bss list after all
> if I'm not mistaken.

Eh, right, of course, not sure why I got confused there. Still though,
adding a few lines of comments would be nice. If we did that every time
we changed a function, we'd have documentation for all functions in no
time ;) Oh well...

johannes


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2008-08-05 15:28:44

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/1] mac80211: filter probes in ieee80211_rx_mgmt_probe_resp

On Tue, 2008-08-05 at 18:21 +0300, Tomas Winkler wrote:

> >> Probes are filtered on destination address not on BSSID, to exclude
> >> probe responses not directed to the station.
> >> bss_info treats any BSSID this is what creates the bss list after all
> >> if I'm not mistaken.
> >
> > Eh, right, of course, not sure why I got confused there. Still though,
> > adding a few lines of comments would be nice. If we did that every time
> > we changed a function, we'd have documentation for all functions in no
> > time ;) Oh well...
> >
> I agree, I haven't added any function in this patch so I'm not sure
> it's appropriate to add comments within this patch.
> The statement I've moved is already commented.
> I can comment the function in a different patch.

Works for me, I don't really care too much either way.

I'm just thinking that when we change behaviour of a function or similar
we could take the opportunity to document the (new) behaviour. Not too
important in this case I guess.

johannes


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2008-08-05 15:21:04

by Tomas Winkler

[permalink] [raw]
Subject: Re: [PATCH 1/1] mac80211: filter probes in ieee80211_rx_mgmt_probe_resp

On Tue, Aug 5, 2008 at 12:09 PM, Johannes Berg
<[email protected]> wrote:
> On Tue, 2008-08-05 at 10:14 +0300, Tomas Winkler wrote:
>> On Sun, Aug 3, 2008 at 9:14 PM, Johannes Berg <[email protected]> wrote:
>> > On Sun, 2008-08-03 at 14:32 +0300, Tomas Winkler wrote:
>> >> This patch moves filtering statement from ieee80211_rx_bss_info
>> >> which is called for both beacon and probe to ieee80211_rx_mgmt_probe_resp
>> >> and save few cycles in beacon parsing.
>> >
>> > Sounds alright to me, but maybe we should then document that
>> > rx_bss_info() only expects data for the right BSSID?
>>
>> Probes are filtered on destination address not on BSSID, to exclude
>> probe responses not directed to the station.
>> bss_info treats any BSSID this is what creates the bss list after all
>> if I'm not mistaken.
>
> Eh, right, of course, not sure why I got confused there. Still though,
> adding a few lines of comments would be nice. If we did that every time
> we changed a function, we'd have documentation for all functions in no
> time ;) Oh well...
>
I agree, I haven't added any function in this patch so I'm not sure
it's appropriate to add comments within this patch.
The statement I've moved is already commented.
I can comment the function in a different patch.
Thanks
Tomas

2008-08-05 07:14:08

by Tomas Winkler

[permalink] [raw]
Subject: Re: [PATCH 1/1] mac80211: filter probes in ieee80211_rx_mgmt_probe_resp

On Sun, Aug 3, 2008 at 9:14 PM, Johannes Berg <[email protected]> wrote:
> On Sun, 2008-08-03 at 14:32 +0300, Tomas Winkler wrote:
>> This patch moves filtering statement from ieee80211_rx_bss_info
>> which is called for both beacon and probe to ieee80211_rx_mgmt_probe_resp
>> and save few cycles in beacon parsing.
>
> Sounds alright to me, but maybe we should then document that
> rx_bss_info() only expects data for the right BSSID?

Probes are filtered on destination address not on BSSID, to exclude
probe responses not directed to the station.
bss_info treats any BSSID this is what creates the bss list after all
if I'm not mistaken.
Tomas