From: Eric Dumazet <eric.dumazet@gmail.com>
To: 杨硕 <shanqn@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: why not use the tcp_set_state() in inet_csk_listen_start()?
Date: Wed, 24 Mar 2010 10:02:03 +0100 [thread overview]
Message-ID: <1269421323.3213.16.camel@edumazet-laptop> (raw)
In-Reply-To: <ffe582101003240113i15c48ff2g850bb209c825b11c@mail.gmail.com>
Le mercredi 24 mars 2010 à 16:13 +0800, 杨硕 a écrit :
> why use "sk->sk_state = TCP_LISTEN" rather than "tcp_set_state(sk, TCP_LISTEN)"?
>
> TIA :)
>
> int inet_csk_listen_start(struct sock *sk, const int nr_table_entries)
> {
> struct inet_sock *inet = inet_sk(sk);
> struct inet_connection_sock *icsk = inet_csk(sk);
> int rc = reqsk_queue_alloc(&icsk->icsk_accept_queue, nr_table_entries);
>
> if (rc != 0)
> return rc;
>
> sk->sk_max_ack_backlog = 0;
> sk->sk_ack_backlog = 0;
> inet_csk_delack_init(sk);
>
> /* There is race window here: we announce ourselves listening,
> * but this transition is still not validated by get_port().
> * It is OK, because this socket enters to hash table only
> * after validation is complete.
> */
> sk->sk_state = TCP_LISTEN;
Because its not necessary ?
tcp_set_state() takes care of particular state transitions.
In case of inet_csk_listen_start(), old state is TCP_CLOSE, so there is
nothing special to do in tcp_set_state().
next prev parent reply other threads:[~2010-03-24 9:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-24 8:13 why not use the tcp_set_state() in inet_csk_listen_start()? 杨硕
2010-03-24 9:02 ` Eric Dumazet [this message]
2010-03-25 0:49 ` 杨硕
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=1269421323.3213.16.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shanqn@gmail.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