From patchwork Fri Oct 27 18:02:51 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: 159055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp788740vqb; Fri, 27 Oct 2023 11:04:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHx4V6U/IeQAmaetgZvjBv/2H1GBWwWrym7C1uWd/I49ghYxx1tr47u25VAeJ2VMUq4ynCe X-Received: by 2002:a05:6808:f08:b0:3b2:f5be:4fd5 with SMTP id m8-20020a0568080f0800b003b2f5be4fd5mr4313747oiw.14.1698429857916; Fri, 27 Oct 2023 11:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698429857; cv=none; d=google.com; s=arc-20160816; b=aNGnAS+T2Q+yd2JbCcoXOAnX1xPv6lbX3071bXEAgBRW2mHF/ykycgSt9b+BBwk0ZK lWYrQEmZs0OajcJ33txAufNsdTaz8EnE5iDIND0sUD43Mn5l804N29u2Roiv7OqqCS4z FFtwqlS2H5XMtlgAX2cTn7Ns3jckliP50UqbVqgMi1Xrt1/r80tsxix7cIq7+yLCXCQq 6xNcrNeIuQgsynp5m8C2K6HwuykWvs4DVhV4SM6gzE4JXtb8+2+WSHZXTav/VwLhtMYk HqyrQ7uL5/v90ONZXpxsTbT9vV9BEO5HXJS4atEVIaEZWUoKEaZfk7VSW5qRodlNOE+C caWQ== 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=Bhr/OBupi+rTwzg+xCz1BVu5+6ueVMiZzbnjch/k+6uGcZ+D+Jtmb+A3taq+7nIrDC +wEJ8rLki28YmvQ1hgBeaEBIF8ClQm2qbS4+fFdW0KiMrwA2dBj8Oqkafli0SLxQYDEz yotqsBJEVvjboEMT4PVOxmqR4GemzX7O7YYWY9I1MYQYwr/+EBr8JB9sWJVFhTezxIXq td873WoIek3j8qAgArkeV/ZMlslh818pb2EA8miATMBKHvWSc9Je5x5mnxIElqQRdWRF GeVFO8b4m+Y7vAX88zGggG/bFicXgRdJ9c2ldtexQve7jkVXSEiLqMNF94zcM+1m52vg ub5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=IhqegN0O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id o194-20020a2541cb000000b00d9cb78a4cd2si3389839yba.243.2023.10.27.11.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 11:04:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=IhqegN0O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id E1CFD85C77A2; Fri, 27 Oct 2023 11:04:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346225AbjJ0SDh (ORCPT + 25 others); Fri, 27 Oct 2023 14:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232600AbjJ0SDc (ORCPT ); Fri, 27 Oct 2023 14:03:32 -0400 Received: from alln-iport-4.cisco.com (alln-iport-4.cisco.com [173.37.142.91]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C216F4; Fri, 27 Oct 2023 11:03:30 -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=1698429810; x=1699639410; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=slFAmSPvNAgschnNw3qQmhrZbli7ashLCnTbqYkfOek=; b=IhqegN0O8F21QqN/5/KYTRvkzVgJ6nFqOLbepNCQ2BlyGly85Yd65+0/ l3/fJ1WtXwMkvgEnQmZ57KolRz09MWtX0+OOo0wful5Ae7TCprC5dM3Lr 0nu5jOtMCWc3RiBlRHelz2cqABnxZJl+gsWGk8P2DsQc9MLimpBXMJOPK g=; X-CSE-ConnectionGUID: g5mnZOM3QESImaYNOt+F7g== X-CSE-MsgGUID: +H+3OqtuS5egXBBZ9ZLWvA== X-IronPort-AV: E=Sophos;i="6.03,256,1694736000"; d="scan'208";a="181456396" Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by alln-iport-4.cisco.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2023 18:03:28 +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 39RI39Oe029226 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 27 Oct 2023 18:03:27 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 v2 02/13] scsi: fnic: Add and use fnic number Date: Fri, 27 Oct 2023 11:02:51 -0700 Message-Id: <20231027180302.418676-3-kartilak@cisco.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20231027180302.418676-1-kartilak@cisco.com> References: <20231027180302.418676-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,URIBL_BLOCKED, 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 pete.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 (pete.vger.email [0.0.0.0]); Fri, 27 Oct 2023 11:04:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780932787033077932 X-GMAIL-MSGID: 1780932787033077932 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 */