From patchwork Tue Nov 14 22:32:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Karan Tilak Kumar (kartilak)" X-Patchwork-Id: 165109 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2243328rwb; Tue, 14 Nov 2023 14:32:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGX7FkUNf2iFTeJNVd80ap7EBOvzIeMpfcmqDni2L9kMXBffZTZ6KAmP/hS1D1KU9JA/WXl X-Received: by 2002:a17:902:e852:b0:1cc:2be7:c0f2 with SMTP id t18-20020a170902e85200b001cc2be7c0f2mr4142521plg.13.1700001161284; Tue, 14 Nov 2023 14:32:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700001161; cv=none; d=google.com; s=arc-20160816; b=phcElHGA9IHO/Q8jfCoRUteRQiHI/7xIScMgMOxHhtcPzXKFTIO6Pagz2J4njbg5YR kKWNJb8+pDIOFitczS18sMVuyh6PS0xccv8qWG0riPVe7bRqgAK6SQPD2YLVaAmznZEE 8QjiVwjrpaXyi5Cv+UcLCozKXRAz8j1sfkekJFyPFb8QhQ8kMl5cpKQSB817XWXJRtLe xJcNtvCTBJVTjn8lkFZtaWfsRDZkdUArLNxPkFsys6a6XP5oc3ruKZwzUhBrj0eFK1wv Z6WX3HFV6T632k+xz4WqeATyv3Mcymi6NgnGcBPeexV6g3HtFXxnuSydRhRLeN3L2qqU 31Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hLOjhxuhNlNogBtivzo6/IXGrtKFXbXe7bdo98vKvew=; fh=bKSAdOD9sjDLFpuVEw2QY/iOhn17PgYAzgX/PkCBS1w=; b=s9cVeSxXodvYv7t/rOTs27MGCOas0Fzv+3loqSy17yWLwnJBVZ+uYF69qdiAFNcngq GOWaynj4XTNPwJT4fOtUZQEc3mv8Z6z4nejCY44IBgVhK+mLpOew4Dw7ZoGkRP6QF18k IoaxTGWRmT4XCQ7wqpuSaHCtilq/jBzl+KbpridFGA7JVwM3hQjTo+McjUxq+uRF9PEY U0QM2HKsnWS4LMhMljGc7fSP8Fd7oRJT2LAkEcn0NONNvkqcN3UYcB/V7bVfGwftGpN9 U3w95rZoY4mu/AeIuVNq1+fWLMB7sM692vNOu/cBKbkH0t+Sr2ttIzr62oToAGyLR4VQ 3fBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=aqfDCjQo; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=cisco.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b3-20020a170902d30300b001c9c9251e05si8335733plc.476.2023.11.14.14.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 14:32:41 -0800 (PST) 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; dkim=pass header.i=@cisco.com header.s=iport header.b=aqfDCjQo; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=cisco.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 784AE811F10F; Tue, 14 Nov 2023 14:32:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234138AbjKNWcg (ORCPT + 29 others); Tue, 14 Nov 2023 17:32:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234112AbjKNWcf (ORCPT ); Tue, 14 Nov 2023 17:32:35 -0500 Received: from rcdn-iport-1.cisco.com (rcdn-iport-1.cisco.com [173.37.86.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 312CDC1; Tue, 14 Nov 2023 14:32:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2502; q=dns/txt; s=iport; t=1700001152; x=1701210752; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=slFAmSPvNAgschnNw3qQmhrZbli7ashLCnTbqYkfOek=; b=aqfDCjQotxitWhRpSeubt4Qtv6BDJMuqtBLEX1n9tp+IMQhVwXQRjcp9 DTr6CI2JPCmUhVXWQQV7fuo8W2HcX7P3u4SQ7xI2pSuqOTgpMHB56EOu0 F5dInmLk48b0Uk7a51jgjgjaSj8gLb9xheF9JBISd5DXMR6sDO+YAY2SY w=; X-CSE-ConnectionGUID: k7q/d/YARROrfkENkvbo5A== X-CSE-MsgGUID: OmkiRmonSQyRNR7uV8Y0uw== X-IronPort-AV: E=Sophos;i="6.03,303,1694736000"; d="scan'208";a="138480103" Received: from rcdn-core-3.cisco.com ([173.37.93.154]) by rcdn-iport-1.cisco.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2023 22:32:31 +0000 Received: from localhost.cisco.com ([10.193.101.253]) (authenticated bits=0) by rcdn-core-3.cisco.com (8.15.2/8.15.2) with ESMTPSA id 3AEMWNTY004130 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 14 Nov 2023 22:32:30 GMT From: Karan Tilak Kumar To: sebaddel@cisco.com Cc: arulponn@cisco.com, djhawar@cisco.com, gcboffa@cisco.com, mkai2@cisco.com, satishkh@cisco.com, jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Karan Tilak Kumar Subject: [PATCH v3 02/13] scsi: fnic: Add and use fnic number Date: Tue, 14 Nov 2023 14:32:21 -0800 Message-Id: <20231114223221.633719-1-kartilak@cisco.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Authenticated-User: kartilak@cisco.com X-Outbound-SMTP-Client: 10.193.101.253, [10.193.101.253] X-Outbound-Node: rcdn-core-3.cisco.com X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_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, 14 Nov 2023 14:32:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782580417951587866 X-GMAIL-MSGID: 1782580417951587866 Add fnic_num in fnic.h to identify fnic in a multi-fnic environment. Increment and set the fnic number during driver load in fnic_probe. Replace the host number with fnic number in debugfs. Reviewed-by: Sesidhar Baddela Reviewed-by: Arulprabhu Ponnusamy Signed-off-by: Karan Tilak Kumar --- drivers/scsi/fnic/fnic.h | 1 + drivers/scsi/fnic/fnic_debugfs.c | 2 +- drivers/scsi/fnic/fnic_main.c | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index 93c68931a593..c6c549c633b1 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h @@ -216,6 +216,7 @@ struct fnic_event { /* Per-instance private data structure */ struct fnic { + int fnic_num; struct fc_lport *lport; struct fcoe_ctlr ctlr; /* FIP FCoE controller structure */ struct vnic_dev_bar bar0; diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c index c4d9ed0d7d75..fac617672868 100644 --- a/drivers/scsi/fnic/fnic_debugfs.c +++ b/drivers/scsi/fnic/fnic_debugfs.c @@ -676,7 +676,7 @@ void fnic_stats_debugfs_init(struct fnic *fnic) { char name[16]; - snprintf(name, sizeof(name), "host%d", fnic->lport->host->host_no); + snprintf(name, sizeof(name), "fnic%d", fnic->fnic_num); fnic->fnic_stats_debugfs_host = debugfs_create_dir(name, fnic_stats_debugfs_root); diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index 984bc5fc55e2..ea7b1ba27ac7 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c @@ -84,6 +84,9 @@ static struct libfc_function_template fnic_transport_template = { .exch_mgr_reset = fnic_exch_mgr_reset }; + +atomic_t fnic_num; + static int fnic_slave_alloc(struct scsi_device *sdev) { struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); @@ -587,6 +590,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) int i; unsigned long flags; + atomic_inc(&fnic_num); /* * Allocate SCSI Host and set up association between host, * local port, and fnic @@ -608,7 +612,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) host->host_no); host->transportt = fnic_fc_transport; - + fnic->fnic_num = atomic_read(&fnic_num); fnic_stats_debugfs_init(fnic); /* Setup PCI resources */