Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: "Luis R. Rodriguez" <lrodriguez@atheros.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] cfg80211: send regulatory beacon hint events to userspace
Date: Tue, 31 Mar 2009 10:16:05 +0200	[thread overview]
Message-ID: <1238487365.5970.78.camel@johannes.local> (raw)
In-Reply-To: <43e72e890903310110l49b8a6b8hfe42202d5da0304@mail.gmail.com> (sfid-20090331_101045_449530_E3541CBE)

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

On Tue, 2009-03-31 at 01:10 -0700, Luis R. Rodriguez wrote:

> >> +     /* Unforunately this is needed */
> >> +     nl_bands = nla_nest_start(msg, NL80211_ATTR_WIPHY_BANDS);
> >> +     if (!nl_bands)
> >> +             goto nla_put_failure;
> >> +     nl_band = nla_nest_start(msg, band);
> >> +     if (!nl_band)
> >> +             goto nla_put_failure;
> >> +
> >> +     /*
> >> +      * Our hack is to piggy back the channel prior to beacon hint
> >> +      * and after the beacon hint so userspace can analyze the
> >> +      * differences. Right now only no-ibss and passive-scan flags
> >> +      * can change as that's the only thing we expect to learn out
> >> +      * of a beacon for now. By re-using these attributes we can
> >> +      * avoid introducing new structs.
> >> +      */
> >> +     nl_freqs = nla_nest_start(msg, NL80211_BAND_ATTR_FREQS);
> >> +     if (!nl_freqs)
> >> +             goto nla_put_failure;
> >> +
> >> +     for (i = 0; i <= 1; i++) {
> >> +             nl_freq = nla_nest_start(msg, i);
> >> +             if (!nl_freq)
> >> +                     goto nla_put_failure;
> >> +
> >> +             chan = (i == 0) ? channel_before : channel_after;
> >> +
> >> +             NLA_PUT_U32(mNo, that's not exclusive...sg, NL80211_FREQUENCY_ATTR_FREQ,
> >> +                         chan->center_freq);
> >> +
> >> +             if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)
> >> +                     NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_PASSIVE_SCAN);
> >> +             if (chan->flags & IEEE80211_CHAN_NO_IBSS)
> >> +                     NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_IBSS);
> >> +
> >> +             nla_nest_end(msg, nl_freq);
> >> +     }
> >
> > I don't think I like this -- it's confusing to userspace code that wants
> > to use a unified message parser.
> 
> I know the feeling, more on this below.
> 
> > Do we really need that before/after thing anyway? I think if we really
> > need this then we should add new attributes.
> 
> Well we can definitely add new attributes, but remember we still have
> to pass the center of freq. The cleanest solution is to define an
> attribute with a center-freq, if-passive-lifted, if-beaconing-enabled
> flags. But that ends up adding all that for something we already have
> attributes for. I chose to use what we have.

No, we don't have to do that. All we'd need to do is add a new attribute
NL80211_ATTR_FREQ_CHANGE, which we document to
 1) contain an array
 2) in that array, contain nesting
 3) in that nesting contain NL80211_FREQUENCY_ATTR

That means you'd only need to remove the bands nesting and replace the
BAND_ATTR_FREQS nesting by ATTR_FREQ_CHANGE nesting. Only one new
attribute needed in total, and you can keep almost all the code too. The
array nesting is a little ugly, but that's not a big concern.

johanes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2009-03-31  8:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31  3:57 [PATCH] cfg80211: send regulatory beacon hint events to userspace Luis R. Rodriguez
2009-03-31  7:48 ` Johannes Berg
2009-03-31  8:10   ` Luis R. Rodriguez
2009-03-31  8:16     ` Johannes Berg [this message]
2009-03-31  8:18       ` Luis R. Rodriguez

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=1238487365.5970.78.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=lrodriguez@atheros.com \
    /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