Skip to contentSkip to conversation

mac80211: adding bss_config to low driver ops

PATCH In review Tomas Winkler 5 participants 10 messages Oct 17, 2007 – Oct 23, 2007 1 message not in the archive mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: adding bss_config to low driver ops

From: Ron Rindjunsky <[email protected]>

This patch gives a framework that will enable the mac80211 to inform to low level driver about association status changes + changes in bss status due to changes in BSS capabilities advertised by AP or in AP mode changes to be advertised and configured to.
This will also obsolete current ops for each BSS change such as erp or wmm. In legacy networks the B G coexistence is handled by ERP While in HT there are many more issues such as 20/40Mhz, GF etc. It will be counterproductive to implement handlers for each parameter it is simpler to consolidate all in one handler under common structure

1 - struct ieee80211_erp_info will be used to inform about erp changes. 2 - struct ieee80211_wmm_info will be used to inform about wmm changes 3 - struct ieee80211_bss_data will be used to transfer this data to low-level driver
4 - bss_info_changed will triger the change in low-level driver

---
 include/net/mac80211.h       |   29 ++++++++++++++++
 net/mac80211/ieee80211_sta.c |   77 +++++++++++++++++++++++++-----------------
 2 files changed, 75 insertions(+), 31 deletions(-)
include/net/mac80211.h +29 -0
index 2b1bffb..fbd7e31 100644
@@ -237,6 +237,33 @@ struct ieee80211_low_level_stats {
 	unsigned int dot11RTSSuccessCount;
 };
 
+/* next structs enable the mac80211 to send association notification
+ * to low-level driver, as well as data that may be changed through
+ * the lifetime of the BSS, after it was parsed to meaningful structs */
+struct ieee80211_erp_info {
+	u8 changes;
+	int cts_protection;
+	int preamble;
+};
+
+struct ieee80211_wmm_info {
+	int queue;
+	struct ieee80211_tx_queue_params *params;
+};
+
+#define ASSOC_CHNAGED_STATE     (1<<0)
+#define ASSOC_CHNAGED_AID       (1<<1)
+#define ASSOC_CHNAGED_ERP       (1<<2)
+#define ASSOC_CHNAGED_WMM       (1<<3)
+
+struct ieee80211_bss_data {
+	u8 changed_map; /* use ASSOC_CHNAGED_.. to indicate changed element */
+	u8 assoc; /* 0 not assoc, 1 assoc */
+	u16 aid;
+	struct ieee80211_erp_info erp_info;
+	struct ieee80211_wmm_info wmm_info;
+};
+
 /* Transmit control fields. This data structure is passed to low-level driver
  * with each TX frame. The low-level driver is responsible for configuring
  * the hardware to use given values (depending on what is supported). */
@@ -1021,6 +1048,8 @@ struct ieee80211_ops {
 	int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
 	int (*config_interface)(struct ieee80211_hw *hw,
 				int if_id, struct ieee80211_if_conf *conf);
+	void (*bss_info_changed)(struct ieee80211_hw *hw,
+				 struct ieee80211_bss_data *bss_data);
 	void (*configure_filter)(struct ieee80211_hw *hw,
 				 unsigned int changed_flags,
 				 unsigned int *total_flags,
net/mac80211/ieee80211_sta.c +46 -31

115 lines not on this page · raw message

Signature · 8 lines
1.5.2.4
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw

Note: this is a RFC patch not completed. Somehow I messed up the header Thanks for feedback.

Quoted 209 lines · Tomas Winkler

From: Ron Rindjunsky <[email protected]>

This patch gives a framework that will enable the mac80211 to inform to low level driver about association status changes + changes in bss status due to changes in BSS capabilities advertised by AP or in AP mode changes to be advertised and configured to.
This will also obsolete current ops for each BSS change such as erp or wmm. In legacy networks the B G coexistence is handled by ERP While in HT there are many more issues such as 20/40Mhz, GF etc. It will be counterproductive to implement handlers for each parameter it is simpler to consolidate all in one handler under common structure

1 - struct ieee80211_erp_info will be used to inform about erp changes. 2 - struct ieee80211_wmm_info will be used to inform about wmm changes 3 - struct ieee80211_bss_data will be used to transfer this data to low-level driver
4 - bss_info_changed will triger the change in low-level driver

---
 include/net/mac80211.h       |   29 ++++++++++++++++
 net/mac80211/ieee80211_sta.c |   77 +++++++++++++++++++++++++-----------------
 2 files changed, 75 insertions(+), 31 deletions(-)
include/net/mac80211.h +29 -0
index 2b1bffb..fbd7e31 100644
@@ -237,6 +237,33 @@ struct ieee80211_low_level_stats {
        unsigned int dot11RTSSuccessCount;
 };
 
+/* next structs enable the mac80211 to send association notification
+ * to low-level driver, as well as data that may be changed through
+ * the lifetime of the BSS, after it was parsed to meaningful structs */
+struct ieee80211_erp_info {
+       u8 changes;
+       int cts_protection;
+       int preamble;
+};
+
+struct ieee80211_wmm_info {
+       int queue;
+       struct ieee80211_tx_queue_params *params;
+};
+
+#define ASSOC_CHNAGED_STATE     (1<<0)
+#define ASSOC_CHNAGED_AID       (1<<1)
+#define ASSOC_CHNAGED_ERP       (1<<2)
+#define ASSOC_CHNAGED_WMM       (1<<3)
+
+struct ieee80211_bss_data {
+       u8 changed_map; /* use ASSOC_CHNAGED_.. to indicate changed element */
+       u8 assoc; /* 0 not assoc, 1 assoc */
+       u16 aid;
+       struct ieee80211_erp_info erp_info;
+       struct ieee80211_wmm_info wmm_info;
+};
+
 /* Transmit control fields. This data structure is passed to low-level driver
  * with each TX frame. The low-level driver is responsible for configuring
  * the hardware to use given values (depending on what is supported). */
@@ -1021,6 +1048,8 @@ struct ieee80211_ops {
        int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
        int (*config_interface)(struct ieee80211_hw *hw,
                                int if_id, struct ieee80211_if_conf *conf);
+       void (*bss_info_changed)(struct ieee80211_hw *hw,
+                                struct ieee80211_bss_data *bss_data);
        void (*configure_filter)(struct ieee80211_hw *hw,
                                 unsigned int changed_flags,
                                 unsigned int *total_flags,
net/mac80211/ieee80211_sta.c +46 -32
index 7c93f29..f38eb5a 100644
@@ -408,56 +408,66 @@ static void ieee80211_sta_send_associnfo(struct net_device *dev,
 
 static void ieee80211_set_associated(struct net_device *dev,
                                     struct ieee80211_if_sta *ifsta,
-                                    bool assoc)
+                                    struct ieee80211_bss_data *bss_data)
 {
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
        union iwreq_data wrqu;
 
-       if (!!(ifsta->flags & IEEE80211_STA_ASSOCIATED) == assoc)
+       if (!bss_data->changed_map)
                return;
 
-       if (assoc) {
-               struct ieee80211_sub_if_data *sdata;
-               struct ieee80211_sta_bss *bss;
+       if (bss_data->changed_map & ASSOC_CHNAGED_STATE) {
+               if (bss_data->assoc) {
+                       struct ieee80211_sub_if_data *sdata;
+                       struct ieee80211_sta_bss *bss;
 
-               ifsta->flags |= IEEE80211_STA_ASSOCIATED;
+                       ifsta->flags |= IEEE80211_STA_ASSOCIATED;
 
-               sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-               if (sdata->type != IEEE80211_IF_TYPE_STA)
-                       return;
+                       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+                       if (sdata->type != IEEE80211_IF_TYPE_STA)
+                               return;
 
-               bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
-               if (bss) {
-                       if (bss->has_erp_value)
-                               ieee80211_handle_erp_ie(dev, bss->erp_value);
-                       ieee80211_rx_bss_put(dev, bss);
-               }
+                       bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+                       if (bss) {
+                               if (bss->has_erp_value)
+                                 ieee80211_handle_erp_ie(dev, bss->erp_value);
+                               ieee80211_rx_bss_put(dev, bss);
+                       }
 
-               netif_carrier_on(dev);
-               ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
-               memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN);
-               memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN);
-               ieee80211_sta_send_associnfo(dev, ifsta);
-       } else {
-               ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
+                       netif_carrier_on(dev);
+                       ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
+                       memcpy(ifsta->prev_bssid,
+                               sdata->u.sta.bssid, ETH_ALEN);
+                       memcpy(wrqu.ap_addr.sa_data,
+                               sdata->u.sta.bssid, ETH_ALEN);
+                       ieee80211_sta_send_associnfo(dev, ifsta);
+               } else {
+                       ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
 
-               netif_carrier_off(dev);
-               ieee80211_reset_erp_info(dev);
-               memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
+                       netif_carrier_off(dev);
+                       ieee80211_reset_erp_info(dev);
+                       memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
+               }
+               wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+               wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
+               ifsta->last_probe = jiffies;
+               ieee80211_led_assoc(local, bss_data->assoc);
        }
-       wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-       wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
-       ifsta->last_probe = jiffies;
-       ieee80211_led_assoc(local, assoc);
+       if (local->ops->bss_info_changed)
+               local->ops->bss_info_changed(local_to_hw(local), bss_data);
 }
 
 static void ieee80211_set_disassoc(struct net_device *dev,
                                   struct ieee80211_if_sta *ifsta, int deauth)
 {
+       struct ieee80211_bss_data bss_data;
+
        if (deauth)
                ifsta->auth_tries = 0;
        ifsta->assoc_tries = 0;
-       ieee80211_set_associated(dev, ifsta, 0);
+       bss_data.assoc = 0;
+       bss_data.changed_map = ASSOC_CHNAGED_STATE;
+       ieee80211_set_associated(dev, ifsta, &bss_data);
 }
 
 static void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
@@ -1162,6 +1172,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
        u32 rates;
        u16 capab_info, status_code, aid;
        struct ieee802_11_elems elems;
+       struct ieee80211_bss_data bss_data;
        u8 *pos;
        int i, j;
 
@@ -1249,7 +1260,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
        if (ifsta->assocresp_ies)
                memcpy(ifsta->assocresp_ies, pos, ifsta->assocresp_ies_len);
 
-       ieee80211_set_associated(dev, ifsta, 1);
+       bss_data.assoc = 1;
+       bss_data.changed_map = ASSOC_CHNAGED_STATE;
+       bss_data.aid = aid;
+       bss_data.changed_map |= ASSOC_CHNAGED_AID;
+       ieee80211_set_associated(dev, ifsta, &bss_data);
 
        /* Add STA entry for the AP */
        sta = sta_info_get(local, ifsta->bssid);
--

1.5.2.4
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Tomas Winkler

include/net/mac80211.h struct ieee80211_low_level_stats { · line 258

Quoted 5 lines · On Wednesday 17 October 2007 19:51:46 you wrote:
include/net/mac80211.h +5 -0
+#define ASSOC_CHNAGED_STATE     (1<<0)
+#define ASSOC_CHNAGED_AID       (1<<1)
+#define ASSOC_CHNAGED_ERP       (1<<2)
+#define ASSOC_CHNAGED_WMM       (1<<3)
+

s/CHNAGED/CHANGED/

net/mac80211/ieee80211_sta.c static void ieee80211_sta_send_associnfo(struct net_device *dev, · line 454

Quoted 4 lines
net/mac80211/ieee80211_sta.c +4 -0
+		wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+		wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
+		ifsta->last_probe = jiffies;
+		ieee80211_led_assoc(local, bss_data->assoc);

The SIOCGIOAP event should happen on both association and disassociation, not just association.

-Michael Wu

#3 lore raw

Both remarks true, thanks

-----Original Message-----
From: Michael Wu [mailto:[email protected]]
Sent: Thursday, October 18, 2007 3:39 AM
To: Winkler, Tomas
Cc: [email protected]; [email protected]; [email protected]; Rindjunsky, Ron
Subject: Re: [PATCH 1/1] mac80211: adding bss_config to low driver ops

include/net/mac80211.h struct ieee80211_low_level_stats { · line 258

Quoted 5 lines · On Wednesday 17 October 2007 19:51:46 you wrote:
include/net/mac80211.h +5 -0
+#define ASSOC_CHNAGED_STATE     (1<<0)
+#define ASSOC_CHNAGED_AID       (1<<1)
+#define ASSOC_CHNAGED_ERP       (1<<2)
+#define ASSOC_CHNAGED_WMM       (1<<3)
+

s/CHNAGED/CHANGED/

net/mac80211/ieee80211_sta.c static void ieee80211_sta_send_associnfo(struct net_device *dev, · line 454

Quoted 4 lines
net/mac80211/ieee80211_sta.c +4 -0
+		wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+		wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
+		ifsta->last_probe = jiffies;
+		ieee80211_led_assoc(local, bss_data->assoc);

The SIOCGIOAP event should happen on both association and disassociation, not
just association.

-Michael Wu
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

maintainer
#4 lore raw
In reply to Tomas Winkler

include/net/mac80211.h struct ieee80211_low_level_stats { · line 252

Quoted 13 lines · Tomas Winkler
include/net/mac80211.h +13 -0
+/* next structs enable the mac80211 to send association notification
+ * to low-level driver, as well as data that may be changed through
+ * the lifetime of the BSS, after it was parsed to meaningful structs */
+struct ieee80211_erp_info {
+	u8 changes;
+	int cts_protection;
+	int preamble;
+};
+
+struct ieee80211_wmm_info {
+	int queue;
+	struct ieee80211_tx_queue_params *params;
+};

Please do kernel-doc style comments for both structures so I can incorporate this information easily into the mac80211 book. Also, some general guidelines in a DOC comment would be appreciated, like

/**
* DOC: BSS Status changes
*
* Describe what is expected of driver here
*/

include/net/mac80211.h struct ieee80211_low_level_stats { · line 265

Quoted 7 lines
include/net/mac80211.h +7 -0
+struct ieee80211_bss_data {
+	u8 changed_map; /* use ASSOC_CHNAGED_.. to indicate changed element */
+	u8 assoc; /* 0 not assoc, 1 assoc */
+	u16 aid;
+	struct ieee80211_erp_info erp_info;
+	struct ieee80211_wmm_info wmm_info;
+};

Again, kernel-doc; also why do we actually need the sub-structuring into erp_info and wmm_info (and if you manage convince me that we do :), can we please call them just 'erp' and 'wmm' to save typing)?

This seems pretty ad-hoc to me. I think it'd be better to have them all in one structure and use just a single 'changed' parameter instead of having an extra one in the erp info. I would also use a 'flags' parameter instead of 'assoc' and then roll CTS protect and short preamble into those flags.

Also, the ASSOC_CHANGED_* flags should be renamed to BSS_STATE_CHANGED_* or so, they don't really affect just the association.

Hmm. And here's a thought: don't we need all this information within mac80211 as well? Would it maybe make sense to embed it into the sta sdata structure and have the 'changed_map' not be in the structure but as a second parameter to the callback function? Then we could always use a pointer to the embedded structure that keeps track of this information and build the changed value dynamically. This saves having to initialise the structure all the time when calling the function and makes sure that even the unchanged parameters are always valid should the driver need them. [also see at the very end of this mail]

include/net/mac80211.h struct ieee80211_ops { · line 1052

Quoted 6 lines
include/net/mac80211.h +2 -0
@@ -1021,6 +1048,8 @@ struct ieee80211_ops {
 	int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
 	int (*config_interface)(struct ieee80211_hw *hw,
 				int if_id, struct ieee80211_if_conf *conf);
+	void (*bss_info_changed)(struct ieee80211_hw *hw,
+				 struct ieee80211_bss_data *bss_data);

Missing doc updates, but see above. I'd prefer the docs in this struct to just be a short note what the handler is and what the context is when it is invoked (like "must be atomic" or "runs under XY lock") and then for more details we refer to a DOC: section as I said above. That makes it much easier to collate it into the mac80211 book.

Quoted 7 lines
net/mac80211/ieee80211_sta.c +0 -0
index 7c93f29..f38eb5a 100644
@@ -408,56 +408,66 @@ static void ieee80211_sta_send_associnfo(struct net_device *dev,
 
 static void ieee80211_set_associated(struct net_device *dev,

net/mac80211/ieee80211_sta.c static void ieee80211_sta_send_associnfo(struct net_device *dev, · line 417

Quoted 10 lines
net/mac80211/ieee80211_sta.c +2 -2
 				     struct ieee80211_if_sta *ifsta,
-				     bool assoc)
+				     struct ieee80211_bss_data *bss_data)
 {
 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
 	union iwreq_data wrqu;
 
-	if (!!(ifsta->flags & IEEE80211_STA_ASSOCIATED) == assoc)
+	if (!bss_data->changed_map)
 		return;

If we did the embedding thing then all this would probably be simpler, we could keep the 'bool assoc' parameter and have this function update the [read on after the quote]

net/mac80211/ieee80211_sta.c static void ieee80211_sta_send_associnfo(struct net_device *dev, · line 424

Quoted 10 lines
net/mac80211/ieee80211_sta.c +5 -4
-	if (assoc) {
-		struct ieee80211_sub_if_data *sdata;
-		struct ieee80211_sta_bss *bss;
+	if (bss_data->changed_map & ASSOC_CHNAGED_STATE) {
+		if (bss_data->assoc) {
+			struct ieee80211_sub_if_data *sdata;
+			struct ieee80211_sta_bss *bss;
 
-		ifsta->flags |= IEEE80211_STA_ASSOCIATED;
+			ifsta->flags |= IEEE80211_STA_ASSOCIATED;

flag within the embedded struct instead of having another flag that keeps track of the same information.

net/mac80211/ieee80211_sta.c static void ieee80211_sta_send_associnfo(struct net_device *dev, · line 433

Quoted 10 lines
net/mac80211/ieee80211_sta.c +4 -6
-		bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
-		if (bss) {
-			if (bss->has_erp_value)
-				ieee80211_handle_erp_ie(dev, bss->erp_value);
-			ieee80211_rx_bss_put(dev, bss);
-		}
+			bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+			if (bss) {
+				if (bss->has_erp_value)
+				  ieee80211_handle_erp_ie(dev, bss->erp_value);

[bad indenting]

Quoted 10 lines
net/mac80211/ieee80211_sta.c +1 -0
 static void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
@@ -1162,6 +1172,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
 	u32 rates;
 	u16 capab_info, status_code, aid;
 	struct ieee802_11_elems elems;
+	struct ieee80211_bss_data bss_data;
 	u8 *pos;
 	int i, j;
 

net/mac80211/ieee80211_sta.c static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, · line 1267

Quoted 9 lines
net/mac80211/ieee80211_sta.c +5 -1
@@ -1249,7 +1260,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
 	if (ifsta->assocresp_ies)
 		memcpy(ifsta->assocresp_ies, pos, ifsta->assocresp_ies_len);
 
-	ieee80211_set_associated(dev, ifsta, 1);
+	bss_data.assoc = 1;
+	bss_data.changed_map = ASSOC_CHNAGED_STATE;
+	bss_data.aid = aid;
+	bss_data.changed_map |= ASSOC_CHNAGED_AID;
+	ieee80211_set_associated(dev, ifsta, &bss_data);

I think this is a bit dangerous. Above, you defined the structure member 'changed_map' which I personally would read as "take care, in this structure the fields X, Y and Z changed over what I gave you last time". However, the way it's used here is as a 'valid' bitmap, in "In this struct, only the fields X, Y and Z are valid". This is a huge difference if the driver happens to need multiple things at the same time, with the approach you're doing here you'd need to keep track of everything in the driver.

johannes

#5 lore raw
Quoted 20 lines · Johannes Berg

include/net/mac80211.h struct ieee80211_low_level_stats { · line 252

Quoted 13 lines · Tomas Winkler
include/net/mac80211.h +13 -0
+/* next structs enable the mac80211 to send association notification
+ * to low-level driver, as well as data that may be changed through
+ * the lifetime of the BSS, after it was parsed to meaningful structs */
+struct ieee80211_erp_info {
+     u8 changes;
+     int cts_protection;
+     int preamble;
+};
+
+struct ieee80211_wmm_info {
+     int queue;
+     struct ieee80211_tx_queue_params *params;
+};

Please do kernel-doc style comments for both structures so I can incorporate this information easily into the mac80211 book. Also, some general guidelines in a DOC comment would be appreciated, like

Quoted 6 lines

/**
* DOC: BSS Status changes
*
* Describe what is expected of driver here
*/

We'll do

Quoted 12 lines

include/net/mac80211.h struct ieee80211_low_level_stats { · line 265

Quoted 7 lines
include/net/mac80211.h +7 -0
+struct ieee80211_bss_data {
+     u8 changed_map; /* use ASSOC_CHNAGED_.. to indicate changed element */
+     u8 assoc; /* 0 not assoc, 1 assoc */
+     u16 aid;
+     struct ieee80211_erp_info erp_info;
+     struct ieee80211_wmm_info wmm_info;
+};

Again, kernel-doc; also why do we actually need the sub-structuring into erp_info and wmm_info (and if you manage convince me that we do :), can we please call them just 'erp' and 'wmm' to save typing)?

This was just to not break all the drivers but you are right these structures won't be needed

Quoted 6 lines

This seems pretty ad-hoc to me. I think it'd be better to have them all in one structure and use just a single 'changed' parameter instead of having an extra one in the erp info. I would also use a 'flags' parameter instead of 'assoc' and then roll CTS protect and short preamble into those flags.

The bits in flags are possible just sometimes you need to pass a value such as assoc id
or queue num so it will be a little mess.

Quoted 3 lines

Also, the ASSOC_CHANGED_* flags should be renamed to BSS_STATE_CHANGED_* or so, they don't really affect just the association.

Fair enough

Quoted 10 lines

Hmm. And here's a thought: don't we need all this information within mac80211 as well? Would it maybe make sense to embed it into the sta sdata structure and have the 'changed_map' not be in the structure but as a second parameter to the callback function? Then we could always use a pointer to the embedded structure that keeps track of this information and build the changed value dynamically. This saves having to initialise the structure all the time when calling the function and makes sure that even the unchanged parameters are always valid should the driver need them. [also see at the very end of this mail]

Sounds good

Quoted 75 lines

include/net/mac80211.h struct ieee80211_ops { · line 1052

Quoted 6 lines
include/net/mac80211.h +2 -0
@@ -1021,6 +1048,8 @@ struct ieee80211_ops {
      int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
      int (*config_interface)(struct ieee80211_hw *hw,
                              int if_id, struct ieee80211_if_conf *conf);
+     void (*bss_info_changed)(struct ieee80211_hw *hw,
+                              struct ieee80211_bss_data *bss_data);

Missing doc updates, but see above. I'd prefer the docs in this struct to just be a short note what the handler is and what the context is when it is invoked (like "must be atomic" or "runs under XY lock") and then for more details we refer to a DOC: section as I said above. That makes it much easier to collate it into the mac80211 book.

Quoted 7 lines
net/mac80211/ieee80211_sta.c +0 -0
index 7c93f29..f38eb5a 100644
@@ -408,56 +408,66 @@ static void ieee80211_sta_send_associnfo(struct net_device *dev,
 
 static void ieee80211_set_associated(struct net_device *dev,

net/mac80211/ieee80211_sta.c static void ieee80211_sta_send_associnfo(struct net_device *dev, · line 417

Quoted 10 lines
net/mac80211/ieee80211_sta.c +2 -2
                                   struct ieee80211_if_sta *ifsta,
-                                  bool assoc)
+                                  struct ieee80211_bss_data *bss_data)
 {
      struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
      union iwreq_data wrqu;
 
-     if (!!(ifsta->flags & IEEE80211_STA_ASSOCIATED) == assoc)
+     if (!bss_data->changed_map)
              return;

If we did the embedding thing then all this would probably be simpler, we could keep the 'bool assoc' parameter and have this function update the [read on after the quote]

net/mac80211/ieee80211_sta.c static void ieee80211_sta_send_associnfo(struct net_device *dev, · line 424

Quoted 10 lines
net/mac80211/ieee80211_sta.c +5 -4
-     if (assoc) {
-             struct ieee80211_sub_if_data *sdata;
-             struct ieee80211_sta_bss *bss;
+     if (bss_data->changed_map & ASSOC_CHNAGED_STATE) {
+             if (bss_data->assoc) {
+                     struct ieee80211_sub_if_data *sdata;
+                     struct ieee80211_sta_bss *bss;
 
-             ifsta->flags |= IEEE80211_STA_ASSOCIATED;
+                     ifsta->flags |= IEEE80211_STA_ASSOCIATED;

flag within the embedded struct instead of having another flag that keeps track of the same information.

net/mac80211/ieee80211_sta.c static void ieee80211_sta_send_associnfo(struct net_device *dev, · line 433

Quoted 10 lines
net/mac80211/ieee80211_sta.c +4 -6
-             bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
-             if (bss) {
-                     if (bss->has_erp_value)
-                             ieee80211_handle_erp_ie(dev, bss->erp_value);
-                     ieee80211_rx_bss_put(dev, bss);
-             }
+                     bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+                     if (bss) {
+                             if (bss->has_erp_value)
+                               ieee80211_handle_erp_ie(dev, bss->erp_value);

[bad indenting]

Quoted 13 lines
net/mac80211/ieee80211_sta.c +1 -0
 static void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
@@ -1162,6 +1172,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
      u32 rates;
      u16 capab_info, status_code, aid;
      struct ieee802_11_elems elems;
+     struct ieee80211_bss_data bss_data;
      u8 *pos;
      int i, j;
 
@@ -1249,7 +1260,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
      if (ifsta->assocresp_ies)
              memcpy(ifsta->assocresp_ies, pos, ifsta->assocresp_ies_len);
 
Quoted 16 lines

net/mac80211/ieee80211_sta.c static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, · line 1267

Quoted 6 lines
net/mac80211/ieee80211_sta.c +5 -1
-     ieee80211_set_associated(dev, ifsta, 1);
+     bss_data.assoc = 1;
+     bss_data.changed_map = ASSOC_CHNAGED_STATE;
+     bss_data.aid = aid;
+     bss_data.changed_map |= ASSOC_CHNAGED_AID;
+     ieee80211_set_associated(dev, ifsta, &bss_data);

I think this is a bit dangerous. Above, you defined the structure member 'changed_map' which I personally would read as "take care, in this structure the fields X, Y and Z changed over what I gave you last time". However, the way it's used here is as a 'valid' bitmap, in "In this struct, only the fields X, Y and Z are valid". This is a huge difference if the driver happens to need multiple things at the same time, with the approach you're doing here you'd need to keep track of everything in the driver.

Yes we can have both valid and change bitmap to lower that burden from form driver.

Thanks for your valuable comments

Quoted 3 lines

johannes

maintainer
#6 lore raw
Quoted 8 lines · Tomas Winkler
Quoted 6 lines

/**
* DOC: BSS Status changes
*
* Describe what is expected of driver here
*/

We'll do

Thanks. One of these days I'll get all the kernel-doc stuff sorted out and actually post the mac80211 book for inclusion.

Quoted 9 lines
Quoted 6 lines

This seems pretty ad-hoc to me. I think it'd be better to have them all in one structure and use just a single 'changed' parameter instead of having an extra one in the erp info. I would also use a 'flags' parameter instead of 'assoc' and then roll CTS protect and short preamble into those flags.

The bits in flags are possible just sometimes you need to pass a value such as assoc id
or queue num so it will be a little mess.

Oh right. I guess we need good docs as to which "changed" flag implies which fields have actually changed since things like "assocation status changed" implies that the AID is new *and* the "associated" flag is changed too. On the other hand, maybe we should aim for some redundancy and have a changed flag for each struct member and each flag?

Hmm. Thinking about this a bit more, the AID can actually change when the association status didn't change, in the case where we associated to another AP. Though we actually tell the driver that we disassociated first, right? That makes me think we should maybe also make the BSSID part of this call structure instead of having it in if_conf. Hmm.

Quoted 2 lines

Yes we can have both valid and change bitmap to lower that burden from form driver.

Note that embedding the info might be a lot of work. Then again it might just be some code shuffling and simplification. I haven't looked at it, from the stuff I see here I just think it'd be worth it. Your tradeoffs are probably different than mine though and in either case such a callback is an improvement over current behaviour.

johannes

maintainer
#7 lore raw
In reply to Tomas Winkler
Quoted 11 lines · Tomas Winkler
Quoted 9 lines

I think this is a bit dangerous. Above, you defined the structure member 'changed_map' which I personally would read as "take care, in this structure the fields X, Y and Z changed over what I gave you last time". However, the way it's used here is as a 'valid' bitmap, in "In this struct, only the fields X, Y and Z are valid". This is a huge difference if the driver happens to need multiple things at the same time, with the approach you're doing here you'd need to keep track of everything in the driver.

Yes we can have both valid and change bitmap to lower that burden from form driver.

Oh I just realised that I didn't read this closely enough. If you actually keep this structure around then we don't need a 'valid' bitmap at all because all info will be valid all the time. If possible, I think that would be much preferable, but I haven't really given much thought to how complex it would be to implement.

johannes

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#9 lore raw
Quoted 9 lines · Ron Rindzonski

I can see that this structure can be a powerful way to convey association data internaly inside mac80211,
and we will examine this possibility, but our initial primary purpose is not to replace existing data exchange
inside mac80211, but rather to unite data exchange with low level driver concerning changing BSS parameters
such as association state,erp,wmm (and HT in near future), all may vary during BSS lifespan, yet all have their
own ops right now, which complicates tracking them.

Yes, I understand, my main concern with building the structure on the fly as you've been doing is that drivers are handed a data structure that is only partially valid which might lead to confusion. That said, I do understand that it would be significantly more work to make mac80211 use the same structure internally, so if you're unable to do that work somebody else will have to pick it up at some point.

Quoted 2 lines

I will send you another RFC in this spirit, with your remarks from this thread.

Thanks,
johannes

maintainer
#10 lore raw
In reply to Johannes Berg
Quoted 9 lines · Johannes Berg

Hmm. And here's a thought: don't we need all this information within mac80211 as well? Would it maybe make sense to embed it into the sta sdata structure and have the 'changed_map' not be in the structure but as a second parameter to the callback function? Then we could always use a pointer to the embedded structure that keeps track of this information and build the changed value dynamically. This saves having to initialise the structure all the time when calling the function and makes sure that even the unchanged parameters are always valid should the driver need them. [also see at the very end of this mail]

Re-reading my own mail :)

Don't we need an if_id parameter to the callback so if the driver supports multiple virtual STA interfaces it can make an effort to support the settings of both BSSes? I'd be tempted to do it in mac80211 but I guess that different MAC designs have different levels of configurability when multiple addresses are programmed so it seems the only sane place to do it would be the driver since mac80211 cannot know which settings are only supported once and where different settings can be supported by the MAC.

johannes