[PATCH] P2P: Enable 40MHz support for p2p group addition

Rajkumar Manoharan rmanohar
Wed Jul 11 03:37:23 PDT 2012


On Wed, Jul 11, 2012 at 12:18:05PM +0300, Arik Nemtsov wrote:
> On Tue, Jul 10, 2012 at 1:08 PM, Rajkumar Manoharan
> <rmanohar at qca.qualcomm.com> wrote:
> > Add optional "ht40" argument for p2p_group_add command to enable 40MHz
> > in 5GHz band. This could configure secondary channel, when 11n support
> > was enabled and if the HW supports 40MHz channel width.
> >
> > Signed-hostap: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
> > ---
> >  wpa_supplicant/ap.c                         | 64 +++++++++++++++++++++++++++++
> >  wpa_supplicant/config.h                     |  1 +
> >  wpa_supplicant/ctrl_iface.c                 | 19 +++++----
> >  wpa_supplicant/dbus/dbus_new_handlers_p2p.c |  2 +-
> >  wpa_supplicant/p2p_supplicant.c             | 16 ++++----
> >  wpa_supplicant/p2p_supplicant.h             |  4 +-
> >  wpa_supplicant/wpa_cli.c                    | 19 ++++-----
> >  7 files changed, 97 insertions(+), 28 deletions(-)
> >
> > diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
> > index f9e0045..394784a 100644
> > --- a/wpa_supplicant/ap.c
> > +++ b/wpa_supplicant/ap.c
> > @@ -40,6 +40,57 @@
> >  static void wpas_wps_ap_pin_timeout(void *eloop_data, void *user_ctx);
> >  #endif /* CONFIG_WPS */
> >
> > +#ifdef CONFIG_IEEE80211N
> > +static int wpas_choose_ht40_sec_chan(struct hostapd_hw_modes *mode,
> > +                                    struct hostapd_config *conf,
> > +                                    int secondary_channel)
> > +{
> > +       int sec_chan, ok, j, first;
> > +       int allowed[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157,
> > +                         184, 192 };
> > +       size_t k;
> > +
> > +       sec_chan = conf->channel + secondary_channel * 4;
> > +
> > +       /* Verify that HT40 secondary channel is an allowed 20 MHz
> > +        * channel */
> > +       ok = 0;
> > +       for (j = 0; j < mode->num_channels; j++) {
> > +               struct hostapd_channel_data *chan = &mode->channels[j];
> > +               if (!(chan->flag & HOSTAPD_CHAN_DISABLED) &&
> > +                   chan->chan == sec_chan) {
> > +                       ok = 1;
> > +                       break;
> > +               }
> 
> Shouldn't you be using global->p2p->channels instead of
> mode->channels? These are pre-checked in wpas_p2p_setup_channels().
> Also shouldn't HOSTAPD_CHAN_HT40PLUS/MINUS be checked here?
> 
Hmm. I followed hostap function ieee80211n_allowed_ht40_channel_pair
for secondary channel selection.
> > +       }
> > +       if (!ok) {
> > +               wpa_printf(MSG_ERROR, "HT40 secondary channel %d not allowed",
> > +                          sec_chan);
> > +               return 0;
> 
> This will always print an error for the sec=-1 case, since sec=1 was
> tried (and failed). Or am I missing something?
>
I will correct the debug level and message.

-Rajkumar



More information about the Hostap mailing list