patch-2.1.79 linux/net/core/dst.c
Next file: linux/net/core/iovec.c
Previous file: linux/net/core/dev_mcast.c
Back to the patch index
Back to the overall index
- Lines: 46
- Date:
Mon Jan 12 15:28:19 1998
- Orig file:
v2.1.78/linux/net/core/dst.c
- Orig date:
Wed Apr 23 19:01:29 1997
diff -u --recursive --new-file v2.1.78/linux/net/core/dst.c linux/net/core/dst.c
@@ -58,9 +58,8 @@
dst_gc_timer_inc += DST_GC_INC;
dst_gc_timer.expires = jiffies + dst_gc_timer_expires;
#if RT_CACHE_DEBUG >= 2
- printk("dst_total: %d/%d/%d %ld\n",
- atomic_read(&dst_total), delayed,
- atomic_read(&hh_count), dst_gc_timer_expires);
+ printk("dst_total: %d/%d %ld\n",
+ atomic_read(&dst_total), delayed, dst_gc_timer_expires);
#endif
add_timer(&dst_gc_timer);
}
@@ -85,7 +84,7 @@
return NULL;
memset(dst, 0, size);
dst->ops = ops;
- atomic_set(&dst->refcnt, 1);
+ atomic_set(&dst->refcnt, 0);
dst->lastuse = jiffies;
dst->input = dst_discard;
dst->output = dst_blackhole;
@@ -107,4 +106,24 @@
add_timer(&dst_gc_timer);
}
end_bh_atomic();
+}
+
+void dst_destroy(struct dst_entry * dst)
+{
+ struct neighbour *neigh = dst->neighbour;
+ struct hh_cache *hh = dst->hh;
+
+ dst->hh = NULL;
+ if (hh && atomic_dec_and_test(&hh->hh_refcnt))
+ kfree(hh);
+
+ if (neigh) {
+ dst->neighbour = NULL;
+ neigh_release(neigh);
+ }
+
+ if (dst->ops->destroy)
+ dst->ops->destroy(dst);
+ atomic_dec(&dst_total);
+ kfree(dst);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov