diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/osd/osd_initiator.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index e266f803aa96..f61ab84ad20b 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c | |||
@@ -345,9 +345,9 @@ _osd_req_sec_params(struct osd_request *or) | |||
345 | struct osd_cdb *ocdb = &or->cdb; | 345 | struct osd_cdb *ocdb = &or->cdb; |
346 | 346 | ||
347 | if (osd_req_is_ver1(or)) | 347 | if (osd_req_is_ver1(or)) |
348 | return &ocdb->v1.sec_params; | 348 | return (struct osd_security_parameters *)&ocdb->v1.sec_params; |
349 | else | 349 | else |
350 | return &ocdb->v2.sec_params; | 350 | return (struct osd_security_parameters *)&ocdb->v2.sec_params; |
351 | } | 351 | } |
352 | 352 | ||
353 | void osd_dev_init(struct osd_dev *osdd, struct scsi_device *scsi_device) | 353 | void osd_dev_init(struct osd_dev *osdd, struct scsi_device *scsi_device) |
@@ -1209,6 +1209,24 @@ static int _osd_req_finalize_attr_page(struct osd_request *or) | |||
1209 | return ret; | 1209 | return ret; |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | static inline void osd_sec_parms_set_out_offset(bool is_v1, | ||
1213 | struct osd_security_parameters *sec_parms, osd_cdb_offset offset) | ||
1214 | { | ||
1215 | if (is_v1) | ||
1216 | sec_parms->v1.data_out_integrity_check_offset = offset; | ||
1217 | else | ||
1218 | sec_parms->v2.data_out_integrity_check_offset = offset; | ||
1219 | } | ||
1220 | |||
1221 | static inline void osd_sec_parms_set_in_offset(bool is_v1, | ||
1222 | struct osd_security_parameters *sec_parms, osd_cdb_offset offset) | ||
1223 | { | ||
1224 | if (is_v1) | ||
1225 | sec_parms->v1.data_in_integrity_check_offset = offset; | ||
1226 | else | ||
1227 | sec_parms->v2.data_in_integrity_check_offset = offset; | ||
1228 | } | ||
1229 | |||
1212 | static int _osd_req_finalize_data_integrity(struct osd_request *or, | 1230 | static int _osd_req_finalize_data_integrity(struct osd_request *or, |
1213 | bool has_in, bool has_out, const u8 *cap_key) | 1231 | bool has_in, bool has_out, const u8 *cap_key) |
1214 | { | 1232 | { |
@@ -1232,8 +1250,8 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or, | |||
1232 | or->out_data_integ.get_attributes_bytes = cpu_to_be64( | 1250 | or->out_data_integ.get_attributes_bytes = cpu_to_be64( |
1233 | or->enc_get_attr.total_bytes); | 1251 | or->enc_get_attr.total_bytes); |
1234 | 1252 | ||
1235 | sec_parms->data_out_integrity_check_offset = | 1253 | osd_sec_parms_set_out_offset(osd_req_is_ver1(or), sec_parms, |
1236 | osd_req_encode_offset(or, or->out.total_bytes, &pad); | 1254 | osd_req_encode_offset(or, or->out.total_bytes, &pad)); |
1237 | 1255 | ||
1238 | ret = _req_append_segment(or, pad, &seg, or->out.last_seg, | 1256 | ret = _req_append_segment(or, pad, &seg, or->out.last_seg, |
1239 | &or->out); | 1257 | &or->out); |
@@ -1253,8 +1271,8 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or, | |||
1253 | }; | 1271 | }; |
1254 | unsigned pad; | 1272 | unsigned pad; |
1255 | 1273 | ||
1256 | sec_parms->data_in_integrity_check_offset = | 1274 | osd_sec_parms_set_in_offset(osd_req_is_ver1(or), sec_parms, |
1257 | osd_req_encode_offset(or, or->in.total_bytes, &pad); | 1275 | osd_req_encode_offset(or, or->in.total_bytes, &pad)); |
1258 | 1276 | ||
1259 | ret = _req_append_segment(or, pad, &seg, or->in.last_seg, | 1277 | ret = _req_append_segment(or, pad, &seg, or->in.last_seg, |
1260 | &or->in); | 1278 | &or->in); |