From a248384e6420ebda63f788d33fac1c0a081e57a8 Mon Sep 17 00:00:00 2001 From: Varun Prakash Date: Mon, 10 Jun 2019 18:36:34 +0530 Subject: cxgb4/libcxgb/cxgb4i/cxgbit: enable eDRAM page pods for iSCSI Page pods are used for direct data placement, this patch enables eDRAM page pods if firmware supports this feature. Signed-off-by: Varun Prakash Signed-off-by: David S. Miller --- drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 10 +++++++--- drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 17 +++++++++++++---- drivers/scsi/cxgbi/libcxgbi.c | 15 +++++++++------ drivers/scsi/cxgbi/libcxgbi.h | 9 +++++---- 4 files changed, 34 insertions(+), 17 deletions(-) (limited to 'drivers/scsi') diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c index b8dd9e648dd0..524cdbcd29aa 100644 --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c @@ -1243,8 +1243,12 @@ static int cxgb3i_ddp_init(struct cxgbi_device *cdev) tformat.pgsz_order[i] = uinfo.pgsz_factor[i]; cxgbi_tagmask_check(tagmask, &tformat); - cxgbi_ddp_ppm_setup(&tdev->ulp_iscsi, cdev, &tformat, ppmax, - uinfo.llimit, uinfo.llimit, 0); + err = cxgbi_ddp_ppm_setup(&tdev->ulp_iscsi, cdev, &tformat, + (uinfo.ulimit - uinfo.llimit + 1), + uinfo.llimit, uinfo.llimit, 0, 0, 0); + if (err) + return err; + if (!(cdev->flags & CXGBI_FLAG_DDP_OFF)) { uinfo.tagmask = tagmask; uinfo.ulimit = uinfo.llimit + (ppmax << PPOD_SIZE_SHIFT); @@ -1318,7 +1322,7 @@ static void cxgb3i_dev_open(struct t3cdev *t3dev) err = cxgb3i_ddp_init(cdev); if (err) { - pr_info("0x%p ddp init failed\n", cdev); + pr_info("0x%p ddp init failed %d\n", cdev, err); goto err_out; } diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 124f3345420f..66d6e1f4b3c3 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c @@ -2070,7 +2070,7 @@ static int cxgb4i_ddp_init(struct cxgbi_device *cdev) struct net_device *ndev = cdev->ports[0]; struct cxgbi_tag_format tformat; unsigned int ppmax; - int i; + int i, err; if (!lldi->vr->iscsi.size) { pr_warn("%s, iscsi NOT enabled, check config!\n", ndev->name); @@ -2086,8 +2086,17 @@ static int cxgb4i_ddp_init(struct cxgbi_device *cdev) & 0xF; cxgbi_tagmask_check(lldi->iscsi_tagmask, &tformat); - cxgbi_ddp_ppm_setup(lldi->iscsi_ppm, cdev, &tformat, ppmax, - lldi->iscsi_llimit, lldi->vr->iscsi.start, 2); + pr_info("iscsi_edram.start 0x%x iscsi_edram.size 0x%x", + lldi->vr->ppod_edram.start, lldi->vr->ppod_edram.size); + + err = cxgbi_ddp_ppm_setup(lldi->iscsi_ppm, cdev, &tformat, + lldi->vr->iscsi.size, lldi->iscsi_llimit, + lldi->vr->iscsi.start, 2, + lldi->vr->ppod_edram.start, + lldi->vr->ppod_edram.size); + + if (err < 0) + return err; cdev->csk_ddp_setup_digest = ddp_setup_conn_digest; cdev->csk_ddp_setup_pgidx = ddp_setup_conn_pgidx; @@ -2141,7 +2150,7 @@ static void *t4_uld_add(const struct cxgb4_lld_info *lldi) rc = cxgb4i_ddp_init(cdev); if (rc) { - pr_info("t4 0x%p ddp init failed.\n", cdev); + pr_info("t4 0x%p ddp init failed %d.\n", cdev, rc); goto err_out; } rc = cxgb4i_ofld_init(cdev); diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 7d43e014bd21..3e17af8aedeb 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -1285,14 +1285,15 @@ EXPORT_SYMBOL_GPL(cxgbi_ddp_set_one_ppod); static unsigned char padding[4]; -void cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *cdev, - struct cxgbi_tag_format *tformat, unsigned int ppmax, - unsigned int llimit, unsigned int start, - unsigned int rsvd_factor) +int cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *cdev, + struct cxgbi_tag_format *tformat, + unsigned int iscsi_size, unsigned int llimit, + unsigned int start, unsigned int rsvd_factor, + unsigned int edram_start, unsigned int edram_size) { int err = cxgbi_ppm_init(ppm_pp, cdev->ports[0], cdev->pdev, - cdev->lldev, tformat, ppmax, llimit, start, - rsvd_factor); + cdev->lldev, tformat, iscsi_size, llimit, start, + rsvd_factor, edram_start, edram_size); if (err >= 0) { struct cxgbi_ppm *ppm = (struct cxgbi_ppm *)(*ppm_pp); @@ -1304,6 +1305,8 @@ void cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *cdev, } else { cdev->flags |= CXGBI_FLAG_DDP_OFF; } + + return err; } EXPORT_SYMBOL_GPL(cxgbi_ddp_ppm_setup); diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h index 1917ff57651d..84b96af52655 100644 --- a/drivers/scsi/cxgbi/libcxgbi.h +++ b/drivers/scsi/cxgbi/libcxgbi.h @@ -617,8 +617,9 @@ void cxgbi_ddp_page_size_factor(int *); void cxgbi_ddp_set_one_ppod(struct cxgbi_pagepod *, struct cxgbi_task_tag_info *, struct scatterlist **sg_pp, unsigned int *sg_off); -void cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *, - struct cxgbi_tag_format *, unsigned int ppmax, - unsigned int llimit, unsigned int start, - unsigned int rsvd_factor); +int cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *cdev, + struct cxgbi_tag_format *tformat, + unsigned int iscsi_size, unsigned int llimit, + unsigned int start, unsigned int rsvd_factor, + unsigned int edram_start, unsigned int edram_size); #endif /*__LIBCXGBI_H__*/ -- cgit v1.2.3