Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp237504iob; Wed, 11 May 2022 13:19:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYXswYWal6x4MWmkgfTucUxZbJpgV5qCjgbbL9Pso/9UuntiOXtS2VMJIPP88xAE0D3vB0 X-Received: by 2002:a17:907:8688:b0:6f4:3d77:f9c7 with SMTP id qa8-20020a170907868800b006f43d77f9c7mr25783204ejc.716.1652300357435; Wed, 11 May 2022 13:19:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652300357; cv=none; d=google.com; s=arc-20160816; b=zidq1iQd6MeNvtcxeOr54QC4IL1zQC4VsDt7X0kgdK6BSvDMBO3dgiBBFdOWR8Vl4n FIADnGM0uXNwJEYzdLVD6HxHgT89pn6BznLVv9gI0D4A3/CrbYLxxZfAR4PvlmV+R9Fi F9cPtrtrJuqG3J/1V8kOLy/VNtCKyam4CLXmDjG3CJHh2HsAbsim8saaqrc7ieY6whK8 Uqk3ycPvmpfpXdYpXPG+6SkhRNhlPC9faYwihmq2DGeWBRqX1y7kEuApAygfThW71qeN Bd4DxoE+eaXZEKKErZ+Dys8sd3rpy6iN84goIv6CTN/9v49oo744Tt5GNSwKfbUzYpAN YIZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date; bh=/B9eAv5FweKlNsLUMA+V2bM0nWHZk2QlO2fZ5s1AS+0=; b=VW8jrr5u2T7ZEGrXiof9mjzK6nYB3eBon9/LOySxciDvuysto3yBtOaXtBEKJ5CWGL SuIPy1d1Oc3VZlIAB4wA76lyGhpbgQaRCJX0i1FuNeGjnR+sb63jrou/gi67kWqQIkcy TrcMFb3naBdKj3I6mrVi+XWEn5TfQ92WxVy75UkjcoA25m0NbPfhPpitpwmYnOYXxJgF UjqNfM+hPeM1aD0bDQjfWFTIFiyZgnbU3KjZl9+QDf0yIv0SY6uUgXM/MIr2CJjtGzf8 x0n5Yah4HGBIp2WVRbejO+3RsdYHs89bzmX2VUhcUK7hm297D4/izi7+ySwtkoisyyrt j+5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz20-20020a1709077d9400b006e7aa3c462esi2907063ejc.276.2022.05.11.13.18.43; Wed, 11 May 2022 13:19:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243480AbiEKNcZ (ORCPT + 99 others); Wed, 11 May 2022 09:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232658AbiEKNcX (ORCPT ); Wed, 11 May 2022 09:32:23 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B89C162204; Wed, 11 May 2022 06:32:17 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=tonylu@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VCwIlBX_1652275933; Received: from localhost(mailfrom:tonylu@linux.alibaba.com fp:SMTPD_---0VCwIlBX_1652275933) by smtp.aliyun-inc.com(127.0.0.1); Wed, 11 May 2022 21:32:14 +0800 Date: Wed, 11 May 2022 21:32:13 +0800 From: Tony Lu To: Guangguan Wang 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 Message-ID: Reply-To: Tony Lu References: <20220509115837.94911-1-guangguan.wang@linux.alibaba.com> <20220509115837.94911-3-guangguan.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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