linux/drivers/scsi/bfa/bfa_fcpim.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
 * Copyright (c) 2014- QLogic Corporation.
 * All rights reserved
 * www.qlogic.com
 *
 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
 */

#ifndef __BFA_FCPIM_H__
#define __BFA_FCPIM_H__

#include "bfa.h"
#include "bfa_svc.h"
#include "bfi_ms.h"
#include "bfa_defs_svc.h"
#include "bfa_cs.h"

/* FCP module related definitions */
#define BFA_IO_MAX
#define BFA_FWTIO_MAX

struct bfa_fcp_mod_s;
struct bfa_iotag_s {};

struct bfa_itn_s {};

void bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport,
		void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m));
void bfa_itn_isr(struct bfa_s *bfa, struct bfi_msg_s *m);
void bfa_iotag_attach(struct bfa_fcp_mod_s *fcp);
void bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw, u16 max_ioim_fw);

#define BFA_FCP_MOD(_hal)
#define BFA_MEM_FCP_KVA(__bfa)
#define BFA_IOTAG_FROM_TAG(_fcp, _tag)
#define BFA_ITN_FROM_TAG(_fcp, _tag)
#define BFA_SNSINFO_FROM_TAG(_fcp, _tag)


#define BFA_ITNIM_MIN
#define BFA_ITNIM_MAX

#define BFA_IOIM_MIN
#define BFA_IOIM_MAX

#define BFA_TSKIM_MIN
#define BFA_TSKIM_MAX
#define BFA_FCPIM_PATHTOV_DEF
#define BFA_FCPIM_PATHTOV_MAX


#define bfa_itnim_ioprofile_update(__itnim, __index)

#define BFA_IOIM_RETRY_TAG_OFFSET
#define BFA_IOIM_IOTAG_MASK
#define BFA_IOIM_RETRY_MAX

/* Buckets are are 512 bytes to 2MB */
static inline u32
bfa_ioim_get_index(u32 n) {}

/*
 * forward declarations
 */
struct bfa_ioim_s;
struct bfa_tskim_s;
struct bfad_ioim_s;
struct bfad_tskim_s;

bfa_fcpim_profile_t;

struct bfa_fcpim_s {};

/* Max FCP dma segs required */
#define BFA_FCP_DMA_SEGS

struct bfa_fcp_mod_s {};

/*
 * IO state machine events
 */
enum bfa_ioim_event {};

struct bfa_ioim_s;
bfa_ioim_sm_t;

/*
 * BFA IO (initiator mode)
 */
struct bfa_ioim_s {};

struct bfa_ioim_sp_s {};

enum bfa_tskim_event {};

struct bfa_tskim_s;
bfa_tskim_sm_t;

/*
 * BFA Task management command (initiator mode)
 */
struct bfa_tskim_s {};

/*
 *  itnim state machine event
 */
enum bfa_itnim_event {};

struct bfa_itnim_s;
bfa_itnim_sm_t;

/*
 * BFA i-t-n (initiator mode)
 */
struct bfa_itnim_s {};

#define bfa_itnim_is_online(_itnim)
#define BFA_FCPIM(_hal)
#define BFA_IOIM_TAG_2_ID(_iotag)
#define BFA_IOIM_FROM_TAG(_fcpim, _iotag)
#define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag)

#define bfa_io_profile_start_time(_bfa)
#define bfa_fcpim_get_io_profile(_bfa)
#define bfa_ioim_update_iotag(__ioim)

static inline bfa_boolean_t
bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim)
{}

/*
 * function prototypes
 */
void	bfa_ioim_attach(struct bfa_fcpim_s *fcpim);
void	bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
void	bfa_ioim_good_comp_isr(struct bfa_s *bfa,
					struct bfi_msg_s *msg);
void	bfa_ioim_cleanup(struct bfa_ioim_s *ioim);
void	bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim,
					struct bfa_tskim_s *tskim);
void	bfa_ioim_iocdisable(struct bfa_ioim_s *ioim);
void	bfa_ioim_tov(struct bfa_ioim_s *ioim);

void	bfa_tskim_attach(struct bfa_fcpim_s *fcpim);
void	bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
void	bfa_tskim_iodone(struct bfa_tskim_s *tskim);
void	bfa_tskim_iocdisable(struct bfa_tskim_s *tskim);
void	bfa_tskim_cleanup(struct bfa_tskim_s *tskim);
void	bfa_tskim_res_recfg(struct bfa_s *bfa, u16 num_tskim_fw);

void	bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len);
void	bfa_itnim_attach(struct bfa_fcpim_s *fcpim);
void	bfa_itnim_iocdisable(struct bfa_itnim_s *itnim);
void	bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
void	bfa_itnim_iodone(struct bfa_itnim_s *itnim);
void	bfa_itnim_tskdone(struct bfa_itnim_s *itnim);
bfa_boolean_t   bfa_itnim_hold_io(struct bfa_itnim_s *itnim);

/*
 * bfa fcpim module API functions
 */
void	bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov);
u16	bfa_fcpim_path_tov_get(struct bfa_s *bfa);
u16	bfa_fcpim_qdepth_get(struct bfa_s *bfa);
bfa_status_t bfa_fcpim_port_iostats(struct bfa_s *bfa,
			struct bfa_itnim_iostats_s *stats, u8 lp_tag);
void bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *fcpim_stats,
			struct bfa_itnim_iostats_s *itnim_stats);
bfa_status_t bfa_fcpim_profile_on(struct bfa_s *bfa, time64_t time);
bfa_status_t bfa_fcpim_profile_off(struct bfa_s *bfa);

#define bfa_fcpim_ioredirect_enabled(__bfa)

#define bfa_fcpim_get_next_reqq(__bfa, __qid)

#define bfa_iocfc_map_msg_to_qid(__msg, __qid)
/*
 * bfa itnim API functions
 */
struct bfa_itnim_s *bfa_itnim_create(struct bfa_s *bfa,
		struct bfa_rport_s *rport, void *itnim);
void bfa_itnim_delete(struct bfa_itnim_s *itnim);
void bfa_itnim_online(struct bfa_itnim_s *itnim, bfa_boolean_t seq_rec);
void bfa_itnim_offline(struct bfa_itnim_s *itnim);
void bfa_itnim_clear_stats(struct bfa_itnim_s *itnim);
bfa_status_t bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim,
			struct bfa_itnim_ioprofile_s *ioprofile);

#define bfa_itnim_get_reqq(__ioim)

/*
 * BFA completion callback for bfa_itnim_online().
 */
void	bfa_cb_itnim_online(void *itnim);

/*
 * BFA completion callback for bfa_itnim_offline().
 */
void	bfa_cb_itnim_offline(void *itnim);
void	bfa_cb_itnim_tov_begin(void *itnim);
void	bfa_cb_itnim_tov(void *itnim);

/*
 * BFA notification to FCS/driver for second level error recovery.
 * Atleast one I/O request has timedout and target is unresponsive to
 * repeated abort requests. Second level error recovery should be initiated
 * by starting implicit logout and recovery procedures.
 */
void	bfa_cb_itnim_sler(void *itnim);

/*
 * bfa ioim API functions
 */
struct bfa_ioim_s	*bfa_ioim_alloc(struct bfa_s *bfa,
					struct bfad_ioim_s *dio,
					struct bfa_itnim_s *itnim,
					u16 nsgles);

void		bfa_ioim_free(struct bfa_ioim_s *ioim);
void		bfa_ioim_start(struct bfa_ioim_s *ioim);
bfa_status_t	bfa_ioim_abort(struct bfa_ioim_s *ioim);
void		bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim,
				      bfa_boolean_t iotov);
/*
 * I/O completion notification.
 *
 * @param[in]		dio			driver IO structure
 * @param[in]		io_status		IO completion status
 * @param[in]		scsi_status		SCSI status returned by target
 * @param[in]		sns_len			SCSI sense length, 0 if none
 * @param[in]		sns_info		SCSI sense data, if any
 * @param[in]		residue			Residual length
 *
 * @return None
 */
void bfa_cb_ioim_done(void *bfad, struct bfad_ioim_s *dio,
			enum bfi_ioim_status io_status,
			u8 scsi_status, int sns_len,
			u8 *sns_info, s32 residue);

/*
 * I/O good completion notification.
 */
void bfa_cb_ioim_good_comp(void *bfad, struct bfad_ioim_s *dio);

/*
 * I/O abort completion notification
 */
void bfa_cb_ioim_abort(void *bfad, struct bfad_ioim_s *dio);

/*
 * bfa tskim API functions
 */
struct bfa_tskim_s *bfa_tskim_alloc(struct bfa_s *bfa,
			struct bfad_tskim_s *dtsk);
void bfa_tskim_free(struct bfa_tskim_s *tskim);
void bfa_tskim_start(struct bfa_tskim_s *tskim,
			struct bfa_itnim_s *itnim, struct scsi_lun lun,
			enum fcp_tm_cmnd tm, u8 t_secs);
void bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk,
			enum bfi_tskim_status tsk_status);

void	bfa_fcpim_lunmask_rp_update(struct bfa_s *bfa, wwn_t lp_wwn,
			wwn_t rp_wwn, u16 rp_tag, u8 lp_tag);
bfa_status_t	bfa_fcpim_lunmask_update(struct bfa_s *bfa, u32 on_off);
bfa_status_t	bfa_fcpim_lunmask_query(struct bfa_s *bfa, void *buf);
bfa_status_t	bfa_fcpim_lunmask_delete(struct bfa_s *bfa, u16 vf_id,
				wwn_t *pwwn, wwn_t rpwwn, struct scsi_lun lun);
bfa_status_t	bfa_fcpim_lunmask_add(struct bfa_s *bfa, u16 vf_id,
				wwn_t *pwwn, wwn_t rpwwn, struct scsi_lun lun);
bfa_status_t	bfa_fcpim_lunmask_clear(struct bfa_s *bfa);
u16		bfa_fcpim_read_throttle(struct bfa_s *bfa);
bfa_status_t	bfa_fcpim_write_throttle(struct bfa_s *bfa, u16 value);
bfa_status_t	bfa_fcpim_throttle_set(struct bfa_s *bfa, u16 value);
bfa_status_t	bfa_fcpim_throttle_get(struct bfa_s *bfa, void *buf);
u16     bfa_fcpim_get_throttle_cfg(struct bfa_s *bfa, u16 drv_cfg_param);

#endif /* __BFA_FCPIM_H__ */