diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-12-13 13:43:42 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-11 19:28:52 -0500 |
commit | df93ffcd748ce41e7b716c3056ae511939bb745e (patch) | |
tree | 864d0c841d417b8bb58bb88601416feb800c620b | |
parent | 118365721768f29d74718a59895ed7bd3c10b68e (diff) |
[SCSI] iscsi_tcp: fix setting of r2t
If we negotiate for X r2ts we have to use only X r2ts. We cannot
round up (we could send less though). It is ok to fail if it
is not something the driver can handle, so this patch just does
that.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index edebdf27af9b..e5be5fd4ef58 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -1774,12 +1774,12 @@ iscsi_conn_set_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, | |||
1774 | break; | 1774 | break; |
1775 | case ISCSI_PARAM_MAX_R2T: | 1775 | case ISCSI_PARAM_MAX_R2T: |
1776 | sscanf(buf, "%d", &value); | 1776 | sscanf(buf, "%d", &value); |
1777 | if (session->max_r2t == roundup_pow_of_two(value)) | 1777 | if (value <= 0 || !is_power_of_2(value)) |
1778 | return -EINVAL; | ||
1779 | if (session->max_r2t == value) | ||
1778 | break; | 1780 | break; |
1779 | iscsi_r2tpool_free(session); | 1781 | iscsi_r2tpool_free(session); |
1780 | iscsi_set_param(cls_conn, param, buf, buflen); | 1782 | iscsi_set_param(cls_conn, param, buf, buflen); |
1781 | if (session->max_r2t & (session->max_r2t - 1)) | ||
1782 | session->max_r2t = roundup_pow_of_two(session->max_r2t); | ||
1783 | if (iscsi_r2tpool_alloc(session)) | 1783 | if (iscsi_r2tpool_alloc(session)) |
1784 | return -ENOMEM; | 1784 | return -ENOMEM; |
1785 | break; | 1785 | break; |