1 /* QLogic FCoE Offload Driver 2 * Copyright (c) 2016 Cavium Inc. 3 * 4 * This software is available under the terms of the GNU General Public License 5 * (GPL) Version 2, available from the file COPYING in the main directory of 6 * this source tree. 7 */ 8 #ifndef _SCSI_FW_FUNCS_H 9 #define _SCSI_FW_FUNCS_H 10 #include <linux/qed/common_hsi.h> 11 #include <linux/qed/storage_common.h> 12 #include <linux/qed/fcoe_common.h> 13 14 struct scsi_sgl_task_params { 15 struct scsi_sge *sgl; 16 struct regpair sgl_phys_addr; 17 u32 total_buffer_size; 18 u16 num_sges; 19 20 /* true if SGL contains a small (< 4KB) SGE in middle(not 1st or last) 21 * -> relevant for tx only 22 */ 23 bool small_mid_sge; 24 }; 25 26 struct scsi_dif_task_params { 27 u32 initial_ref_tag; 28 bool initial_ref_tag_is_valid; 29 u16 application_tag; 30 u16 application_tag_mask; 31 u16 dif_block_size_log; 32 bool dif_on_network; 33 bool dif_on_host; 34 u8 host_guard_type; 35 u8 protection_type; 36 u8 ref_tag_mask; 37 bool crc_seed; 38 39 /* Enable Connection error upon DIF error (segments with DIF errors are 40 * dropped) 41 */ 42 bool tx_dif_conn_err_en; 43 bool ignore_app_tag; 44 bool keep_ref_tag_const; 45 bool validate_guard; 46 bool validate_app_tag; 47 bool validate_ref_tag; 48 bool forward_guard; 49 bool forward_app_tag; 50 bool forward_ref_tag; 51 bool forward_app_tag_with_mask; 52 bool forward_ref_tag_with_mask; 53 }; 54 55 struct scsi_initiator_cmd_params { 56 /* for cdb_size > default CDB size (extended CDB > 16 bytes) -> 57 * pointer to the CDB buffer SGE 58 */ 59 struct scsi_sge extended_cdb_sge; 60 61 /* Physical address of sense data buffer for sense data - 256B buffer */ 62 struct regpair sense_data_buffer_phys_addr; 63 }; 64 65 /** 66 * @brief scsi_is_slow_sgl - checks for slow SGL 67 * 68 * @param num_sges - number of sges in SGL 69 * @param small_mid_sge - True is the SGL contains an SGE which is smaller than 70 * 4KB and its not the 1st or last SGE in the SGL 71 */ 72 bool scsi_is_slow_sgl(u16 num_sges, bool small_mid_sge); 73 74 /** 75 * @brief init_scsi_sgl_context - initializes SGL task context 76 * 77 * @param sgl_params - SGL context parameters to initialize (output parameter) 78 * @param data_desc - context struct containing SGEs array to set (output 79 * parameter) 80 * @param sgl_task_params - SGL parameters (input) 81 */ 82 void init_scsi_sgl_context(struct scsi_sgl_params *sgl_params, 83 struct scsi_cached_sges *ctx_data_desc, 84 struct scsi_sgl_task_params *sgl_task_params); 85 #endif 86