diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/net/neighbour.h | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'include/net/neighbour.h')
-rw-r--r-- | include/net/neighbour.h | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 0dab173e27d..2720884287c 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -59,7 +59,7 @@ struct neigh_parms { | |||
59 | int reachable_time; | 59 | int reachable_time; |
60 | int delay_probe_time; | 60 | int delay_probe_time; |
61 | 61 | ||
62 | int queue_len_bytes; | 62 | int queue_len; |
63 | int ucast_probes; | 63 | int ucast_probes; |
64 | int app_probes; | 64 | int app_probes; |
65 | int mcast_probes; | 65 | int mcast_probes; |
@@ -99,7 +99,6 @@ struct neighbour { | |||
99 | rwlock_t lock; | 99 | rwlock_t lock; |
100 | atomic_t refcnt; | 100 | atomic_t refcnt; |
101 | struct sk_buff_head arp_queue; | 101 | struct sk_buff_head arp_queue; |
102 | unsigned int arp_queue_len_bytes; | ||
103 | struct timer_list timer; | 102 | struct timer_list timer; |
104 | unsigned long used; | 103 | unsigned long used; |
105 | atomic_t probes; | 104 | atomic_t probes; |
@@ -139,12 +138,10 @@ struct pneigh_entry { | |||
139 | * neighbour table manipulation | 138 | * neighbour table manipulation |
140 | */ | 139 | */ |
141 | 140 | ||
142 | #define NEIGH_NUM_HASH_RND 4 | ||
143 | |||
144 | struct neigh_hash_table { | 141 | struct neigh_hash_table { |
145 | struct neighbour __rcu **hash_buckets; | 142 | struct neighbour __rcu **hash_buckets; |
146 | unsigned int hash_shift; | 143 | unsigned int hash_shift; |
147 | __u32 hash_rnd[NEIGH_NUM_HASH_RND]; | 144 | __u32 hash_rnd; |
148 | struct rcu_head rcu; | 145 | struct rcu_head rcu; |
149 | }; | 146 | }; |
150 | 147 | ||
@@ -156,7 +153,7 @@ struct neigh_table { | |||
156 | int key_len; | 153 | int key_len; |
157 | __u32 (*hash)(const void *pkey, | 154 | __u32 (*hash)(const void *pkey, |
158 | const struct net_device *dev, | 155 | const struct net_device *dev, |
159 | __u32 *hash_rnd); | 156 | __u32 hash_rnd); |
160 | int (*constructor)(struct neighbour *); | 157 | int (*constructor)(struct neighbour *); |
161 | int (*pconstructor)(struct pneigh_entry *); | 158 | int (*pconstructor)(struct pneigh_entry *); |
162 | void (*pdestructor)(struct pneigh_entry *); | 159 | void (*pdestructor)(struct pneigh_entry *); |
@@ -175,18 +172,12 @@ struct neigh_table { | |||
175 | atomic_t entries; | 172 | atomic_t entries; |
176 | rwlock_t lock; | 173 | rwlock_t lock; |
177 | unsigned long last_rand; | 174 | unsigned long last_rand; |
175 | struct kmem_cache *kmem_cachep; | ||
178 | struct neigh_statistics __percpu *stats; | 176 | struct neigh_statistics __percpu *stats; |
179 | struct neigh_hash_table __rcu *nht; | 177 | struct neigh_hash_table __rcu *nht; |
180 | struct pneigh_entry **phash_buckets; | 178 | struct pneigh_entry **phash_buckets; |
181 | }; | 179 | }; |
182 | 180 | ||
183 | #define NEIGH_PRIV_ALIGN sizeof(long long) | ||
184 | |||
185 | static inline void *neighbour_priv(const struct neighbour *n) | ||
186 | { | ||
187 | return (char *)n + ALIGN(sizeof(*n) + n->tbl->key_len, NEIGH_PRIV_ALIGN); | ||
188 | } | ||
189 | |||
190 | /* flags for neigh_update() */ | 181 | /* flags for neigh_update() */ |
191 | #define NEIGH_UPDATE_F_OVERRIDE 0x00000001 | 182 | #define NEIGH_UPDATE_F_OVERRIDE 0x00000001 |
192 | #define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002 | 183 | #define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002 |
@@ -195,6 +186,7 @@ static inline void *neighbour_priv(const struct neighbour *n) | |||
195 | #define NEIGH_UPDATE_F_ADMIN 0x80000000 | 186 | #define NEIGH_UPDATE_F_ADMIN 0x80000000 |
196 | 187 | ||
197 | extern void neigh_table_init(struct neigh_table *tbl); | 188 | extern void neigh_table_init(struct neigh_table *tbl); |
189 | extern void neigh_table_init_no_netlink(struct neigh_table *tbl); | ||
198 | extern int neigh_table_clear(struct neigh_table *tbl); | 190 | extern int neigh_table_clear(struct neigh_table *tbl); |
199 | extern struct neighbour * neigh_lookup(struct neigh_table *tbl, | 191 | extern struct neighbour * neigh_lookup(struct neigh_table *tbl, |
200 | const void *pkey, | 192 | const void *pkey, |
@@ -202,16 +194,9 @@ extern struct neighbour * neigh_lookup(struct neigh_table *tbl, | |||
202 | extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl, | 194 | extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl, |
203 | struct net *net, | 195 | struct net *net, |
204 | const void *pkey); | 196 | const void *pkey); |
205 | extern struct neighbour * __neigh_create(struct neigh_table *tbl, | 197 | extern struct neighbour * neigh_create(struct neigh_table *tbl, |
206 | const void *pkey, | ||
207 | struct net_device *dev, | ||
208 | bool want_ref); | ||
209 | static inline struct neighbour *neigh_create(struct neigh_table *tbl, | ||
210 | const void *pkey, | 198 | const void *pkey, |
211 | struct net_device *dev) | 199 | struct net_device *dev); |
212 | { | ||
213 | return __neigh_create(tbl, pkey, dev, true); | ||
214 | } | ||
215 | extern void neigh_destroy(struct neighbour *neigh); | 200 | extern void neigh_destroy(struct neighbour *neigh); |
216 | extern int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb); | 201 | extern int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb); |
217 | extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, | 202 | extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, |
@@ -309,6 +294,12 @@ static inline struct neighbour * neigh_clone(struct neighbour *neigh) | |||
309 | 294 | ||
310 | #define neigh_hold(n) atomic_inc(&(n)->refcnt) | 295 | #define neigh_hold(n) atomic_inc(&(n)->refcnt) |
311 | 296 | ||
297 | static inline void neigh_confirm(struct neighbour *neigh) | ||
298 | { | ||
299 | if (neigh) | ||
300 | neigh->confirmed = jiffies; | ||
301 | } | ||
302 | |||
312 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | 303 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) |
313 | { | 304 | { |
314 | unsigned long now = jiffies; | 305 | unsigned long now = jiffies; |
@@ -323,7 +314,7 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | |||
323 | #ifdef CONFIG_BRIDGE_NETFILTER | 314 | #ifdef CONFIG_BRIDGE_NETFILTER |
324 | static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) | 315 | static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) |
325 | { | 316 | { |
326 | unsigned int seq, hh_alen; | 317 | unsigned seq, hh_alen; |
327 | 318 | ||
328 | do { | 319 | do { |
329 | seq = read_seqbegin(&hh->hh_lock); | 320 | seq = read_seqbegin(&hh->hh_lock); |
@@ -334,28 +325,33 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) | |||
334 | } | 325 | } |
335 | #endif | 326 | #endif |
336 | 327 | ||
337 | static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb) | 328 | static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) |
338 | { | 329 | { |
339 | unsigned int seq; | 330 | unsigned seq; |
340 | int hh_len; | 331 | int hh_len; |
341 | 332 | ||
342 | do { | 333 | do { |
334 | int hh_alen; | ||
335 | |||
343 | seq = read_seqbegin(&hh->hh_lock); | 336 | seq = read_seqbegin(&hh->hh_lock); |
344 | hh_len = hh->hh_len; | 337 | hh_len = hh->hh_len; |
345 | if (likely(hh_len <= HH_DATA_MOD)) { | 338 | hh_alen = HH_DATA_ALIGN(hh_len); |
346 | /* this is inlined by gcc */ | 339 | memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); |
347 | memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD); | ||
348 | } else { | ||
349 | int hh_alen = HH_DATA_ALIGN(hh_len); | ||
350 | |||
351 | memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); | ||
352 | } | ||
353 | } while (read_seqretry(&hh->hh_lock, seq)); | 340 | } while (read_seqretry(&hh->hh_lock, seq)); |
354 | 341 | ||
355 | skb_push(skb, hh_len); | 342 | skb_push(skb, hh_len); |
356 | return dev_queue_xmit(skb); | 343 | return dev_queue_xmit(skb); |
357 | } | 344 | } |
358 | 345 | ||
346 | static inline int neigh_output(struct neighbour *n, struct sk_buff *skb) | ||
347 | { | ||
348 | struct hh_cache *hh = &n->hh; | ||
349 | if ((n->nud_state & NUD_CONNECTED) && hh->hh_len) | ||
350 | return neigh_hh_output(hh, skb); | ||
351 | else | ||
352 | return n->output(n, skb); | ||
353 | } | ||
354 | |||
359 | static inline struct neighbour * | 355 | static inline struct neighbour * |
360 | __neigh_lookup(struct neigh_table *tbl, const void *pkey, struct net_device *dev, int creat) | 356 | __neigh_lookup(struct neigh_table *tbl, const void *pkey, struct net_device *dev, int creat) |
361 | { | 357 | { |