Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1105860lql; Tue, 12 Mar 2024 07:29:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUR/0FTd6Cws0cY3dMALgjapO/UZ8AKAp6Movy/AL5xVYuCI0aYSAeEal+aMutza1gOKZn3GlrtaOTYJ/Cx0IBsjE8d7K1A7ijOHORgWw== X-Google-Smtp-Source: AGHT+IHHnvHQa/Kx+4ow0i9pm3BMT+VWmCItqpXe4NyEkGf8ziFIjW7ZwEAcCVA+B/yRqtzR28f0 X-Received: by 2002:a17:902:e741:b0:1dd:a120:7761 with SMTP id p1-20020a170902e74100b001dda1207761mr7208015plf.14.1710253799293; Tue, 12 Mar 2024 07:29:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710253799; cv=pass; d=google.com; s=arc-20160816; b=o0o0yyGcpAvr0/j+eAPi4tt+gcReK1SIK7Y3KP6hS/r+o/35uOH+rD9UldDpk2BTKw 6pTHaX7Y4D4mdvTUvZGJ+6g/FvGwGkJQ8LQ23ofavqiRMz+oqSYGdw4Au7EOd7yhIgCE J443ojKLFp+sIMz1LBMofwAEygwRJ6Sg8uGWIRsDSjyBVIu844MglXLllI4Us1uUqSLs Jo1/6RCefDkG5UuoU4aJ8WBdWz4v5sG9HMm+Rd8KWYmO0lZBDGdlQAWOaRMHl9vkZXnD KhnhNwyQXOob/sfXsyIbS3EoOkNsldaTE8Udkt/WVWQSRgwNE18sm2OZxv10sgKo72+n MdIg== ARC-Message-Signature: i=2; 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:dkim-signature; bh=ioFYp50r+AC0yjO8FJo0KTmmSlkoNb91N+pNLCEdIRU=; fh=dZ+5j4HvJgOzvN8nB02tgPlkwHWSh0WzjxQ9fqEQCrY=; b=G51OTryA+4Bouou9/vBeTnDr5+x/PoqhS4SEieFc5ALJxt+T8wDZ3T5Xc1XDjcg0QY R9RPofB+jdDpGFgHHAuTraiV6eh5rhwhibDS/CGXJjprI83LJF5OsEQKqn2OA863HGt4 06HiI9tB39Jgb6uORJjj7KCyWqUZQdfrumOByPVBHV+2Xtupl+iv4v/bPoAc4/2HT2Dl TUZqHdG1+NPB6/z/YPV89aYzSVw7y9Vz3mKZfzdXbe/Hm6LtDhPWT013OKHVvTnY/Nx3 9HDRzZKSZLo+wPDyZ0p2pZlh/h4r/E/CfTDxGLnH4JaOFEujfzl387hpGMf7aVa7sy6E 4Opw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=WYfd5Viz; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-100357-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ju22-20020a170903429600b001db8cd74953si6879447plb.112.2024.03.12.07.29.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:29:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100357-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=WYfd5Viz; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-100357-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EEC5F280E11 for ; Tue, 12 Mar 2024 14:29:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57E4A7E11A; Tue, 12 Mar 2024 14:28:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="WYfd5Viz" Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (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 E0D6F7D070; Tue, 12 Mar 2024 14:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.119 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710253693; cv=none; b=qStEmyQgf/ry9/Z25IVr3lNgPPWUBoUxCYx4pzbCeGN0pB2G6wh9VAWWAClboCVNOpGhhRucoe6P/JtPH3FyjyLWvEu2teBL/0yAQfaVTfeMZjqB3brwyyNBr1iFJiP7PLwQ5EXUY9RZxZZUY7XNDKI+monVzZclBbSFJVX5d1A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710253693; c=relaxed/simple; bh=dvrjP6FyooMZfH9tP3r/k0q7Zxk1MxNigKI5R5WFDZg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hhyf7MtLFkCiYFUNnZM7UPiS2LskCawqE59jVjvqc/hihAVF+nUzHMk7VieWQW0xQItfruXX+pyOUWwhvEFwUQADNGL12mglL2Lu7xPS8lsSuxSZvP/h3h8MEVFFHFQUOx9SOztU1VGjRIRmsOj88PIsY93GSBMjWJY/IOlZOcg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=WYfd5Viz; arc=none smtp.client-ip=115.124.30.119 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 DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1710253681; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=ioFYp50r+AC0yjO8FJo0KTmmSlkoNb91N+pNLCEdIRU=; b=WYfd5VizNb9SE3HUzl40ZHd1jy2A9TSu6Z5YR0n2wMQSgBPGdD3OSGf4BS6n2mHE+WWTAjkyWXaw74hKvJpCLlA6k/n47mAsbLqNzTLY5V6o28be0H+K0/HP8f8U+axSUt5zh0143JOM0xSThBK8odwgmRTXvlO/+sfX0kxHDbM= 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=ay29a033018046049;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0W2M60RJ_1710253679; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0W2M60RJ_1710253679) by smtp.aliyun-inc.com; Tue, 12 Mar 2024 22:28:01 +0800 From: Wen Gu To: wintera@linux.ibm.com, twinkler@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, wenjia@linux.ibm.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-kernel@vger.kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v3 01/11] net/smc: adapt SMC-D device dump for Emulated-ISM Date: Tue, 12 Mar 2024 22:27:33 +0800 Message-Id: <20240312142743.41406-2-guwen@linux.alibaba.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f In-Reply-To: <20240312142743.41406-1-guwen@linux.alibaba.com> References: <20240312142743.41406-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 Emulated-ISM requires adaptation of SMC-D device dump. Software implemented non-PCI device (loopback-ism) should be handled correctly and the CHID reserved for Emulated-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..b6eca4231913 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_emulated(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