提交 7a80da77 编写于 作者: C Chenguangli 提交者: Yang Yingliang

scsi/hifc: add hifc driver FC service module

driver inclusion
category: feature
bugzilla: NA

-----------------------------------------------------------------------

This module is used to process services related to the FC protocol.
Signed-off-by: NChenguangli <chenguangli2@huawei.com>
Reviewed-by: NZengweiliang <zengweiliang.zengweiliang@huawei.com>
Acked-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 418ca332
...@@ -179,7 +179,7 @@ config CHR_DEV_SCH ...@@ -179,7 +179,7 @@ config CHR_DEV_SCH
changers are listed as "Type: Medium Changer" in /proc/scsi/scsi. changers are listed as "Type: Medium Changer" in /proc/scsi/scsi.
If you have such hardware and want to use it with linux, say Y If you have such hardware and want to use it with linux, say Y
here. Check <file:Documentation/scsi/scsi-changer.txt> for details. here. Check <file:Documentation/scsi/scsi-changer.txt> for details.
If you want to compile this as a module ( = code which can be If you want to compile this as a module ( = code which can be
inserted in and removed from the running kernel whenever you want), inserted in and removed from the running kernel whenever you want),
say M here and read <file:Documentation/kbuild/modules.txt> and say M here and read <file:Documentation/kbuild/modules.txt> and
...@@ -475,7 +475,7 @@ config SCSI_DPT_I2O ...@@ -475,7 +475,7 @@ config SCSI_DPT_I2O
tristate "Adaptec I2O RAID support " tristate "Adaptec I2O RAID support "
depends on SCSI && PCI && VIRT_TO_BUS depends on SCSI && PCI && VIRT_TO_BUS
help help
This driver supports all of Adaptec's I2O based RAID controllers as This driver supports all of Adaptec's I2O based RAID controllers as
well as the DPT SmartRaid V cards. This is an Adaptec maintained well as the DPT SmartRaid V cards. This is an Adaptec maintained
driver by Deanna Bonds. See <file:Documentation/scsi/dpti.txt>. driver by Deanna Bonds. See <file:Documentation/scsi/dpti.txt>.
...@@ -638,7 +638,7 @@ config SCSI_GDTH ...@@ -638,7 +638,7 @@ config SCSI_GDTH
---help--- ---help---
Formerly called GDT SCSI Disk Array Controller Support. Formerly called GDT SCSI Disk Array Controller Support.
This is a driver for RAID/SCSI Disk Array Controllers (EISA/ISA/PCI) This is a driver for RAID/SCSI Disk Array Controllers (EISA/ISA/PCI)
manufactured by Intel Corporation/ICP vortex GmbH. It is documented manufactured by Intel Corporation/ICP vortex GmbH. It is documented
in the kernel source in <file:drivers/scsi/gdth.c> and in the kernel source in <file:drivers/scsi/gdth.c> and
<file:drivers/scsi/gdth.h>. <file:drivers/scsi/gdth.h>.
...@@ -1113,6 +1113,8 @@ source "drivers/scsi/qla4xxx/Kconfig" ...@@ -1113,6 +1113,8 @@ source "drivers/scsi/qla4xxx/Kconfig"
source "drivers/scsi/qedi/Kconfig" source "drivers/scsi/qedi/Kconfig"
source "drivers/scsi/qedf/Kconfig" source "drivers/scsi/qedf/Kconfig"
source "drivers/scsi/huawei/Kconfig"
config SCSI_LPFC config SCSI_LPFC
tristate "Emulex LightPulse Fibre Channel Support" tristate "Emulex LightPulse Fibre Channel Support"
depends on PCI && SCSI depends on PCI && SCSI
......
...@@ -79,10 +79,11 @@ obj-$(CONFIG_SCSI_IPS) += ips.o ...@@ -79,10 +79,11 @@ obj-$(CONFIG_SCSI_IPS) += ips.o
obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o
obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o
obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o
obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o
obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/ obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/
obj-$(CONFIG_SCSI_QLA_ISCSI) += libiscsi.o qla4xxx/ obj-$(CONFIG_SCSI_QLA_ISCSI) += libiscsi.o qla4xxx/
obj-$(CONFIG_SCSI_LPFC) += lpfc/ obj-$(CONFIG_SCSI_LPFC) += lpfc/
obj-$(CONFIG_SCSI_HUAWEI_FC) += huawei/
obj-$(CONFIG_SCSI_BFA_FC) += bfa/ obj-$(CONFIG_SCSI_BFA_FC) += bfa/
obj-$(CONFIG_SCSI_CHELSIO_FCOE) += csiostor/ obj-$(CONFIG_SCSI_CHELSIO_FCOE) += csiostor/
obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o
......
#
# Huawei driver configuration
#
config SCSI_HUAWEI_FC
tristate "Huawei devices"
depends on PCI && SCSI
depends on SCSI_FC_ATTRS
default m
---help---
If you have a Fibre Channel PCI card belonging to this class, say Y.
Note that the answer to this question doesn't directly affect the
kernel: saying N will just cause the configurator to skip all
the questions about Huawei cards. If you say Y, you will be asked
for your specific card in the following questions.
if SCSI_HUAWEI_FC
source "drivers/scsi/huawei/hifc/Kconfig"
endif # SCSI_HUAWEI_FC
#
# Makefile for the Huawei device drivers.
#
obj-$(CONFIG_SCSI_FC_HIFC) += hifc/
#
# Huawei driver configuration
#
config SCSI_FC_HIFC
tristate "Huawei hifc Fibre Channel Support"
default m
depends on PCI && SCSI
depends on SCSI_FC_ATTRS
---help---
This driver supports Huawei Fibre Channel PCI and
PCIE host adapters.
obj-$(CONFIG_SCSI_FC_HIFC) += hifc.o
hifc-objs += hifc_utils.o
hifc-objs += hifc_hba.o
hifc-objs += hifc_portmng.o
hifc-objs += hifc_module.o
hifc-objs += hifc_chipitf.o
hifc-objs += hifc_io.o
hifc-objs += hifc_queue.o
hifc-objs += hifc_service.o
hifc-objs += hifc_wqe.o
hifc-objs += hifc_cfg.o
hifc-objs += hifc_lld.o
hifc-objs += unf_io.o
hifc-objs += unf_io_abnormal.o
hifc-objs += unf_scsi.o
hifc-objs += unf_init.o
hifc-objs += unf_event.o
hifc-objs += unf_exchg.o
hifc-objs += unf_lport.o
hifc-objs += unf_disc.o
hifc-objs += unf_rport.o
hifc-objs += unf_service.o
hifc-objs += unf_portman.o
hifc-objs += unf_npiv.o
hifc-objs += hifc_sml.o
hifc-objs += hifc_tool.o
hifc-objs += hifc_tool_hw.o
hifc-objs += hifc_dbgtool_knl.o
hifc-objs += hifc_hwif.o
hifc-objs += hifc_eqs.o
hifc-objs += hifc_api_cmd.o
hifc-objs += hifc_mgmt.o
hifc-objs += hifc_wq.o
hifc-objs += hifc_cmdq.o
hifc-objs += hifc_hwdev.o
hifc-objs += hifc_cqm_main.o
hifc-objs += hifc_cqm_object.o
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0 */
/* Huawei Hifc PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
*/
#ifndef __HIFC_SERVICE_H__
#define __HIFC_SERVICE_H__
/* Send ElsCmnd or ElsRsp */
unsigned int hifc_send_els_cmnd(void *phba, struct unf_frame_pkg_s *v_pkg);
/* Send GsCmnd */
unsigned int hifc_send_gs_cmnd(void *v_hba, struct unf_frame_pkg_s *v_pkg);
/* Send BlsCmnd */
unsigned int hifc_send_bls_cmnd(void *v_hba, struct unf_frame_pkg_s *v_pkg);
/* Receive Frame from Root RQ */
unsigned int hifc_rcv_service_frame_from_rq(
struct hifc_hba_s *v_hba,
struct hifc_root_rq_info_s *rq_info,
struct hifc_root_rq_complet_info_s *v_complet_info,
unsigned short v_rcv_buf_num);
unsigned int hifc_rq_rcv_srv_err(struct hifc_hba_s *v_hba,
struct hifc_root_rq_complet_info_s *v_info);
unsigned int hifc_rq_rcv_els_rsp_sts(
struct hifc_hba_s *v_hba,
struct hifc_root_rq_complet_info_s *v_info);
/* Receive Frame from SCQ */
unsigned int hifc_rcv_scqe_entry_from_scq(void *v_hba, void *v_scqe,
unsigned int scq_idx);
/* FC txmfs */
#define HIFC_DEFAULT_TX_MAX_FREAM_SIZE 256
#define HIFC_FIRST_PKG_FLAG (1 << 0)
#define HIFC_LAST_PKG_FLAG (1 << 1)
#define HIFC_CHECK_IF_FIRST_PKG(pkg_flag) ((pkg_flag) & HIFC_FIRST_PKG_FLAG)
#define HIFC_CHECK_IF_LAST_PKG(pkg_flag) ((pkg_flag) & HIFC_LAST_PKG_FLAG)
#define HIFC_GET_SERVICE_TYPE(v_hba) 12
#define HIFC_GET_PACKET_TYPE(v_service_type) 1
#define HIFC_GET_PACKET_COS(v_service_type) 1
#define HIFC_GET_PRLI_PAYLOAD_LEN \
(UNF_PRLI_PAYLOAD_LEN - UNF_PRLI_SIRT_EXTRA_SIZE)
/* Start addr of the header/payloed of the cmnd buffer in the pkg */
#define HIFC_FC_HEAD_LEN (sizeof(struct unf_fchead_s))
#define HIFC_PAYLOAD_OFFSET (sizeof(struct unf_fchead_s))
#define HIFC_GET_CMND_PAYLOAD_ADDR(v_pkg) \
UNF_GET_FLOGI_PAYLOAD(v_pkg)
#define HIFC_GET_CMND_HEADER_ADDR(v_pkg) \
((v_pkg)->unf_cmnd_pload_bl.buffer_ptr)
#define HIFC_GET_RSP_HEADER_ADDR(v_pkg) \
((v_pkg)->unf_rsp_pload_bl.buffer_ptr)
#define HIFC_GET_RSP_PAYLOAD_ADDR(v_pkg) \
((v_pkg)->unf_rsp_pload_bl.buffer_ptr + HIFC_PAYLOAD_OFFSET)
#define HIFC_GET_CMND_FC_HEADER(v_pkg) \
(&(UNF_GET_SFS_ENTRY(v_pkg)->sfs_common.frame_head))
#define HIFC_PKG_IS_ELS_RSP(els_cmnd_type) \
(((els_cmnd_type) == ELS_ACC) || ((els_cmnd_type) == ELS_RJT))
#define HIFC_XID_IS_VALID(xid, exi_base, exi_count) \
(((xid) >= (exi_base)) && ((xid) < ((exi_base) + (exi_count))))
#define UNF_FC_PAYLOAD_ELS_MASK 0xFF000000
#define UNF_FC_PAYLOAD_ELS_SHIFT 24
#define UNF_FC_PAYLOAD_ELS_DWORD 0
/* Note: this pfcpayload is little endian */
#define UNF_GET_FC_PAYLOAD_ELS_CMND(pfcpayload) \
UNF_GET_SHIFTMASK(((unsigned int *)(void *)pfcpayload)\
[UNF_FC_PAYLOAD_ELS_DWORD], \
UNF_FC_PAYLOAD_ELS_SHIFT, UNF_FC_PAYLOAD_ELS_MASK)
#define HIFC_ELS_CMND_MASK 0xffff
#define HIFC_ELS_CMND__RELEVANT_SHIFT 16UL
#define HIFC_GET_ELS_CMND_CODE(__cmnd) \
((unsigned short)((__cmnd) & HIFC_ELS_CMND_MASK))
#define HIFC_GET_ELS_RSP_TYPE(__cmnd) \
((unsigned short)((__cmnd) & HIFC_ELS_CMND_MASK))
#define HIFC_GET_ELS_RSP_CODE(__cmnd) \
((unsigned short)((__cmnd) >> HIFC_ELS_CMND__RELEVANT_SHIFT & \
HIFC_ELS_CMND_MASK))
#define HIFC_GET_GS_CMND_CODE(__cmnd) \
((unsigned short)((__cmnd) & HIFC_ELS_CMND_MASK))
/* ELS CMND Request */
#define ELS_CMND 0
/* fh_f_ctl - Frame control flags. */
#define HIFC_FC_EX_CTX (1 << 23) /* sent by responder to exchange */
#define HIFC_FC_SEQ_CTX (1 << 22) /* sent by responder to sequence */
#define HIFC_FC_FIRST_SEQ (1 << 21) /* first sequence of this exchange */
#define HIFC_FC_LAST_SEQ (1 << 20) /* last sequence of this exchange */
#define HIFC_FC_END_SEQ (1 << 19) /* last frame of sequence */
#define HIFC_FC_END_CONN (1 << 18) /* end of class 1 connection pending */
#define HIFC_FC_RES_B17 (1 << 17) /* reserved */
#define HIFC_FC_SEQ_INIT (1 << 16) /* transfer of sequence initiative */
#define HIFC_FC_X_ID_REASS (1 << 15) /* exchange ID has been changed */
#define HIFC_FC_X_ID_INVAL (1 << 14) /* exchange ID invalidated */
#define HIFC_FC_ACK_1 (1 << 12) /* 13:12 = 1: ACK_1 expected */
#define HIFC_FC_ACK_N (2 << 12) /* 13:12 = 2: ACK_N expected */
#define HIFC_FC_ACK_0 (3 << 12) /* 13:12 = 3: ACK_0 expected */
#define HIFC_FC_RES_B11 (1 << 11) /* reserved */
#define HIFC_FC_RES_B10 (1 << 10) /* reserved */
#define HIFC_FC_RETX_SEQ (1 << 9) /* retransmitted sequence */
#define HIFC_FC_UNI_TX (1 << 8) /* unidirectional transmit (class 1) */
#define HIFC_FC_CONT_SEQ(i) ((i) << 6)
#define HIFC_FC_ABT_SEQ(i) ((i) << 4)
#define HIFC_FC_REL_OFF (1 << 3) /* parameter is relative offset */
#define HIFC_FC_RES2 (1 << 2) /* reserved */
#define HIFC_FC_FILL(i) ((i) & 3) /* 1:0: bytes of trailing fill */
#define HIFC_FCTL_REQ (HIFC_FC_FIRST_SEQ | HIFC_FC_END_SEQ |\
HIFC_FC_SEQ_INIT)
#define HIFC_FCTL_RESP (HIFC_FC_EX_CTX | HIFC_FC_LAST_SEQ | \
HIFC_FC_END_SEQ | HIFC_FC_SEQ_INIT)
#define HIFC_RCTL_BLS_REQ 0x81
#define HIFC_RCTL_BLS_ACC 0x84
#define HIFC_RCTL_BLS_RJT 0x85
#define UNF_IO_STATE_NEW 0
#define TGT_IO_STATE_SEND_XFERRDY (1 << 2)
#define TGT_IO_STATE_RSP (1 << 5)
#define TGT_IO_STATE_ABORT (1 << 7)
enum HIFC_FC_FH_TYPE_E {
HIFC_FC_TYPE_BLS = 0x00, /* basic link service */
HIFC_FC_TYPE_ELS = 0x01, /* extended link service */
HIFC_FC_TYPE_IP = 0x05, /* IP over FC, RFC 4338 */
HIFC_FC_TYPE_FCP = 0x08, /* SCSI FCP */
HIFC_FC_TYPE_CT = 0x20, /* Fibre Channel Services (FC-CT) */
HIFC_FC_TYPE_ILS = 0x22 /* internal link service */
};
enum HIFC_FC_FH_RCTL_E {
HIFC_FC_RCTL_DD_UNCAT = 0x00, /* uncategorized information */
HIFC_FC_RCTL_DD_SOL_DATA = 0x01, /* solicited data */
HIFC_FC_RCTL_DD_UNSOL_CTL = 0x02, /* unsolicited control */
HIFC_FC_RCTL_DD_SOL_CTL = 0x03, /* solicited control or reply */
HIFC_FC_RCTL_DD_UNSOL_DATA = 0x04, /* unsolicited data */
HIFC_FC_RCTL_DD_DATA_DESC = 0x05, /* data descriptor */
HIFC_FC_RCTL_DD_UNSOL_CMD = 0x06, /* unsolicited command */
HIFC_FC_RCTL_DD_CMD_STATUS = 0x07, /* command status */
#define HIFC_FC_RCTL_ILS_REQ HIFC_FC_RCTL_DD_UNSOL_CTL /* ILS request */
#define HIFC_FC_RCTL_ILS_REP HIFC_FC_RCTL_DD_SOL_CTL /* ILS reply */
/*
* Extended Link_Data
*/
HIFC_FC_RCTL_ELS_REQ = 0x22, /* extended link services request */
HIFC_FC_RCTL_ELS_RSP = 0x23, /* extended link services reply */
HIFC_FC_RCTL_ELS4_REQ = 0x32, /* FC-4 ELS request */
HIFC_FC_RCTL_ELS4_RSP = 0x33, /* FC-4 ELS reply */
/*
* Optional Extended Headers
*/
HIFC_FC_RCTL_VFTH = 0x50, /* virtual fabric tagging header */
HIFC_FC_RCTL_IFRH = 0x51, /* inter-fabric routing header */
HIFC_FC_RCTL_ENCH = 0x52, /* encapsulation header */
/*
* Basic Link Services fh_r_ctl values.
*/
HIFC_FC_RCTL_BA_NOP = 0x80, /* basic link service NOP */
HIFC_FC_RCTL_BA_ABTS = 0x81, /* basic link service abort */
HIFC_FC_RCTL_BA_RMC = 0x82, /* remove connection */
HIFC_FC_RCTL_BA_ACC = 0x84, /* basic accept */
HIFC_FC_RCTL_BA_RJT = 0x85, /* basic reject */
HIFC_FC_RCTL_BA_PRMT = 0x86, /* dedicated connection preempted */
/*
* Link Control Information.
*/
HIFC_FC_RCTL_ACK_1 = 0xc0, /* acknowledge_1 */
HIFC_FC_RCTL_ACK_0 = 0xc1, /* acknowledge_0 */
HIFC_FC_RCTL_P_RJT = 0xc2, /* port reject */
HIFC_FC_RCTL_F_RJT = 0xc3, /* fabric reject */
HIFC_FC_RCTL_P_BSY = 0xc4, /* port busy */
HIFC_FC_RCTL_F_BSY = 0xc5, /* fabric busy to data frame */
HIFC_FC_RCTL_F_BSYL = 0xc6, /* fabric busy to link control frame */
HIFC_FC_RCTL_LCR = 0xc7, /* link credit reset */
HIFC_FC_RCTL_END = 0xc9 /* end */
};
struct hifc_fc_frame_header {
unsigned char rctl; /* routing control */
unsigned char did[3]; /* Destination ID */
unsigned char cs_ctl; /* class of service control / pri */
unsigned char sid[3]; /* Source ID */
unsigned char type; /* see enum fc_fh_type below */
unsigned char frame_ctl[3]; /* frame control */
unsigned char seq_id; /* sequence ID */
unsigned char df_ctl; /* data field control */
unsigned short seq_cnt; /* sequence count */
unsigned short ox_id; /* originator exchange ID */
unsigned short rx_id; /* responder exchange ID */
unsigned int parm_offset; /* parameter or relative offset */
};
unsigned int hifc_rcv_els_cmnd(const struct hifc_hba_s *v_hba,
struct unf_frame_pkg_s *v_pkg,
unsigned char *v_pld,
unsigned int pld_len,
int first_frame);
unsigned int hifc_rcv_els_rsp(const struct hifc_hba_s *v_hba,
struct unf_frame_pkg_s *v_pkg,
unsigned int ox_id);
unsigned int hifc_rcv_els_rsp_sts(const struct hifc_hba_s *v_hba,
struct unf_frame_pkg_s *v_pkg,
unsigned int rx_id);
unsigned int hifc_rcv_gs_rsp(const struct hifc_hba_s *v_hba,
struct unf_frame_pkg_s *v_pkg,
unsigned int ox_id);
unsigned int hifc_rcv_bls_rsp(const struct hifc_hba_s *v_hba,
struct unf_frame_pkg_s *v_pkg,
unsigned int ox_id);
void hifc_save_login_para_in_sq_info(
struct hifc_hba_s *v_hba,
struct unf_port_login_parms_s *v_login_coparms);
unsigned int hifc_handle_aeq_offload_err(struct hifc_hba_s *v_hba,
struct hifcoe_aqe_data_s *v_aeg_msg);
#define HIFC_CHECK_PKG_ALLOCTIME(v_pkg) \
do { \
if (unlikely(UNF_GETXCHGALLOCTIME(v_pkg) == 0)) { \
HIFC_TRACE(UNF_EVTLOG_DRIVER_WARN, UNF_LOG_NORMAL, \
UNF_WARN, \
"[warn]Invalid MagicNum,S_ID(0x%x) D_ID(0x%x) OXID(0x%x) RX_ID(0x%x) pkg type(0x%x) hot pooltag(0x%x)", \
UNF_GET_SID(v_pkg), \
UNF_GET_DID(v_pkg), \
UNF_GET_OXID(v_pkg), \
UNF_GET_RXID(v_pkg), \
((struct unf_frame_pkg_s *)v_pkg)->type, \
UNF_GET_XCHG_TAG(v_pkg)); \
} \
} while (0)
#endif
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0 */
/* Huawei Hifc PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
*/
#ifndef __UNF_DISC_H__
#define __UNF_DISC_H__
#define UNF_DISC_RETRY_TIMES 3
#define UNF_DISC_NONE 0
#define UNF_DISC_FABRIC 1
#define UNF_DISC_LOOP 2
enum unf_disc_state_e {
UNF_DISC_ST_START = 0x3000,
UNF_DISC_ST_GIDPT_WAIT,
UNF_DISC_ST_GIDFT_WAIT,
UNF_DISC_ST_END
};
enum unf_disc_event_e {
UNF_EVENT_DISC_NORMAL_ENTER = 0x8000,
UNF_EVENT_DISC_FAILED = 0x8001,
UNF_EVENT_DISC_SUCCESS = 0x8002,
UNF_EVENT_DISC_RETRY_TIMEOUT = 0x8003,
UNF_EVENT_DISC_LINKDOWN = 0x8004
};
enum unf_disc_type_e {
UNF_DISC_GET_PORT_NAME = 0,
UNF_DISC_GET_NODE_NAME,
UNF_DISC_GET_FEATURE
};
struct unf_disc_gs_event_info {
void *lport;
void *rport;
unsigned int rport_id;
enum unf_disc_type_e entype;
struct list_head list_entry;
};
unsigned int unf_get_and_post_disc_event(void *v_lport,
void *v_sns_port,
unsigned int v_nport_id,
enum unf_disc_type_e v_en_type);
void unf_flush_disc_event(void *v_disc, void *v_vport);
void unf_disc_error_recovery(void *v_lport);
void unf_disc_mgr_destroy(void *v_lport);
void unf_disc_ctrl_size_inc(void *v_lport, unsigned int v_cmnd);
#endif
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0 */
/* Huawei Hifc PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
*/
#ifndef __UNF_EVENT_H__
#define __UNF_EVENT_H__
#include "hifc_knl_adp.h"
enum unf_poll_flag {
UNF_POLL_CHIPERROR_FLAG = 0, /* CHIP ERROR POLL */
UNF_POLL_ERROR_CODE, /* CODE ERROR POLL */
UNF_POLL_SFP_FLAG, /* SFP POLL */
UNF_POLL_BUTT
};
#define UNF_MAX_EVENT_NODE 256
enum unf_event_type {
UNF_EVENT_TYPE_ALARM = 0, /* Alarm */
UNF_EVENT_TYPE_REQUIRE, /* Require */
UNF_EVENT_TYPE_RECOVERY, /* Recovery */
UNF_EVENT_TYPE_BUTT
};
struct unf_cm_event_report {
/* event type */
unsigned int event;
/* ASY flag */
unsigned int event_asy_flag;
/* Delay times,must be async event */
unsigned int delay_times;
struct list_head list_entry;
void *lport;
/* parameter */
void *para_in;
void *para_out;
unsigned int result;
/* recovery strategy */
int (*pfn_unf_event_task)(void *v_argin, void *v_argout);
/* recovery strategy */
int (*pfn_unf_event_recovery_strategy)(void *);
/* alarm strategy */
int (*pfn_unf_event_alarm_strategy)(void *);
struct completion event_comp;
};
struct unf_event_mgr {
spinlock_t port_event_lock;
unsigned int free_event_count;
struct list_head list_free_event;
struct completion *emg_completion;
void *pmem_add;
struct unf_cm_event_report *(*pfn_unf_get_free_event)(void *v_lport);
void (*pfn_unf_release_event)(void *v_lport, void *v_event_node);
void (*pfn_unf_post_event)(void *v_lport, void *v_event_node);
};
struct unf_global_event_queue {
void *global_event_add;
unsigned int list_number;
struct list_head global_eventlist;
spinlock_t global_eventlist_lock;
};
struct unf_event_list {
struct list_head list_head;
spinlock_t fc_eventlist_lock;
unsigned int list_num; /* list node number */
};
void unf_handle_event(struct unf_cm_event_report *v_event_node);
unsigned int unf_init_global_event_msg(void);
void unf_destroy_global_event_msg(void);
unsigned int unf_schedule_global_event(
void *v_para,
unsigned int v_event_asy_flag,
int (*pfn_unf_event_task)(void *v_argin, void *v_argout));
struct unf_cm_event_report *unf_get_one_event_node(void *v_lport);
void unf_post_one_event_node(void *v_lport,
struct unf_cm_event_report *v_event);
unsigned int unf_event_center_destroy(void *v_lport);
unsigned int unf_init_event_center(void *v_lport);
extern struct task_struct *event_thread;
extern struct unf_global_event_queue global_event_queue;
extern struct unf_event_list fc_event_list;
#endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册