Skip to contentSkip to conversation

cxgb4i v5: iscsi driver

PATCH Superseded [email protected] 2 participants 3 messages Aug 9, 2010 – Aug 11, 2010

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 cxgb4i v5: iscsi driver

[PATCH 2/3] cxgb4i v5: iscsi driver

From: Karen Xie <[email protected]>

Add cxgb4i iSCSI driver.

This patch implements the cxgb4i iscsi connection acceleration for the open-iscsi initiator.

The cxgb4i driver offers the iscsi PDU based offload:
- digest insertion and verification
- payload direct-placement into host memory buffer.

---

 drivers/scsi/cxgbi/Kconfig         |    7 
 drivers/scsi/cxgbi/Makefile        |    1 
 drivers/scsi/cxgbi/cxgb4i/Kbuild   |    3 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1551 ++++++++++++++++++++++++++++++++++++
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h |   42 +
 5 files changed, 1604 insertions(+), 0 deletions(-)
 create mode 100644 drivers/scsi/cxgbi/Kconfig
 create mode 100644 drivers/scsi/cxgbi/Makefile
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kbuild
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h
drivers/scsi/Kconfig +1 -0
index 158284f..704622d 100644
@@ -371,6 +371,7 @@ config ISCSI_TCP
 	 http://open-iscsi.org
 
 source "drivers/scsi/cxgb3i/Kconfig"
+source "drivers/scsi/cxgbi/Kconfig"
 source "drivers/scsi/bnx2i/Kconfig"
 source "drivers/scsi/be2iscsi/Kconfig"
 
drivers/scsi/Makefile +1 -0
index 2a3fca2..1694ab7 100644
@@ -133,6 +133,7 @@ obj-$(CONFIG_SCSI_STEX)		+= stex.o
 obj-$(CONFIG_SCSI_MVSAS)	+= mvsas/
 obj-$(CONFIG_PS3_ROM)		+= ps3rom.o
 obj-$(CONFIG_SCSI_CXGB3_ISCSI)	+= libiscsi.o libiscsi_tcp.o cxgb3i/
+obj-$(CONFIG_SCSI_CXGB4_ISCSI)	+= libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)	+= libiscsi.o bnx2i/
 obj-$(CONFIG_BE2ISCSI)		+= libiscsi.o be2iscsi/
 obj-$(CONFIG_SCSI_PMCRAID)	+= pmcraid.o
drivers/scsi/cxgbi/Kconfig new file +7 -0
new file mode 100644
index 0000000..96c887a
@@ -0,0 +1,7 @@
+config SCSI_CXGB4_ISCSI
+	tristate "Chelsio T4 iSCSI support"
+	depends on CHELSIO_T4_DEPENDS
+	select CHELSIO_T4
+	select SCSI_ISCSI_ATTRS
+	---help---
+	This driver supports iSCSI offload for the Chelsio T4 devices.
drivers/scsi/cxgbi/Makefile new file +1 -0
new file mode 100644
index 0000000..9e8f604
@@ -0,0 +1 @@
+obj-$(CONFIG_SCSI_CXGB4_ISCSI)	+= libcxgbi.o cxgb4i/
drivers/scsi/cxgbi/cxgb4i/Kbuild new file +3 -0
new file mode 100644
index 0000000..b9f4af7
@@ -0,0 +1,3 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/net/cxgb4
+
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += cxgb4i.o
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c new file +1551 -0

1,551 lines not on this page · raw message

drivers/scsi/cxgbi/cxgb4i/cxgb4i.h new file +42 -0

42 lines not on this page · raw message

Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group.
To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
#1 lore raw
Quoted 33 lines · On 08/09/2010 12:53 PM, [email protected] wrote:
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c new file +33 -0
+
+static void *t4_uld_add(const struct cxgb4_lld_info *lldi)
+{
+	struct cxgbi_device *cdev;
+	struct port_info *pi;
+	int i, rc;
+
+	cxgb4i_log_info("%s", version);
+
+	cdev = cxgbi_device_register(sizeof(*lldi), lldi->nports);
+	if (!cdev) {
+		cxgb4i_log_info("t4 device 0x%p, register failed.\n", lldi);
+		return NULL;
+	}
+	cxgb4i_log_debug(1<<  CXGBI_DBG_DEV,
+			"t4 0x%p,0x%x, ports %u,%s, chan %u, q %u,%u, wr %u.\n",
+			cdev, lldi->adapter_type, lldi->nports,
+			lldi->ports[0]->name, lldi->nchan, lldi->ntxq,
+			lldi->nrxq, lldi->wr_cred);
+	for (i = 0; i<  lldi->nrxq; i++)
+			cxgb4i_log_debug(1<<  CXGBI_DBG_DEV,
+				"t4 0x%p, rxq id #%d: %u.\n",
+				cdev, i, lldi->rxq_ids[i]);
+
+	memcpy(cxgbi_cdev_priv(cdev), lldi, sizeof(*lldi));
+	cdev->flags = CXGBI_FLAG_DEV_T4;
+	cdev->pdev = lldi->pdev;
+	cdev->ports = lldi->ports;
+	cdev->nports = lldi->nports;
+	cdev->mtus = lldi->mtus;
+	cdev->nmtus = NMTUS;
+	cdev->snd_win = cxgb4i_snd_win;
+	cdev->rcv_win = cxgb4i_rcv_win;

drivers/scsi/cxgbi/cxgb4i/cxgb4i.c line 1433

Quoted 10 lines
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c new file +10 -0
+	cdev->rx_credit_thres = cxgb4i_rx_credit_thres;
+	cdev->skb_tx_rsvd = CXGB4I_TX_HEADER_LEN;
+	cdev->skb_rx_extra = sizeof(struct cpl_iscsi_hdr);
+	cdev->itp =&cxgb4i_iscsi_transport;
+
+	rc = cxgbi_iscsi_init(cdev);
+	if (rc) {
+		cxgb4i_log_info("t4 0x%p iscsi init failed\n", cdev);
+		goto err_out;
+	}

For each LLD (cxgb3i and cxgb4i) could it get called more than once? I mean if you had multiple cxgb3i HBAs could it get called once for each or is it called just once time for all cxgb3i hbas? If more than once the cxgbi_iscsi_init call to iscsi_register_transport would fail on the second call, because the iscsi class would not allow you to register the same transport twice.

author
#2 lore raw

Yes, you are right. I will fix it to make sure iscsi transport registration happens only once.
Thanks,
Karen

-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 11:38 AM
To: open-iscsi-/[email protected]
Cc: Karen Xie; [email protected]; [email protected]; Rakesh Ranjan; James.Bottomley-d9PhHud1JfjCXq6kfMZ53/[email protected]
Subject: Re: [PATCH 2/3] cxgb4i v5: iscsi driver

drivers/scsi/cxgbi/cxgb4i/cxgb4i.c

Quoted 12 lines · On 08/09/2010 12:53 PM, [email protected] wrote:
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c new file +12 -0
+
+static void *t4_uld_add(const struct cxgb4_lld_info *lldi)
+{
+	struct cxgbi_device *cdev;
+	struct port_info *pi;
+	int i, rc;
+
+	cxgb4i_log_info("%s", version);
+
+	cdev = cxgbi_device_register(sizeof(*lldi), lldi->nports);
+	if (!cdev) {
+		cxgb4i_log_info("t4 device 0x%p, register failed.\n",

lldi);

drivers/scsi/cxgbi/cxgb4i/cxgb4i.c

Quoted 4 lines
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c new file +4 -0
+		return NULL;
+	}
+	cxgb4i_log_debug(1<<  CXGBI_DBG_DEV,
+			"t4 0x%p,0x%x, ports %u,%s, chan %u, q %u,%u, wr

%u.\n",

Quoted 17 lines
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c new file +17 -0
+			cdev, lldi->adapter_type, lldi->nports,
+			lldi->ports[0]->name, lldi->nchan, lldi->ntxq,
+			lldi->nrxq, lldi->wr_cred);
+	for (i = 0; i<  lldi->nrxq; i++)
+			cxgb4i_log_debug(1<<  CXGBI_DBG_DEV,
+				"t4 0x%p, rxq id #%d: %u.\n",
+				cdev, i, lldi->rxq_ids[i]);
+
+	memcpy(cxgbi_cdev_priv(cdev), lldi, sizeof(*lldi));
+	cdev->flags = CXGBI_FLAG_DEV_T4;
+	cdev->pdev = lldi->pdev;
+	cdev->ports = lldi->ports;
+	cdev->nports = lldi->nports;
+	cdev->mtus = lldi->mtus;
+	cdev->nmtus = NMTUS;
+	cdev->snd_win = cxgb4i_snd_win;
+	cdev->rcv_win = cxgb4i_rcv_win;

drivers/scsi/cxgbi/cxgb4i/cxgb4i.c line 1433

Quoted 10 lines
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c new file +10 -0
+	cdev->rx_credit_thres = cxgb4i_rx_credit_thres;
+	cdev->skb_tx_rsvd = CXGB4I_TX_HEADER_LEN;
+	cdev->skb_rx_extra = sizeof(struct cpl_iscsi_hdr);
+	cdev->itp =&cxgb4i_iscsi_transport;
+
+	rc = cxgbi_iscsi_init(cdev);
+	if (rc) {
+		cxgb4i_log_info("t4 0x%p iscsi init failed\n", cdev);
+		goto err_out;
+	}

For each LLD (cxgb3i and cxgb4i) could it get called more than once? I mean if you had multiple cxgb3i HBAs could it get called once for each or is it called just once time for all cxgb3i hbas? If more than once the cxgbi_iscsi_init call to iscsi_register_transport would fail on the second call, because the iscsi class would not allow you to register the

same transport twice.

Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group.
To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.