* [RFC] ibss: Added channel type in order to create HT IBSS
@ 2010-05-02 14:12 Benoit Papillault
2010-05-02 16:32 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Benoit Papillault @ 2010-05-02 14:12 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, Benoit Papillault
When joining an IBSS, the parameters can be used to create the IBSS. As
such, we need to know if the user wants to create an HT IBSS or not.
This is accomplish by passing the channel type (ie ht20, ht40- or
ht40+). Default is to create a non HT IBSS.
Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
---
It is needed for upcoming patches regarding HT IBSS
ibss.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/ibss.c b/ibss.c
index 4715ac8..4003a38 100644
--- a/ibss.c
+++ b/ibss.c
@@ -18,6 +18,15 @@ static int join_ibss(struct nl80211_state *state,
{
char *end;
unsigned char abssid[6];
+ int i;
+ static const struct {
+ const char *name;
+ unsigned int val;
+ } htmap[] = {
+ { .name = "HT20", .val = NL80211_CHAN_HT20, },
+ { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, },
+ { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, },
+ };
if (argc < 2)
return 1;
@@ -52,6 +61,22 @@ static int join_ibss(struct nl80211_state *state,
if (!argc)
return 0;
+ if (argc) {
+ for (i = 0; i < ARRAY_SIZE(htmap); i++) {
+ if (strcasecmp(htmap[i].name, argv[1]) == 0) {
+ NLA_PUT_U32(msg,
+ NL80211_ATTR_WIPHY_CHANNEL_TYPE,
+ htmap[i].val);
+ argv++;
+ argc--;
+ break;
+ }
+ }
+ }
+
+ if (!argc)
+ return 0;
+
if (strcmp(*argv, "key") != 0 && strcmp(*argv, "keys") != 0)
return 1;
@@ -73,7 +98,7 @@ static int leave_ibss(struct nl80211_state *state,
COMMAND(ibss, leave, NULL,
NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss,
"Leave the current IBSS cell.");
-COMMAND(ibss, join, "<SSID> <freq in MHz> [fixed-freq] [<fixed bssid>] [key d:0:abcde]",
+COMMAND(ibss, join, "<SSID> <freq in MHz> [HT20|HT40+|HT40-] [fixed-freq] [<fixed bssid>] [key d:0:abcde]",
NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss,
"Join the IBSS cell with the given SSID, if it doesn't exist create\n"
"it on the given frequency. When fixed frequency is requested, don't\n"
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [RFC] ibss: Added channel type in order to create HT IBSS
2010-05-02 14:12 [RFC] ibss: Added channel type in order to create HT IBSS Benoit Papillault
@ 2010-05-02 16:32 ` Johannes Berg
2010-05-02 20:05 ` Benoit Papillault
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2010-05-02 16:32 UTC (permalink / raw)
To: Benoit Papillault; +Cc: linux-wireless
On Sun, 2010-05-02 at 16:12 +0200, Benoit Papillault wrote:
> When joining an IBSS, the parameters can be used to create the IBSS. As
> such, we need to know if the user wants to create an HT IBSS or not.
> This is accomplish by passing the channel type (ie ht20, ht40- or
> ht40+). Default is to create a non HT IBSS.
>
> Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
> ---
> It is needed for upcoming patches regarding HT IBSS
> ibss.c | 27 ++++++++++++++++++++++++++-
> 1 files changed, 26 insertions(+), 1 deletions(-)
>
> diff --git a/ibss.c b/ibss.c
> index 4715ac8..4003a38 100644
> --- a/ibss.c
> +++ b/ibss.c
> @@ -18,6 +18,15 @@ static int join_ibss(struct nl80211_state *state,
> {
> char *end;
> unsigned char abssid[6];
> + int i;
> + static const struct {
> + const char *name;
> + unsigned int val;
> + } htmap[] = {
> + { .name = "HT20", .val = NL80211_CHAN_HT20, },
> + { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, },
> + { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, },
> + };
There's code to do something like this already when setting the channel,
please factor it out and use it in both places.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFC] ibss: Added channel type in order to create HT IBSS
2010-05-02 16:32 ` Johannes Berg
@ 2010-05-02 20:05 ` Benoit Papillault
0 siblings, 0 replies; 3+ messages in thread
From: Benoit Papillault @ 2010-05-02 20:05 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
Le 02/05/2010 18:32, Johannes Berg a écrit :
> On Sun, 2010-05-02 at 16:12 +0200, Benoit Papillault wrote:
>> When joining an IBSS, the parameters can be used to create the IBSS. As
>> such, we need to know if the user wants to create an HT IBSS or not.
>> This is accomplish by passing the channel type (ie ht20, ht40- or
>> ht40+). Default is to create a non HT IBSS.
>>
>> Signed-off-by: Benoit Papillault<benoit.papillault@free.fr>
>> ---
>> It is needed for upcoming patches regarding HT IBSS
>> ibss.c | 27 ++++++++++++++++++++++++++-
>> 1 files changed, 26 insertions(+), 1 deletions(-)
>>
>> diff --git a/ibss.c b/ibss.c
>> index 4715ac8..4003a38 100644
>> --- a/ibss.c
>> +++ b/ibss.c
>> @@ -18,6 +18,15 @@ static int join_ibss(struct nl80211_state *state,
>> {
>> char *end;
>> unsigned char abssid[6];
>> + int i;
>> + static const struct {
>> + const char *name;
>> + unsigned int val;
>> + } htmap[] = {
>> + { .name = "HT20", .val = NL80211_CHAN_HT20, },
>> + { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, },
>> + { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, },
>> + };
>
> There's code to do something like this already when setting the channel,
> please factor it out and use it in both places.
>
> johannes
>
Agreed. I did a copy/paste in the hurry, my bad.
I am going to post an update ASAP.
Regards,
Benoit
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-02 20:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-02 14:12 [RFC] ibss: Added channel type in order to create HT IBSS Benoit Papillault
2010-05-02 16:32 ` Johannes Berg
2010-05-02 20:05 ` Benoit Papillault
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).