Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1590939rdd; Thu, 11 Jan 2024 04:01:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1nQWHB2Wh4AjQcAUc+81xSbTOIZ+waoi9vWH61AasUVBz1mSLkMtH+cPFelrKkhbpyqRN X-Received: by 2002:a17:90a:b112:b0:28c:fa29:8de6 with SMTP id z18-20020a17090ab11200b0028cfa298de6mr908803pjq.53.1704974507490; Thu, 11 Jan 2024 04:01:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704974507; cv=none; d=google.com; s=arc-20160816; b=wqxkUJRq9zmv023ATZeUxlb8JVpyTGpU3sCbu6C+uvnHwMZGNSHXIejtnvnUfyDeJ8 mU5+aeDmSJlqf05fKwnrQJQudnyLOx1NxcYljhR6Skf4cmkYrjBiTRbV/VMadi4yy9if B2MJHO7JMP9h5DFMwv+fRFpTlQc9k3vgtNJevLk5EyAGcw6rYAbRBg5VuCwIDXgH/bpG /VaMj1HAWr6lNqptq7NofxehAPgTROLskNVVHDrajDH2lZZKDyWO66FJc3aB37H+fYuN qrTio5HvLA3M+4epU3q+g2Tib4avVMfM5dKn8Frt2N2tdA/jFs74xGUGRtbHpcHojByA yPbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=m23eZC5ddgisUbndrEYw/y6RXEkDS6lW7UWKKie0pOk=; fh=jvQSXgb9+Gwj+2SIugFJuht8/m1b8ZaGKJU/ZBOVFgM=; b=u8F8qEZxcDR+blnhS94g/jetHvEqpai1yV3a2jHA8ikW0vZ/RIFbFuJk5918reNxKn 4guL6Jbcn1+jFWwb/x4mSFzVfz1+vtRDydEz9AOhnvHJ9ZRIZ/40NDEPCL/Q8k/uqx25 wExKSxPjEGL2IjDxm8Qqo8reBt8stIqoNvY5lMv32EDbefCL3zjLeRr/oCo2CWaOAWKZ 50oNn1XYKQJmPUOFzKj7FjZbjT1acztF2us0vF8ycOE4Si6aesiNweUUCSkTxjNpc5f7 giTrgJ7RWvlJrdEA+MgcN4vJmR/F/qpUtVD2YnOTqm1P7ZYjnDcIvqqHi3NP6++9k2Bk zVOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23537-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ml22-20020a17090b361600b0028cf6318076si3363784pjb.98.2024.01.11.04.01.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 04:01:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23537-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23537-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 453CAB22A10 for ; Thu, 11 Jan 2024 12:01:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBD0515AD3; Thu, 11 Jan 2024 12:01:20 +0000 (UTC) Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02E8E15AC9; Thu, 11 Jan 2024 12:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R551e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0W-Pgn2k_1704974458; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0W-Pgn2k_1704974458) by smtp.aliyun-inc.com; Thu, 11 Jan 2024 20:01:09 +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, 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: [PATCH net-next 01/15] net/smc: improve SMC-D device dump for virtual ISM Date: Thu, 11 Jan 2024 20:00:22 +0800 Message-Id: <20240111120036.109903-2-guwen@linux.alibaba.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f In-Reply-To: <20240111120036.109903-1-guwen@linux.alibaba.com> References: <20240111120036.109903-1-guwen@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The introduction of virtual ISM requires improvement of SMC-D device dump. Software implemented non-PCI device (loopback-ism) should be handled correctly and the CHID reserved for virtual ISM should be got from smcd_ops interface instead of PCI information. Signed-off-by: Wen Gu --- net/smc/smc_ism.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c index ac88de2a06a0..66bcfddd3fcf 100644 --- a/net/smc/smc_ism.c +++ b/net/smc/smc_ism.c @@ -252,12 +252,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 *device; 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); @@ -272,7 +271,15 @@ 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); + device = smcd->ops->get_dev(smcd); + if (device->parent) + smc_set_pci_values(to_pci_dev(device->parent), &smc_pci_dev); + if (smc_ism_is_virtual(smcd)) { + smc_pci_dev.pci_pchid = smc_ism_get_chid(smcd); + if (!device->parent) + snprintf(smc_pci_dev.pci_id, sizeof(smc_pci_dev.pci_id), + "%s", dev_name(device)); + } 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)) -- 2.32.0.3.g01195cf9f