1 /*
2  * Linux network driver for QLogic BR-series 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-2014 Brocade Communications Systems, Inc.
15  * Copyright (c) 2014-2015 QLogic Corporation
16  * All rights reserved
17  * www.qlogic.com
18  */
19 #ifndef __BFI_CNA_H__
20 #define __BFI_CNA_H__
21 
22 #include "bfi.h"
23 #include "bfa_defs_cna.h"
24 
25 #pragma pack(1)
26 
27 enum bfi_port_h2i {
28 	BFI_PORT_H2I_ENABLE_REQ		= (1),
29 	BFI_PORT_H2I_DISABLE_REQ	= (2),
30 	BFI_PORT_H2I_GET_STATS_REQ	= (3),
31 	BFI_PORT_H2I_CLEAR_STATS_REQ	= (4),
32 };
33 
34 enum bfi_port_i2h {
35 	BFI_PORT_I2H_ENABLE_RSP		= BFA_I2HM(1),
36 	BFI_PORT_I2H_DISABLE_RSP	= BFA_I2HM(2),
37 	BFI_PORT_I2H_GET_STATS_RSP	= BFA_I2HM(3),
38 	BFI_PORT_I2H_CLEAR_STATS_RSP	= BFA_I2HM(4),
39 };
40 
41 /* Generic REQ type */
42 struct bfi_port_generic_req {
43 	struct bfi_mhdr mh;		/*!< msg header			    */
44 	u32	msgtag;		/*!< msgtag for reply		    */
45 	u32	rsvd;
46 };
47 
48 /* Generic RSP type */
49 struct bfi_port_generic_rsp {
50 	struct bfi_mhdr mh;		/*!< common msg header		    */
51 	u8		status;		/*!< port enable status		    */
52 	u8		rsvd[3];
53 	u32	msgtag;		/*!< msgtag for reply		    */
54 };
55 
56 /* BFI_PORT_H2I_GET_STATS_REQ */
57 struct bfi_port_get_stats_req {
58 	struct bfi_mhdr mh;		/*!< common msg header		    */
59 	union bfi_addr_u   dma_addr;
60 };
61 
62 union bfi_port_h2i_msg_u {
63 	struct bfi_mhdr mh;
64 	struct bfi_port_generic_req enable_req;
65 	struct bfi_port_generic_req disable_req;
66 	struct bfi_port_get_stats_req getstats_req;
67 	struct bfi_port_generic_req clearstats_req;
68 };
69 
70 union bfi_port_i2h_msg_u {
71 	struct bfi_mhdr mh;
72 	struct bfi_port_generic_rsp enable_rsp;
73 	struct bfi_port_generic_rsp disable_rsp;
74 	struct bfi_port_generic_rsp getstats_rsp;
75 	struct bfi_port_generic_rsp clearstats_rsp;
76 };
77 
78 /* @brief Mailbox commands from host to (DCBX/LLDP) firmware */
79 enum bfi_cee_h2i_msgs {
80 	BFI_CEE_H2I_GET_CFG_REQ = 1,
81 	BFI_CEE_H2I_RESET_STATS = 2,
82 	BFI_CEE_H2I_GET_STATS_REQ = 3,
83 };
84 
85 /* @brief Mailbox reply and AEN messages from DCBX/LLDP firmware to host */
86 enum bfi_cee_i2h_msgs {
87 	BFI_CEE_I2H_GET_CFG_RSP = BFA_I2HM(1),
88 	BFI_CEE_I2H_RESET_STATS_RSP = BFA_I2HM(2),
89 	BFI_CEE_I2H_GET_STATS_RSP = BFA_I2HM(3),
90 };
91 
92 /* Data structures */
93 
94 /*
95  * @brief H2I command structure for resetting the stats.
96  * BFI_CEE_H2I_RESET_STATS
97  */
98 struct bfi_lldp_reset_stats {
99 	struct bfi_mhdr mh;
100 };
101 
102 /*
103  * @brief H2I command structure for resetting the stats.
104  * BFI_CEE_H2I_RESET_STATS
105  */
106 struct bfi_cee_reset_stats {
107 	struct bfi_mhdr mh;
108 };
109 
110 /*
111  * @brief  get configuration  command from host
112  * BFI_CEE_H2I_GET_CFG_REQ
113  */
114 struct bfi_cee_get_req {
115 	struct bfi_mhdr mh;
116 	union bfi_addr_u   dma_addr;
117 };
118 
119 /*
120  * @brief reply message from firmware
121  * BFI_CEE_I2H_GET_CFG_RSP
122  */
123 struct bfi_cee_get_rsp {
124 	struct bfi_mhdr mh;
125 	u8			cmd_status;
126 	u8			rsvd[3];
127 };
128 
129 /*
130  * @brief  get configuration  command from host
131  * BFI_CEE_H2I_GET_STATS_REQ
132  */
133 struct bfi_cee_stats_req {
134 	struct bfi_mhdr mh;
135 	union bfi_addr_u   dma_addr;
136 };
137 
138 /*
139  * @brief reply message from firmware
140  * BFI_CEE_I2H_GET_STATS_RSP
141  */
142 struct bfi_cee_stats_rsp {
143 	struct bfi_mhdr mh;
144 	u8			cmd_status;
145 	u8			rsvd[3];
146 };
147 
148 /* @brief mailbox command structures from host to firmware */
149 union bfi_cee_h2i_msg_u {
150 	struct bfi_mhdr mh;
151 	struct bfi_cee_get_req get_req;
152 	struct bfi_cee_stats_req stats_req;
153 };
154 
155 /* @brief mailbox message structures from firmware to host	*/
156 union bfi_cee_i2h_msg_u {
157 	struct bfi_mhdr mh;
158 	struct bfi_cee_get_rsp get_rsp;
159 	struct bfi_cee_stats_rsp stats_rsp;
160 };
161 
162 #pragma pack()
163 
164 #endif /* __BFI_CNA_H__ */
165