Re: [PATCH net V3 2/2] net: fix tcp reset packet flowlabel for ipv6
From: Cong Wang <hidden>
Date: 2017-07-31 18:10:59
From: Cong Wang <hidden>
Date: 2017-07-31 18:10:59
On Mon, Jul 31, 2017 at 10:08 AM, Shaohua Li [off-list ref] 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?