aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_target.h
diff options
context:
space:
mode:
authorQuinn Tran <quinn.tran@qlogic.com>2014-04-11 16:54:43 -0400
committerChristoph Hellwig <hch@lst.de>2014-05-19 07:31:05 -0400
commitf83adb617f55be13046191d83fa9110ff0689406 (patch)
tree79975dd317761859016a96e573f0fde2ff82b1c6 /drivers/scsi/qla2xxx/qla_target.h
parent5921cda6c1a402bacbfa5c97bbb7039eb0fd9dd8 (diff)
qla2xxx: T10-Dif: add T10-PI support
Add support for T10-Dif for Target Mode to qla driver. The driver will look for firmware attribute that support this feature. When the feature is present, the capabilities will be report to TCM layer. Add CTIO CRC2 iocb to build T10-Dif commands. Add support routines to process good & error cases. Signed-off-by: Quinn Tran <quinn.tran@qlogic.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_target.h')
-rw-r--r--drivers/scsi/qla2xxx/qla_target.h84
1 files changed, 81 insertions, 3 deletions
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index ce33d8c26406..f873e10451d2 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -293,6 +293,7 @@ struct ctio_to_2xxx {
293#define CTIO_ABORTED 0x02 293#define CTIO_ABORTED 0x02
294#define CTIO_INVALID_RX_ID 0x08 294#define CTIO_INVALID_RX_ID 0x08
295#define CTIO_TIMEOUT 0x0B 295#define CTIO_TIMEOUT 0x0B
296#define CTIO_DIF_ERROR 0x0C /* DIF error detected */
296#define CTIO_LIP_RESET 0x0E 297#define CTIO_LIP_RESET 0x0E
297#define CTIO_TARGET_RESET 0x17 298#define CTIO_TARGET_RESET 0x17
298#define CTIO_PORT_UNAVAILABLE 0x28 299#define CTIO_PORT_UNAVAILABLE 0x28
@@ -498,11 +499,12 @@ struct ctio7_from_24xx {
498#define CTIO7_FLAGS_DONT_RET_CTIO BIT_8 499#define CTIO7_FLAGS_DONT_RET_CTIO BIT_8
499#define CTIO7_FLAGS_STATUS_MODE_0 0 500#define CTIO7_FLAGS_STATUS_MODE_0 0
500#define CTIO7_FLAGS_STATUS_MODE_1 BIT_6 501#define CTIO7_FLAGS_STATUS_MODE_1 BIT_6
502#define CTIO7_FLAGS_STATUS_MODE_2 BIT_7
501#define CTIO7_FLAGS_EXPLICIT_CONFORM BIT_5 503#define CTIO7_FLAGS_EXPLICIT_CONFORM BIT_5
502#define CTIO7_FLAGS_CONFIRM_SATISF BIT_4 504#define CTIO7_FLAGS_CONFIRM_SATISF BIT_4
503#define CTIO7_FLAGS_DSD_PTR BIT_2 505#define CTIO7_FLAGS_DSD_PTR BIT_2
504#define CTIO7_FLAGS_DATA_IN BIT_1 506#define CTIO7_FLAGS_DATA_IN BIT_1 /* data to initiator */
505#define CTIO7_FLAGS_DATA_OUT BIT_0 507#define CTIO7_FLAGS_DATA_OUT BIT_0 /* data from initiator */
506 508
507#define ELS_PLOGI 0x3 509#define ELS_PLOGI 0x3
508#define ELS_FLOGI 0x4 510#define ELS_FLOGI 0x4
@@ -514,6 +516,68 @@ struct ctio7_from_24xx {
514#define ELS_ADISC 0x52 516#define ELS_ADISC 0x52
515 517
516/* 518/*
519 *CTIO Type CRC_2 IOCB
520 */
521struct ctio_crc2_to_fw {
522 uint8_t entry_type; /* Entry type. */
523#define CTIO_CRC2 0x7A
524 uint8_t entry_count; /* Entry count. */
525 uint8_t sys_define; /* System defined. */
526 uint8_t entry_status; /* Entry Status. */
527
528 uint32_t handle; /* System handle. */
529 uint16_t nport_handle; /* N_PORT handle. */
530 uint16_t timeout; /* Command timeout. */
531
532 uint16_t dseg_count; /* Data segment count. */
533 uint8_t vp_index;
534 uint8_t add_flags; /* additional flags */
535#define CTIO_CRC2_AF_DIF_DSD_ENA BIT_3
536
537 uint8_t initiator_id[3]; /* initiator ID */
538 uint8_t reserved1;
539 uint32_t exchange_addr; /* rcv exchange address */
540 uint16_t reserved2;
541 uint16_t flags; /* refer to CTIO7 flags values */
542 uint32_t residual;
543 uint16_t ox_id;
544 uint16_t scsi_status;
545 uint32_t relative_offset;
546 uint32_t reserved5;
547 uint32_t transfer_length; /* total fc transfer length */
548 uint32_t reserved6;
549 uint32_t crc_context_address[2];/* Data segment address. */
550 uint16_t crc_context_len; /* Data segment length. */
551 uint16_t reserved_1; /* MUST be set to 0. */
552} __packed;
553
554/* CTIO Type CRC_x Status IOCB */
555struct ctio_crc_from_fw {
556 uint8_t entry_type; /* Entry type. */
557 uint8_t entry_count; /* Entry count. */
558 uint8_t sys_define; /* System defined. */
559 uint8_t entry_status; /* Entry Status. */
560
561 uint32_t handle; /* System handle. */
562 uint16_t status;
563 uint16_t timeout; /* Command timeout. */
564 uint16_t dseg_count; /* Data segment count. */
565 uint32_t reserved1;
566 uint16_t state_flags;
567#define CTIO_CRC_SF_DIF_CHOPPED BIT_4
568
569 uint32_t exchange_address; /* rcv exchange address */
570 uint16_t reserved2;
571 uint16_t flags;
572 uint32_t resid_xfer_length;
573 uint16_t ox_id;
574 uint8_t reserved3[12];
575 uint16_t runt_guard; /* reported runt blk guard */
576 uint8_t actual_dif[8];
577 uint8_t expected_dif[8];
578} __packed;
579
580/*
517 * ISP queue - ABTS received/response entries structure definition for 24xx. 581 * ISP queue - ABTS received/response entries structure definition for 24xx.
518 */ 582 */
519#define ABTS_RECV_24XX 0x54 /* ABTS received (for 24xx) */ 583#define ABTS_RECV_24XX 0x54 /* ABTS received (for 24xx) */
@@ -641,6 +705,7 @@ struct qla_tgt_func_tmpl {
641 int (*handle_cmd)(struct scsi_qla_host *, struct qla_tgt_cmd *, 705 int (*handle_cmd)(struct scsi_qla_host *, struct qla_tgt_cmd *,
642 unsigned char *, uint32_t, int, int, int); 706 unsigned char *, uint32_t, int, int, int);
643 void (*handle_data)(struct qla_tgt_cmd *); 707 void (*handle_data)(struct qla_tgt_cmd *);
708 void (*handle_dif_err)(struct qla_tgt_cmd *);
644 int (*handle_tmr)(struct qla_tgt_mgmt_cmd *, uint32_t, uint8_t, 709 int (*handle_tmr)(struct qla_tgt_mgmt_cmd *, uint32_t, uint8_t,
645 uint32_t); 710 uint32_t);
646 void (*free_cmd)(struct qla_tgt_cmd *); 711 void (*free_cmd)(struct qla_tgt_cmd *);
@@ -829,9 +894,9 @@ struct qla_tgt_sess {
829}; 894};
830 895
831struct qla_tgt_cmd { 896struct qla_tgt_cmd {
897 struct se_cmd se_cmd;
832 struct qla_tgt_sess *sess; 898 struct qla_tgt_sess *sess;
833 int state; 899 int state;
834 struct se_cmd se_cmd;
835 struct work_struct free_work; 900 struct work_struct free_work;
836 struct work_struct work; 901 struct work_struct work;
837 /* Sense buffer that will be mapped into outgoing status */ 902 /* Sense buffer that will be mapped into outgoing status */
@@ -843,6 +908,7 @@ struct qla_tgt_cmd {
843 unsigned int free_sg:1; 908 unsigned int free_sg:1;
844 unsigned int aborted:1; /* Needed in case of SRR */ 909 unsigned int aborted:1; /* Needed in case of SRR */
845 unsigned int write_data_transferred:1; 910 unsigned int write_data_transferred:1;
911 unsigned int ctx_dsd_alloced:1;
846 912
847 struct scatterlist *sg; /* cmd data buffer SG vector */ 913 struct scatterlist *sg; /* cmd data buffer SG vector */
848 int sg_cnt; /* SG segments count */ 914 int sg_cnt; /* SG segments count */
@@ -857,6 +923,12 @@ struct qla_tgt_cmd {
857 struct scsi_qla_host *vha; 923 struct scsi_qla_host *vha;
858 924
859 struct atio_from_isp atio; 925 struct atio_from_isp atio;
926 /* t10dif */
927 struct scatterlist *prot_sg;
928 uint32_t prot_sg_cnt;
929 uint32_t blk_sz;
930 struct crc_context *ctx;
931
860}; 932};
861 933
862struct qla_tgt_sess_work_param { 934struct qla_tgt_sess_work_param {
@@ -901,6 +973,10 @@ struct qla_tgt_prm {
901 int sense_buffer_len; 973 int sense_buffer_len;
902 int residual; 974 int residual;
903 int add_status_pkt; 975 int add_status_pkt;
976 /* dif */
977 struct scatterlist *prot_sg;
978 uint16_t prot_seg_cnt;
979 uint16_t tot_dsds;
904}; 980};
905 981
906struct qla_tgt_srr_imm { 982struct qla_tgt_srr_imm {
@@ -976,6 +1052,8 @@ extern void qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *,
976extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *); 1052extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *);
977extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *); 1053extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *);
978extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t); 1054extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t);
1055extern int qlt_rdy_to_xfer_dif(struct qla_tgt_cmd *);
1056extern int qlt_xmit_response_dif(struct qla_tgt_cmd *, int, uint8_t);
979extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *); 1057extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *);
980extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *); 1058extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *);
981extern void qlt_free_cmd(struct qla_tgt_cmd *cmd); 1059extern void qlt_free_cmd(struct qla_tgt_cmd *cmd);