diff options
author | David S. Miller <davem@davemloft.net> | 2011-07-14 10:53:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-14 10:53:20 -0400 |
commit | f6b72b6217f8c24f2a54988e58af858b4e66024d (patch) | |
tree | c59d5adcf9bb226db6f602c5078106052524cfea /include/linux/netdevice.h | |
parent | 390fd0b388e4f85549e5d60bdeb21364b344d9b9 (diff) |
net: Embed hh_cache inside of struct neighbour.
Now that there is a one-to-one correspondance between neighbour
and hh_cache entries, we no longer need:
1) dynamic allocation
2) attachment to dst->hh
3) refcounting
Initialization of the hh_cache entry is indicated by hh_len
being non-zero, and such initialization is always done with
the neighbour's lock held as a writer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 75382378a1ba..5ccc0cb8352b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -252,14 +252,7 @@ struct netdev_hw_addr_list { | |||
252 | netdev_hw_addr_list_for_each(ha, &(dev)->mc) | 252 | netdev_hw_addr_list_for_each(ha, &(dev)->mc) |
253 | 253 | ||
254 | struct hh_cache { | 254 | struct hh_cache { |
255 | atomic_t hh_refcnt; /* number of users */ | 255 | u16 hh_len; |
256 | /* | ||
257 | * We want hh_output, hh_len, hh_lock and hh_data be a in a separate | ||
258 | * cache line on SMP. | ||
259 | * They are mostly read, but hh_refcnt may be changed quite frequently, | ||
260 | * incurring cache line ping pongs. | ||
261 | */ | ||
262 | u16 hh_len ____cacheline_aligned_in_smp; | ||
263 | u16 __pad; | 256 | u16 __pad; |
264 | int (*hh_output)(struct sk_buff *skb); | 257 | int (*hh_output)(struct sk_buff *skb); |
265 | seqlock_t hh_lock; | 258 | seqlock_t hh_lock; |
@@ -273,12 +266,6 @@ struct hh_cache { | |||
273 | unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; | 266 | unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; |
274 | }; | 267 | }; |
275 | 268 | ||
276 | static inline void hh_cache_put(struct hh_cache *hh) | ||
277 | { | ||
278 | if (atomic_dec_and_test(&hh->hh_refcnt)) | ||
279 | kfree(hh); | ||
280 | } | ||
281 | |||
282 | /* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much. | 269 | /* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much. |
283 | * Alternative is: | 270 | * Alternative is: |
284 | * dev->hard_header_len ? (dev->hard_header_len + | 271 | * dev->hard_header_len ? (dev->hard_header_len + |