linux/drivers/scsi/snic/snic.h

/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright 2014 Cisco Systems, Inc.  All rights reserved. */

#ifndef _SNIC_H_
#define _SNIC_H_

#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/workqueue.h>
#include <linux/bitops.h>
#include <linux/mempool.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>

#include "snic_disc.h"
#include "snic_io.h"
#include "snic_res.h"
#include "snic_trc.h"
#include "snic_stats.h"
#include "vnic_dev.h"
#include "vnic_wq.h"
#include "vnic_cq.h"
#include "vnic_intr.h"
#include "vnic_stats.h"
#include "vnic_snic.h"

#define SNIC_DRV_NAME
#define SNIC_DRV_DESCRIPTION
#define SNIC_DRV_VERSION
#define PFX
#define DFX

#define DESC_CLEAN_LOW_WATERMARK
#define SNIC_UCSM_DFLT_THROTTLE_CNT_BLD
#define SNIC_MAX_IO_REQ
#define SNIC_MIN_IO_REQ
#define SNIC_IO_LOCKS
#define SNIC_DFLT_QUEUE_DEPTH
#define SNIC_MAX_QUEUE_DEPTH
#define SNIC_DFLT_CMD_TIMEOUT

/*
 * Tag bits used for special requests.
 */
#define SNIC_TAG_ABORT
#define SNIC_TAG_DEV_RST
#define SNIC_TAG_IOCTL_DEV_RST
#define SNIC_TAG_MASK
#define SNIC_NO_TAG

/*
 * Command flags to identify the type of command and for other future use
 */
#define SNIC_NO_FLAGS
#define SNIC_IO_INITIALIZED
#define SNIC_IO_ISSUED
#define SNIC_IO_DONE
#define SNIC_IO_REQ_NULL
#define SNIC_IO_ABTS_PENDING
#define SNIC_IO_ABORTED
#define SNIC_IO_ABTS_ISSUED
#define SNIC_IO_TERM_ISSUED
#define SNIC_IO_ABTS_TIMEDOUT
#define SNIC_IO_ABTS_TERM_DONE
#define SNIC_IO_ABTS_TERM_REQ_NULL
#define SNIC_IO_ABTS_TERM_TIMEDOUT
#define SNIC_IO_INTERNAL_TERM_PENDING
#define SNIC_IO_INTERNAL_TERM_ISSUED
#define SNIC_DEVICE_RESET
#define SNIC_DEV_RST_ISSUED
#define SNIC_DEV_RST_TIMEDOUT
#define SNIC_DEV_RST_ABTS_ISSUED
#define SNIC_DEV_RST_TERM_ISSUED
#define SNIC_DEV_RST_DONE
#define SNIC_DEV_RST_REQ_NULL
#define SNIC_DEV_RST_ABTS_DONE
#define SNIC_DEV_RST_TERM_DONE
#define SNIC_DEV_RST_ABTS_PENDING
#define SNIC_DEV_RST_PENDING
#define SNIC_DEV_RST_NOTSUP
#define SNIC_SCSI_CLEANUP
#define SNIC_HOST_RESET_ISSUED
#define SNIC_HOST_RESET_CMD_TERM

#define SNIC_ABTS_TIMEOUT
#define SNIC_LUN_RESET_TIMEOUT
#define SNIC_HOST_RESET_TIMEOUT


/*
 * These are protected by the hashed req_lock.
 */
#define CMD_SP(Cmnd)
#define CMD_STATE(Cmnd)
#define CMD_ABTS_STATUS(Cmnd)
#define CMD_LR_STATUS(Cmnd)
#define CMD_FLAGS(Cmnd)

#define SNIC_INVALID_CODE

#define SNIC_MAX_TARGET
#define SNIC_FLAGS_NONE

/* snic module params */
extern unsigned int snic_max_qdepth;

/* snic debugging */
extern unsigned int snic_log_level;

#define SNIC_MAIN_LOGGING
#define SNIC_SCSI_LOGGING
#define SNIC_ISR_LOGGING
#define SNIC_DESC_LOGGING

#define SNIC_CHECK_LOGGING(LEVEL, CMD)

#define SNIC_MAIN_DBG(host, fmt, args...)

#define SNIC_SCSI_DBG(host, fmt, args...)

#define SNIC_DISC_DBG(host, fmt, args...)

#define SNIC_ISR_DBG(host, fmt, args...)

#define SNIC_HOST_ERR(host, fmt, args...)

#define SNIC_HOST_INFO(host, fmt, args...)

#define SNIC_INFO(fmt, args...)

#define SNIC_DBG(fmt, args...)

#define SNIC_ERR(fmt, args...)

#ifdef DEBUG
#define SNIC_BUG_ON
#else
#define SNIC_BUG_ON(EXPR)
#endif

/* Soft assert */
#define SNIC_ASSERT_NOT_IMPL(EXPR)


extern const char *snic_state_str[];

enum snic_intx_intr_index {};

enum snic_msix_intr_index {};

#define SNIC_INTRHDLR_NAMSZ
struct snic_msix_entry {};

enum snic_state {};

#define SNIC_WQ_MAX
#define SNIC_CQ_IO_CMPL_MAX
#define SNIC_CQ_MAX

/* firmware version information */
struct snic_fw_info {};

/*
 * snic_work item : defined to process asynchronous events
 */
struct snic_work {};

/*
 * snic structure to represent SCSI vNIC
 */
struct snic {}; /* end of snic structure */

/*
 * SNIC Driver's Global Data
 */
struct snic_global {};

extern struct snic_global *snic_glob;

int snic_glob_init(void);
void snic_glob_cleanup(void);

extern struct workqueue_struct *snic_event_queue;
extern const struct attribute_group *snic_host_groups[];

int snic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
int snic_abort_cmd(struct scsi_cmnd *);
int snic_device_reset(struct scsi_cmnd *);
int snic_host_reset(struct scsi_cmnd *);
int snic_reset(struct Scsi_Host *, struct scsi_cmnd *);
void snic_shutdown_scsi_cleanup(struct snic *);


int snic_request_intr(struct snic *);
void snic_free_intr(struct snic *);
int snic_set_intr_mode(struct snic *);
void snic_clear_intr_mode(struct snic *);

int snic_fwcq_cmpl_handler(struct snic *, int);
int snic_wq_cmpl_handler(struct snic *, int);
void snic_free_wq_buf(struct vnic_wq *, struct vnic_wq_buf *);


void snic_log_q_error(struct snic *);
void snic_handle_link_event(struct snic *);
void snic_handle_link(struct work_struct *);

int snic_queue_exch_ver_req(struct snic *);
void snic_io_exch_ver_cmpl_handler(struct snic *, struct snic_fw_req *);

int snic_queue_wq_desc(struct snic *, void *os_buf, u16 len);

void snic_handle_untagged_req(struct snic *, struct snic_req_info *);
void snic_release_untagged_req(struct snic *, struct snic_req_info *);
void snic_free_all_untagged_reqs(struct snic *);
int snic_get_conf(struct snic *);
void snic_set_state(struct snic *, enum snic_state);
int snic_get_state(struct snic *);
const char *snic_state_to_str(unsigned int);
void snic_hex_dump(char *, char *, int);
void snic_print_desc(const char *fn, char *os_buf, int len);
const char *show_opcode_name(int val);
#endif /* _SNIC_H */