batman-adv: Use kref_get for batadv_nc_get_nc_node
[deliverable/linux.git] / net / batman-adv / network-coding.c
index cc63b44f0d2e2fdc61b41be26e745dea7567f28c..953dff1ad43b8d4702e3cb426a69bc71c390ee72 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2015 B.A.T.M.A.N. contributors:
+/* Copyright (C) 2012-201 B.A.T.M.A.N. contributors:
  *
  * Martin Hundebøll, Jeppe Ledet-Pedersen
  *
@@ -32,6 +32,7 @@
 #include <linux/jhash.h>
 #include <linux/jiffies.h>
 #include <linux/kernel.h>
+#include <linux/kref.h>
 #include <linux/list.h>
 #include <linux/lockdep.h>
 #include <linux/netdevice.h>
@@ -64,6 +65,8 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb,
 
 /**
  * batadv_nc_init - one-time initialization for network coding
+ *
+ * Return: 0 on success or negative error number in case of failure
  */
 int __init batadv_nc_init(void)
 {
@@ -142,6 +145,8 @@ static void batadv_nc_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
 /**
  * batadv_nc_mesh_init - initialise coding hash table and start house keeping
  * @bat_priv: the bat priv with all the soft interface information
+ *
+ * Return: 0 on success or negative error number in case of failure
  */
 int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
 {
@@ -205,34 +210,50 @@ void batadv_nc_init_orig(struct batadv_orig_node *orig_node)
 /**
  * batadv_nc_node_release - release nc_node from lists and queue for free after
  *  rcu grace period
- * @nc_node: the nc node to free
+ * @ref: kref pointer of the nc_node
  */
-static void batadv_nc_node_release(struct batadv_nc_node *nc_node)
+static void batadv_nc_node_release(struct kref *ref)
 {
-       batadv_orig_node_free_ref(nc_node->orig_node);
+       struct batadv_nc_node *nc_node;
+
+       nc_node = container_of(ref, struct batadv_nc_node, refcount);
+
+       batadv_orig_node_put(nc_node->orig_node);
        kfree_rcu(nc_node, rcu);
 }
 
 /**
- * batadv_nc_node_free_ref - decrement the nc node refcounter and possibly
+ * batadv_nc_node_put - decrement the nc_node refcounter and possibly
  *  release it
- * @nc_node: the nc node to free
+ * @nc_node: nc_node to be free'd
+ */
+static void batadv_nc_node_put(struct batadv_nc_node *nc_node)
+{
+       kref_put(&nc_node->refcount, batadv_nc_node_release);
+}
+
+/**
+ * batadv_nc_path_release - release nc_path from lists and queue for free after
+ *  rcu grace period
+ * @ref: kref pointer of the nc_path
  */
-static void batadv_nc_node_free_ref(struct batadv_nc_node *nc_node)
+static void batadv_nc_path_release(struct kref *ref)
 {
-       if (atomic_dec_and_test(&nc_node->refcount))
-               batadv_nc_node_release(nc_node);
+       struct batadv_nc_path *nc_path;
+
+       nc_path = container_of(ref, struct batadv_nc_path, refcount);
+
+       kfree_rcu(nc_path, rcu);
 }
 
 /**
- * batadv_nc_path_free_ref - decrements the nc path refcounter and possibly
- * frees it
- * @nc_path: the nc node to free
+ * batadv_nc_path_put - decrement the nc_path refcounter and possibly
+ *  release it
+ * @nc_path: nc_path to be free'd
  */
-static void batadv_nc_path_free_ref(struct batadv_nc_path *nc_path)
+static void batadv_nc_path_put(struct batadv_nc_path *nc_path)
 {
-       if (atomic_dec_and_test(&nc_path->refcount))
-               kfree_rcu(nc_path, rcu);
+       kref_put(&nc_path->refcount, batadv_nc_path_release);
 }
 
 /**
@@ -242,7 +263,7 @@ static void batadv_nc_path_free_ref(struct batadv_nc_path *nc_path)
 static void batadv_nc_packet_free(struct batadv_nc_packet *nc_packet)
 {
        kfree_skb(nc_packet->skb);
-       batadv_nc_path_free_ref(nc_packet->nc_path);
+       batadv_nc_path_put(nc_packet->nc_path);
        kfree(nc_packet);
 }
 
@@ -251,7 +272,7 @@ static void batadv_nc_packet_free(struct batadv_nc_packet *nc_packet)
  * @bat_priv: the bat priv with all the soft interface information
  * @nc_node: the nc node to check
  *
- * Returns true if the entry has to be purged now, false otherwise
+ * Return: true if the entry has to be purged now, false otherwise
  */
 static bool batadv_nc_to_purge_nc_node(struct batadv_priv *bat_priv,
                                       struct batadv_nc_node *nc_node)
@@ -267,7 +288,7 @@ static bool batadv_nc_to_purge_nc_node(struct batadv_priv *bat_priv,
  * @bat_priv: the bat priv with all the soft interface information
  * @nc_path: the nc path to check
  *
- * Returns true if the entry has to be purged now, false otherwise
+ * Return: true if the entry has to be purged now, false otherwise
  */
 static bool batadv_nc_to_purge_nc_path_coding(struct batadv_priv *bat_priv,
                                              struct batadv_nc_path *nc_path)
@@ -287,7 +308,7 @@ static bool batadv_nc_to_purge_nc_path_coding(struct batadv_priv *bat_priv,
  * @bat_priv: the bat priv with all the soft interface information
  * @nc_path: the nc path to check
  *
- * Returns true if the entry has to be purged now, false otherwise
+ * Return: true if the entry has to be purged now, false otherwise
  */
 static bool batadv_nc_to_purge_nc_path_decoding(struct batadv_priv *bat_priv,
                                                struct batadv_nc_path *nc_path)
@@ -335,7 +356,7 @@ batadv_nc_purge_orig_nc_nodes(struct batadv_priv *bat_priv,
                           "Removing nc_node %pM -> %pM\n",
                           nc_node->addr, nc_node->orig_node->orig);
                list_del_rcu(&nc_node->list);
-               batadv_nc_node_free_ref(nc_node);
+               batadv_nc_node_put(nc_node);
        }
        spin_unlock_bh(lock);
 }
@@ -446,7 +467,7 @@ static void batadv_nc_purge_paths(struct batadv_priv *bat_priv,
                                   "Remove nc_path %pM -> %pM\n",
                                   nc_path->prev_hop, nc_path->next_hop);
                        hlist_del_rcu(&nc_path->hash_entry);
-                       batadv_nc_path_free_ref(nc_path);
+                       batadv_nc_path_put(nc_path);
                }
                spin_unlock_bh(lock);
        }
@@ -470,7 +491,7 @@ static void batadv_nc_hash_key_gen(struct batadv_nc_path *key, const char *src,
  * @data: data to hash
  * @size: size of the hash table
  *
- * Returns the selected index in the hash table for the given data.
+ * Return: the selected index in the hash table for the given data.
  */
 static u32 batadv_nc_hash_choose(const void *data, u32 size)
 {
@@ -489,7 +510,7 @@ static u32 batadv_nc_hash_choose(const void *data, u32 size)
  * @node: node in the local table
  * @data2: second object to compare the node to
  *
- * Returns 1 if the two entry are the same, 0 otherwise
+ * Return: 1 if the two entry are the same, 0 otherwise
  */
 static int batadv_nc_hash_compare(const struct hlist_node *node,
                                  const void *data2)
@@ -516,7 +537,7 @@ static int batadv_nc_hash_compare(const struct hlist_node *node,
  * @hash: hash table containing the nc path
  * @data: search key
  *
- * Returns the nc_path if found, NULL otherwise.
+ * Return: the nc_path if found, NULL otherwise.
  */
 static struct batadv_nc_path *
 batadv_nc_hash_find(struct batadv_hashtable *hash,
@@ -537,7 +558,7 @@ batadv_nc_hash_find(struct batadv_hashtable *hash,
                if (!batadv_nc_hash_compare(&nc_path->hash_entry, data))
                        continue;
 
-               if (!atomic_inc_not_zero(&nc_path->refcount))
+               if (!kref_get_unless_zero(&nc_path->refcount))
                        continue;
 
                nc_path_tmp = nc_path;
@@ -554,9 +575,7 @@ batadv_nc_hash_find(struct batadv_hashtable *hash,
  */
 static void batadv_nc_send_packet(struct batadv_nc_packet *nc_packet)
 {
-       batadv_send_skb_packet(nc_packet->skb,
-                              nc_packet->neigh_node->if_incoming,
-                              nc_packet->nc_path->next_hop);
+       batadv_send_unicast_skb(nc_packet->skb, nc_packet->neigh_node);
        nc_packet->skb = NULL;
        batadv_nc_packet_free(nc_packet);
 }
@@ -571,7 +590,7 @@ static void batadv_nc_send_packet(struct batadv_nc_packet *nc_packet)
  * timeout. If so, the packet is no longer kept and the entry deleted from the
  * queue. Has to be called with the appropriate locks.
  *
- * Returns false as soon as the entry in the fifo queue has not been timed out
+ * Return: false as soon as the entry in the fifo queue has not been timed out
  * yet and true otherwise.
  */
 static bool batadv_nc_sniffed_purge(struct batadv_priv *bat_priv,
@@ -610,7 +629,7 @@ out:
  * packet is no longer delayed, immediately sent and the entry deleted from the
  * queue. Has to be called with the appropriate locks.
  *
- * Returns false as soon as the entry in the fifo queue has not been timed out
+ * Return: false as soon as the entry in the fifo queue has not been timed out
  * yet and true otherwise.
  */
 static bool batadv_nc_fwd_flush(struct batadv_priv *bat_priv,
@@ -695,7 +714,7 @@ static void batadv_nc_worker(struct work_struct *work)
        struct batadv_priv *bat_priv;
        unsigned long timeout;
 
-       delayed_work = container_of(work, struct delayed_work, work);
+       delayed_work = to_delayed_work(work);
        priv_nc = container_of(delayed_work, struct batadv_priv_nc, work);
        bat_priv = container_of(priv_nc, struct batadv_priv, nc);
 
@@ -731,7 +750,7 @@ static void batadv_nc_worker(struct work_struct *work)
  * @orig_node: neighboring orig node which may be used as nc candidate
  * @ogm_packet: incoming ogm packet also used for the checks
  *
- * Returns true if:
+ * Return: true if:
  *  1) The OGM must have the most recent sequence number.
  *  2) The TTL must be decremented by one and only one.
  *  3) The OGM must be received from the first hop from orig_node.
@@ -751,7 +770,7 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv,
 
        last_ttl = orig_ifinfo->last_ttl;
        last_real_seqno = orig_ifinfo->last_real_seqno;
-       batadv_orig_ifinfo_free_ref(orig_ifinfo);
+       batadv_orig_ifinfo_put(orig_ifinfo);
 
        if (last_real_seqno != ntohl(ogm_packet->seqno))
                return false;
@@ -772,12 +791,12 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv,
  *  (can be equal to orig_node)
  * @in_coding: traverse incoming or outgoing network coding list
  *
- * Returns the nc_node if found, NULL otherwise.
+ * Return: the nc_node if found, NULL otherwise.
  */
-static struct batadv_nc_node
-*batadv_nc_find_nc_node(struct batadv_orig_node *orig_node,
-                       struct batadv_orig_node *orig_neigh_node,
-                       bool in_coding)
+static struct batadv_nc_node *
+batadv_nc_find_nc_node(struct batadv_orig_node *orig_node,
+                      struct batadv_orig_node *orig_neigh_node,
+                      bool in_coding)
 {
        struct batadv_nc_node *nc_node, *nc_node_out = NULL;
        struct list_head *list;
@@ -793,7 +812,7 @@ static struct batadv_nc_node
                if (!batadv_compare_eth(nc_node->addr, orig_node->orig))
                        continue;
 
-               if (!atomic_inc_not_zero(&nc_node->refcount))
+               if (!kref_get_unless_zero(&nc_node->refcount))
                        continue;
 
                /* Found a match */
@@ -814,13 +833,13 @@ static struct batadv_nc_node
  *  (can be equal to orig_node)
  * @in_coding: traverse incoming or outgoing network coding list
  *
- * Returns the nc_node if found or created, NULL in case of an error.
+ * Return: the nc_node if found or created, NULL in case of an error.
  */
-static struct batadv_nc_node
-*batadv_nc_get_nc_node(struct batadv_priv *bat_priv,
-                      struct batadv_orig_node *orig_node,
-                      struct batadv_orig_node *orig_neigh_node,
-                      bool in_coding)
+static struct batadv_nc_node *
+batadv_nc_get_nc_node(struct batadv_priv *bat_priv,
+                     struct batadv_orig_node *orig_node,
+                     struct batadv_orig_node *orig_neigh_node,
+                     bool in_coding)
 {
        struct batadv_nc_node *nc_node;
        spinlock_t *lock; /* Used to lock list selected by "int in_coding" */
@@ -837,14 +856,14 @@ static struct batadv_nc_node
        if (!nc_node)
                return NULL;
 
-       if (!atomic_inc_not_zero(&orig_neigh_node->refcount))
-               goto free;
+       kref_get(&orig_neigh_node->refcount);
 
        /* Initialize nc_node */
        INIT_LIST_HEAD(&nc_node->list);
        ether_addr_copy(nc_node->addr, orig_node->orig);
        nc_node->orig_node = orig_neigh_node;
-       atomic_set(&nc_node->refcount, 2);
+       kref_init(&nc_node->refcount);
+       kref_get(&nc_node->refcount);
 
        /* Select ingoing or outgoing coding node */
        if (in_coding) {
@@ -864,10 +883,6 @@ static struct batadv_nc_node
        spin_unlock_bh(lock);
 
        return nc_node;
-
-free:
-       kfree(nc_node);
-       return NULL;
 }
 
 /**
@@ -920,9 +935,9 @@ void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
 
 out:
        if (in_nc_node)
-               batadv_nc_node_free_ref(in_nc_node);
+               batadv_nc_node_put(in_nc_node);
        if (out_nc_node)
-               batadv_nc_node_free_ref(out_nc_node);
+               batadv_nc_node_put(out_nc_node);
 }
 
 /**
@@ -932,7 +947,7 @@ out:
  * @src: ethernet source address - first half of the nc path search key
  * @dst: ethernet destination address - second half of the nc path search key
  *
- * Returns pointer to nc_path if the path was found or created, returns NULL
+ * Return: pointer to nc_path if the path was found or created, returns NULL
  * on error.
  */
 static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv,
@@ -963,7 +978,8 @@ static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv,
        /* Initialize nc_path */
        INIT_LIST_HEAD(&nc_path->packet_list);
        spin_lock_init(&nc_path->packet_list_lock);
-       atomic_set(&nc_path->refcount, 2);
+       kref_init(&nc_path->refcount);
+       kref_get(&nc_path->refcount);
        nc_path->last_valid = jiffies;
        ether_addr_copy(nc_path->next_hop, dst);
        ether_addr_copy(nc_path->prev_hop, src);
@@ -989,6 +1005,8 @@ static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv,
  * batadv_nc_random_weight_tq - scale the receivers TQ-value to avoid unfair
  *  selection of a receiver with slightly lower TQ than the other
  * @tq: to be weighted tq value
+ *
+ * Return: scaled tq value
  */
 static u8 batadv_nc_random_weight_tq(u8 tq)
 {
@@ -1029,7 +1047,7 @@ static void batadv_nc_memxor(char *dst, const char *src, unsigned int len)
  * @nc_packet: structure containing the packet to the skb can be coded with
  * @neigh_node: next hop to forward packet to
  *
- * Returns true if both packets are consumed, false otherwise.
+ * Return: true if both packets are consumed, false otherwise.
  */
 static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
                                   struct sk_buff *skb,
@@ -1042,11 +1060,11 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
        struct batadv_unicast_packet *packet1;
        struct batadv_unicast_packet *packet2;
        struct batadv_coded_packet *coded_packet;
-       struct batadv_neigh_node *neigh_tmp, *router_neigh;
-       struct batadv_neigh_node *router_coding = NULL;
+       struct batadv_neigh_node *neigh_tmp, *router_neigh, *first_dest;
+       struct batadv_neigh_node *router_coding = NULL, *second_dest;
        struct batadv_neigh_ifinfo *router_neigh_ifinfo = NULL;
        struct batadv_neigh_ifinfo *router_coding_ifinfo = NULL;
-       u8 *first_source, *first_dest, *second_source, *second_dest;
+       u8 *first_source, *second_source;
        __be32 packet_id1, packet_id2;
        size_t count;
        bool res = false;
@@ -1089,9 +1107,9 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
         */
        if (tq_weighted_neigh >= tq_weighted_coding) {
                /* Destination from nc_packet is selected for MAC-header */
-               first_dest = nc_packet->nc_path->next_hop;
+               first_dest = nc_packet->neigh_node;
                first_source = nc_packet->nc_path->prev_hop;
-               second_dest = neigh_node->addr;
+               second_dest = neigh_node;
                second_source = ethhdr->h_source;
                packet1 = (struct batadv_unicast_packet *)nc_packet->skb->data;
                packet2 = (struct batadv_unicast_packet *)skb->data;
@@ -1100,9 +1118,9 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
                                              skb->data + sizeof(*packet2));
        } else {
                /* Destination for skb is selected for MAC-header */
-               first_dest = neigh_node->addr;
+               first_dest = neigh_node;
                first_source = ethhdr->h_source;
-               second_dest = nc_packet->nc_path->next_hop;
+               second_dest = nc_packet->neigh_node;
                second_source = nc_packet->nc_path->prev_hop;
                packet1 = (struct batadv_unicast_packet *)skb->data;
                packet2 = (struct batadv_unicast_packet *)nc_packet->skb->data;
@@ -1144,7 +1162,7 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
        coded_packet->first_ttvn = packet1->ttvn;
 
        /* Info about second unicast packet */
-       ether_addr_copy(coded_packet->second_dest, second_dest);
+       ether_addr_copy(coded_packet->second_dest, second_dest->addr);
        ether_addr_copy(coded_packet->second_source, second_source);
        ether_addr_copy(coded_packet->second_orig_dest, packet2->dest);
        coded_packet->second_crc = packet_id2;
@@ -1199,17 +1217,17 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
        batadv_nc_packet_free(nc_packet);
 
        /* Send the coded packet and return true */
-       batadv_send_skb_packet(skb_dest, neigh_node->if_incoming, first_dest);
+       batadv_send_unicast_skb(skb_dest, first_dest);
        res = true;
 out:
        if (router_neigh)
-               batadv_neigh_node_free_ref(router_neigh);
+               batadv_neigh_node_put(router_neigh);
        if (router_coding)
-               batadv_neigh_node_free_ref(router_coding);
+               batadv_neigh_node_put(router_coding);
        if (router_neigh_ifinfo)
-               batadv_neigh_ifinfo_free_ref(router_neigh_ifinfo);
+               batadv_neigh_ifinfo_put(router_neigh_ifinfo);
        if (router_coding_ifinfo)
-               batadv_neigh_ifinfo_free_ref(router_coding_ifinfo);
+               batadv_neigh_ifinfo_put(router_coding_ifinfo);
        return res;
 }
 
@@ -1228,7 +1246,7 @@ out:
  * Since the source encoded the packet we can be certain it has all necessary
  * decode information.
  *
- * Returns true if coding of a decoded packet is allowed.
+ * Return: true if coding of a decoded packet is allowed.
  */
 static bool batadv_nc_skb_coding_possible(struct sk_buff *skb, u8 *dst, u8 *src)
 {
@@ -1246,7 +1264,7 @@ static bool batadv_nc_skb_coding_possible(struct sk_buff *skb, u8 *dst, u8 *src)
  * @skb: data skb to forward
  * @eth_dst: next hop mac address of skb
  *
- * Returns true if coding of a decoded skb is allowed.
+ * Return: true if coding of a decoded skb is allowed.
  */
 static struct batadv_nc_packet *
 batadv_nc_path_search(struct batadv_priv *bat_priv,
@@ -1314,7 +1332,7 @@ batadv_nc_path_search(struct batadv_priv *bat_priv,
  * @eth_src: source mac address of skb
  * @in_nc_node: pointer to skb next hop's neighbor nc node
  *
- * Returns an nc packet if a suitable coding packet was found, NULL otherwise.
+ * Return: an nc packet if a suitable coding packet was found, NULL otherwise.
  */
 static struct batadv_nc_packet *
 batadv_nc_skb_src_search(struct batadv_priv *bat_priv,
@@ -1347,7 +1365,7 @@ batadv_nc_skb_src_search(struct batadv_priv *bat_priv,
        }
        rcu_read_unlock();
 
-       batadv_orig_node_free_ref(orig_node);
+       batadv_orig_node_put(orig_node);
        return nc_packet;
 }
 
@@ -1397,7 +1415,7 @@ static void batadv_nc_skb_store_before_coding(struct batadv_priv *bat_priv,
  * next hop that potentially sent a packet which our next hop also received
  * (overheard) and has stored for later decoding.
  *
- * Returns true if the skb was consumed (encoded packet sent) or false otherwise
+ * Return: true if the skb was consumed (encoded packet sent) or false otherwise
  */
 static bool batadv_nc_skb_dst_search(struct sk_buff *skb,
                                     struct batadv_neigh_node *neigh_node,
@@ -1451,7 +1469,7 @@ static bool batadv_nc_skb_dst_search(struct sk_buff *skb,
  * @neigh_node: next hop to forward packet to
  * @packet_id: checksum to identify packet
  *
- * Returns true if the packet was buffered or false in case of an error.
+ * Return: true if the packet was buffered or false in case of an error.
  */
 static bool batadv_nc_skb_add_to_path(struct sk_buff *skb,
                                      struct batadv_nc_path *nc_path,
@@ -1485,7 +1503,7 @@ static bool batadv_nc_skb_add_to_path(struct sk_buff *skb,
  * @skb: data skb to forward
  * @neigh_node: next hop to forward packet to
  *
- * Returns true if the skb was consumed (encoded packet sent) or false otherwise
+ * Return: true if the skb was consumed (encoded packet sent) or false otherwise
  */
 bool batadv_nc_skb_forward(struct sk_buff *skb,
                           struct batadv_neigh_node *neigh_node)
@@ -1530,7 +1548,7 @@ bool batadv_nc_skb_forward(struct sk_buff *skb,
        return true;
 
 free_nc_path:
-       batadv_nc_path_free_ref(nc_path);
+       batadv_nc_path_put(nc_path);
 out:
        /* Packet is not consumed */
        return false;
@@ -1592,7 +1610,7 @@ void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
 free_skb:
        kfree_skb(skb);
 free_nc_path:
-       batadv_nc_path_free_ref(nc_path);
+       batadv_nc_path_put(nc_path);
 out:
        return;
 }
@@ -1624,7 +1642,7 @@ void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  * @skb: unicast skb to decode
  * @nc_packet: decode data needed to decode the skb
  *
- * Returns pointer to decoded unicast packet if the packet was decoded or NULL
+ * Return: pointer to decoded unicast packet if the packet was decoded or NULL
  * in case of an error.
  */
 static struct batadv_unicast_packet *
@@ -1718,7 +1736,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
  * @ethhdr: pointer to the ethernet header inside the coded packet
  * @coded: coded packet we try to find decode data for
  *
- * Returns pointer to nc packet if the needed data was found or NULL otherwise.
+ * Return: pointer to nc packet if the needed data was found or NULL otherwise.
  */
 static struct batadv_nc_packet *
 batadv_nc_find_decoding_packet(struct batadv_priv *bat_priv,
@@ -1781,6 +1799,9 @@ batadv_nc_find_decoding_packet(struct batadv_priv *bat_priv,
  *  resulting unicast packet
  * @skb: incoming coded packet
  * @recv_if: pointer to interface this packet was received on
+ *
+ * Return: NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP
+ * otherwise.
  */
 static int batadv_nc_recv_coded_packet(struct sk_buff *skb,
                                       struct batadv_hard_iface *recv_if)
@@ -1865,6 +1886,8 @@ void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
  * batadv_nc_nodes_seq_print_text - print the nc node information
  * @seq: seq file to print on
  * @offset: not used
+ *
+ * Return: always 0
  */
 int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset)
 {
@@ -1920,13 +1943,15 @@ int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset)
 
 out:
        if (primary_if)
-               batadv_hardif_free_ref(primary_if);
+               batadv_hardif_put(primary_if);
        return 0;
 }
 
 /**
  * batadv_nc_init_debugfs - create nc folder and related files in debugfs
  * @bat_priv: the bat priv with all the soft interface information
+ *
+ * Return: 0 on success or negative error number in case of failure
  */
 int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
 {
This page took 0.066275 seconds and 5 git commands to generate.