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