From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f66.google.com ([74.125.83.66]:46179 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753656AbeBUSuJ (ORCPT ); Wed, 21 Feb 2018 13:50:09 -0500 Received: by mail-pg0-f66.google.com with SMTP id m1so987304pgp.13 for ; Wed, 21 Feb 2018 10:50:09 -0800 (PST) From: David Ahern To: netdev@vger.kernel.org Cc: idosch@idosch.org, tom@herbertland.com, davem@davemloft.net, roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, David Ahern Subject: [PATCH net-next 3/7] net/ipv6: Make rt6_multipath_hash similar to fib_multipath_hash Date: Wed, 21 Feb 2018 10:49:50 -0800 Message-Id: <20180221184954.28875-4-dsahern@gmail.com> In-Reply-To: <20180221184954.28875-1-dsahern@gmail.com> References: <20180221184954.28875-1-dsahern@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: Make rt6_multipath_hash more of a direct parallel to fib_multipath_hash and reduce stack and overhead in the process: get_hash_from_flowi6 is just a wrapper around __get_hash_from_flowi6 with another stack allocation for flow_keys. Move setting the addresses, protocol and label into rt6_multipath_hash and allow it to make the call to flow_hash_from_keys. Signed-off-by: David Ahern --- net/ipv6/route.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ff43add1619d..ab0de69ec67d 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1822,15 +1822,21 @@ static void ip6_multipath_l3_keys(const struct sk_buff *skb, u32 rt6_multipath_hash(const struct flowi6 *fl6, const struct sk_buff *skb) { struct flow_keys hash_keys; + u32 mhash; + memset(&hash_keys, 0, sizeof(hash_keys)); + hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; if (skb) { - memset(&hash_keys, 0, sizeof(hash_keys)); - hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; ip6_multipath_l3_keys(skb, &hash_keys); - return flow_hash_from_keys(&hash_keys) >> 1; + } else { + hash_keys.addrs.v6addrs.src = fl6->saddr; + hash_keys.addrs.v6addrs.dst = fl6->daddr; + hash_keys.tags.flow_label = (__force u32)fl6->flowlabel; + hash_keys.basic.ip_proto = fl6->flowi6_proto; } + mhash = flow_hash_from_keys(&hash_keys); - return get_hash_from_flowi6(fl6) >> 1; + return mhash >> 1; } void ip6_route_input(struct sk_buff *skb) -- 2.11.0