aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarun Prakash <varun@chelsio.com>2018-07-11 12:33:43 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2018-07-12 23:04:06 -0400
commit1b350ea0c2f4df9aa30426614c8eb755a8c32814 (patch)
tree5d30c7e622c4d27f2bf288d41170c7978d111e4c
parent943e59fe78ee870d86c775fc9fee2ab68bd262a3 (diff)
scsi: target: iscsi: cxgbit: fix max iso npdu calculation
- rounddown CXGBIT_MAX_ISO_PAYLOAD by csk->emss before calculating max_iso_npdu to get max TCP payload in multiple of mss. - call cxgbit_set_digest() before cxgbit_set_iso_npdu() to set csk->submode, it is used in calculating number of iso pdus. Signed-off-by: Varun Prakash <varun@chelsio.com> Reviewed-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/target/iscsi/cxgbit/cxgbit_target.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c b/drivers/target/iscsi/cxgbit/cxgbit_target.c
index 514986b57c2d..25eb3891e34b 100644
--- a/drivers/target/iscsi/cxgbit/cxgbit_target.c
+++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c
@@ -652,6 +652,7 @@ static int cxgbit_set_iso_npdu(struct cxgbit_sock *csk)
652 struct iscsi_param *param; 652 struct iscsi_param *param;
653 u32 mrdsl, mbl; 653 u32 mrdsl, mbl;
654 u32 max_npdu, max_iso_npdu; 654 u32 max_npdu, max_iso_npdu;
655 u32 max_iso_payload;
655 656
656 if (conn->login->leading_connection) { 657 if (conn->login->leading_connection) {
657 param = iscsi_find_param_from_key(MAXBURSTLENGTH, 658 param = iscsi_find_param_from_key(MAXBURSTLENGTH,
@@ -670,8 +671,10 @@ static int cxgbit_set_iso_npdu(struct cxgbit_sock *csk)
670 mrdsl = conn_ops->MaxRecvDataSegmentLength; 671 mrdsl = conn_ops->MaxRecvDataSegmentLength;
671 max_npdu = mbl / mrdsl; 672 max_npdu = mbl / mrdsl;
672 673
673 max_iso_npdu = CXGBIT_MAX_ISO_PAYLOAD / 674 max_iso_payload = rounddown(CXGBIT_MAX_ISO_PAYLOAD, csk->emss);
674 (ISCSI_HDR_LEN + mrdsl + 675
676 max_iso_npdu = max_iso_payload /
677 (ISCSI_HDR_LEN + mrdsl +
675 cxgbit_digest_len[csk->submode]); 678 cxgbit_digest_len[csk->submode]);
676 679
677 csk->max_iso_npdu = min(max_npdu, max_iso_npdu); 680 csk->max_iso_npdu = min(max_npdu, max_iso_npdu);
@@ -741,6 +744,9 @@ static int cxgbit_set_params(struct iscsi_conn *conn)
741 if (conn_ops->MaxRecvDataSegmentLength > cdev->mdsl) 744 if (conn_ops->MaxRecvDataSegmentLength > cdev->mdsl)
742 conn_ops->MaxRecvDataSegmentLength = cdev->mdsl; 745 conn_ops->MaxRecvDataSegmentLength = cdev->mdsl;
743 746
747 if (cxgbit_set_digest(csk))
748 return -1;
749
744 if (conn->login->leading_connection) { 750 if (conn->login->leading_connection) {
745 param = iscsi_find_param_from_key(ERRORRECOVERYLEVEL, 751 param = iscsi_find_param_from_key(ERRORRECOVERYLEVEL,
746 conn->param_list); 752 conn->param_list);
@@ -764,7 +770,7 @@ static int cxgbit_set_params(struct iscsi_conn *conn)
764 if (is_t5(cdev->lldi.adapter_type)) 770 if (is_t5(cdev->lldi.adapter_type))
765 goto enable_ddp; 771 goto enable_ddp;
766 else 772 else
767 goto enable_digest; 773 return 0;
768 } 774 }
769 775
770 if (test_bit(CDEV_ISO_ENABLE, &cdev->flags)) { 776 if (test_bit(CDEV_ISO_ENABLE, &cdev->flags)) {
@@ -781,10 +787,6 @@ enable_ddp:
781 } 787 }
782 } 788 }
783 789
784enable_digest:
785 if (cxgbit_set_digest(csk))
786 return -1;
787
788 return 0; 790 return 0;
789} 791}
790 792