From 5d2c05b213377694a2aa8ce1ed9b23f7c39b0569 Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Tue, 2 Jul 2013 11:04:34 +0200 Subject: batman-adv: add per VLAN interface attribute framework Since batman-adv is now fully VLAN-aware, a proper framework able to handle per-vlan-interface attributes is needed. Those attributes will affect the associated VLAN interface only, rather than the real soft_iface (which would result in every vlan interface having the same attribute configuration). To make the code simpler and easier to extend, attributes associated to the standalone soft_iface are now treated like belonging to yet another vlan having a special vid. This vid is different from the others because it is made up by all zeros and the VLAN_HAS_TAG bit is not set. Signed-off-by: Antonio Quartulli Signed-off-by: Marek Lindner --- net/batman-adv/types.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'net/batman-adv/types.h') diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 6954a5d5a9e9..e5fecd4add64 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h @@ -530,6 +530,22 @@ struct batadv_priv_nc { struct batadv_hashtable *decoding_hash; }; +/** + * struct batadv_softif_vlan - per VLAN attributes set + * @vid: VLAN identifier + * @kobj: kobject for sysfs vlan subdirectory + * @list: list node for bat_priv::softif_vlan_list + * @refcount: number of context where this object is currently in use + * @rcu: struct used for freeing in a RCU-safe manner + */ +struct batadv_softif_vlan { + unsigned short vid; + struct kobject *kobj; + struct hlist_node list; + atomic_t refcount; + struct rcu_head rcu; +}; + /** * struct batadv_priv - per mesh interface data * @mesh_state: current status of the mesh (inactive/active/deactivating) @@ -566,6 +582,9 @@ struct batadv_priv_nc { * @primary_if: one of the hard interfaces assigned to this mesh interface * becomes the primary interface * @bat_algo_ops: routing algorithm used by this mesh interface + * @softif_vlan_list: a list of softif_vlan structs, one per VLAN created on top + * of the mesh interface represented by this object + * @softif_vlan_list_lock: lock protecting softif_vlan_list * @bla: bridge loope avoidance data * @debug_log: holding debug logging relevant data * @gw: gateway data @@ -613,6 +632,8 @@ struct batadv_priv { struct work_struct cleanup_work; struct batadv_hard_iface __rcu *primary_if; /* rcu protected pointer */ struct batadv_algo_ops *bat_algo_ops; + struct hlist_head softif_vlan_list; + spinlock_t softif_vlan_list_lock; /* protects softif_vlan_list */ #ifdef CONFIG_BATMAN_ADV_BLA struct batadv_priv_bla bla; #endif -- cgit v1.2.3-59-g8ed1b