netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: sched: cls_u32: use hash_ptr() for tc_u_hash
@ 2017-10-18  8:33 Arnd Bergmann
  2017-10-18  8:39 ` Jiri Pirko
  2017-10-20  7:36 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-10-18  8:33 UTC (permalink / raw)
  To: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S. Miller
  Cc: Arnd Bergmann, netdev, linux-kernel

After the change to the tp hash, we now get a build warning
on 32-bit architectures:

net/sched/cls_u32.c: In function 'tc_u_hash':
net/sched/cls_u32.c:338:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  return hash_64((u64) tp->chain->block, U32_HASH_SHIFT);

Using hash_ptr() instead of hash_64() lets us drop the cast
and fixes the warning while still resulting in the same hash
value.

Fixes: 7fa9d974f3c2 ("net: sched: cls_u32: use block instead of q in tc_u_common")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 net/sched/cls_u32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index b6d46065f661..49d96b45a8ce 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -335,7 +335,7 @@ static struct hlist_head *tc_u_common_hash;
 
 static unsigned int tc_u_hash(const struct tcf_proto *tp)
 {
-	return hash_64((u64) tp->chain->block, U32_HASH_SHIFT);
+	return hash_ptr(tp->chain->block, U32_HASH_SHIFT);
 }
 
 static struct tc_u_common *tc_u_common_find(const struct tcf_proto *tp)
-- 
2.9.0

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

* Re: [PATCH net-next] net: sched: cls_u32: use hash_ptr() for tc_u_hash
  2017-10-18  8:33 [PATCH net-next] net: sched: cls_u32: use hash_ptr() for tc_u_hash Arnd Bergmann
@ 2017-10-18  8:39 ` Jiri Pirko
  2017-10-20  7:36 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2017-10-18  8:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jamal Hadi Salim, Cong Wang, David S. Miller, netdev,
	linux-kernel

Wed, Oct 18, 2017 at 10:33:37AM CEST, arnd@arndb.de wrote:
>After the change to the tp hash, we now get a build warning
>on 32-bit architectures:
>
>net/sched/cls_u32.c: In function 'tc_u_hash':
>net/sched/cls_u32.c:338:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>  return hash_64((u64) tp->chain->block, U32_HASH_SHIFT);
>
>Using hash_ptr() instead of hash_64() lets us drop the cast
>and fixes the warning while still resulting in the same hash
>value.
>
>Fixes: 7fa9d974f3c2 ("net: sched: cls_u32: use block instead of q in tc_u_common")
>Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Jiri Pirko <jiri@mellanox.com>

Thanks.

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

* Re: [PATCH net-next] net: sched: cls_u32: use hash_ptr() for tc_u_hash
  2017-10-18  8:33 [PATCH net-next] net: sched: cls_u32: use hash_ptr() for tc_u_hash Arnd Bergmann
  2017-10-18  8:39 ` Jiri Pirko
@ 2017-10-20  7:36 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-10-20  7:36 UTC (permalink / raw)
  To: arnd; +Cc: jhs, xiyou.wangcong, jiri, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 18 Oct 2017 10:33:37 +0200

> After the change to the tp hash, we now get a build warning
> on 32-bit architectures:
> 
> net/sched/cls_u32.c: In function 'tc_u_hash':
> net/sched/cls_u32.c:338:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>   return hash_64((u64) tp->chain->block, U32_HASH_SHIFT);
> 
> Using hash_ptr() instead of hash_64() lets us drop the cast
> and fixes the warning while still resulting in the same hash
> value.
> 
> Fixes: 7fa9d974f3c2 ("net: sched: cls_u32: use block instead of q in tc_u_common")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied.

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

end of thread, other threads:[~2017-10-20  7:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-18  8:33 [PATCH net-next] net: sched: cls_u32: use hash_ptr() for tc_u_hash Arnd Bergmann
2017-10-18  8:39 ` Jiri Pirko
2017-10-20  7:36 ` 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).