* [PATCH] net: neigh: make ->hh_len 32-bit
@ 2017-04-10 8:11 Alexey Dobriyan
2017-04-12 17:59 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2017-04-10 8:11 UTC (permalink / raw)
To: davem; +Cc: netdev
Using 16-bit ->hh_len doesn't save any memory, save some .text instead:
add/remove: 0/0 grow/shrink: 1/6 up/down: 2/-19 (-17)
function old new delta
neigh_update 2312 2314 +2
fwnet_header_cache 199 197 -2
eth_header_cache 101 99 -2
ip6_finish_output2 2371 2368 -3
vrf_finish_output6 1522 1518 -4
vrf_finish_output 1413 1409 -4
ip_finish_output2 1627 1623 -4
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
include/linux/netdevice.h | 3 +--
include/net/neighbour.h | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -237,8 +237,7 @@ struct netdev_hw_addr_list {
netdev_hw_addr_list_for_each(ha, &(dev)->mc)
struct hh_cache {
- u16 hh_len;
- u16 __pad;
+ unsigned int hh_len;
seqlock_t hh_lock;
/* cached hardware header; allow for machine alignment needs. */
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -450,7 +450,7 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb)
{
unsigned int seq;
- int hh_len;
+ unsigned int hh_len;
do {
seq = read_seqbegin(&hh->hh_lock);
@@ -459,7 +459,7 @@ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb
/* this is inlined by gcc */
memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD);
} else {
- int hh_alen = HH_DATA_ALIGN(hh_len);
+ unsigned int hh_alen = HH_DATA_ALIGN(hh_len);
memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net: neigh: make ->hh_len 32-bit
2017-04-10 8:11 [PATCH] net: neigh: make ->hh_len 32-bit Alexey Dobriyan
@ 2017-04-12 17:59 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-04-12 17:59 UTC (permalink / raw)
To: adobriyan; +Cc: netdev
From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Mon, 10 Apr 2017 11:11:17 +0300
> Using 16-bit ->hh_len doesn't save any memory, save some .text instead:
>
> add/remove: 0/0 grow/shrink: 1/6 up/down: 2/-19 (-17)
> function old new delta
> neigh_update 2312 2314 +2
> fwnet_header_cache 199 197 -2
> eth_header_cache 101 99 -2
> ip6_finish_output2 2371 2368 -3
> vrf_finish_output6 1522 1518 -4
> vrf_finish_output 1413 1409 -4
> ip_finish_output2 1627 1623 -4
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-12 17:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-10 8:11 [PATCH] net: neigh: make ->hh_len 32-bit Alexey Dobriyan
2017-04-12 17:59 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).