| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * net/core/dst_cache.c - dst entry cache |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 166 | 162 | free_percpu(dst_cache->cache); |
|---|
| 167 | 163 | } |
|---|
| 168 | 164 | 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); |
|---|