public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <mleitner@redhat.com>
To: Yuchung Cheng <ycheng@google.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Matt Mathis <mattmathis@google.com>,
	Craig Gallek <cgallek@google.com>, Martin Lau <kafai@fb.com>,
	Chris Rapier <rapier@psc.edu>
Subject: Re: [PATCH net-next] tcp: add tcpi_segs_in and tcpi_segs_out to tcp_info
Date: Thu, 21 May 2015 18:53:14 -0300	[thread overview]
Message-ID: <20150521215314.GB2566@localhost.localdomain> (raw)
In-Reply-To: <CAK6E8=ebJDpUZeM=JHmqxgjcFEr1WLee2UeaKUjPg5vQwVL0tA@mail.gmail.com>

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.dumazet@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))
> >
> >
> 

  parent reply	other threads:[~2015-05-21 21:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 22:28 [PATCH v2 net-next 0/2] tcp: tcp_info extensions Eric Dumazet
2015-04-28 22:28 ` [PATCH v2 net-next 1/2] tcp: add tcpi_bytes_acked to tcp_info Eric Dumazet
2015-04-29 22:12   ` David Miller
2015-04-28 22:28 ` [PATCH v2 net-next 2/2] tcp: add tcpi_bytes_received " Eric Dumazet
2015-04-28 22:56   ` Yuchung Cheng
2015-04-28 23:07     ` Eric Dumazet
2015-04-29 22:12   ` David Miller
2015-05-12 13:08 ` [PATCH v2 net-next 0/2] tcp: tcp_info extensions Marcelo Ricardo Leitner
2015-05-12 20:31   ` Eric Dumazet
2015-05-12 22:21     ` Marcelo Ricardo Leitner
2015-05-20 23:35     ` [PATCH net-next] tcp: add tcpi_segs_in and tcpi_segs_out to tcp_info Eric Dumazet
2015-05-21  0:06       ` Rick Jones
2015-05-21  0:37         ` Eric Dumazet
2015-05-21  0:48           ` Rick Jones
2015-05-21  0:52             ` Eric Dumazet
2015-05-21 12:38               ` Marcelo Ricardo Leitner
2015-05-21 19:41       ` Yuchung Cheng
2015-05-21 20:06         ` Eric Dumazet
2015-05-21 21:53         ` Marcelo Ricardo Leitner [this message]
2015-05-22  3:25       ` David Miller
2015-05-22  3:43         ` Eric Dumazet
2015-05-22  4:51           ` [PATCH net-next] tcp: fix a potential deadlock in tcp_get_info() Eric Dumazet
2015-05-22 17:50             ` David Miller
2015-05-22 17:56               ` Eric Dumazet
2015-05-22 18:03                 ` Eric Dumazet
2015-05-22 18:08                   ` Eric Dumazet
2015-05-22 18:21                     ` David Miller
2015-05-22 18:12                 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150521215314.GB2566@localhost.localdomain \
    --to=mleitner@redhat.com \
    --cc=cgallek@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kafai@fb.com \
    --cc=mattmathis@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=rapier@psc.edu \
    --cc=ycheng@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox