xref: /freebsd/sys/dev/bxe/ecore_mfw_req.h (revision 7661de35d15f582ab33e3bd6b8d909601557e436)
1 /*-
2  * Copyright (c) 2007-2013 Broadcom Corporation. All rights reserved.
3  *
4  * Eric Davis        <edavis@broadcom.com>
5  * David Christensen <davidch@broadcom.com>
6  * Gary Zambrano     <zambrano@broadcom.com>
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. Neither the name of Broadcom Corporation nor the name of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written consent.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #include <sys/cdefs.h>
35 __FBSDID("$FreeBSD$");
36 
37 #ifndef ECORE_MFW_REQ_H
38 #define ECORE_MFW_REQ_H
39 
40 
41 
42 #define PORT_0              0
43 #define PORT_1              1
44 #define PORT_MAX            2
45 #define NVM_PATH_MAX        2
46 
47 /* FCoE capabilities required from the driver */
48 struct fcoe_capabilities {
49 	uint32_t capability1;
50 	/* Maximum number of I/Os per connection */
51 	#define FCOE_IOS_PER_CONNECTION_MASK    0x0000ffff
52 	#define FCOE_IOS_PER_CONNECTION_SHIFT   0
53 	/* Maximum number of Logins per port */
54 	#define FCOE_LOGINS_PER_PORT_MASK       0xffff0000
55 	#define FCOE_LOGINS_PER_PORT_SHIFT   16
56 
57 	uint32_t capability2;
58 	/* Maximum number of exchanges */
59 	#define FCOE_NUMBER_OF_EXCHANGES_MASK   0x0000ffff
60 	#define FCOE_NUMBER_OF_EXCHANGES_SHIFT  0
61 	/* Maximum NPIV WWN per port */
62 	#define FCOE_NPIV_WWN_PER_PORT_MASK     0xffff0000
63 	#define FCOE_NPIV_WWN_PER_PORT_SHIFT    16
64 
65 	uint32_t capability3;
66 	/* Maximum number of targets supported */
67 	#define FCOE_TARGETS_SUPPORTED_MASK     0x0000ffff
68 	#define FCOE_TARGETS_SUPPORTED_SHIFT    0
69 	/* Maximum number of outstanding commands across all connections */
70 	#define FCOE_OUTSTANDING_COMMANDS_MASK  0xffff0000
71 	#define FCOE_OUTSTANDING_COMMANDS_SHIFT 16
72 
73 	uint32_t capability4;
74 	#define FCOE_CAPABILITY4_STATEFUL       		0x00000001
75 	#define FCOE_CAPABILITY4_STATELESS      		0x00000002
76 	#define FCOE_CAPABILITY4_CAPABILITIES_REPORTED_VALID   	0x00000004
77 };
78 
79 struct glob_ncsi_oem_data
80 {
81 	uint32_t driver_version;
82 	uint32_t unused[3];
83 	struct fcoe_capabilities fcoe_features[NVM_PATH_MAX][PORT_MAX];
84 };
85 
86 /* current drv_info version */
87 #define DRV_INFO_CUR_VER 2
88 
89 /* drv_info op codes supported */
90 enum drv_info_opcode {
91 	ETH_STATS_OPCODE,
92 	FCOE_STATS_OPCODE,
93 	ISCSI_STATS_OPCODE
94 };
95 
96 #define ETH_STAT_INFO_VERSION_LEN	12
97 /*  Per PCI Function Ethernet Statistics required from the driver */
98 struct eth_stats_info {
99 	/* Function's Driver Version. padded to 12 */
100 	uint8_t version[ETH_STAT_INFO_VERSION_LEN];
101 	/* Locally Admin Addr. BigEndian EIU48. Actual size is 6 bytes */
102 	uint8_t mac_local[8];
103 	uint8_t mac_add1[8];		/* Additional Programmed MAC Addr 1. */
104 	uint8_t mac_add2[8];		/* Additional Programmed MAC Addr 2. */
105 	uint32_t mtu_size;		/* MTU Size. Note   : Negotiated MTU */
106 	uint32_t feature_flags;	/* Feature_Flags. */
107 #define FEATURE_ETH_CHKSUM_OFFLOAD_MASK		0x01
108 #define FEATURE_ETH_LSO_MASK			0x02
109 #define FEATURE_ETH_BOOTMODE_MASK		0x1C
110 #define FEATURE_ETH_BOOTMODE_SHIFT		2
111 #define FEATURE_ETH_BOOTMODE_NONE		(0x0 << 2)
112 #define FEATURE_ETH_BOOTMODE_PXE		(0x1 << 2)
113 #define FEATURE_ETH_BOOTMODE_ISCSI		(0x2 << 2)
114 #define FEATURE_ETH_BOOTMODE_FCOE		(0x3 << 2)
115 #define FEATURE_ETH_TOE_MASK			0x20
116 	uint32_t lso_max_size;	/* LSO MaxOffloadSize. */
117 	uint32_t lso_min_seg_cnt;	/* LSO MinSegmentCount. */
118 	/* Num Offloaded Connections TCP_IPv4. */
119 	uint32_t ipv4_ofld_cnt;
120 	/* Num Offloaded Connections TCP_IPv6. */
121 	uint32_t ipv6_ofld_cnt;
122 	uint32_t promiscuous_mode;	/* Promiscuous Mode. non-zero true */
123 	uint32_t txq_size;		/* TX Descriptors Queue Size */
124 	uint32_t rxq_size;		/* RX Descriptors Queue Size */
125 	/* TX Descriptor Queue Avg Depth. % Avg Queue Depth since last poll */
126 	uint32_t txq_avg_depth;
127 	/* RX Descriptors Queue Avg Depth. % Avg Queue Depth since last poll */
128 	uint32_t rxq_avg_depth;
129 	/* IOV_Offload. 0=none; 1=MultiQueue, 2=VEB 3= VEPA*/
130 	uint32_t iov_offload;
131 	/* Number of NetQueue/VMQ Config'd. */
132 	uint32_t netq_cnt;
133 	uint32_t vf_cnt;		/* Num VF assigned to this PF. */
134 };
135 
136 /*  Per PCI Function FCOE Statistics required from the driver */
137 struct fcoe_stats_info {
138 	uint8_t version[12];		/* Function's Driver Version. */
139 	uint8_t mac_local[8];	/* Locally Admin Addr. */
140 	uint8_t mac_add1[8];		/* Additional Programmed MAC Addr 1. */
141 	uint8_t mac_add2[8];		/* Additional Programmed MAC Addr 2. */
142 	/* QoS Priority (per 802.1p). 0-7255 */
143 	uint32_t qos_priority;
144 	uint32_t txq_size;		/* FCoE TX Descriptors Queue Size. */
145 	uint32_t rxq_size;		/* FCoE RX Descriptors Queue Size. */
146 	/* FCoE TX Descriptor Queue Avg Depth. */
147 	uint32_t txq_avg_depth;
148 	/* FCoE RX Descriptors Queue Avg Depth. */
149 	uint32_t rxq_avg_depth;
150 	uint32_t rx_frames_lo;	/* FCoE RX Frames received. */
151 	uint32_t rx_frames_hi;	/* FCoE RX Frames received. */
152 	uint32_t rx_bytes_lo;	/* FCoE RX Bytes received. */
153 	uint32_t rx_bytes_hi;	/* FCoE RX Bytes received. */
154 	uint32_t tx_frames_lo;	/* FCoE TX Frames sent. */
155 	uint32_t tx_frames_hi;	/* FCoE TX Frames sent. */
156 	uint32_t tx_bytes_lo;	/* FCoE TX Bytes sent. */
157 	uint32_t tx_bytes_hi;	/* FCoE TX Bytes sent. */
158 	uint32_t rx_fcs_errors;	/* number of receive packets with FCS errors */
159 	uint32_t rx_fc_crc_errors;	/* number of FC frames with CRC errors*/
160 	uint32_t fip_login_failures;	/* number of FCoE/FIP Login failures */
161 };
162 
163 /* Per PCI  Function iSCSI Statistics required from the driver*/
164 struct iscsi_stats_info {
165 	uint8_t version[12];		/* Function's Driver Version. */
166 	uint8_t mac_local[8];	/* Locally Admin iSCSI MAC Addr. */
167 	uint8_t mac_add1[8];		/* Additional Programmed MAC Addr 1. */
168 	/* QoS Priority (per 802.1p). 0-7255 */
169 	uint32_t qos_priority;
170 
171 	uint8_t initiator_name[64];	/* iSCSI Boot Initiator Node name. */
172 
173 	uint8_t ww_port_name[64];	/* iSCSI World wide port name */
174 
175 	uint8_t boot_target_name[64];/* iSCSI Boot Target Name. */
176 
177 	uint8_t boot_target_ip[16];	/* iSCSI Boot Target IP. */
178 	uint32_t boot_target_portal;	/* iSCSI Boot Target Portal. */
179 	uint8_t boot_init_ip[16];	/* iSCSI Boot Initiator IP Address. */
180 	uint32_t max_frame_size;	/* Max Frame Size. bytes */
181 	uint32_t txq_size;		/* PDU TX Descriptors Queue Size. */
182 	uint32_t rxq_size;		/* PDU RX Descriptors Queue Size. */
183 
184 	uint32_t txq_avg_depth;	/*PDU TX Descriptor Queue Avg Depth. */
185 	uint32_t rxq_avg_depth;	/*PDU RX Descriptors Queue Avg Depth. */
186 	uint32_t rx_pdus_lo;		/* iSCSI PDUs received. */
187 	uint32_t rx_pdus_hi;		/* iSCSI PDUs received. */
188 
189 	uint32_t rx_bytes_lo;	/* iSCSI RX Bytes received. */
190 	uint32_t rx_bytes_hi;	/* iSCSI RX Bytes received. */
191 	uint32_t tx_pdus_lo;		/* iSCSI PDUs sent. */
192 	uint32_t tx_pdus_hi;		/* iSCSI PDUs sent. */
193 
194 	uint32_t tx_bytes_lo;	/* iSCSI PDU TX Bytes sent. */
195 	uint32_t tx_bytes_hi;	/* iSCSI PDU TX Bytes sent. */
196 	uint32_t pcp_prior_map_tbl;	/*C-PCP to S-PCP Priority MapTable.
197 				9 nibbles, the position of each nibble
198 				represents the C-PCP value, the value
199 				of the nibble = S-PCP value.*/
200 };
201 
202 union drv_info_to_mcp {
203 	struct eth_stats_info		ether_stat;
204 	struct fcoe_stats_info		fcoe_stat;
205 	struct iscsi_stats_info		iscsi_stat;
206 };
207 
208 
209 #endif /* ECORE_MFW_REQ_H */
210 
211