hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/batman-adv/translation-table.h
....@@ -1,19 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
2
+/* Copyright (C) 2007-2020 B.A.T.M.A.N. contributors:
33 *
44 * Marek Lindner, Simon Wunderlich, Antonio Quartulli
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of version 2 of the GNU General Public
8
- * License as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful, but
11
- * WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- * General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
175 */
186
197 #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
....@@ -21,12 +9,12 @@
219
2210 #include "main.h"
2311
12
+#include <linux/kref.h>
13
+#include <linux/netdevice.h>
14
+#include <linux/netlink.h>
15
+#include <linux/seq_file.h>
16
+#include <linux/skbuff.h>
2417 #include <linux/types.h>
25
-
26
-struct netlink_callback;
27
-struct net_device;
28
-struct seq_file;
29
-struct sk_buff;
3018
3119 int batadv_tt_init(struct batadv_priv *bat_priv);
3220 bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
....@@ -41,6 +29,10 @@
4129 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
4230 struct batadv_orig_node *orig_node,
4331 s32 match_vid, const char *message);
32
+struct batadv_tt_global_entry *
33
+batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
34
+ unsigned short vid);
35
+void batadv_tt_global_entry_release(struct kref *ref);
4436 int batadv_tt_global_hash_count(struct batadv_priv *bat_priv,
4537 const u8 *addr, unsigned short vid);
4638 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
....@@ -67,4 +59,19 @@
6759 int batadv_tt_cache_init(void);
6860 void batadv_tt_cache_destroy(void);
6961
62
+/**
63
+ * batadv_tt_global_entry_put() - decrement the tt_global_entry refcounter and
64
+ * possibly release it
65
+ * @tt_global_entry: tt_global_entry to be free'd
66
+ */
67
+static inline void
68
+batadv_tt_global_entry_put(struct batadv_tt_global_entry *tt_global_entry)
69
+{
70
+ if (!tt_global_entry)
71
+ return;
72
+
73
+ kref_put(&tt_global_entry->common.refcount,
74
+ batadv_tt_global_entry_release);
75
+}
76
+
7077 #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */