@@ -377,9 +377,9 @@ static bool smc_clc_msg_prop_valid(struct smc_clc_msg_proposal *pclc)
377377
378378/* check arriving CLC accept or confirm */
379379static bool
380- smc_clc_msg_acc_conf_valid (struct smc_clc_msg_accept_confirm_v2 * clc_v2 )
380+ smc_clc_msg_acc_conf_valid (struct smc_clc_msg_accept_confirm * clc )
381381{
382- struct smc_clc_msg_hdr * hdr = & clc_v2 -> hdr ;
382+ struct smc_clc_msg_hdr * hdr = & clc -> hdr ;
383383
384384 if (hdr -> typev1 != SMC_TYPE_R && hdr -> typev1 != SMC_TYPE_D )
385385 return false;
@@ -449,7 +449,7 @@ static int smc_clc_fill_fce_v2x(struct smc_clc_first_contact_ext_v2x *fce_v2x,
449449 */
450450static bool smc_clc_msg_hdr_valid (struct smc_clc_msg_hdr * clcm , bool check_trl )
451451{
452- struct smc_clc_msg_accept_confirm_v2 * clc_v2 ;
452+ struct smc_clc_msg_accept_confirm * clc ;
453453 struct smc_clc_msg_proposal * pclc ;
454454 struct smc_clc_msg_decline * dclc ;
455455 struct smc_clc_msg_trail * trl ;
@@ -467,12 +467,11 @@ static bool smc_clc_msg_hdr_valid(struct smc_clc_msg_hdr *clcm, bool check_trl)
467467 break ;
468468 case SMC_CLC_ACCEPT :
469469 case SMC_CLC_CONFIRM :
470- clc_v2 = (struct smc_clc_msg_accept_confirm_v2 * )clcm ;
471- if (!smc_clc_msg_acc_conf_valid (clc_v2 ))
470+ clc = (struct smc_clc_msg_accept_confirm * )clcm ;
471+ if (!smc_clc_msg_acc_conf_valid (clc ))
472472 return false;
473473 trl = (struct smc_clc_msg_trail * )
474- ((u8 * )clc_v2 + ntohs (clc_v2 -> hdr .length ) -
475- sizeof (* trl ));
474+ ((u8 * )clc + ntohs (clc -> hdr .length ) - sizeof (* trl ));
476475 break ;
477476 case SMC_CLC_DECLINE :
478477 dclc = (struct smc_clc_msg_decline * )clcm ;
@@ -1000,19 +999,17 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)
1000999
10011000static void
10021001smcd_clc_prep_confirm_accept (struct smc_connection * conn ,
1003- struct smc_clc_msg_accept_confirm_v2 * clc_v2 ,
1002+ struct smc_clc_msg_accept_confirm * clc ,
10041003 int first_contact , u8 version ,
10051004 u8 * eid , struct smc_init_info * ini ,
10061005 int * fce_len ,
10071006 struct smc_clc_first_contact_ext_v2x * fce_v2x ,
10081007 struct smc_clc_msg_trail * trl )
10091008{
10101009 struct smcd_dev * smcd = conn -> lgr -> smcd ;
1011- struct smc_clc_msg_accept_confirm * clc ;
10121010 int len ;
10131011
10141012 /* SMC-D specific settings */
1015- clc = (struct smc_clc_msg_accept_confirm * )clc_v2 ;
10161013 memcpy (clc -> hdr .eyecatcher , SMCD_EYECATCHER ,
10171014 sizeof (SMCD_EYECATCHER ));
10181015 clc -> hdr .typev1 = SMC_TYPE_D ;
@@ -1024,36 +1021,34 @@ smcd_clc_prep_confirm_accept(struct smc_connection *conn,
10241021 if (version == SMC_V1 ) {
10251022 clc -> hdr .length = htons (SMCD_CLC_ACCEPT_CONFIRM_LEN );
10261023 } else {
1027- clc_v2 -> d1 .chid = htons (smc_ism_get_chid (smcd ));
1024+ clc -> d1 .chid = htons (smc_ism_get_chid (smcd ));
10281025 if (eid && eid [0 ])
1029- memcpy (clc_v2 -> d1 .eid , eid , SMC_MAX_EID_LEN );
1026+ memcpy (clc -> d1 .eid , eid , SMC_MAX_EID_LEN );
10301027 len = SMCD_CLC_ACCEPT_CONFIRM_LEN_V2 ;
10311028 if (first_contact ) {
10321029 * fce_len = smc_clc_fill_fce_v2x (fce_v2x , ini );
10331030 len += * fce_len ;
10341031 }
1035- clc_v2 -> hdr .length = htons (len );
1032+ clc -> hdr .length = htons (len );
10361033 }
10371034 memcpy (trl -> eyecatcher , SMCD_EYECATCHER ,
10381035 sizeof (SMCD_EYECATCHER ));
10391036}
10401037
10411038static void
10421039smcr_clc_prep_confirm_accept (struct smc_connection * conn ,
1043- struct smc_clc_msg_accept_confirm_v2 * clc_v2 ,
1040+ struct smc_clc_msg_accept_confirm * clc ,
10441041 int first_contact , u8 version ,
10451042 u8 * eid , struct smc_init_info * ini ,
10461043 int * fce_len ,
10471044 struct smc_clc_first_contact_ext_v2x * fce_v2x ,
10481045 struct smc_clc_fce_gid_ext * gle ,
10491046 struct smc_clc_msg_trail * trl )
10501047{
1051- struct smc_clc_msg_accept_confirm * clc ;
10521048 struct smc_link * link = conn -> lnk ;
10531049 int len ;
10541050
10551051 /* SMC-R specific settings */
1056- clc = (struct smc_clc_msg_accept_confirm * )clc_v2 ;
10571052 memcpy (clc -> hdr .eyecatcher , SMC_EYECATCHER ,
10581053 sizeof (SMC_EYECATCHER ));
10591054 clc -> hdr .typev1 = SMC_TYPE_R ;
@@ -1085,7 +1080,7 @@ smcr_clc_prep_confirm_accept(struct smc_connection *conn,
10851080 clc -> hdr .length = htons (SMCR_CLC_ACCEPT_CONFIRM_LEN );
10861081 } else {
10871082 if (eid && eid [0 ])
1088- memcpy (clc_v2 -> r1 .eid , eid , SMC_MAX_EID_LEN );
1083+ memcpy (clc -> r1 .eid , eid , SMC_MAX_EID_LEN );
10891084 len = SMCR_CLC_ACCEPT_CONFIRM_LEN_V2 ;
10901085 if (first_contact ) {
10911086 * fce_len = smc_clc_fill_fce_v2x (fce_v2x , ini );
@@ -1099,42 +1094,40 @@ smcr_clc_prep_confirm_accept(struct smc_connection *conn,
10991094 len += gle -> gid_cnt * sizeof (gle -> gid [0 ]);
11001095 }
11011096 }
1102- clc_v2 -> hdr .length = htons (len );
1097+ clc -> hdr .length = htons (len );
11031098 }
11041099 memcpy (trl -> eyecatcher , SMC_EYECATCHER , sizeof (SMC_EYECATCHER ));
11051100}
11061101
11071102/* build and send CLC CONFIRM / ACCEPT message */
11081103static int smc_clc_send_confirm_accept (struct smc_sock * smc ,
1109- struct smc_clc_msg_accept_confirm_v2 * clc_v2 ,
1104+ struct smc_clc_msg_accept_confirm * clc ,
11101105 int first_contact , u8 version ,
11111106 u8 * eid , struct smc_init_info * ini )
11121107{
11131108 struct smc_clc_first_contact_ext_v2x fce_v2x ;
11141109 struct smc_connection * conn = & smc -> conn ;
1115- struct smc_clc_msg_accept_confirm * clc ;
11161110 struct smc_clc_fce_gid_ext gle ;
11171111 struct smc_clc_msg_trail trl ;
11181112 int i , fce_len ;
11191113 struct kvec vec [5 ];
11201114 struct msghdr msg ;
11211115
11221116 /* send SMC Confirm CLC msg */
1123- clc = (struct smc_clc_msg_accept_confirm * )clc_v2 ;
11241117 clc -> hdr .version = version ; /* SMC version */
11251118 if (first_contact )
11261119 clc -> hdr .typev2 |= SMC_FIRST_CONTACT_MASK ;
11271120 if (conn -> lgr -> is_smcd )
1128- smcd_clc_prep_confirm_accept (conn , clc_v2 , first_contact ,
1121+ smcd_clc_prep_confirm_accept (conn , clc , first_contact ,
11291122 version , eid , ini , & fce_len ,
11301123 & fce_v2x , & trl );
11311124 else
1132- smcr_clc_prep_confirm_accept (conn , clc_v2 , first_contact ,
1125+ smcr_clc_prep_confirm_accept (conn , clc , first_contact ,
11331126 version , eid , ini , & fce_len ,
11341127 & fce_v2x , & gle , & trl );
11351128 memset (& msg , 0 , sizeof (msg ));
11361129 i = 0 ;
1137- vec [i ].iov_base = clc_v2 ;
1130+ vec [i ].iov_base = clc ;
11381131 if (version > SMC_V1 )
11391132 vec [i ++ ].iov_len = (clc -> hdr .typev1 == SMC_TYPE_D ?
11401133 SMCD_CLC_ACCEPT_CONFIRM_LEN_V2 :
@@ -1168,16 +1161,16 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc,
11681161int smc_clc_send_confirm (struct smc_sock * smc , bool clnt_first_contact ,
11691162 u8 version , u8 * eid , struct smc_init_info * ini )
11701163{
1171- struct smc_clc_msg_accept_confirm_v2 cclc_v2 ;
1164+ struct smc_clc_msg_accept_confirm cclc ;
11721165 int reason_code = 0 ;
11731166 int len ;
11741167
11751168 /* send SMC Confirm CLC msg */
1176- memset (& cclc_v2 , 0 , sizeof (cclc_v2 ));
1177- cclc_v2 .hdr .type = SMC_CLC_CONFIRM ;
1178- len = smc_clc_send_confirm_accept (smc , & cclc_v2 , clnt_first_contact ,
1169+ memset (& cclc , 0 , sizeof (cclc ));
1170+ cclc .hdr .type = SMC_CLC_CONFIRM ;
1171+ len = smc_clc_send_confirm_accept (smc , & cclc , clnt_first_contact ,
11791172 version , eid , ini );
1180- if (len < ntohs (cclc_v2 .hdr .length )) {
1173+ if (len < ntohs (cclc .hdr .length )) {
11811174 if (len >= 0 ) {
11821175 reason_code = - ENETUNREACH ;
11831176 smc -> sk .sk_err = - reason_code ;
@@ -1193,14 +1186,14 @@ int smc_clc_send_confirm(struct smc_sock *smc, bool clnt_first_contact,
11931186int smc_clc_send_accept (struct smc_sock * new_smc , bool srv_first_contact ,
11941187 u8 version , u8 * negotiated_eid , struct smc_init_info * ini )
11951188{
1196- struct smc_clc_msg_accept_confirm_v2 aclc_v2 ;
1189+ struct smc_clc_msg_accept_confirm aclc ;
11971190 int len ;
11981191
1199- memset (& aclc_v2 , 0 , sizeof (aclc_v2 ));
1200- aclc_v2 .hdr .type = SMC_CLC_ACCEPT ;
1201- len = smc_clc_send_confirm_accept (new_smc , & aclc_v2 , srv_first_contact ,
1192+ memset (& aclc , 0 , sizeof (aclc ));
1193+ aclc .hdr .type = SMC_CLC_ACCEPT ;
1194+ len = smc_clc_send_confirm_accept (new_smc , & aclc , srv_first_contact ,
12021195 version , negotiated_eid , ini );
1203- if (len < ntohs (aclc_v2 .hdr .length ))
1196+ if (len < ntohs (aclc .hdr .length ))
12041197 len = len >= 0 ? - EPROTO : - new_smc -> clcsock -> sk -> sk_err ;
12051198
12061199 return len > 0 ? 0 : len ;
@@ -1265,10 +1258,8 @@ int smc_clc_clnt_v2x_features_validate(struct smc_clc_first_contact_ext *fce,
12651258int smc_clc_v2x_features_confirm_check (struct smc_clc_msg_accept_confirm * cclc ,
12661259 struct smc_init_info * ini )
12671260{
1268- struct smc_clc_msg_accept_confirm_v2 * clc_v2 =
1269- (struct smc_clc_msg_accept_confirm_v2 * )cclc ;
12701261 struct smc_clc_first_contact_ext * fce =
1271- smc_get_clc_first_contact_ext (clc_v2 , ini -> is_smcd );
1262+ smc_get_clc_first_contact_ext (cclc , ini -> is_smcd );
12721263 struct smc_clc_first_contact_ext_v2x * fce_v2x =
12731264 (struct smc_clc_first_contact_ext_v2x * )fce ;
12741265
0 commit comments