Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp708668rdh; Sun, 24 Sep 2023 08:17:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXRYntkcKwzi2YtvKZvWk7wwGpTFHT7iFnVy9OkSiMG+liuPoxAQzpYfExanWQqhDd5/yN X-Received: by 2002:a05:6a00:1913:b0:690:15c7:60d8 with SMTP id y19-20020a056a00191300b0069015c760d8mr6265738pfi.22.1695568661054; Sun, 24 Sep 2023 08:17:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695568661; cv=none; d=google.com; s=arc-20160816; b=uVlMt+ZsZarC0xVy6bk3ejojqNleX/Y3J8/0EHgOlNR9IC4nUDG2YBQWty2aAE1fJE 0wR7nv0iSQx0hY1E20CoeDuIN9g+amS3GiiZPU6CBm7sRyPOO/GBExKWnB5tcNF1e3e9 FIIFii7OEeN6PJuJBMni/leg+7d/6oH4d4FGJEv0vAE09w+APCviM3X159yhtCa82lcs IiASJHDPAkqCKfwItJZIhWra8pfRaLAMkp8Z/Gd5951OmkzFc5MENW515hwK92EWiTgZ jZs9/1qlgbtfmaOMWwnQTe3ES1V5XkgMkSiXwVMMOm+h1dmSr2soP2RBbG0ZiQScC2qQ oI9A== 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=f0EV04ehMJ2ZfdISjMdLCTjHv5suxyB+NCCn7ClG20k=; fh=kTBstCixiri9Ahdk8UNuw7wmcx8Ry+mqafUdDsc8Vd0=; b=aqvuKajAqV3fvclIHU7t9FAeV7u10bxkrK48jIR3DeJkR8P7Sm4+xqcGvzlbLaLlM9 GElsREtSX7VGTFR5xUCQzI0F+RH0aRRwAva4q5CqggjAGJOzp9F+AIZij50P0el8VStT /guNFXhJgyrQegYhf2fnLpXhSn9p0k8pYjM9VdWt9d7FEUrOiMsmjHjIICAD7evjE31M mTvCscH2AHf4koXDPwU0pGiv7ziq+ToqzxiRwOq7dO+guWzll6zUkXycIxXRjR6xh/JG fX7TE2yB+riNAJ9xke0hJAw6hFWgCnT6CiPuwyova3aEjI9nnqC1f4bou2jrnO/syJhe RDRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id fa40-20020a056a002d2800b0068ff3927553si8505106pfb.35.2023.09.24.08.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 08:17:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 220DD8022444; Sun, 24 Sep 2023 08:17:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229459AbjIXPRT (ORCPT + 99 others); Sun, 24 Sep 2023 11:17:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjIXPRP (ORCPT ); Sun, 24 Sep 2023 11:17:15 -0400 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2118FD; Sun, 24 Sep 2023 08:17:08 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0VsinOY6_1695568622; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VsinOY6_1695568622) by smtp.aliyun-inc.com; Sun, 24 Sep 2023 23:17:04 +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 02/18] net/smc: decouple ism_dev from SMC-D DMB registration Date: Sun, 24 Sep 2023 23:16:37 +0800 Message-Id: <1695568613-125057-3-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 morse.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 (morse.vger.email [0.0.0.0]); Sun, 24 Sep 2023 08:17:35 -0700 (PDT) This patch tries to decouple ISM device from SMC-D DMB registration, So that the register_dmb option is not restricted to ISM devices. Signed-off-by: Wen Gu --- drivers/s390/net/ism_drv.c | 2 +- include/net/smc.h | 4 ++-- net/smc/smc_ism.c | 7 ++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c index 6df7f37..a34e913 100644 --- a/drivers/s390/net/ism_drv.c +++ b/drivers/s390/net/ism_drv.c @@ -781,7 +781,7 @@ static int smcd_query_rgid(struct smcd_dev *smcd, u64 rgid, u32 vid_valid, } static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb, - struct ism_client *client) + void *client) { return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, client); } diff --git a/include/net/smc.h b/include/net/smc.h index a002552..f75116e 100644 --- a/include/net/smc.h +++ b/include/net/smc.h @@ -50,13 +50,12 @@ struct smcd_dmb { #define ISM_ERROR 0xFFFF struct smcd_dev; -struct ism_client; struct smcd_ops { int (*query_remote_gid)(struct smcd_dev *dev, u64 rgid, u32 vid_valid, u32 vid); int (*register_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb, - struct ism_client *client); + void *client); int (*unregister_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb); int (*add_vlan_id)(struct smcd_dev *dev, u64 vlan_id); int (*del_vlan_id)(struct smcd_dev *dev, u64 vlan_id); @@ -77,6 +76,7 @@ struct smcd_ops { struct smcd_dev { const struct smcd_ops *ops; void *priv; + void *client; struct list_head list; spinlock_t lock; struct smc_connection **conn; diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c index fc551f4..455ae0a 100644 --- a/net/smc/smc_ism.c +++ b/net/smc/smc_ism.c @@ -200,7 +200,6 @@ int smc_ism_unregister_dmb(struct smcd_dev *smcd, struct smc_buf_desc *dmb_desc) int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len, struct smc_buf_desc *dmb_desc) { -#if IS_ENABLED(CONFIG_ISM) struct smcd_dmb dmb; int rc; @@ -209,7 +208,7 @@ int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len, dmb.sba_idx = dmb_desc->sba_idx; dmb.vlan_id = lgr->vlan_id; dmb.rgid = lgr->peer_gid; - rc = lgr->smcd->ops->register_dmb(lgr->smcd, &dmb, &smc_ism_client); + rc = lgr->smcd->ops->register_dmb(lgr->smcd, &dmb, lgr->smcd->client); if (!rc) { dmb_desc->sba_idx = dmb.sba_idx; dmb_desc->token = dmb.dmb_tok; @@ -218,9 +217,6 @@ int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len, dmb_desc->len = dmb.dmb_len; } return rc; -#else - return 0; -#endif } static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, @@ -421,6 +417,7 @@ static void smcd_register_dev(struct ism_dev *ism) if (!smcd) return; smcd->priv = ism; + smcd->client = &smc_ism_client; ism_set_priv(ism, &smc_ism_client, smcd); if (smc_pnetid_by_dev_port(&ism->pdev->dev, 0, smcd->pnetid)) smc_pnetid_by_table_smcd(smcd); -- 1.8.3.1