netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lu <tonylu@linux.alibaba.com>
To: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Cc: kgraul@linux.ibm.com, davem@davemloft.net, kuba@kernel.org,
	linux-s390@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 2/2] net/smc: align the connect behaviour with TCP
Date: Wed, 11 May 2022 21:32:13 +0800	[thread overview]
Message-ID: <Ynu63ZIz433CYBtb@TonyMac-Alibaba> (raw)
In-Reply-To: <b380e302-5b16-2de0-eca0-9805359daaaa@linux.alibaba.com>

On Tue, May 10, 2022 at 08:58:38PM +0800, Guangguan Wang wrote:
> 
> 
> On 2022/5/10 17:30, Tony Lu wrote:
> > On Mon, May 09, 2022 at 07:58:37PM +0800, Guangguan Wang wrote:
> >> Connect with O_NONBLOCK will not be completed immediately
> >> and returns -EINPROGRESS. It is possible to use selector/poll
> >> for completion by selecting the socket for writing. After select
> >> indicates writability, a second connect function call will return
> >> 0 to indicate connected successfully as TCP does, but smc returns
> > 
> > If the connection is established successfully, the following up call of
> > connect() returns -EISCONN (SS_CONNECTED), which is expected and SMC
> > does it, same as TCP.
> > 
> > In case of misunderstanding, could you append more detailed information?
> > 
> > Thanks,
> > Tony Lu
> > 
> 
> io_uring uses nonblocking connect as follow steps:
>   1) call connect with nonblocking
>   2) wait for selector/poll to indicate writability
>   3) call connect to confirm connection's state
> 
> In the third step, tcp changes the socket state from SS_CONNECTING to
> SS_CONNECTED and returns 0 if the connection is established successfully,
> but smc returns -EISCONN.

Based on the steps you list, I am wondering if it is finished in the
step #1, the call of connect() in step #3 would return -EISCONN. Should
we check 0 and -EISCONN in  step #3?

To fix this issue, I think we should be careful about adding and
handling sock state, maybe we could push it to net-next and take
advantage of sock state. And I will test this patch later in our test
cases.

Thanks,
Tony Lu

  reply	other threads:[~2022-05-11 13:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 11:58 [PATCH net 0/2] net/smc: two fixes for using smc with io_uring Guangguan Wang
2022-05-09 11:58 ` [PATCH net 1/2] net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending Guangguan Wang
2022-05-10  3:23   ` Tony Lu
2022-05-09 11:58 ` [PATCH net 2/2] net/smc: align the connect behaviour with TCP Guangguan Wang
2022-05-10  9:30   ` Tony Lu
2022-05-10 12:58     ` Guangguan Wang
2022-05-11 13:32       ` Tony Lu [this message]
2022-05-10 11:05   ` Paolo Abeni
2022-05-10 13:03     ` Guangguan Wang

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=Ynu63ZIz433CYBtb@TonyMac-Alibaba \
    --to=tonylu@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=guangguan.wang@linux.alibaba.com \
    --cc=kgraul@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.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 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).