* [PATCH] mac80211: Adds clean sdata helper
@ 2012-04-24 11:18 Andrei Emeltchenko
2012-05-03 19:01 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Andrei Emeltchenko @ 2012-04-24 11:18 UTC (permalink / raw)
To: linux-wireless
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Adds hepler to clean sdata ieee80211_clean_sdata similar way as
ieee80211_setup_sdata is implemented. The function will be used by other
interfaces later.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/mac80211/iface.c | 19 +++++++++++++++----
net/mac80211/mesh.h | 4 +++-
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 401c01f..96f8773 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -907,6 +907,18 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
ieee80211_debugfs_add_netdev(sdata);
}
+static void ieee80211_clean_sdata(struct ieee80211_sub_if_data *sdata)
+{
+ switch (sdata->vif.type) {
+ case NL80211_IFTYPE_MESH_POINT:
+ mesh_path_flush_by_iface(sdata);
+ break;
+
+ default:
+ break;
+ }
+}
+
static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
enum nl80211_iftype type)
{
@@ -1227,8 +1239,8 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata)
list_del_rcu(&sdata->list);
mutex_unlock(&sdata->local->iflist_mtx);
- if (ieee80211_vif_is_mesh(&sdata->vif))
- mesh_path_flush_by_iface(sdata);
+ /* clean up type-dependent data */
+ ieee80211_clean_sdata(sdata);
synchronize_rcu();
unregister_netdevice(sdata->dev);
@@ -1249,8 +1261,7 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
list_del(&sdata->list);
- if (ieee80211_vif_is_mesh(&sdata->vif))
- mesh_path_flush_by_iface(sdata);
+ ieee80211_clean_sdata(sdata);
unregister_netdevice_queue(sdata->dev, &unreg_list);
}
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 8d53b71..5b4f670 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -284,7 +284,6 @@ void mesh_pathtbl_unregister(void);
int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata);
void mesh_path_timer(unsigned long data);
void mesh_path_flush_by_nexthop(struct sta_info *sta);
-void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
void mesh_path_discard_frame(struct sk_buff *skb,
struct ieee80211_sub_if_data *sdata);
void mesh_path_quiesce(struct ieee80211_sub_if_data *sdata);
@@ -325,6 +324,7 @@ void ieee80211_mesh_quiesce(struct ieee80211_sub_if_data *sdata);
void ieee80211_mesh_restart(struct ieee80211_sub_if_data *sdata);
void mesh_plink_quiesce(struct sta_info *sta);
void mesh_plink_restart(struct sta_info *sta);
+void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
#else
#define mesh_allocated 0
static inline void
@@ -337,6 +337,8 @@ static inline void mesh_plink_quiesce(struct sta_info *sta) {}
static inline void mesh_plink_restart(struct sta_info *sta) {}
static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
{ return false; }
+static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
+{}
#endif
#endif /* IEEE80211S_H */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211: Adds clean sdata helper
2012-04-24 11:18 [PATCH] mac80211: Adds clean sdata helper Andrei Emeltchenko
@ 2012-05-03 19:01 ` Johannes Berg
2012-05-04 8:48 ` Andrei Emeltchenko
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2012-05-03 19:01 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-wireless
Looks fine to me, but I'd prefer not having the mesh.h change, maybe we
can add an extra if (ieee80211_vif_is_mesh(&sdata->vif)) or use if
instead of switch?
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211: Adds clean sdata helper
2012-05-03 19:01 ` Johannes Berg
@ 2012-05-04 8:48 ` Andrei Emeltchenko
0 siblings, 0 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2012-05-04 8:48 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
Hi Johannes,
On Thu, May 3, 2012 at 10:01 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> Looks fine to me, but I'd prefer not having the mesh.h change, maybe we
> can add an extra if (ieee80211_vif_is_mesh(&sdata->vif)) or use if
> instead of switch?
Is this approach a recommended way? Otherwise using "elseif" or "if"
inside "switch" looks somehow not OK.
Regards,
Andrei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-04 8:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-24 11:18 [PATCH] mac80211: Adds clean sdata helper Andrei Emeltchenko
2012-05-03 19:01 ` Johannes Berg
2012-05-04 8:48 ` Andrei Emeltchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.