path: root/sys/cam/ctl/ctl_frontend_iscsi.c
diff options
authorAlexander Motin <mav@FreeBSD.org>2020-10-25 19:34:02 +0000
committerAlexander Motin <mav@FreeBSD.org>2020-10-25 19:34:02 +0000
commit883649681528398dc227778882830fc9da0ce58c (patch)
treee723924a03b24e3f8e7969d4016ff5c79df76e94 /sys/cam/ctl/ctl_frontend_iscsi.c
parent98b04ac35965fa0735c06a4966c6939f8009509e (diff)
Introduce support of SCSI Command Priority.
SAM-3 specification introduced concept of Task Priority, that was renamed to Command Priority in SAM-4, and supported by all modern SCSI transports. It provides 15 levels of relative priorities: 1 - highest, 15 - lowest and 0 - default. SAT specification for SATA devices translates priorities 1-3 into NCQ high priority. This change adds new "priority" field into empty spots of struct ccb_scsiio and struct ccb_accept_tio of CAM and struct ctl_scsiio of CTL. Respective support is added into iscsi(4), isp(4), mpr(4), mps(4) and ocs_fc(4) drivers for both initiator and where applicable target roles. Minimal support was added to CTL to receive the priority value from different frontends, pass it between HA controllers and report in few places. This patch does not add consumers of this functionality, so nothing should really change yet, since the field is still set to 0 (default) on initiator and not actively used on target. Those are to be implemented separately. I've confirmed priority working on WD Red SATA disks connected via mpr(4) and properly transferred to CTL target via iscsi(4), isp(4) and ocs_fc(4). While there, added missing tag_action support to ocs_fc(4) initiator role. MFC after: 1 month Relnotes: yes Sponsored by: iXsystems, Inc.
Notes: svn path=/head/; revision=367044
Diffstat (limited to 'sys/cam/ctl/ctl_frontend_iscsi.c')
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 0b91d4fd39c1..694ce99763f6 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -530,6 +530,8 @@ cfiscsi_pdu_handle_scsi_command(struct icl_pdu *request)
io->io_hdr.nexus.initid = cs->cs_ctl_initid;
io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port;
io->io_hdr.nexus.targ_lun = ctl_decode_lun(be64toh(bhssc->bhssc_lun));
+ io->scsiio.priority = (bhssc->bhssc_pri & BHSSC_PRI_MASK) >>
io->scsiio.tag_num = bhssc->bhssc_initiator_task_tag;
switch ((bhssc->bhssc_flags & BHSSC_FLAGS_ATTR)) {