.. | .. |
---|
46 | 46 | /* Used by transport_get_inquiry_vpd_device_ident() */ |
---|
47 | 47 | #define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254 |
---|
48 | 48 | |
---|
| 49 | +#define INQUIRY_VENDOR_LEN 8 |
---|
| 50 | +#define INQUIRY_MODEL_LEN 16 |
---|
| 51 | +#define INQUIRY_REVISION_LEN 4 |
---|
| 52 | + |
---|
49 | 53 | /* Attempts before moving from SHORT to LONG */ |
---|
50 | 54 | #define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3 |
---|
51 | 55 | #define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */ |
---|
.. | .. |
---|
70 | 74 | #define DA_EMULATE_MODEL_ALIAS 0 |
---|
71 | 75 | /* Emulation for WriteCache and SYNCHRONIZE_CACHE */ |
---|
72 | 76 | #define DA_EMULATE_WRITE_CACHE 0 |
---|
73 | | -/* Emulation for UNIT ATTENTION Interlock Control */ |
---|
74 | | -#define DA_EMULATE_UA_INTLLCK_CTRL 0 |
---|
75 | 77 | /* Emulation for TASK_ABORTED status (TAS) by default */ |
---|
76 | 78 | #define DA_EMULATE_TAS 1 |
---|
77 | 79 | /* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */ |
---|
.. | .. |
---|
87 | 89 | #define DA_EMULATE_3PC 1 |
---|
88 | 90 | /* No Emulation for PSCSI by default */ |
---|
89 | 91 | #define DA_EMULATE_ALUA 0 |
---|
| 92 | +/* Emulate SCSI2 RESERVE/RELEASE and Persistent Reservations by default */ |
---|
| 93 | +#define DA_EMULATE_PR 1 |
---|
90 | 94 | /* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ |
---|
91 | 95 | #define DA_ENFORCE_PR_ISIDS 1 |
---|
92 | 96 | /* Force SPC-3 PR Activate Persistence across Target Power Loss */ |
---|
.. | .. |
---|
134 | 138 | SCF_SENT_CHECK_CONDITION = 0x00000800, |
---|
135 | 139 | SCF_OVERFLOW_BIT = 0x00001000, |
---|
136 | 140 | SCF_UNDERFLOW_BIT = 0x00002000, |
---|
137 | | - SCF_SEND_DELAYED_TAS = 0x00004000, |
---|
138 | 141 | SCF_ALUA_NON_OPTIMIZED = 0x00008000, |
---|
139 | 142 | SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, |
---|
140 | 143 | SCF_COMPARE_AND_WRITE = 0x00080000, |
---|
141 | | - SCF_COMPARE_AND_WRITE_POST = 0x00100000, |
---|
142 | 144 | SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = 0x00200000, |
---|
143 | 145 | SCF_ACK_KREF = 0x00400000, |
---|
144 | 146 | SCF_USE_CPUID = 0x00800000, |
---|
.. | .. |
---|
205 | 207 | TMR_LUN_RESET = 5, |
---|
206 | 208 | TMR_TARGET_WARM_RESET = 6, |
---|
207 | 209 | TMR_TARGET_COLD_RESET = 7, |
---|
| 210 | + TMR_LUN_RESET_PRO = 0x80, |
---|
208 | 211 | TMR_UNKNOWN = 0xff, |
---|
209 | 212 | }; |
---|
210 | 213 | |
---|
.. | .. |
---|
315 | 318 | }; |
---|
316 | 319 | |
---|
317 | 320 | struct t10_wwn { |
---|
318 | | - char vendor[8]; |
---|
319 | | - char model[16]; |
---|
320 | | - char revision[4]; |
---|
| 321 | + /* |
---|
| 322 | + * SCSI left aligned strings may not be null terminated. +1 to ensure a |
---|
| 323 | + * null terminator is always present. |
---|
| 324 | + */ |
---|
| 325 | + char vendor[INQUIRY_VENDOR_LEN + 1]; |
---|
| 326 | + char model[INQUIRY_MODEL_LEN + 1]; |
---|
| 327 | + char revision[INQUIRY_REVISION_LEN + 1]; |
---|
321 | 328 | char unit_serial[INQUIRY_VPD_SERIAL_LEN]; |
---|
322 | 329 | spinlock_t t10_vpd_lock; |
---|
323 | 330 | struct se_device *t10_dev; |
---|
.. | .. |
---|
425 | 432 | TARGET_DIF_TYPE3_PROT, |
---|
426 | 433 | }; |
---|
427 | 434 | |
---|
| 435 | +/* Emulation for UNIT ATTENTION Interlock Control */ |
---|
| 436 | +enum target_ua_intlck_ctrl { |
---|
| 437 | + TARGET_UA_INTLCK_CTRL_CLEAR = 0, |
---|
| 438 | + TARGET_UA_INTLCK_CTRL_NO_CLEAR = 1, |
---|
| 439 | + TARGET_UA_INTLCK_CTRL_ESTABLISH_UA = 2, |
---|
| 440 | +}; |
---|
| 441 | + |
---|
428 | 442 | enum target_core_dif_check { |
---|
429 | 443 | TARGET_DIF_CHECK_GUARD = 0x1 << 0, |
---|
430 | 444 | TARGET_DIF_CHECK_APPTAG = 0x1 << 1, |
---|
.. | .. |
---|
475 | 489 | struct se_session *se_sess; |
---|
476 | 490 | struct se_tmr_req *se_tmr_req; |
---|
477 | 491 | struct list_head se_cmd_list; |
---|
478 | | - struct completion *compl; |
---|
| 492 | + struct completion *free_compl; |
---|
| 493 | + struct completion *abrt_compl; |
---|
479 | 494 | const struct target_core_fabric_ops *se_tfo; |
---|
480 | 495 | sense_reason_t (*execute_cmd)(struct se_cmd *); |
---|
481 | 496 | sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool, int *); |
---|
.. | .. |
---|
493 | 508 | #define CMD_T_STOP (1 << 5) |
---|
494 | 509 | #define CMD_T_TAS (1 << 10) |
---|
495 | 510 | #define CMD_T_FABRIC_STOP (1 << 11) |
---|
496 | | -#define CMD_T_PRE_EXECUTE (1 << 12) |
---|
497 | 511 | spinlock_t t_state_lock; |
---|
498 | 512 | struct kref cmd_kref; |
---|
499 | 513 | struct completion t_transport_stop_comp; |
---|
.. | .. |
---|
526 | 540 | struct scatterlist *t_prot_sg; |
---|
527 | 541 | unsigned int t_prot_nents; |
---|
528 | 542 | sense_reason_t pi_err; |
---|
529 | | - sector_t bad_sector; |
---|
| 543 | + u64 sense_info; |
---|
| 544 | + /* |
---|
| 545 | + * CPU LIO will execute the cmd on. Defaults to the CPU the cmd is |
---|
| 546 | + * initialized on. Drivers can override. |
---|
| 547 | + */ |
---|
530 | 548 | int cpuid; |
---|
531 | 549 | }; |
---|
532 | 550 | |
---|
.. | .. |
---|
655 | 673 | }; |
---|
656 | 674 | |
---|
657 | 675 | struct se_dev_attrib { |
---|
658 | | - int emulate_model_alias; |
---|
659 | | - int emulate_dpo; |
---|
660 | | - int emulate_fua_write; |
---|
661 | | - int emulate_fua_read; |
---|
662 | | - int emulate_write_cache; |
---|
663 | | - int emulate_ua_intlck_ctrl; |
---|
664 | | - int emulate_tas; |
---|
665 | | - int emulate_tpu; |
---|
666 | | - int emulate_tpws; |
---|
667 | | - int emulate_caw; |
---|
668 | | - int emulate_3pc; |
---|
669 | | - int pi_prot_format; |
---|
| 676 | + bool emulate_model_alias; |
---|
| 677 | + bool emulate_dpo; /* deprecated */ |
---|
| 678 | + bool emulate_fua_write; |
---|
| 679 | + bool emulate_fua_read; /* deprecated */ |
---|
| 680 | + bool emulate_write_cache; |
---|
| 681 | + enum target_ua_intlck_ctrl emulate_ua_intlck_ctrl; |
---|
| 682 | + bool emulate_tas; |
---|
| 683 | + bool emulate_tpu; |
---|
| 684 | + bool emulate_tpws; |
---|
| 685 | + bool emulate_caw; |
---|
| 686 | + bool emulate_3pc; |
---|
| 687 | + bool emulate_pr; |
---|
670 | 688 | enum target_prot_type pi_prot_type; |
---|
671 | 689 | enum target_prot_type hw_pi_prot_type; |
---|
672 | | - int pi_prot_verify; |
---|
673 | | - int enforce_pr_isids; |
---|
674 | | - int force_pr_aptpl; |
---|
675 | | - int is_nonrot; |
---|
676 | | - int emulate_rest_reord; |
---|
677 | | - int unmap_zeroes_data; |
---|
| 690 | + bool pi_prot_verify; |
---|
| 691 | + bool enforce_pr_isids; |
---|
| 692 | + bool force_pr_aptpl; |
---|
| 693 | + bool is_nonrot; |
---|
| 694 | + bool emulate_rest_reord; |
---|
| 695 | + bool unmap_zeroes_data; |
---|
678 | 696 | u32 hw_block_size; |
---|
679 | 697 | u32 block_size; |
---|
680 | 698 | u32 hw_max_sectors; |
---|
.. | .. |
---|
733 | 751 | struct scsi_port_stats lun_stats; |
---|
734 | 752 | struct config_group lun_group; |
---|
735 | 753 | struct se_port_stat_grps port_stat_grps; |
---|
736 | | - struct completion lun_ref_comp; |
---|
737 | 754 | struct completion lun_shutdown_comp; |
---|
738 | 755 | struct percpu_ref lun_ref; |
---|
739 | 756 | struct list_head lun_dev_link; |
---|
.. | .. |
---|
748 | 765 | struct config_group scsi_lu_group; |
---|
749 | 766 | }; |
---|
750 | 767 | |
---|
| 768 | +struct se_device_queue { |
---|
| 769 | + struct list_head state_list; |
---|
| 770 | + spinlock_t lock; |
---|
| 771 | +}; |
---|
| 772 | + |
---|
751 | 773 | struct se_device { |
---|
752 | 774 | /* RELATIVE TARGET PORT IDENTIFER Counter */ |
---|
753 | 775 | u16 dev_rpti_counter; |
---|
.. | .. |
---|
760 | 782 | #define DF_USING_UDEV_PATH 0x00000008 |
---|
761 | 783 | #define DF_USING_ALIAS 0x00000010 |
---|
762 | 784 | #define DF_READ_ONLY 0x00000020 |
---|
| 785 | + u8 transport_flags; |
---|
763 | 786 | /* Physical device queue depth */ |
---|
764 | 787 | u32 queue_depth; |
---|
765 | 788 | /* Used for SPC-2 reservations enforce of ISIDs */ |
---|
.. | .. |
---|
780 | 803 | atomic_t dev_qf_count; |
---|
781 | 804 | u32 export_count; |
---|
782 | 805 | spinlock_t delayed_cmd_lock; |
---|
783 | | - spinlock_t execute_task_lock; |
---|
784 | 806 | spinlock_t dev_reservation_lock; |
---|
785 | 807 | unsigned int dev_reservation_flags; |
---|
786 | 808 | #define DRF_SPC2_RESERVATIONS 0x00000001 |
---|
.. | .. |
---|
789 | 811 | spinlock_t se_tmr_lock; |
---|
790 | 812 | spinlock_t qf_cmd_lock; |
---|
791 | 813 | struct semaphore caw_sem; |
---|
792 | | - /* Used for legacy SPC-2 reservationsa */ |
---|
793 | | - struct se_node_acl *dev_reserved_node_acl; |
---|
| 814 | + /* Used for legacy SPC-2 reservations */ |
---|
| 815 | + struct se_session *reservation_holder; |
---|
794 | 816 | /* Used for ALUA Logical Unit Group membership */ |
---|
795 | 817 | struct t10_alua_lu_gp_member *dev_alua_lu_gp_mem; |
---|
796 | 818 | /* Used for SPC-3 Persistent Reservations */ |
---|
797 | 819 | struct t10_pr_registration *dev_pr_res_holder; |
---|
798 | 820 | struct list_head dev_sep_list; |
---|
799 | 821 | struct list_head dev_tmr_list; |
---|
800 | | - struct workqueue_struct *tmr_wq; |
---|
801 | 822 | struct work_struct qf_work_queue; |
---|
802 | 823 | struct work_struct delayed_cmd_work; |
---|
803 | 824 | struct list_head delayed_cmd_list; |
---|
804 | | - struct list_head state_list; |
---|
805 | 825 | struct list_head qf_cmd_list; |
---|
806 | 826 | /* Pointer to associated SE HBA */ |
---|
807 | 827 | struct se_hba *se_hba; |
---|
.. | .. |
---|
828 | 848 | /* For se_lun->lun_se_dev RCU read-side critical access */ |
---|
829 | 849 | u32 hba_index; |
---|
830 | 850 | struct rcu_head rcu_head; |
---|
| 851 | + int queue_cnt; |
---|
| 852 | + struct se_device_queue *queues; |
---|
| 853 | + struct mutex lun_reset_mutex; |
---|
831 | 854 | }; |
---|
832 | 855 | |
---|
833 | 856 | struct se_hba { |
---|
.. | .. |
---|
872 | 895 | /* Spinlock for adding/removing sessions */ |
---|
873 | 896 | spinlock_t session_lock; |
---|
874 | 897 | struct mutex tpg_lun_mutex; |
---|
875 | | - struct list_head se_tpg_node; |
---|
876 | 898 | /* linked list for initiator ACL list */ |
---|
877 | 899 | struct list_head acl_node_list; |
---|
878 | 900 | struct hlist_head tpg_lun_hlist; |
---|