hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/net/core/dst_cache.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * net/core/dst_cache.c - dst entry cache
34 *
45 * Copyright (c) 2016 Paolo Abeni <pabeni@redhat.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
106 */
117
128 #include <linux/kernel.h>
....@@ -166,3 +162,22 @@
166162 free_percpu(dst_cache->cache);
167163 }
168164 EXPORT_SYMBOL_GPL(dst_cache_destroy);
165
+
166
+void dst_cache_reset_now(struct dst_cache *dst_cache)
167
+{
168
+ int i;
169
+
170
+ if (!dst_cache->cache)
171
+ return;
172
+
173
+ dst_cache->reset_ts = jiffies;
174
+ for_each_possible_cpu(i) {
175
+ struct dst_cache_pcpu *idst = per_cpu_ptr(dst_cache->cache, i);
176
+ struct dst_entry *dst = idst->dst;
177
+
178
+ idst->cookie = 0;
179
+ idst->dst = NULL;
180
+ dst_release(dst);
181
+ }
182
+}
183
+EXPORT_SYMBOL_GPL(dst_cache_reset_now);