Subject: Re: [PATCH v3 net-next 1/2] ipv4: L3 hash-based multipath

From: David Ahern <[email-masked]>
Date: Mon, 21 Sep 2015 10:52:13 -0600

On 9/15/15 2:29 PM, Peter Nørlund wrote:
> @@ -1094,8 +1142,15 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
>
>   	change_nexthops(fi) {
>   		fib_info_update_nh_saddr(net, nexthop_nh);
> +#ifdef CONFIG_IP_ROUTE_MULTIPATH
> +		fi->fib_weight += nexthop_nh->nh_weight;
> +#endif
>   	} endfor_nexthops(fi)
>
> +#ifdef CONFIG_IP_ROUTE_MULTIPATH
> +	fib_rebalance(fi);
> +#endif

The ifdefs everywhere make this harder to read. Just have a second 
definition above for fib_rebalance(fi) when CONFIG_IP_ROUTE_MULTIPATH is 
not defined.

Similarly an inlined macro of fi->fib_weight that compiles out if 
CONFIG_IP_ROUTE_MULTIPATH is not defined.

David