Skip to content

Commit 5248788

Browse files
Varun PrakashNicholas Bellinger
authored andcommitted
target/cxgbit: Enable DDP for T6 only if data sequence and pdu are in order
Enable DDP for T6 only if DataSequenceInOrder=YES and DataPDUInOrder=YES to ensure inorder delivery of iSCSI pdus. Signed-off-by: Varun Prakash <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent d88b504 commit 5248788

File tree

1 file changed

+61
-25
lines changed

1 file changed

+61
-25
lines changed

drivers/target/iscsi/cxgbit/cxgbit_target.c

Lines changed: 61 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -653,26 +653,6 @@ static int cxgbit_set_iso_npdu(struct cxgbit_sock *csk)
653653
u32 max_npdu, max_iso_npdu;
654654

655655
if (conn->login->leading_connection) {
656-
param = iscsi_find_param_from_key(DATASEQUENCEINORDER,
657-
conn->param_list);
658-
if (!param) {
659-
pr_err("param not found key %s\n", DATASEQUENCEINORDER);
660-
return -1;
661-
}
662-
663-
if (strcmp(param->value, YES))
664-
return 0;
665-
666-
param = iscsi_find_param_from_key(DATAPDUINORDER,
667-
conn->param_list);
668-
if (!param) {
669-
pr_err("param not found key %s\n", DATAPDUINORDER);
670-
return -1;
671-
}
672-
673-
if (strcmp(param->value, YES))
674-
return 0;
675-
676656
param = iscsi_find_param_from_key(MAXBURSTLENGTH,
677657
conn->param_list);
678658
if (!param) {
@@ -683,11 +663,6 @@ static int cxgbit_set_iso_npdu(struct cxgbit_sock *csk)
683663
if (kstrtou32(param->value, 0, &mbl) < 0)
684664
return -1;
685665
} else {
686-
if (!conn->sess->sess_ops->DataSequenceInOrder)
687-
return 0;
688-
if (!conn->sess->sess_ops->DataPDUInOrder)
689-
return 0;
690-
691666
mbl = conn->sess->sess_ops->MaxBurstLength;
692667
}
693668

@@ -706,6 +681,53 @@ static int cxgbit_set_iso_npdu(struct cxgbit_sock *csk)
706681
return 0;
707682
}
708683

684+
/*
685+
* cxgbit_seq_pdu_inorder()
686+
* @csk: pointer to cxgbit socket structure
687+
*
688+
* This function checks whether data sequence and data
689+
* pdu are in order.
690+
*
691+
* Return: returns -1 on error, 0 if data sequence and
692+
* data pdu are in order, 1 if data sequence or data pdu
693+
* is not in order.
694+
*/
695+
static int cxgbit_seq_pdu_inorder(struct cxgbit_sock *csk)
696+
{
697+
struct iscsi_conn *conn = csk->conn;
698+
struct iscsi_param *param;
699+
700+
if (conn->login->leading_connection) {
701+
param = iscsi_find_param_from_key(DATASEQUENCEINORDER,
702+
conn->param_list);
703+
if (!param) {
704+
pr_err("param not found key %s\n", DATASEQUENCEINORDER);
705+
return -1;
706+
}
707+
708+
if (strcmp(param->value, YES))
709+
return 1;
710+
711+
param = iscsi_find_param_from_key(DATAPDUINORDER,
712+
conn->param_list);
713+
if (!param) {
714+
pr_err("param not found key %s\n", DATAPDUINORDER);
715+
return -1;
716+
}
717+
718+
if (strcmp(param->value, YES))
719+
return 1;
720+
721+
} else {
722+
if (!conn->sess->sess_ops->DataSequenceInOrder)
723+
return 1;
724+
if (!conn->sess->sess_ops->DataPDUInOrder)
725+
return 1;
726+
}
727+
728+
return 0;
729+
}
730+
709731
static int cxgbit_set_params(struct iscsi_conn *conn)
710732
{
711733
struct cxgbit_sock *csk = conn->context;
@@ -732,11 +754,24 @@ static int cxgbit_set_params(struct iscsi_conn *conn)
732754
}
733755

734756
if (!erl) {
757+
int ret;
758+
759+
ret = cxgbit_seq_pdu_inorder(csk);
760+
if (ret < 0) {
761+
return -1;
762+
} else if (ret > 0) {
763+
if (is_t5(cdev->lldi.adapter_type))
764+
goto enable_ddp;
765+
else
766+
goto enable_digest;
767+
}
768+
735769
if (test_bit(CDEV_ISO_ENABLE, &cdev->flags)) {
736770
if (cxgbit_set_iso_npdu(csk))
737771
return -1;
738772
}
739773

774+
enable_ddp:
740775
if (test_bit(CDEV_DDP_ENABLE, &cdev->flags)) {
741776
if (cxgbit_setup_conn_pgidx(csk,
742777
ppm->tformat.pgsz_idx_dflt))
@@ -745,6 +780,7 @@ static int cxgbit_set_params(struct iscsi_conn *conn)
745780
}
746781
}
747782

783+
enable_digest:
748784
if (cxgbit_set_digest(csk))
749785
return -1;
750786

0 commit comments

Comments
 (0)