From patchwork Fri Oct 20 19:06:18 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: 156275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp1268755vqb; Fri, 20 Oct 2023 12:07:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+aBbgjCiGCSSZDPEce/EGVbw3bruaDImKvvg4xqtef46racT9iVYboSUi+e66RhWEpdxa X-Received: by 2002:a05:6a21:7989:b0:137:514a:984f with SMTP id bh9-20020a056a21798900b00137514a984fmr2680371pzc.35.1697828862795; Fri, 20 Oct 2023 12:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697828862; cv=none; d=google.com; s=arc-20160816; b=LQftQUjf4Phw5yCt6dS7p8Q3UZgyidOnnLeEX1oAyZJQA6rv76GxKAqYKnzsV63Too sOr29CV52G64i7IBH9QA09Sp6VbUn1VgsGvCtsT1eu23GOjugnYbWblKmLcB+Et3REyk qzHJKeFDvGUKCO1E+oUoiQbeK7tmguRmqPQC5RZcr0tG24FI1QlRXWTk3E7Tw1iue0Cd s2/YPEN51Vp/iQng1Ds4gIP6XO5+J5HRUXN3fFxEvE5ZuDChf9OIyFTqXwhd6RhS0ovh dkO4LxKEjxoFjQl+GLsD6O6YATRkJiQMb8YyoK5Gw2qCYxzi2cKlPFxNCEgVYh2MfAeO D1Qg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hLOjhxuhNlNogBtivzo6/IXGrtKFXbXe7bdo98vKvew=; fh=bKSAdOD9sjDLFpuVEw2QY/iOhn17PgYAzgX/PkCBS1w=; b=Nqc4lE1khNmXUGRJhmMjtozc5xLYN0Z545nZUEm577gHT3YOMTa8ETj3f7BU7NiEEw nrFw/LEzszChJSEqX3RTGii9LTtpZ9eJsJvGPOpjrGtRDTaarFAzNn3ZEwHj1CLz6HLa mNg4b5L/jX7qOKLZ1OG1axREi9wOkwWDAPEQhpLNmNuFJyD7c3pIfg/qY25aKSV3nZ4q GWPXxwYk6WtoquTbRH8bFrqgwTTiZeKmpIPoFNwFb1s+ITDCgLD/JI/paDTcPd89NiAM Z56Gc+/Orj2d49ffMU6696Woui06naroVzuMlvSKXi5LE6kg1hF75nym2akqrM5gvARI dq3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=Qe0WIIl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id rm3-20020a17090b3ec300b0027d1567f5e6si2697448pjb.133.2023.10.20.12.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 12:07:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=Qe0WIIl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id D4A2B83B8C85; Fri, 20 Oct 2023 12:07:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229889AbjJTTHR (ORCPT + 26 others); Fri, 20 Oct 2023 15:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230106AbjJTTHJ (ORCPT ); Fri, 20 Oct 2023 15:07:09 -0400 Received: from rcdn-iport-7.cisco.com (rcdn-iport-7.cisco.com [173.37.86.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7233C10C9; Fri, 20 Oct 2023 12:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2502; q=dns/txt; s=iport; t=1697828825; x=1699038425; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=slFAmSPvNAgschnNw3qQmhrZbli7ashLCnTbqYkfOek=; b=Qe0WIIl6P7yegH4FBMARHpZZ+wYwsMmG6Gimu0hHPwQ5KUU5mgm/OX3m JwP5JGcVXQ1nZzKE2kjDgc5jPL5Txye0OEkQJ9dpZR0SlXjasSSDKe5oo kJzx5QQYJjr3/CWYSoz8zahhE0cusm8Mq4fhH04vwaGZFpZKPhgllMA4y E=; X-CSE-ConnectionGUID: LOxnrS9lTw2AjmEyNgFijw== X-CSE-MsgGUID: WBJA61wgQo6wqkkpOtqStA== X-IronPort-AV: E=Sophos;i="6.03,239,1694736000"; d="scan'208";a="126421320" Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by rcdn-iport-7.cisco.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2023 19:07:04 +0000 Received: from localhost.cisco.com ([10.193.101.253]) (authenticated bits=0) by rcdn-core-11.cisco.com (8.15.2/8.15.2) with ESMTPSA id 39KJ6XPE026372 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 20 Oct 2023 19:07:03 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 02/13] scsi: fnic: Add and use fnic number Date: Fri, 20 Oct 2023 12:06:18 -0700 Message-Id: <20231020190629.338623-3-kartilak@cisco.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20231020190629.338623-1-kartilak@cisco.com> References: <20231020190629.338623-1-kartilak@cisco.com> 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-11.cisco.com X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Fri, 20 Oct 2023 12:07:39 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780302597668260021 X-GMAIL-MSGID: 1780302597668260021 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 */