On Thu, May 21, 2015 at 12:41:21PM -0700, Yuchung Cheng wrote: > On Wed, May 20, 2015 at 4:35 PM, Eric Dumazet <eric.duma...@gmail.com> wrote: ... > > diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c > > index > > b6575d6655681e8e84993a5db929c7309d47d4d3..beac6bf840b9a9d1e2f281d2b1c71b5a3414b824 > > 100644 > > --- a/net/ipv6/tcp_ipv6.c > > +++ b/net/ipv6/tcp_ipv6.c > > @@ -1421,6 +1421,7 @@ process: > > skb->dev = NULL; > > > > bh_lock_sock_nested(sk); > > + tcp_sk(sk)->segs_in += max_t(u16, 1, skb_shinfo(skb)->gso_segs); > some helper like e.g. tcp_event_pkt_recv() for v4/v6? > i am curious why use max instead of the ternary op?
Just because it was based this line, nothing else: ip_rcv() ... IP_ADD_STATS_BH(dev_net(dev), IPSTATS_MIB_NOECTPKTS + (iph->tos & INET_ECN_MASK), max_t(unsigned short, 1, skb_shinfo(skb)->gso_segs)); Including these new lines, this calculation is being done 5 times now, being just these 2 on tcp, then ip_input.c, ip_output and ip_tunnel_core.c. I'd rather wait some more to add a helper as coming to a reasonable name is hard at this point. For iptunnel, it's used at iptunnel_xmit() for example. Or perhaps you have another suggestion of a name? Thanks, Marcelo > > ret = 0; > > if (!sock_owned_by_user(sk)) { > > if (!tcp_prequeue(sk, skb)) > > > > > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html