dst.c (42249094f79422fbf5ed4b54eeb48ff096809b8f) | dst.c (aad88724c9d54acb1a9737cb6069d8470fa85f74) |
---|---|
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> --- 128 unchanged lines hidden (view full) --- 137 expires = round_jiffies_relative(expires); 138 schedule_delayed_work(&dst_gc_work, expires); 139 } 140 141 spin_unlock_bh(&dst_garbage.lock); 142 mutex_unlock(&dst_gc_mutex); 143} 144 | 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> --- 128 unchanged lines hidden (view full) --- 137 expires = round_jiffies_relative(expires); 138 schedule_delayed_work(&dst_gc_work, expires); 139 } 140 141 spin_unlock_bh(&dst_garbage.lock); 142 mutex_unlock(&dst_gc_mutex); 143} 144 |
145int dst_discard(struct sk_buff *skb) | 145int dst_discard_sk(struct sock *sk, struct sk_buff *skb) |
146{ 147 kfree_skb(skb); 148 return 0; 149} | 146{ 147 kfree_skb(skb); 148 return 0; 149} |
150EXPORT_SYMBOL(dst_discard); | 150EXPORT_SYMBOL(dst_discard_sk); |
151 152const u32 dst_default_metrics[RTAX_MAX + 1] = { 153 /* This initializer is needed to force linker to place this variable 154 * into const section. Otherwise it might end into bss section. 155 * We really want to avoid false sharing on this variable, and catch 156 * any writes on it. 157 */ 158 [RTAX_MAX] = 0xdeadbeef, --- 20 unchanged lines hidden (view full) --- 179 dst_init_metrics(dst, dst_default_metrics, true); 180 dst->expires = 0UL; 181 dst->path = dst; 182 dst->from = NULL; 183#ifdef CONFIG_XFRM 184 dst->xfrm = NULL; 185#endif 186 dst->input = dst_discard; | 151 152const u32 dst_default_metrics[RTAX_MAX + 1] = { 153 /* This initializer is needed to force linker to place this variable 154 * into const section. Otherwise it might end into bss section. 155 * We really want to avoid false sharing on this variable, and catch 156 * any writes on it. 157 */ 158 [RTAX_MAX] = 0xdeadbeef, --- 20 unchanged lines hidden (view full) --- 179 dst_init_metrics(dst, dst_default_metrics, true); 180 dst->expires = 0UL; 181 dst->path = dst; 182 dst->from = NULL; 183#ifdef CONFIG_XFRM 184 dst->xfrm = NULL; 185#endif 186 dst->input = dst_discard; |
187 dst->output = dst_discard; | 187 dst->output = dst_discard_sk; |
188 dst->error = 0; 189 dst->obsolete = initial_obsolete; 190 dst->header_len = 0; 191 dst->trailer_len = 0; 192#ifdef CONFIG_IP_ROUTE_CLASSID 193 dst->tclassid = 0; 194#endif 195 atomic_set(&dst->__refcnt, initial_ref); --- 8 unchanged lines hidden (view full) --- 204} 205EXPORT_SYMBOL(dst_alloc); 206 207static void ___dst_free(struct dst_entry *dst) 208{ 209 /* The first case (dev==NULL) is required, when 210 protocol module is unloaded. 211 */ | 188 dst->error = 0; 189 dst->obsolete = initial_obsolete; 190 dst->header_len = 0; 191 dst->trailer_len = 0; 192#ifdef CONFIG_IP_ROUTE_CLASSID 193 dst->tclassid = 0; 194#endif 195 atomic_set(&dst->__refcnt, initial_ref); --- 8 unchanged lines hidden (view full) --- 204} 205EXPORT_SYMBOL(dst_alloc); 206 207static void ___dst_free(struct dst_entry *dst) 208{ 209 /* The first case (dev==NULL) is required, when 210 protocol module is unloaded. 211 */ |
212 if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) 213 dst->input = dst->output = dst_discard; | 212 if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) { 213 dst->input = dst_discard; 214 dst->output = dst_discard_sk; 215 } |
214 dst->obsolete = DST_OBSOLETE_DEAD; 215} 216 217void __dst_free(struct dst_entry *dst) 218{ 219 spin_lock_bh(&dst_garbage.lock); 220 ___dst_free(dst); 221 dst->next = dst_garbage.list; --- 134 unchanged lines hidden (view full) --- 356{ 357 if (dst->ops->ifdown) 358 dst->ops->ifdown(dst, dev, unregister); 359 360 if (dev != dst->dev) 361 return; 362 363 if (!unregister) { | 216 dst->obsolete = DST_OBSOLETE_DEAD; 217} 218 219void __dst_free(struct dst_entry *dst) 220{ 221 spin_lock_bh(&dst_garbage.lock); 222 ___dst_free(dst); 223 dst->next = dst_garbage.list; --- 134 unchanged lines hidden (view full) --- 358{ 359 if (dst->ops->ifdown) 360 dst->ops->ifdown(dst, dev, unregister); 361 362 if (dev != dst->dev) 363 return; 364 365 if (!unregister) { |
364 dst->input = dst->output = dst_discard; | 366 dst->input = dst_discard; 367 dst->output = dst_discard_sk; |
365 } else { 366 dst->dev = dev_net(dst->dev)->loopback_dev; 367 dev_hold(dst->dev); 368 dev_put(dev); 369 } 370} 371 372static int dst_dev_event(struct notifier_block *this, unsigned long event, --- 40 unchanged lines hidden --- | 368 } else { 369 dst->dev = dev_net(dst->dev)->loopback_dev; 370 dev_hold(dst->dev); 371 dev_put(dev); 372 } 373} 374 375static int dst_dev_event(struct notifier_block *this, unsigned long event, --- 40 unchanged lines hidden --- |