[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9aecd068-1fe4-7d83-6fc5-87ec90d69c13@gmail.com>
Date: Fri, 28 Sep 2018 11:47:48 -0600
From: David Ahern <dsahern@...il.com>
To: Maciej Żenczykowski <zenczykowski@...il.com>,
Maciej Żenczykowski <maze@...gle.com>,
"David S . Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH 03/11] net: fib_multipath_hash() - use new style struct
initializer instead of memset
On 9/27/18 5:00 PM, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@...gle.com>
>
> Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
> ---
> net/ipv4/route.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 048919713f4e..17953a52fbd0 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1821,12 +1821,11 @@ static void ip_multipath_l3_keys(const struct sk_buff *skb,
> int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4,
> const struct sk_buff *skb, struct flow_keys *flkeys)
> {
> - struct flow_keys hash_keys;
> + struct flow_keys hash_keys = {};
> u32 mhash;
>
> switch (net->ipv4.sysctl_fib_multipath_hash_policy) {
> case 0:
> - memset(&hash_keys, 0, sizeof(hash_keys));
> hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
> if (skb) {
> ip_multipath_l3_keys(skb, &hash_keys);
> @@ -1845,8 +1844,6 @@ int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4,
> if (skb->l4_hash)
> return skb_get_hash_raw(skb) >> 1;
>
> - memset(&hash_keys, 0, sizeof(hash_keys));
> -
> if (!flkeys) {
> skb_flow_dissect_flow_keys(skb, &keys, flag);
> flkeys = &keys;
> @@ -1859,7 +1856,6 @@ int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4,
> hash_keys.ports.dst = flkeys->ports.dst;
> hash_keys.basic.ip_proto = flkeys->basic.ip_proto;
> } else {
> - memset(&hash_keys, 0, sizeof(hash_keys));
> hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
> hash_keys.addrs.v4addrs.src = fl4->saddr;
> hash_keys.addrs.v4addrs.dst = fl4->daddr;
>
NACK on this one.
This is the hot path and the memset was done right before use for least
overhead.
Powered by blists - more mailing lists