Skip to contentSkip to conversation

mac80211: add sta_notify callback

PATCH Superseded Tomas Winkler 4 participants 14 messages Sep 17, 2007 – Sep 26, 2007 mac80211

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: add sta_notify callback

This patch adds sta_notify callback and removes sta_table_notification which was not used by any driver This patch helps drivers such as iwlwifi that keeps notion of station internaly about removal and addition of station or AP to BSS.

Currently iwlwifi have to parse internaly management frames to get this information.

---
 include/net/mac80211.h  |   18 ++++++++++++++++--
 net/mac80211/sta_info.c |   13 ++++++-------
 2 files changed, 22 insertions(+), 9 deletions(-)
include/net/mac80211.h +16 -2
index a2c14f9..f762a95 100644
@@ -497,6 +497,20 @@ typedef enum set_key_cmd {
 } set_key_cmd;
 
 /**
+ * enum sta_notify_cmd - sta notify command
+ *
+ * Used with the sta_notify() callback in &struct ieee80211_ops, this
+ * indicates whether a sta is being removed or added
+ *
+ * @STA_NOTIFY_ADD: a station is added
+ * @STA_NOTIFY_REMOVE: a  station is removed
+ */
+typedef enum sta_notify_cmd {
+	STA_NOTIFY_ADD, STA_NOTIFY_REMOVE
+} sta_notify_cmd;
+
+
+/**
  * struct ieee80211_hw - hardware information and state
  * TODO: move documentation into kernel-doc format
  */
@@ -748,8 +762,8 @@ struct ieee80211_ops {
 
 	/* Number of STAs in STA table notification (NULL = disabled).
 	 * Must be atomic. */
-	void (*sta_table_notification)(struct ieee80211_hw *hw,
-				       int num_sta);
+	void (*sta_notify)(struct ieee80211_hw *hw,
+				sta_notify_cmd cmd, const u8 *addr);
 
 	/* Handle ERP IE change notifications. Must be atomic. */
 	void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes,
net/mac80211/sta_info.c +6 -7
index c17172a..892e0d5 100644
@@ -158,9 +158,9 @@ struct sta_info * sta_info_add(struct ieee80211_local *local,
 	list_add(&sta->list, &local->sta_list);
 	local->num_sta++;
 	sta_info_hash_add(local, sta);
-	if (local->ops->sta_table_notification)
-		local->ops->sta_table_notification(local_to_hw(local),
-						  local->num_sta);
+	if (local->ops->sta_notify)
+		local->ops->sta_notify(local_to_hw(local),
+					STA_NOTIFY_ADD, addr);
 	write_unlock_bh(&local->sta_lock);
 
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
@@ -197,10 +197,6 @@ void sta_info_remove(struct sta_info *sta)
 	}
 	local->num_sta--;
 	sta_info_remove_aid_ptr(sta);
-
-	if (local->ops->sta_table_notification)
-		local->ops->sta_table_notification(local_to_hw(local),
-						   local->num_sta);
 }
 
 void sta_info_free(struct sta_info *sta)
@@ -230,6 +226,9 @@ void sta_info_free(struct sta_info *sta)
 	ieee80211_key_free(sta->key);
 	sta->key = NULL;
 
+	if (local->ops->sta_notify)
+		local->ops->sta_notify(local_to_hw(local),
+					STA_NOTIFY_ADD, sta->addr);
 	rate_control_remove_sta_debugfs(sta);
 	ieee80211_sta_debugfs_remove(sta);
 
Signature · 8 lines
1.5.2.2
---------------------------------------------------------------------
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
#1 lore raw

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

Quoted 2 lines · Tomas Winkler
include/net/mac80211.h +2 -0
+	void (*sta_notify)(struct ieee80211_hw *hw,
+				sta_notify_cmd cmd, const u8 *addr);

I have plans to make the sta_info structs per-netdev so that we can support having the same station associate to multiple virtual APs and not hurting WDS links etc. This is not too hard, but needs some thought.

However, for this callback to be correct when the same sta_info struct can be present for multiple virtual interfaces, we need to be able to distinguish somehow, so this callback should probably get an if_idx that allows a driver to map to the right interface because in add_interface it was given the same if_idx.

I know this doesn't matter for iwlwifi because it only supports a single local MAC address and currently not even WDS/AP mode at the same time (nor AP mode at all? haven't checked). And I wonder if there will ever be any hardware that cares and supports the configuration that would require it. Should we just leave it and add a comment that when the driver supports multiple interfaces this callback is unusable?

Thoughts? Do you have plans to, say, support combined WDS/AP modes? If so, would the firmware be able to distinguish between the same STA sending WDS frames and trying to associate? I don't know if any current software supports that but I see nothing precluding it either. Or say you have a WDS interface and also associate with a client interface to the same AP; we could easily do that with b43 by allowing WDS interfaces with the same MAC address in parallel all the time.

johannes

#2 lore raw
Quoted 15 lines · Johannes Berg

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

Quoted 2 lines · Tomas Winkler
include/net/mac80211.h +2 -0
+     void (*sta_notify)(struct ieee80211_hw *hw,
+                             sta_notify_cmd cmd, const u8 *addr);

I have plans to make the sta_info structs per-netdev so that we can support having the same station associate to multiple virtual APs and not hurting WDS links etc. This is not too hard, but needs some thought.

However, for this callback to be correct when the same sta_info struct can be present for multiple virtual interfaces, we need to be able to distinguish somehow, so this callback should probably get an if_idx that allows a driver to map to the right interface because in add_interface it was given the same if_idx.

Quoted 3 lines

I know this doesn't matter for iwlwifi because it only supports a single local MAC address and currently not even WDS/AP mode at the same time (nor AP mode at all? haven't checked).

Actually I'm interested in this feature 4965AGN HW supports multiple MAC addresses.
Need to enabled it also in the driver but this is few month away till I get there.

Quoted 1 line

And I wonder if there will ever

AP mode is functional yet not the whole code is published I want to roll it in slowly and I need the patch I sent for it.
The legacy AP mode (not 11n) should be functional even on the current code base.

Quoted 3 lines

be any hardware that cares and supports the configuration that would require it Should we just leave it and add a comment that when the driver supports multiple interfaces this callback is unusable?

It

Quoted 1 line

Thoughts? Do you have plans to, say, support combined WDS/AP modes?

Yes
If

Quoted 2 lines

so, would the firmware be able to distinguish between the same STA sending WDS frames and trying to associate?

Yes it will

I don't know if any current

Quoted 8 lines

software supports that but I see nothing precluding it either. Or say you have a WDS interface and also associate with a client interface to the same AP; we could easily do that with b43 by allowing WDS interfaces with the same MAC address in parallel all the time.

johannes

maintainer
#3 lore raw
Quoted 7 lines · Tomas Winkler

Actually I'm interested in this feature 4965AGN HW supports multiple MAC addresses.

Quoted 2 lines

so, would the firmware be able to distinguish between the same STA sending WDS frames and trying to associate?

Yes it will

So that means you should add the if_id to the sta callback, no?

johannes

#4 lore raw
Quoted 5 lines · Johannes Berg
Quoted 2 lines · Tomas Winkler

Actually I'm interested in this feature 4965AGN HW supports multiple MAC addresses.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

so, would the firmware be able to distinguish between the same STA sending WDS frames and trying to associate?

Yes it will

So that means you should add the if_id to the sta callback, no?

Yes, yet I'm not sure I want to deal with it right now. I have no use for it currently
I will add it in next stage there are no objections. I don't think I'm breaking anything right now.

Quoted 3 lines

johannes

maintainer
#5 lore raw
Quoted 1 line · Tomas Winkler

Yes, yet I'm not sure I want to deal with it right now.

Well, my patch making sta_info be per-if isn't ready yet either. However, once I finish that patch I'll have to touch this callback to be correct, and then I will need to fix iwlwifi for using it which is not really nice. Hence, I would very much prefer if this callback was correctly defined in the first place and the driver simply ignored the extra information it currently doesn't need.

johannes

#6 lore raw
Quoted 11 lines · Johannes Berg
Quoted 1 line · Tomas Winkler

Yes, yet I'm not sure I want to deal with it right now.

Well, my patch making sta_info be per-if isn't ready yet either. However, once I finish that patch I'll have to touch this callback to be correct, and then I will need to fix iwlwifi for using it which is not really nice. Hence, I would very much prefer if this callback was correctly defined in the first place and the driver simply ignored the extra information it currently doesn't need.

I will do this favor for you :) I will prepare another patch. Tomas

Quoted 3 lines

johannes

#8 lore raw
Quoted 4 lines · Johannes Berg
Quoted 1 line · Tomas Winkler

I will do this favor for you :) I will prepare another patch.

Quoted 9 lines

Thanks :)

You should probably base it against Michael's tree though:
http://git.kernel.org/?p=linux/kernel/git/mwu/mac80211-misc.git;a=summary
which basically consists of all the patches I had that we agreed on should go in.

Oh and please also update the comment describing the callback.

I cannot clone the tree it gives me an error about wrong blob. I cannot even get snapshot from gitweb.
Thanks
Tomas

#9 lore raw
Quoted 12 lines · Tomas Winkler
Quoted 11 lines · Johannes Berg
Quoted 1 line · Tomas Winkler

I will do this favor for you :) I will prepare another patch.

Thanks :)

You should probably base it against Michael's tree though:
http://git.kernel.org/?p=linux/kernel/git/mwu/mac80211-misc.git;a=summary
which basically consists of all the patches I had that we agreed on should go in.

Quoted 4 lines
Quoted 2 lines

Oh and please also update the comment describing the callback.

I cannot clone the tree it gives me an error about wrong blob. I cannot even get snapshot from gitweb.

cg-clone http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Initialized empty Git repository in .git/
Fetching head...
Fetching objects...
Getting alternates list for
http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Also look at http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.24.git/
Getting pack list for
http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Getting index for pack 91b13e9181bb0f55aac736e33abdec5c2be3303f Getting index for pack a4dceed182e0ade8737e9c62ac789e58aa6f7655 Getting pack 91b13e9181bb0f55aac736e33abdec5c2be3303f
which contains 4cceb887147261d7fd9fe7ce3b6d6f236c8300bc
Getting pack list for
http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.24.git/
error: Unable to find 27c3e839b54e9d81eb32a6cb7f28a1e71c05b8ef under
http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Cannot obtain needed blob 27c3e839b54e9d81eb32a6cb7f28a1e71c05b8ef while processing commit 38e405f56478021531ad9eda5291474fe6d120d5.
progress: 0 objects, 12873698 bytes
cg-fetch: objects fetch failed

Quoted 3 lines

Thanks
Tomas

#10 lore raw
Quoted 32 lines · Tomas Winkler
Quoted 12 lines · Tomas Winkler
Quoted 11 lines · Johannes Berg
Quoted 1 line · Tomas Winkler

I will do this favor for you :) I will prepare another patch.

Thanks :)

You should probably base it against Michael's tree though:
http://git.kernel.org/?p=linux/kernel/git/mwu/mac80211-misc.git;a=summary
which basically consists of all the patches I had that we agreed on should go in.

Quoted 4 lines
Quoted 2 lines

Oh and please also update the comment describing the callback.

I cannot clone the tree it gives me an error about wrong blob. I cannot even get snapshot from gitweb.

cg-clone http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Initialized empty Git repository in .git/
Fetching head...
Fetching objects...
Getting alternates list for
http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Also look at http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.24.git/
Getting pack list for
http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Getting index for pack 91b13e9181bb0f55aac736e33abdec5c2be3303f Getting index for pack a4dceed182e0ade8737e9c62ac789e58aa6f7655 Getting pack 91b13e9181bb0f55aac736e33abdec5c2be3303f
which contains 4cceb887147261d7fd9fe7ce3b6d6f236c8300bc

Quoted 9 lines

Getting pack list for
http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.24.git/
error: Unable to find 27c3e839b54e9d81eb32a6cb7f28a1e71c05b8ef under
http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Cannot obtain needed blob 27c3e839b54e9d81eb32a6cb7f28a1e71c05b8ef while processing commit 38e405f56478021531ad9eda5291474fe6d120d5.
progress: 0 objects, 12873698 bytes
cg-fetch: objects fetch failed

git:// works fine but I need http because of the firewall.

Quoted 4 lines
Quoted 3 lines

Thanks
Tomas

#11 lore raw

from an *up to date* wireless-dev tree I appear to be able to fetch the mwu/mac80211-misc.git

git remote add mwu http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc
git fetch mwu
git checkout mwu/master

This might work for you. I'm not a git master either though.

ian

Quoted 51 lines · Tomas Winkler
Quoted 30 lines · Tomas Winkler
Quoted 11 lines · Tomas Winkler
Quoted 10 lines · Johannes Berg
Quoted 1 line · Tomas Winkler

I will do this favor for you :) I will prepare another patch.

Thanks :)

You should probably base it against Michael's tree though:
http://git.kernel.org/?p=linux/kernel/git/mwu/mac80211-misc.git;a=summary
which basically consists of all the patches I had that we agreed on should go in.

Quoted 4 lines
Quoted 2 lines

Oh and please also update the comment describing the callback.

I cannot clone the tree it gives me an error about wrong blob. I cannot even get snapshot from gitweb.

cg-clone http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Initialized empty Git repository in .git/
Fetching head...
Fetching objects...
Getting alternates list for
http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Also look at http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.24.git/
Getting pack list for
http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Getting index for pack 91b13e9181bb0f55aac736e33abdec5c2be3303f Getting index for pack a4dceed182e0ade8737e9c62ac789e58aa6f7655 Getting pack 91b13e9181bb0f55aac736e33abdec5c2be3303f
which contains 4cceb887147261d7fd9fe7ce3b6d6f236c8300bc

Quoted 9 lines

Getting pack list for
http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.24.git/
error: Unable to find 27c3e839b54e9d81eb32a6cb7f28a1e71c05b8ef under
http://www.kernel.org/pub/scm/linux/kernel/git/mwu/mac80211-misc.git
Cannot obtain needed blob 27c3e839b54e9d81eb32a6cb7f28a1e71c05b8ef while processing commit 38e405f56478021531ad9eda5291474fe6d120d5.
progress: 0 objects, 12873698 bytes
cg-fetch: objects fetch failed

git:// works fine but I need http because of the firewall.

Quoted 3 lines
Quoted 3 lines

Thanks
Tomas

-
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

maintainer
#12 lore raw
In reply to Tomas Winkler
Quoted 1 line · Tomas Winkler

git:// works fine but I need http because of the firewall.

Michael: poke: you need to run git-http-update or whatever it's called from the commit hook.

johannes

#13 lore raw
Quoted 7 lines · Johannes Berg
Quoted 1 line · Tomas Winkler

git:// works fine but I need http because of the firewall.

Michael: poke: you need to run git-http-update or whatever it's called from the commit hook.

Actually the problem is in net-2.6.24.git which mac80211-misc references Dave?

Thanks
Tomas

Quoted 2 lines