From patchwork Tue Sep 19 14:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gu X-Patchwork-Id: 141972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3482693vqi; Tue, 19 Sep 2023 08:39:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGw77JNZK65y8QKUyyNqcrsOWGk9ajEDy+GhQDRcRkVDZNtX8zHskDyB3ZJtfcO2UnWIG/q X-Received: by 2002:a05:6300:8002:b0:14c:d5e9:21b8 with SMTP id an2-20020a056300800200b0014cd5e921b8mr11105502pzc.30.1695137985184; Tue, 19 Sep 2023 08:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695137985; cv=none; d=google.com; s=arc-20160816; b=tGG4d2whMoPO1egGy09A5iyC9SuEoKF8TUxKZbNWyb4lDmp4afjGkOCy3CJThYvTtg OLCm4J9X30EeQCS9R5G73V44yWf7+yyFM+paxqKEtxI9P2pe6tOuLPA+aigA6+jsubv/ /kPFAr3KtqDqdz1vaVXauleO3q0uMUQCz0PY4GWhep7yxWG5tDU4sgYQPbc7U0xQf2TN tJeafyKzMI4EdcLa9Cc2HCSss+XWVSUp9gP59uRJoXLSkidZj14W7DJDe833Iff70qAU Bw1rTLzVX1mSTDQNT/WSJpNwWIJTVUw/ZfVaNmHCDKSp/SThD9OfZZcBMQ0O/SVfQuRp Nclw== 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=2pM1iPMxEbHhpM0cC4MR9TZN1sh+tiMrz6RmDDUzn8Y=; fh=2Ks5OhTjwS8gZt4F+VGxBODwUEQ0u2wJBF3lQY5ZqAM=; b=kru3u4Q8GRHWep4JOAbxRtd+Hg1XF/tZoXHqJq09jMnM7KOwTl2Y3ZH89X4o2pTeCH 1Lq3s3lSZNPINlEVji6mk1w1z7PS8qYRIyP2fuDYTcjKGgUsbbWxw0nuW7tULHKfgIlw KWNXUllz8eYsTyMmriMpdppTTkYX+PnMyo2KgnkBNHRENob5dsVFcb0Yl3/Pqt+bRXTY kqhIWBqFHHJYL0zwlMDO23XHPOt2cSG8UWe9Qq+ZESFAP2zrGfkcPjUOih65FM1sghOX 8D+cHGMQNWEi9skrd4r9zoxjoUA2x8WBxOkmQd51A5/dXJ91tkV5r3AG5TT5zmpj3awA jCSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 19-20020a631753000000b00578b4edf57esi1373535pgx.797.2023.09.19.08.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 08:39:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 F3DCD80D44DF; Tue, 19 Sep 2023 07:42:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232878AbjISOms (ORCPT + 26 others); Tue, 19 Sep 2023 10:42:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232316AbjISOmq (ORCPT ); Tue, 19 Sep 2023 10:42:46 -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 BFB4CBF; Tue, 19 Sep 2023 07:42:39 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;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=13;SR=0;TI=SMTPD_---0VsRsRjQ_1695134534; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VsRsRjQ_1695134534) by smtp.aliyun-inc.com; Tue, 19 Sep 2023 22:42:36 +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: 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: [PATCH net-next 01/18] net/smc: decouple ism_dev from SMC-D device dump Date: Tue, 19 Sep 2023 22:41:45 +0800 Message-Id: <1695134522-126655-2-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695134522-126655-1-git-send-email-guwen@linux.alibaba.com> References: <1695134522-126655-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, 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]); Tue, 19 Sep 2023 07:42:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777481007983736185 X-GMAIL-MSGID: 1777481007983736185 This patch helps to decouple ISM device from SMC-D device, allowing different underlying device forms, such as virtual ISM devices. Signed-off-by: Wen Gu --- net/smc/smc_ism.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c index fbee249..0045fee 100644 --- a/net/smc/smc_ism.c +++ b/net/smc/smc_ism.c @@ -230,12 +230,11 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, char smc_pnet[SMC_MAX_PNETID_LEN + 1]; struct smc_pci_dev smc_pci_dev; struct nlattr *port_attrs; + struct device *priv_dev; 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 +249,10 @@ 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->ops->get_dev) + priv_dev = smcd->ops->get_dev(smcd); + if (priv_dev->parent) + smc_set_pci_values(to_pci_dev(priv_dev->parent), &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))