From: Shai Malin <smalin@marvell.com>
To: <netdev@vger.kernel.org>, <linux-nvme@lists.infradead.org>,
<sagi@grimberg.me>, <hch@lst.de>, <axboe@fb.com>,
<kbusch@kernel.org>
Cc: "David S . Miller davem @ davemloft . net --cc=Jakub Kicinski"
<kuba@kernel.org>,
smalin@marvell.com, aelior@marvell.com, mkalderon@marvell.com,
okulkarni@marvell.com, pkushwaha@marvell.com,
malin1024@gmail.com, "Arie Gershberg" <agershberg@marvell.com>
Subject: [RFC PATCH v4 16/27] qedn: Add qedn - Marvell's NVMeTCP HW offload vendor driver
Date: Thu, 29 Apr 2021 22:09:15 +0300 [thread overview]
Message-ID: <20210429190926.5086-17-smalin@marvell.com> (raw)
In-Reply-To: <20210429190926.5086-1-smalin@marvell.com>
This patch will present the skeleton of the qedn driver.
The new driver will be added under "drivers/nvme/hw/qedn" and will be
enabled by the Kconfig "Marvell NVM Express over Fabrics TCP offload".
The internal implementation:
- qedn.h:
Includes all common structs to be used by the qedn vendor driver.
- qedn_main.c
Includes the qedn_init and qedn_cleanup implementation.
As part of the qedn init, the driver will register as a pci device and
will work with the Marvell fastlinQ NICs.
As part of the probe, the driver will register to the nvme_tcp_offload
(ULP).
Acked-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Arie Gershberg <agershberg@marvell.com>
Signed-off-by: Prabhakar Kushwaha <pkushwaha@marvell.com>
Signed-off-by: Omkar Kulkarni <okulkarni@marvell.com>
Signed-off-by: Michal Kalderon <mkalderon@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.com>
Signed-off-by: Shai Malin <smalin@marvell.com>
---
MAINTAINERS | 10 ++
drivers/nvme/Kconfig | 1 +
drivers/nvme/Makefile | 1 +
drivers/nvme/hw/Kconfig | 8 ++
drivers/nvme/hw/Makefile | 3 +
drivers/nvme/hw/qedn/Makefile | 5 +
drivers/nvme/hw/qedn/qedn.h | 19 +++
drivers/nvme/hw/qedn/qedn_main.c | 201 +++++++++++++++++++++++++++++++
8 files changed, 248 insertions(+)
create mode 100644 drivers/nvme/hw/Kconfig
create mode 100644 drivers/nvme/hw/Makefile
create mode 100644 drivers/nvme/hw/qedn/Makefile
create mode 100644 drivers/nvme/hw/qedn/qedn.h
create mode 100644 drivers/nvme/hw/qedn/qedn_main.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 0d85ae9e61e2..2d6f50523db8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14688,6 +14688,16 @@ S: Supported
F: drivers/infiniband/hw/qedr/
F: include/uapi/rdma/qedr-abi.h
+QLOGIC QL4xxx NVME-TCP-OFFLOAD DRIVER
+M: Shai Malin <smalin@marvell.com>
+M: Ariel Elior <aelior@marvell.com>
+L: linux-nvme@lists.infradead.org
+S: Supported
+W: http://git.infradead.org/nvme.git
+T: git://git.infradead.org/nvme.git
+F: drivers/nvme/hw/qedn/
+F: include/linux/qed/
+
QLOGIC QLA1280 SCSI DRIVER
M: Michael Reed <mdr@sgi.com>
L: linux-scsi@vger.kernel.org
diff --git a/drivers/nvme/Kconfig b/drivers/nvme/Kconfig
index 87ae409a32b9..827c2c9f0ad1 100644
--- a/drivers/nvme/Kconfig
+++ b/drivers/nvme/Kconfig
@@ -3,5 +3,6 @@ menu "NVME Support"
source "drivers/nvme/host/Kconfig"
source "drivers/nvme/target/Kconfig"
+source "drivers/nvme/hw/Kconfig"
endmenu
diff --git a/drivers/nvme/Makefile b/drivers/nvme/Makefile
index fb42c44609a8..14c569040ef2 100644
--- a/drivers/nvme/Makefile
+++ b/drivers/nvme/Makefile
@@ -2,3 +2,4 @@
obj-y += host/
obj-y += target/
+obj-y += hw/
\ No newline at end of file
diff --git a/drivers/nvme/hw/Kconfig b/drivers/nvme/hw/Kconfig
new file mode 100644
index 000000000000..374f1f9dbd3d
--- /dev/null
+++ b/drivers/nvme/hw/Kconfig
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config NVME_QEDN
+ tristate "Marvell NVM Express over Fabrics TCP offload"
+ depends on NVME_TCP_OFFLOAD
+ help
+ This enables the Marvell NVMe TCP offload support (qedn).
+
+ If unsure, say N.
diff --git a/drivers/nvme/hw/Makefile b/drivers/nvme/hw/Makefile
new file mode 100644
index 000000000000..7780ea5ab520
--- /dev/null
+++ b/drivers/nvme/hw/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_NVME_QEDN) += qedn/
diff --git a/drivers/nvme/hw/qedn/Makefile b/drivers/nvme/hw/qedn/Makefile
new file mode 100644
index 000000000000..cb169bbaae18
--- /dev/null
+++ b/drivers/nvme/hw/qedn/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_NVME_QEDN) := qedn.o
+
+qedn-y := qedn_main.o
\ No newline at end of file
diff --git a/drivers/nvme/hw/qedn/qedn.h b/drivers/nvme/hw/qedn/qedn.h
new file mode 100644
index 000000000000..bcd0748a10fd
--- /dev/null
+++ b/drivers/nvme/hw/qedn/qedn.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2021 Marvell. All rights reserved.
+ */
+
+#ifndef _QEDN_H_
+#define _QEDN_H_
+
+/* Driver includes */
+#include "../../host/tcp-offload.h"
+
+#define QEDN_MODULE_NAME "qedn"
+
+struct qedn_ctx {
+ struct pci_dev *pdev;
+ struct nvme_tcp_ofld_dev qedn_ofld_dev;
+};
+
+#endif /* _QEDN_H_ */
diff --git a/drivers/nvme/hw/qedn/qedn_main.c b/drivers/nvme/hw/qedn/qedn_main.c
new file mode 100644
index 000000000000..31d6d86d6eb7
--- /dev/null
+++ b/drivers/nvme/hw/qedn/qedn_main.c
@@ -0,0 +1,201 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2021 Marvell. All rights reserved.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ /* Kernel includes */
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+/* Driver includes */
+#include "qedn.h"
+
+#define CHIP_NUM_AHP_NVMETCP 0x8194
+
+static struct pci_device_id qedn_pci_tbl[] = {
+ { PCI_VDEVICE(QLOGIC, CHIP_NUM_AHP_NVMETCP), 0 },
+ {0, 0},
+};
+
+static int
+qedn_claim_dev(struct nvme_tcp_ofld_dev *dev,
+ struct nvme_tcp_ofld_ctrl_con_params *conn_params)
+{
+ /* Placeholder - qedn_claim_dev */
+
+ return 0;
+}
+
+static int qedn_create_queue(struct nvme_tcp_ofld_queue *queue, int qid,
+ size_t q_size)
+{
+ /* Placeholder - qedn_create_queue */
+
+ return 0;
+}
+
+static void qedn_drain_queue(struct nvme_tcp_ofld_queue *queue)
+{
+ /* Placeholder - qedn_drain_queue */
+}
+
+static void qedn_destroy_queue(struct nvme_tcp_ofld_queue *queue)
+{
+ /* Placeholder - qedn_destroy_queue */
+}
+
+static int qedn_poll_queue(struct nvme_tcp_ofld_queue *queue)
+{
+ /*
+ * Poll queue support will be added as part of future
+ * enhancements.
+ */
+
+ return 0;
+}
+
+static int qedn_init_req(struct nvme_tcp_ofld_req *req)
+{
+ /*
+ * tcp-offload layer taking care of everything,
+ * Nothing required from qedn driver, hence empty.
+ */
+
+ return 0;
+}
+
+static void qedn_commit_rqs(struct nvme_tcp_ofld_queue *queue)
+{
+ /* Placeholder - queue work */
+}
+
+static int qedn_send_req(struct nvme_tcp_ofld_req *req)
+{
+ /* Placeholder - qedn_send_req */
+
+ return 0;
+}
+
+static struct nvme_tcp_ofld_ops qedn_ofld_ops = {
+ .name = "qedn",
+ .module = THIS_MODULE,
+ .required_opts = NVMF_OPT_TRADDR,
+ .allowed_opts = NVMF_OPT_TRSVCID | NVMF_OPT_NR_WRITE_QUEUES |
+ NVMF_OPT_HOST_TRADDR | NVMF_OPT_CTRL_LOSS_TMO |
+ NVMF_OPT_RECONNECT_DELAY,
+ /* These flags will be as part of future enhancements
+ * NVMF_OPT_HDR_DIGEST | NVMF_OPT_DATA_DIGEST |
+ * NVMF_OPT_NR_POLL_QUEUES | NVMF_OPT_TOS
+ */
+ .claim_dev = qedn_claim_dev,
+ .create_queue = qedn_create_queue,
+ .drain_queue = qedn_drain_queue,
+ .destroy_queue = qedn_destroy_queue,
+ .poll_queue = qedn_poll_queue,
+ .init_req = qedn_init_req,
+ .send_req = qedn_send_req,
+ .commit_rqs = qedn_commit_rqs,
+};
+
+static void __qedn_remove(struct pci_dev *pdev)
+{
+ struct qedn_ctx *qedn = pci_get_drvdata(pdev);
+
+ pr_notice("Starting qedn_remove\n");
+ nvme_tcp_ofld_unregister_dev(&qedn->qedn_ofld_dev);
+ kfree(qedn);
+ pr_notice("Ending qedn_remove successfully\n");
+}
+
+static void qedn_remove(struct pci_dev *pdev)
+{
+ __qedn_remove(pdev);
+}
+
+static void qedn_shutdown(struct pci_dev *pdev)
+{
+ __qedn_remove(pdev);
+}
+
+static struct qedn_ctx *qedn_alloc_ctx(struct pci_dev *pdev)
+{
+ struct qedn_ctx *qedn = NULL;
+
+ qedn = kzalloc(sizeof(*qedn), GFP_KERNEL);
+ if (!qedn)
+ return NULL;
+
+ qedn->pdev = pdev;
+ pci_set_drvdata(pdev, qedn);
+
+ return qedn;
+}
+
+static int __qedn_probe(struct pci_dev *pdev)
+{
+ struct qedn_ctx *qedn;
+ int rc;
+
+ pr_notice("Starting qedn probe\n");
+
+ qedn = qedn_alloc_ctx(pdev);
+ if (!qedn)
+ return -ENODEV;
+
+ qedn->qedn_ofld_dev.ops = &qedn_ofld_ops;
+ INIT_LIST_HEAD(&qedn->qedn_ofld_dev.entry);
+ rc = nvme_tcp_ofld_register_dev(&qedn->qedn_ofld_dev);
+ if (rc)
+ goto release_qedn;
+
+ return 0;
+release_qedn:
+ kfree(qedn);
+
+ return rc;
+}
+
+static int qedn_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+ return __qedn_probe(pdev);
+}
+
+static struct pci_driver qedn_pci_driver = {
+ .name = QEDN_MODULE_NAME,
+ .id_table = qedn_pci_tbl,
+ .probe = qedn_probe,
+ .remove = qedn_remove,
+ .shutdown = qedn_shutdown,
+};
+
+static int __init qedn_init(void)
+{
+ int rc;
+
+ rc = pci_register_driver(&qedn_pci_driver);
+ if (rc) {
+ pr_err("Failed to register pci driver\n");
+
+ return -EINVAL;
+ }
+
+ pr_notice("driver loaded successfully\n");
+
+ return 0;
+}
+
+static void __exit qedn_cleanup(void)
+{
+ pci_unregister_driver(&qedn_pci_driver);
+ pr_notice("Unloading qedn ended\n");
+}
+
+module_init(qedn_init);
+module_exit(qedn_cleanup);
+
+MODULE_LICENSE("GPL v2");
+MODULE_SOFTDEP("pre: qede nvme-fabrics nvme-tcp-offload");
+MODULE_DESCRIPTION("Marvell 25/50/100G NVMe-TCP Offload Host Driver");
+MODULE_AUTHOR("Marvell");
--
2.22.0
next prev parent reply other threads:[~2021-04-29 19:19 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 19:08 [RFC PATCH v4 00/27] NVMeTCP Offload ULP and QEDN Device Driver Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 01/27] qed: Add NVMeTCP Offload PF Level FW and HW HSI Shai Malin
2021-05-01 16:50 ` Hannes Reinecke
2021-05-03 15:23 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 02/27] qed: Add NVMeTCP Offload Connection " Shai Malin
2021-05-01 17:28 ` Hannes Reinecke
2021-05-03 15:25 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 03/27] qed: Add qed-NVMeTCP personality Shai Malin
2021-05-02 11:11 ` Hannes Reinecke
2021-05-03 15:26 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 04/27] qed: Add support of HW filter block Shai Malin
2021-05-02 11:13 ` Hannes Reinecke
2021-05-03 15:27 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 05/27] qed: Add NVMeTCP Offload IO Level FW and HW HSI Shai Malin
2021-05-02 11:22 ` Hannes Reinecke
2021-05-04 16:25 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 06/27] qed: Add NVMeTCP Offload IO Level FW Initializations Shai Malin
2021-05-02 11:24 ` Hannes Reinecke
2021-05-04 16:28 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 07/27] qed: Add IP services APIs support Shai Malin
2021-05-02 11:26 ` Hannes Reinecke
2021-05-03 15:44 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 08/27] nvme-tcp-offload: Add nvme-tcp-offload - NVMeTCP HW offload ULP Shai Malin
2021-05-01 12:18 ` Hannes Reinecke
2021-05-03 15:46 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 09/27] nvme-fabrics: Move NVMF_ALLOWED_OPTS and NVMF_REQUIRED_OPTS definitions Shai Malin
2021-05-01 12:19 ` Hannes Reinecke
2021-05-03 15:50 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 10/27] nvme-tcp-offload: Add device scan implementation Shai Malin
2021-05-01 12:25 ` Hannes Reinecke
2021-05-05 17:52 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 11/27] nvme-tcp-offload: Add controller level implementation Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 12/27] nvme-tcp-offload: Add controller level error recovery implementation Shai Malin
2021-05-01 16:29 ` Hannes Reinecke
2021-05-03 15:52 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 13/27] nvme-tcp-offload: Add queue level implementation Shai Malin
2021-05-01 16:36 ` Hannes Reinecke
2021-05-03 15:56 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 14/27] nvme-tcp-offload: Add IO " Shai Malin
2021-05-01 16:38 ` Hannes Reinecke
2021-05-04 16:34 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 15/27] nvme-tcp-offload: Add Timeout and ASYNC Support Shai Malin
2021-05-01 16:45 ` Hannes Reinecke
2021-05-04 16:49 ` Shai Malin
2021-04-29 19:09 ` Shai Malin [this message]
2021-05-02 11:27 ` [RFC PATCH v4 16/27] qedn: Add qedn - Marvell's NVMeTCP HW offload vendor driver Hannes Reinecke
2021-05-04 16:52 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 17/27] qedn: Add qedn probe Shai Malin
2021-05-02 11:28 ` Hannes Reinecke
2021-05-08 11:01 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 18/27] qedn: Add qedn_claim_dev API support Shai Malin
2021-05-02 11:29 ` Hannes Reinecke
2021-05-07 13:57 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 19/27] qedn: Add IRQ and fast-path resources initializations Shai Malin
2021-05-02 11:32 ` Hannes Reinecke
2021-05-05 17:54 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 20/27] qedn: Add connection-level slowpath functionality Shai Malin
2021-05-02 11:37 ` Hannes Reinecke
2021-05-05 17:56 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 21/27] qedn: Add support of configuring HW filter block Shai Malin
2021-05-02 11:38 ` Hannes Reinecke
2021-05-05 17:57 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 22/27] qedn: Add IO level nvme_req and fw_cq workqueues Shai Malin
2021-05-02 11:42 ` Hannes Reinecke
2021-05-07 13:56 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 23/27] qedn: Add support of Task and SGL Shai Malin
2021-05-02 11:48 ` Hannes Reinecke
2021-05-07 14:00 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 24/27] qedn: Add support of NVME ICReq & ICResp Shai Malin
2021-05-02 11:53 ` Hannes Reinecke
2021-05-05 18:01 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 25/27] qedn: Add IO level fastpath functionality Shai Malin
2021-05-02 11:54 ` Hannes Reinecke
2021-05-05 18:04 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 26/27] qedn: Add Connection and IO level recovery flows Shai Malin
2021-05-02 11:57 ` Hannes Reinecke
2021-05-05 18:06 ` Shai Malin
2021-04-29 19:09 ` [RFC PATCH v4 27/27] qedn: Add support of ASYNC Shai Malin
2021-05-02 11:59 ` Hannes Reinecke
2021-05-05 18:08 ` Shai Malin
2021-05-01 16:47 ` [RFC PATCH v4 00/27] NVMeTCP Offload ULP and QEDN Device Driver Hannes Reinecke
2021-05-03 15:13 ` Shai Malin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210429190926.5086-17-smalin@marvell.com \
--to=smalin@marvell.com \
--cc=aelior@marvell.com \
--cc=agershberg@marvell.com \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=malin1024@gmail.com \
--cc=mkalderon@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=okulkarni@marvell.com \
--cc=pkushwaha@marvell.com \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).