All of lore.kernel.org
 help / color / mirror / Atom feed
From: Firo Yang <firogm@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	gerrit@erg.abdn.ac.uk, yoshfuji@linux-ipv6.org,
	jmorris@namei.org, kuznet@ms2.inr.ac.ru,
	herbert@gondor.apana.org.au, ast@plumgrid.com,
	dborkman@redhat.com, ebiederm@xmission.com,
	dan.carpenter@oracle.com, Julia.Lawall@lip6.fr,
	kernel-janitors@vger.kernel.org
Subject: Re: [RFC PATCH] net: Add sock_common_listen for TCP and DCCP
Date: Fri, 12 Jun 2015 02:12:18 +0000	[thread overview]
Message-ID: <20150612021218.GA3930@firo> (raw)
In-Reply-To: <1434032743.27504.38.camel@edumazet-glaptop2.roam.corp.google.com>

On Thu, Jun 11, 2015 at 07:25:43AM -0700, Eric Dumazet wrote:
>On Thu, 2015-06-11 at 19:05 +0800, Firo Yang wrote:
>> Code refactoring:
>> 1. Move the common code of inet_listen() and inet_dccp_listen() to
>> sock_common_listen().
>> Add new state SOCK_LISTEN and SOCK_CLOSE for sock_common_listen().
>> 
>> 2. Modify and rename inet_listen() to tcp_listen().
>> 
>> 3. Modify and rename inet_dccp_listen() to dccp_listen().
>> 
>> 4. Add new callback pointer listen in struct proto for
>> tcp_listen() and dccp_listen().
>> 
>> This patch makes codes more modularized and removes redudant codes.
>> 
>> Signed-off-by: Firo Yang <firogm@gmail.com>
>> ---
>> I test it on my x86 pc.
>> 
>>  include/net/sock.h  | 18 ++++++++++++++++
>>  include/net/tcp.h   |  1 +
>>  net/core/sock.c     | 36 +++++++++++++++++++++++++++++++
>>  net/dccp/dccp.h     |  2 +-
>>  net/dccp/ipv4.c     |  4 ++--
>>  net/dccp/ipv6.c     |  3 ++-
>>  net/dccp/proto.c    | 62 ++++++++++++++++-------------------------------------
>>  net/ipv4/af_inet.c  | 58 +------------------------------------------------
>>  net/ipv4/tcp.c      | 35 ++++++++++++++++++++++++++++++
>>  net/ipv4/tcp_ipv4.c |  1 +
>>  net/ipv6/af_inet6.c |  2 +-
>>  net/ipv6/tcp_ipv6.c |  1 +
>>  12 files changed, 118 insertions(+), 105 deletions(-)
>> 
>> diff --git a/include/net/sock.h b/include/net/sock.h
>> index 26c1c31..5adc7f4 100644
>> --- a/include/net/sock.h
>> +++ b/include/net/sock.h
>> @@ -934,6 +934,7 @@ struct proto {
>>  	int			(*connect)(struct sock *sk,
>>  					struct sockaddr *uaddr,
>>  					int addr_len);
>> +	int			(*listen)(struct sock *sk, int backlog);
>>  	int			(*disconnect)(struct sock *sk, int flags);
>>  
>>  	struct sock *		(*accept)(struct sock *sk, int flags, int *err);
>> @@ -1349,6 +1350,21 @@ void sk_prot_clear_portaddr_nulls(struct sock *sk, int size);
>>  #define SOCK_BINDADDR_LOCK	4
>>  #define SOCK_BINDPORT_LOCK	8
>>  
>> +/*
>> + * Sock common state
>> + * These values must be enqual to correspondent TCP state
>> + * and DCCP state.
>> + */
>> +enum {
>> +	SOCK_CLOSE	= TCP_CLOSE,
>> +	SOCK_LISTEN	= TCP_LISTEN
>> +};
>> +
>> +enum {
>> +	SOCKF_CLOSE	= TCPF_CLOSE,
>> +	SOCKF_LISTEN	= TCPF_LISTEN,
>> +};
>> +
>
>You know, TCP_CLOSE and TCP_LISTEN are really legacy states for
>sk_state, this is not going to change anytime soon.
>
>
>I prefer to keep using TCP_xxxx names and not adding aliases.

Many thanks, Eric. I will update the patch.

Firo
>
>Otherwise your patch looks fine to me, thanks.
>
>
>

-- 

WARNING: multiple messages have this Message-ID (diff)
From: Firo Yang <firogm@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	gerrit@erg.abdn.ac.uk, yoshfuji@linux-ipv6.org,
	jmorris@namei.org, kuznet@ms2.inr.ac.ru,
	herbert@gondor.apana.org.au, ast@plumgrid.com,
	dborkman@redhat.com, ebiederm@xmission.com,
	dan.carpenter@oracle.com, Julia.Lawall@lip6.fr,
	kernel-janitors@vger.kernel.org
Subject: Re: [RFC PATCH] net: Add sock_common_listen for TCP and DCCP
Date: Fri, 12 Jun 2015 10:12:18 +0800	[thread overview]
Message-ID: <20150612021218.GA3930@firo> (raw)
In-Reply-To: <1434032743.27504.38.camel@edumazet-glaptop2.roam.corp.google.com>

On Thu, Jun 11, 2015 at 07:25:43AM -0700, Eric Dumazet wrote:
>On Thu, 2015-06-11 at 19:05 +0800, Firo Yang wrote:
>> Code refactoring:
>> 1. Move the common code of inet_listen() and inet_dccp_listen() to
>> sock_common_listen().
>> Add new state SOCK_LISTEN and SOCK_CLOSE for sock_common_listen().
>> 
>> 2. Modify and rename inet_listen() to tcp_listen().
>> 
>> 3. Modify and rename inet_dccp_listen() to dccp_listen().
>> 
>> 4. Add new callback pointer listen in struct proto for
>> tcp_listen() and dccp_listen().
>> 
>> This patch makes codes more modularized and removes redudant codes.
>> 
>> Signed-off-by: Firo Yang <firogm@gmail.com>
>> ---
>> I test it on my x86 pc.
>> 
>>  include/net/sock.h  | 18 ++++++++++++++++
>>  include/net/tcp.h   |  1 +
>>  net/core/sock.c     | 36 +++++++++++++++++++++++++++++++
>>  net/dccp/dccp.h     |  2 +-
>>  net/dccp/ipv4.c     |  4 ++--
>>  net/dccp/ipv6.c     |  3 ++-
>>  net/dccp/proto.c    | 62 ++++++++++++++++-------------------------------------
>>  net/ipv4/af_inet.c  | 58 +------------------------------------------------
>>  net/ipv4/tcp.c      | 35 ++++++++++++++++++++++++++++++
>>  net/ipv4/tcp_ipv4.c |  1 +
>>  net/ipv6/af_inet6.c |  2 +-
>>  net/ipv6/tcp_ipv6.c |  1 +
>>  12 files changed, 118 insertions(+), 105 deletions(-)
>> 
>> diff --git a/include/net/sock.h b/include/net/sock.h
>> index 26c1c31..5adc7f4 100644
>> --- a/include/net/sock.h
>> +++ b/include/net/sock.h
>> @@ -934,6 +934,7 @@ struct proto {
>>  	int			(*connect)(struct sock *sk,
>>  					struct sockaddr *uaddr,
>>  					int addr_len);
>> +	int			(*listen)(struct sock *sk, int backlog);
>>  	int			(*disconnect)(struct sock *sk, int flags);
>>  
>>  	struct sock *		(*accept)(struct sock *sk, int flags, int *err);
>> @@ -1349,6 +1350,21 @@ void sk_prot_clear_portaddr_nulls(struct sock *sk, int size);
>>  #define SOCK_BINDADDR_LOCK	4
>>  #define SOCK_BINDPORT_LOCK	8
>>  
>> +/*
>> + * Sock common state
>> + * These values must be enqual to correspondent TCP state
>> + * and DCCP state.
>> + */
>> +enum {
>> +	SOCK_CLOSE	= TCP_CLOSE,
>> +	SOCK_LISTEN	= TCP_LISTEN
>> +};
>> +
>> +enum {
>> +	SOCKF_CLOSE	= TCPF_CLOSE,
>> +	SOCKF_LISTEN	= TCPF_LISTEN,
>> +};
>> +
>
>You know, TCP_CLOSE and TCP_LISTEN are really legacy states for
>sk_state, this is not going to change anytime soon.
>
>
>I prefer to keep using TCP_xxxx names and not adding aliases.

Many thanks, Eric. I will update the patch.

Firo
>
>Otherwise your patch looks fine to me, thanks.
>
>
>

-- 

  reply	other threads:[~2015-06-12  2:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 11:05 [RFC PATCH] net: Add sock_common_listen for TCP and DCCP Firo Yang
2015-06-11 11:05 ` Firo Yang
2015-06-11 14:25 ` Eric Dumazet
2015-06-11 14:25   ` Eric Dumazet
2015-06-12  2:12   ` Firo Yang [this message]
2015-06-12  2:12     ` Firo Yang

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=20150612021218.GA3930@firo \
    --to=firogm@gmail.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=ast@plumgrid.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=eric.dumazet@gmail.com \
    --cc=gerrit@erg.abdn.ac.uk \
    --cc=herbert@gondor.apana.org.au \
    --cc=jmorris@namei.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.