Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1983259lqp; Tue, 16 Apr 2024 04:05:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWagrqYsIGj9G+VnAa7Cw7H7YeE2UEzh8NscJ8r8rGx7C4+zSTERKJIC/3VTRF7cajx0jIhWj5zWZRFQY+reIGKVRi9I1L5596Eoj/hNg== X-Google-Smtp-Source: AGHT+IF/eNSc1cyxBCl7+ijG0OcdJ0usIJ4Cx5vJ6JfGTDXQIUOTt3+PPJNYjkQD9qcimGJv++rG X-Received: by 2002:a17:906:245a:b0:a51:91fb:efb1 with SMTP id a26-20020a170906245a00b00a5191fbefb1mr8005215ejb.72.1713265555329; Tue, 16 Apr 2024 04:05:55 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bt24-20020a170906b15800b00a51cc6479ddsi5491642ejb.1012.2024.04.16.04.05.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 04:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146687-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=AnNWPFk2; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-146687-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146687-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 128281F21E5A for ; Tue, 16 Apr 2024 11:05:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14595128820; Tue, 16 Apr 2024 11:05:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AnNWPFk2" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35961127B5D; Tue, 16 Apr 2024 11:05:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713265545; cv=none; b=uGgKSQH5sjRM5LAYtrKaDWbml5DpUjnJOBO6P2sd+sGT+B4wTfO/IBN2muxshJmzgHuYW6n7zOClegGCQBw7tPVbZZmPRloIKWechn89a3EvAJiDWoZ+DqbM7zBZjxSS2loCFJrvkvOnn9lxBNzIYaE2QKVZY8DxHAXIWKY0QVA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713265545; c=relaxed/simple; bh=b+bXT9aw+B73/v9YDMYAG7FfnV6DKgNRfmqZTWXBmro=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SAceiJeMWoY0cYC/tMYRj86TdD4d/jotBpSRqoHzwG/6J66JIInjfeCn38UQ25+ixWe7kiqXD+bOg6UkTMKaKczhdzdU3xCnxs3q+J2/tPTzLUiaKPZoc/aTuH0aSf6QySBlXBqA9koIlGhi2kykuHUJQ26yvpSwEJZdVKCjc6E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AnNWPFk2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0989AC113CE; Tue, 16 Apr 2024 11:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713265545; bh=b+bXT9aw+B73/v9YDMYAG7FfnV6DKgNRfmqZTWXBmro=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AnNWPFk2cPR63aap4cP380v2VxcbontjhUIhUDPw8VjdKLYXol+uDqChzoz/vIqtL CQtNYOSG4NFjgYm9zRpzIk4mWQtwesDabP+lVQv3DvXQ7HHk9ZR1OAOJxu3Laa+Dss ER3dOztV7KK7i3p58jW3/6z1qhX35ggZxlWrFV8PRmnRjYErVyg77pPpHPFnFNQA4c 1RjPN1THSUmFrxOFwFqY+ktddtmpprzrSEYJldb280LYiFDLuy+7sKVVV3GSIJ+zip /4q8iaRzwAv7K1qNssIlLRfvzkzyemk7WcqEbP24uViUsrW2oynJePbU1/mSQLkQoZ SRFhaDiceip7A== Date: Tue, 16 Apr 2024 12:05:38 +0100 From: Simon Horman To: Wen Gu Cc: wintera@linux.ibm.com, twinkler@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, wenjia@linux.ibm.com, jaka@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net-next v6 10/11] net/smc: adapt cursor update when sndbuf and peer DMB are merged Message-ID: <20240416110538.GK2320920@kernel.org> References: <20240414040304.54255-1-guwen@linux.alibaba.com> <20240414040304.54255-11-guwen@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240414040304.54255-11-guwen@linux.alibaba.com> On Sun, Apr 14, 2024 at 12:03:03PM +0800, Wen Gu wrote: > If the local sndbuf shares the same physical memory with peer DMB, > the cursor update processing needs to be adapted to ensure that the > data to be consumed won't be overwritten. > > So in this case, the fin_curs and sndbuf_space that were originally > updated after sending the CDC message should be modified to not be > update until the peer updates cons_curs. > > Signed-off-by: Wen Gu .. > @@ -255,6 +256,14 @@ int smcd_cdc_msg_send(struct smc_connection *conn) > return rc; > smc_curs_copy(&conn->rx_curs_confirmed, &curs, conn); > conn->local_rx_ctrl.prod_flags.cons_curs_upd_req = 0; > + > + if (smc_ism_support_dmb_nocopy(conn->lgr->smcd)) > + /* if local sndbuf shares the same memory region with > + * peer DMB, then don't update the tx_curs_fin > + * and sndbuf_space until peer has consumed the data. > + */ > + return rc; Hi Wen Gu, A minor nit from my side: To my mind "return rc" implies returning an error value. But here rc is 0, which based on the comment seems correct. So perhaps it would be clearer to simply return 0. Flagged by Smatch. > + > /* Calculate transmitted data and increment free send buffer space */ > diff = smc_curs_diff(conn->sndbuf_desc->len, &conn->tx_curs_fin, > &conn->tx_curs_sent); ..