[PATCH v2 1/2] P2P: Enable 40MHz support for p2p group addition

Arik Nemtsov arik at wizery.com
Mon Jul 16 02:56:45 EDT 2012


On Thu, Jul 12, 2012 at 11:44 AM, 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>
[...]
>  static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
>  {
> -       int freq = 0;
> +       int freq = 0, ht40 = 0;
>         char *pos;
>
>         pos = os_strstr(cmd, "freq=");
>         if (pos)
>                 freq = atoi(pos + 5);
>
> +       if (os_strncmp(cmd, "ht40", 4) == 0)
> +               ht40 = 1;

This limits ht40 to appear only in the beginning of the command. I
hope that's on purpose?

> +
>         if (os_strncmp(cmd, "persistent=", 11) == 0)
> -               return p2p_ctrl_group_add_persistent(wpa_s, cmd + 11, freq);
> +               return p2p_ctrl_group_add_persistent(wpa_s, cmd + 11, freq, ht40);
>         if (os_strcmp(cmd, "persistent") == 0 ||
>             os_strncmp(cmd, "persistent ", 11) == 0)
> -               return wpas_p2p_group_add(wpa_s, 1, freq);
> +               return wpas_p2p_group_add(wpa_s, 1, freq, ht40);
>         if (os_strncmp(cmd, "freq=", 5) == 0)
> -               return wpas_p2p_group_add(wpa_s, 0, freq);
> +               return wpas_p2p_group_add(wpa_s, 0, freq, ht40);
> +       if (ht40)
> +               return wpas_p2p_group_add(wpa_s, 0, freq, ht40);
[...]

> @@ -2019,7 +2020,7 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid,
>                            MAC2STR(sa), op_freq);
>                 if (s) {
>                         wpas_p2p_group_add_persistent(
> -                               wpa_s, s, s->mode == WPAS_MODE_P2P_GO, 0);
> +                               wpa_s, s, s->mode == WPAS_MODE_P2P_GO, 0, 0);
>                 } else if (bssid) {
>                         wpas_p2p_join(wpa_s, bssid, go_dev_addr,
>                                       wpa_s->p2p_wps_method, 0);

This appears to be a corner case of the
ht40-only-on-explicit-p2p-connect approach. Here we can never enable
ht40.

Jouni - perhaps we can also use a global parameter in
wpa_supplicant.conf (go_enable_ht40=1)?
The p2p_connect parameter (if specified) will override the globally
set parameter.

> @@ -2086,7 +2087,7 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid)
>         }
>
>         wpas_p2p_group_add_persistent(wpa_s, ssid,
> -                                     ssid->mode == WPAS_MODE_P2P_GO, 0);
> +                                     ssid->mode == WPAS_MODE_P2P_GO, 0, 0);
>  }

Same argument applies here.

>
>
> @@ -2331,6 +2332,42 @@ static int wpas_go_connected(void *ctx, const u8 *dev_addr)
>         return 0;
>  }
>
> +int wpas_p2p_select_ht40_sec_channel(struct wpa_supplicant *wpa_s,
> +                                    struct hostapd_hw_modes *mode,
> +                                    u8 channel)

This functions seems like a duplication of wpas_p2p_setup_channels().
Perhaps its worth separating out the common code into another
function?

> +{
> +       int op;
> +       struct p2p_oper_class_map op_class[] = {
> +               { HOSTAPD_MODE_IEEE80211A, 116, 36, 44, 8, BW40PLUS },
> +               { HOSTAPD_MODE_IEEE80211A, 117, 40, 48, 8, BW40MINUS },
> +               { HOSTAPD_MODE_IEEE80211A, 126, 149, 157, 8, BW40PLUS },
> +               { HOSTAPD_MODE_IEEE80211A, 127, 153, 161, 8, BW40MINUS },
> +               { -1, 0, 0, 0, 0, BW20 }
> +       };
> +
> +       for (op = 0; op_class[op].op_class; op++) {
> +               struct p2p_oper_class_map *o = &op_class[op];
> +               u8 ch;
> +
> +               for (ch = o->min_chan; ch <= o->max_chan; ch += o->inc) {
> +                       int flag;
> +                       if (ch != channel)
> +                               continue;
> +                       if (!has_channel(wpa_s->global, mode, ch, &flag))
> +                               continue;
> +                       if (o->bw == BW40MINUS &&
> +                           (!(flag & HOSTAPD_CHAN_HT40MINUS) ||
> +                            !has_channel(wpa_s->global, mode, ch - 4, NULL)))
> +                               return 0;
> +                       if (o->bw == BW40PLUS &&
> +                           (!(flag & HOSTAPD_CHAN_HT40PLUS) ||
> +                            !has_channel(wpa_s->global, mode, ch + 4, NULL)))
> +                               return 0;
> +                       return (o->bw == BW40MINUS) ? -1 : 1;
> +               }
> +       }
> +       return 0;
> +}

Arik


More information about the HostAP mailing list