batman-adv: Fix names in kerneldoc of functions
[deliverable/linux.git] / net / batman-adv / translation-table.c
index 76f19ba62462bf03fadba72171d3ae01a565ba57..7d8fc90c9e3886f28469eaf9a8aa26fc95ce3493 100644 (file)
@@ -217,7 +217,6 @@ batadv_tt_global_entry_free_ref(struct batadv_tt_global_entry *tt_global_entry)
 
 /**
  * batadv_tt_global_hash_count - count the number of orig entries
- * @hash: hash table containing the tt entries
  * @addr: the mac address of the client to count entries for
  * @vid: VLAN identifier
  *
@@ -240,20 +239,6 @@ int batadv_tt_global_hash_count(struct batadv_priv *bat_priv,
        return count;
 }
 
-static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
-{
-       struct batadv_tt_orig_list_entry *orig_entry;
-
-       orig_entry = container_of(rcu, struct batadv_tt_orig_list_entry, rcu);
-
-       /* We are in an rcu callback here, therefore we cannot use
-        * batadv_orig_node_free_ref() and its call_rcu():
-        * An rcu_barrier() wouldn't wait for that to finish
-        */
-       batadv_orig_node_free_ref_now(orig_entry->orig_node);
-       kfree(orig_entry);
-}
-
 /**
  * batadv_tt_local_size_mod - change the size by v of the local table identified
  *  by vid
@@ -302,7 +287,6 @@ static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv,
 /**
  * batadv_tt_global_size_mod - change the size by v of the local table
  *  identified by vid
- * @bat_priv: the bat priv with all the soft interface information
  * @vid: the VLAN identifier
  * @v: the amount to sum to the global table size
  */
@@ -349,13 +333,25 @@ static void batadv_tt_global_size_dec(struct batadv_orig_node *orig_node,
        batadv_tt_global_size_mod(orig_node, vid, -1);
 }
 
+/**
+ * batadv_tt_orig_list_entry_release - release tt orig entry from lists and
+ *  queue for free after rcu grace period
+ * @orig_entry: tt orig entry to be free'd
+ */
+static void
+batadv_tt_orig_list_entry_release(struct batadv_tt_orig_list_entry *orig_entry)
+{
+       batadv_orig_node_free_ref(orig_entry->orig_node);
+       kfree_rcu(orig_entry, rcu);
+}
+
 static void
 batadv_tt_orig_list_entry_free_ref(struct batadv_tt_orig_list_entry *orig_entry)
 {
        if (!atomic_dec_and_test(&orig_entry->refcount))
                return;
 
-       call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
+       batadv_tt_orig_list_entry_release(orig_entry);
 }
 
 /**
@@ -1443,7 +1439,7 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
                 * TT_CLIENT_WIFI, therefore they have to be copied in the
                 * client entry
                 */
-               tt_global_entry->common.flags |= flags;
+               common->flags |= flags;
 
                /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only
                 * one originator left in the list and we previously received a
@@ -2408,7 +2404,6 @@ static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
  * @orig_node: originator for which the CRCs have to be checked
  * @tt_vlan: pointer to the first tvlv VLAN entry
  * @num_vlan: number of tvlv VLAN entries
- * @create: if true, create VLAN objects if not found
  *
  * Return true if all the received CRCs match the locally stored ones, false
  * otherwise
@@ -2419,8 +2414,8 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
 {
        struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp;
        struct batadv_orig_node_vlan *vlan;
+       int i, orig_num_vlan;
        u32 crc;
-       int i;
 
        /* check if each received CRC matches the locally stored one */
        for (i = 0; i < num_vlan; i++) {
@@ -2446,6 +2441,18 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
                        return false;
        }
 
+       /* check if any excess VLANs exist locally for the originator
+        * which are not mentioned in the TVLV from the originator.
+        */
+       rcu_read_lock();
+       orig_num_vlan = 0;
+       hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list)
+               orig_num_vlan++;
+       rcu_read_unlock();
+
+       if (orig_num_vlan > num_vlan)
+               return false;
+
        return true;
 }
 
@@ -3327,7 +3334,10 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
        bool ret = false;
 
        vlan = batadv_softif_vlan_get(bat_priv, vid);
-       if (!vlan || !atomic_read(&vlan->ap_isolation))
+       if (!vlan)
+               return false;
+
+       if (!atomic_read(&vlan->ap_isolation))
                goto out;
 
        tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid);
@@ -3344,8 +3354,7 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
        ret = true;
 
 out:
-       if (vlan)
-               batadv_softif_vlan_free_ref(vlan);
+       batadv_softif_vlan_free_ref(vlan);
        if (tt_global_entry)
                batadv_tt_global_entry_free_ref(tt_global_entry);
        if (tt_local_entry)
@@ -3357,13 +3366,12 @@ out:
  * batadv_tt_update_orig - update global translation table with new tt
  *  information received via ogms
  * @bat_priv: the bat priv with all the soft interface information
- * @orig: the orig_node of the ogm
- * @tt_vlan: pointer to the first tvlv VLAN entry
+ * @orig_node: the orig_node of the ogm
+ * @tt_buff: pointer to the first tvlv VLAN entry
  * @tt_num_vlan: number of tvlv VLAN entries
  * @tt_change: pointer to the first entry in the TT buffer
  * @tt_num_changes: number of tt changes inside the tt buffer
  * @ttvn: translation table version number of this changeset
- * @tt_crc: crc32 checksum of orig node's translation table
  */
 static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
                                  struct batadv_orig_node *orig_node,
This page took 0.033774 seconds and 5 git commands to generate.