linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Tourrilhes <jt@hpl.hp.com>
To: Dan Williams <dcbw@redhat.com>
Cc: Dave <kilroyd@googlemail.com>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] introduce WEXT scan capabilities
Date: Mon, 10 Dec 2007 10:08:09 -0800	[thread overview]
Message-ID: <20071210180809.GA7168@bougret.hpl.hp.com> (raw)
In-Reply-To: <1197225300.9149.74.camel@localhost.localdomain>

On Sun, Dec 09, 2007 at 01:35:00PM -0500, Dan Williams wrote:
> 
> 
> 
> On Sun, 2007-12-09 at 18:34 +0000, Dave wrote:
> > 
> > Dan Williams wrote:
> > > On Fri, 2007-12-07 at 18:12 -0800, David Miller wrote:
> > >> From: Dan Williams <dcbw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > >> Date: Fri, 07 Dec 2007 19:22:46 -0500
> > >>
> > >>> @@ -1040,6 +1049,16 @@ struct	iw_range
> > >>>  	 * because each entry contain its channel index */
> > >>>  
> > >>>  	__u32		enc_capa;	/* IW_ENC_CAPA_* bit field */
> > >>> +
> > >>> +	/* Do *NOT* use those fields, they are just used as padding to get
> > >>> +	 * proper alignement with user space */
> > >>> +	__s32		reserved1;
> > >>> +	__s32		reserved2;
> > >>> +	__u16		reserved3;
> > >>> +	__s32		reserved4;
> > >>> +	__u32		reserved5;
> > >>> +
> > >>> +	__u32		scan_capa;	/* IW_SCAN_CAPA_* bit field */
> > >>>  };
> > >>>  
> > >>>  /*
> > >> Major NACK.  These datastructure usages are complete wrong, and
> > >> we have to stop spreading this problem instead of continuing on
> > >> with it as if it's OK.
> > > 
> > > There's not too much we can do here.  We need a better way to support
> > > driver/card capabilities in WEXT right _now_, in parallel with
> > > cfg80211/nl80211.  The other alternative here is to have a 64-bit
> > > generic capabilities field-to-end-all-fields and add more bitfield
> > > position constants to that without extending the structure any more.
> > > 
> > > Is there a better way you'd propose to do this _in_WEXT_?
> > 
> > Since iw_range is not packed, there are a few locations where there is some padding. You could quite easily shoehorn an 8 bit bitmask into the existing structure without impacting backward compatibility (unless userspace is using the padding for something). For example:
> > 
> > --- a/include/linux/wireless.h
> > +++ b/include/linux/wireless.h
> > @@ -1035,6 +1035,7 @@ struct    iw_range
> >         /* Frequency */
> >         __u16           num_channels;   /* Number of channels [0; num - 1] */
> >         __u8            num_frequency;  /* Number of entry in the list */
> > +       __u8            scan_capa;      /* scan capabilities */
> >         struct iw_freq  freq[IW_MAX_FREQUENCIES];       /* list */
> >         /* Note : this frequency list doesn't need to fit channel numbers,
> >          * because each entry contain its channel index */
> > 
> > Other candidate blocks are Old Frequency, Rates, Encoder stuff, Transmit power.
> 
> Hmm; this could work as long as that part of the structure is guaranteed
> to be 0 if it wasn't touched by the driver.  If it could be filled with
> garbage bits at any point, then it's not going to work.  Interesting
> thought.

	You can count on zero being there in almost every case, for
this precise reason. The first thing a driver is supposed to do with
iwrange is :
----------------------------------------
	memset(range, 0, sizeof(struct iw_range));
----------------------------------------
	From what I remember, all drivers are doing it. If a driver
does not do it, it should be fixed ASAP as other things would break
(most driver only fill a few field of the struct and don't touch
others).

> Dan

	Regards,

	Jean

P.S. : What's up with all the bogus e-mail addresses in cc ?

      parent reply	other threads:[~2007-12-10 18:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-08  0:22 [PATCH] introduce WEXT scan capabilities Dan Williams
2007-12-08  2:12 ` David Miller
2007-12-08 10:56   ` drago01
2007-12-09 17:31   ` Dan Williams
2007-12-09 18:34     ` Dave
2007-12-09 18:35       ` Dan Williams
2007-12-10 12:23         ` Johannes Berg
2007-12-10 12:34           ` Johannes Berg
2007-12-10 18:08         ` Jean Tourrilhes [this message]

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=20071210180809.GA7168@bougret.hpl.hp.com \
    --to=jt@hpl.hp.com \
    --cc=dcbw@redhat.com \
    --cc=kilroyd@googlemail.com \
    --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).