[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpXOaP4JmGW4-AcL6JYbzKq_Co_Z4pWiSh1B1i=4MsakEQ@mail.gmail.com>
Date: Mon, 31 Jul 2017 15:35:02 -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>, Shaohua Li <shli@...com>,
Eric Dumazet <eric.dumazet@...il.com>,
Florent Fourcot <flo@...rcot.fr>
Subject: Re: [PATCH V4 net 2/2] net: fix tcp reset packet flowlabel for ipv6
On Mon, Jul 31, 2017 at 3:19 PM, Shaohua Li <shli@...nel.org> wrote:
> static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
> __be32 flowlabel, bool autolabel,
> - struct flowi6 *fl6)
> + struct flowi6 *fl6, u32 hash)
> {
> - u32 hash;
> -
> /* @flowlabel may include more than a flow label, eg, the traffic class.
> * Here we want only the flow label value.
> */
> @@ -788,7 +786,8 @@ static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
> net->ipv6.sysctl.auto_flowlabels != IP6_AUTO_FLOW_LABEL_FORCED))
> return flowlabel;
>
> - hash = skb_get_hash_flowi6(skb, fl6);
> + if (skb)
> + hash = skb_get_hash_flowi6(skb, fl6);
Why not just move skb_get_hash_flowi6() to its caller?
This check is not necessary. If you don't want to touch
existing callers, you can just introduce a wrapper:
static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
__be32 flowlabel, bool autolabel,
struct flowi6 *fl6)
{
u32 hash = skb_get_hash_flowi6(skb, fl6);
return __ip6_make_flowlabel(net, flowlabel, autolabel, hash);
}
And your code can just call:
__ip6_make_flowlabel(net, flowlabel, autolabel, sk->sk_txhash);
Powered by blists - more mailing lists