lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171206213505.17018-2-adobriyan@gmail.com>
Date:   Thu,  7 Dec 2017 00:35:04 +0300
From:   Alexey Dobriyan <adobriyan@...il.com>
To:     davem@...emloft.net
Cc:     netdev@...r.kernel.org, Alexey Dobriyan <adobriyan@...il.com>
Subject: [PATCH 2/3] net: dst: switch to 8-bit dst->flags

None of the flags is 16-bit currently.

Space savings on x86_64:

	add/remove: 0/0 grow/shrink: 2/16 up/down: 7/-29 (-22)
	Function                                     old     new   delta
	netdev_frame_hook                            464     470      +6
	gre_fill_metadata_dst                        257     258      +1
	xfrm_resolve_and_create_bundle              2817    2816      -1
	ipv6_add_addr                               1724    1723      -1
	ip6_rt_cache_alloc                           472     471      -1
	ip6_route_info_create                       2955    2954      -1
	icmp6_dst_alloc                              569     568      -1
	dst_init                                     166     165      -1
	dev_fill_metadata_dst                        395     394      -1
	bnxt_start_xmit                             3119    3118      -1
	arp_process                                 2524    2523      -1
	addrconf_dst_alloc                           442     441      -1
	xfrm_lookup                                 2029    2027      -2
	ip6_tnl_xmit                                2965    2963      -2
	rt_dst_alloc                                 200     197      -3
	do_execute_actions                          2799    2796      -3
	addrconf_disable_policy_idev                 449     445      -4
	br_netfilter_rtable_init                      66      61      -5

Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
 include/net/dst.h | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index 0f0905bda423..25decfa4e14a 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -31,7 +31,7 @@
  */
 
 struct sk_buff;
-typedef unsigned short __bitwise dst_flags_t;
+typedef u8 __bitwise dst_flags_t;
 
 struct dst_entry {
 	struct net_device       *dev;
@@ -47,14 +47,15 @@ struct dst_entry {
 	int			(*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
 
 	dst_flags_t		flags;
-#define DST_HOST		((dst_flags_t __force)0x0001)
-#define DST_NOXFRM		((dst_flags_t __force)0x0002)
-#define DST_NOPOLICY		((dst_flags_t __force)0x0004)
-#define DST_NOCOUNT		((dst_flags_t __force)0x0008)
-#define DST_FAKE_RTABLE		((dst_flags_t __force)0x0010)
-#define DST_XFRM_TUNNEL		((dst_flags_t __force)0x0020)
-#define DST_XFRM_QUEUE		((dst_flags_t __force)0x0040)
-#define DST_METADATA		((dst_flags_t __force)0x0080)
+#define DST_HOST		((dst_flags_t __force)0x01)
+#define DST_NOXFRM		((dst_flags_t __force)0x02)
+#define DST_NOPOLICY		((dst_flags_t __force)0x04)
+#define DST_NOCOUNT		((dst_flags_t __force)0x08)
+#define DST_FAKE_RTABLE		((dst_flags_t __force)0x10)
+#define DST_XFRM_TUNNEL		((dst_flags_t __force)0x20)
+#define DST_XFRM_QUEUE		((dst_flags_t __force)0x40)
+#define DST_METADATA		((dst_flags_t __force)0x80)
+	u8			__pad2;
 
 	/* A non-zero value of dst->obsolete forces by-hand validation
 	 * of the route entry.  Positive values are set by the generic
-- 
2.13.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ