Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3424777rdb; Sun, 10 Dec 2023 05:24:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFY1HzkPqWqf1hdO57/FLJQDMghMXetgQG+q9TfLvXxWPRTiGeO13+bYcsdKDew9tQeVezf X-Received: by 2002:a17:903:187:b0:1cc:449b:689e with SMTP id z7-20020a170903018700b001cc449b689emr3783553plg.20.1702214698958; Sun, 10 Dec 2023 05:24:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702214698; cv=none; d=google.com; s=arc-20160816; b=yNdEZUlzIP9UriGQGESBVHWWEEgBKEYuIouJBUizo+ivnzdu4BKH9esascZa7oQnhd DGioVkBwTzBeChO1higFGugxPfTuDtRJBCzVrU6SvrhO2gO8BW8cDeIQyypDXouIY5JN UjiK4bz/11k7BMwMv1C0UMK/zFZxX+rJgZOcDWaSiSSbqhKACoDZV+9RhPR2lB7R7R0H b6igWI8dhXWYU+cFde24k+Oh2/XiPK13bakGF1CAqloOvx/NeFnS4dmeZ8iSsVTMKFLP FTLfhKNEXNwjtWlJkwjKgN1+PnEdh2aD7wqPdpCjAxVHzckjMHe+ize9kQC2FIp8G/K3 mcmQ== 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=ZzSHE0ngm4VHOtLEX6ewADDyMTGgCBq5ApDt8PfWdAY=; fh=OseD/KU9IozxwwuPl+YAZpOMu/WojE/9fn/xPSMdB/8=; b=B8jf61AfvfjoBa04Z3igK+mF0E0Oq6cgiXcDjpDJXjljmWAhUNcLtJCfyK7xY/ggsj Uti/rTqwbGNiPQIwJ/p6xIZ6Ohx3/jF6fIfHfUF1ztW6yX7Q35JupvdtvKBQ/rf6z/PU COwaTMsMMw7Mfa123czGRkFu98f+q/IajIGRAR3p76tQ9J2sMQ3ECRCzBMrhGFy7S+Io 680vXeiRNCgX2AYECeByhQ+gpo1UrtGs5YOafsRnIRjAUVIFhzOPyd42vQN2ZkB2v6yo VCQ1ceXAxnPYlxptmMNNnJbMgC9a+A5H0Eskmhri+5/QeCOR4q0C3GYi/0VWnVQr25fS 9CAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j9-20020a17090276c900b001d2e3004f98si4557461plt.593.2023.12.10.05.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 05:24:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id C3E5E80657C6; Sun, 10 Dec 2023 05:24:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232708AbjLJNYi (ORCPT + 99 others); Sun, 10 Dec 2023 08:24:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232543AbjLJNYb (ORCPT ); Sun, 10 Dec 2023 08:24:31 -0500 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 493EE1A1; Sun, 10 Dec 2023 05:24:35 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R341e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0Vy8DoYz_1702214671; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0Vy8DoYz_1702214671) by smtp.aliyun-inc.com; Sun, 10 Dec 2023 21:24:33 +0800 From: Wen Gu To: wintera@linux.ibm.com, wenjia@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, kgraul@linux.ibm.com, jaka@linux.ibm.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 07/13] net/smc: register loopback-ism into SMC-D device list Date: Sun, 10 Dec 2023 21:24:08 +0800 Message-Id: <1702214654-32069-8-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1702214654-32069-1-git-send-email-guwen@linux.alibaba.com> References: <1702214654-32069-1-git-send-email-guwen@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 10 Dec 2023 05:24:58 -0800 (PST) After loopback-ism device gets ready, add it to the SMC-D device list as an ISMv2 device. Signed-off-by: Wen Gu --- net/smc/smc_ism.c | 11 +++++++---- net/smc/smc_ism.h | 1 + net/smc/smc_loopback.c | 20 +++++++++++++------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c index fb1837d..4065ebd 100644 --- a/net/smc/smc_ism.c +++ b/net/smc/smc_ism.c @@ -91,6 +91,11 @@ bool smc_ism_is_v2_capable(void) return smc_ism_v2_capable; } +void smc_ism_set_v2_capable(void) +{ + smc_ism_v2_capable = true; +} + /* Set a connection using this DMBE. */ void smc_ism_set_conn(struct smc_connection *conn) { @@ -454,11 +459,9 @@ static void smcd_register_dev(struct ism_dev *ism) if (smc_pnetid_by_dev_port(&ism->pdev->dev, 0, smcd->pnetid)) smc_pnetid_by_table_smcd(smcd); + if (smcd->ops->supports_v2()) + smc_ism_set_v2_capable(); mutex_lock(&smcd_dev_list.mutex); - if (list_empty(&smcd_dev_list.list)) { - if (smcd->ops->supports_v2()) - smc_ism_v2_capable = true; - } /* sort list: devices without pnetid before devices with pnetid */ if (smcd->pnetid[0]) list_add_tail(&smcd->list, &smcd_dev_list.list); diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h index ffff40c..6903cd5 100644 --- a/net/smc/smc_ism.h +++ b/net/smc/smc_ism.h @@ -52,6 +52,7 @@ int smc_ism_register_dmb(struct smc_link_group *lgr, int buf_size, void smc_ism_get_system_eid(u8 **eid); u16 smc_ism_get_chid(struct smcd_dev *dev); bool smc_ism_is_v2_capable(void); +void smc_ism_set_v2_capable(void); int smc_ism_init(void); void smc_ism_exit(void); int smcd_nl_get_device(struct sk_buff *skb, struct netlink_callback *cb); diff --git a/net/smc/smc_loopback.c b/net/smc/smc_loopback.c index ee4f112..83bc9a7 100644 --- a/net/smc/smc_loopback.c +++ b/net/smc/smc_loopback.c @@ -273,10 +273,12 @@ static int smcd_lo_register_dev(struct smc_lo_dev *ldev) return -ENOMEM; ldev->smcd = smcd; smcd->priv = ldev; - - /* TODO: - * register loopback-ism to smcd_dev list. - */ + smc_ism_set_v2_capable(); + mutex_lock(&smcd_dev_list.mutex); + list_add(&smcd->list, &smcd_dev_list.list); + mutex_unlock(&smcd_dev_list.mutex); + pr_warn_ratelimited("smc: adding smcd device %s\n", + smc_lo_dev_name); return 0; } @@ -284,9 +286,13 @@ static void smcd_lo_unregister_dev(struct smc_lo_dev *ldev) { struct smcd_dev *smcd = ldev->smcd; - /* TODO: - * unregister loopback-ism from smcd_dev list. - */ + 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); kfree(smcd->conn); kfree(smcd); } -- 1.8.3.1