ctl_frontend_iscsi.c (265513) | ctl_frontend_iscsi.c (265640) |
---|---|
1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 265513 2014-05-07 07:37:55Z trasz $ | 29 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 265640 2014-05-08 07:07:51Z mav $ |
30 */ 31 32/* 33 * CTL frontend for the iSCSI protocol. 34 */ 35 36#include <sys/cdefs.h> | 30 */ 31 32/* 33 * CTL frontend for the iSCSI protocol. 34 */ 35 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 265513 2014-05-07 07:37:55Z trasz $"); | 37__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 265640 2014-05-08 07:07:51Z mav $"); |
38 39#include <sys/param.h> 40#include <sys/capability.h> 41#include <sys/condvar.h> 42#include <sys/file.h> 43#include <sys/kernel.h> 44#include <sys/kthread.h> 45#include <sys/lock.h> --- 658 unchanged lines hidden (view full) --- 704 705 KASSERT((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == 706 ISCSI_BHS_OPCODE_SCSI_DATA_OUT || 707 (request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == 708 ISCSI_BHS_OPCODE_SCSI_COMMAND, 709 ("bad opcode 0x%x", request->ip_bhs->bhs_opcode)); 710 711 /* | 38 39#include <sys/param.h> 40#include <sys/capability.h> 41#include <sys/condvar.h> 42#include <sys/file.h> 43#include <sys/kernel.h> 44#include <sys/kthread.h> 45#include <sys/lock.h> --- 658 unchanged lines hidden (view full) --- 704 705 KASSERT((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == 706 ISCSI_BHS_OPCODE_SCSI_DATA_OUT || 707 (request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == 708 ISCSI_BHS_OPCODE_SCSI_COMMAND, 709 ("bad opcode 0x%x", request->ip_bhs->bhs_opcode)); 710 711 /* |
712 * We're only using fields common for Data Out and SCSI Command PDUs. | 712 * We're only using fields common for Data-Out and SCSI Command PDUs. |
713 */ 714 bhsdo = (struct iscsi_bhs_data_out *)request->ip_bhs; 715 716 io = cdw->cdw_ctl_io; 717 KASSERT((io->io_hdr.flags & CTL_FLAG_DATA_MASK) != CTL_FLAG_DATA_IN, 718 ("CTL_FLAG_DATA_IN")); 719 720#if 0 --- 16 unchanged lines hidden (view full) --- 737 buffer_offset = ntohl(bhsdo->bhsdo_buffer_offset); 738 else 739 buffer_offset = 0; 740 741 /* 742 * Make sure the offset, as sent by the initiator, matches the offset 743 * we're supposed to be at in the scatter-gather list. 744 */ | 713 */ 714 bhsdo = (struct iscsi_bhs_data_out *)request->ip_bhs; 715 716 io = cdw->cdw_ctl_io; 717 KASSERT((io->io_hdr.flags & CTL_FLAG_DATA_MASK) != CTL_FLAG_DATA_IN, 718 ("CTL_FLAG_DATA_IN")); 719 720#if 0 --- 16 unchanged lines hidden (view full) --- 737 buffer_offset = ntohl(bhsdo->bhsdo_buffer_offset); 738 else 739 buffer_offset = 0; 740 741 /* 742 * Make sure the offset, as sent by the initiator, matches the offset 743 * we're supposed to be at in the scatter-gather list. 744 */ |
745 if (buffer_offset != io->scsiio.ext_data_filled) { | 745 if (buffer_offset != 746 io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled) { |
746 CFISCSI_SESSION_WARN(cs, "received bad buffer offset %zd, " | 747 CFISCSI_SESSION_WARN(cs, "received bad buffer offset %zd, " |
747 "expected %zd", buffer_offset, | 748 "expected %zd; dropping connection", buffer_offset, 749 (size_t)io->scsiio.kern_rel_offset + |
748 (size_t)io->scsiio.ext_data_filled); | 750 (size_t)io->scsiio.ext_data_filled); |
751 ctl_set_data_phase_error(&io->scsiio); |
|
749 cfiscsi_session_terminate(cs); 750 return (true); 751 } 752 753 /* 754 * This is the offset within the PDU data segment, as opposed 755 * to buffer_offset, which is the offset within the task (SCSI 756 * command). --- 42 unchanged lines hidden (view full) --- 799 /* 800 * End of PDU payload. 801 */ 802 break; 803 } 804 } 805 806 if (len > off) { | 752 cfiscsi_session_terminate(cs); 753 return (true); 754 } 755 756 /* 757 * This is the offset within the PDU data segment, as opposed 758 * to buffer_offset, which is the offset within the task (SCSI 759 * command). --- 42 unchanged lines hidden (view full) --- 802 /* 803 * End of PDU payload. 804 */ 805 break; 806 } 807 } 808 809 if (len > off) { |
810 /* 811 * In case of unsolicited data, it's possible that the buffer 812 * provided by CTL is smaller than negotiated FirstBurstLength. 813 * Just ignore the superfluous data; will ask for them with R2T 814 * on next call to cfiscsi_datamove(). 815 * 816 * This obviously can only happen with SCSI Command PDU. 817 */ 818 if ((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == 819 ISCSI_BHS_OPCODE_SCSI_COMMAND) { 820 CFISCSI_SESSION_DEBUG(cs, "received too much immediate " 821 "data: got %zd bytes, expected %zd", 822 icl_pdu_data_segment_length(request), off); 823 return (true); 824 } 825 |
|
807 CFISCSI_SESSION_WARN(cs, "received too much data: got %zd bytes, " | 826 CFISCSI_SESSION_WARN(cs, "received too much data: got %zd bytes, " |
808 "expected %zd", icl_pdu_data_segment_length(request), off); | 827 "expected %zd; dropping connection", 828 icl_pdu_data_segment_length(request), off); 829 ctl_set_data_phase_error(&io->scsiio); |
809 cfiscsi_session_terminate(cs); 810 return (true); 811 } 812 | 830 cfiscsi_session_terminate(cs); 831 return (true); 832 } 833 |
813 if (bhsdo->bhsdo_flags & BHSDO_FLAGS_F || 814 io->scsiio.ext_data_filled == io->scsiio.kern_total_len) { 815 if ((bhsdo->bhsdo_flags & BHSDO_FLAGS_F) == 0) { 816 CFISCSI_SESSION_WARN(cs, "got the final packet without " 817 "the F flag; flags = 0x%x; dropping connection", 818 bhsdo->bhsdo_flags); | 834 if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len && 835 (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) == 0) { 836 CFISCSI_SESSION_WARN(cs, "got the final packet without " 837 "the F flag; flags = 0x%x; dropping connection", 838 bhsdo->bhsdo_flags); 839 ctl_set_data_phase_error(&io->scsiio); 840 cfiscsi_session_terminate(cs); 841 return (true); 842 } 843 844 if (io->scsiio.ext_data_filled != io->scsiio.kern_data_len && 845 (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) != 0) { 846 if ((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == 847 ISCSI_BHS_OPCODE_SCSI_DATA_OUT) { 848 CFISCSI_SESSION_WARN(cs, "got the final packet, but the " 849 "transmitted size was %zd bytes instead of %d; " 850 "dropping connection", 851 (size_t)io->scsiio.ext_data_filled, 852 io->scsiio.kern_data_len); 853 ctl_set_data_phase_error(&io->scsiio); |
819 cfiscsi_session_terminate(cs); 820 return (true); | 854 cfiscsi_session_terminate(cs); 855 return (true); |
856 } else { 857 /* 858 * For SCSI Command PDU, this just means we need to 859 * solicit more data by sending R2T. 860 */ 861 return (false); |
|
821 } | 862 } |
863 } |
|
822 | 864 |
823 if (io->scsiio.ext_data_filled != io->scsiio.kern_total_len) { 824 if ((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == 825 ISCSI_BHS_OPCODE_SCSI_DATA_OUT) { 826 CFISCSI_SESSION_WARN(cs, "got the final packet, but the " 827 "transmitted size was %zd bytes instead of %d; " 828 "dropping connection", 829 (size_t)io->scsiio.ext_data_filled, 830 io->scsiio.kern_total_len); 831 cfiscsi_session_terminate(cs); 832 return (true); 833 } else { 834 /* 835 * For SCSI Command PDU, this just means we need to 836 * solicit more data by sending R2T. 837 */ 838 return (false); 839 } 840 } | 865 if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len) { |
841#if 0 842 CFISCSI_SESSION_DEBUG(cs, "no longer expecting Data-Out with target " 843 "transfer tag 0x%x", cdw->cdw_target_transfer_tag); 844#endif 845 846 return (true); 847 } 848 --- 1536 unchanged lines hidden (view full) --- 2385 * SCSI command. We need to record it so that we can properly report 2386 * underflow/underflow. 2387 */ 2388 PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; 2389 2390 /* 2391 * This is the offset within the current SCSI command; for the first 2392 * call to cfiscsi_datamove() it will be 0, and for subsequent ones | 866#if 0 867 CFISCSI_SESSION_DEBUG(cs, "no longer expecting Data-Out with target " 868 "transfer tag 0x%x", cdw->cdw_target_transfer_tag); 869#endif 870 871 return (true); 872 } 873 --- 1536 unchanged lines hidden (view full) --- 2410 * SCSI command. We need to record it so that we can properly report 2411 * underflow/underflow. 2412 */ 2413 PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; 2414 2415 /* 2416 * This is the offset within the current SCSI command; for the first 2417 * call to cfiscsi_datamove() it will be 0, and for subsequent ones |
2393 * it will be the sum of lengths of previous ones. It's being 2394 * incremented as we append data to the data segment. | 2418 * it will be the sum of lengths of previous ones. |
2395 */ 2396 buffer_offset = io->scsiio.kern_rel_offset; 2397 2398 /* 2399 * This is the transfer length expected by the initiator. In theory, 2400 * it could be different from the correct amount of data from the SCSI 2401 * point of view, even if that doesn't make any sense. 2402 */ 2403 expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); 2404#if 0 | 2419 */ 2420 buffer_offset = io->scsiio.kern_rel_offset; 2421 2422 /* 2423 * This is the transfer length expected by the initiator. In theory, 2424 * it could be different from the correct amount of data from the SCSI 2425 * point of view, even if that doesn't make any sense. 2426 */ 2427 expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); 2428#if 0 |
2405 if (expected_len != io->scsiio.kern_total_len) 2406 CFISCSI_SESSION_DEBUG(cs, "expected transfer length = %zd, " 2407 "actual length = %zd", expected_len, 2408 io->scsiio.kern_total_len); | 2429 if (expected_len != io->scsiio.kern_total_len) { 2430 CFISCSI_SESSION_DEBUG(cs, "expected transfer length %zd, " 2431 "actual length %zd", expected_len, 2432 (size_t)io->scsiio.kern_total_len); 2433 } |
2409#endif 2410 2411 if (buffer_offset >= expected_len) { 2412#if 0 2413 CFISCSI_SESSION_DEBUG(cs, "buffer_offset = %zd, " 2414 "already sent the expected len", buffer_offset); 2415#endif | 2434#endif 2435 2436 if (buffer_offset >= expected_len) { 2437#if 0 2438 CFISCSI_SESSION_DEBUG(cs, "buffer_offset = %zd, " 2439 "already sent the expected len", buffer_offset); 2440#endif |
2416 io->scsiio.ext_data_filled = io->scsiio.kern_total_len; | |
2417 io->scsiio.be_move_done(io); 2418 return; 2419 } 2420 2421 i = 0; 2422 sg_addr = NULL; 2423 sg_len = 0; 2424 response = NULL; --- 26 unchanged lines hidden (view full) --- 2451 } 2452 2453 len = sg_len; 2454 2455 /* 2456 * Truncate to maximum data segment length. 2457 */ 2458 KASSERT(response->ip_data_len < cs->cs_max_data_segment_length, | 2441 io->scsiio.be_move_done(io); 2442 return; 2443 } 2444 2445 i = 0; 2446 sg_addr = NULL; 2447 sg_len = 0; 2448 response = NULL; --- 26 unchanged lines hidden (view full) --- 2475 } 2476 2477 len = sg_len; 2478 2479 /* 2480 * Truncate to maximum data segment length. 2481 */ 2482 KASSERT(response->ip_data_len < cs->cs_max_data_segment_length, |
2459 ("max_data_segment_length %zd >= ip_data_len %zd", | 2483 ("ip_data_len %zd >= max_data_segment_length %zd", |
2460 response->ip_data_len, cs->cs_max_data_segment_length)); 2461 if (response->ip_data_len + len > | 2484 response->ip_data_len, cs->cs_max_data_segment_length)); 2485 if (response->ip_data_len + len > |
2462 cs->cs_max_data_segment_length) | 2486 cs->cs_max_data_segment_length) { |
2463 len = cs->cs_max_data_segment_length - 2464 response->ip_data_len; | 2487 len = cs->cs_max_data_segment_length - 2488 response->ip_data_len; |
2489 KASSERT(len <= sg_len, ("len %zd > sg_len %zd", 2490 len, sg_len)); 2491 } |
|
2465 2466 /* 2467 * Truncate to expected data transfer length. 2468 */ 2469 KASSERT(buffer_offset + response->ip_data_len < expected_len, | 2492 2493 /* 2494 * Truncate to expected data transfer length. 2495 */ 2496 KASSERT(buffer_offset + response->ip_data_len < expected_len, |
2470 ("%zd >= %zd", buffer_offset + response->ip_data_len, expected_len)); | 2497 ("buffer_offset %zd + ip_data_len %zd >= expected_len %zd", 2498 buffer_offset, response->ip_data_len, expected_len)); |
2471 if (buffer_offset + response->ip_data_len + len > expected_len) { 2472 CFISCSI_SESSION_DEBUG(cs, "truncating from %zd " 2473 "to expected data transfer length %zd", 2474 buffer_offset + response->ip_data_len + len, expected_len); 2475 len = expected_len - (buffer_offset + response->ip_data_len); | 2499 if (buffer_offset + response->ip_data_len + len > expected_len) { 2500 CFISCSI_SESSION_DEBUG(cs, "truncating from %zd " 2501 "to expected data transfer length %zd", 2502 buffer_offset + response->ip_data_len + len, expected_len); 2503 len = expected_len - (buffer_offset + response->ip_data_len); |
2504 KASSERT(len <= sg_len, ("len %zd > sg_len %zd", 2505 len, sg_len)); |
|
2476 } 2477 | 2506 } 2507 |
2478 KASSERT(len <= sg_len, ("len > sg_len")); | |
2479 error = icl_pdu_append_data(response, sg_addr, len, M_NOWAIT); 2480 if (error != 0) { 2481 CFISCSI_SESSION_WARN(cs, "failed to " 2482 "allocate memory; dropping connection"); 2483 icl_pdu_free(response); 2484 ctl_set_busy(&io->scsiio); 2485 io->scsiio.be_move_done(io); 2486 cfiscsi_session_terminate(cs); 2487 return; 2488 } 2489 sg_addr += len; 2490 sg_len -= len; | 2508 error = icl_pdu_append_data(response, sg_addr, len, M_NOWAIT); 2509 if (error != 0) { 2510 CFISCSI_SESSION_WARN(cs, "failed to " 2511 "allocate memory; dropping connection"); 2512 icl_pdu_free(response); 2513 ctl_set_busy(&io->scsiio); 2514 io->scsiio.be_move_done(io); 2515 cfiscsi_session_terminate(cs); 2516 return; 2517 } 2518 sg_addr += len; 2519 sg_len -= len; |
2491 buffer_offset += len; 2492 io->scsiio.ext_data_filled += len; | |
2493 | 2520 |
2494 if (buffer_offset == expected_len) { | 2521 KASSERT(buffer_offset + request->ip_data_len <= expected_len, 2522 ("buffer_offset %zd + ip_data_len %zd > expected_len %zd", 2523 buffer_offset, request->ip_data_len, expected_len)); 2524 if (buffer_offset + request->ip_data_len == expected_len) { |
2495 /* 2496 * Already have the amount of data the initiator wanted. 2497 */ 2498 break; 2499 } 2500 2501 if (sg_len == 0) { 2502 /* --- 13 unchanged lines hidden (view full) --- 2516 /* 2517 * Can't stuff more data into the current PDU; 2518 * queue it. Note that's not enough to check 2519 * for kern_data_resid == 0 instead; there 2520 * may be several Data-In PDUs for the final 2521 * call to cfiscsi_datamove(), and we want 2522 * to set the F flag only on the last of them. 2523 */ | 2525 /* 2526 * Already have the amount of data the initiator wanted. 2527 */ 2528 break; 2529 } 2530 2531 if (sg_len == 0) { 2532 /* --- 13 unchanged lines hidden (view full) --- 2546 /* 2547 * Can't stuff more data into the current PDU; 2548 * queue it. Note that's not enough to check 2549 * for kern_data_resid == 0 instead; there 2550 * may be several Data-In PDUs for the final 2551 * call to cfiscsi_datamove(), and we want 2552 * to set the F flag only on the last of them. 2553 */ |
2554 buffer_offset += response->ip_data_len; |
|
2524 if (buffer_offset == io->scsiio.kern_total_len || 2525 buffer_offset == expected_len) 2526 bhsdi->bhsdi_flags |= BHSDI_FLAGS_F; 2527 cfiscsi_pdu_queue(response); 2528 response = NULL; 2529 bhsdi = NULL; 2530 } 2531 } 2532 if (response != NULL) { | 2555 if (buffer_offset == io->scsiio.kern_total_len || 2556 buffer_offset == expected_len) 2557 bhsdi->bhsdi_flags |= BHSDI_FLAGS_F; 2558 cfiscsi_pdu_queue(response); 2559 response = NULL; 2560 bhsdi = NULL; 2561 } 2562 } 2563 if (response != NULL) { |
2564 buffer_offset += response->ip_data_len; |
|
2533 if (buffer_offset == io->scsiio.kern_total_len || 2534 buffer_offset == expected_len) 2535 bhsdi->bhsdi_flags |= BHSDI_FLAGS_F; 2536 KASSERT(response->ip_data_len > 0, ("sending empty Data-In")); 2537 cfiscsi_pdu_queue(response); 2538 } 2539 2540 io->scsiio.be_move_done(io); --- 19 unchanged lines hidden (view full) --- 2560 ("bhssc->bhssc_opcode != ISCSI_BHS_OPCODE_SCSI_COMMAND")); 2561 2562 /* 2563 * We need to record it so that we can properly report 2564 * underflow/underflow. 2565 */ 2566 PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; 2567 | 2565 if (buffer_offset == io->scsiio.kern_total_len || 2566 buffer_offset == expected_len) 2567 bhsdi->bhsdi_flags |= BHSDI_FLAGS_F; 2568 KASSERT(response->ip_data_len > 0, ("sending empty Data-In")); 2569 cfiscsi_pdu_queue(response); 2570 } 2571 2572 io->scsiio.be_move_done(io); --- 19 unchanged lines hidden (view full) --- 2592 ("bhssc->bhssc_opcode != ISCSI_BHS_OPCODE_SCSI_COMMAND")); 2593 2594 /* 2595 * We need to record it so that we can properly report 2596 * underflow/underflow. 2597 */ 2598 PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; 2599 |
2600 /* 2601 * We hadn't received anything during this datamove yet. 2602 */ 2603 io->scsiio.ext_data_filled = 0; 2604 |
|
2568 target_transfer_tag = 2569 atomic_fetchadd_32(&cs->cs_target_transfer_tag, 1); 2570 2571#if 0 2572 CFISCSI_SESSION_DEBUG(cs, "expecting Data-Out with initiator " 2573 "task tag 0x%x, target transfer tag 0x%x", 2574 bhssc->bhssc_initiator_task_tag, target_transfer_tag); 2575#endif --- 5 unchanged lines hidden (view full) --- 2581 io->scsiio.be_move_done(io); 2582 cfiscsi_session_terminate(cs); 2583 return; 2584 } 2585 cdw->cdw_ctl_io = io; 2586 cdw->cdw_target_transfer_tag = target_transfer_tag; 2587 cdw->cdw_initiator_task_tag = bhssc->bhssc_initiator_task_tag; 2588 | 2605 target_transfer_tag = 2606 atomic_fetchadd_32(&cs->cs_target_transfer_tag, 1); 2607 2608#if 0 2609 CFISCSI_SESSION_DEBUG(cs, "expecting Data-Out with initiator " 2610 "task tag 0x%x, target transfer tag 0x%x", 2611 bhssc->bhssc_initiator_task_tag, target_transfer_tag); 2612#endif --- 5 unchanged lines hidden (view full) --- 2618 io->scsiio.be_move_done(io); 2619 cfiscsi_session_terminate(cs); 2620 return; 2621 } 2622 cdw->cdw_ctl_io = io; 2623 cdw->cdw_target_transfer_tag = target_transfer_tag; 2624 cdw->cdw_initiator_task_tag = bhssc->bhssc_initiator_task_tag; 2625 |
2589 if (cs->cs_immediate_data && icl_pdu_data_segment_length(request) > 0) { | 2626 if (cs->cs_immediate_data && io->scsiio.kern_rel_offset == 0 && 2627 icl_pdu_data_segment_length(request) > 0) { |
2590 done = cfiscsi_handle_data_segment(request, cdw); 2591 if (done) { 2592 uma_zfree(cfiscsi_data_wait_zone, cdw); 2593 io->scsiio.be_move_done(io); 2594 return; 2595 } | 2628 done = cfiscsi_handle_data_segment(request, cdw); 2629 if (done) { 2630 uma_zfree(cfiscsi_data_wait_zone, cdw); 2631 io->scsiio.be_move_done(io); 2632 return; 2633 } |
2596 2597#if 0 2598 if (io->scsiio.ext_data_filled != 0) 2599 CFISCSI_SESSION_DEBUG(cs, "got %zd bytes of immediate data, need %zd", 2600 io->scsiio.ext_data_filled, io->scsiio.kern_data_len); 2601#endif | |
2602 } 2603 2604 CFISCSI_SESSION_LOCK(cs); 2605 TAILQ_INSERT_TAIL(&cs->cs_waiting_for_data_out, cdw, cdw_next); 2606 CFISCSI_SESSION_UNLOCK(cs); 2607 2608 /* 2609 * XXX: We should limit the number of outstanding R2T PDUs --- 235 unchanged lines hidden --- | 2634 } 2635 2636 CFISCSI_SESSION_LOCK(cs); 2637 TAILQ_INSERT_TAIL(&cs->cs_waiting_for_data_out, cdw, cdw_next); 2638 CFISCSI_SESSION_UNLOCK(cs); 2639 2640 /* 2641 * XXX: We should limit the number of outstanding R2T PDUs --- 235 unchanged lines hidden --- |