[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpV-=OxeGyS1ie62x-_+w2pN_V-yxQ0jP3HfjYxo+k_k-A@mail.gmail.com>
Date: Mon, 31 Jul 2017 11:10:38 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Shaohua Li <shli@...nel.org>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
kernel-team <Kernel-team@...com>, Shaohua Li <shli@...com>,
Eric Dumazet <eric.dumazet@...il.com>,
Florent Fourcot <flo@...rcot.fr>
Subject: Re: [PATCH net V3 2/2] net: fix tcp reset packet flowlabel for ipv6
On Mon, Jul 31, 2017 at 10:08 AM, Shaohua Li <shli@...nel.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?
Powered by blists - more mailing lists