Subject: Re: if_media and 802.11
To: David Young <dyoung@pobox.com>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 02/16/2007 01:56:09
On Feb 16, 2007, at 12:43 AM, David Young wrote:

>
> #define IFM_IEEE80211_11A       0x00010000      /* 5 GHz, OFDM mode */
> #define IFM_IEEE80211_11B       0x00020000      /* Direct Sequence  
> mode */
> #define IFM_IEEE80211_11BG      0x00030000      /* 2 GHz, CCK/OFDM */
> #define IFM_IEEE80211_FH        0x00040000      /* 2 GHz, GFSK mode */
> #define IFM_IEEE80211_11G       0x00050000      /* 2 GHz, OFDM only */
> #define IFM_IEEE80211_11AGN     0x00060000      /* HT plus legacy  
> OFDM */
> #define IFM_IEEE80211_11ABGN    0x00070000      /* HT plus legacy  
> CCK/OFDM */

I like this.

> Let's let the determined operator "fix" a legacy rate in all modes  
> above.
>
> Let's add a media word for "pure" N mode.  At a glance, 0x00080000 is
> unused, so I use that.  I don't see any use in letting apps set an HT
> rate using the media word.  We will provide for that a little later.
>
> #define IFM_IEEE80211_11N       0x00080000      /* Pure N mode */
>
> Legacy modes do not make any sense in "pure" N mode.  Let's just fix
> all other parameters at
>
> We are not quite finished.  For 802.11n, we need to specify some
> additional media parameters, such as MCS ID, short/long guard  
> interval,
> channel width, and upper/lower channel extension.  I believe short/ 
> long
> guard interval and eligible MCS IDs belong in one ioctl:
>
>         #define IEEE80211_IOC_HT        TBD
>
>         struct ieee80211_ht_req {
>                 char                            i_name[IFNAMSIZ];
>                 uint16_t                        i_type;
>                 struct ieee80211_ht_params      *i_param;

This should not be a pointer.  It'd be best if the ioctl can avoid  
secondary copyins or copyouts.

>         };
>
>         struct ieee80211_ht_params {
>                 uint32_t        p_flags;
> #define IEEE80211_HTFLAG_GI_MASK        __BITS(1,0)     /* GI mode */
> #define IEEE80211_HTFLAG_GI_AUTO        __SHIFTIN(0,  
> IEEE80211_HTFLAG_GI_MASK)
> #define IEEE80211_HTFLAG_GI_SHORT       __SHIFTIN(1,  
> IEEE80211_HTFLAG_GI_MASK)
> #define IEEE80211_HTFLAG_GI_LONG        __SHIFTIN(2,  
> IEEE80211_HTFLAG_GI_MASK)
> #define IEEE80211_HTFLAG_40             __BIT(2)/* ok to auto- 
> select a 40 MHz
>                                                  * channel
>                                                  */
>                 uint8_t         p_mcsset[16];   /* bitmap of  
> eligible MCS IDs */
>         };
>
> To set the channel width and extension channel, let's use the upper  
> bits
> of the 16-bit channel word we pass to SIOCS80211CHANNEL[1]:
>
> #define IEEE80211_CHAN_40MHZ_UPEXT      0x8000
> #define IEEE80211_CHAN_40MHZ_LOEXT      0xC000
>
> I have no doubt left media parameters out, made a bunch of typos, etc.
>
> Dave
>
> [1] FWIW, I have used and still like the ifconfig notation 'ch+' and
>     'ch-' for upper/lower channel extension.
>
>         ifconfig w0 chan 11-
>         ifconfig w0 chan 1+