1 /*
2  * Linux network driver for Brocade Converged Network Adapter.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License (GPL) Version 2 as
6  * published by the Free Software Foundation
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  */
13 /*
14  * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
15  * All rights reserved
16  * www.brocade.com
17  */
18 #ifndef __BFI_CNA_H__
19 #define __BFI_CNA_H__
20 
21 #include "bfi.h"
22 #include "bfa_defs_cna.h"
23 
24 #pragma pack(1)
25 
26 enum bfi_port_h2i {
27 	BFI_PORT_H2I_ENABLE_REQ		= (1),
28 	BFI_PORT_H2I_DISABLE_REQ	= (2),
29 	BFI_PORT_H2I_GET_STATS_REQ	= (3),
30 	BFI_PORT_H2I_CLEAR_STATS_REQ	= (4),
31 };
32 
33 enum bfi_port_i2h {
34 	BFI_PORT_I2H_ENABLE_RSP		= BFA_I2HM(1),
35 	BFI_PORT_I2H_DISABLE_RSP	= BFA_I2HM(2),
36 	BFI_PORT_I2H_GET_STATS_RSP	= BFA_I2HM(3),
37 	BFI_PORT_I2H_CLEAR_STATS_RSP	= BFA_I2HM(4),
38 };
39 
40 /* Generic REQ type */
41 struct bfi_port_generic_req {
42 	struct bfi_mhdr mh;		/*!< msg header			    */
43 	u32	msgtag;		/*!< msgtag for reply		    */
44 	u32	rsvd;
45 };
46 
47 /* Generic RSP type */
48 struct bfi_port_generic_rsp {
49 	struct bfi_mhdr mh;		/*!< common msg header		    */
50 	u8		status;		/*!< port enable status		    */
51 	u8		rsvd[3];
52 	u32	msgtag;		/*!< msgtag for reply		    */
53 };
54 
55 /* BFI_PORT_H2I_GET_STATS_REQ */
56 struct bfi_port_get_stats_req {
57 	struct bfi_mhdr mh;		/*!< common msg header		    */
58 	union bfi_addr_u   dma_addr;
59 };
60 
61 union bfi_port_h2i_msg_u {
62 	struct bfi_mhdr mh;
63 	struct bfi_port_generic_req enable_req;
64 	struct bfi_port_generic_req disable_req;
65 	struct bfi_port_get_stats_req getstats_req;
66 	struct bfi_port_generic_req clearstats_req;
67 };
68 
69 union bfi_port_i2h_msg_u {
70 	struct bfi_mhdr mh;
71 	struct bfi_port_generic_rsp enable_rsp;
72 	struct bfi_port_generic_rsp disable_rsp;
73 	struct bfi_port_generic_rsp getstats_rsp;
74 	struct bfi_port_generic_rsp clearstats_rsp;
75 };
76 
77 /* @brief Mailbox commands from host to (DCBX/LLDP) firmware */
78 enum bfi_cee_h2i_msgs {
79 	BFI_CEE_H2I_GET_CFG_REQ = 1,
80 	BFI_CEE_H2I_RESET_STATS = 2,
81 	BFI_CEE_H2I_GET_STATS_REQ = 3,
82 };
83 
84 /* @brief Mailbox reply and AEN messages from DCBX/LLDP firmware to host */
85 enum bfi_cee_i2h_msgs {
86 	BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
87 	BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
88 	BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
89 };
90 
91 /* Data structures */
92 
93 /*
94  * @brief H2I command structure for resetting the stats.
95  * BFI_CEE_H2I_RESET_STATS
96  */
97 struct bfi_lldp_reset_stats {
98 	struct bfi_mhdr mh;
99 };
100 
101 /*
102  * @brief H2I command structure for resetting the stats.
103  * BFI_CEE_H2I_RESET_STATS
104  */
105 struct bfi_cee_reset_stats {
106 	struct bfi_mhdr mh;
107 };
108 
109 /*
110  * @brief  get configuration  command from host
111  * BFI_CEE_H2I_GET_CFG_REQ
112  */
113 struct bfi_cee_get_req {
114 	struct bfi_mhdr mh;
115 	union bfi_addr_u   dma_addr;
116 };
117 
118 /*
119  * @brief reply message from firmware
120  * BFI_CEE_I2H_GET_CFG_RSP
121  */
122 struct bfi_cee_get_rsp {
123 	struct bfi_mhdr mh;
124 	u8			cmd_status;
125 	u8			rsvd[3];
126 };
127 
128 /*
129  * @brief  get configuration  command from host
130  * BFI_CEE_H2I_GET_STATS_REQ
131  */
132 struct bfi_cee_stats_req {
133 	struct bfi_mhdr mh;
134 	union bfi_addr_u   dma_addr;
135 };
136 
137 /*
138  * @brief reply message from firmware
139  * BFI_CEE_I2H_GET_STATS_RSP
140  */
141 struct bfi_cee_stats_rsp {
142 	struct bfi_mhdr mh;
143 	u8			cmd_status;
144 	u8			rsvd[3];
145 };
146 
147 /* @brief mailbox command structures from host to firmware */
148 union bfi_cee_h2i_msg_u {
149 	struct bfi_mhdr mh;
150 	struct bfi_cee_get_req get_req;
151 	struct bfi_cee_stats_req stats_req;
152 };
153 
154 /* @brief mailbox message structures from firmware to host	*/
155 union bfi_cee_i2h_msg_u {
156 	struct bfi_mhdr mh;
157 	struct bfi_cee_get_rsp get_rsp;
158 	struct bfi_cee_stats_rsp stats_rsp;
159 };
160 
161 #pragma pack()
162 
163 #endif /* __BFI_CNA_H__ */
164