linux/drivers/scsi/bnx2fc/bnx2fc.h

/* bnx2fc.h: QLogic Linux FCoE offload driver.
 *
 * Copyright (c) 2008-2013 Broadcom Corporation
 * Copyright (c) 2014-2016 QLogic Corporation
 * Copyright (c) 2016-2017 Cavium Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Written by: Bhanu Prakash Gollapudi ([email protected])
 */

#ifndef _BNX2FC_H_
#define _BNX2FC_H_
#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
#include <linux/kthread.h>
#include <linux/crc32.h>
#include <linux/cpu.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/dma-mapping.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/bitops.h>
#include <linux/log2.h>
#include <linux/interrupt.h>
#include <linux/sched/signal.h>
#include <linux/io.h>

#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_tcq.h>
#include <scsi/libfc.h>
#include <scsi/libfcoe.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_fc.h>
#include <scsi/fc/fc_fip.h>
#include <scsi/fc/fc_fc2.h>
#include <scsi/fc_frame.h>
#include <scsi/fc/fc_fcoe.h>
#include <scsi/fc/fc_fcp.h>

#include "57xx_hsi_bnx2fc.h"
#include "../../net/ethernet/broadcom/cnic_if.h"
#include  "../../net/ethernet/broadcom/bnx2x/bnx2x_mfw_req.h"
#include "bnx2fc_constants.h"

#define BNX2FC_NAME
#define BNX2FC_VERSION

#define PFX

#define BCM_CHIP_LEN

#define BNX2X_DOORBELL_PCI_BAR

#define BNX2FC_MAX_BD_LEN
#define BNX2FC_BD_SPLIT_SZ
#define BNX2FC_MAX_BDS_PER_CMD
#define BNX2FC_FW_MAX_BDS_PER_CMD

#define BNX2FC_SQ_WQES_MAX

#define BNX2FC_SCSI_MAX_SQES
#define BNX2FC_TM_MAX_SQES
#define BNX2FC_ELS_MAX_SQES

#define BNX2FC_RQ_WQES_MAX
#define BNX2FC_CQ_WQES_MAX

#define BNX2FC_NUM_MAX_SESS
#define BNX2FC_NUM_MAX_SESS_LOG

#define BNX2FC_MAX_NPIV

#define BNX2FC_MIN_PAYLOAD
#define BNX2FC_MAX_PAYLOAD
#define BNX2FC_MFS
#define BNX2FC_MINI_JUMBO_MTU


#define BNX2FC_RQ_BUF_SZ
#define BNX2FC_RQ_BUF_LOG_SZ

#define BNX2FC_SQ_WQE_SIZE
#define BNX2FC_CQ_WQE_SIZE
#define BNX2FC_RQ_WQE_SIZE
#define BNX2FC_XFERQ_WQE_SIZE
#define BNX2FC_CONFQ_WQE_SIZE
#define BNX2X_DB_SHIFT

#define BNX2FC_TASK_SIZE
#define BNX2FC_TASKS_PER_PAGE

#define BNX2FC_MAX_ROWS_IN_HASH_TBL
#define BNX2FC_HASH_TBL_CHUNK_SIZE

#define BNX2FC_MAX_SEQS
#define BNX2FC_MAX_RETRY_CNT
#define BNX2FC_MAX_RPORT_RETRY_CNT

#define BNX2FC_READ
#define BNX2FC_WRITE

#define BNX2FC_MIN_XID
#define FCOE_MAX_NUM_XIDS
#define FCOE_MAX_XID_OFFSET
#define FCOE_XIDS_PER_CPU_OFFSET
#define BNX2FC_MAX_LUN
#define BNX2FC_MAX_FCP_TGT
#define BNX2FC_MAX_CMD_LEN

#define BNX2FC_TM_TIMEOUT
#define BNX2FC_IO_TIMEOUT

#define BNX2FC_WAIT_CNT
#define BNX2FC_FW_TIMEOUT
#define PORT_MAX

/* FC FCP Status */
#define FC_GOOD

#define BNX2FC_RNID_HBA

#define SRR_RETRY_COUNT
#define REC_RETRY_COUNT
#define BNX2FC_NUM_ERR_BITS

#define BNX2FC_RELOGIN_WAIT_TIME
#define BNX2FC_RELOGIN_WAIT_CNT

#define BNX2FC_STATS(hba, stat, cnt)

/* bnx2fc driver uses only one instance of fcoe_percpu_s */
extern struct fcoe_percpu_s bnx2fc_global;

extern struct workqueue_struct *bnx2fc_wq;

struct bnx2fc_percpu_s {};

struct bnx2fc_fw_stats {};

struct bnx2fc_hba {};

struct bnx2fc_interface {};

#define bnx2fc_from_ctlr(x)

#define bnx2fc_to_ctlr(x)

struct bnx2fc_lport {};

struct bnx2fc_cmd_mgr {};

struct bnx2fc_rport {};

struct bnx2fc_mp_req {};

struct bnx2fc_els_cb_arg {};

/* bnx2fc command structure */
struct bnx2fc_cmd {};

struct io_bdt {};

struct bnx2fc_work {};
struct bnx2fc_unsol_els {};

struct bnx2fc_priv {};

static inline struct bnx2fc_priv *bnx2fc_priv(struct scsi_cmnd *cmd)
{}

struct bnx2fc_cmd *bnx2fc_cmd_alloc(struct bnx2fc_rport *tgt);
struct bnx2fc_cmd *bnx2fc_elstm_alloc(struct bnx2fc_rport *tgt, int type);
void bnx2fc_cmd_release(struct kref *ref);
int bnx2fc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd);
int bnx2fc_send_fw_fcoe_init_msg(struct bnx2fc_hba *hba);
int bnx2fc_send_fw_fcoe_destroy_msg(struct bnx2fc_hba *hba);
int bnx2fc_send_session_ofld_req(struct fcoe_port *port,
					struct bnx2fc_rport *tgt);
int bnx2fc_send_session_enable_req(struct fcoe_port *port,
					struct bnx2fc_rport *tgt);
int bnx2fc_send_session_disable_req(struct fcoe_port *port,
				    struct bnx2fc_rport *tgt);
int bnx2fc_send_session_destroy_req(struct bnx2fc_hba *hba,
					struct bnx2fc_rport *tgt);
int bnx2fc_map_doorbell(struct bnx2fc_rport *tgt);
void bnx2fc_indicate_kcqe(void *context, struct kcqe *kcq[],
					u32 num_cqe);
int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba);
void bnx2fc_free_task_ctx(struct bnx2fc_hba *hba);
int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba);
void bnx2fc_free_fw_resc(struct bnx2fc_hba *hba);
struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba);
void bnx2fc_cmd_mgr_free(struct bnx2fc_cmd_mgr *cmgr);
void bnx2fc_get_link_state(struct bnx2fc_hba *hba);
char *bnx2fc_get_next_rqe(struct bnx2fc_rport *tgt, u8 num_items);
void bnx2fc_return_rqe(struct bnx2fc_rport *tgt, u8 num_items);
int bnx2fc_get_paged_crc_eof(struct sk_buff *skb, int tlen);
int bnx2fc_send_rrq(struct bnx2fc_cmd *aborted_io_req);
int bnx2fc_send_adisc(struct bnx2fc_rport *tgt, struct fc_frame *fp);
int bnx2fc_send_logo(struct bnx2fc_rport *tgt, struct fc_frame *fp);
int bnx2fc_send_rls(struct bnx2fc_rport *tgt, struct fc_frame *fp);
int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req);
int bnx2fc_initiate_abts(struct bnx2fc_cmd *io_req);
void bnx2fc_cmd_timer_set(struct bnx2fc_cmd *io_req,
			  unsigned int timer_msec);
int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req);
void bnx2fc_init_cleanup_task(struct bnx2fc_cmd *io_req,
			      struct fcoe_task_ctx_entry *task,
			      u16 orig_xid);
void bnx2fc_init_seq_cleanup_task(struct bnx2fc_cmd *seq_clnup_req,
				  struct fcoe_task_ctx_entry *task,
				  struct bnx2fc_cmd *orig_io_req,
				  u32 offset);
void bnx2fc_init_mp_task(struct bnx2fc_cmd *io_req,
			 struct fcoe_task_ctx_entry *task);
void bnx2fc_init_task(struct bnx2fc_cmd *io_req,
			     struct fcoe_task_ctx_entry *task);
void bnx2fc_add_2_sq(struct bnx2fc_rport *tgt, u16 xid);
void bnx2fc_ring_doorbell(struct bnx2fc_rport *tgt);
int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd);
int bnx2fc_eh_target_reset(struct scsi_cmnd *sc_cmd);
int bnx2fc_eh_device_reset(struct scsi_cmnd *sc_cmd);
void bnx2fc_rport_event_handler(struct fc_lport *lport,
				struct fc_rport_priv *rport,
				enum fc_rport_event event);
void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
				   struct fcoe_task_ctx_entry *task,
				   u8 num_rq, unsigned char *rq_data);
void bnx2fc_process_cleanup_compl(struct bnx2fc_cmd *io_req,
			       struct fcoe_task_ctx_entry *task,
			       u8 num_rq);
void bnx2fc_process_abts_compl(struct bnx2fc_cmd *io_req,
			       struct fcoe_task_ctx_entry *task,
			       u8 num_rq);
void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,
			     struct fcoe_task_ctx_entry *task,
			     u8 num_rq, unsigned char *rq_data);
void bnx2fc_process_els_compl(struct bnx2fc_cmd *els_req,
			      struct fcoe_task_ctx_entry *task,
			      u8 num_rq);
void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req,
			   struct fcp_cmnd *fcp_cmnd);



void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt);
struct fc_seq *bnx2fc_elsct_send(struct fc_lport *lport, u32 did,
				      struct fc_frame *fp, unsigned int op,
				      void (*resp)(struct fc_seq *,
						   struct fc_frame *,
						   void *),
				      void *arg, u32 timeout);
void bnx2fc_arm_cq(struct bnx2fc_rport *tgt);
int bnx2fc_process_new_cqes(struct bnx2fc_rport *tgt);
void bnx2fc_process_cq_compl(struct bnx2fc_rport *tgt, u16 wqe,
			     unsigned char *rq_data, u8 num_rq,
			     struct fcoe_task_ctx_entry *task);
struct bnx2fc_rport *bnx2fc_tgt_lookup(struct fcoe_port *port,
					     u32 port_id);
void bnx2fc_process_l2_frame_compl(struct bnx2fc_rport *tgt,
				   unsigned char *buf,
				   u32 frame_len, u16 l2_oxid);
int bnx2fc_send_stat_req(struct bnx2fc_hba *hba);
int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, struct bnx2fc_cmd *io_req);
int bnx2fc_send_rec(struct bnx2fc_cmd *orig_io_req);
int bnx2fc_send_srr(struct bnx2fc_cmd *orig_io_req, u32 offset, u8 r_ctl);
void bnx2fc_process_seq_cleanup_compl(struct bnx2fc_cmd *seq_clnup_req,
				      struct fcoe_task_ctx_entry *task,
				      u8 rx_state);
int bnx2fc_initiate_seq_cleanup(struct bnx2fc_cmd *orig_io_req, u32 offset,
				enum fc_rctl r_ctl);


#include "bnx2fc_debug.h"

#endif