From patchwork Sun Apr 23 12:17:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gu X-Patchwork-Id: 86699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2167143vqo; Sun, 23 Apr 2023 05:18:56 -0700 (PDT) X-Google-Smtp-Source: AKy350at8S7QVPuHA4EPnfpvfvQKjYKFaToZR8Y9qutoOWYN5NybAahAritntusaciW5GwKZOSkx X-Received: by 2002:a17:902:e943:b0:1a6:5fa2:3293 with SMTP id b3-20020a170902e94300b001a65fa23293mr11110953pll.56.1682252335996; Sun, 23 Apr 2023 05:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682252335; cv=none; d=google.com; s=arc-20160816; b=rg42XvO9/3Vm43nzfO9FtR+611pWLKeHMUGiv50hm3cpy+jopcy+9+rMLMfTZBjSgy szOGFg2c/BHmeCrnYuAmWUBM8OCkQVSlXk0fq6WkJh+4MC2ZmUr1JcmzlP0YAxaffDig oZuk+pffD+N2vFgL551zbRecdZIeHZoRO1X8d158z/iYP1LW1UfGTNvDljL3kkY9Z90U xAfe5yyUFBqEFwlGi/5JAv+dpV9spIbeK+pQGT1EVZ223SB0S7pXVqnd3Q7XCg5JcxcL +hC8ZNZGj6XC0tJRB+yQW164ashU8KiVtgt9yJU7ROd3eiwb8I2bKWf6z4K9THo/dnSc O1Ig== 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=YkI8nfWdk85GUVbTaS0cXVCvjHkcgnSSecqNPswoDos=; b=p+9648u1q2+D050+IAC5Bwq16Qajjr5FPT5ygR1qaNf3Rwe6/Q9DuhZKZbqhTmJVXi zYMv92fKigpApCftQ/hdI82GmZb/aPNUpoaARcOQ2RUBp12+w8uVDtHLsVKu7evL///o Y2nGL7gvOFc8PkaVnj2P7sssg+o360R7MRaXT0m3EqvmPPlQdH+X+umYiZRNvojZ9/iD hn2RHgiWl3iu3D6cySx0nvvV/b5BbPMuos+x++qopXUTZwFNc4AdqhVVo2S++zMQXTVt zb+cks2ZL45ppX57DAKVTmVhTAbQJQbZ0TTO/V9lcUx2bDPCJtpwX38+jF9uohKIj/3Y Cxog== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a170902e80e00b001a6fe422894si9385438plg.200.2023.04.23.05.18.41; Sun, 23 Apr 2023 05:18:55 -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 S229580AbjDWMSC (ORCPT + 99 others); Sun, 23 Apr 2023 08:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbjDWMSB (ORCPT ); Sun, 23 Apr 2023 08:18:01 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8411B10F0; Sun, 23 Apr 2023 05:17:59 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0Vgjux1M_1682252274; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0Vgjux1M_1682252274) by smtp.aliyun-inc.com; Sun, 23 Apr 2023 20:17:56 +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: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next v5 1/9] net/smc: Decouple ism_dev from SMC-D device dump Date: Sun, 23 Apr 2023 20:17:43 +0800 Message-Id: <1682252271-2544-2-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682252271-2544-1-git-send-email-guwen@linux.alibaba.com> References: <1682252271-2544-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_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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763969425159774841?= X-GMAIL-MSGID: =?utf-8?q?1763969425159774841?= This patch helps to decouple SMC-D device and ISM device, allowing different underlying device forms, such as non-PCI devices. Signed-off-by: Wen Gu --- include/net/smc.h | 1 + net/smc/smc_ism.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/net/smc.h b/include/net/smc.h index a002552..963ce9c 100644 --- a/include/net/smc.h +++ b/include/net/smc.h @@ -77,6 +77,7 @@ struct smcd_ops { struct smcd_dev { const struct smcd_ops *ops; void *priv; + struct device *parent_pci_dev; 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 fbee249..4249fb9 100644 --- a/net/smc/smc_ism.c +++ b/net/smc/smc_ism.c @@ -231,11 +231,9 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, struct smc_pci_dev smc_pci_dev; struct nlattr *port_attrs; struct nlattr *attrs; - struct ism_dev *ism; int use_cnt = 0; void *nlh; - ism = smcd->priv; nlh = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, &smc_gen_nl_family, NLM_F_MULTI, SMC_NETLINK_GET_DEV_SMCD); @@ -250,7 +248,8 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, if (nla_put_u8(skb, SMC_NLA_DEV_IS_CRIT, use_cnt > 0)) goto errattr; memset(&smc_pci_dev, 0, sizeof(smc_pci_dev)); - smc_set_pci_values(to_pci_dev(ism->dev.parent), &smc_pci_dev); + if (smcd->parent_pci_dev) + smc_set_pci_values(to_pci_dev(smcd->parent_pci_dev), &smc_pci_dev); if (nla_put_u32(skb, SMC_NLA_DEV_PCI_FID, smc_pci_dev.pci_fid)) goto errattr; if (nla_put_u16(skb, SMC_NLA_DEV_PCI_CHID, smc_pci_dev.pci_pchid)) @@ -420,6 +419,7 @@ static void smcd_register_dev(struct ism_dev *ism) if (!smcd) return; smcd->priv = ism; + smcd->parent_pci_dev = ism->dev.parent; 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);