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