18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/* QLogic FCoE Offload Driver
38c2ecf20Sopenharmony_ci * Copyright (c) 2016-2018 Cavium Inc.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef _FCOE_FW_FUNCS_H
68c2ecf20Sopenharmony_ci#define _FCOE_FW_FUNCS_H
78c2ecf20Sopenharmony_ci#include "drv_scsi_fw_funcs.h"
88c2ecf20Sopenharmony_ci#include "qedf_hsi.h"
98c2ecf20Sopenharmony_ci#include <linux/qed/qed_if.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistruct fcoe_task_params {
128c2ecf20Sopenharmony_ci	/* Output parameter [set/filled by the HSI function] */
138c2ecf20Sopenharmony_ci	struct e4_fcoe_task_context *context;
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci	/* Output parameter [set/filled by the HSI function] */
168c2ecf20Sopenharmony_ci	struct fcoe_wqe *sqe;
178c2ecf20Sopenharmony_ci	enum fcoe_task_type task_type;
188c2ecf20Sopenharmony_ci	u32 tx_io_size; /* in bytes */
198c2ecf20Sopenharmony_ci	u32 rx_io_size; /* in bytes */
208c2ecf20Sopenharmony_ci	u32 conn_cid;
218c2ecf20Sopenharmony_ci	u16 itid;
228c2ecf20Sopenharmony_ci	u8 cq_rss_number;
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci	 /* Whether it's Tape device or not (0=Disk, 1=Tape) */
258c2ecf20Sopenharmony_ci	u8 is_tape_device;
268c2ecf20Sopenharmony_ci};
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/**
298c2ecf20Sopenharmony_ci * @brief init_initiator_rw_fcoe_task - Initializes FCoE task context for
308c2ecf20Sopenharmony_ci * read/write task types and init fcoe_sqe
318c2ecf20Sopenharmony_ci *
328c2ecf20Sopenharmony_ci * @param task_params - Pointer to task parameters struct
338c2ecf20Sopenharmony_ci * @param sgl_task_params - Pointer to SGL task params
348c2ecf20Sopenharmony_ci * @param sense_data_buffer_phys_addr - Pointer to sense data buffer
358c2ecf20Sopenharmony_ci * @param task_retry_id - retry identification - Used only for Tape device
368c2ecf20Sopenharmony_ci * @param fcp_cmnd_payload - FCP CMD Payload
378c2ecf20Sopenharmony_ci */
388c2ecf20Sopenharmony_ciint init_initiator_rw_fcoe_task(struct fcoe_task_params *task_params,
398c2ecf20Sopenharmony_ci	struct scsi_sgl_task_params *sgl_task_params,
408c2ecf20Sopenharmony_ci	struct regpair sense_data_buffer_phys_addr,
418c2ecf20Sopenharmony_ci	u32 task_retry_id,
428c2ecf20Sopenharmony_ci	u8 fcp_cmd_payload[32]);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/**
458c2ecf20Sopenharmony_ci * @brief init_initiator_midpath_fcoe_task - Initializes FCoE task context for
468c2ecf20Sopenharmony_ci * midpath/unsolicited task types and init fcoe_sqe
478c2ecf20Sopenharmony_ci *
488c2ecf20Sopenharmony_ci * @param task_params - Pointer to task parameters struct
498c2ecf20Sopenharmony_ci * @param mid_path_fc_header - FC header
508c2ecf20Sopenharmony_ci * @param tx_sgl_task_params - Pointer to Tx SGL task params
518c2ecf20Sopenharmony_ci * @param rx_sgl_task_params - Pointer to Rx SGL task params
528c2ecf20Sopenharmony_ci * @param fw_to_place_fc_header	- Indication if the FW will place the FC header
538c2ecf20Sopenharmony_ci * in addition to the data arrives.
548c2ecf20Sopenharmony_ci */
558c2ecf20Sopenharmony_ciint init_initiator_midpath_unsolicited_fcoe_task(
568c2ecf20Sopenharmony_ci	struct fcoe_task_params *task_params,
578c2ecf20Sopenharmony_ci	struct fcoe_tx_mid_path_params *mid_path_fc_header,
588c2ecf20Sopenharmony_ci	struct scsi_sgl_task_params *tx_sgl_task_params,
598c2ecf20Sopenharmony_ci	struct scsi_sgl_task_params *rx_sgl_task_params,
608c2ecf20Sopenharmony_ci	u8 fw_to_place_fc_header);
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/**
638c2ecf20Sopenharmony_ci * @brief init_initiator_abort_fcoe_task - Initializes FCoE task context for
648c2ecf20Sopenharmony_ci * abort task types and init fcoe_sqe
658c2ecf20Sopenharmony_ci *
668c2ecf20Sopenharmony_ci * @param task_params - Pointer to task parameters struct
678c2ecf20Sopenharmony_ci */
688c2ecf20Sopenharmony_ciint init_initiator_abort_fcoe_task(struct fcoe_task_params *task_params);
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/**
718c2ecf20Sopenharmony_ci * @brief init_initiator_cleanup_fcoe_task - Initializes FCoE task context for
728c2ecf20Sopenharmony_ci * cleanup task types and init fcoe_sqe
738c2ecf20Sopenharmony_ci *
748c2ecf20Sopenharmony_ci *
758c2ecf20Sopenharmony_ci * @param task_params - Pointer to task parameters struct
768c2ecf20Sopenharmony_ci */
778c2ecf20Sopenharmony_ciint init_initiator_cleanup_fcoe_task(struct fcoe_task_params *task_params);
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/**
808c2ecf20Sopenharmony_ci * @brief init_initiator_cleanup_fcoe_task - Initializes FCoE task context for
818c2ecf20Sopenharmony_ci * sequence recovery task types and init fcoe_sqe
828c2ecf20Sopenharmony_ci *
838c2ecf20Sopenharmony_ci *
848c2ecf20Sopenharmony_ci * @param task_params - Pointer to task parameters struct
858c2ecf20Sopenharmony_ci * @param desired_offset - The desired offest the task will be re-sent from
868c2ecf20Sopenharmony_ci */
878c2ecf20Sopenharmony_ciint init_initiator_sequence_recovery_fcoe_task(
888c2ecf20Sopenharmony_ci	struct fcoe_task_params *task_params,
898c2ecf20Sopenharmony_ci	u32 desired_offset);
908c2ecf20Sopenharmony_ci#endif
91