public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfrm: use "unsigned int" in __xfrm6_pref_hash()
@ 2017-03-23 22:53 Alexey Dobriyan
  2017-03-27 10:36 ` Steffen Klassert
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2017-03-23 22:53 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, davem, netdev

x86_64 is zero-extending arch so "unsigned int" is preferred over "int"
for address calculations.

Space savings:

	add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-58 (-58)
	function                                     old     new   delta
	xfrm_hash_resize                            2752    2743      -9
	policy_hash_bysel                            985     973     -12
	policy_hash_direct                          1036     999     -37

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 net/xfrm/xfrm_hash.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/xfrm/xfrm_hash.h
+++ b/net/xfrm/xfrm_hash.h
@@ -54,8 +54,8 @@ static inline unsigned int __xfrm4_dpref_spref_hash(const xfrm_address_t *daddr,
 static inline unsigned int __xfrm6_pref_hash(const xfrm_address_t *addr,
 					     __u8 prefixlen)
 {
-	int pdw;
-	int pbi;
+	unsigned int pdw;
+	unsigned int pbi;
 	u32 initval = 0;
 
 	pdw = prefixlen >> 5;     /* num of whole u32 in prefix */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfrm: use "unsigned int" in __xfrm6_pref_hash()
  2017-03-23 22:53 [PATCH] xfrm: use "unsigned int" in __xfrm6_pref_hash() Alexey Dobriyan
@ 2017-03-27 10:36 ` Steffen Klassert
  0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2017-03-27 10:36 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: herbert, davem, netdev

On Fri, Mar 24, 2017 at 01:53:09AM +0300, Alexey Dobriyan wrote:
> x86_64 is zero-extending arch so "unsigned int" is preferred over "int"
> for address calculations.
> 
> Space savings:
> 
> 	add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-58 (-58)
> 	function                                     old     new   delta
> 	xfrm_hash_resize                            2752    2743      -9
> 	policy_hash_bysel                            985     973     -12
> 	policy_hash_direct                          1036     999     -37
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

Applied to ipsec-next, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-27 10:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-23 22:53 [PATCH] xfrm: use "unsigned int" in __xfrm6_pref_hash() Alexey Dobriyan
2017-03-27 10:36 ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox