Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp698776rdb; Tue, 19 Sep 2023 07:45:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHT+XO6zJFoZ0TMVxOEUnr0yzBBpkpm35h21/y9b+tWTei/PAW538J++veBxdrnmWs4bdK X-Received: by 2002:a17:902:e848:b0:1c5:b1a6:8118 with SMTP id t8-20020a170902e84800b001c5b1a68118mr703405plg.42.1695134740360; Tue, 19 Sep 2023 07:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695134740; cv=none; d=google.com; s=arc-20160816; b=kuhZAkriaZbhQJxBd5I/+f/IfqTSdd02ZTjRnS/mOkLiyMfSiw3m5TlwJVu3lsib5I KugSaRWjYDihHIu8N/jPAvt6QbcCUXIzBg219eyXrOtYxVACN4wMtLBYi2ADIsvfG4H2 uVbjyRNVvlfd2gYVzZ/4kTUfShJR2ANrT9k4X3VIR7jXnjZZ0t/aVuyIOJwDxTtDTZ7e kdZHzMopNsqNfwMpDbR+ttg+/LNJqn0VYRp6W+E9gd2VickB3HqgiWMZTe82ZPFZnm0/ 0YOZJOnACQ1WbT8/bOj1j38M155bz0NmMmbD4WDEHXWmBpVIYgtLSaHOSup5SyePE6hA EzKw== 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:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id c17-20020a170903235100b001bf3fe55e78si10261118plh.600.2023.09.19.07.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 07:45:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id D702C8266273; Tue, 19 Sep 2023 07:43:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232870AbjISOmr (ORCPT + 99 others); Tue, 19 Sep 2023 10:42:47 -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=-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 groat.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 (groat.vger.email [0.0.0.0]); Tue, 19 Sep 2023 07:43:30 -0700 (PDT) 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)) -- 1.8.3.1