linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Wu <flamingice@sourmilk.net>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Jiri Benc <jbenc@suse.cz>,
	linux-wireless@vger.kernel.org, Andy Green <andy@warmcat.com>
Subject: Re: [PATCH] mac80211: Add radiotap support
Date: Fri, 6 Apr 2007 09:26:16 -0400	[thread overview]
Message-ID: <200704060926.21863.flamingice@sourmilk.net> (raw)
In-Reply-To: <1175847074.3489.56.camel@johannes.berg>

[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]

On Friday 06 April 2007 04:11, Johannes Berg wrote:
> On Fri, 2007-04-06 at 00:48 -0400, Michael Wu wrote:
> > @@ -3756,6 +3802,12 @@ void __ieee80211_rx(struct ieee80211_hw *hw,
> > struct sk_buff *skb, struct ieee80211_txrx_data rx;
> >  	u16 type;
> >  	int multicast;
> > +	int radiotap_len = 0;
> > +
> > +	if (status->flag & RX_FLAG_RADIOTAP) {
> > +		radiotap_len = ieee80211_get_radiotap_len(skb);
> > +		skb_pull(skb, radiotap_len);
> > +	}
> >
> >  	hdr = (struct ieee80211_hdr *) skb->data;
> >  	memset(&rx, 0, sizeof(rx));
> > @@ -3792,6 +3844,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct
> > sk_buff *skb, goto end;
> >  	skb = rx.skb;
> >
> > +	skb_push(skb, radiotap_len);
>
> I don't like this trick. It's so non-obvious. And inbetween, the only
> thing we ever use is skb->data (once, to get hdr assigned) and skb->len
> (which we could also load into a local variable.
>
This is actually being done to avoid modifying rx_pre_handlers.

> > @@ -3800,7 +3853,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct
> > sk_buff *skb, } else {
> >  		struct ieee80211_sub_if_data *prev = NULL;
> >  		struct sk_buff *skb_new;
> > -		u8 *bssid = ieee80211_get_bssid(hdr, skb->len);
> > +		u8 *bssid = ieee80211_get_bssid(hdr, skb->len - radiotap_len);
>
> and here you still need to do the subtraction. If you had the local
> variable, then you could just write frame_len or something.
>
But calling the rx_pre_handlers still requires the skb_pull and skb_push so 
this is the only point where we need to calculate the frame length ourselves.

-Michael Wu

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-04-06 13:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-06  4:48 [PATCH] mac80211: Add radiotap support Michael Wu
2007-04-06  8:11 ` Johannes Berg
2007-04-06 13:26   ` Michael Wu [this message]
2007-04-06 13:52     ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200704060926.21863.flamingice@sourmilk.net \
    --to=flamingice@sourmilk.net \
    --cc=andy@warmcat.com \
    --cc=jbenc@suse.cz \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).