netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John Zeng" <zrzeng@linuxforum.net>
To: <netdev@oss.sgi.com>
Subject: Please help, Two simple questions regarding Linux TCP codes
Date: Fri, 29 Aug 2003 16:34:06 +0800	[thread overview]
Message-ID: <001901c36e08$4fa4cce0$0301a8c0@homepc> (raw)

Hi, all,

I am a pretty newbie in Linux TCP codes,
now I know the overall operation of the Linux TCP codes,
but some details has really confused me for a long time,
would anyone there please kindly help me? thank you very much.

-------------------------------------
Q.1) in tcp_input.c, there is a function called tcp_check_reno_reordering(),
   as following:
static void tcp_check_reno_reordering(struct tcp_opt *tp, int addend)
{
    u32 holes;

    holes = max(tp->lost_out, 1U);
    holes = min(holes, tp->packets_out);

    if (tp->sacked_out + holes > tp->packets_out) {
        tp->sacked_out = tp->packets_out - holes;
        tcp_update_reordering(tp, tp->packets_out+addend, 0);
    }
}

In my imagination, only when segments are duplicated in the network,
will the statement "tp->sacked_out + holes > tp->packets_out" be true.
but because the function name shows that it is related to reordering,
I must have missed some important points,
could you please tell me what is the situation? i.e. in what reordering
circumstances will "tp->sacked_out + holes > tp->packets_out" be true?
-------------------------------

Q.2)what is the rationale behind of the function _tcp_grow_window()?
  to be more specific, what is the rationale of the while loop?
  i.e. why can we judge that when "truesize <= skb->len" is true,
  we can increase the window by 2*tp->ack.rcv_mss?

static int __tcp_grow_window(struct sock *sk, struct tcp_opt *tp, struct
sk_buff *skb)
{
    /* Optimize this! */
    int truesize = tcp_win_from_space(skb->truesize)/2;
    int window = tcp_full_space(sk)/2;

    while (tp->rcv_ssthresh <= window) {
        if (truesize <= skb->len)
            return 2*tp->ack.rcv_mss;

        truesize >>= 1;
        window >>= 1;
    }
    return 0;
}

                 reply	other threads:[~2003-08-29  8:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='001901c36e08$4fa4cce0$0301a8c0@homepc' \
    --to=zrzeng@linuxforum.net \
    --cc=netdev@oss.sgi.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;
as well as URLs for NNTP newsgroup(s).