On Mon, Jul 31, 2017 at 10:08 AM, Shaohua Li <s...@kernel.org> wrote:
> +/* Like ip6_make_flowlabel, but already has hash */
> +static inline __be32 ip6_make_flowlabel_from_hash(struct net *net,
> +                                                 bool autolabel, u32 hash)
> +{
> +       __be32 flowlabel;
> +
> +       if (net->ipv6.sysctl.auto_flowlabels == IP6_AUTO_FLOW_LABEL_OFF ||
> +           (!autolabel &&
> +            net->ipv6.sysctl.auto_flowlabels != IP6_AUTO_FLOW_LABEL_FORCED))
> +               return 0;
> +
> +       flowlabel = (__force __be32)hash & IPV6_FLOWLABEL_MASK;
> +
> +       if (net->ipv6.sysctl.flowlabel_state_ranges)
> +               flowlabel |= IPV6_FLOWLABEL_STATELESS_FLAG;
> +
> +       return flowlabel;
> +}

I still don't see why you have to duplicate the code,
for me you can just refactor ip6_make_flowlabel()
and pass the hash as a parameter and pass
'flowlabel' as 0, and no run-time overhead.

Or I am missing anything?

Reply via email to