Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp709080rdh; Sun, 24 Sep 2023 08:18:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENcaT9hQi3ToVXTyah5AR7MDYai44AIdjaXu72ou7ZogSFgnw2Lo4j1DODV2PXE2ztEr1o X-Received: by 2002:a05:6a00:2483:b0:68a:52ec:3d36 with SMTP id c3-20020a056a00248300b0068a52ec3d36mr3729240pfv.31.1695568719197; Sun, 24 Sep 2023 08:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695568719; cv=none; d=google.com; s=arc-20160816; b=fwmfe0wI0uCjezRGKJk97s2FQTNCgxqeEPJCMHPDMppfgYTeeQ2Mfo+Gb+AjJQF/jJ Pput14gyQTmC8lKGAt6nZ1jT422sK9XwktNPqHvC6TcpBbQv8YVTQ3sWL3ry0VivCNJr D0PTlD3dh9V8SAInSr5TcqRUH1h5FM9UBiBLSbEr80xVBXzqRX6i0yDmkKIJeEGbCj/l PhL/AIou1Eff5SF6FOLHs7xZ2hybKMzPwVY0HgrFmgah9rMoRSOmU1ZlkgqOqLZpZrAc GwqLPJtTtouV/fnRxfRQVdldr2sIYK11qnMZrWpzD4zqf3JSA5br9cEJ0IXygtM/4jiT Mddg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=xa98sDZioUnrket/O/63THRFBCzmBafowWrtgRLMRAQ=; fh=kTBstCixiri9Ahdk8UNuw7wmcx8Ry+mqafUdDsc8Vd0=; b=Y75DyyjMjRaoc1dv00d14mN2TYt8IWB+pGzGFIgA4Rai9TH6BOI3rxvg8giqj6sL4j ZK4R6hmJODaQQvI/hBUnJsbtxAXK8noH9GhGRx1VqaAY97OOaRpIrZoZws75MFZ/PRS+ 2lwg1o87bATfYgoqfML7c33u6v72ZTJhC8aIGUO9nmUdpmKYUgK3YFlcQTnnB2UhKJZc OD4kgNNPrUkC5VJf0RhucW+6AsCH5EvNt5euenoPWxn2gtcSIhBotaBVxjC8u/qzH2kP 6xjy+Kx+5k0DcB2aPk1JXtRL6ptt/qKJejD+3MRXTCbshG6c2AgtUG4bHduTG17xI8hR OZUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id o15-20020a656a4f000000b00565eedb1cf8si8826727pgu.825.2023.09.24.08.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 08:18:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 964C180BB1C2; Sun, 24 Sep 2023 08:18:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbjIXPSO (ORCPT + 99 others); Sun, 24 Sep 2023 11:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbjIXPRx (ORCPT ); Sun, 24 Sep 2023 11:17:53 -0400 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 369601AD; Sun, 24 Sep 2023 08:17:33 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R871e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0VsinOdy_1695568647; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VsinOdy_1695568647) by smtp.aliyun-inc.com; Sun, 24 Sep 2023 23:17:29 +0800 From: Wen Gu To: kgraul@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: wintera@linux.ibm.com, schnelle@linux.ibm.com, gbayer@linux.ibm.com, pasic@linux.ibm.com, alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, dust.li@linux.alibaba.com, guwen@linux.alibaba.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v4 13/18] net/smc: register loopback device as SMC-Dv2 device Date: Sun, 24 Sep 2023 23:16:48 +0800 Message-Id: <1695568613-125057-14-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695568613-125057-1-git-send-email-guwen@linux.alibaba.com> References: <1695568613-125057-1-git-send-email-guwen@linux.alibaba.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 24 Sep 2023 08:18:32 -0700 (PDT) After loopback device gets ready, add it to the smcd_dev list as an SMC-Dv2 device for use by SMC-D protocol. Signed-off-by: Wen Gu --- net/smc/smc_loopback.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/net/smc/smc_loopback.c b/net/smc/smc_loopback.c index eb13291..8375575 100644 --- a/net/smc/smc_loopback.c +++ b/net/smc/smc_loopback.c @@ -304,18 +304,27 @@ static int smcd_lo_register_dev(struct smc_lo_dev *ldev) ldev->smcd = smcd; smcd->priv = ldev; - - /* TODO: - * register smc_lo to smcd_dev list. - */ + mutex_lock(&smcd_dev_list.mutex); + smc_ism_check_v2_capable(smcd); + list_add(&smcd->list, &smcd_dev_list.list); + mutex_unlock(&smcd_dev_list.mutex); + pr_warn_ratelimited("smc: adding smcd device %s with pnetid %.16s%s\n", + smc_lo_dev_name, smcd->pnetid, + smcd->pnetid_by_user ? " (user defined)" : ""); return 0; } static void smcd_lo_unregister_dev(struct smc_lo_dev *ldev) { - /* TODO: - * unregister smc_lo from smcd_dev list. - */ + struct smcd_dev *smcd = ldev->smcd; + + pr_warn_ratelimited("smc: removing smcd device %s\n", + smc_lo_dev_name); + smcd->going_away = 1; + smc_smcd_terminate_all(smcd); + mutex_lock(&smcd_dev_list.mutex); + list_del_init(&smcd->list); + mutex_unlock(&smcd_dev_list.mutex); } static void smc_lo_dev_release(struct device *dev) -- 1.8.3.1