@@ -377,9 +377,9 @@ static bool smc_clc_msg_prop_valid(struct smc_clc_msg_proposal *pclc)
377
377
378
378
/* check arriving CLC accept or confirm */
379
379
static 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 )
381
381
{
382
- struct smc_clc_msg_hdr * hdr = & clc_v2 -> hdr ;
382
+ struct smc_clc_msg_hdr * hdr = & clc -> hdr ;
383
383
384
384
if (hdr -> typev1 != SMC_TYPE_R && hdr -> typev1 != SMC_TYPE_D )
385
385
return false;
@@ -449,7 +449,7 @@ static int smc_clc_fill_fce_v2x(struct smc_clc_first_contact_ext_v2x *fce_v2x,
449
449
*/
450
450
static bool smc_clc_msg_hdr_valid (struct smc_clc_msg_hdr * clcm , bool check_trl )
451
451
{
452
- struct smc_clc_msg_accept_confirm_v2 * clc_v2 ;
452
+ struct smc_clc_msg_accept_confirm * clc ;
453
453
struct smc_clc_msg_proposal * pclc ;
454
454
struct smc_clc_msg_decline * dclc ;
455
455
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)
467
467
break ;
468
468
case SMC_CLC_ACCEPT :
469
469
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 ))
472
472
return false;
473
473
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 ));
476
475
break ;
477
476
case SMC_CLC_DECLINE :
478
477
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)
1000
999
1001
1000
static void
1002
1001
smcd_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 ,
1004
1003
int first_contact , u8 version ,
1005
1004
u8 * eid , struct smc_init_info * ini ,
1006
1005
int * fce_len ,
1007
1006
struct smc_clc_first_contact_ext_v2x * fce_v2x ,
1008
1007
struct smc_clc_msg_trail * trl )
1009
1008
{
1010
1009
struct smcd_dev * smcd = conn -> lgr -> smcd ;
1011
- struct smc_clc_msg_accept_confirm * clc ;
1012
1010
int len ;
1013
1011
1014
1012
/* SMC-D specific settings */
1015
- clc = (struct smc_clc_msg_accept_confirm * )clc_v2 ;
1016
1013
memcpy (clc -> hdr .eyecatcher , SMCD_EYECATCHER ,
1017
1014
sizeof (SMCD_EYECATCHER ));
1018
1015
clc -> hdr .typev1 = SMC_TYPE_D ;
@@ -1024,36 +1021,34 @@ smcd_clc_prep_confirm_accept(struct smc_connection *conn,
1024
1021
if (version == SMC_V1 ) {
1025
1022
clc -> hdr .length = htons (SMCD_CLC_ACCEPT_CONFIRM_LEN );
1026
1023
} else {
1027
- clc_v2 -> d1 .chid = htons (smc_ism_get_chid (smcd ));
1024
+ clc -> d1 .chid = htons (smc_ism_get_chid (smcd ));
1028
1025
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 );
1030
1027
len = SMCD_CLC_ACCEPT_CONFIRM_LEN_V2 ;
1031
1028
if (first_contact ) {
1032
1029
* fce_len = smc_clc_fill_fce_v2x (fce_v2x , ini );
1033
1030
len += * fce_len ;
1034
1031
}
1035
- clc_v2 -> hdr .length = htons (len );
1032
+ clc -> hdr .length = htons (len );
1036
1033
}
1037
1034
memcpy (trl -> eyecatcher , SMCD_EYECATCHER ,
1038
1035
sizeof (SMCD_EYECATCHER ));
1039
1036
}
1040
1037
1041
1038
static void
1042
1039
smcr_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 ,
1044
1041
int first_contact , u8 version ,
1045
1042
u8 * eid , struct smc_init_info * ini ,
1046
1043
int * fce_len ,
1047
1044
struct smc_clc_first_contact_ext_v2x * fce_v2x ,
1048
1045
struct smc_clc_fce_gid_ext * gle ,
1049
1046
struct smc_clc_msg_trail * trl )
1050
1047
{
1051
- struct smc_clc_msg_accept_confirm * clc ;
1052
1048
struct smc_link * link = conn -> lnk ;
1053
1049
int len ;
1054
1050
1055
1051
/* SMC-R specific settings */
1056
- clc = (struct smc_clc_msg_accept_confirm * )clc_v2 ;
1057
1052
memcpy (clc -> hdr .eyecatcher , SMC_EYECATCHER ,
1058
1053
sizeof (SMC_EYECATCHER ));
1059
1054
clc -> hdr .typev1 = SMC_TYPE_R ;
@@ -1085,7 +1080,7 @@ smcr_clc_prep_confirm_accept(struct smc_connection *conn,
1085
1080
clc -> hdr .length = htons (SMCR_CLC_ACCEPT_CONFIRM_LEN );
1086
1081
} else {
1087
1082
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 );
1089
1084
len = SMCR_CLC_ACCEPT_CONFIRM_LEN_V2 ;
1090
1085
if (first_contact ) {
1091
1086
* fce_len = smc_clc_fill_fce_v2x (fce_v2x , ini );
@@ -1099,42 +1094,40 @@ smcr_clc_prep_confirm_accept(struct smc_connection *conn,
1099
1094
len += gle -> gid_cnt * sizeof (gle -> gid [0 ]);
1100
1095
}
1101
1096
}
1102
- clc_v2 -> hdr .length = htons (len );
1097
+ clc -> hdr .length = htons (len );
1103
1098
}
1104
1099
memcpy (trl -> eyecatcher , SMC_EYECATCHER , sizeof (SMC_EYECATCHER ));
1105
1100
}
1106
1101
1107
1102
/* build and send CLC CONFIRM / ACCEPT message */
1108
1103
static 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 ,
1110
1105
int first_contact , u8 version ,
1111
1106
u8 * eid , struct smc_init_info * ini )
1112
1107
{
1113
1108
struct smc_clc_first_contact_ext_v2x fce_v2x ;
1114
1109
struct smc_connection * conn = & smc -> conn ;
1115
- struct smc_clc_msg_accept_confirm * clc ;
1116
1110
struct smc_clc_fce_gid_ext gle ;
1117
1111
struct smc_clc_msg_trail trl ;
1118
1112
int i , fce_len ;
1119
1113
struct kvec vec [5 ];
1120
1114
struct msghdr msg ;
1121
1115
1122
1116
/* send SMC Confirm CLC msg */
1123
- clc = (struct smc_clc_msg_accept_confirm * )clc_v2 ;
1124
1117
clc -> hdr .version = version ; /* SMC version */
1125
1118
if (first_contact )
1126
1119
clc -> hdr .typev2 |= SMC_FIRST_CONTACT_MASK ;
1127
1120
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 ,
1129
1122
version , eid , ini , & fce_len ,
1130
1123
& fce_v2x , & trl );
1131
1124
else
1132
- smcr_clc_prep_confirm_accept (conn , clc_v2 , first_contact ,
1125
+ smcr_clc_prep_confirm_accept (conn , clc , first_contact ,
1133
1126
version , eid , ini , & fce_len ,
1134
1127
& fce_v2x , & gle , & trl );
1135
1128
memset (& msg , 0 , sizeof (msg ));
1136
1129
i = 0 ;
1137
- vec [i ].iov_base = clc_v2 ;
1130
+ vec [i ].iov_base = clc ;
1138
1131
if (version > SMC_V1 )
1139
1132
vec [i ++ ].iov_len = (clc -> hdr .typev1 == SMC_TYPE_D ?
1140
1133
SMCD_CLC_ACCEPT_CONFIRM_LEN_V2 :
@@ -1168,16 +1161,16 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc,
1168
1161
int smc_clc_send_confirm (struct smc_sock * smc , bool clnt_first_contact ,
1169
1162
u8 version , u8 * eid , struct smc_init_info * ini )
1170
1163
{
1171
- struct smc_clc_msg_accept_confirm_v2 cclc_v2 ;
1164
+ struct smc_clc_msg_accept_confirm cclc ;
1172
1165
int reason_code = 0 ;
1173
1166
int len ;
1174
1167
1175
1168
/* 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 ,
1179
1172
version , eid , ini );
1180
- if (len < ntohs (cclc_v2 .hdr .length )) {
1173
+ if (len < ntohs (cclc .hdr .length )) {
1181
1174
if (len >= 0 ) {
1182
1175
reason_code = - ENETUNREACH ;
1183
1176
smc -> sk .sk_err = - reason_code ;
@@ -1193,14 +1186,14 @@ int smc_clc_send_confirm(struct smc_sock *smc, bool clnt_first_contact,
1193
1186
int smc_clc_send_accept (struct smc_sock * new_smc , bool srv_first_contact ,
1194
1187
u8 version , u8 * negotiated_eid , struct smc_init_info * ini )
1195
1188
{
1196
- struct smc_clc_msg_accept_confirm_v2 aclc_v2 ;
1189
+ struct smc_clc_msg_accept_confirm aclc ;
1197
1190
int len ;
1198
1191
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 ,
1202
1195
version , negotiated_eid , ini );
1203
- if (len < ntohs (aclc_v2 .hdr .length ))
1196
+ if (len < ntohs (aclc .hdr .length ))
1204
1197
len = len >= 0 ? - EPROTO : - new_smc -> clcsock -> sk -> sk_err ;
1205
1198
1206
1199
return len > 0 ? 0 : len ;
@@ -1265,10 +1258,8 @@ int smc_clc_clnt_v2x_features_validate(struct smc_clc_first_contact_ext *fce,
1265
1258
int smc_clc_v2x_features_confirm_check (struct smc_clc_msg_accept_confirm * cclc ,
1266
1259
struct smc_init_info * ini )
1267
1260
{
1268
- struct smc_clc_msg_accept_confirm_v2 * clc_v2 =
1269
- (struct smc_clc_msg_accept_confirm_v2 * )cclc ;
1270
1261
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 );
1272
1263
struct smc_clc_first_contact_ext_v2x * fce_v2x =
1273
1264
(struct smc_clc_first_contact_ext_v2x * )fce ;
1274
1265
0 commit comments