Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1231672rdb; Fri, 20 Oct 2023 12:07:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHg3TXOELOEyE58a/g2f3WiHSC1zBQmripqUen/M8g2c4zwcob73mkY9aWr3ddeas9H4ol0 X-Received: by 2002:a05:6e02:1c2b:b0:351:5322:b801 with SMTP id m11-20020a056e021c2b00b003515322b801mr3581690ilh.16.1697828876432; Fri, 20 Oct 2023 12:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697828876; cv=none; d=google.com; s=arc-20160816; b=OsVQMZl6K60g/JTFnPJPKy0S97NiK2wMlH/WB2mtE6Oj+mEWOVqMLoIUeAWGxuz4QS oxDokxWnGVNuhemy+LoMfyPkW8QIgTWqeAVNCvVZreHMZSecRCgIclLPq6aXE0L4PHzX /iAWUUu9VYfOg0C17TJQrqoHGRQ2SW8yMn2mAPv9R3Q7ralGKwNDP6jhvhN7yxNTxwCc zTTyQc4ZruGw9rasbGe5NPHCe4wjitlqXMPnN/fXH9ghJi4iXCnAM8ZACM0hC54MaDH1 3PwKipyCkUkYULv9tzlkUBbqxMIvv8JdyA2NGeIrN5SCelPtYOx/dmauGkvpKCkZ7VWL ovjQ== 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=gqNhDxbcPdNX7zA6xUqqKGVwPcItcIq95tVj70quFqE=; fh=bKSAdOD9sjDLFpuVEw2QY/iOhn17PgYAzgX/PkCBS1w=; b=c5sS9bIctdgZTZZse8NXTZUhUNPvYdNhCQjJKWDt3HJs3u8wF0YOW79Ix+QwMUXjBZ xfxhsgLLvsP6MSvPuy7M/TFs1ZjJF918iZLwA703zTjtwh1xMQHAeTGMhjXq5n3/APFR TI+OcjrqG7+OoDTc2XSvv62BvhoJqCIkg3MVwP/rttU44ZMt1IgtNEWuSapHNbnWeO9t W7NUQmu2e0YYlV1F9fVZyOaUWHOSgEqJaBuErsUdXsRG5wSpujVq2vrez6eC5BO3KbXM qvMsljRYHNysysESHRl5Y7U9BtIVMYVcj2b0k22tBbT2Z6hVFWshYVEUJ5s+97Yc1Qjd khaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=CZXxTqKh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=cisco.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id z16-20020a634c10000000b005b874265d26si2097915pga.284.2023.10.20.12.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 12:07:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=CZXxTqKh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 6B9EE82DAB55; Fri, 20 Oct 2023 12:07:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbjJTTHa (ORCPT + 99 others); Fri, 20 Oct 2023 15:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230297AbjJTTHT (ORCPT ); Fri, 20 Oct 2023 15:07:19 -0400 Received: from rcdn-iport-2.cisco.com (rcdn-iport-2.cisco.com [173.37.86.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B743CD7A; Fri, 20 Oct 2023 12:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3120; q=dns/txt; s=iport; t=1697828833; x=1699038433; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sjJkSqdln9qea/n4Fpj7gGInKVCSDN0znydRXK9ldtE=; b=CZXxTqKhayY1c+zfYKPwQa8YGh5R9HMOkbUBR/L8aBSnKg8nuIX3RpTT rVTyob7q1G5P4V4AjaaMBgL23c8SNz/Cb4KoMPVBT21UKU517SUueoUop 2hHFKb4Gl/OK+zchDtGP9rJr3+/GHFOS+7EpHRSLFG0qRmu/dmZO3VcKx s=; X-CSE-ConnectionGUID: cVOFaWG+TJGASHi4IPtMJg== X-CSE-MsgGUID: OweevoQdSeObhtMcX43nDQ== X-IronPort-AV: E=Sophos;i="6.03,239,1694736000"; d="scan'208";a="127269668" Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by rcdn-iport-2.cisco.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2023 19:07:11 +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 39KJ6XPI026372 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 20 Oct 2023 19:07:11 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 06/13] scsi: fnic: Refactor and redefine fnic.h for multiqueue Date: Fri, 20 Oct 2023 12:06:22 -0700 Message-Id: <20231020190629.338623-7-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 Content-Transfer-Encoding: 8bit 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 20 Oct 2023 12:07:52 -0700 (PDT) Refactor and re-define values in fnic.h to implement multiqueue(MQ) functionality. VIC firmware allows fnic to create up to 64 copy workqueues. Update the copy workqueue max to 64. Modify the interrupt index to be in sync with the firmware to support MQ. Add irq number to the MSIX entry. Define a software workqueue table to track the status of io_reqs. Define a base for the copy workqueue. Reviewed-by: Sesidhar Baddela Reviewed-by: Arulprabhu Ponnusamy Signed-off-by: Karan Tilak Kumar --- drivers/scsi/fnic/fnic.h | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index 9fd01a867788..f4390fc96323 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h @@ -163,12 +163,21 @@ do { \ #define FNIC_MAIN_NOTE(kern_level, host, fmt, args...) \ shost_printk(kern_level, host, fmt, ##args) +#define FNIC_WQ_COPY_MAX 64 +#define FNIC_WQ_MAX 1 +#define FNIC_RQ_MAX 1 +#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX) +#define FNIC_DFLT_IO_COMPLETIONS 256 + +#define FNIC_MQ_CQ_INDEX 2 + extern const char *fnic_state_str[]; enum fnic_intx_intr_index { FNIC_INTX_WQ_RQ_COPYWQ, - FNIC_INTX_ERR, + FNIC_INTX_DUMMY, FNIC_INTX_NOTIFY, + FNIC_INTX_ERR, FNIC_INTX_INTR_MAX, }; @@ -176,7 +185,7 @@ enum fnic_msix_intr_index { FNIC_MSIX_RQ, FNIC_MSIX_WQ, FNIC_MSIX_WQ_COPY, - FNIC_MSIX_ERR_NOTIFY, + FNIC_MSIX_ERR_NOTIFY = FNIC_MSIX_WQ_COPY + FNIC_WQ_COPY_MAX, FNIC_MSIX_INTR_MAX, }; @@ -185,6 +194,7 @@ struct fnic_msix_entry { char devname[IFNAMSIZ + 11]; irqreturn_t (*isr)(int, void *); void *devid; + int irq_num; }; enum fnic_state { @@ -194,12 +204,6 @@ enum fnic_state { FNIC_IN_ETH_TRANS_FC_MODE, }; -#define FNIC_WQ_COPY_MAX 1 -#define FNIC_WQ_MAX 1 -#define FNIC_RQ_MAX 1 -#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX) -#define FNIC_DFLT_IO_COMPLETIONS 256 - struct mempool; enum fnic_evt { @@ -214,6 +218,13 @@ struct fnic_event { enum fnic_evt event; }; +struct fnic_cpy_wq { + unsigned long hw_lock_flags; + u16 active_ioreq_count; + u16 ioreq_table_size; + ____cacheline_aligned struct fnic_io_req **io_req_table; +}; + /* Per-instance private data structure */ struct fnic { int fnic_num; @@ -283,6 +294,7 @@ struct fnic { mempool_t *io_sgl_pool[FNIC_SGL_NUM_CACHES]; spinlock_t io_req_lock[FNIC_IO_LOCKS]; /* locks for scsi cmnds */ + unsigned int cpy_wq_base; struct work_struct link_work; struct work_struct frame_work; struct sk_buff_head frame_queue; @@ -302,6 +314,8 @@ struct fnic { /* copy work queue cache line section */ ____cacheline_aligned struct vnic_wq_copy hw_copy_wq[FNIC_WQ_COPY_MAX]; + ____cacheline_aligned struct fnic_cpy_wq sw_copy_wq[FNIC_WQ_COPY_MAX]; + /* completion queue cache line section */ ____cacheline_aligned struct vnic_cq cq[FNIC_CQ_MAX]; -- 2.31.1