netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Please help, Two simple questions regarding Linux TCP codes
@ 2003-08-29  8:34 John Zeng
  0 siblings, 0 replies; only message in thread
From: John Zeng @ 2003-08-29  8:34 UTC (permalink / raw)
  To: netdev

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;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-29  8:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-29  8:34 Please help, Two simple questions regarding Linux TCP codes John Zeng

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