diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-09-30 01:34:10 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-10-02 16:17:33 -0400 |
commit | b094a4bd840e6f268f70a79a099debaf235e44e5 (patch) | |
tree | df538c10b5267d349301b59542e8f9ac13ed3342 /drivers/target/iscsi | |
parent | 1c417f39c1f896206f0d5bfec65cd61a8f5e69b8 (diff) |
iscsi-target: Change iscsi_target_seq_pdu_list.c to honor MaxXmitDataSegmentLength
This patch converts iscsi_target_seq_pdu_list.c code for DataSequenceInOrder=No +
DataPDUInOrder=No operation to honor the MaxXmitDataSegmentLength value
for iscsi_cmd->se_cmd.data_direction == DMA_TO_DEVICE cases.
Cc: Mike Christie <michaelc@cs.wisc.edu>
Cc: Andy Grover <agrover@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_seq_pdu_list.c | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/drivers/target/iscsi/iscsi_target_seq_pdu_list.c b/drivers/target/iscsi/iscsi_target_seq_pdu_list.c index 85a306e067ba..edb592a368ef 100644 --- a/drivers/target/iscsi/iscsi_target_seq_pdu_list.c +++ b/drivers/target/iscsi/iscsi_target_seq_pdu_list.c | |||
@@ -219,8 +219,14 @@ static void iscsit_determine_counts_for_list( | |||
219 | int check_immediate = 0; | 219 | int check_immediate = 0; |
220 | u32 burstlength = 0, offset = 0; | 220 | u32 burstlength = 0, offset = 0; |
221 | u32 unsolicited_data_length = 0; | 221 | u32 unsolicited_data_length = 0; |
222 | u32 mdsl; | ||
222 | struct iscsi_conn *conn = cmd->conn; | 223 | struct iscsi_conn *conn = cmd->conn; |
223 | 224 | ||
225 | if (cmd->se_cmd.data_direction == DMA_TO_DEVICE) | ||
226 | mdsl = cmd->conn->conn_ops->MaxXmitDataSegmentLength; | ||
227 | else | ||
228 | mdsl = cmd->conn->conn_ops->MaxRecvDataSegmentLength; | ||
229 | |||
224 | if ((bl->type == PDULIST_IMMEDIATE) || | 230 | if ((bl->type == PDULIST_IMMEDIATE) || |
225 | (bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED)) | 231 | (bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED)) |
226 | check_immediate = 1; | 232 | check_immediate = 1; |
@@ -243,14 +249,13 @@ static void iscsit_determine_counts_for_list( | |||
243 | continue; | 249 | continue; |
244 | } | 250 | } |
245 | if (unsolicited_data_length > 0) { | 251 | if (unsolicited_data_length > 0) { |
246 | if ((offset + conn->conn_ops->MaxRecvDataSegmentLength) | 252 | if ((offset + mdsl) >= cmd->se_cmd.data_length) { |
247 | >= cmd->se_cmd.data_length) { | ||
248 | unsolicited_data_length -= | 253 | unsolicited_data_length -= |
249 | (cmd->se_cmd.data_length - offset); | 254 | (cmd->se_cmd.data_length - offset); |
250 | offset += (cmd->se_cmd.data_length - offset); | 255 | offset += (cmd->se_cmd.data_length - offset); |
251 | continue; | 256 | continue; |
252 | } | 257 | } |
253 | if ((offset + conn->conn_ops->MaxRecvDataSegmentLength) | 258 | if ((offset + mdsl) |
254 | >= conn->sess->sess_ops->FirstBurstLength) { | 259 | >= conn->sess->sess_ops->FirstBurstLength) { |
255 | unsolicited_data_length -= | 260 | unsolicited_data_length -= |
256 | (conn->sess->sess_ops->FirstBurstLength - | 261 | (conn->sess->sess_ops->FirstBurstLength - |
@@ -262,17 +267,15 @@ static void iscsit_determine_counts_for_list( | |||
262 | continue; | 267 | continue; |
263 | } | 268 | } |
264 | 269 | ||
265 | offset += conn->conn_ops->MaxRecvDataSegmentLength; | 270 | offset += mdsl; |
266 | unsolicited_data_length -= | 271 | unsolicited_data_length -= mdsl; |
267 | conn->conn_ops->MaxRecvDataSegmentLength; | ||
268 | continue; | 272 | continue; |
269 | } | 273 | } |
270 | if ((offset + conn->conn_ops->MaxRecvDataSegmentLength) >= | 274 | if ((offset + mdsl) >= cmd->se_cmd.data_length) { |
271 | cmd->se_cmd.data_length) { | ||
272 | offset += (cmd->se_cmd.data_length - offset); | 275 | offset += (cmd->se_cmd.data_length - offset); |
273 | continue; | 276 | continue; |
274 | } | 277 | } |
275 | if ((burstlength + conn->conn_ops->MaxRecvDataSegmentLength) >= | 278 | if ((burstlength + mdsl) >= |
276 | conn->sess->sess_ops->MaxBurstLength) { | 279 | conn->sess->sess_ops->MaxBurstLength) { |
277 | offset += (conn->sess->sess_ops->MaxBurstLength - | 280 | offset += (conn->sess->sess_ops->MaxBurstLength - |
278 | burstlength); | 281 | burstlength); |
@@ -281,8 +284,8 @@ static void iscsit_determine_counts_for_list( | |||
281 | continue; | 284 | continue; |
282 | } | 285 | } |
283 | 286 | ||
284 | burstlength += conn->conn_ops->MaxRecvDataSegmentLength; | 287 | burstlength += mdsl; |
285 | offset += conn->conn_ops->MaxRecvDataSegmentLength; | 288 | offset += mdsl; |
286 | } | 289 | } |
287 | } | 290 | } |
288 | 291 | ||
@@ -296,12 +299,17 @@ static int iscsit_do_build_pdu_and_seq_lists( | |||
296 | struct iscsi_build_list *bl) | 299 | struct iscsi_build_list *bl) |
297 | { | 300 | { |
298 | int check_immediate = 0, datapduinorder, datasequenceinorder; | 301 | int check_immediate = 0, datapduinorder, datasequenceinorder; |
299 | u32 burstlength = 0, offset = 0, i = 0; | 302 | u32 burstlength = 0, offset = 0, i = 0, mdsl; |
300 | u32 pdu_count = 0, seq_no = 0, unsolicited_data_length = 0; | 303 | u32 pdu_count = 0, seq_no = 0, unsolicited_data_length = 0; |
301 | struct iscsi_conn *conn = cmd->conn; | 304 | struct iscsi_conn *conn = cmd->conn; |
302 | struct iscsi_pdu *pdu = cmd->pdu_list; | 305 | struct iscsi_pdu *pdu = cmd->pdu_list; |
303 | struct iscsi_seq *seq = cmd->seq_list; | 306 | struct iscsi_seq *seq = cmd->seq_list; |
304 | 307 | ||
308 | if (cmd->se_cmd.data_direction == DMA_TO_DEVICE) | ||
309 | mdsl = cmd->conn->conn_ops->MaxXmitDataSegmentLength; | ||
310 | else | ||
311 | mdsl = cmd->conn->conn_ops->MaxRecvDataSegmentLength; | ||
312 | |||
305 | datapduinorder = conn->sess->sess_ops->DataPDUInOrder; | 313 | datapduinorder = conn->sess->sess_ops->DataPDUInOrder; |
306 | datasequenceinorder = conn->sess->sess_ops->DataSequenceInOrder; | 314 | datasequenceinorder = conn->sess->sess_ops->DataSequenceInOrder; |
307 | 315 | ||
@@ -348,9 +356,7 @@ static int iscsit_do_build_pdu_and_seq_lists( | |||
348 | continue; | 356 | continue; |
349 | } | 357 | } |
350 | if (unsolicited_data_length > 0) { | 358 | if (unsolicited_data_length > 0) { |
351 | if ((offset + | 359 | if ((offset + mdsl) >= cmd->se_cmd.data_length) { |
352 | conn->conn_ops->MaxRecvDataSegmentLength) >= | ||
353 | cmd->se_cmd.data_length) { | ||
354 | if (!datapduinorder) { | 360 | if (!datapduinorder) { |
355 | pdu[i].type = PDUTYPE_UNSOLICITED; | 361 | pdu[i].type = PDUTYPE_UNSOLICITED; |
356 | pdu[i].length = | 362 | pdu[i].length = |
@@ -367,8 +373,7 @@ static int iscsit_do_build_pdu_and_seq_lists( | |||
367 | offset += (cmd->se_cmd.data_length - offset); | 373 | offset += (cmd->se_cmd.data_length - offset); |
368 | continue; | 374 | continue; |
369 | } | 375 | } |
370 | if ((offset + | 376 | if ((offset + mdsl) >= |
371 | conn->conn_ops->MaxRecvDataSegmentLength) >= | ||
372 | conn->sess->sess_ops->FirstBurstLength) { | 377 | conn->sess->sess_ops->FirstBurstLength) { |
373 | if (!datapduinorder) { | 378 | if (!datapduinorder) { |
374 | pdu[i].type = PDUTYPE_UNSOLICITED; | 379 | pdu[i].type = PDUTYPE_UNSOLICITED; |
@@ -396,17 +401,14 @@ static int iscsit_do_build_pdu_and_seq_lists( | |||
396 | 401 | ||
397 | if (!datapduinorder) { | 402 | if (!datapduinorder) { |
398 | pdu[i].type = PDUTYPE_UNSOLICITED; | 403 | pdu[i].type = PDUTYPE_UNSOLICITED; |
399 | pdu[i++].length = | 404 | pdu[i++].length = mdsl; |
400 | conn->conn_ops->MaxRecvDataSegmentLength; | ||
401 | } | 405 | } |
402 | burstlength += conn->conn_ops->MaxRecvDataSegmentLength; | 406 | burstlength += mdsl; |
403 | offset += conn->conn_ops->MaxRecvDataSegmentLength; | 407 | offset += mdsl; |
404 | unsolicited_data_length -= | 408 | unsolicited_data_length -= mdsl; |
405 | conn->conn_ops->MaxRecvDataSegmentLength; | ||
406 | continue; | 409 | continue; |
407 | } | 410 | } |
408 | if ((offset + conn->conn_ops->MaxRecvDataSegmentLength) >= | 411 | if ((offset + mdsl) >= cmd->se_cmd.data_length) { |
409 | cmd->se_cmd.data_length) { | ||
410 | if (!datapduinorder) { | 412 | if (!datapduinorder) { |
411 | pdu[i].type = PDUTYPE_NORMAL; | 413 | pdu[i].type = PDUTYPE_NORMAL; |
412 | pdu[i].length = (cmd->se_cmd.data_length - offset); | 414 | pdu[i].length = (cmd->se_cmd.data_length - offset); |
@@ -420,7 +422,7 @@ static int iscsit_do_build_pdu_and_seq_lists( | |||
420 | offset += (cmd->se_cmd.data_length - offset); | 422 | offset += (cmd->se_cmd.data_length - offset); |
421 | continue; | 423 | continue; |
422 | } | 424 | } |
423 | if ((burstlength + conn->conn_ops->MaxRecvDataSegmentLength) >= | 425 | if ((burstlength + mdsl) >= |
424 | conn->sess->sess_ops->MaxBurstLength) { | 426 | conn->sess->sess_ops->MaxBurstLength) { |
425 | if (!datapduinorder) { | 427 | if (!datapduinorder) { |
426 | pdu[i].type = PDUTYPE_NORMAL; | 428 | pdu[i].type = PDUTYPE_NORMAL; |
@@ -445,11 +447,10 @@ static int iscsit_do_build_pdu_and_seq_lists( | |||
445 | 447 | ||
446 | if (!datapduinorder) { | 448 | if (!datapduinorder) { |
447 | pdu[i].type = PDUTYPE_NORMAL; | 449 | pdu[i].type = PDUTYPE_NORMAL; |
448 | pdu[i++].length = | 450 | pdu[i++].length = mdsl; |
449 | conn->conn_ops->MaxRecvDataSegmentLength; | ||
450 | } | 451 | } |
451 | burstlength += conn->conn_ops->MaxRecvDataSegmentLength; | 452 | burstlength += mdsl; |
452 | offset += conn->conn_ops->MaxRecvDataSegmentLength; | 453 | offset += mdsl; |
453 | } | 454 | } |
454 | 455 | ||
455 | if (!datasequenceinorder) { | 456 | if (!datasequenceinorder) { |