linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] nl80211: Add sta_flags to the station info
@ 2011-10-13 14:30 Helmut Schaa
  2011-10-13 14:30 ` [PATCH 2/2] mac80211: Provide station flags to cfg80211 Helmut Schaa
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Helmut Schaa @ 2011-10-13 14:30 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, johannes, Helmut Schaa

Reuse the already existing struct nl80211_sta_flag_update to specify
both, a flag mask and the flag set itself. This means
nl80211_sta_flag_update is now used for setting station flags and also
for getting station flags.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---

I think this is reasonable since even if we add read-only flags in
the future we can just ignore them when userspace tries to set them.

Helmut

 include/linux/nl80211.h |    2 ++
 include/net/cfg80211.h  |    5 ++++-
 net/wireless/nl80211.c  |    4 ++++
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9d797f2..013ec4b 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1548,6 +1548,7 @@ enum nl80211_sta_bss_param {
  * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute
  *     containing info as possible, see &enum nl80211_sta_bss_param
  * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
+ * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. 
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -1569,6 +1570,7 @@ enum nl80211_sta_info {
 	NL80211_STA_INFO_RX_BITRATE,
 	NL80211_STA_INFO_BSS_PARAM,
 	NL80211_STA_INFO_CONNECTED_TIME,
+	NL80211_STA_INFO_STA_FLAGS,
 
 	/* keep last */
 	__NL80211_STA_INFO_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 74f4f85..92cf1c2 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -497,6 +497,7 @@ struct station_parameters {
  * @STATION_INFO_BSS_PARAM: @bss_param filled
  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
+ * @STATION_INFO_STA_FLAGS: @sta_flags filled
  */
 enum station_info_flags {
 	STATION_INFO_INACTIVE_TIME	= 1<<0,
@@ -516,7 +517,8 @@ enum station_info_flags {
 	STATION_INFO_RX_BITRATE		= 1<<14,
 	STATION_INFO_BSS_PARAM          = 1<<15,
 	STATION_INFO_CONNECTED_TIME	= 1<<16,
-	STATION_INFO_ASSOC_REQ_IES	= 1<<17
+	STATION_INFO_ASSOC_REQ_IES	= 1<<17,
+	STATION_INFO_STA_FLAGS		= 1<<18
 };
 
 /**
@@ -633,6 +635,7 @@ struct station_info {
 	u32 tx_failed;
 	u32 rx_dropped_misc;
 	struct sta_bss_parameters bss_param;
+	struct nl80211_sta_flag_update sta_flags;
 
 	int generation;
 
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index edf655a..48260c2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2344,6 +2344,10 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
 
 		nla_nest_end(msg, bss_param);
 	}
+	if (sinfo->filled & STATION_INFO_STA_FLAGS)
+		NLA_PUT(msg, NL80211_STA_INFO_STA_FLAGS,
+			sizeof(struct nl80211_sta_flag_update),
+			&sinfo->sta_flags);
 	nla_nest_end(msg, sinfoattr);
 
 	if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES)
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] mac80211: Provide station flags to cfg80211
  2011-10-13 14:30 [PATCH 1/2] nl80211: Add sta_flags to the station info Helmut Schaa
@ 2011-10-13 14:30 ` Helmut Schaa
  2011-10-13 14:43 ` [PATCH 1/2] nl80211: Add sta_flags to the station info Johannes Berg
  2011-10-17 16:39 ` Johannes Berg
  2 siblings, 0 replies; 7+ messages in thread
From: Helmut Schaa @ 2011-10-13 14:30 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, johannes, Helmut Schaa

Only station flags that are already defined in nl80211 are added for
now.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---
 net/mac80211/cfg.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index d0705f2..e253afa 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -344,7 +344,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 			STATION_INFO_RX_BITRATE |
 			STATION_INFO_RX_DROP_MISC |
 			STATION_INFO_BSS_PARAM |
-			STATION_INFO_CONNECTED_TIME;
+			STATION_INFO_CONNECTED_TIME |
+			STATION_INFO_STA_FLAGS;
 
 	do_posix_clock_monotonic_gettime(&uptime);
 	sinfo->connected_time = uptime.tv_sec - sta->last_connected;
@@ -404,6 +405,23 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 		sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
 	sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
 	sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
+
+	sinfo->sta_flags.set = 0;
+	sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
+				BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
+				BIT(NL80211_STA_FLAG_WME) |
+				BIT(NL80211_STA_FLAG_MFP) |
+				BIT(NL80211_STA_FLAG_AUTHENTICATED);
+	if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
+	if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
+	if (test_sta_flag(sta, WLAN_STA_WME))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
+	if (test_sta_flag(sta, WLAN_STA_MFP))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
+	if (test_sta_flag(sta, WLAN_STA_AUTH))
+		sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
 }
 
 
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] nl80211: Add sta_flags to the station info
  2011-10-13 14:30 [PATCH 1/2] nl80211: Add sta_flags to the station info Helmut Schaa
  2011-10-13 14:30 ` [PATCH 2/2] mac80211: Provide station flags to cfg80211 Helmut Schaa
@ 2011-10-13 14:43 ` Johannes Berg
  2011-10-13 14:54   ` Helmut Schaa
  2011-10-17 16:39 ` Johannes Berg
  2 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2011-10-13 14:43 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: linux-wireless, linville

On Thu, 2011-10-13 at 16:30 +0200, Helmut Schaa wrote:
> Reuse the already existing struct nl80211_sta_flag_update to specify
> both, a flag mask and the flag set itself. This means
> nl80211_sta_flag_update is now used for setting station flags and also
> for getting station flags.

Why would we care about the mask here? Wouldn't a u32 attribute with the
set flags only make more sense?

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] nl80211: Add sta_flags to the station info
  2011-10-13 14:43 ` [PATCH 1/2] nl80211: Add sta_flags to the station info Johannes Berg
@ 2011-10-13 14:54   ` Helmut Schaa
  2011-10-13 15:00     ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Helmut Schaa @ 2011-10-13 14:54 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, linville

On Thu, Oct 13, 2011 at 4:43 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> Why would we care about the mask here? Wouldn't a u32 attribute with the
> set flags only make more sense?

I though about using the mask to tell user space which flags are actually
used/supported by the driver. There might be nl80211 drivers that can't provide
all flags and hence want to mask out the flags. Otherwise user space cannot
decide if a flag is not set or not supported by the driver. Does that sound
reasonable?

Helmut

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] nl80211: Add sta_flags to the station info
  2011-10-13 14:54   ` Helmut Schaa
@ 2011-10-13 15:00     ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2011-10-13 15:00 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: linux-wireless, linville

On Thu, 2011-10-13 at 16:54 +0200, Helmut Schaa wrote:
> On Thu, Oct 13, 2011 at 4:43 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > Why would we care about the mask here? Wouldn't a u32 attribute with the
> > set flags only make more sense?
> 
> I though about using the mask to tell user space which flags are actually
> used/supported by the driver. There might be nl80211 drivers that can't provide
> all flags and hence want to mask out the flags. Otherwise user space cannot
> decide if a flag is not set or not supported by the driver. Does that sound
> reasonable?

Yeah I was thinking that too, maybe that makes some sense. Not sure
we'll really run into that? Anyway we can keep it, I don't mind.

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] nl80211: Add sta_flags to the station info
  2011-10-13 14:30 [PATCH 1/2] nl80211: Add sta_flags to the station info Helmut Schaa
  2011-10-13 14:30 ` [PATCH 2/2] mac80211: Provide station flags to cfg80211 Helmut Schaa
  2011-10-13 14:43 ` [PATCH 1/2] nl80211: Add sta_flags to the station info Johannes Berg
@ 2011-10-17 16:39 ` Johannes Berg
  2011-10-17 16:43   ` Helmut Schaa
  2 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2011-10-17 16:39 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: linux-wireless, linville

On Thu, 2011-10-13 at 16:30 +0200, Helmut Schaa wrote:
> Reuse the already existing struct nl80211_sta_flag_update to specify
> both, a flag mask and the flag set itself. This means
> nl80211_sta_flag_update is now used for setting station flags and also
> for getting station flags.

Got a corresponding iw patch?

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: [PATCH 1/2] nl80211: Add sta_flags to the station info
  2011-10-17 16:39 ` Johannes Berg
@ 2011-10-17 16:43   ` Helmut Schaa
  0 siblings, 0 replies; 7+ messages in thread
From: Helmut Schaa @ 2011-10-17 16:43 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, linville

Am Montag, 17. Oktober 2011, 18:39:37 schrieb Johannes Berg:
> On Thu, 2011-10-13 at 16:30 +0200, Helmut Schaa wrote:
> > Reuse the already existing struct nl80211_sta_flag_update to specify
> > both, a flag mask and the flag set itself. This means
> > nl80211_sta_flag_update is now used for setting station flags and also
> > for getting station flags.
> 
> Got a corresponding iw patch?

Yup. Haven't found the time to send it out though...

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-17 16:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-13 14:30 [PATCH 1/2] nl80211: Add sta_flags to the station info Helmut Schaa
2011-10-13 14:30 ` [PATCH 2/2] mac80211: Provide station flags to cfg80211 Helmut Schaa
2011-10-13 14:43 ` [PATCH 1/2] nl80211: Add sta_flags to the station info Johannes Berg
2011-10-13 14:54   ` Helmut Schaa
2011-10-13 15:00     ` Johannes Berg
2011-10-17 16:39 ` Johannes Berg
2011-10-17 16:43   ` Helmut Schaa

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).