Jing Huang | 7725ccf | 2009-09-23 17:46:15 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005-2009 Brocade Communications Systems, Inc. |
| 3 | * All rights reserved |
| 4 | * www.brocade.com |
| 5 | * |
| 6 | * Linux driver for Brocade Fibre Channel Host Bus Adapter. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License (GPL) Version 2 as |
| 10 | * published by the Free Software Foundation |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | */ |
| 17 | |
| 18 | #ifndef __BFA_DEFS_RPORT_H__ |
| 19 | #define __BFA_DEFS_RPORT_H__ |
| 20 | |
| 21 | #include <bfa_os_inc.h> |
| 22 | #include <protocol/types.h> |
| 23 | #include <defs/bfa_defs_pport.h> |
| 24 | #include <defs/bfa_defs_port.h> |
| 25 | #include <defs/bfa_defs_qos.h> |
| 26 | |
| 27 | /** |
| 28 | * FCS remote port states |
| 29 | */ |
| 30 | enum bfa_rport_state { |
| 31 | BFA_RPORT_UNINIT = 0, /* PORT is not yet initialized */ |
| 32 | BFA_RPORT_OFFLINE = 1, /* rport is offline */ |
| 33 | BFA_RPORT_PLOGI = 2, /* PLOGI to rport is in progress */ |
| 34 | BFA_RPORT_ONLINE = 3, /* login to rport is complete */ |
| 35 | BFA_RPORT_PLOGI_RETRY = 4, /* retrying login to rport */ |
| 36 | BFA_RPORT_NSQUERY = 5, /* nameserver query */ |
| 37 | BFA_RPORT_ADISC = 6, /* ADISC authentication */ |
| 38 | BFA_RPORT_LOGO = 7, /* logging out with rport */ |
| 39 | BFA_RPORT_LOGORCV = 8, /* handling LOGO from rport */ |
| 40 | BFA_RPORT_NSDISC = 9, /* re-discover rport */ |
| 41 | }; |
| 42 | |
| 43 | /** |
| 44 | * Rport Scsi Function : Initiator/Target. |
| 45 | */ |
| 46 | enum bfa_rport_function { |
| 47 | BFA_RPORT_INITIATOR = 0x01, /* SCSI Initiator */ |
| 48 | BFA_RPORT_TARGET = 0x02, /* SCSI Target */ |
| 49 | }; |
| 50 | |
| 51 | /** |
| 52 | * port/node symbolic names for rport |
| 53 | */ |
| 54 | #define BFA_RPORT_SYMNAME_MAXLEN 255 |
| 55 | struct bfa_rport_symname_s { |
| 56 | char symname[BFA_RPORT_SYMNAME_MAXLEN]; |
| 57 | }; |
| 58 | |
| 59 | struct bfa_rport_hal_stats_s { |
| 60 | u32 sm_un_cr; /* uninit: create events */ |
| 61 | u32 sm_un_unexp; /* uninit: exception events */ |
| 62 | u32 sm_cr_on; /* created: online events */ |
| 63 | u32 sm_cr_del; /* created: delete events */ |
| 64 | u32 sm_cr_hwf; /* created: IOC down */ |
| 65 | u32 sm_cr_unexp; /* created: exception events */ |
| 66 | u32 sm_fwc_rsp; /* fw create: f/w responses */ |
| 67 | u32 sm_fwc_del; /* fw create: delete events */ |
| 68 | u32 sm_fwc_off; /* fw create: offline events */ |
| 69 | u32 sm_fwc_hwf; /* fw create: IOC down */ |
| 70 | u32 sm_fwc_unexp; /* fw create: exception events*/ |
| 71 | u32 sm_on_off; /* online: offline events */ |
| 72 | u32 sm_on_del; /* online: delete events */ |
| 73 | u32 sm_on_hwf; /* online: IOC down events */ |
| 74 | u32 sm_on_unexp; /* online: exception events */ |
| 75 | u32 sm_fwd_rsp; /* fw delete: fw responses */ |
| 76 | u32 sm_fwd_del; /* fw delete: delete events */ |
| 77 | u32 sm_fwd_hwf; /* fw delete: IOC down events */ |
| 78 | u32 sm_fwd_unexp; /* fw delete: exception events*/ |
| 79 | u32 sm_off_del; /* offline: delete events */ |
| 80 | u32 sm_off_on; /* offline: online events */ |
| 81 | u32 sm_off_hwf; /* offline: IOC down events */ |
| 82 | u32 sm_off_unexp; /* offline: exception events */ |
| 83 | u32 sm_del_fwrsp; /* delete: fw responses */ |
| 84 | u32 sm_del_hwf; /* delete: IOC down events */ |
| 85 | u32 sm_del_unexp; /* delete: exception events */ |
| 86 | u32 sm_delp_fwrsp; /* delete pend: fw responses */ |
| 87 | u32 sm_delp_hwf; /* delete pend: IOC downs */ |
| 88 | u32 sm_delp_unexp; /* delete pend: exceptions */ |
| 89 | u32 sm_offp_fwrsp; /* off-pending: fw responses */ |
| 90 | u32 sm_offp_del; /* off-pending: deletes */ |
| 91 | u32 sm_offp_hwf; /* off-pending: IOC downs */ |
| 92 | u32 sm_offp_unexp; /* off-pending: exceptions */ |
| 93 | u32 sm_iocd_off; /* IOC down: offline events */ |
| 94 | u32 sm_iocd_del; /* IOC down: delete events */ |
| 95 | u32 sm_iocd_on; /* IOC down: online events */ |
| 96 | u32 sm_iocd_unexp; /* IOC down: exceptions */ |
| 97 | u32 rsvd; |
| 98 | }; |
| 99 | |
| 100 | /** |
| 101 | * FCS remote port statistics |
| 102 | */ |
| 103 | struct bfa_rport_stats_s { |
| 104 | u32 offlines; /* remote port offline count */ |
| 105 | u32 onlines; /* remote port online count */ |
| 106 | u32 rscns; /* RSCN affecting rport */ |
| 107 | u32 plogis; /* plogis sent */ |
| 108 | u32 plogi_accs; /* plogi accepts */ |
| 109 | u32 plogi_timeouts; /* plogi timeouts */ |
| 110 | u32 plogi_rejects; /* rcvd plogi rejects */ |
| 111 | u32 plogi_failed; /* local failure */ |
| 112 | u32 plogi_rcvd; /* plogis rcvd */ |
| 113 | u32 prli_rcvd; /* inbound PRLIs */ |
| 114 | u32 adisc_rcvd; /* ADISCs received */ |
| 115 | u32 adisc_rejects; /* recvd ADISC rejects */ |
| 116 | u32 adisc_sent; /* ADISC requests sent */ |
| 117 | u32 adisc_accs; /* ADISC accepted by rport */ |
| 118 | u32 adisc_failed; /* ADISC failed (no response) */ |
| 119 | u32 adisc_rejected; /* ADISC rejected by us */ |
| 120 | u32 logos; /* logos sent */ |
| 121 | u32 logo_accs; /* LOGO accepts from rport */ |
| 122 | u32 logo_failed; /* LOGO failures */ |
| 123 | u32 logo_rejected; /* LOGO rejects from rport */ |
| 124 | u32 logo_rcvd; /* LOGO from remote port */ |
| 125 | |
| 126 | u32 rpsc_rcvd; /* RPSC received */ |
| 127 | u32 rpsc_rejects; /* recvd RPSC rejects */ |
| 128 | u32 rpsc_sent; /* RPSC requests sent */ |
| 129 | u32 rpsc_accs; /* RPSC accepted by rport */ |
| 130 | u32 rpsc_failed; /* RPSC failed (no response) */ |
| 131 | u32 rpsc_rejected; /* RPSC rejected by us */ |
| 132 | |
| 133 | u32 rsvd; |
| 134 | struct bfa_rport_hal_stats_s hal_stats; /* BFA rport stats */ |
| 135 | }; |
| 136 | |
| 137 | /** |
| 138 | * Rport's QoS attributes |
| 139 | */ |
| 140 | struct bfa_rport_qos_attr_s { |
| 141 | enum bfa_qos_priority qos_priority; /* rport's QoS priority */ |
| 142 | u32 qos_flow_id; /* QoS flow Id */ |
| 143 | }; |
| 144 | |
| 145 | /** |
| 146 | * FCS remote port attributes returned in queries |
| 147 | */ |
| 148 | struct bfa_rport_attr_s { |
| 149 | wwn_t nwwn; /* node wwn */ |
| 150 | wwn_t pwwn; /* port wwn */ |
| 151 | enum fc_cos cos_supported; /* supported class of services */ |
| 152 | u32 pid; /* port ID */ |
| 153 | u32 df_sz; /* Max payload size */ |
| 154 | enum bfa_rport_state state; /* Rport State machine state */ |
| 155 | enum fc_cos fc_cos; /* FC classes of services */ |
| 156 | bfa_boolean_t cisc; /* CISC capable device */ |
| 157 | struct bfa_rport_symname_s symname; /* Symbolic Name */ |
| 158 | enum bfa_rport_function scsi_function; /* Initiator/Target */ |
| 159 | struct bfa_rport_qos_attr_s qos_attr; /* qos attributes */ |
| 160 | enum bfa_pport_speed curr_speed; /* operating speed got from |
| 161 | * RPSC ELS. UNKNOWN, if RPSC |
| 162 | * is not supported */ |
| 163 | bfa_boolean_t trl_enforced; /* TRL enforced ? TRUE/FALSE */ |
| 164 | enum bfa_pport_speed assigned_speed; /* Speed assigned by the user. |
| 165 | * will be used if RPSC is not |
| 166 | * supported by the rport */ |
| 167 | }; |
| 168 | |
| 169 | #define bfa_rport_aen_qos_data_t struct bfa_rport_qos_attr_s |
| 170 | |
| 171 | /** |
| 172 | * BFA remote port events |
| 173 | * Arguments below are in BFAL context from Mgmt |
| 174 | * BFA_RPORT_AEN_ONLINE: [in]: lpwwn [out]: vf_id, lpwwn, rpwwn |
| 175 | * BFA_RPORT_AEN_OFFLINE: [in]: lpwwn [out]: vf_id, lpwwn, rpwwn |
| 176 | * BFA_RPORT_AEN_DISCONNECT:[in]: lpwwn [out]: vf_id, lpwwn, rpwwn |
| 177 | * BFA_RPORT_AEN_QOS_PRIO: [in]: lpwwn [out]: vf_id, lpwwn, rpwwn, prio |
| 178 | * BFA_RPORT_AEN_QOS_FLOWID:[in]: lpwwn [out]: vf_id, lpwwn, rpwwn, flow_id |
| 179 | */ |
| 180 | enum bfa_rport_aen_event { |
| 181 | BFA_RPORT_AEN_ONLINE = 1, /* RPort online event */ |
| 182 | BFA_RPORT_AEN_OFFLINE = 2, /* RPort offline event */ |
| 183 | BFA_RPORT_AEN_DISCONNECT = 3, /* RPort disconnect event */ |
| 184 | BFA_RPORT_AEN_QOS_PRIO = 4, /* QOS priority change event */ |
| 185 | BFA_RPORT_AEN_QOS_FLOWID = 5, /* QOS flow Id change event */ |
| 186 | }; |
| 187 | |
| 188 | struct bfa_rport_aen_data_s { |
| 189 | u16 vf_id; /* vf_id of this logical port */ |
| 190 | u16 rsvd[3]; |
| 191 | wwn_t ppwwn; /* WWN of its physical port */ |
| 192 | wwn_t lpwwn; /* WWN of this logical port */ |
| 193 | wwn_t rpwwn; /* WWN of this remote port */ |
| 194 | union { |
| 195 | bfa_rport_aen_qos_data_t qos; |
| 196 | } priv; |
| 197 | }; |
| 198 | |
| 199 | #endif /* __BFA_DEFS_RPORT_H__ */ |