netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kumar SANGHVI <kumar.sanghvi@stericsson.com>
To: "Rémi Denis-Courmont" <remi@remlab.net>
Cc: "remi.denis-courmont@nokia.com" <remi.denis-courmont@nokia.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Linus WALLEIJ <linus.walleij@stericsson.com>,
	Gulshan KARMANI <gulshan.karmani@stericsson.com>,
	Sudeep DIVAKARAN <sudeep.divakaran@stericsson.com>
Subject: Re: [PATCH] Phonet: 'connect' socket implementation for Pipe controller
Date: Wed, 13 Oct 2010 10:02:45 +0530	[thread overview]
Message-ID: <20101013043240.GA28430@bnru01.bnr.st.com> (raw)
In-Reply-To: <201010121930.32116.remi@remlab.net>

Hi Rémi Denis-Courmontt, 

On Tue, Oct 12, 2010 at 18:30:30 +0200, Rémi Denis-Courmont wrote:
> > +	static u8 host_pref_rx_fc[3] = {3, 2, 1}, host_req_tx_fc[3] = {3, 2, 1};
> 
> Why is this 'static' ? Doesn't that break concurrent uses?

Yes. The 'static' is not needed here. I will fix this.
Thanks.

 > +static int pn_socket_connect(struct socket *sock, struct sockaddr *addr,
> > +		int len, int flags)
> > +{
> > +	struct sock *sk = sock->sk;
> > +	struct sockaddr_pn *spn = (struct sockaddr_pn *)addr;
> > +	long timeo;
> > +	int err;
> > +
> > +	lock_sock(sk);
> > +
> > +	if (len < sizeof(struct sockaddr_pn))
> > +		return -EINVAL;
> > +	if (spn->spn_family != AF_PHONET)
> > +		return -EAFNOSUPPORT;
> 
> You should move lock_sock(sk); here, I think.

Yes. I will fix this locking.
Thanks.

> 
> > +
> > +	switch (sock->state) {
> > +	case SS_UNCONNECTED:
> > +		sk->sk_state = TCP_CLOSE;
> > +		break;
> > +	case SS_CONNECTING:
> > +		switch (sk->sk_state) {
> > +		case TCP_SYN_RECV:
> > +			sock->state = SS_CONNECTED;
> > +			err = -EISCONN;
> > +			goto out;
> > +		case TCP_CLOSE:
> > +			err = -EALREADY;
> > +			if (flags & O_NONBLOCK)
> > +				goto out;
> > +			goto wait_connect;
> > +			break;
> 
> I think the kernel policy is against redumdant break statements.

Yes, the break is redundant here. I will fix this.
Thanks.

> 
> > +		}
> > +		break;
> > +	case SS_CONNECTED:
> > +		switch (sk->sk_state) {
> > +		case TCP_SYN_RECV:
> > +			err = -EISCONN;
> > +			goto out;
> > +		case TCP_CLOSE:
> > +			sock->state = SS_UNCONNECTED;
> > +			break;
> > +		}
> > +		break;
> > +	case SS_DISCONNECTING:
> > +	case SS_FREE:
> > +		break;
> > +	}
> > +	sk->sk_state = TCP_CLOSE;
> > +	sock->state = SS_UNCONNECTED;
> 
> This is dead code...

Yes. I will remove the above assignment to sock->state which is not
required at all.
Thanks.

> 
> > +	sk_stream_kill_queues(sk);
> > +
> > +
> > +	sock->state = SS_CONNECTING;
> 
> ...because of this ^ .
> 
> > +	err = sk->sk_prot->connect(sk, addr, len);

Thanks for the review. I will fix and upload v2 version of the patch.
I will also upload a patch on Documentation describing on 'connect' for
Pipe controller logic.

Thanks & regards,
Kumar.

      reply	other threads:[~2010-10-13  4:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 15:26 [PATCH] Phonet: 'connect' socket implementation for Pipe controller Kumar A Sanghvi
2010-10-12 16:30 ` Rémi Denis-Courmont
2010-10-13  4:32   ` Kumar SANGHVI [this message]

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=20101013043240.GA28430@bnru01.bnr.st.com \
    --to=kumar.sanghvi@stericsson.com \
    --cc=davem@davemloft.net \
    --cc=gulshan.karmani@stericsson.com \
    --cc=linus.walleij@stericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=remi.denis-courmont@nokia.com \
    --cc=remi@remlab.net \
    --cc=sudeep.divakaran@stericsson.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).