Search Linux Wireless

Re: [patch 2/5] Add basic support for IEEE 802.11n discovery and association

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/27/07, Luis R. Rodriguez <mcgrof@xxxxxxxxx> wrote:
On 3/27/07, Luis R. Rodriguez <mcgrof@xxxxxxxxx> wrote:
> On 3/26/07, mohamed <mabbas@xxxxxxxxxxxxxxx> wrote:
>
> > +/* Get 11n capabilties from low level driver */
> > +static void ieee80211_fill_ht_ie(struct net_device *dev,
> > +                                struct ieee80211_ht_capability *ht_capab)
> > +{
> > +       int rc;
> > +       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
> > +
> > +       if (!local->ops->get_ht_capab){
> > +               memset(ht_capab, 0, sizeof(struct ieee80211_ht_capability));
> > +               return;
> > +       }
> > +
> > +       rc = local->ops->get_ht_capab(local_to_hw(local), ht_capab);
> > +       if (!rc) {
> > +               memset(ht_capab, 0, sizeof(struct ieee80211_ht_capability));
> > +               return;
> > +       }
> >
> > +       ht_capab->capabilitiesInfo = (__le16) cpu_to_le16(
> > +                                       ht_capab->capabilitiesInfo);
> > +       ht_capab->extended_ht_capability_info = (__le16) cpu_to_le16(
> > +                                       ht_capab->extended_ht_capability_info);
> > +       ht_capab->tx_BF_capability_info = (__le32) cpu_to_le32(
> > +                                       ht_capab->tx_BF_capability_info);
> > +}
> > +
>
> We should memset to 0 the entire ht_capab to regardless as its coming
> from skb_put() otherwise we'll get random data there if we don't set
> it and we sure as hell don't want to just transmit that :) Also
> ieee80211_send_assoc() is already checking for
> local->ops->get_ht_capab so lets just do a BUG_ON here to capture
> cases where someone else didn't do the proper checking. So how about
> instead something like:
>
> /* Get 11n capabilties from low level driver */
> static void ieee80211_fill_ht_ie(struct net_device *dev,
>                                 struct ieee80211_ht_capability *ht_capab)
> {
>        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
>        BUG_ON(!local->ops->get_ht_capab);
>        memset(ht_capab, 0, sizeof(struct ieee80211_ht_capability));
>        if (!local->ops->get_ht_capab(local_to_hw(local), ht_capab))
>                return;
>        ht_capab->capabilitiesInfo = (__le16) cpu_to_le16(
>                                        ht_capab->capabilitiesInfo);
>        ht_capab->extended_ht_capability_info = (__le16) cpu_to_le16(
>                                        ht_capab->extended_ht_capability_info);
>        ht_capab->tx_BF_capability_info = (__le32) cpu_to_le32(
>                                        ht_capab->tx_BF_capability_info);
> }
>

On second thought just memset to 0 on ieee80211_send_assoc() right
after the skb_put and remove that from above.

  Luis


Last few comments:

I. In struct ieee80211_ops you added your hunk after the TSF comment,
but before  u64 (*get_tsf)(struct ieee80211_hw *hw) was listed. Please
move the hunk after get_tsf or before the comment.

II. In ieee80211_fill_ht_ie() you do cpu_to_le* on the same fields.. I
take it the driver's get_ht_capab() is supposed to fill these. Since
you already defined them as little endian in the struct
ieee80211_ht_capability, how about just leaving that up to the driver
developer to make sure they do this? That's would be 6 lines less of
code in ieee80211_fill_ht_ie().

 Luis
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux