dst.c (df3872a9664667edae729361c9948b652de5c6f4) dst.c (e9dc86534051b78e41e5b746cccc291b57a3a311)
1/*
2 * net/core/dst.c Protocol independent destination cache.
3 *
4 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
5 *
6 */
7
8#include <linux/bitops.h>
9#include <linux/errno.h>
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/mm.h>
13#include <linux/module.h>
14#include <linux/netdevice.h>
15#include <linux/skbuff.h>
16#include <linux/string.h>
17#include <linux/types.h>
1/*
2 * net/core/dst.c Protocol independent destination cache.
3 *
4 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
5 *
6 */
7
8#include <linux/bitops.h>
9#include <linux/errno.h>
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/mm.h>
13#include <linux/module.h>
14#include <linux/netdevice.h>
15#include <linux/skbuff.h>
16#include <linux/string.h>
17#include <linux/types.h>
18#include <net/net_namespace.h>
18
19#include <net/dst.h>
20
21/* Locking strategy:
22 * 1) Garbage collection state of dead destination cache
23 * entries is protected by dst_lock.
24 * 2) GC is run only from BH context, and is the only remover
25 * of entries.

--- 221 unchanged lines hidden (view full) ---

247 }
248}
249
250static int dst_dev_event(struct notifier_block *this, unsigned long event, void *ptr)
251{
252 struct net_device *dev = ptr;
253 struct dst_entry *dst;
254
19
20#include <net/dst.h>
21
22/* Locking strategy:
23 * 1) Garbage collection state of dead destination cache
24 * entries is protected by dst_lock.
25 * 2) GC is run only from BH context, and is the only remover
26 * of entries.

--- 221 unchanged lines hidden (view full) ---

248 }
249}
250
251static int dst_dev_event(struct notifier_block *this, unsigned long event, void *ptr)
252{
253 struct net_device *dev = ptr;
254 struct dst_entry *dst;
255
256 if (dev->nd_net != &init_net)
257 return NOTIFY_DONE;
258
255 switch (event) {
256 case NETDEV_UNREGISTER:
257 case NETDEV_DOWN:
258 spin_lock_bh(&dst_lock);
259 for (dst = dst_garbage_list; dst; dst = dst->next) {
260 dst_ifdown(dst, dev, event != NETDEV_DOWN);
261 }
262 spin_unlock_bh(&dst_lock);

--- 17 unchanged lines hidden ---
259 switch (event) {
260 case NETDEV_UNREGISTER:
261 case NETDEV_DOWN:
262 spin_lock_bh(&dst_lock);
263 for (dst = dst_garbage_list; dst; dst = dst->next) {
264 dst_ifdown(dst, dev, event != NETDEV_DOWN);
265 }
266 spin_unlock_bh(&dst_lock);

--- 17 unchanged lines hidden ---