[PATCH 1/2] p2p: disable 11b rates only on p2p interface creation

Guy Eilam guy at wizery.com
Mon Oct 3 21:33:39 EDT 2011

On Sat, Sep 3, 2011 at 7:51 PM, Rajkumar Manoharan
<rmanohar at qca.qualcomm.com> wrote:
> 11b rates are disabled blindly during p2p init based on driver
> capability. This prevents use of CCK rates where p2p is not in
> use. This patch disables 11b rates during the p2p interface
> setup and also removes the disable_11b from global.
> Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> @@ -6603,6 +6606,9 @@ static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
>                    NL80211_CMD_SET_TX_BITRATE_MASK, 0);
>        NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
> +       if (!disabled)
> +               goto nla_send;
> +
>        bands = nla_nest_start(msg, NL80211_ATTR_TX_RATES);
>        if (!bands)
>                goto nla_put_failure;
> @@ -6620,7 +6626,7 @@ static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
>        nla_nest_end(msg, band);
>        nla_nest_end(msg, bands);
> -
> +nla_send:
>        ret = send_and_recv_msgs(drv, msg, NULL, NULL);
>        msg = NULL;
>        if (ret) {

I know that this patch is not entirely relevant and there are some
prerequisites that need to be handled before talking about this patch,
but I just wanted to point out that the (!disable) case in the
function is handled wrong in your patch.
Without the NL80211_ATTR_TX_RATES in the SET_TX_BITRATE_MASK command,
NL will return an invalid argument error.
The right way is to just put the NL80211_TXRATE_LEGACY attribute
inside an if clause, like this:

	if (disabled)
		NLA_PUT(msg, NL80211_TXRATE_LEGACY, 8,

Hopefully this will be relevant for a new patch that handles the p2p
and 11b scenario.

More information about the HostAP mailing list