From 0801c242a33426fddc005c2f559a3d2fa6fca7eb Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:12 -0500 Subject: [SCSI] libiscsi, iscsi_tcp, ib_iser : add sw iscsi host get/set params helpers iscsid and udev need to key off the hw address being used so add some helpers for iser and iscsi tcp. Also convert them Signed-off-by: Mike Christie Cc: Roland Dreier Signed-off-by: James Bottomley --- drivers/infiniband/ulp/iser/iscsi_iser.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/infiniband') diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index dd221eda3ea6..2a99b7b6c906 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -576,6 +576,7 @@ static struct iscsi_transport iscsi_iser_transport = { ISCSI_PERSISTENT_ADDRESS | ISCSI_TARGET_NAME | ISCSI_TPGT, + .host_param_mask = ISCSI_HOST_HWADDRESS, .host_template = &iscsi_iser_sht, .conndata_size = sizeof(struct iscsi_conn), .max_lun = ISCSI_ISER_MAX_LUN, @@ -592,6 +593,9 @@ static struct iscsi_transport iscsi_iser_transport = { .get_session_param = iscsi_session_get_param, .start_conn = iscsi_iser_conn_start, .stop_conn = iscsi_conn_stop, + /* iscsi host params */ + .get_host_param = iscsi_host_get_param, + .set_host_param = iscsi_host_set_param, /* IO */ .send_pdu = iscsi_conn_send_pdu, .get_stats = iscsi_iser_conn_get_stats, -- cgit v1.2.1 From 8ad5781ae9702a8f95cfdf30967752e4297613ee Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:13 -0500 Subject: [SCSI] iscsi class, qla4xxx, iscsi_tcp, ib_iser: export/set initiator name For iscsi root boot, software iscsi needs to know what the BIOS/OF initiator used for the initiator name so this puts it in sysfs for userspace to be able to pick up. For hw iscsi, it is nice to see what the card is using. This patch adds the new param, and hooks in qla4xxx, iscsi_tcp, and ib_iser. Signed-off-by: Mike Christie Cc: Roland Dreier Cc: David C Somayajulu Signed-off-by: James Bottomley --- drivers/infiniband/ulp/iser/iscsi_iser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/infiniband') diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 2a99b7b6c906..e39d9a07bc5d 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -576,7 +576,8 @@ static struct iscsi_transport iscsi_iser_transport = { ISCSI_PERSISTENT_ADDRESS | ISCSI_TARGET_NAME | ISCSI_TPGT, - .host_param_mask = ISCSI_HOST_HWADDRESS, + .host_param_mask = ISCSI_HOST_HWADDRESS | + ISCSI_HOST_INITIATOR_NAME, .host_template = &iscsi_iser_sht, .conndata_size = sizeof(struct iscsi_conn), .max_lun = ISCSI_ISER_MAX_LUN, -- cgit v1.2.1 From 857ae0bdb72999936a28ce621e38e2e288c485da Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:15 -0500 Subject: [SCSI] iscsi: Some fixes in preparation for bidirectional support - total_length - Remove shadow of request length from struct iscsi_cmd_task. - change all users to use scsi_cmnd->request_bufflen directly (With bidi we will use scsi-ml API to retrieve in/out length) Signed-off-by: Boaz Harrosh Signed-off-by: Benny Halevy Signed-off-by: Mike Christie Cc: Roland Dreier Signed-off-by: James Bottomley --- drivers/infiniband/ulp/iser/iscsi_iser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/infiniband') diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index e39d9a07bc5d..568f88bf7c91 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -140,10 +140,10 @@ iscsi_iser_cmd_init(struct iscsi_cmd_task *ctask) iser_ctask->iser_conn = iser_conn; if (sc->sc_data_direction == DMA_TO_DEVICE) { - BUG_ON(ctask->total_length == 0); + BUG_ON(sc->request_bufflen == 0); debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n", - ctask->itt, ctask->total_length, ctask->imm_count, + ctask->itt, sc->request_bufflen, ctask->imm_count, ctask->unsol_count); } -- cgit v1.2.1 From b2c6416736b847b91950bd43cc5153e11a1f83ee Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:16 -0500 Subject: [SCSI] iscsi class, iscsi_tcp, ib_iser: add sysfs chap file The attached patches add sysfs files for the chap settings to the iscsi transport class, iscsi_tcp and ib_iser. This is needed for software iscsi because there are times when iscsid can die and it will need to reread the values it was using. And it is needed by qla4xxx for basic management opertaions. This patch does not hook in qla4xxx yet, because I am not sure the mbx command to use. Signed-off-by: Mike Christie Cc: Roland Dreier Signed-off-by: James Bottomley --- drivers/infiniband/ulp/iser/iscsi_iser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/infiniband') diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 568f88bf7c91..6c8cd09c58f0 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -574,8 +574,9 @@ static struct iscsi_transport iscsi_iser_transport = { ISCSI_EXP_STATSN | ISCSI_PERSISTENT_PORT | ISCSI_PERSISTENT_ADDRESS | - ISCSI_TARGET_NAME | - ISCSI_TPGT, + ISCSI_TARGET_NAME | ISCSI_TPGT | + ISCSI_USERNAME | ISCSI_PASSWORD | + ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN, .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_INITIATOR_NAME, .host_template = &iscsi_iser_sht, -- cgit v1.2.1 From 77a23c21aaa723f6b0ffc4a701be8c8e5a32346d Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:18 -0500 Subject: [SCSI] libiscsi: fix iscsi cmdsn allocation The cmdsn allocation and pdu transmit code can race, and we can end up sending a pdu with cmdsn 10 before a pdu with 5. The target will then fail the connection/session. This patch fixes the problem by delaying the cmdsn allocation until we are about to send the pdu. This also removes the xmitmutex. We were using the connection xmitmutex during error handling to handle races with mtask and ctask cleanup and completion. For ctasks we now have nice refcounting and for the mtask, if we hit the case where the mtask timesout and it is floating around somewhere in the driver, we end up dropping the session. And to handle session level cleanup, we use the xmit suspend bit along with scsi_flush_queue and the session lock to make sure that the xmit thread is not possibly transmitting a task while we are trying to kill it. Signed-off-by: Mike Christie Cc: Roland Dreier Signed-off-by: James Bottomley --- drivers/infiniband/ulp/iser/iscsi_iser.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'drivers/infiniband') diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 6c8cd09c58f0..9782190a9ee5 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -134,19 +134,9 @@ iscsi_iser_cmd_init(struct iscsi_cmd_task *ctask) { struct iscsi_iser_conn *iser_conn = ctask->conn->dd_data; struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; - struct scsi_cmnd *sc = ctask->sc; iser_ctask->command_sent = 0; iser_ctask->iser_conn = iser_conn; - - if (sc->sc_data_direction == DMA_TO_DEVICE) { - BUG_ON(sc->request_bufflen == 0); - - debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n", - ctask->itt, sc->request_bufflen, ctask->imm_count, - ctask->unsol_count); - } - iser_ctask_rdma_init(iser_ctask); } @@ -219,6 +209,14 @@ iscsi_iser_ctask_xmit(struct iscsi_conn *conn, struct iscsi_iser_cmd_task *iser_ctask = ctask->dd_data; int error = 0; + if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) { + BUG_ON(ctask->sc->request_bufflen == 0); + + debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n", + ctask->itt, ctask->sc->request_bufflen, + ctask->imm_count, ctask->unsol_count); + } + debug_scsi("ctask deq [cid %d itt 0x%x]\n", conn->id, ctask->itt); -- cgit v1.2.1 From 1548271ece9e9312fd5feb41fd58773b56a71d39 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:19 -0500 Subject: [SCSI] libiscsi: make can_queue configurable This patch allows us to set can_queue and cmds_per_lun from userspace when we create the session/host. From there we can set it on a per target basis. The patch fully converts iscsi_tcp, but only hooks up ib_iser for cmd_per_lun since it currently has a lots of preallocations based on can_queue. Signed-off-by: Mike Christie Cc: Roland Dreier Signed-off-by: James Bottomley --- drivers/infiniband/ulp/iser/iscsi_iser.c | 11 +++++++++-- drivers/infiniband/ulp/iser/iscsi_iser.h | 4 ++-- drivers/infiniband/ulp/iser/iser_verbs.c | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'drivers/infiniband') diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 9782190a9ee5..bed583c426e6 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -373,7 +373,8 @@ static struct iscsi_transport iscsi_iser_transport; static struct iscsi_cls_session * iscsi_iser_session_create(struct iscsi_transport *iscsit, struct scsi_transport_template *scsit, - uint32_t initial_cmdsn, uint32_t *hostno) + uint16_t cmds_max, uint16_t qdepth, + uint32_t initial_cmdsn, uint32_t *hostno) { struct iscsi_cls_session *cls_session; struct iscsi_session *session; @@ -384,7 +385,13 @@ iscsi_iser_session_create(struct iscsi_transport *iscsit, struct iscsi_iser_cmd_task *iser_ctask; struct iser_desc *desc; + /* + * we do not support setting can_queue cmd_per_lun from userspace yet + * because we preallocate so many resources + */ cls_session = iscsi_session_setup(iscsit, scsit, + ISCSI_DEF_XMIT_CMDS_MAX, + ISCSI_MAX_CMD_PER_LUN, sizeof(struct iscsi_iser_cmd_task), sizeof(struct iser_desc), initial_cmdsn, &hn); @@ -543,7 +550,7 @@ iscsi_iser_ep_disconnect(__u64 ep_handle) static struct scsi_host_template iscsi_iser_sht = { .name = "iSCSI Initiator over iSER, v." DRV_VER, .queuecommand = iscsi_queuecommand, - .can_queue = ISCSI_XMIT_CMDS_MAX - 1, + .can_queue = ISCSI_DEF_XMIT_CMDS_MAX - 1, .sg_tablesize = ISCSI_ISER_SG_TABLESIZE, .max_sectors = 1024, .cmd_per_lun = ISCSI_MAX_CMD_PER_LUN, diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index 8960196ffb0f..e2353701e8bb 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h @@ -98,7 +98,7 @@ #define ISER_MAX_TX_MISC_PDUS 6 /* NOOP_OUT(2), TEXT(1), * * SCSI_TMFUNC(2), LOGOUT(1) */ -#define ISER_QP_MAX_RECV_DTOS (ISCSI_XMIT_CMDS_MAX + \ +#define ISER_QP_MAX_RECV_DTOS (ISCSI_DEF_XMIT_CMDS_MAX + \ ISER_MAX_RX_MISC_PDUS + \ ISER_MAX_TX_MISC_PDUS) @@ -110,7 +110,7 @@ #define ISER_INFLIGHT_DATAOUTS 8 -#define ISER_QP_MAX_REQ_DTOS (ISCSI_XMIT_CMDS_MAX * \ +#define ISER_QP_MAX_REQ_DTOS (ISCSI_DEF_XMIT_CMDS_MAX * \ (1 + ISER_INFLIGHT_DATAOUTS) + \ ISER_MAX_TX_MISC_PDUS + \ ISER_MAX_RX_MISC_PDUS) diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 3702e2375553..2044de1164ac 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c @@ -155,8 +155,8 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn) params.max_pages_per_fmr = ISCSI_ISER_SG_TABLESIZE + 1; /* make the pool size twice the max number of SCSI commands * * the ML is expected to queue, watermark for unmap at 50% */ - params.pool_size = ISCSI_XMIT_CMDS_MAX * 2; - params.dirty_watermark = ISCSI_XMIT_CMDS_MAX; + params.pool_size = ISCSI_DEF_XMIT_CMDS_MAX * 2; + params.dirty_watermark = ISCSI_DEF_XMIT_CMDS_MAX; params.cache = 0; params.flush_function = NULL; params.access = (IB_ACCESS_LOCAL_WRITE | -- cgit v1.2.1 From d8196ed2181b4595eaf464a5bcbddb6c28649a39 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 30 May 2007 12:57:25 -0500 Subject: [SCSI] iscsi class, iscsi_tcp, iser, qla4xxx: add netdevname sysfs attr iSCSI must support software iscsi (iscsi_tcp, iser), hardware iscsi (qla4xxx), and partial offload (broadcom). To be able to allow each stack or driver or port (virtual or physical) to be able to log into the same target portal we use the initiator tuple [[HWADDRESS | NETDEVNAME], INITIATOR_NAME] and the target tuple [TARGETNAME, CONN_ADDRESS, CONN_PORT] to id a session. This patch adds the netdev name, which is used by software iscsi when it binds a session to a netdevice using the SO_BINDTODEVICE sock opt. It cannot use HWADDRESS because if someone did vlans then the same netdevice will have the same mac and the initiator,target id will not be unique. Signed-off-by: Mike Christie Cc: Roland Dreier Cc: David C Somayajulu Signed-off-by: James Bottomley --- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/infiniband') diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index bed583c426e6..1bf173decade 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -583,6 +583,7 @@ static struct iscsi_transport iscsi_iser_transport = { ISCSI_USERNAME | ISCSI_PASSWORD | ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN, .host_param_mask = ISCSI_HOST_HWADDRESS | + ISCSI_HOST_NETDEV_NAME | ISCSI_HOST_INITIATOR_NAME, .host_template = &iscsi_iser_sht, .conndata_size = sizeof(struct iscsi_conn), -- cgit v1.2.1 From bb350d1decd9c48ffaa7f7e263df3056df9f4f21 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Sat, 26 May 2007 02:28:25 +0900 Subject: [SCSI] ib_srp: convert to use the data buffer accessors - remove the unnecessary map_single path. - convert to use the new accessors for the sg lists and the parameters. Jens Axboe did the for_each_sg cleanup. Signed-off-by: FUJITA Tomonori Acked-by: Roland Dreier Signed-off-by: James Bottomley --- drivers/infiniband/ulp/srp/ib_srp.c | 63 ++++++++++++------------------------- drivers/infiniband/ulp/srp/ib_srp.h | 5 --- 2 files changed, 20 insertions(+), 48 deletions(-) (limited to 'drivers/infiniband') diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 39bf057fbc43..f01ca182f226 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -455,10 +455,7 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, struct srp_request *req) { - struct scatterlist *scat; - int nents; - - if (!scmnd->request_buffer || + if (!scsi_sglist(scmnd) || (scmnd->sc_data_direction != DMA_TO_DEVICE && scmnd->sc_data_direction != DMA_FROM_DEVICE)) return; @@ -468,20 +465,8 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd, req->fmr = NULL; } - /* - * This handling of non-SG commands can be killed when the - * SCSI midlayer no longer generates non-SG commands. - */ - if (likely(scmnd->use_sg)) { - nents = scmnd->use_sg; - scat = scmnd->request_buffer; - } else { - nents = 1; - scat = &req->fake_sg; - } - - ib_dma_unmap_sg(target->srp_host->dev->dev, scat, nents, - scmnd->sc_data_direction); + ib_dma_unmap_sg(target->srp_host->dev->dev, scsi_sglist(scmnd), + scsi_sg_count(scmnd), scmnd->sc_data_direction); } static void srp_remove_req(struct srp_target_port *target, struct srp_request *req) @@ -595,6 +580,7 @@ static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat, int ret; struct srp_device *dev = target->srp_host->dev; struct ib_device *ibdev = dev->dev; + struct scatterlist *sg; if (!dev->fmr_pool) return -ENODEV; @@ -604,16 +590,16 @@ static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat, return -EINVAL; len = page_cnt = 0; - for (i = 0; i < sg_cnt; ++i) { - unsigned int dma_len = ib_sg_dma_len(ibdev, &scat[i]); + scsi_for_each_sg(req->scmnd, sg, sg_cnt, i) { + unsigned int dma_len = ib_sg_dma_len(ibdev, sg); - if (ib_sg_dma_address(ibdev, &scat[i]) & ~dev->fmr_page_mask) { + if (ib_sg_dma_address(ibdev, sg) & ~dev->fmr_page_mask) { if (i > 0) return -EINVAL; else ++page_cnt; } - if ((ib_sg_dma_address(ibdev, &scat[i]) + dma_len) & + if ((ib_sg_dma_address(ibdev, sg) + dma_len) & ~dev->fmr_page_mask) { if (i < sg_cnt - 1) return -EINVAL; @@ -633,12 +619,12 @@ static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat, return -ENOMEM; page_cnt = 0; - for (i = 0; i < sg_cnt; ++i) { - unsigned int dma_len = ib_sg_dma_len(ibdev, &scat[i]); + scsi_for_each_sg(req->scmnd, sg, sg_cnt, i) { + unsigned int dma_len = ib_sg_dma_len(ibdev, sg); for (j = 0; j < dma_len; j += dev->fmr_page_size) dma_pages[page_cnt++] = - (ib_sg_dma_address(ibdev, &scat[i]) & + (ib_sg_dma_address(ibdev, sg) & dev->fmr_page_mask) + j; } @@ -673,7 +659,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, struct srp_device *dev; struct ib_device *ibdev; - if (!scmnd->request_buffer || scmnd->sc_data_direction == DMA_NONE) + if (!scsi_sglist(scmnd) || scmnd->sc_data_direction == DMA_NONE) return sizeof (struct srp_cmd); if (scmnd->sc_data_direction != DMA_FROM_DEVICE && @@ -683,18 +669,8 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, return -EINVAL; } - /* - * This handling of non-SG commands can be killed when the - * SCSI midlayer no longer generates non-SG commands. - */ - if (likely(scmnd->use_sg)) { - nents = scmnd->use_sg; - scat = scmnd->request_buffer; - } else { - nents = 1; - scat = &req->fake_sg; - sg_init_one(scat, scmnd->request_buffer, scmnd->request_bufflen); - } + nents = scsi_sg_count(scmnd); + scat = scsi_sglist(scmnd); dev = target->srp_host->dev; ibdev = dev->dev; @@ -724,6 +700,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, * descriptor. */ struct srp_indirect_buf *buf = (void *) cmd->add_data; + struct scatterlist *sg; u32 datalen = 0; int i; @@ -732,11 +709,11 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, sizeof (struct srp_indirect_buf) + count * sizeof (struct srp_direct_buf); - for (i = 0; i < count; ++i) { - unsigned int dma_len = ib_sg_dma_len(ibdev, &scat[i]); + scsi_for_each_sg(scmnd, sg, count, i) { + unsigned int dma_len = ib_sg_dma_len(ibdev, sg); buf->desc_list[i].va = - cpu_to_be64(ib_sg_dma_address(ibdev, &scat[i])); + cpu_to_be64(ib_sg_dma_address(ibdev, sg)); buf->desc_list[i].key = cpu_to_be32(dev->mr->rkey); buf->desc_list[i].len = cpu_to_be32(dma_len); @@ -802,9 +779,9 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) } if (rsp->flags & (SRP_RSP_FLAG_DOOVER | SRP_RSP_FLAG_DOUNDER)) - scmnd->resid = be32_to_cpu(rsp->data_out_res_cnt); + scsi_set_resid(scmnd, be32_to_cpu(rsp->data_out_res_cnt)); else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER)) - scmnd->resid = be32_to_cpu(rsp->data_in_res_cnt); + scsi_set_resid(scmnd, be32_to_cpu(rsp->data_in_res_cnt)); if (!req->tsk_mgmt) { scmnd->host_scribble = (void *) -1L; diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index 1d53c7bc368f..e3573e7038c4 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h @@ -106,11 +106,6 @@ struct srp_request { struct srp_iu *cmd; struct srp_iu *tsk_mgmt; struct ib_pool_fmr *fmr; - /* - * Fake scatterlist used when scmnd->use_sg==0. Can be killed - * when the SCSI midlayer no longer generates non-SG commands. - */ - struct scatterlist fake_sg; struct completion done; short index; u8 cmd_done; -- cgit v1.2.1 From da9c0c770e775e655e3f77c96d91ee557b117adb Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 1 Jun 2007 18:56:21 +0900 Subject: [SCSI] iscsi_iser: convert to use the data buffer accessors iscsi_iser: convert to use the data buffer accessors - remove the unnecessary map_single path. - convert to use the new accessors for the sg lists and the parameters. TODO: use scsi_for_each_sg(). Signed-off-by: FUJITA Tomonori Acked-by: Erez Zilber Signed-off-by: James Bottomley --- drivers/infiniband/ulp/iser/iscsi_iser.c | 4 ++-- drivers/infiniband/ulp/iser/iser_initiator.c | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'drivers/infiniband') diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 1bf173decade..effdee299b0c 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -210,10 +210,10 @@ iscsi_iser_ctask_xmit(struct iscsi_conn *conn, int error = 0; if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) { - BUG_ON(ctask->sc->request_bufflen == 0); + BUG_ON(scsi_bufflen(ctask->sc) == 0); debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n", - ctask->itt, ctask->sc->request_bufflen, + ctask->itt, scsi_bufflen(ctask->sc), ctask->imm_count, ctask->unsol_count); } diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 3651072f6c1f..9ea5b9aaba7c 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -351,18 +351,12 @@ int iser_send_command(struct iscsi_conn *conn, else data_buf = &iser_ctask->data[ISER_DIR_OUT]; - if (sc->use_sg) { /* using a scatter list */ - data_buf->buf = sc->request_buffer; - data_buf->size = sc->use_sg; - } else if (sc->request_bufflen) { - /* using a single buffer - convert it into one entry SG */ - sg_init_one(&data_buf->sg_single, - sc->request_buffer, sc->request_bufflen); - data_buf->buf = &data_buf->sg_single; - data_buf->size = 1; + if (scsi_sg_count(sc)) { /* using a scatter list */ + data_buf->buf = scsi_sglist(sc); + data_buf->size = scsi_sg_count(sc); } - data_buf->data_len = sc->request_bufflen; + data_buf->data_len = scsi_bufflen(sc); if (hdr->flags & ISCSI_FLAG_CMD_READ) { err = iser_prepare_read_cmd(ctask, edtl); -- cgit v1.2.1