aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/dst_ops.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/net/dst_ops.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/net/dst_ops.h')
-rw-r--r--include/net/dst_ops.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index d1ff9b7e99b8..dc0746328947 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -1,6 +1,8 @@
1#ifndef _NET_DST_OPS_H 1#ifndef _NET_DST_OPS_H
2#define _NET_DST_OPS_H 2#define _NET_DST_OPS_H
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/percpu_counter.h>
5#include <linux/cache.h>
4 6
5struct dst_entry; 7struct dst_entry;
6struct kmem_cachep; 8struct kmem_cachep;
@@ -14,6 +16,9 @@ struct dst_ops {
14 16
15 int (*gc)(struct dst_ops *ops); 17 int (*gc)(struct dst_ops *ops);
16 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); 18 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
19 unsigned int (*default_advmss)(const struct dst_entry *);
20 unsigned int (*default_mtu)(const struct dst_entry *);
21 u32 * (*cow_metrics)(struct dst_entry *, unsigned long);
17 void (*destroy)(struct dst_entry *); 22 void (*destroy)(struct dst_entry *);
18 void (*ifdown)(struct dst_entry *, 23 void (*ifdown)(struct dst_entry *,
19 struct net_device *dev, int how); 24 struct net_device *dev, int how);
@@ -22,7 +27,41 @@ struct dst_ops {
22 void (*update_pmtu)(struct dst_entry *dst, u32 mtu); 27 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
23 int (*local_out)(struct sk_buff *skb); 28 int (*local_out)(struct sk_buff *skb);
24 29
25 atomic_t entries;
26 struct kmem_cache *kmem_cachep; 30 struct kmem_cache *kmem_cachep;
31
32 struct percpu_counter pcpuc_entries ____cacheline_aligned_in_smp;
27}; 33};
34
35static inline int dst_entries_get_fast(struct dst_ops *dst)
36{
37 return percpu_counter_read_positive(&dst->pcpuc_entries);
38}
39
40static inline int dst_entries_get_slow(struct dst_ops *dst)
41{
42 int res;
43
44 local_bh_disable();
45 res = percpu_counter_sum_positive(&dst->pcpuc_entries);
46 local_bh_enable();
47 return res;
48}
49
50static inline void dst_entries_add(struct dst_ops *dst, int val)
51{
52 local_bh_disable();
53 percpu_counter_add(&dst->pcpuc_entries, val);
54 local_bh_enable();
55}
56
57static inline int dst_entries_init(struct dst_ops *dst)
58{
59 return percpu_counter_init(&dst->pcpuc_entries, 0);
60}
61
62static inline void dst_entries_destroy(struct dst_ops *dst)
63{
64 percpu_counter_destroy(&dst->pcpuc_entries);
65}
66
28#endif 67#endif