/*1* Copyright(c) 2007 Intel Corporation. All rights reserved.2*3* This program is free software; you can redistribute it and/or modify it4* under the terms and conditions of the GNU General Public License,5* version 2, as published by the Free Software Foundation.6*7* This program is distributed in the hope it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for10* more details.11*12* You should have received a copy of the GNU General Public License along with13* this program; if not, write to the Free Software Foundation, Inc.,14* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.15*16* Maintained at www.Open-FCoE.org17*/1819#ifndef _FC_ELS_H_20#define _FC_ELS_H_2122#include <linux/types.h>2324/*25* Fibre Channel Switch - Enhanced Link Services definitions.26* From T11 FC-LS Rev 1.2 June 7, 2005.27*/2829/*30* ELS Command codes - byte 0 of the frame payload31*/32enum fc_els_cmd {33ELS_LS_RJT = 0x01, /* ESL reject */34ELS_LS_ACC = 0x02, /* ESL Accept */35ELS_PLOGI = 0x03, /* N_Port login */36ELS_FLOGI = 0x04, /* F_Port login */37ELS_LOGO = 0x05, /* Logout */38ELS_ABTX = 0x06, /* Abort exchange - obsolete */39ELS_RCS = 0x07, /* read connection status */40ELS_RES = 0x08, /* read exchange status block */41ELS_RSS = 0x09, /* read sequence status block */42ELS_RSI = 0x0a, /* read sequence initiative */43ELS_ESTS = 0x0b, /* establish streaming */44ELS_ESTC = 0x0c, /* estimate credit */45ELS_ADVC = 0x0d, /* advise credit */46ELS_RTV = 0x0e, /* read timeout value */47ELS_RLS = 0x0f, /* read link error status block */48ELS_ECHO = 0x10, /* echo */49ELS_TEST = 0x11, /* test */50ELS_RRQ = 0x12, /* reinstate recovery qualifier */51ELS_REC = 0x13, /* read exchange concise */52ELS_SRR = 0x14, /* sequence retransmission request */53ELS_PRLI = 0x20, /* process login */54ELS_PRLO = 0x21, /* process logout */55ELS_SCN = 0x22, /* state change notification */56ELS_TPLS = 0x23, /* test process login state */57ELS_TPRLO = 0x24, /* third party process logout */58ELS_LCLM = 0x25, /* login control list mgmt (obs) */59ELS_GAID = 0x30, /* get alias_ID */60ELS_FACT = 0x31, /* fabric activate alias_id */61ELS_FDACDT = 0x32, /* fabric deactivate alias_id */62ELS_NACT = 0x33, /* N-port activate alias_id */63ELS_NDACT = 0x34, /* N-port deactivate alias_id */64ELS_QOSR = 0x40, /* quality of service request */65ELS_RVCS = 0x41, /* read virtual circuit status */66ELS_PDISC = 0x50, /* discover N_port service params */67ELS_FDISC = 0x51, /* discover F_port service params */68ELS_ADISC = 0x52, /* discover address */69ELS_RNC = 0x53, /* report node cap (obs) */70ELS_FARP_REQ = 0x54, /* FC ARP request */71ELS_FARP_REPL = 0x55, /* FC ARP reply */72ELS_RPS = 0x56, /* read port status block */73ELS_RPL = 0x57, /* read port list */74ELS_RPBC = 0x58, /* read port buffer condition */75ELS_FAN = 0x60, /* fabric address notification */76ELS_RSCN = 0x61, /* registered state change notification */77ELS_SCR = 0x62, /* state change registration */78ELS_RNFT = 0x63, /* report node FC-4 types */79ELS_CSR = 0x68, /* clock synch. request */80ELS_CSU = 0x69, /* clock synch. update */81ELS_LINIT = 0x70, /* loop initialize */82ELS_LSTS = 0x72, /* loop status */83ELS_RNID = 0x78, /* request node ID data */84ELS_RLIR = 0x79, /* registered link incident report */85ELS_LIRR = 0x7a, /* link incident record registration */86ELS_SRL = 0x7b, /* scan remote loop */87ELS_SBRP = 0x7c, /* set bit-error reporting params */88ELS_RPSC = 0x7d, /* report speed capabilities */89ELS_QSA = 0x7e, /* query security attributes */90ELS_EVFP = 0x7f, /* exchange virt. fabrics params */91ELS_LKA = 0x80, /* link keep-alive */92ELS_AUTH_ELS = 0x90, /* authentication ELS */93};9495/*96* Initializer useful for decoding table.97* Please keep this in sync with the above definitions.98*/99#define FC_ELS_CMDS_INIT { \100[ELS_LS_RJT] = "LS_RJT", \101[ELS_LS_ACC] = "LS_ACC", \102[ELS_PLOGI] = "PLOGI", \103[ELS_FLOGI] = "FLOGI", \104[ELS_LOGO] = "LOGO", \105[ELS_ABTX] = "ABTX", \106[ELS_RCS] = "RCS", \107[ELS_RES] = "RES", \108[ELS_RSS] = "RSS", \109[ELS_RSI] = "RSI", \110[ELS_ESTS] = "ESTS", \111[ELS_ESTC] = "ESTC", \112[ELS_ADVC] = "ADVC", \113[ELS_RTV] = "RTV", \114[ELS_RLS] = "RLS", \115[ELS_ECHO] = "ECHO", \116[ELS_TEST] = "TEST", \117[ELS_RRQ] = "RRQ", \118[ELS_REC] = "REC", \119[ELS_SRR] = "SRR", \120[ELS_PRLI] = "PRLI", \121[ELS_PRLO] = "PRLO", \122[ELS_SCN] = "SCN", \123[ELS_TPLS] = "TPLS", \124[ELS_TPRLO] = "TPRLO", \125[ELS_LCLM] = "LCLM", \126[ELS_GAID] = "GAID", \127[ELS_FACT] = "FACT", \128[ELS_FDACDT] = "FDACDT", \129[ELS_NACT] = "NACT", \130[ELS_NDACT] = "NDACT", \131[ELS_QOSR] = "QOSR", \132[ELS_RVCS] = "RVCS", \133[ELS_PDISC] = "PDISC", \134[ELS_FDISC] = "FDISC", \135[ELS_ADISC] = "ADISC", \136[ELS_RNC] = "RNC", \137[ELS_FARP_REQ] = "FARP_REQ", \138[ELS_FARP_REPL] = "FARP_REPL", \139[ELS_RPS] = "RPS", \140[ELS_RPL] = "RPL", \141[ELS_RPBC] = "RPBC", \142[ELS_FAN] = "FAN", \143[ELS_RSCN] = "RSCN", \144[ELS_SCR] = "SCR", \145[ELS_RNFT] = "RNFT", \146[ELS_CSR] = "CSR", \147[ELS_CSU] = "CSU", \148[ELS_LINIT] = "LINIT", \149[ELS_LSTS] = "LSTS", \150[ELS_RNID] = "RNID", \151[ELS_RLIR] = "RLIR", \152[ELS_LIRR] = "LIRR", \153[ELS_SRL] = "SRL", \154[ELS_SBRP] = "SBRP", \155[ELS_RPSC] = "RPSC", \156[ELS_QSA] = "QSA", \157[ELS_EVFP] = "EVFP", \158[ELS_LKA] = "LKA", \159[ELS_AUTH_ELS] = "AUTH_ELS", \160}161162/*163* LS_ACC payload.164*/165struct fc_els_ls_acc {166__u8 la_cmd; /* command code ELS_LS_ACC */167__u8 la_resv[3]; /* reserved */168};169170/*171* ELS reject payload.172*/173struct fc_els_ls_rjt {174__u8 er_cmd; /* command code ELS_LS_RJT */175__u8 er_resv[4]; /* reserved must be zero */176__u8 er_reason; /* reason (enum fc_els_rjt_reason below) */177__u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */178__u8 er_vendor; /* vendor specific code */179};180181/*182* ELS reject reason codes (er_reason).183*/184enum fc_els_rjt_reason {185ELS_RJT_NONE = 0, /* no reject - not to be sent */186ELS_RJT_INVAL = 0x01, /* invalid ELS command code */187ELS_RJT_LOGIC = 0x03, /* logical error */188ELS_RJT_BUSY = 0x05, /* logical busy */189ELS_RJT_PROT = 0x07, /* protocol error */190ELS_RJT_UNAB = 0x09, /* unable to perform command request */191ELS_RJT_UNSUP = 0x0b, /* command not supported */192ELS_RJT_INPROG = 0x0e, /* command already in progress */193ELS_RJT_FIP = 0x20, /* FIP error */194ELS_RJT_VENDOR = 0xff, /* vendor specific error */195};196197198/*199* reason code explanation (er_explan).200*/201enum fc_els_rjt_explan {202ELS_EXPL_NONE = 0x00, /* No additional explanation */203ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */204ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */205ELS_EXPL_AH = 0x11, /* invalid association header */206ELS_EXPL_AH_REQ = 0x13, /* association_header required */207ELS_EXPL_SID = 0x15, /* invalid originator S_ID */208ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */209ELS_EXPL_INPROG = 0x19, /* Request already in progress */210ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */211ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */212ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */213ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */214ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */215ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */216/* TBD - above definitions incomplete */217};218219/*220* Common service parameters (N ports).221*/222struct fc_els_csp {223__u8 sp_hi_ver; /* highest version supported (obs.) */224__u8 sp_lo_ver; /* highest version supported (obs.) */225__be16 sp_bb_cred; /* buffer-to-buffer credits */226__be16 sp_features; /* common feature flags */227__be16 sp_bb_data; /* b-b state number and data field sz */228union {229struct {230__be16 _sp_tot_seq; /* total concurrent sequences */231__be16 _sp_rel_off; /* rel. offset by info cat */232} sp_plogi;233struct {234__be32 _sp_r_a_tov; /* resource alloc. timeout msec */235} sp_flogi_acc;236} sp_u;237__be32 sp_e_d_tov; /* error detect timeout value */238};239#define sp_tot_seq sp_u.sp_plogi._sp_tot_seq240#define sp_rel_off sp_u.sp_plogi._sp_rel_off241#define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov242243#define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */244245/*246* Minimum and maximum values for max data field size in service parameters.247*/248#define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD249#define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD250251/*252* sp_features253*/254#define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */255#define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */256#define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */257#define FC_SP_FT_RAND 0x4000 /* random relative offset */258#define FC_SP_FT_VAL 0x2000 /* valid vendor version level */259#define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */260#define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */261#define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */262#define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */263#define FC_SP_FT_MCAST 0x0200 /* multicast */264#define FC_SP_FT_BCAST 0x0100 /* broadcast */265#define FC_SP_FT_HUNT 0x0080 /* hunt group */266#define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */267#define FC_SP_FT_SEC 0x0020 /* reserved for security */268#define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */269#define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */270#define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */271#define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */272#define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */273274/*275* Class-specific service parameters.276*/277struct fc_els_cssp {278__be16 cp_class; /* class flags */279__be16 cp_init; /* initiator flags */280__be16 cp_recip; /* recipient flags */281__be16 cp_rdfs; /* receive data field size */282__be16 cp_con_seq; /* concurrent sequences */283__be16 cp_ee_cred; /* N-port end-to-end credit */284__u8 cp_resv1; /* reserved */285__u8 cp_open_seq; /* open sequences per exchange */286__u8 _cp_resv2[2]; /* reserved */287};288289/*290* cp_class flags.291*/292#define FC_CPC_VALID 0x8000 /* class valid */293#define FC_CPC_IMIX 0x4000 /* intermix mode */294#define FC_CPC_SEQ 0x0800 /* sequential delivery */295#define FC_CPC_CAMP 0x0200 /* camp-on */296#define FC_CPC_PRI 0x0080 /* priority */297298/*299* cp_init flags.300* (TBD: not all flags defined here).301*/302#define FC_CPI_CSYN 0x0010 /* clock synch. capable */303304/*305* cp_recip flags.306*/307#define FC_CPR_CSYN 0x0008 /* clock synch. capable */308309/*310* NFC_ELS_FLOGI: Fabric login request.311* NFC_ELS_PLOGI: Port login request (same format).312*/313struct fc_els_flogi {314__u8 fl_cmd; /* command */315__u8 _fl_resvd[3]; /* must be zero */316struct fc_els_csp fl_csp; /* common service parameters */317__be64 fl_wwpn; /* port name */318__be64 fl_wwnn; /* node name */319struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */320__u8 fl_vend[16]; /* vendor version level */321} __attribute__((__packed__));322323/*324* Process login service parameter page.325*/326struct fc_els_spp {327__u8 spp_type; /* type code or common service params */328__u8 spp_type_ext; /* type code extension */329__u8 spp_flags;330__u8 _spp_resvd;331__be32 spp_orig_pa; /* originator process associator */332__be32 spp_resp_pa; /* responder process associator */333__be32 spp_params; /* service parameters */334};335336/*337* spp_flags.338*/339#define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */340#define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */341#define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */342#define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */343344/*345* SPP response code in spp_flags - lower 4 bits.346*/347enum fc_els_spp_resp {348FC_SPP_RESP_ACK = 1, /* request executed */349FC_SPP_RESP_RES = 2, /* unable due to lack of resources */350FC_SPP_RESP_INIT = 3, /* initialization not complete */351FC_SPP_RESP_NO_PA = 4, /* unknown process associator */352FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */353FC_SPP_RESP_COND = 6, /* request completed conditionally */354FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */355FC_SPP_RESP_INVL = 8, /* SPP is invalid */356};357358/*359* ELS_RRQ - Reinstate Recovery Qualifier360*/361struct fc_els_rrq {362__u8 rrq_cmd; /* command (0x12) */363__u8 rrq_zero[3]; /* specified as zero - part of cmd */364__u8 rrq_resvd; /* reserved */365__u8 rrq_s_id[3]; /* originator FID */366__be16 rrq_ox_id; /* originator exchange ID */367__be16 rrq_rx_id; /* responders exchange ID */368};369370/*371* ELS_REC - Read exchange concise.372*/373struct fc_els_rec {374__u8 rec_cmd; /* command (0x13) */375__u8 rec_zero[3]; /* specified as zero - part of cmd */376__u8 rec_resvd; /* reserved */377__u8 rec_s_id[3]; /* originator FID */378__be16 rec_ox_id; /* originator exchange ID */379__be16 rec_rx_id; /* responders exchange ID */380};381382/*383* ELS_REC LS_ACC payload.384*/385struct fc_els_rec_acc {386__u8 reca_cmd; /* accept (0x02) */387__u8 reca_zero[3]; /* specified as zero - part of cmd */388__be16 reca_ox_id; /* originator exchange ID */389__be16 reca_rx_id; /* responders exchange ID */390__u8 reca_resvd1; /* reserved */391__u8 reca_ofid[3]; /* originator FID */392__u8 reca_resvd2; /* reserved */393__u8 reca_rfid[3]; /* responder FID */394__be32 reca_fc4value; /* FC4 value */395__be32 reca_e_stat; /* ESB (exchange status block) status */396};397398/*399* ELS_PRLI - Process login request and response.400*/401struct fc_els_prli {402__u8 prli_cmd; /* command */403__u8 prli_spp_len; /* length of each serv. parm. page */404__be16 prli_len; /* length of entire payload */405/* service parameter pages follow */406};407408/*409* ELS_PRLO - Process logout request and response.410*/411struct fc_els_prlo {412__u8 prlo_cmd; /* command */413__u8 prlo_obs; /* obsolete, but shall be set to 10h */414__be16 prlo_len; /* payload length */415};416417/*418* ELS_ADISC payload419*/420struct fc_els_adisc {421__u8 adisc_cmd;422__u8 adisc_resv[3];423__u8 adisc_resv1;424__u8 adisc_hard_addr[3];425__be64 adisc_wwpn;426__be64 adisc_wwnn;427__u8 adisc_resv2;428__u8 adisc_port_id[3];429} __attribute__((__packed__));430431/*432* ELS_LOGO - process or fabric logout.433*/434struct fc_els_logo {435__u8 fl_cmd; /* command code */436__u8 fl_zero[3]; /* specified as zero - part of cmd */437__u8 fl_resvd; /* reserved */438__u8 fl_n_port_id[3];/* N port ID */439__be64 fl_n_port_wwn; /* port name */440};441442/*443* ELS_RTV - read timeout value.444*/445struct fc_els_rtv {446__u8 rtv_cmd; /* command code 0x0e */447__u8 rtv_zero[3]; /* specified as zero - part of cmd */448};449450/*451* LS_ACC for ELS_RTV - read timeout value.452*/453struct fc_els_rtv_acc {454__u8 rtv_cmd; /* command code 0x02 */455__u8 rtv_zero[3]; /* specified as zero - part of cmd */456__be32 rtv_r_a_tov; /* resource allocation timeout value */457__be32 rtv_e_d_tov; /* error detection timeout value */458__be32 rtv_toq; /* timeout qualifier (see below) */459};460461/*462* rtv_toq bits.463*/464#define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */465#define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */466467/*468* ELS_SCR - state change registration payload.469*/470struct fc_els_scr {471__u8 scr_cmd; /* command code */472__u8 scr_resv[6]; /* reserved */473__u8 scr_reg_func; /* registration function (see below) */474};475476enum fc_els_scr_func {477ELS_SCRF_FAB = 1, /* fabric-detected registration */478ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */479ELS_SCRF_FULL = 3, /* full registration */480ELS_SCRF_CLEAR = 255, /* remove any current registrations */481};482483/*484* ELS_RSCN - registered state change notification payload.485*/486struct fc_els_rscn {487__u8 rscn_cmd; /* RSCN opcode (0x61) */488__u8 rscn_page_len; /* page length (4) */489__be16 rscn_plen; /* payload length including this word */490491/* followed by 4-byte generic affected Port_ID pages */492};493494struct fc_els_rscn_page {495__u8 rscn_page_flags; /* event and address format */496__u8 rscn_fid[3]; /* fabric ID */497};498499#define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */500#define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */501#define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */502#define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */503504enum fc_els_rscn_ev_qual {505ELS_EV_QUAL_NONE = 0, /* unspecified */506ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */507ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */508ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */509ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */510ELS_EV_QUAL_REM_OBJ = 5, /* removed object */511};512513enum fc_els_rscn_addr_fmt {514ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */515ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */516ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */517ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */518};519520/*521* ELS_RNID - request Node ID.522*/523struct fc_els_rnid {524__u8 rnid_cmd; /* RNID opcode (0x78) */525__u8 rnid_resv[3]; /* reserved */526__u8 rnid_fmt; /* data format */527__u8 rnid_resv2[3]; /* reserved */528};529530/*531* Node Identification Data formats (rnid_fmt)532*/533enum fc_els_rnid_fmt {534ELS_RNIDF_NONE = 0, /* no specific identification data */535ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */536};537538/*539* ELS_RNID response.540*/541struct fc_els_rnid_resp {542__u8 rnid_cmd; /* response code (LS_ACC) */543__u8 rnid_resv[3]; /* reserved */544__u8 rnid_fmt; /* data format */545__u8 rnid_cid_len; /* common ID data length */546__u8 rnid_resv2; /* reserved */547__u8 rnid_sid_len; /* specific ID data length */548};549550struct fc_els_rnid_cid {551__be64 rnid_wwpn; /* N port name */552__be64 rnid_wwnn; /* node name */553};554555struct fc_els_rnid_gen {556__u8 rnid_vend_id[16]; /* vendor-unique ID */557__be32 rnid_atype; /* associated type (see below) */558__be32 rnid_phys_port; /* physical port number */559__be32 rnid_att_nodes; /* number of attached nodes */560__u8 rnid_node_mgmt; /* node management (see below) */561__u8 rnid_ip_ver; /* IP version (see below) */562__be16 rnid_prot_port; /* UDP / TCP port number */563__be32 rnid_ip_addr[4]; /* IP address */564__u8 rnid_resvd[2]; /* reserved */565__be16 rnid_vend_spec; /* vendor-specific field */566};567568enum fc_els_rnid_atype {569ELS_RNIDA_UNK = 0x01, /* unknown */570ELS_RNIDA_OTHER = 0x02, /* none of the following */571ELS_RNIDA_HUB = 0x03,572ELS_RNIDA_SWITCH = 0x04,573ELS_RNIDA_GATEWAY = 0x05,574ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */575ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */576ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */577ELS_RNIDA_STORAGE = 0x09,578ELS_RNIDA_HOST = 0x0a,579ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */580ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */581ELS_RNIDA_NAS = 0x11, /* NAS server */582ELS_RNIDA_BRIDGE = 0x12, /* bridge */583ELS_RNIDA_VIRT = 0x13, /* virtualization device */584ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */585ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */586ELS_RNIDA_MF_SW = 1UL << 30, /* switch */587ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */588ELS_RNIDA_MF_ST = 1UL << 28, /* storage */589ELS_RNIDA_MF_HOST = 1UL << 27, /* host */590ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */591ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */592ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */593ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */594ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */595ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */596};597598enum fc_els_rnid_mgmt {599ELS_RNIDM_SNMP = 0,600ELS_RNIDM_TELNET = 1,601ELS_RNIDM_HTTP = 2,602ELS_RNIDM_HTTPS = 3,603ELS_RNIDM_XML = 4, /* HTTP + XML */604};605606enum fc_els_rnid_ipver {607ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */608ELS_RNIDIP_V4 = 1, /* IPv4 */609ELS_RNIDIP_V6 = 2, /* IPv6 */610};611612/*613* ELS RPL - Read Port List.614*/615struct fc_els_rpl {616__u8 rpl_cmd; /* command */617__u8 rpl_resv[5]; /* reserved - must be zero */618__be16 rpl_max_size; /* maximum response size or zero */619__u8 rpl_resv1; /* reserved - must be zero */620__u8 rpl_index[3]; /* starting index */621};622623/*624* Port number block in RPL response.625*/626struct fc_els_pnb {627__be32 pnb_phys_pn; /* physical port number */628__u8 pnb_resv; /* reserved */629__u8 pnb_port_id[3]; /* port ID */630__be64 pnb_wwpn; /* port name */631};632633/*634* RPL LS_ACC response.635*/636struct fc_els_rpl_resp {637__u8 rpl_cmd; /* ELS_LS_ACC */638__u8 rpl_resv1; /* reserved - must be zero */639__be16 rpl_plen; /* payload length */640__u8 rpl_resv2; /* reserved - must be zero */641__u8 rpl_llen[3]; /* list length */642__u8 rpl_resv3; /* reserved - must be zero */643__u8 rpl_index[3]; /* starting index */644struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */645};646647/*648* Link Error Status Block.649*/650struct fc_els_lesb {651__be32 lesb_link_fail; /* link failure count */652__be32 lesb_sync_loss; /* loss of synchronization count */653__be32 lesb_sig_loss; /* loss of signal count */654__be32 lesb_prim_err; /* primitive sequence error count */655__be32 lesb_inv_word; /* invalid transmission word count */656__be32 lesb_inv_crc; /* invalid CRC count */657};658659/*660* ELS RPS - Read Port Status Block request.661*/662struct fc_els_rps {663__u8 rps_cmd; /* command */664__u8 rps_resv[2]; /* reserved - must be zero */665__u8 rps_flag; /* flag - see below */666__be64 rps_port_spec; /* port selection */667};668669enum fc_els_rps_flag {670FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */671FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */672FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */673};674675/*676* ELS RPS LS_ACC response.677*/678struct fc_els_rps_resp {679__u8 rps_cmd; /* command - LS_ACC */680__u8 rps_resv[2]; /* reserved - must be zero */681__u8 rps_flag; /* flag - see below */682__u8 rps_resv2[2]; /* reserved */683__be16 rps_status; /* port status - see below */684struct fc_els_lesb rps_lesb; /* link error status block */685};686687enum fc_els_rps_resp_flag {688FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */689};690691enum fc_els_rps_resp_status {692FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */693FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */694FC_ELS_RPS_FAB = 1 << 3, /* fabric present */695FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */696FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */697FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */698};699700/*701* ELS LIRR - Link Incident Record Registration request.702*/703struct fc_els_lirr {704__u8 lirr_cmd; /* command */705__u8 lirr_resv[3]; /* reserved - must be zero */706__u8 lirr_func; /* registration function */707__u8 lirr_fmt; /* FC-4 type of RLIR requested */708__u8 lirr_resv2[2]; /* reserved - must be zero */709};710711enum fc_els_lirr_func {712ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */713ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */714ELS_LIRR_CLEAR = 0xff /* clear registration */715};716717/*718* ELS SRL - Scan Remote Loop request.719*/720struct fc_els_srl {721__u8 srl_cmd; /* command */722__u8 srl_resv[3]; /* reserved - must be zero */723__u8 srl_flag; /* flag - see below */724__u8 srl_flag_param[3]; /* flag parameter */725};726727enum fc_els_srl_flag {728FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */729FC_ELS_SRL_ONE = 0x01, /* scan specified loop */730FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */731FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */732};733734/*735* ELS RLS - Read Link Error Status Block request.736*/737struct fc_els_rls {738__u8 rls_cmd; /* command */739__u8 rls_resv[4]; /* reserved - must be zero */740__u8 rls_port_id[3]; /* port ID */741};742743/*744* ELS RLS LS_ACC Response.745*/746struct fc_els_rls_resp {747__u8 rls_cmd; /* ELS_LS_ACC */748__u8 rls_resv[3]; /* reserved - must be zero */749struct fc_els_lesb rls_lesb; /* link error status block */750};751752/*753* ELS RLIR - Registered Link Incident Report.754* This is followed by the CLIR and the CLID, described below.755*/756struct fc_els_rlir {757__u8 rlir_cmd; /* command */758__u8 rlir_resv[3]; /* reserved - must be zero */759__u8 rlir_fmt; /* format (FC4-type if type specific) */760__u8 rlir_clr_len; /* common link incident record length */761__u8 rlir_cld_len; /* common link incident desc. length */762__u8 rlir_slr_len; /* spec. link incident record length */763};764765/*766* CLIR - Common Link Incident Record Data. - Sent via RLIR.767*/768struct fc_els_clir {769__be64 clir_wwpn; /* incident port name */770__be64 clir_wwnn; /* incident port node name */771__u8 clir_port_type; /* incident port type */772__u8 clir_port_id[3]; /* incident port ID */773774__be64 clir_conn_wwpn; /* connected port name */775__be64 clir_conn_wwnn; /* connected node name */776__be64 clir_fab_name; /* fabric name */777__be32 clir_phys_port; /* physical port number */778__be32 clir_trans_id; /* transaction ID */779__u8 clir_resv[3]; /* reserved */780__u8 clir_ts_fmt; /* time stamp format */781__be64 clir_timestamp; /* time stamp */782};783784/*785* CLIR clir_ts_fmt - time stamp format values.786*/787enum fc_els_clir_ts_fmt {788ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */789ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */790ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */791};792793/*794* Common Link Incident Descriptor - sent via RLIR.795*/796struct fc_els_clid {797__u8 clid_iq; /* incident qualifier flags */798__u8 clid_ic; /* incident code */799__be16 clid_epai; /* domain/area of ISL */800};801802/*803* CLID incident qualifier flags.804*/805enum fc_els_clid_iq {806ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */807ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */808ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */809ELS_CLID_SEV_INFO = 0x00, /* report is informational */810ELS_CLID_SEV_INOP = 0x08, /* link not operational */811ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */812ELS_CLID_LASER = 0x02, /* subassembly is a laser */813ELS_CLID_FRU = 0x01, /* format can identify a FRU */814};815816/*817* CLID incident code.818*/819enum fc_els_clid_ic {820ELS_CLID_IC_IMPL = 1, /* implicit incident */821ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */822ELS_CLID_IC_LOS = 3, /* loss of synch or signal */823ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */824ELS_CLID_IC_PST = 5, /* primitive sequence timeout */825ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */826ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */827ELS_CLID_IC_LIP = 8, /* receiving LIP */828};829830#endif /* _FC_ELS_H_ */831832833