[SCSI] bfa: Brocade BFA FC SCSI driver
[linux-2.6-block.git] / drivers / scsi / bfa / include / defs / bfa_defs_cee.h
1 /*
2  * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3  * All rights reserved
4  * www.brocade.com
5  *
6  *  bfa_defs_cee.h Interface declarations between host based
7  *      BFAL and DCBX/LLDP module in Firmware
8  *
9  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
10  *
11  * This program is free software; you can redistribute it and/or modify it
12  * under the terms of the GNU General Public License (GPL) Version 2 as
13  * published by the Free Software Foundation
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  */
20 #ifndef __BFA_DEFS_CEE_H__
21 #define __BFA_DEFS_CEE_H__
22
23 #include <defs/bfa_defs_types.h>
24 #include <defs/bfa_defs_pport.h>
25 #include <protocol/types.h>
26
27 #pragma pack(1)
28
29 #define BFA_CEE_LLDP_MAX_STRING_LEN (128)
30
31
32 /* FIXME: this is coming from the protocol spec. Can the host & apps share the
33    protocol .h files ?
34  */
35 #define BFA_CEE_LLDP_SYS_CAP_OTHER       0x0001
36 #define BFA_CEE_LLDP_SYS_CAP_REPEATER    0x0002
37 #define BFA_CEE_LLDP_SYS_CAP_MAC_BRIDGE  0x0004
38 #define BFA_CEE_LLDP_SYS_CAP_WLAN_AP     0x0008
39 #define BFA_CEE_LLDP_SYS_CAP_ROUTER      0x0010
40 #define BFA_CEE_LLDP_SYS_CAP_TELEPHONE   0x0020
41 #define BFA_CEE_LLDP_SYS_CAP_DOCSIS_CD   0x0040
42 #define BFA_CEE_LLDP_SYS_CAP_STATION     0x0080
43 #define BFA_CEE_LLDP_SYS_CAP_CVLAN           0x0100
44 #define BFA_CEE_LLDP_SYS_CAP_SVLAN           0x0200
45 #define BFA_CEE_LLDP_SYS_CAP_TPMR                0x0400
46
47
48 /* LLDP string type */
49 struct bfa_cee_lldp_str_s {
50         u8 sub_type;
51         u8 len;
52         u8 rsvd[2];
53         u8 value[BFA_CEE_LLDP_MAX_STRING_LEN];
54 };
55
56
57 /* LLDP paramters */
58 struct bfa_cee_lldp_cfg_s {
59         struct bfa_cee_lldp_str_s chassis_id;
60         struct bfa_cee_lldp_str_s port_id;
61         struct bfa_cee_lldp_str_s port_desc;
62         struct bfa_cee_lldp_str_s sys_name;
63         struct bfa_cee_lldp_str_s sys_desc;
64         struct bfa_cee_lldp_str_s mgmt_addr;
65         u16    time_to_interval;
66         u16    enabled_system_cap;
67 };
68
69 enum bfa_cee_dcbx_version_e {
70         DCBX_PROTOCOL_PRECEE = 1,
71         DCBX_PROTOCOL_CEE    = 2,
72 };
73
74 enum bfa_cee_lls_e {
75         CEE_LLS_DOWN_NO_TLV = 0, /* LLS is down because the TLV not sent by
76                                   * the peer */
77         CEE_LLS_DOWN        = 1, /* LLS is down as advertised by the peer */
78         CEE_LLS_UP          = 2,
79 };
80
81 /* CEE/DCBX parameters */
82 struct bfa_cee_dcbx_cfg_s {
83         u8 pgid[8];
84         u8 pg_percentage[8];
85         u8 pfc_enabled;          /* bitmap of priorties with PFC enabled */
86         u8 fcoe_user_priority;   /* bitmap of priorities used for FcoE
87                                        * traffic */
88         u8 dcbx_version;        /* operating version:CEE or preCEE */
89         u8 lls_fcoe;    /* FCoE Logical Link Status */
90         u8 lls_lan;     /* LAN Logical Link Status */
91         u8 rsvd[3];
92 };
93
94 /* CEE status */
95 /* Making this to tri-state for the benefit of port list command */
96 enum bfa_cee_status_e {
97     CEE_PHY_DOWN = 0,
98     CEE_PHY_UP = 1,
99     CEE_UP = 2,
100 };
101
102 /* CEE Query */
103 struct bfa_cee_attr_s {
104         u8                   cee_status;
105         u8                   error_reason;
106         struct bfa_cee_lldp_cfg_s lldp_remote;
107         struct bfa_cee_dcbx_cfg_s dcbx_remote;
108         mac_t src_mac;
109         u8 link_speed;
110         u8 filler[3];
111 };
112
113
114
115
116 /* LLDP/DCBX/CEE Statistics */
117
118 struct bfa_cee_lldp_stats_s {
119         u32 frames_transmitted;
120         u32 frames_aged_out;
121         u32 frames_discarded;
122         u32 frames_in_error;
123         u32 frames_rcvd;
124         u32 tlvs_discarded;
125         u32 tlvs_unrecognized;
126 };
127
128 struct bfa_cee_dcbx_stats_s {
129         u32 subtlvs_unrecognized;
130         u32 negotiation_failed;
131         u32 remote_cfg_changed;
132         u32 tlvs_received;
133         u32 tlvs_invalid;
134         u32 seqno;
135         u32 ackno;
136         u32 recvd_seqno;
137         u32 recvd_ackno;
138 };
139
140 struct bfa_cee_cfg_stats_s {
141         u32 cee_status_down;
142         u32 cee_status_up;
143         u32 cee_hw_cfg_changed;
144         u32 recvd_invalid_cfg;
145 };
146
147
148 struct bfa_cee_stats_s {
149         struct bfa_cee_lldp_stats_s lldp_stats;
150         struct bfa_cee_dcbx_stats_s dcbx_stats;
151         struct bfa_cee_cfg_stats_s  cfg_stats;
152 };
153
154 #pragma pack()
155
156
157 #endif  /* __BFA_DEFS_CEE_H__ */
158
159