diff options
Diffstat (limited to 'drivers/scsi/cxgb3i')
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i.h | 2 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_ddp.c | 32 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_iscsi.c | 5 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_offload.c | 4 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_pdu.c | 19 |
5 files changed, 36 insertions, 26 deletions
diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h index d362860e7504..59b0958d2d11 100644 --- a/drivers/scsi/cxgb3i/cxgb3i.h +++ b/drivers/scsi/cxgb3i/cxgb3i.h | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "cxgb3i_offload.h" | 34 | #include "cxgb3i_offload.h" |
35 | #include "cxgb3i_ddp.h" | 35 | #include "cxgb3i_ddp.h" |
36 | 36 | ||
37 | #define CXGB3I_SCSI_QDEPTH_DFLT 128 | 37 | #define CXGB3I_SCSI_HOST_QDEPTH 1024 |
38 | #define CXGB3I_MAX_TARGET CXGB3I_MAX_CONN | 38 | #define CXGB3I_MAX_TARGET CXGB3I_MAX_CONN |
39 | #define CXGB3I_MAX_LUN 512 | 39 | #define CXGB3I_MAX_LUN 512 |
40 | #define ISCSI_PDU_NONPAYLOAD_MAX \ | 40 | #define ISCSI_PDU_NONPAYLOAD_MAX \ |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c index d06a661c209f..99c912547902 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c +++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c | |||
@@ -120,20 +120,26 @@ static void clear_ddp_map(struct cxgb3i_ddp_info *ddp, unsigned int tag, | |||
120 | } | 120 | } |
121 | 121 | ||
122 | static inline int ddp_find_unused_entries(struct cxgb3i_ddp_info *ddp, | 122 | static inline int ddp_find_unused_entries(struct cxgb3i_ddp_info *ddp, |
123 | int start, int max, int count, | 123 | unsigned int start, unsigned int max, |
124 | unsigned int count, | ||
124 | struct cxgb3i_gather_list *gl) | 125 | struct cxgb3i_gather_list *gl) |
125 | { | 126 | { |
126 | unsigned int i, j; | 127 | unsigned int i, j, k; |
127 | 128 | ||
129 | /* not enough entries */ | ||
130 | if ((max - start) < count) | ||
131 | return -EBUSY; | ||
132 | |||
133 | max -= count; | ||
128 | spin_lock(&ddp->map_lock); | 134 | spin_lock(&ddp->map_lock); |
129 | for (i = start; i <= max;) { | 135 | for (i = start; i < max;) { |
130 | for (j = 0; j < count; j++) { | 136 | for (j = 0, k = i; j < count; j++, k++) { |
131 | if (ddp->gl_map[i + j]) | 137 | if (ddp->gl_map[k]) |
132 | break; | 138 | break; |
133 | } | 139 | } |
134 | if (j == count) { | 140 | if (j == count) { |
135 | for (j = 0; j < count; j++) | 141 | for (j = 0, k = i; j < count; j++, k++) |
136 | ddp->gl_map[i + j] = gl; | 142 | ddp->gl_map[k] = gl; |
137 | spin_unlock(&ddp->map_lock); | 143 | spin_unlock(&ddp->map_lock); |
138 | return i; | 144 | return i; |
139 | } | 145 | } |
@@ -354,7 +360,7 @@ int cxgb3i_ddp_tag_reserve(struct t3cdev *tdev, unsigned int tid, | |||
354 | struct cxgb3i_ddp_info *ddp = tdev->ulp_iscsi; | 360 | struct cxgb3i_ddp_info *ddp = tdev->ulp_iscsi; |
355 | struct pagepod_hdr hdr; | 361 | struct pagepod_hdr hdr; |
356 | unsigned int npods; | 362 | unsigned int npods; |
357 | int idx = -1, idx_max; | 363 | int idx = -1; |
358 | int err = -ENOMEM; | 364 | int err = -ENOMEM; |
359 | u32 sw_tag = *tagp; | 365 | u32 sw_tag = *tagp; |
360 | u32 tag; | 366 | u32 tag; |
@@ -367,17 +373,17 @@ int cxgb3i_ddp_tag_reserve(struct t3cdev *tdev, unsigned int tid, | |||
367 | } | 373 | } |
368 | 374 | ||
369 | npods = (gl->nelem + PPOD_PAGES_MAX - 1) >> PPOD_PAGES_SHIFT; | 375 | npods = (gl->nelem + PPOD_PAGES_MAX - 1) >> PPOD_PAGES_SHIFT; |
370 | idx_max = ddp->nppods - npods + 1; | ||
371 | 376 | ||
372 | if (ddp->idx_last == ddp->nppods) | 377 | if (ddp->idx_last == ddp->nppods) |
373 | idx = ddp_find_unused_entries(ddp, 0, idx_max, npods, gl); | 378 | idx = ddp_find_unused_entries(ddp, 0, ddp->nppods, npods, gl); |
374 | else { | 379 | else { |
375 | idx = ddp_find_unused_entries(ddp, ddp->idx_last + 1, | 380 | idx = ddp_find_unused_entries(ddp, ddp->idx_last + 1, |
376 | idx_max, npods, gl); | 381 | ddp->nppods, npods, gl); |
377 | if (idx < 0 && ddp->idx_last >= npods) | 382 | if (idx < 0 && ddp->idx_last >= npods) { |
378 | idx = ddp_find_unused_entries(ddp, 0, | 383 | idx = ddp_find_unused_entries(ddp, 0, |
379 | ddp->idx_last - npods + 1, | 384 | min(ddp->idx_last + npods, ddp->nppods), |
380 | npods, gl); | 385 | npods, gl); |
386 | } | ||
381 | } | 387 | } |
382 | if (idx < 0) { | 388 | if (idx < 0) { |
383 | ddp_log_debug("xferlen %u, gl %u, npods %u NO DDP.\n", | 389 | ddp_log_debug("xferlen %u, gl %u, npods %u NO DDP.\n", |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c index fff8e4327644..9212400b9b13 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c +++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c | |||
@@ -876,13 +876,14 @@ static struct scsi_host_template cxgb3i_host_template = { | |||
876 | .proc_name = "cxgb3i", | 876 | .proc_name = "cxgb3i", |
877 | .queuecommand = iscsi_queuecommand, | 877 | .queuecommand = iscsi_queuecommand, |
878 | .change_queue_depth = iscsi_change_queue_depth, | 878 | .change_queue_depth = iscsi_change_queue_depth, |
879 | .can_queue = CXGB3I_SCSI_QDEPTH_DFLT - 1, | 879 | .can_queue = CXGB3I_SCSI_HOST_QDEPTH, |
880 | .sg_tablesize = SG_ALL, | 880 | .sg_tablesize = SG_ALL, |
881 | .max_sectors = 0xFFFF, | 881 | .max_sectors = 0xFFFF, |
882 | .cmd_per_lun = CXGB3I_SCSI_QDEPTH_DFLT, | 882 | .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, |
883 | .eh_abort_handler = iscsi_eh_abort, | 883 | .eh_abort_handler = iscsi_eh_abort, |
884 | .eh_device_reset_handler = iscsi_eh_device_reset, | 884 | .eh_device_reset_handler = iscsi_eh_device_reset, |
885 | .eh_target_reset_handler = iscsi_eh_target_reset, | 885 | .eh_target_reset_handler = iscsi_eh_target_reset, |
886 | .target_alloc = iscsi_target_alloc, | ||
886 | .use_clustering = DISABLE_CLUSTERING, | 887 | .use_clustering = DISABLE_CLUSTERING, |
887 | .this_id = -1, | 888 | .this_id = -1, |
888 | }; | 889 | }; |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c b/drivers/scsi/cxgb3i/cxgb3i_offload.c index 4d8654cdbdae..e11c9c180f39 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_offload.c +++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c | |||
@@ -1737,7 +1737,7 @@ int cxgb3i_c3cn_send_pdus(struct s3_conn *c3cn, struct sk_buff *skb) | |||
1737 | c3cn_tx_debug("c3cn 0x%p, snd %u - %u > %u.\n", | 1737 | c3cn_tx_debug("c3cn 0x%p, snd %u - %u > %u.\n", |
1738 | c3cn, c3cn->write_seq, c3cn->snd_una, | 1738 | c3cn, c3cn->write_seq, c3cn->snd_una, |
1739 | cxgb3_snd_win); | 1739 | cxgb3_snd_win); |
1740 | err = -EAGAIN; | 1740 | err = -ENOBUFS; |
1741 | goto out_err; | 1741 | goto out_err; |
1742 | } | 1742 | } |
1743 | 1743 | ||
@@ -1775,6 +1775,8 @@ done: | |||
1775 | out_err: | 1775 | out_err: |
1776 | if (copied == 0 && err == -EPIPE) | 1776 | if (copied == 0 && err == -EPIPE) |
1777 | copied = c3cn->err ? c3cn->err : -EPIPE; | 1777 | copied = c3cn->err ? c3cn->err : -EPIPE; |
1778 | else | ||
1779 | copied = err; | ||
1778 | goto done; | 1780 | goto done; |
1779 | } | 1781 | } |
1780 | 1782 | ||
diff --git a/drivers/scsi/cxgb3i/cxgb3i_pdu.c b/drivers/scsi/cxgb3i/cxgb3i_pdu.c index 7eebc9a7cb35..709105071177 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_pdu.c +++ b/drivers/scsi/cxgb3i/cxgb3i_pdu.c | |||
@@ -400,17 +400,18 @@ int cxgb3i_conn_xmit_pdu(struct iscsi_task *task) | |||
400 | return 0; | 400 | return 0; |
401 | } | 401 | } |
402 | 402 | ||
403 | if (err < 0 && err != -EAGAIN) { | 403 | if (err == -EAGAIN || err == -ENOBUFS) { |
404 | kfree_skb(skb); | 404 | /* reset skb to send when we are called again */ |
405 | cxgb3i_tx_debug("itt 0x%x, skb 0x%p, len %u/%u, xmit err %d.\n", | 405 | tdata->skb = skb; |
406 | task->itt, skb, skb->len, skb->data_len, err); | ||
407 | iscsi_conn_printk(KERN_ERR, task->conn, "xmit err %d.\n", err); | ||
408 | iscsi_conn_failure(task->conn, ISCSI_ERR_XMIT_FAILED); | ||
409 | return err; | 406 | return err; |
410 | } | 407 | } |
411 | /* reset skb to send when we are called again */ | 408 | |
412 | tdata->skb = skb; | 409 | kfree_skb(skb); |
413 | return -EAGAIN; | 410 | cxgb3i_tx_debug("itt 0x%x, skb 0x%p, len %u/%u, xmit err %d.\n", |
411 | task->itt, skb, skb->len, skb->data_len, err); | ||
412 | iscsi_conn_printk(KERN_ERR, task->conn, "xmit err %d.\n", err); | ||
413 | iscsi_conn_failure(task->conn, ISCSI_ERR_XMIT_FAILED); | ||
414 | return err; | ||
414 | } | 415 | } |
415 | 416 | ||
416 | int cxgb3i_pdu_init(void) | 417 | int cxgb3i_pdu_init(void) |