]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/batman-adv/types.h
batman-adv: Convert batadv_tvlv_container to kref
[mirror_ubuntu-bionic-kernel.git] / net / batman-adv / types.h
index 3437b667a2cd670965cc12479c2b2169f7020803..c55925bb34afa15198d4d154efc5be53856df637 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors:
+/* Copyright (C) 2007-201 B.A.T.M.A.N. contributors:
  *
  * Marek Lindner, Simon Wunderlich
  *
@@ -25,6 +25,7 @@
 #include <linux/bitops.h>
 #include <linux/compiler.h>
 #include <linux/if_ether.h>
+#include <linux/kref.h>
 #include <linux/netdevice.h>
 #include <linux/sched.h> /* for linux/wait.h */
 #include <linux/spinlock.h>
@@ -73,7 +74,7 @@ enum batadv_dhcp_recipient {
 #define BATADV_TT_SYNC_MASK    0x00F0
 
 /**
- * struct batadv_hard_iface_bat_iv - per hard interface B.A.T.M.A.N. IV data
+ * struct batadv_hard_iface_bat_iv - per hard-interface B.A.T.M.A.N. IV data
  * @ogm_buff: buffer holding the OGM packet
  * @ogm_buff_len: length of the OGM packet buffer
  * @ogm_seqno: OGM sequence number - used to identify each OGM
@@ -97,8 +98,8 @@ struct batadv_hard_iface_bat_iv {
  *  batman-adv for this interface
  * @soft_iface: the batman-adv interface which uses this network interface
  * @rcu: struct used for freeing in an RCU-safe manner
- * @bat_iv: BATMAN IV specific per hard interface data
- * @cleanup_work: work queue callback item for hard interface deinit
+ * @bat_iv: per hard-interface B.A.T.M.A.N. IV data
+ * @cleanup_work: work queue callback item for hard-interface deinit
  * @debug_dir: dentry for nc subdir in batman-adv directory in debugfs
  * @neigh_list: list of unique single hop neighbors via this interface
  * @neigh_list_lock: lock protecting neigh_list
@@ -125,7 +126,7 @@ struct batadv_hard_iface {
 /**
  * struct batadv_orig_ifinfo - originator info per outgoing interface
  * @list: list node for orig_node::ifinfo_list
- * @if_outgoing: pointer to outgoing hard interface
+ * @if_outgoing: pointer to outgoing hard-interface
  * @router: router that should be used to reach this originator
  * @last_real_seqno: last and best known sequence number
  * @last_ttl: ttl of last received packet
@@ -202,7 +203,7 @@ struct batadv_orig_node_vlan {
 
 /**
  * struct batadv_orig_bat_iv - B.A.T.M.A.N. IV private orig_node members
- * @bcast_own: set of bitfields (one per hard interface) where each one counts
+ * @bcast_own: set of bitfields (one per hard-interface) where each one counts
  * the number of our OGMs this orig_node rebroadcasted "back" to us  (relative
  * to last_real_seqno). Every bitfield is BATADV_TQ_LOCAL_WINDOW_SIZE bits long.
  * @bcast_own_sum: sum of bcast_own
@@ -341,15 +342,16 @@ struct batadv_gw_node {
        struct batadv_orig_node *orig_node;
        u32 bandwidth_down;
        u32 bandwidth_up;
-       atomic_t refcount;
+       struct kref refcount;
        struct rcu_head rcu;
 };
 
 /**
- * batadv_hardif_neigh_node - unique neighbor per hard interface
+ * struct batadv_hardif_neigh_node - unique neighbor per hard-interface
  * @list: list node for batadv_hard_iface::neigh_list
  * @addr: the MAC address of the neighboring interface
- * @if_incoming: pointer to incoming hard interface
+ * @if_incoming: pointer to incoming hard-interface
+ * @last_seen: when last packet via this neighbor was received
  * @refcount: number of contexts the object is used
  * @rcu: struct used for freeing in a RCU-safe manner
  */
@@ -358,7 +360,7 @@ struct batadv_hardif_neigh_node {
        u8 addr[ETH_ALEN];
        struct batadv_hard_iface *if_incoming;
        unsigned long last_seen;
-       atomic_t refcount;
+       struct kref refcount;
        struct rcu_head rcu;
 };
 
@@ -369,7 +371,7 @@ struct batadv_hardif_neigh_node {
  * @addr: the MAC address of the neighboring interface
  * @ifinfo_list: list for routing metrics per outgoing interface
  * @ifinfo_lock: lock protecting private ifinfo members and list
- * @if_incoming: pointer to incoming hard interface
+ * @if_incoming: pointer to incoming hard-interface
  * @last_seen: when last packet via this neighbor was received
  * @refcount: number of contexts the object is used
  * @rcu: struct used for freeing in an RCU-safe manner
@@ -388,7 +390,7 @@ struct batadv_neigh_node {
 
 /**
  * struct batadv_neigh_ifinfo_bat_iv - neighbor information per outgoing
- *  interface for BATMAN IV
+ *  interface for B.A.T.M.A.N. IV
  * @tq_recv: ring buffer of received TQ values from this neigh node
  * @tq_index: ring buffer index
  * @tq_avg: averaged tq of all tq values in the ring buffer (tq_recv)
@@ -407,7 +409,7 @@ struct batadv_neigh_ifinfo_bat_iv {
 /**
  * struct batadv_neigh_ifinfo - neighbor information per outgoing interface
  * @list: list node for batadv_neigh_node::ifinfo_list
- * @if_outgoing: pointer to outgoing hard interface
+ * @if_outgoing: pointer to outgoing hard-interface
  * @bat_iv: B.A.T.M.A.N. IV private structure
  * @last_ttl: last received ttl from this neigh node
  * @refcount: number of contexts the object is used
@@ -744,7 +746,7 @@ struct batadv_softif_vlan {
        atomic_t ap_isolation;          /* boolean */
        struct batadv_vlan_tt tt;
        struct hlist_node list;
-       atomic_t refcount;
+       struct kref refcount;
        struct rcu_head rcu;
 };
 
@@ -771,6 +773,9 @@ struct batadv_softif_vlan {
  * @orig_interval: OGM broadcast interval in milliseconds
  * @hop_penalty: penalty which will be applied to an OGM's tq-field on every hop
  * @log_level: configured log level (see batadv_dbg_level)
+ * @isolation_mark: the skb->mark value used to match packets for AP isolation
+ * @isolation_mark_mask: bitmask identifying the bits in skb->mark to be used
+ *  for the isolation mark
  * @bcast_seqno: last sent broadcast packet sequence number
  * @bcast_queue_left: number of remaining buffered broadcast packet slots
  * @batman_queue_left: number of remaining OGM packet slots
@@ -783,8 +788,8 @@ struct batadv_softif_vlan {
  * @forw_bat_list_lock: lock protecting forw_bat_list
  * @forw_bcast_list_lock: lock protecting forw_bcast_list
  * @orig_work: work queue callback item for orig node purging
- * @cleanup_work: work queue callback item for soft interface deinit
- * @primary_if: one of the hard interfaces assigned to this mesh interface
+ * @cleanup_work: work queue callback item for soft-interface deinit
+ * @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
@@ -925,7 +930,7 @@ struct batadv_bla_backbone_gw {
        atomic_t request_sent;
        u16 crc;
        spinlock_t crc_lock; /* protects crc */
-       atomic_t refcount;
+       struct kref refcount;
        struct rcu_head rcu;
 };
 
@@ -946,7 +951,7 @@ struct batadv_bla_claim {
        unsigned long lasttime;
        struct hlist_node hash_entry;
        struct rcu_head rcu;
-       atomic_t refcount;
+       struct kref refcount;
 };
 #endif
 
@@ -1062,7 +1067,7 @@ struct batadv_tt_roam_node {
 struct batadv_nc_node {
        struct list_head list;
        u8 addr[ETH_ALEN];
-       atomic_t refcount;
+       struct kref refcount;
        struct rcu_head rcu;
        struct batadv_orig_node *orig_node;
        unsigned long last_seen;
@@ -1082,7 +1087,7 @@ struct batadv_nc_node {
 struct batadv_nc_path {
        struct hlist_node hash_entry;
        struct rcu_head rcu;
-       atomic_t refcount;
+       struct kref refcount;
        struct list_head packet_list;
        spinlock_t packet_list_lock; /* Protects packet_list */
        u8 next_hop[ETH_ALEN];
@@ -1225,7 +1230,7 @@ struct batadv_dat_entry {
        unsigned short vid;
        unsigned long last_update;
        struct hlist_node hash_entry;
-       atomic_t refcount;
+       struct kref refcount;
        struct rcu_head rcu;
 };
 
@@ -1261,7 +1266,7 @@ struct batadv_dat_candidate {
 struct batadv_tvlv_container {
        struct hlist_node list;
        struct batadv_tvlv_hdr tvlv_hdr;
-       atomic_t refcount;
+       struct kref refcount;
 };
 
 /**