From 2c3dfe3f6ad8daff5acdb01713e4f2b116e78136 Mon Sep 17 00:00:00 2001 From: Seokmann Ju Date: Thu, 5 Jul 2007 13:16:51 -0700 Subject: [SCSI] qla2xxx: add support for NPIV Following patch adds support for NPIV (N-Port ID Virtualization) to the qla2xxx. - supported within switched-fabric topologies only. - supports up to 63 virtual ports on each physical port. Signed-off-by: Seokmann Ju Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_def.h | 83 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 'drivers/scsi/qla2xxx/qla_def.h') diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index e8948b679f5..a1ca590ba44 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -1551,6 +1551,9 @@ typedef struct fc_port { unsigned long last_queue_full; unsigned long last_ramp_up; + + struct list_head vp_fcport; + uint16_t vp_idx; } fc_port_t; /* @@ -1999,6 +2002,36 @@ struct gid_list_info { }; #define GID_LIST_SIZE (sizeof(struct gid_list_info) * MAX_FIBRE_DEVICES) +/* NPIV */ +typedef struct vport_info { + uint8_t port_name[WWN_SIZE]; + uint8_t node_name[WWN_SIZE]; + int vp_id; + uint16_t loop_id; + unsigned long host_no; + uint8_t port_id[3]; + int loop_state; +} vport_info_t; + +typedef struct vport_params { + uint8_t port_name[WWN_SIZE]; + uint8_t node_name[WWN_SIZE]; + uint32_t options; +#define VP_OPTS_RETRY_ENABLE BIT_0 +#define VP_OPTS_VP_DISABLE BIT_1 +} vport_params_t; + +/* NPIV - return codes of VP create and modify */ +#define VP_RET_CODE_OK 0 +#define VP_RET_CODE_FATAL 1 +#define VP_RET_CODE_WRONG_ID 2 +#define VP_RET_CODE_WWPN 3 +#define VP_RET_CODE_RESOURCES 4 +#define VP_RET_CODE_NO_MEM 5 +#define VP_RET_CODE_NOT_FOUND 6 + +#define to_qla_parent(x) (((x)->parent) ? (x)->parent : (x)) + /* * ISP operations */ @@ -2073,6 +2106,16 @@ struct qla_msix_entry { uint16_t msix_entry; }; +#define WATCH_INTERVAL 1 /* number of seconds */ + +/* NPIV */ +#define MAX_MULTI_ID_LOOP 126 +#define MAX_MULTI_ID_FABRIC 64 +#define MAX_NUM_VPORT_LOOP (MAX_MULTI_ID_LOOP - 1) +#define MAX_NUM_VPORT_FABRIC (MAX_MULTI_ID_FABRIC - 1) +#define MAX_NUM_VHBA_LOOP (MAX_MULTI_ID_LOOP - 1) +#define MAX_NUM_VHBA_FABRIC (MAX_MULTI_ID_FABRIC - 1) + /* * Linux Host Adapter structure */ @@ -2108,6 +2151,8 @@ typedef struct scsi_qla_host { uint32_t msix_enabled :1; uint32_t disable_serdes :1; uint32_t gpsc_supported :1; + uint32_t vsan_enabled :1; + uint32_t npiv_supported :1; } flags; atomic_t loop_state; @@ -2147,6 +2192,7 @@ typedef struct scsi_qla_host { #define BEACON_BLINK_NEEDED 25 #define REGISTER_FDMI_NEEDED 26 #define FCPORT_UPDATE_NEEDED 27 +#define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */ uint32_t device_flags; #define DFLG_LOCAL_DEVICES BIT_0 @@ -2237,6 +2283,11 @@ typedef struct scsi_qla_host { /* ISP configuration data. */ uint16_t loop_id; /* Host adapter loop id */ + uint16_t switch_cap; +#define FLOGI_SEQ_DEL BIT_8 +#define FLOGI_MID_SUPPORT BIT_10 +#define FLOGI_VSAN_SUPPORT BIT_12 +#define FLOGI_SP_SUPPORT BIT_13 uint16_t fb_rev; port_id_t d_id; /* Host adapter port id */ @@ -2344,6 +2395,7 @@ typedef struct scsi_qla_host { #define MBX_UPDATE_FLASH_ACTIVE 3 struct semaphore mbx_cmd_sem; /* Serialialize mbx access */ + struct semaphore vport_sem; /* Virtual port synchronization */ struct semaphore mbx_intr_sem; /* Used for completion notification */ uint32_t mbx_flags; @@ -2428,6 +2480,37 @@ typedef struct scsi_qla_host { struct fc_host_statistics fc_host_stat; struct qla_msix_entry msix_entries[QLA_MSIX_ENTRIES]; + + struct list_head vp_list; /* list of VP */ + struct fc_vport *fc_vport; /* holds fc_vport * for each vport */ + uint8_t vp_idx_map[16]; + uint16_t num_vhosts; /* number of vports created */ + uint16_t num_vsans; /* number of vsan created */ + uint16_t vp_idx; /* vport ID */ + + struct scsi_qla_host *parent; /* holds pport */ + unsigned long vp_flags; + struct list_head vp_fcports; /* list of fcports */ +#define VP_IDX_ACQUIRED 0 /* bit no 0 */ +#define VP_CREATE_NEEDED 1 +#define VP_BIND_NEEDED 2 +#define VP_DELETE_NEEDED 3 +#define VP_SCR_NEEDED 4 /* State Change Request registration */ + atomic_t vp_state; +#define VP_OFFLINE 0 +#define VP_ACTIVE 1 +#define VP_FAILED 2 +// #define VP_DISABLE 3 + uint16_t vp_err_state; + uint16_t vp_prev_err_state; +#define VP_ERR_UNKWN 0 +#define VP_ERR_PORTDWN 1 +#define VP_ERR_FAB_UNSUPPORTED 2 +#define VP_ERR_FAB_NORESOURCES 3 +#define VP_ERR_FAB_LOGOUT 4 +#define VP_ERR_ADAP_NORESOURCES 5 + int max_npiv_vports; /* 63 or 125 per topoloty */ + int cur_vport_count; } scsi_qla_host_t; -- cgit v1.2.3