Re: [net-next 3/6] cxgb4i,libcxgbi: add iSCSI DDP support
On Fri, Jul 15, 2016 at 07:43:10PM +0530, Steve Wise wrote: > > Add iSCSI DDP support in cxgb4i driver > > using common iSCSI DDP Page Pod Manager. > > > > Signed-off-by: Varun Prakash > > --- > > drivers/scsi/cxgbi/Makefile| 2 + > > drivers/scsi/cxgbi/cxgb3i/Kbuild | 1 + > > drivers/scsi/cxgbi/cxgb3i/Kconfig | 1 + > > Should the cxgb3i changes be in patch 4? Both cxgb3i and cxgb4i depends on libcxgbi, this patch adds DDP code in libcxgbi, to compile cxgb3i Kconfig and Kbuild update is required in this patch. > > > drivers/scsi/cxgbi/cxgb4i/Kbuild | 1 + > > drivers/scsi/cxgbi/cxgb4i/Kconfig | 1 + > > drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 145 > > drivers/scsi/cxgbi/libcxgbi.c | 331 > + > > drivers/scsi/cxgbi/libcxgbi.h | 27 ++- > > 8 files changed, 507 insertions(+), 2 deletions(-) > >
RE: [net-next 3/6] cxgb4i,libcxgbi: add iSCSI DDP support
> Add iSCSI DDP support in cxgb4i driver
> using common iSCSI DDP Page Pod Manager.
>
> Signed-off-by: Varun Prakash
> ---
> drivers/scsi/cxgbi/Makefile| 2 +
> drivers/scsi/cxgbi/cxgb3i/Kbuild | 1 +
> drivers/scsi/cxgbi/cxgb3i/Kconfig | 1 +
Should the cxgb3i changes be in patch 4?
> drivers/scsi/cxgbi/cxgb4i/Kbuild | 1 +
> drivers/scsi/cxgbi/cxgb4i/Kconfig | 1 +
> drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 145
> drivers/scsi/cxgbi/libcxgbi.c | 331
+
> drivers/scsi/cxgbi/libcxgbi.h | 27 ++-
> 8 files changed, 507 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/cxgbi/Makefile b/drivers/scsi/cxgbi/Makefile
> index 86007e3..a73781a 100644
> --- a/drivers/scsi/cxgbi/Makefile
> +++ b/drivers/scsi/cxgbi/Makefile
> @@ -1,2 +1,4 @@
> +ccflags-y += -Idrivers/net/ethernet/chelsio/libcxgb
> +
> obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libcxgbi.o cxgb3i/
> obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libcxgbi.o cxgb4i/
> diff --git a/drivers/scsi/cxgbi/cxgb3i/Kbuild
b/drivers/scsi/cxgbi/cxgb3i/Kbuild
> index 961a12f..663c52e 100644
> --- a/drivers/scsi/cxgbi/cxgb3i/Kbuild
> +++ b/drivers/scsi/cxgbi/cxgb3i/Kbuild
> @@ -1,3 +1,4 @@
> ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb3
> +ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/libcxgb
>
> obj-$(CONFIG_SCSI_CXGB3_ISCSI) += cxgb3i.o
> diff --git a/drivers/scsi/cxgbi/cxgb3i/Kconfig
b/drivers/scsi/cxgbi/cxgb3i/Kconfig
> index e460398..f68c871 100644
> --- a/drivers/scsi/cxgbi/cxgb3i/Kconfig
> +++ b/drivers/scsi/cxgbi/cxgb3i/Kconfig
> @@ -5,6 +5,7 @@ config SCSI_CXGB3_ISCSI
> select ETHERNET
> select NET_VENDOR_CHELSIO
> select CHELSIO_T3
> + select CHELSIO_LIB
> select SCSI_ISCSI_ATTRS
> ---help---
> This driver supports iSCSI offload for the Chelsio T3 devices.
> diff --git a/drivers/scsi/cxgbi/cxgb4i/Kbuild
b/drivers/scsi/cxgbi/cxgb4i/Kbuild
> index 3745864..38e03c2 100644
> --- a/drivers/scsi/cxgbi/cxgb4i/Kbuild
> +++ b/drivers/scsi/cxgbi/cxgb4i/Kbuild
> @@ -1,3 +1,4 @@
> ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb4
> +ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/libcxgb
>
> obj-$(CONFIG_SCSI_CXGB4_ISCSI) += cxgb4i.o
> diff --git a/drivers/scsi/cxgbi/cxgb4i/Kconfig
b/drivers/scsi/cxgbi/cxgb4i/Kconfig
> index 8c4e423..594f593 100644
> --- a/drivers/scsi/cxgbi/cxgb4i/Kconfig
> +++ b/drivers/scsi/cxgbi/cxgb4i/Kconfig
> @@ -5,6 +5,7 @@ config SCSI_CXGB4_ISCSI
> select ETHERNET
> select NET_VENDOR_CHELSIO
> select CHELSIO_T4
> + select CHELSIO_LIB
> select SCSI_ISCSI_ATTRS
> ---help---
> This driver supports iSCSI offload for the Chelsio T4 devices.
> diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
> index 2911214..521f9e4 100644
> --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
> +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
> @@ -1543,6 +1543,115 @@ int cxgb4i_ofld_init(struct cxgbi_device *cdev)
> return 0;
> }
>
> +static inline void
> +ulp_mem_io_set_hdr(struct cxgbi_device *cdev,
> +struct ulp_mem_io *req,
> +unsigned int wr_len, unsigned int dlen,
> +unsigned int pm_addr,
> +int tid)
> +{
nit: the type and function should be on the same line, yes? EG:
static inline void ulp_mem_io_set_hdr(...
> + struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
> + struct ulptx_idata *idata = (struct ulptx_idata *)(req + 1);
> +
> + INIT_ULPTX_WR(req, wr_len, 0, tid);
> + req->wr.wr_hi = htonl(FW_WR_OP_V(FW_ULPTX_WR) |
> + FW_WR_ATOMIC_V(0));
> + req->cmd = htonl(ULPTX_CMD_V(ULP_TX_MEM_WRITE) |
> + ULP_MEMIO_ORDER_V(is_t4(lldi->adapter_type)) |
> + T5_ULP_MEMIO_IMM_V(!is_t4(lldi->adapter_type)));
> + req->dlen = htonl(ULP_MEMIO_DATA_LEN_V(dlen >> 5));
> + req->lock_addr = htonl(ULP_MEMIO_ADDR_V(pm_addr >> 5));
> + req->len16 = htonl(DIV_ROUND_UP(wr_len - sizeof(req->wr), 16));
> +
> + idata->cmd_more = htonl(ULPTX_CMD_V(ULP_TX_SC_IMM));
> + idata->len = htonl(dlen);
> +}
> +
> +static struct sk_buff *
> +ddp_ppod_init_idata(struct cxgbi_device *cdev,
> + struct cxgbi_ppm *ppm,
> + unsigned int idx, unsigned int npods,
> + unsigned int tid)
Same here
> +{
> + unsigned int pm_addr = (idx << PPOD_SIZE_SHIFT) + ppm->llimit;
> + unsigned int dlen = npods << PPOD_SIZE_SHIFT;
> + unsigned int wr_len = roundup(sizeof(struct ulp_mem_io) +
> + sizeof(struct ulptx_idata) + dlen, 16);
> + struct sk_buff *skb = alloc_wr(wr_len, 0, GFP_ATOMIC);
> +
> + if (!skb) {
> + pr_err("%s: %s idx %u, npods %u, OOM.\n",
> +__func__, ppm->ndev->name, idx, npods);
> + return NULL;
> + }
> +
> + ulp_mem_io_set_hdr(cdev, (struct ulp_mem_io *)skb->hea
[net-next 3/6] cxgb4i,libcxgbi: add iSCSI DDP support
Add iSCSI DDP support in cxgb4i driver
using common iSCSI DDP Page Pod Manager.
Signed-off-by: Varun Prakash
---
drivers/scsi/cxgbi/Makefile| 2 +
drivers/scsi/cxgbi/cxgb3i/Kbuild | 1 +
drivers/scsi/cxgbi/cxgb3i/Kconfig | 1 +
drivers/scsi/cxgbi/cxgb4i/Kbuild | 1 +
drivers/scsi/cxgbi/cxgb4i/Kconfig | 1 +
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 145
drivers/scsi/cxgbi/libcxgbi.c | 331 +
drivers/scsi/cxgbi/libcxgbi.h | 27 ++-
8 files changed, 507 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/cxgbi/Makefile b/drivers/scsi/cxgbi/Makefile
index 86007e3..a73781a 100644
--- a/drivers/scsi/cxgbi/Makefile
+++ b/drivers/scsi/cxgbi/Makefile
@@ -1,2 +1,4 @@
+ccflags-y += -Idrivers/net/ethernet/chelsio/libcxgb
+
obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libcxgbi.o cxgb3i/
obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libcxgbi.o cxgb4i/
diff --git a/drivers/scsi/cxgbi/cxgb3i/Kbuild b/drivers/scsi/cxgbi/cxgb3i/Kbuild
index 961a12f..663c52e 100644
--- a/drivers/scsi/cxgbi/cxgb3i/Kbuild
+++ b/drivers/scsi/cxgbi/cxgb3i/Kbuild
@@ -1,3 +1,4 @@
ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb3
+ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/libcxgb
obj-$(CONFIG_SCSI_CXGB3_ISCSI) += cxgb3i.o
diff --git a/drivers/scsi/cxgbi/cxgb3i/Kconfig
b/drivers/scsi/cxgbi/cxgb3i/Kconfig
index e460398..f68c871 100644
--- a/drivers/scsi/cxgbi/cxgb3i/Kconfig
+++ b/drivers/scsi/cxgbi/cxgb3i/Kconfig
@@ -5,6 +5,7 @@ config SCSI_CXGB3_ISCSI
select ETHERNET
select NET_VENDOR_CHELSIO
select CHELSIO_T3
+ select CHELSIO_LIB
select SCSI_ISCSI_ATTRS
---help---
This driver supports iSCSI offload for the Chelsio T3 devices.
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kbuild b/drivers/scsi/cxgbi/cxgb4i/Kbuild
index 3745864..38e03c2 100644
--- a/drivers/scsi/cxgbi/cxgb4i/Kbuild
+++ b/drivers/scsi/cxgbi/cxgb4i/Kbuild
@@ -1,3 +1,4 @@
ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb4
+ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/libcxgb
obj-$(CONFIG_SCSI_CXGB4_ISCSI) += cxgb4i.o
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kconfig
b/drivers/scsi/cxgbi/cxgb4i/Kconfig
index 8c4e423..594f593 100644
--- a/drivers/scsi/cxgbi/cxgb4i/Kconfig
+++ b/drivers/scsi/cxgbi/cxgb4i/Kconfig
@@ -5,6 +5,7 @@ config SCSI_CXGB4_ISCSI
select ETHERNET
select NET_VENDOR_CHELSIO
select CHELSIO_T4
+ select CHELSIO_LIB
select SCSI_ISCSI_ATTRS
---help---
This driver supports iSCSI offload for the Chelsio T4 devices.
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 2911214..521f9e4 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -1543,6 +1543,115 @@ int cxgb4i_ofld_init(struct cxgbi_device *cdev)
return 0;
}
+static inline void
+ulp_mem_io_set_hdr(struct cxgbi_device *cdev,
+ struct ulp_mem_io *req,
+ unsigned int wr_len, unsigned int dlen,
+ unsigned int pm_addr,
+ int tid)
+{
+ struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
+ struct ulptx_idata *idata = (struct ulptx_idata *)(req + 1);
+
+ INIT_ULPTX_WR(req, wr_len, 0, tid);
+ req->wr.wr_hi = htonl(FW_WR_OP_V(FW_ULPTX_WR) |
+ FW_WR_ATOMIC_V(0));
+ req->cmd = htonl(ULPTX_CMD_V(ULP_TX_MEM_WRITE) |
+ ULP_MEMIO_ORDER_V(is_t4(lldi->adapter_type)) |
+ T5_ULP_MEMIO_IMM_V(!is_t4(lldi->adapter_type)));
+ req->dlen = htonl(ULP_MEMIO_DATA_LEN_V(dlen >> 5));
+ req->lock_addr = htonl(ULP_MEMIO_ADDR_V(pm_addr >> 5));
+ req->len16 = htonl(DIV_ROUND_UP(wr_len - sizeof(req->wr), 16));
+
+ idata->cmd_more = htonl(ULPTX_CMD_V(ULP_TX_SC_IMM));
+ idata->len = htonl(dlen);
+}
+
+static struct sk_buff *
+ddp_ppod_init_idata(struct cxgbi_device *cdev,
+ struct cxgbi_ppm *ppm,
+ unsigned int idx, unsigned int npods,
+ unsigned int tid)
+{
+ unsigned int pm_addr = (idx << PPOD_SIZE_SHIFT) + ppm->llimit;
+ unsigned int dlen = npods << PPOD_SIZE_SHIFT;
+ unsigned int wr_len = roundup(sizeof(struct ulp_mem_io) +
+ sizeof(struct ulptx_idata) + dlen, 16);
+ struct sk_buff *skb = alloc_wr(wr_len, 0, GFP_ATOMIC);
+
+ if (!skb) {
+ pr_err("%s: %s idx %u, npods %u, OOM.\n",
+ __func__, ppm->ndev->name, idx, npods);
+ return NULL;
+ }
+
+ ulp_mem_io_set_hdr(cdev, (struct ulp_mem_io *)skb->head, wr_len, dlen,
+ pm_addr, tid);
+
+ return skb;
+}
+
+static int ddp_ppod_write_idata(struct cxgbi_ppm *ppm, struct cxgbi_sock *csk,
+ struct cxgbi_task_tag_info *ttinfo,
+ unsigned int idx, unsigned int npods,
+
