hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/net/batman-adv/hash.h
....@@ -1,19 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2
-/* Copyright (C) 2006-2018 B.A.T.M.A.N. contributors:
2
+/* Copyright (C) 2006-2020 B.A.T.M.A.N. contributors:
33 *
44 * Simon Wunderlich, Marek Lindner
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_HASH_H_
....@@ -21,14 +9,14 @@
219
2210 #include "main.h"
2311
12
+#include <linux/atomic.h>
2413 #include <linux/compiler.h>
2514 #include <linux/list.h>
15
+#include <linux/lockdep.h>
2616 #include <linux/rculist.h>
2717 #include <linux/spinlock.h>
2818 #include <linux/stddef.h>
2919 #include <linux/types.h>
30
-
31
-struct lock_class_key;
3220
3321 /* callback to a compare function. should compare 2 element datas for their
3422 * keys
....@@ -58,6 +46,9 @@
5846
5947 /** @size: size of hashtable */
6048 u32 size;
49
+
50
+ /** @generation: current (generation) sequence number */
51
+ atomic_t generation;
6152 };
6253
6354 /* allocates and clears the hash */
....@@ -112,6 +103,7 @@
112103
113104 /* no duplicate found in list, add new element */
114105 hlist_add_head_rcu(data_node, head);
106
+ atomic_inc(&hash->generation);
115107
116108 ret = 0;
117109
....@@ -154,6 +146,7 @@
154146
155147 data_save = node;
156148 hlist_del_rcu(node);
149
+ atomic_inc(&hash->generation);
157150 break;
158151 }
159152 spin_unlock_bh(&hash->list_locks[index]);