@@ -79,9 +79,10 @@ static int dack_mode = 1;
7979module_param (dack_mode , int , 0644 );
8080MODULE_PARM_DESC (dack_mode , "Delayed ack mode (default=1)" );
8181
82- int c4iw_max_read_depth = 8 ;
82+ uint c4iw_max_read_depth = 32 ;
8383module_param (c4iw_max_read_depth , int , 0644 );
84- MODULE_PARM_DESC (c4iw_max_read_depth , "Per-connection max ORD/IRD (default=8)" );
84+ MODULE_PARM_DESC (c4iw_max_read_depth ,
85+ "Per-connection max ORD/IRD (default=32)" );
8586
8687static int enable_tcp_timestamps ;
8788module_param (enable_tcp_timestamps , int , 0644 );
@@ -813,6 +814,8 @@ static void send_mpa_req(struct c4iw_ep *ep, struct sk_buff *skb,
813814 if (mpa_rev_to_use == 2 ) {
814815 mpa -> private_data_size = htons (ntohs (mpa -> private_data_size ) +
815816 sizeof (struct mpa_v2_conn_params ));
817+ PDBG ("%s initiator ird %u ord %u\n" , __func__ , ep -> ird ,
818+ ep -> ord );
816819 mpa_v2_params .ird = htons ((u16 )ep -> ird );
817820 mpa_v2_params .ord = htons ((u16 )ep -> ord );
818821
@@ -1182,8 +1185,8 @@ static int connect_request_upcall(struct c4iw_ep *ep)
11821185 sizeof (struct mpa_v2_conn_params );
11831186 } else {
11841187 /* this means MPA_v1 is used. Send max supported */
1185- event .ord = c4iw_max_read_depth ;
1186- event .ird = c4iw_max_read_depth ;
1188+ event .ord = cur_max_read_depth ( ep -> com . dev ) ;
1189+ event .ird = cur_max_read_depth ( ep -> com . dev ) ;
11871190 event .private_data_len = ep -> plen ;
11881191 event .private_data = ep -> mpa_pkt + sizeof (struct mpa_message );
11891192 }
@@ -1247,6 +1250,8 @@ static int update_rx_credits(struct c4iw_ep *ep, u32 credits)
12471250 return credits ;
12481251}
12491252
1253+ #define RELAXED_IRD_NEGOTIATION 1
1254+
12501255static int process_mpa_reply (struct c4iw_ep * ep , struct sk_buff * skb )
12511256{
12521257 struct mpa_message * mpa ;
@@ -1358,17 +1363,33 @@ static int process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb)
13581363 MPA_V2_IRD_ORD_MASK ;
13591364 resp_ord = ntohs (mpa_v2_params -> ord ) &
13601365 MPA_V2_IRD_ORD_MASK ;
1366+ PDBG ("%s responder ird %u ord %u ep ird %u ord %u\n" ,
1367+ __func__ , resp_ird , resp_ord , ep -> ird , ep -> ord );
13611368
13621369 /*
13631370 * This is a double-check. Ideally, below checks are
13641371 * not required since ird/ord stuff has been taken
13651372 * care of in c4iw_accept_cr
13661373 */
1367- if ((ep -> ird < resp_ord ) || (ep -> ord > resp_ird )) {
1374+ if (ep -> ird < resp_ord ) {
1375+ if (RELAXED_IRD_NEGOTIATION && resp_ord <=
1376+ ep -> com .dev -> rdev .lldi .max_ordird_qp )
1377+ ep -> ird = resp_ord ;
1378+ else
1379+ insuff_ird = 1 ;
1380+ } else if (ep -> ird > resp_ord ) {
1381+ ep -> ird = resp_ord ;
1382+ }
1383+ if (ep -> ord > resp_ird ) {
1384+ if (RELAXED_IRD_NEGOTIATION )
1385+ ep -> ord = resp_ird ;
1386+ else
1387+ insuff_ird = 1 ;
1388+ }
1389+ if (insuff_ird ) {
13681390 err = - ENOMEM ;
13691391 ep -> ird = resp_ord ;
13701392 ep -> ord = resp_ird ;
1371- insuff_ird = 1 ;
13721393 }
13731394
13741395 if (ntohs (mpa_v2_params -> ird ) &
@@ -1571,6 +1592,8 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb)
15711592 MPA_V2_IRD_ORD_MASK ;
15721593 ep -> ord = ntohs (mpa_v2_params -> ord ) &
15731594 MPA_V2_IRD_ORD_MASK ;
1595+ PDBG ("%s initiator ird %u ord %u\n" , __func__ , ep -> ird ,
1596+ ep -> ord );
15741597 if (ntohs (mpa_v2_params -> ird ) & MPA_V2_PEER2PEER_MODEL )
15751598 if (peer2peer ) {
15761599 if (ntohs (mpa_v2_params -> ord ) &
@@ -2724,40 +2747,50 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
27242747 BUG_ON (!qp );
27252748
27262749 set_bit (ULP_ACCEPT , & ep -> com .history );
2727- if ((conn_param -> ord > c4iw_max_read_depth ) ||
2728- (conn_param -> ird > c4iw_max_read_depth )) {
2750+ if ((conn_param -> ord > cur_max_read_depth ( ep -> com . dev ) ) ||
2751+ (conn_param -> ird > cur_max_read_depth ( ep -> com . dev ) )) {
27292752 abort_connection (ep , NULL , GFP_KERNEL );
27302753 err = - EINVAL ;
27312754 goto err ;
27322755 }
27332756
27342757 if (ep -> mpa_attr .version == 2 && ep -> mpa_attr .enhanced_rdma_conn ) {
27352758 if (conn_param -> ord > ep -> ird ) {
2736- ep -> ird = conn_param -> ird ;
2737- ep -> ord = conn_param -> ord ;
2738- send_mpa_reject (ep , conn_param -> private_data ,
2739- conn_param -> private_data_len );
2740- abort_connection (ep , NULL , GFP_KERNEL );
2741- err = - ENOMEM ;
2742- goto err ;
2759+ if (RELAXED_IRD_NEGOTIATION ) {
2760+ ep -> ord = ep -> ird ;
2761+ } else {
2762+ ep -> ird = conn_param -> ird ;
2763+ ep -> ord = conn_param -> ord ;
2764+ send_mpa_reject (ep , conn_param -> private_data ,
2765+ conn_param -> private_data_len );
2766+ abort_connection (ep , NULL , GFP_KERNEL );
2767+ err = - ENOMEM ;
2768+ goto err ;
2769+ }
27432770 }
2744- if (conn_param -> ird > ep -> ord ) {
2745- if (!ep -> ord )
2746- conn_param -> ird = 1 ;
2747- else {
2771+ if (conn_param -> ird < ep -> ord ) {
2772+ if (RELAXED_IRD_NEGOTIATION &&
2773+ ep -> ord <= h -> rdev .lldi .max_ordird_qp ) {
2774+ conn_param -> ird = ep -> ord ;
2775+ } else {
27482776 abort_connection (ep , NULL , GFP_KERNEL );
27492777 err = - ENOMEM ;
27502778 goto err ;
27512779 }
27522780 }
2753-
27542781 }
27552782 ep -> ird = conn_param -> ird ;
27562783 ep -> ord = conn_param -> ord ;
27572784
2758- if (ep -> mpa_attr .version != 2 )
2785+ if (ep -> mpa_attr .version == 1 ) {
27592786 if (peer2peer && ep -> ird == 0 )
27602787 ep -> ird = 1 ;
2788+ } else {
2789+ if (peer2peer &&
2790+ (ep -> mpa_attr .p2p_type != FW_RI_INIT_P2PTYPE_DISABLED ) &&
2791+ (p2p_type == FW_RI_INIT_P2PTYPE_READ_REQ ) && ep -> ord == 0 )
2792+ ep -> ird = 1 ;
2793+ }
27612794
27622795 PDBG ("%s %d ird %d ord %d\n" , __func__ , __LINE__ , ep -> ird , ep -> ord );
27632796
@@ -2796,6 +2829,7 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
27962829 return 0 ;
27972830err1 :
27982831 ep -> com .cm_id = NULL ;
2832+ abort_connection (ep , NULL , GFP_KERNEL );
27992833 cm_id -> rem_ref (cm_id );
28002834err :
28012835 mutex_unlock (& ep -> com .mutex );
@@ -2879,8 +2913,8 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
28792913 int iptype ;
28802914 int iwpm_err = 0 ;
28812915
2882- if ((conn_param -> ord > c4iw_max_read_depth ) ||
2883- (conn_param -> ird > c4iw_max_read_depth )) {
2916+ if ((conn_param -> ord > cur_max_read_depth ( dev ) ) ||
2917+ (conn_param -> ird > cur_max_read_depth ( dev ) )) {
28842918 err = - EINVAL ;
28852919 goto out ;
28862920 }
0 commit comments