diff mbox

iw: Allow configuring empty legacy and ht ratesets.

Message ID 1426028412-17438-1-git-send-email-greearb@candelatech.com (mailing list archive)
State Not Applicable
Delegated to: Johannes Berg
Headers show

Commit Message

Ben Greear March 10, 2015, 11 p.m. UTC
From: Ben Greear <greearb@candelatech.com>

This allows one to configure exactly one rate for drivers
such as ath10k that will only allow a single rate to be
configured.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 bitrate.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Janusz.Dziedzic@tieto.com March 11, 2015, 6:10 a.m. UTC | #1
On 11 March 2015 at 00:00,  <greearb@candelatech.com> wrote:
> From: Ben Greear <greearb@candelatech.com>
>
> This allows one to configure exactly one rate for drivers
> such as ath10k that will only allow a single rate to be
> configured.
>

Hello,

But iw already support setting single rate with ath10k.
This is example from ath10k commit log:

    Example:
    iw wlanX set bitrates legacy-5 ht-mcs-5 vht-mcs-5 2:9
    will setup VHT, nss=2, mcs=9

    iw wlanX set bitrates legacy-5 18 ht-mcs-5 vht-mcs-5
    will setup legacy, 18Mbps

    iw wlanX set bitrates legacy-5 ht-mcs-5 3 vht-mcs-5
    will setup HT, nss=1, mcs=3

    iw wlanX set bitrate legacy-5 ht-mcs-5 vht-mcs-5 1:0-9
    will setup nss=1

    iw wlanX set bitrate legacy-5 ht-mcs-5 vht-mcs-5 1:0-9 2:0-9
    will setup nss=2

BR
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Greear March 11, 2015, 3:53 p.m. UTC | #2
On 03/10/2015 11:10 PM, Janusz Dziedzic wrote:
> On 11 March 2015 at 00:00,  <greearb@candelatech.com> wrote:
>> From: Ben Greear <greearb@candelatech.com>
>>
>> This allows one to configure exactly one rate for drivers
>> such as ath10k that will only allow a single rate to be
>> configured.
>>
> 
> Hello,
> 
> But iw already support setting single rate with ath10k.
> This is example from ath10k commit log:

Ahh, I see.  I was confused about what syntax to use for 'iw', must have
typo'd something early on and then though the limitation was in the parser.

Thanks,
Ben

> 
>     Example:
>     iw wlanX set bitrates legacy-5 ht-mcs-5 vht-mcs-5 2:9
>     will setup VHT, nss=2, mcs=9
> 
>     iw wlanX set bitrates legacy-5 18 ht-mcs-5 vht-mcs-5
>     will setup legacy, 18Mbps
> 
>     iw wlanX set bitrates legacy-5 ht-mcs-5 3 vht-mcs-5
>     will setup HT, nss=1, mcs=3
> 
>     iw wlanX set bitrate legacy-5 ht-mcs-5 vht-mcs-5 1:0-9
>     will setup nss=1
> 
>     iw wlanX set bitrate legacy-5 ht-mcs-5 vht-mcs-5 1:0-9 2:0-9
>     will setup nss=2
> 
> BR
> Janusz
>
diff mbox

Patch

diff --git a/bitrate.c b/bitrate.c
index 4df6185..21217bf 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -176,6 +176,8 @@  static int handle_bitrates(struct nl80211_state *state,
 			tmpd = strtod(argv[i], &end);
 			if (*end != '\0')
 				return 1;
+                        if (tmpd == -1) /* terminator, could be empty list */
+                           break;
 			if (tmpd < 1 || tmpd > 255 * 2)
 				return 1;
 			legacy[(*n_legacy)++] = tmpd * 2;
@@ -184,6 +186,8 @@  static int handle_bitrates(struct nl80211_state *state,
 			tmpl = strtol(argv[i], &end, 0);
 			if (*end != '\0')
 				return 1;
+                        if (tmpl == -1) /* terminator, could be empty list */
+                           break;
 			if (tmpl < 0 || tmpl > 255)
 				return 1;
 			mcs[(*n_mcs)++] = tmpl;