1*d14abf15SRobert Mustacchi /*
2*d14abf15SRobert Mustacchi * CDDL HEADER START
3*d14abf15SRobert Mustacchi *
4*d14abf15SRobert Mustacchi * The contents of this file are subject to the terms of the
5*d14abf15SRobert Mustacchi * Common Development and Distribution License (the "License").
6*d14abf15SRobert Mustacchi * You may not use this file except in compliance with the License.
7*d14abf15SRobert Mustacchi *
8*d14abf15SRobert Mustacchi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*d14abf15SRobert Mustacchi * or http://www.opensolaris.org/os/licensing.
10*d14abf15SRobert Mustacchi * See the License for the specific language governing permissions
11*d14abf15SRobert Mustacchi * and limitations under the License.
12*d14abf15SRobert Mustacchi *
13*d14abf15SRobert Mustacchi * When distributing Covered Code, include this CDDL HEADER in each
14*d14abf15SRobert Mustacchi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*d14abf15SRobert Mustacchi * If applicable, add the following below this CDDL HEADER, with the
16*d14abf15SRobert Mustacchi * fields enclosed by brackets "[]" replaced with your own identifying
17*d14abf15SRobert Mustacchi * information: Portions Copyright [yyyy] [name of copyright owner]
18*d14abf15SRobert Mustacchi *
19*d14abf15SRobert Mustacchi * CDDL HEADER END
20*d14abf15SRobert Mustacchi */
21*d14abf15SRobert Mustacchi
22*d14abf15SRobert Mustacchi /*
23*d14abf15SRobert Mustacchi * Copyright 2014 QLogic Corporation
24*d14abf15SRobert Mustacchi * The contents of this file are subject to the terms of the
25*d14abf15SRobert Mustacchi * QLogic End User License (the "License").
26*d14abf15SRobert Mustacchi * You may not use this file except in compliance with the License.
27*d14abf15SRobert Mustacchi *
28*d14abf15SRobert Mustacchi * You can obtain a copy of the License at
29*d14abf15SRobert Mustacchi * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/
30*d14abf15SRobert Mustacchi * QLogic_End_User_Software_License.txt
31*d14abf15SRobert Mustacchi * See the License for the specific language governing permissions
32*d14abf15SRobert Mustacchi * and limitations under the License.
33*d14abf15SRobert Mustacchi */
34*d14abf15SRobert Mustacchi
35*d14abf15SRobert Mustacchi /*
36*d14abf15SRobert Mustacchi * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
37*d14abf15SRobert Mustacchi */
38*d14abf15SRobert Mustacchi
39*d14abf15SRobert Mustacchi #ifndef BNXE_H
40*d14abf15SRobert Mustacchi #define BNXE_H
41*d14abf15SRobert Mustacchi
42*d14abf15SRobert Mustacchi #include <sys/types.h>
43*d14abf15SRobert Mustacchi #include <sys/stream.h>
44*d14abf15SRobert Mustacchi #include <sys/stropts.h>
45*d14abf15SRobert Mustacchi #include <sys/errno.h>
46*d14abf15SRobert Mustacchi #include <sys/cred.h>
47*d14abf15SRobert Mustacchi #include <sys/poll.h>
48*d14abf15SRobert Mustacchi #include <sys/modctl.h>
49*d14abf15SRobert Mustacchi #include <sys/mac.h>
50*d14abf15SRobert Mustacchi #include <sys/mac_provider.h>
51*d14abf15SRobert Mustacchi #include <sys/stat.h>
52*d14abf15SRobert Mustacchi #include <sys/ddi.h>
53*d14abf15SRobert Mustacchi #include <sys/sunddi.h>
54*d14abf15SRobert Mustacchi #include <sys/sunndi.h>
55*d14abf15SRobert Mustacchi #include <sys/ddifm.h>
56*d14abf15SRobert Mustacchi #include <sys/fm/protocol.h>
57*d14abf15SRobert Mustacchi #include <sys/fm/util.h>
58*d14abf15SRobert Mustacchi #include <sys/fm/io/ddi.h>
59*d14abf15SRobert Mustacchi #include <sys/pattr.h>
60*d14abf15SRobert Mustacchi #include <sys/sysmacros.h>
61*d14abf15SRobert Mustacchi #include <sys/ethernet.h>
62*d14abf15SRobert Mustacchi //#include <sys/vlan.h>
63*d14abf15SRobert Mustacchi #include <sys/strsun.h>
64*d14abf15SRobert Mustacchi #include <sys/ksynch.h>
65*d14abf15SRobert Mustacchi #include <sys/kstat.h>
66*d14abf15SRobert Mustacchi #include <netinet/in.h>
67*d14abf15SRobert Mustacchi #include <netinet/ip.h>
68*d14abf15SRobert Mustacchi #include <netinet/udp.h>
69*d14abf15SRobert Mustacchi #include <netinet/tcp.h>
70*d14abf15SRobert Mustacchi #include <inet/common.h>
71*d14abf15SRobert Mustacchi #include <inet/ip.h>
72*d14abf15SRobert Mustacchi #include <inet/ip_if.h>
73*d14abf15SRobert Mustacchi #include <sys/strsubr.h>
74*d14abf15SRobert Mustacchi #include <sys/pci.h>
75*d14abf15SRobert Mustacchi #include <sys/gld.h>
76*d14abf15SRobert Mustacchi
77*d14abf15SRobert Mustacchi /*
78*d14abf15SRobert Mustacchi * This really ticks me off! We use 'u' for naming unions
79*d14abf15SRobert Mustacchi * within structures. Why is 'u' a reserved word!?!?!?
80*d14abf15SRobert Mustacchi * http://bugs.opensolaris.org/view_bug.do?bug_id=4340073
81*d14abf15SRobert Mustacchi * This undef has been moved to bnxe_debug.h.
82*d14abf15SRobert Mustacchi */
83*d14abf15SRobert Mustacchi //#undef u
84*d14abf15SRobert Mustacchi
85*d14abf15SRobert Mustacchi #include "version.h"
86*d14abf15SRobert Mustacchi #include "debug.h"
87*d14abf15SRobert Mustacchi #include "bcmtype.h"
88*d14abf15SRobert Mustacchi #include "lm_defs.h"
89*d14abf15SRobert Mustacchi #include "listq.h"
90*d14abf15SRobert Mustacchi #include "lm5710.h"
91*d14abf15SRobert Mustacchi #include "lm.h"
92*d14abf15SRobert Mustacchi #include "bd_chain.h"
93*d14abf15SRobert Mustacchi #if !defined(__SunOS_MDB)
94*d14abf15SRobert Mustacchi #include "command.h"
95*d14abf15SRobert Mustacchi #endif
96*d14abf15SRobert Mustacchi #include "bnxe_binding.h"
97*d14abf15SRobert Mustacchi #if !defined(DBG) && !defined(__SunOS_MDB)
98*d14abf15SRobert Mustacchi #include "bnxe_debug.h" /* wasn't included by debug.h */
99*d14abf15SRobert Mustacchi #endif
100*d14abf15SRobert Mustacchi
101*d14abf15SRobert Mustacchi #ifndef VLAN_TAGSZ
102*d14abf15SRobert Mustacchi #define VLAN_TAGSZ 4
103*d14abf15SRobert Mustacchi #endif
104*d14abf15SRobert Mustacchi
105*d14abf15SRobert Mustacchi #define BNXE_RINGS
106*d14abf15SRobert Mustacchi #define RSS_ID_NONE -1
107*d14abf15SRobert Mustacchi
108*d14abf15SRobert Mustacchi #define USER_OPTION_CKSUM_NONE 0x0
109*d14abf15SRobert Mustacchi #define USER_OPTION_CKSUM_L3 0x1
110*d14abf15SRobert Mustacchi #define USER_OPTION_CKSUM_L3_L4 0x2
111*d14abf15SRobert Mustacchi #define USER_OPTION_CKSUM_DEFAULT USER_OPTION_CKSUM_L3_L4
112*d14abf15SRobert Mustacchi
113*d14abf15SRobert Mustacchi #define USER_OPTION_MTU_MIN 60
114*d14abf15SRobert Mustacchi #define USER_OPTION_MTU_MAX 9216
115*d14abf15SRobert Mustacchi #define USER_OPTION_MTU_DEFAULT 1500
116*d14abf15SRobert Mustacchi
117*d14abf15SRobert Mustacchi #define USER_OPTION_NUM_RINGS_MIN 0
118*d14abf15SRobert Mustacchi #define USER_OPTION_NUM_RINGS_MAX MAX_RSS_CHAINS
119*d14abf15SRobert Mustacchi #define USER_OPTION_NUM_RINGS_DEFAULT_MF 1
120*d14abf15SRobert Mustacchi #define USER_OPTION_NUM_RINGS_DEFAULT_SF 4
121*d14abf15SRobert Mustacchi #define USER_OPTION_NUM_RINGS_DEFAULT 0
122*d14abf15SRobert Mustacchi
123*d14abf15SRobert Mustacchi #define USER_OPTION_RX_RING_GROUPS_MIN 1
124*d14abf15SRobert Mustacchi #define USER_OPTION_RX_RING_GROUPS_MAX 1
125*d14abf15SRobert Mustacchi #define USER_OPTION_RX_RING_GROUPS_DEFAULT 1
126*d14abf15SRobert Mustacchi
127*d14abf15SRobert Mustacchi #define USER_OPTION_BDS_MIN 1
128*d14abf15SRobert Mustacchi #define USER_OPTION_BDS_MAX 32767
129*d14abf15SRobert Mustacchi #define USER_OPTION_RX_BDS_DEFAULT 1024
130*d14abf15SRobert Mustacchi #define USER_OPTION_TX_BDS_DEFAULT 1024
131*d14abf15SRobert Mustacchi #define USER_OPTION_MF_BDS_DIVISOR 4
132*d14abf15SRobert Mustacchi
133*d14abf15SRobert Mustacchi #define USER_OPTION_INTR_COALESCE_MIN 10 /* usecs */
134*d14abf15SRobert Mustacchi #define USER_OPTION_INTR_COALESCE_MAX 1000
135*d14abf15SRobert Mustacchi #define USER_OPTION_INTR_COALESCE_RX_DEFAULT 20
136*d14abf15SRobert Mustacchi #define USER_OPTION_INTR_COALESCE_TX_DEFAULT 40
137*d14abf15SRobert Mustacchi
138*d14abf15SRobert Mustacchi #define USER_OPTION_TX_MAX_FREE_DEFAULT 32
139*d14abf15SRobert Mustacchi #define USER_OPTION_RX_MAX_FREE_DEFAULT 32
140*d14abf15SRobert Mustacchi
141*d14abf15SRobert Mustacchi //#define USER_OPTION_RX_DCOPY_THRESH_DEFAULT 0xffffffff
142*d14abf15SRobert Mustacchi #define USER_OPTION_RX_DCOPY_THRESH_DEFAULT 128
143*d14abf15SRobert Mustacchi
144*d14abf15SRobert Mustacchi //#define USER_OPTION_TX_DCOPY_THRESH_DEFAULT 0
145*d14abf15SRobert Mustacchi #define USER_OPTION_TX_DCOPY_THRESH_DEFAULT 512
146*d14abf15SRobert Mustacchi
147*d14abf15SRobert Mustacchi //#define BNXE_IP_MAXLEN 65535
148*d14abf15SRobert Mustacchi #define BNXE_IP_MAXLEN 32768 /* 32768 = PAGESIZE * (BNXE_MAX_DMA_FRAGS_PER_PKT - 2 ) */
149*d14abf15SRobert Mustacchi #define BNXE_OPTION_LEN 80 /* room for IP/TCP options (max 40 bytes each) */
150*d14abf15SRobert Mustacchi #define BNXE_PKTHDR_LEN (sizeof(struct ether_vlan_header) + sizeof(struct ip) + sizeof(struct tcphdr) + BNXE_OPTION_LEN)
151*d14abf15SRobert Mustacchi #define BNXE_LSO_MAXLEN (BNXE_IP_MAXLEN + sizeof(struct ether_vlan_header) - BNXE_PKTHDR_LEN) /* maximum payload */
152*d14abf15SRobert Mustacchi
153*d14abf15SRobert Mustacchi #define BNXE_MAGIC 0x0feedead
154*d14abf15SRobert Mustacchi #define BNXE_MEM_CHECK_LEN 16
155*d14abf15SRobert Mustacchi #define BNXE_STR_SIZE 32
156*d14abf15SRobert Mustacchi
157*d14abf15SRobert Mustacchi #define BNXEF_NAME "bnxef"
158*d14abf15SRobert Mustacchi
159*d14abf15SRobert Mustacchi #define BNXE_FCOE(dev) ((um_device_t *)(dev))->do_fcoe
160*d14abf15SRobert Mustacchi
161*d14abf15SRobert Mustacchi #ifdef __sparc
162*d14abf15SRobert Mustacchi #define BNXE_DMA_ALIGNMENT 0x2000UL
163*d14abf15SRobert Mustacchi #else
164*d14abf15SRobert Mustacchi #define BNXE_DMA_ALIGNMENT 0x1000UL
165*d14abf15SRobert Mustacchi #endif
166*d14abf15SRobert Mustacchi
167*d14abf15SRobert Mustacchi /*
168*d14abf15SRobert Mustacchi * Adding a two byte offset to the receive buffer aligns the IP header on a
169*d14abf15SRobert Mustacchi * 16 byte boundary and it would put the TCP payload (assuming a 20 byte IP
170*d14abf15SRobert Mustacchi * header and 20 byte TCP header) on an 8 byte boundary.
171*d14abf15SRobert Mustacchi */
172*d14abf15SRobert Mustacchi #define BNXE_DMA_RX_OFFSET 2
173*d14abf15SRobert Mustacchi
174*d14abf15SRobert Mustacchi /*
175*d14abf15SRobert Mustacchi * The following two defines are used for defining limits on Tx packets.
176*d14abf15SRobert Mustacchi * BNXE_MAX_DMA_HANDLES_PER_PKT is the maximum number of DMA handles that are
177*d14abf15SRobert Mustacchi * pre-allocated for every Tx buffer descriptor. These DMA handles are used
178*d14abf15SRobert Mustacchi * for mapping each mblk in the chain when not double copying the packet data
179*d14abf15SRobert Mustacchi * into the copy buffer. BNXE_MAX_DMA_FRAGS_PER_PKT is based on the hardware
180*d14abf15SRobert Mustacchi * and represents the maximum number of fragments an outgoing packet can have.
181*d14abf15SRobert Mustacchi * Note that a single DMA handle can be comprised of multiple fragments which
182*d14abf15SRobert Mustacchi * is very likely with LSO.
183*d14abf15SRobert Mustacchi *
184*d14abf15SRobert Mustacchi * As seen below BNXE_MAX_DMA_FRAGS_PER_PKT is set to 10. The actual firmware
185*d14abf15SRobert Mustacchi * limit is 13 but 10 is chosen specifically for the case of LSO packets that
186*d14abf15SRobert Mustacchi * are broken up across a long mblk chain. The firmware utilizes a sliding
187*d14abf15SRobert Mustacchi * window on a packet's assigned buffer descriptors for LSO. The window is 10
188*d14abf15SRobert Mustacchi * bds and each window (i.e. bds 1-10, 2-11, 3-12, etc), except the window
189*d14abf15SRobert Mustacchi * containing the last bd, must contains at least MSS bytes. There are 'rare'
190*d14abf15SRobert Mustacchi * cases where a packet sent down by the stack will not satisfy this window
191*d14abf15SRobert Mustacchi * size requirement. Therefore, setting the frag limit to 10 results in any
192*d14abf15SRobert Mustacchi * long chained packet (i.e. greater than 10 mblks), the trailing mblks will
193*d14abf15SRobert Mustacchi * get double copied into a single copy buffer and will be pointed to by the
194*d14abf15SRobert Mustacchi * last bd. This simple change will ensure the sliding window requirement is
195*d14abf15SRobert Mustacchi * always satisfied. Note, LSO packets with long mblk chains are a rare
196*d14abf15SRobert Mustacchi * occurance (nicdrv test01 can trigger it).
197*d14abf15SRobert Mustacchi */
198*d14abf15SRobert Mustacchi #define BNXE_MAX_DMA_HANDLES_PER_PKT 11 /* go easy on DMA resources */
199*d14abf15SRobert Mustacchi #define BNXE_MAX_DMA_FRAGS_PER_PKT 10 /* set BNXE_IP_MAXLEN above accordingly */
200*d14abf15SRobert Mustacchi #define BNXE_MAX_DMA_SGLLEN 20 /* for partial dma mapping */
201*d14abf15SRobert Mustacchi
202*d14abf15SRobert Mustacchi #define BNXE_PDWM_THRESHOLD 8
203*d14abf15SRobert Mustacchi
204*d14abf15SRobert Mustacchi #define BNXE_TX_RESOURCES_NO_CREDIT 0x01
205*d14abf15SRobert Mustacchi #define BNXE_TX_RESOURCES_NO_DESC 0x02
206*d14abf15SRobert Mustacchi #define BNXE_TX_RESOURCES_NO_DRV_DMA_RES 0x04 /* Out of Tx DMA handles */
207*d14abf15SRobert Mustacchi #define BNXE_TX_RESOURCES_NO_OS_DMA_RES 0x08 /* Unable to allocate DMA resources. (e.g. bind error) */
208*d14abf15SRobert Mustacchi #define BNXE_TX_RESOURCES_TOO_MANY_FRAGS 0x10
209*d14abf15SRobert Mustacchi
210*d14abf15SRobert Mustacchi #define BNXE_TX_GOODXMIT 0
211*d14abf15SRobert Mustacchi #define BNXE_TX_LINKDOWN 1
212*d14abf15SRobert Mustacchi #define BNXE_TX_DEFERPKT 2
213*d14abf15SRobert Mustacchi #define BNXE_TX_HDWRFULL 3
214*d14abf15SRobert Mustacchi #define BNXE_TX_PKTERROR 4
215*d14abf15SRobert Mustacchi
216*d14abf15SRobert Mustacchi #define BNXE_ROUTE_RING_NONE 0
217*d14abf15SRobert Mustacchi #define BNXE_ROUTE_RING_TCPUDP 1
218*d14abf15SRobert Mustacchi #define BNXE_ROUTE_RING_DEST_MAC 2
219*d14abf15SRobert Mustacchi #define BNXE_ROUTE_RING_MSG_PRIO 3
220*d14abf15SRobert Mustacchi
221*d14abf15SRobert Mustacchi #undef BNXE_DEBUG_DMA_LIST
222*d14abf15SRobert Mustacchi
223*d14abf15SRobert Mustacchi extern ddi_device_acc_attr_t bnxeAccessAttribBAR;
224*d14abf15SRobert Mustacchi extern ddi_device_acc_attr_t bnxeAccessAttribBUF;
225*d14abf15SRobert Mustacchi
226*d14abf15SRobert Mustacchi typedef struct _BnxeDevParams
227*d14abf15SRobert Mustacchi {
228*d14abf15SRobert Mustacchi u32_t fw_ver;
229*d14abf15SRobert Mustacchi
230*d14abf15SRobert Mustacchi u32_t mtu[LM_CLI_IDX_MAX];
231*d14abf15SRobert Mustacchi
232*d14abf15SRobert Mustacchi u32_t routeTxRingPolicy;
233*d14abf15SRobert Mustacchi u32_t numRings; /* number of rings */
234*d14abf15SRobert Mustacchi u32_t numRxDesc[LM_CLI_IDX_MAX]; /* number of RX descriptors */
235*d14abf15SRobert Mustacchi u32_t numTxDesc[LM_CLI_IDX_MAX]; /* number of TX descriptors */
236*d14abf15SRobert Mustacchi u32_t maxRxFree; /* max free allowed before posting back */
237*d14abf15SRobert Mustacchi u32_t maxTxFree; /* max free allowed before posting back */
238*d14abf15SRobert Mustacchi
239*d14abf15SRobert Mustacchi boolean_t intrCoalesce;
240*d14abf15SRobert Mustacchi u32_t intrRxPerSec;
241*d14abf15SRobert Mustacchi u32_t intrTxPerSec;
242*d14abf15SRobert Mustacchi boolean_t disableMsix;
243*d14abf15SRobert Mustacchi
244*d14abf15SRobert Mustacchi boolean_t l2_fw_flow_ctrl;
245*d14abf15SRobert Mustacchi boolean_t autogreeenEnable;
246*d14abf15SRobert Mustacchi
247*d14abf15SRobert Mustacchi u32_t rxCopyThreshold;
248*d14abf15SRobert Mustacchi u32_t txCopyThreshold;
249*d14abf15SRobert Mustacchi
250*d14abf15SRobert Mustacchi lm_rx_mask_t rx_filter_mask[LM_CLI_IDX_MAX];
251*d14abf15SRobert Mustacchi
252*d14abf15SRobert Mustacchi int checksum;
253*d14abf15SRobert Mustacchi lm_offload_t enabled_oflds;
254*d14abf15SRobert Mustacchi
255*d14abf15SRobert Mustacchi boolean_t lsoEnable;
256*d14abf15SRobert Mustacchi
257*d14abf15SRobert Mustacchi boolean_t logEnable;
258*d14abf15SRobert Mustacchi
259*d14abf15SRobert Mustacchi boolean_t fcoeEnable;
260*d14abf15SRobert Mustacchi
261*d14abf15SRobert Mustacchi boolean_t linkRemoteFaultDetect;
262*d14abf15SRobert Mustacchi
263*d14abf15SRobert Mustacchi lm_status_t lastIndLink;
264*d14abf15SRobert Mustacchi lm_medium_t lastIndMedium;
265*d14abf15SRobert Mustacchi
266*d14abf15SRobert Mustacchi uint32_t debug_level;
267*d14abf15SRobert Mustacchi } BnxeDevParams;
268*d14abf15SRobert Mustacchi
269*d14abf15SRobert Mustacchi
270*d14abf15SRobert Mustacchi typedef struct _BnxeLinkCfg
271*d14abf15SRobert Mustacchi {
272*d14abf15SRobert Mustacchi boolean_t link_autoneg;
273*d14abf15SRobert Mustacchi boolean_t param_20000fdx;
274*d14abf15SRobert Mustacchi boolean_t param_10000fdx;
275*d14abf15SRobert Mustacchi boolean_t param_2500fdx;
276*d14abf15SRobert Mustacchi boolean_t param_1000fdx;
277*d14abf15SRobert Mustacchi boolean_t param_100fdx;
278*d14abf15SRobert Mustacchi boolean_t param_100hdx;
279*d14abf15SRobert Mustacchi boolean_t param_10fdx;
280*d14abf15SRobert Mustacchi boolean_t param_10hdx;
281*d14abf15SRobert Mustacchi boolean_t param_txpause;
282*d14abf15SRobert Mustacchi boolean_t param_rxpause;
283*d14abf15SRobert Mustacchi } BnxeLinkCfg;
284*d14abf15SRobert Mustacchi
285*d14abf15SRobert Mustacchi
286*d14abf15SRobert Mustacchi typedef struct _BnxePhyCfg
287*d14abf15SRobert Mustacchi {
288*d14abf15SRobert Mustacchi BnxeLinkCfg lnkcfg;
289*d14abf15SRobert Mustacchi boolean_t flow_autoneg;
290*d14abf15SRobert Mustacchi u32_t supported[ELINK_LINK_CONFIG_SIZE];
291*d14abf15SRobert Mustacchi u32_t phy_cfg_size;
292*d14abf15SRobert Mustacchi } BnxePhyCfg;
293*d14abf15SRobert Mustacchi
294*d14abf15SRobert Mustacchi
295*d14abf15SRobert Mustacchi typedef struct _BnxeProps
296*d14abf15SRobert Mustacchi {
297*d14abf15SRobert Mustacchi u32_t link_speed;
298*d14abf15SRobert Mustacchi boolean_t link_duplex;
299*d14abf15SRobert Mustacchi boolean_t link_txpause;
300*d14abf15SRobert Mustacchi boolean_t link_rxpause;
301*d14abf15SRobert Mustacchi time_t uptime;
302*d14abf15SRobert Mustacchi } BnxeProps;
303*d14abf15SRobert Mustacchi
304*d14abf15SRobert Mustacchi
305*d14abf15SRobert Mustacchi typedef struct _BnxeMemBlock
306*d14abf15SRobert Mustacchi {
307*d14abf15SRobert Mustacchi d_list_entry_t link;
308*d14abf15SRobert Mustacchi u32_t size;
309*d14abf15SRobert Mustacchi void * pBuf;
310*d14abf15SRobert Mustacchi char fileName[128];
311*d14abf15SRobert Mustacchi u32_t fileLine;
312*d14abf15SRobert Mustacchi } BnxeMemBlock;
313*d14abf15SRobert Mustacchi
314*d14abf15SRobert Mustacchi
315*d14abf15SRobert Mustacchi typedef struct _BnxeMemDma
316*d14abf15SRobert Mustacchi {
317*d14abf15SRobert Mustacchi d_list_entry_t link;
318*d14abf15SRobert Mustacchi u32_t size;
319*d14abf15SRobert Mustacchi void * pDmaVirt;
320*d14abf15SRobert Mustacchi ddi_dma_handle_t dmaHandle;
321*d14abf15SRobert Mustacchi ddi_acc_handle_t dmaAccHandle;
322*d14abf15SRobert Mustacchi lm_address_t physAddr;
323*d14abf15SRobert Mustacchi char fileName[128];
324*d14abf15SRobert Mustacchi u32_t fileLine;
325*d14abf15SRobert Mustacchi } BnxeMemDma;
326*d14abf15SRobert Mustacchi
327*d14abf15SRobert Mustacchi
328*d14abf15SRobert Mustacchi typedef struct _BnxeMemRegion
329*d14abf15SRobert Mustacchi {
330*d14abf15SRobert Mustacchi d_list_entry_t link;
331*d14abf15SRobert Mustacchi lm_address_t baseAddr;
332*d14abf15SRobert Mustacchi u32_t regNumber;
333*d14abf15SRobert Mustacchi offset_t offset;
334*d14abf15SRobert Mustacchi u32_t size;
335*d14abf15SRobert Mustacchi ddi_acc_handle_t regAccess;
336*d14abf15SRobert Mustacchi caddr_t pRegAddr;
337*d14abf15SRobert Mustacchi } BnxeMemRegion;
338*d14abf15SRobert Mustacchi
339*d14abf15SRobert Mustacchi
340*d14abf15SRobert Mustacchi typedef struct _um_txpacket_t
341*d14abf15SRobert Mustacchi {
342*d14abf15SRobert Mustacchi lm_packet_t lm_pkt; /* must be the first entry */
343*d14abf15SRobert Mustacchi lm_pkt_tx_info_t tx_info;
344*d14abf15SRobert Mustacchi
345*d14abf15SRobert Mustacchi mblk_t * pMblk;
346*d14abf15SRobert Mustacchi
347*d14abf15SRobert Mustacchi ddi_dma_handle_t cbDmaHandle; /* cb = copy buffer */
348*d14abf15SRobert Mustacchi ddi_acc_handle_t cbDmaAccHandle;
349*d14abf15SRobert Mustacchi caddr_t pCbBuf;
350*d14abf15SRobert Mustacchi lm_address_t cbPhysAddr;
351*d14abf15SRobert Mustacchi
352*d14abf15SRobert Mustacchi u32_t cbLength;
353*d14abf15SRobert Mustacchi u32_t num_handles; /* number of handles used for pkt */
354*d14abf15SRobert Mustacchi ddi_dma_handle_t dmaHandles[BNXE_MAX_DMA_HANDLES_PER_PKT];
355*d14abf15SRobert Mustacchi
356*d14abf15SRobert Mustacchi lm_frag_list_t frag_list;
357*d14abf15SRobert Mustacchi lm_frag_t frag_list_buffer[BNXE_MAX_DMA_FRAGS_PER_PKT];
358*d14abf15SRobert Mustacchi } um_txpacket_t;
359*d14abf15SRobert Mustacchi
360*d14abf15SRobert Mustacchi
361*d14abf15SRobert Mustacchi typedef struct _TxQueue
362*d14abf15SRobert Mustacchi {
363*d14abf15SRobert Mustacchi void * pUM; /* backpointer to um_device_t */
364*d14abf15SRobert Mustacchi u32_t idx; /* this ring's index */
365*d14abf15SRobert Mustacchi
366*d14abf15SRobert Mustacchi mac_ring_handle_t ringHandle;
367*d14abf15SRobert Mustacchi
368*d14abf15SRobert Mustacchi u32_t desc_cnt; /* number of Tx descriptors */
369*d14abf15SRobert Mustacchi
370*d14abf15SRobert Mustacchi u32_t txFailed;
371*d14abf15SRobert Mustacchi u32_t txDiscards;
372*d14abf15SRobert Mustacchi u32_t txRecycle;
373*d14abf15SRobert Mustacchi u32_t txCopied;
374*d14abf15SRobert Mustacchi u32_t txBlocked;
375*d14abf15SRobert Mustacchi u32_t txWait;
376*d14abf15SRobert Mustacchi u32_t txLowWater;
377*d14abf15SRobert Mustacchi
378*d14abf15SRobert Mustacchi u32_t thresh_pdwm; /* low resource water marks */
379*d14abf15SRobert Mustacchi
380*d14abf15SRobert Mustacchi kmutex_t txMutex;
381*d14abf15SRobert Mustacchi
382*d14abf15SRobert Mustacchi s_list_t sentTxQ; /* bds that have been sent and are ready to be freed */
383*d14abf15SRobert Mustacchi
384*d14abf15SRobert Mustacchi kmutex_t freeTxDescMutex;
385*d14abf15SRobert Mustacchi s_list_t freeTxDescQ; /* bds that are free for use */
386*d14abf15SRobert Mustacchi
387*d14abf15SRobert Mustacchi s_list_t waitTxDescQ; /* bds that are setup and waiting for tx (lock w/ tx mutex) */
388*d14abf15SRobert Mustacchi
389*d14abf15SRobert Mustacchi u32_t noTxCredits;
390*d14abf15SRobert Mustacchi } TxQueue;
391*d14abf15SRobert Mustacchi
392*d14abf15SRobert Mustacchi
393*d14abf15SRobert Mustacchi typedef struct _um_rxpacket_t
394*d14abf15SRobert Mustacchi {
395*d14abf15SRobert Mustacchi lm_packet_t lm_pkt; /* must be first entry */
396*d14abf15SRobert Mustacchi lm_pkt_rx_info_t rx_info;
397*d14abf15SRobert Mustacchi u32_t hash_value;
398*d14abf15SRobert Mustacchi
399*d14abf15SRobert Mustacchi frtn_t freeRtn;
400*d14abf15SRobert Mustacchi void * pUM; /* backpointer to um_device_t for free routine */
401*d14abf15SRobert Mustacchi int idx; /* chain index used by the free routine */
402*d14abf15SRobert Mustacchi
403*d14abf15SRobert Mustacchi u32_t signature;
404*d14abf15SRobert Mustacchi
405*d14abf15SRobert Mustacchi ddi_dma_handle_t dmaHandle;
406*d14abf15SRobert Mustacchi ddi_acc_handle_t dmaAccHandle;
407*d14abf15SRobert Mustacchi } um_rxpacket_t;
408*d14abf15SRobert Mustacchi
409*d14abf15SRobert Mustacchi
410*d14abf15SRobert Mustacchi typedef struct _RxQueue
411*d14abf15SRobert Mustacchi {
412*d14abf15SRobert Mustacchi void * pUM; /* backpointer to um_device_t */
413*d14abf15SRobert Mustacchi u32_t idx; /* this ring's index */
414*d14abf15SRobert Mustacchi
415*d14abf15SRobert Mustacchi mac_ring_handle_t ringHandle;
416*d14abf15SRobert Mustacchi uint64_t genNumber; /* set by mac and passed up in mac_ring_rx */
417*d14abf15SRobert Mustacchi
418*d14abf15SRobert Mustacchi volatile u32_t inPollMode;
419*d14abf15SRobert Mustacchi u8_t intrDisableCnt;
420*d14abf15SRobert Mustacchi u8_t intrEnableCnt;
421*d14abf15SRobert Mustacchi u8_t pollCnt;
422*d14abf15SRobert Mustacchi
423*d14abf15SRobert Mustacchi u32_t rxDiscards;
424*d14abf15SRobert Mustacchi u32_t rxCopied;
425*d14abf15SRobert Mustacchi u32_t rxLowWater;
426*d14abf15SRobert Mustacchi u32_t rxBufUpInStack;
427*d14abf15SRobert Mustacchi
428*d14abf15SRobert Mustacchi kmutex_t rxMutex;
429*d14abf15SRobert Mustacchi
430*d14abf15SRobert Mustacchi kmutex_t doneRxMutex;
431*d14abf15SRobert Mustacchi s_list_t doneRxQ; /* free bds that are ready to be posted */
432*d14abf15SRobert Mustacchi
433*d14abf15SRobert Mustacchi s_list_t waitRxQ; /* packet waiting to be sent up */
434*d14abf15SRobert Mustacchi } RxQueue;
435*d14abf15SRobert Mustacchi
436*d14abf15SRobert Mustacchi
437*d14abf15SRobert Mustacchi typedef struct _RxQueueGroup
438*d14abf15SRobert Mustacchi {
439*d14abf15SRobert Mustacchi void * pUM; /* backpointer to um_device_t */
440*d14abf15SRobert Mustacchi u32_t idx; /* this group's index */
441*d14abf15SRobert Mustacchi mac_group_handle_t groupHandle;
442*d14abf15SRobert Mustacchi } RxQueueGroup;
443*d14abf15SRobert Mustacchi
444*d14abf15SRobert Mustacchi
445*d14abf15SRobert Mustacchi typedef struct _KstatRingMap
446*d14abf15SRobert Mustacchi {
447*d14abf15SRobert Mustacchi u32_t idx; /* ring index */
448*d14abf15SRobert Mustacchi void * pUM; /* reference back to um_device_t */
449*d14abf15SRobert Mustacchi } KstatRingMap;
450*d14abf15SRobert Mustacchi
451*d14abf15SRobert Mustacchi
452*d14abf15SRobert Mustacchi typedef struct _BnxeFcoeState
453*d14abf15SRobert Mustacchi {
454*d14abf15SRobert Mustacchi lm_fcoe_state_t lm_fcoe;
455*d14abf15SRobert Mustacchi } BnxeFcoeState;
456*d14abf15SRobert Mustacchi
457*d14abf15SRobert Mustacchi
458*d14abf15SRobert Mustacchi typedef struct _BnxeClientStats
459*d14abf15SRobert Mustacchi {
460*d14abf15SRobert Mustacchi u32_t initWqeTx;
461*d14abf15SRobert Mustacchi u32_t initWqeTxErr;
462*d14abf15SRobert Mustacchi u32_t initCqeRx;
463*d14abf15SRobert Mustacchi u32_t initCqeRxErr;
464*d14abf15SRobert Mustacchi u32_t offloadConnWqeTx;
465*d14abf15SRobert Mustacchi u32_t offloadConnWqeTxErr;
466*d14abf15SRobert Mustacchi u32_t offloadConnCqeRx;
467*d14abf15SRobert Mustacchi u32_t offloadConnCqeRxErr;
468*d14abf15SRobert Mustacchi u32_t enableConnWqeTx;
469*d14abf15SRobert Mustacchi u32_t enableConnWqeTxErr;
470*d14abf15SRobert Mustacchi u32_t enableConnCqeRx;
471*d14abf15SRobert Mustacchi u32_t enableConnCqeRxErr;
472*d14abf15SRobert Mustacchi u32_t disableConnWqeTx;
473*d14abf15SRobert Mustacchi u32_t disableConnWqeTxErr;
474*d14abf15SRobert Mustacchi u32_t disableConnCqeRx;
475*d14abf15SRobert Mustacchi u32_t disableConnCqeRxErr;
476*d14abf15SRobert Mustacchi u32_t destroyConnWqeTx;
477*d14abf15SRobert Mustacchi u32_t destroyConnWqeTxErr;
478*d14abf15SRobert Mustacchi u32_t destroyConnCqeRx;
479*d14abf15SRobert Mustacchi u32_t destroyConnCqeRxErr;
480*d14abf15SRobert Mustacchi u32_t destroyWqeTx;
481*d14abf15SRobert Mustacchi u32_t destroyWqeTxErr;
482*d14abf15SRobert Mustacchi u32_t destroyCqeRx;
483*d14abf15SRobert Mustacchi u32_t destroyCqeRxErr;
484*d14abf15SRobert Mustacchi u32_t compRequestCqeRx;
485*d14abf15SRobert Mustacchi u32_t compRequestCqeRxErr;
486*d14abf15SRobert Mustacchi u32_t statWqeTx;
487*d14abf15SRobert Mustacchi u32_t statWqeTxErr;
488*d14abf15SRobert Mustacchi u32_t statCqeRx;
489*d14abf15SRobert Mustacchi u32_t statCqeRxErr;
490*d14abf15SRobert Mustacchi } BnxeClientStats;
491*d14abf15SRobert Mustacchi
492*d14abf15SRobert Mustacchi
493*d14abf15SRobert Mustacchi typedef struct _BnxeFcoeData
494*d14abf15SRobert Mustacchi {
495*d14abf15SRobert Mustacchi dev_info_t * pDev;
496*d14abf15SRobert Mustacchi BnxeBinding bind;
497*d14abf15SRobert Mustacchi BnxeClientStats stats;
498*d14abf15SRobert Mustacchi BnxeWwnInfo wwn;
499*d14abf15SRobert Mustacchi } BnxeFcoeData;
500*d14abf15SRobert Mustacchi
501*d14abf15SRobert Mustacchi
502*d14abf15SRobert Mustacchi typedef struct _BnxeIntrBlock
503*d14abf15SRobert Mustacchi {
504*d14abf15SRobert Mustacchi int intrCount;
505*d14abf15SRobert Mustacchi int intrCapability;
506*d14abf15SRobert Mustacchi u32_t intrPriority;
507*d14abf15SRobert Mustacchi u32_t intrHandleBlockSize;
508*d14abf15SRobert Mustacchi ddi_intr_handle_t * pIntrHandleBlockAlloc;
509*d14abf15SRobert Mustacchi ddi_intr_handle_t * pIntrHandleBlock;
510*d14abf15SRobert Mustacchi } BnxeIntrBlock;
511*d14abf15SRobert Mustacchi
512*d14abf15SRobert Mustacchi
513*d14abf15SRobert Mustacchi typedef struct _BnxeWorkQueueInstance
514*d14abf15SRobert Mustacchi {
515*d14abf15SRobert Mustacchi void * pUM;
516*d14abf15SRobert Mustacchi
517*d14abf15SRobert Mustacchi char taskqName[BNXE_STR_SIZE];
518*d14abf15SRobert Mustacchi ddi_taskq_t * pTaskq;
519*d14abf15SRobert Mustacchi kmutex_t workQueueMutex;
520*d14abf15SRobert Mustacchi s_list_t workQueue;
521*d14abf15SRobert Mustacchi
522*d14abf15SRobert Mustacchi u32_t workItemQueued;
523*d14abf15SRobert Mustacchi u32_t workItemError;
524*d14abf15SRobert Mustacchi u32_t workItemComplete;
525*d14abf15SRobert Mustacchi u32_t highWater;
526*d14abf15SRobert Mustacchi } BnxeWorkQueueInstance;
527*d14abf15SRobert Mustacchi
528*d14abf15SRobert Mustacchi
529*d14abf15SRobert Mustacchi typedef struct _BnxeWorkQueues
530*d14abf15SRobert Mustacchi {
531*d14abf15SRobert Mustacchi BnxeWorkQueueInstance instq; /* instant, single thread serialized */
532*d14abf15SRobert Mustacchi BnxeWorkQueueInstance delayq; /* delayed, multi thread not serialized */
533*d14abf15SRobert Mustacchi } BnxeWorkQueues;
534*d14abf15SRobert Mustacchi
535*d14abf15SRobert Mustacchi
536*d14abf15SRobert Mustacchi /* the following are used against the clientState variable in um_device_t */
537*d14abf15SRobert Mustacchi
538*d14abf15SRobert Mustacchi #define CLIENT_FLG_DEVI 0x001
539*d14abf15SRobert Mustacchi #define CLIENT_FLG_BIND 0x002
540*d14abf15SRobert Mustacchi #define CLIENT_FLG_HW 0x004
541*d14abf15SRobert Mustacchi
542*d14abf15SRobert Mustacchi #define CLIENT_DEVI(pUM, client) \
543*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] & CLIENT_FLG_DEVI)
544*d14abf15SRobert Mustacchi
545*d14abf15SRobert Mustacchi #define CLIENT_HW(pUM, client) \
546*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] & CLIENT_FLG_HW)
547*d14abf15SRobert Mustacchi
548*d14abf15SRobert Mustacchi #define CLIENT_BOUND(pUM, client) \
549*d14abf15SRobert Mustacchi (((client) == LM_CLI_IDX_NDIS) ? \
550*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] & CLIENT_FLG_HW) : \
551*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] & CLIENT_FLG_BIND))
552*d14abf15SRobert Mustacchi
553*d14abf15SRobert Mustacchi #define CLIENT_DEVI_SET(pUM, client) \
554*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] |= CLIENT_FLG_DEVI)
555*d14abf15SRobert Mustacchi
556*d14abf15SRobert Mustacchi #define CLIENT_DEVI_RESET(pUM, client) \
557*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] &= ~CLIENT_FLG_DEVI)
558*d14abf15SRobert Mustacchi
559*d14abf15SRobert Mustacchi #define CLIENT_BIND_SET(pUM, client) \
560*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] |= CLIENT_FLG_BIND)
561*d14abf15SRobert Mustacchi
562*d14abf15SRobert Mustacchi #define CLIENT_BIND_RESET(pUM, client) \
563*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] &= ~CLIENT_FLG_BIND)
564*d14abf15SRobert Mustacchi
565*d14abf15SRobert Mustacchi #define CLIENT_HW_SET(pUM, client) \
566*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] |= CLIENT_FLG_HW)
567*d14abf15SRobert Mustacchi
568*d14abf15SRobert Mustacchi #define CLIENT_HW_RESET(pUM, client) \
569*d14abf15SRobert Mustacchi ((pUM)->clientState[(client)] &= ~CLIENT_FLG_HW)
570*d14abf15SRobert Mustacchi
571*d14abf15SRobert Mustacchi
572*d14abf15SRobert Mustacchi typedef struct _um_device
573*d14abf15SRobert Mustacchi {
574*d14abf15SRobert Mustacchi lm_device_t lm_dev; /* must be the first element */
575*d14abf15SRobert Mustacchi
576*d14abf15SRobert Mustacchi u32_t magic;
577*d14abf15SRobert Mustacchi dev_info_t * pDev;
578*d14abf15SRobert Mustacchi
579*d14abf15SRobert Mustacchi u32_t hwInitDone;
580*d14abf15SRobert Mustacchi u32_t chipStarted;
581*d14abf15SRobert Mustacchi u32_t clientState[LM_CLI_IDX_MAX];
582*d14abf15SRobert Mustacchi
583*d14abf15SRobert Mustacchi d_list_t memBlockList;
584*d14abf15SRobert Mustacchi d_list_t memDmaList;
585*d14abf15SRobert Mustacchi d_list_t memRegionList;
586*d14abf15SRobert Mustacchi #ifdef BNXE_DEBUG_DMA_LIST
587*d14abf15SRobert Mustacchi d_list_t memDmaListSaved;
588*d14abf15SRobert Mustacchi #endif
589*d14abf15SRobert Mustacchi
590*d14abf15SRobert Mustacchi int instance;
591*d14abf15SRobert Mustacchi char devName[BNXE_STR_SIZE];
592*d14abf15SRobert Mustacchi char version[BNXE_STR_SIZE];
593*d14abf15SRobert Mustacchi char versionLM[BNXE_STR_SIZE];
594*d14abf15SRobert Mustacchi char versionFW[BNXE_STR_SIZE];
595*d14abf15SRobert Mustacchi char versionBC[BNXE_STR_SIZE];
596*d14abf15SRobert Mustacchi char chipName[BNXE_STR_SIZE];
597*d14abf15SRobert Mustacchi char chipID[BNXE_STR_SIZE];
598*d14abf15SRobert Mustacchi char intrAlloc[BNXE_STR_SIZE];
599*d14abf15SRobert Mustacchi char bus_dev_func[BNXE_STR_SIZE];
600*d14abf15SRobert Mustacchi char vendor_device[BNXE_STR_SIZE];
601*d14abf15SRobert Mustacchi
602*d14abf15SRobert Mustacchi volatile u32_t plumbed;
603*d14abf15SRobert Mustacchi
604*d14abf15SRobert Mustacchi ddi_acc_handle_t pPciCfg;
605*d14abf15SRobert Mustacchi
606*d14abf15SRobert Mustacchi kmutex_t intrMutex[MAX_RSS_CHAINS + 1];
607*d14abf15SRobert Mustacchi kmutex_t intrFlipMutex[MAX_RSS_CHAINS + 1];
608*d14abf15SRobert Mustacchi kmutex_t sbMutex[MAX_RSS_CHAINS + 1];
609*d14abf15SRobert Mustacchi kmutex_t ethConMutex;
610*d14abf15SRobert Mustacchi kmutex_t mcpMutex;
611*d14abf15SRobert Mustacchi kmutex_t phyMutex;
612*d14abf15SRobert Mustacchi kmutex_t indMutex;
613*d14abf15SRobert Mustacchi kmutex_t cidMutex;
614*d14abf15SRobert Mustacchi kmutex_t spqMutex; /* slow path queue lock */
615*d14abf15SRobert Mustacchi kmutex_t spReqMutex; /* slow path request manager lock */
616*d14abf15SRobert Mustacchi kmutex_t rrReqMutex; /* ramrod request */
617*d14abf15SRobert Mustacchi kmutex_t islesCtrlMutex;
618*d14abf15SRobert Mustacchi kmutex_t toeMutex;
619*d14abf15SRobert Mustacchi kmutex_t memMutex;
620*d14abf15SRobert Mustacchi kmutex_t offloadMutex;
621*d14abf15SRobert Mustacchi kmutex_t hwInitMutex;
622*d14abf15SRobert Mustacchi kmutex_t gldMutex;
623*d14abf15SRobert Mustacchi krwlock_t gldTxMutex;
624*d14abf15SRobert Mustacchi
625*d14abf15SRobert Mustacchi kmutex_t timerMutex;
626*d14abf15SRobert Mustacchi volatile u32_t timerEnabled;
627*d14abf15SRobert Mustacchi timeout_id_t timerID;
628*d14abf15SRobert Mustacchi
629*d14abf15SRobert Mustacchi BnxeWorkQueues workqs;
630*d14abf15SRobert Mustacchi
631*d14abf15SRobert Mustacchi BnxeMemDma * statusBlocks[MAX_RSS_CHAINS + 1];
632*d14abf15SRobert Mustacchi volatile u32_t intrEnabled;
633*d14abf15SRobert Mustacchi u64_t intrFired;
634*d14abf15SRobert Mustacchi /* the arrays below = LM_SB_CNT() + 1 = 17 */
635*d14abf15SRobert Mustacchi u64_t intrSbCnt[MAX_RSS_CHAINS + 1];
636*d14abf15SRobert Mustacchi u64_t intrSbNoChangeCnt[MAX_RSS_CHAINS + 1];
637*d14abf15SRobert Mustacchi u64_t intrSbPollCnt[MAX_RSS_CHAINS + 1];
638*d14abf15SRobert Mustacchi u64_t intrSbPollNoChangeCnt[MAX_RSS_CHAINS + 1];
639*d14abf15SRobert Mustacchi
640*d14abf15SRobert Mustacchi int intrType;
641*d14abf15SRobert Mustacchi u32_t intrPriority;
642*d14abf15SRobert Mustacchi BnxeIntrBlock defIntr;
643*d14abf15SRobert Mustacchi BnxeIntrBlock rssIntr;
644*d14abf15SRobert Mustacchi BnxeIntrBlock fcoeIntr;
645*d14abf15SRobert Mustacchi
646*d14abf15SRobert Mustacchi BnxeDevParams devParams;
647*d14abf15SRobert Mustacchi mac_handle_t pMac;
648*d14abf15SRobert Mustacchi mac_resource_handle_t macRxResourceHandles[MAX_ETH_REG_CONS];
649*d14abf15SRobert Mustacchi u8_t gldMac[ETHERNET_ADDRESS_SIZE];
650*d14abf15SRobert Mustacchi
651*d14abf15SRobert Mustacchi d_list_t mcast_l2;
652*d14abf15SRobert Mustacchi d_list_t mcast_fcoe;
653*d14abf15SRobert Mustacchi
654*d14abf15SRobert Mustacchi u32_t ucastTableLen; /* number of ucast addrs in the table */
655*d14abf15SRobert Mustacchi #ifndef LM_MAX_UC_TABLE_SIZE
656*d14abf15SRobert Mustacchi #define LM_MAX_UC_TABLE_SIZE 1 /* for now, fix needed to support multiple ucast addr */
657*d14abf15SRobert Mustacchi #endif
658*d14abf15SRobert Mustacchi
659*d14abf15SRobert Mustacchi TxQueue txq[MAX_ETH_CONS];
660*d14abf15SRobert Mustacchi RxQueue rxq[MAX_ETH_CONS];
661*d14abf15SRobert Mustacchi RxQueueGroup rxqGroup[USER_OPTION_RX_RING_GROUPS_MAX];
662*d14abf15SRobert Mustacchi u32_t rxBufSignature[LM_CLI_IDX_MAX];
663*d14abf15SRobert Mustacchi u32_t txMsgPullUp;
664*d14abf15SRobert Mustacchi
665*d14abf15SRobert Mustacchi BnxeProps props;
666*d14abf15SRobert Mustacchi BnxePhyCfg hwinit; /* gathered by BnxeCfgInit */
667*d14abf15SRobert Mustacchi BnxePhyCfg curcfg; /* initialized from hwinit by BnxeCfgReset */
668*d14abf15SRobert Mustacchi BnxeLinkCfg remote;
669*d14abf15SRobert Mustacchi u32_t phyInitialized;
670*d14abf15SRobert Mustacchi
671*d14abf15SRobert Mustacchi kstat_t * kstats;
672*d14abf15SRobert Mustacchi kstat_t * kstatsLink;
673*d14abf15SRobert Mustacchi kstat_t * kstatsIntr;
674*d14abf15SRobert Mustacchi kstat_t * kstatsL2Chip;
675*d14abf15SRobert Mustacchi kstat_t * kstatsL2Driver;
676*d14abf15SRobert Mustacchi kstat_t * kstatsL2Stats;
677*d14abf15SRobert Mustacchi kstat_t * kstatsFcoe;
678*d14abf15SRobert Mustacchi kstat_t * kstatsDcbx;
679*d14abf15SRobert Mustacchi kstat_t * kstats_rxq[MAX_ETH_CONS];
680*d14abf15SRobert Mustacchi KstatRingMap kstats_rxq_map[MAX_ETH_CONS];
681*d14abf15SRobert Mustacchi kstat_t * kstats_txq[MAX_ETH_CONS];
682*d14abf15SRobert Mustacchi KstatRingMap kstats_txq_map[MAX_ETH_CONS];
683*d14abf15SRobert Mustacchi kmutex_t kstatMutex;
684*d14abf15SRobert Mustacchi
685*d14abf15SRobert Mustacchi int fmCapabilities; /* FMA capabilities */
686*d14abf15SRobert Mustacchi
687*d14abf15SRobert Mustacchi boolean_t do_fcoe;
688*d14abf15SRobert Mustacchi BnxeFcoeData fcoe;
689*d14abf15SRobert Mustacchi iscsi_info_block_hdr_t iscsiInfo;
690*d14abf15SRobert Mustacchi
691*d14abf15SRobert Mustacchi } um_device_t;
692*d14abf15SRobert Mustacchi
693*d14abf15SRobert Mustacchi
694*d14abf15SRobert Mustacchi /* mioc[ack|nak] return values from ioctl subroutines */
695*d14abf15SRobert Mustacchi enum ioc_reply
696*d14abf15SRobert Mustacchi {
697*d14abf15SRobert Mustacchi IOC_INVAL = -1, /* bad, NAK with EINVAL */
698*d14abf15SRobert Mustacchi IOC_DONE, /* OK, reply sent */
699*d14abf15SRobert Mustacchi IOC_ACK, /* OK, just send ACK */
700*d14abf15SRobert Mustacchi IOC_REPLY, /* OK, just send reply */
701*d14abf15SRobert Mustacchi IOC_RESTART_ACK, /* OK, restart & ACK */
702*d14abf15SRobert Mustacchi IOC_RESTART_REPLY /* OK, restart & reply */
703*d14abf15SRobert Mustacchi };
704*d14abf15SRobert Mustacchi
705*d14abf15SRobert Mustacchi
706*d14abf15SRobert Mustacchi #define BNXE_IOC_BASE ('X' << 8)
707*d14abf15SRobert Mustacchi /* IOCTLs for get/set lldp and dcbx params */
708*d14abf15SRobert Mustacchi #define GIOCBNXELLDP (BNXE_IOC_BASE + 0)
709*d14abf15SRobert Mustacchi #define GIOCBNXEDCBX (BNXE_IOC_BASE + 1)
710*d14abf15SRobert Mustacchi #define SIOCBNXEDCBX (BNXE_IOC_BASE + 2)
711*d14abf15SRobert Mustacchi /* IOCTLs for edebug and firmware upgrade */
712*d14abf15SRobert Mustacchi #define GIOCBNXEREG (BNXE_IOC_BASE + 3)
713*d14abf15SRobert Mustacchi #define SIOCBNXEREG (BNXE_IOC_BASE + 4)
714*d14abf15SRobert Mustacchi #define GIOCBNXENVRM (BNXE_IOC_BASE + 5)
715*d14abf15SRobert Mustacchi #define SIOCBNXENVRM (BNXE_IOC_BASE + 6)
716*d14abf15SRobert Mustacchi #define GIOCBNXEPCI (BNXE_IOC_BASE + 7)
717*d14abf15SRobert Mustacchi #define GIOCBNXESTATS (BNXE_IOC_BASE + 8)
718*d14abf15SRobert Mustacchi
719*d14abf15SRobert Mustacchi struct bnxe_reg_data
720*d14abf15SRobert Mustacchi {
721*d14abf15SRobert Mustacchi u32_t offset;
722*d14abf15SRobert Mustacchi u32_t value;
723*d14abf15SRobert Mustacchi };
724*d14abf15SRobert Mustacchi
725*d14abf15SRobert Mustacchi struct bnxe_nvram_data
726*d14abf15SRobert Mustacchi {
727*d14abf15SRobert Mustacchi u32_t offset;
728*d14abf15SRobert Mustacchi u32_t num_of_u32;
729*d14abf15SRobert Mustacchi u32_t value[1]; /* variable */
730*d14abf15SRobert Mustacchi };
731*d14abf15SRobert Mustacchi
732*d14abf15SRobert Mustacchi
733*d14abf15SRobert Mustacchi /* bnxe_cfg.c */
734*d14abf15SRobert Mustacchi void BnxeCfgInit(um_device_t * pUM);
735*d14abf15SRobert Mustacchi void BnxeCfgReset(um_device_t * pUM);
736*d14abf15SRobert Mustacchi
737*d14abf15SRobert Mustacchi /* bnxe_mm.c */
738*d14abf15SRobert Mustacchi void BnxeInitBdCnts(um_device_t * pUM,
739*d14abf15SRobert Mustacchi int cli_idx);
740*d14abf15SRobert Mustacchi
741*d14abf15SRobert Mustacchi /* bnxe_gld.c */
742*d14abf15SRobert Mustacchi boolean_t BnxeGldInit(um_device_t * pUM);
743*d14abf15SRobert Mustacchi boolean_t BnxeGldFini(um_device_t * pUM);
744*d14abf15SRobert Mustacchi void BnxeGldLink(um_device_t * pUM,
745*d14abf15SRobert Mustacchi link_state_t state);
746*d14abf15SRobert Mustacchi
747*d14abf15SRobert Mustacchi /* bnxe_hw.c */
748*d14abf15SRobert Mustacchi boolean_t BnxeEstablishHwConn(um_device_t * pUM,
749*d14abf15SRobert Mustacchi int cid);
750*d14abf15SRobert Mustacchi int BnxeHwStartFCOE(um_device_t * pUM);
751*d14abf15SRobert Mustacchi int BnxeHwStartL2(um_device_t * pUM);
752*d14abf15SRobert Mustacchi int BnxeHwStartCore(um_device_t * pUM);
753*d14abf15SRobert Mustacchi void BnxeHwStopFCOE(um_device_t * pUM);
754*d14abf15SRobert Mustacchi void BnxeHwStopL2(um_device_t * pUM);
755*d14abf15SRobert Mustacchi void BnxeHwStopCore(um_device_t * pUM);
756*d14abf15SRobert Mustacchi void BnxeUpdatePhy(um_device_t * pUM);
757*d14abf15SRobert Mustacchi int BnxeMacAddress(um_device_t * pUM,
758*d14abf15SRobert Mustacchi int cliIdx,
759*d14abf15SRobert Mustacchi boolean_t flag,
760*d14abf15SRobert Mustacchi const uint8_t * pMacAddr);
761*d14abf15SRobert Mustacchi int BnxeMulticast(um_device_t * pUM,
762*d14abf15SRobert Mustacchi int cliIdx,
763*d14abf15SRobert Mustacchi boolean_t flag,
764*d14abf15SRobert Mustacchi const uint8_t * pMcastAddr,
765*d14abf15SRobert Mustacchi boolean_t hwSet);
766*d14abf15SRobert Mustacchi int BnxeRxMask(um_device_t * pUM,
767*d14abf15SRobert Mustacchi int cliIdx,
768*d14abf15SRobert Mustacchi lm_rx_mask_t mask);
769*d14abf15SRobert Mustacchi int BnxeHwResume(um_device_t * pUM);
770*d14abf15SRobert Mustacchi int BnxeHwSuspend(um_device_t * pUM);
771*d14abf15SRobert Mustacchi #if (DEVO_REV > 3)
772*d14abf15SRobert Mustacchi int BnxeHwQuiesce(um_device_t * pUM);
773*d14abf15SRobert Mustacchi #endif
774*d14abf15SRobert Mustacchi
775*d14abf15SRobert Mustacchi /* bnxe_intr.c */
776*d14abf15SRobert Mustacchi void BnxeIntrIguSbEnable(um_device_t * pUM,
777*d14abf15SRobert Mustacchi u32_t idx,
778*d14abf15SRobert Mustacchi boolean_t fromISR);
779*d14abf15SRobert Mustacchi void BnxeIntrIguSbDisable(um_device_t * pUM,
780*d14abf15SRobert Mustacchi u32_t idx,
781*d14abf15SRobert Mustacchi boolean_t fromISR);
782*d14abf15SRobert Mustacchi void BnxePollRxRing(um_device_t * pUM,
783*d14abf15SRobert Mustacchi u32_t idx,
784*d14abf15SRobert Mustacchi boolean_t * pPktsRxed,
785*d14abf15SRobert Mustacchi boolean_t * pPktsTxed);
786*d14abf15SRobert Mustacchi void BnxePollRxRingFCOE(um_device_t * pUM);
787*d14abf15SRobert Mustacchi int BnxeIntrEnable(um_device_t * pUM);
788*d14abf15SRobert Mustacchi void BnxeIntrDisable(um_device_t * pUM);
789*d14abf15SRobert Mustacchi boolean_t BnxeIntrInit(um_device_t * pUM);
790*d14abf15SRobert Mustacchi void BnxeIntrFini(um_device_t * pUM);
791*d14abf15SRobert Mustacchi
792*d14abf15SRobert Mustacchi /* bnxe_kstat.c */
793*d14abf15SRobert Mustacchi boolean_t BnxeKstatInit(um_device_t * pUM);
794*d14abf15SRobert Mustacchi void BnxeKstatFini(um_device_t * pUM);
795*d14abf15SRobert Mustacchi
796*d14abf15SRobert Mustacchi /* bnxe_rr.c */
797*d14abf15SRobert Mustacchi int BnxeRouteTxRing(um_device_t * pUM,
798*d14abf15SRobert Mustacchi mblk_t * pMblk);
799*d14abf15SRobert Mustacchi
800*d14abf15SRobert Mustacchi /* bnxe_rx.c */
801*d14abf15SRobert Mustacchi boolean_t BnxeWaitForPacketsFromClient(um_device_t * pUM,
802*d14abf15SRobert Mustacchi int cliIdx);
803*d14abf15SRobert Mustacchi mblk_t * BnxeRxRingProcess(um_device_t * pUM,
804*d14abf15SRobert Mustacchi int idx,
805*d14abf15SRobert Mustacchi boolean_t polling,
806*d14abf15SRobert Mustacchi int numBytes);
807*d14abf15SRobert Mustacchi void BnxeRxPktsAbort(um_device_t * pUM,
808*d14abf15SRobert Mustacchi int cliIdx);
809*d14abf15SRobert Mustacchi int BnxeRxPktsInitPostBuffers(um_device_t * pUM,
810*d14abf15SRobert Mustacchi int cliIdx);
811*d14abf15SRobert Mustacchi int BnxeRxPktsInit(um_device_t * pUM,
812*d14abf15SRobert Mustacchi int cliIdx);
813*d14abf15SRobert Mustacchi void BnxeRxPktsFini(um_device_t * pUM,
814*d14abf15SRobert Mustacchi int cliIdx);
815*d14abf15SRobert Mustacchi
816*d14abf15SRobert Mustacchi /* bnxe_tx.c */
817*d14abf15SRobert Mustacchi void BnxeTxPktsReclaim(um_device_t * pUM,
818*d14abf15SRobert Mustacchi int idx,
819*d14abf15SRobert Mustacchi s_list_t * pPktList);
820*d14abf15SRobert Mustacchi void BnxeTxRingProcess(um_device_t * pUM,
821*d14abf15SRobert Mustacchi int idx);
822*d14abf15SRobert Mustacchi int BnxeTxSendMblk(um_device_t * pUM,
823*d14abf15SRobert Mustacchi int idx,
824*d14abf15SRobert Mustacchi mblk_t * pMblk,
825*d14abf15SRobert Mustacchi u32_t flags,
826*d14abf15SRobert Mustacchi u16_t vlan_tag);
827*d14abf15SRobert Mustacchi void BnxeTxPktsAbort(um_device_t * pUM,
828*d14abf15SRobert Mustacchi int cliIdx);
829*d14abf15SRobert Mustacchi int BnxeTxPktsInit(um_device_t * pUM,
830*d14abf15SRobert Mustacchi int cliIdx);
831*d14abf15SRobert Mustacchi void BnxeTxPktsFini(um_device_t * pUM,
832*d14abf15SRobert Mustacchi int cliIdx);
833*d14abf15SRobert Mustacchi
834*d14abf15SRobert Mustacchi /* bnxe_timer.c */
835*d14abf15SRobert Mustacchi void BnxeTimerStart(um_device_t * pUM);
836*d14abf15SRobert Mustacchi void BnxeTimerStop(um_device_t * pUM);
837*d14abf15SRobert Mustacchi
838*d14abf15SRobert Mustacchi /* bnxe_workq.c */
839*d14abf15SRobert Mustacchi boolean_t BnxeWorkQueueInit(um_device_t * pUM);
840*d14abf15SRobert Mustacchi void BnxeWorkQueueWaitAndDestroy(um_device_t * pUM);
841*d14abf15SRobert Mustacchi void BnxeWorkQueueStartPending(um_device_t * pUM);
842*d14abf15SRobert Mustacchi boolean_t BnxeWorkQueueAdd(um_device_t * pUM,
843*d14abf15SRobert Mustacchi void (*pWorkCbk)(um_device_t *, void *, u32_t),
844*d14abf15SRobert Mustacchi void * pWorkData,
845*d14abf15SRobert Mustacchi u32_t workDataLen);
846*d14abf15SRobert Mustacchi boolean_t BnxeWorkQueueAddNoCopy(um_device_t * pUM,
847*d14abf15SRobert Mustacchi void (*pWorkCbk)(um_device_t *, void *),
848*d14abf15SRobert Mustacchi void * pWorkData);
849*d14abf15SRobert Mustacchi boolean_t BnxeWorkQueueAddGeneric(um_device_t * pUM,
850*d14abf15SRobert Mustacchi void (*pWorkCbkGeneric)(um_device_t *));
851*d14abf15SRobert Mustacchi boolean_t BnxeWorkQueueAddDelay(um_device_t * pUM,
852*d14abf15SRobert Mustacchi void (*pWorkCbk)(um_device_t *, void *, u32_t),
853*d14abf15SRobert Mustacchi void * pWorkData,
854*d14abf15SRobert Mustacchi u32_t workDataLen,
855*d14abf15SRobert Mustacchi u32_t delayMs);
856*d14abf15SRobert Mustacchi boolean_t BnxeWorkQueueAddDelayNoCopy(um_device_t * pUM,
857*d14abf15SRobert Mustacchi void (*pWorkCbk)(um_device_t *, void *),
858*d14abf15SRobert Mustacchi void * pWorkData,
859*d14abf15SRobert Mustacchi u32_t delayMs);
860*d14abf15SRobert Mustacchi boolean_t BnxeWorkQueueAddDelayGeneric(um_device_t * pUM,
861*d14abf15SRobert Mustacchi void (*pWorkCbkGeneric)(um_device_t *),
862*d14abf15SRobert Mustacchi u32_t delayMs);
863*d14abf15SRobert Mustacchi
864*d14abf15SRobert Mustacchi /* bnxe_fcoe.c */
865*d14abf15SRobert Mustacchi boolean_t BnxeFcoeInitCqe(um_device_t * pUM,
866*d14abf15SRobert Mustacchi struct fcoe_kcqe * kcqe);
867*d14abf15SRobert Mustacchi boolean_t BnxeFcoeOffloadConnCqe(um_device_t * pUM,
868*d14abf15SRobert Mustacchi BnxeFcoeState * pFcoeState,
869*d14abf15SRobert Mustacchi struct fcoe_kcqe * kcqe);
870*d14abf15SRobert Mustacchi boolean_t BnxeFcoeEnableConnCqe(um_device_t * pUM,
871*d14abf15SRobert Mustacchi BnxeFcoeState * pFcoeState,
872*d14abf15SRobert Mustacchi struct fcoe_kcqe * kcqe);
873*d14abf15SRobert Mustacchi boolean_t BnxeFcoeDisableConnCqe(um_device_t * pUM,
874*d14abf15SRobert Mustacchi BnxeFcoeState * pFcoeState,
875*d14abf15SRobert Mustacchi struct fcoe_kcqe * kcqe);
876*d14abf15SRobert Mustacchi boolean_t BnxeFcoeDestroyConnCqe(um_device_t * pUM,
877*d14abf15SRobert Mustacchi BnxeFcoeState * pFcoeState,
878*d14abf15SRobert Mustacchi struct fcoe_kcqe * kcqe);
879*d14abf15SRobert Mustacchi boolean_t BnxeFcoeDestroyCqe(um_device_t * pUM,
880*d14abf15SRobert Mustacchi struct fcoe_kcqe * kcqe);
881*d14abf15SRobert Mustacchi boolean_t BnxeFcoeStatCqe(um_device_t * pUM,
882*d14abf15SRobert Mustacchi struct fcoe_kcqe * kcqe);
883*d14abf15SRobert Mustacchi boolean_t BnxeFcoeCompRequestCqe(um_device_t * pUM,
884*d14abf15SRobert Mustacchi struct fcoe_kcqe * kcqes,
885*d14abf15SRobert Mustacchi u32_t num_kcqes);
886*d14abf15SRobert Mustacchi boolean_t BnxeFcoePrvCtl(dev_info_t * pDev,
887*d14abf15SRobert Mustacchi int cmd,
888*d14abf15SRobert Mustacchi void * pData,
889*d14abf15SRobert Mustacchi int dataLen);
890*d14abf15SRobert Mustacchi mblk_t * BnxeFcoePrvTx(dev_info_t * pDev,
891*d14abf15SRobert Mustacchi mblk_t * pMblk,
892*d14abf15SRobert Mustacchi u32_t flags,
893*d14abf15SRobert Mustacchi u16_t vlan_tag);
894*d14abf15SRobert Mustacchi boolean_t BnxeFcoePrvPoll(dev_info_t * pDev);
895*d14abf15SRobert Mustacchi boolean_t BnxeFcoePrvSendWqes(dev_info_t * pDev,
896*d14abf15SRobert Mustacchi void * wqes[],
897*d14abf15SRobert Mustacchi int wqeCnt);
898*d14abf15SRobert Mustacchi boolean_t BnxeFcoePrvMapMailboxq(dev_info_t * pDev,
899*d14abf15SRobert Mustacchi u32_t cid,
900*d14abf15SRobert Mustacchi void ** ppMap,
901*d14abf15SRobert Mustacchi ddi_acc_handle_t * pAccHandle);
902*d14abf15SRobert Mustacchi boolean_t BnxeFcoePrvUnmapMailboxq(dev_info_t * pDev,
903*d14abf15SRobert Mustacchi u32_t cid,
904*d14abf15SRobert Mustacchi void * pMap,
905*d14abf15SRobert Mustacchi ddi_acc_handle_t accHandle);
906*d14abf15SRobert Mustacchi int BnxeFcoeInit(um_device_t * pUM);
907*d14abf15SRobert Mustacchi int BnxeFcoeFini(um_device_t * pUM);
908*d14abf15SRobert Mustacchi void BnxeFcoeStartStop(um_device_t * pUM);
909*d14abf15SRobert Mustacchi
910*d14abf15SRobert Mustacchi /* bnxe_main.c */
911*d14abf15SRobert Mustacchi u8_t BnxeInstance(void * pDev);
912*d14abf15SRobert Mustacchi char * BnxeDevName(void * pDev);
913*d14abf15SRobert Mustacchi boolean_t BnxeProtoSupport(um_device_t * pUM, int proto);
914*d14abf15SRobert Mustacchi boolean_t BnxeProtoFcoeAfex(um_device_t * pUM);
915*d14abf15SRobert Mustacchi int BnxeCheckAccHandle(ddi_acc_handle_t handle);
916*d14abf15SRobert Mustacchi int BnxeCheckDmaHandle(ddi_dma_handle_t handle);
917*d14abf15SRobert Mustacchi void BnxeFmErrorReport(um_device_t * pUM, char * detail);
918*d14abf15SRobert Mustacchi
919*d14abf15SRobert Mustacchi extern kmutex_t bnxeLoaderMutex;
920*d14abf15SRobert Mustacchi extern u32_t bnxeNumPlumbed;
921*d14abf15SRobert Mustacchi
922*d14abf15SRobert Mustacchi extern BnxeLinkCfg bnxeLinkCfg;
923*d14abf15SRobert Mustacchi
924*d14abf15SRobert Mustacchi /* undefine this to help with dtrace analysis */
925*d14abf15SRobert Mustacchi #define BNXE_LOCKS_INLINE
926*d14abf15SRobert Mustacchi
927*d14abf15SRobert Mustacchi #ifdef BNXE_LOCKS_INLINE
928*d14abf15SRobert Mustacchi
929*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_INTR(pUM, idx) mutex_enter(&(pUM)->intrMutex[(idx)])
930*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_INTR(pUM, idx) mutex_exit(&(pUM)->intrMutex[(idx)])
931*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_INTR_FLIP(pUM, idx) mutex_enter(&(pUM)->intrFlipMutex[(idx)])
932*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_INTR_FLIP(pUM, idx) mutex_exit(&(pUM)->intrFlipMutex[(idx)])
933*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_TX(pUM, idx) mutex_enter(&(pUM)->txq[(idx)].txMutex)
934*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_TX(pUM, idx) mutex_exit(&(pUM)->txq[(idx)].txMutex)
935*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_FREETX(pUM, idx) mutex_enter(&(pUM)->txq[(idx)].freeTxDescMutex)
936*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_FREETX(pUM, idx) mutex_exit(&(pUM)->txq[(idx)].freeTxDescMutex)
937*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_RX(pUM, idx) mutex_enter(&(pUM)->rxq[(idx)].rxMutex)
938*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_RX(pUM, idx) mutex_exit(&(pUM)->rxq[(idx)].rxMutex)
939*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_DONERX(pUM, idx) mutex_enter(&(pUM)->rxq[(idx)].doneRxMutex)
940*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_DONERX(pUM, idx) mutex_exit(&(pUM)->rxq[(idx)].doneRxMutex)
941*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_SB(pUM, idx) mutex_enter(&(pUM)->sbMutex[(idx)])
942*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_SB(pUM, idx) mutex_exit(&(pUM)->sbMutex[(idx)])
943*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_ETH_CON(pUM) mutex_enter(&(pUM)->ethConMutex)
944*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_ETH_CON(pUM) mutex_exit(&(pUM)->ethConMutex)
945*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_MCP(pUM) mutex_enter(&(pUM)->mcpMutex)
946*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_MCP(pUM) mutex_exit(&(pUM)->mcpMutex)
947*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_PHY(pUM) mutex_enter(&(pUM)->phyMutex)
948*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_PHY(pUM) mutex_exit(&(pUM)->phyMutex)
949*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_IND(pUM) mutex_enter(&(pUM)->indMutex)
950*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_IND(pUM) mutex_exit(&(pUM)->indMutex)
951*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_CID(pUM) mutex_enter(&(pUM)->cidMutex)
952*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_CID(pUM) mutex_exit(&(pUM)->cidMutex)
953*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_SPQ(pUM) mutex_enter(&(pUM)->spqMutex)
954*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_SPQ(pUM) mutex_exit(&(pUM)->spqMutex)
955*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_SPREQ(pUM) mutex_enter(&(pUM)->spReqMutex)
956*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_SPREQ(pUM) mutex_exit(&(pUM)->spReqMutex)
957*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_RRREQ(pUM) mutex_enter(&(pUM)->rrReqMutex)
958*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_RRREQ(pUM) mutex_exit(&(pUM)->rrReqMutex)
959*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_ISLES_CONTROL(pUM) mutex_enter(&(pUM)->islesCtrlMutex)
960*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_ISLES_CONTROL(pUM) mutex_exit(&(pUM)->islesCtrlMutex)
961*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_TOE(pUM) mutex_enter(&(pUM)->toeMutex)
962*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_TOE(pUM) mutex_exit(&(pUM)->toeMutex)
963*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_MEM(pUM) mutex_enter(&(pUM)->memMutex)
964*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_MEM(pUM) mutex_exit(&(pUM)->memMutex)
965*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_OFFLOAD(pUM) mutex_enter(&(pUM)->offloadMutex)
966*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_OFFLOAD(pUM) mutex_exit(&(pUM)->offloadMutex)
967*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_HWINIT(pUM) mutex_enter(&(pUM)->hwInitMutex)
968*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_HWINIT(pUM) mutex_exit(&(pUM)->hwInitMutex)
969*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_GLD(pUM) mutex_enter(&(pUM)->gldMutex)
970*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_GLD(pUM) mutex_exit(&(pUM)->gldMutex)
971*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_GLDTX(pUM, rw) rw_enter(&(pUM)->gldTxMutex, (rw))
972*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_GLDTX(pUM) rw_exit(&(pUM)->gldTxMutex)
973*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_TIMER(pUM) mutex_enter(&(pUM)->timerMutex)
974*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_TIMER(pUM) mutex_exit(&(pUM)->timerMutex)
975*d14abf15SRobert Mustacchi #define BNXE_LOCK_ENTER_STATS(pUM) mutex_enter(&(pUM)->kstatMutex)
976*d14abf15SRobert Mustacchi #define BNXE_LOCK_EXIT_STATS(pUM) mutex_exit(&(pUM)->kstatMutex)
977*d14abf15SRobert Mustacchi
978*d14abf15SRobert Mustacchi #else /* not BNXE_LOCKS_INLINE */
979*d14abf15SRobert Mustacchi
980*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_INTR(um_device_t * pUM, int idx);
981*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_INTR(um_device_t * pUM, int idx);
982*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_INTR_FLIP(um_device_t * pUM, int idx);
983*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_INTR_FLIP(um_device_t * pUM, int idx);
984*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_TX(um_device_t * pUM, int idx);
985*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_TX(um_device_t * pUM, int idx);
986*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_FREETX(um_device_t * pUM, int idx);
987*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_FREETX(um_device_t * pUM, int idx);
988*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_RX(um_device_t * pUM, int idx);
989*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_RX(um_device_t * pUM, int idx);
990*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_DONERX(um_device_t * pUM, int idx);
991*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_DONERX(um_device_t * pUM, int idx);
992*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_SB(um_device_t * pUM, int idx);
993*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_SB(um_device_t * pUM, int idx);
994*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_ETH_CON(um_device_t * pUM);
995*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_ETH_CON(um_device_t * pUM);
996*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_MCP(um_device_t * pUM);
997*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_MCP(um_device_t * pUM);
998*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_PHY(um_device_t * pUM);
999*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_PHY(um_device_t * pUM);
1000*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_IND(um_device_t * pUM);
1001*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_IND(um_device_t * pUM);
1002*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_CID(um_device_t * pUM);
1003*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_CID(um_device_t * pUM);
1004*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_SPQ(um_device_t * pUM);
1005*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_SPQ(um_device_t * pUM);
1006*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_SPREQ(um_device_t * pUM);
1007*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_SPREQ(um_device_t * pUM);
1008*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_RRREQ(um_device_t * pUM);
1009*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_RRREQ(um_device_t * pUM);
1010*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_ISLES_CONTROL(um_device_t * pUM);
1011*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_ISLES_CONTROL(um_device_t * pUM);
1012*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_MEM(um_device_t * pUM);
1013*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_MEM(um_device_t * pUM);
1014*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_GLD(um_device_t * pUM);
1015*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_GLD(um_device_t * pUM);
1016*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_GLDTX(um_device_t * pUM, krw_t rw);
1017*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_GLDTX(um_device_t * pUM);
1018*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_TIMER(um_device_t * pUM);
1019*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_TIMER(um_device_t * pUM);
1020*d14abf15SRobert Mustacchi void BNXE_LOCK_ENTER_STATS(um_device_t * pUM);
1021*d14abf15SRobert Mustacchi void BNXE_LOCK_EXIT_STATS(um_device_t * pUM);
1022*d14abf15SRobert Mustacchi
1023*d14abf15SRobert Mustacchi #endif /* BNXE_LOCKS_INLINE */
1024*d14abf15SRobert Mustacchi
1025*d14abf15SRobert Mustacchi #define CATC_TRIGGER(lmdev, data) { \
1026*d14abf15SRobert Mustacchi REG_WR((lmdev), 0x2000, (data)); \
1027*d14abf15SRobert Mustacchi }
1028*d14abf15SRobert Mustacchi #define CATC_TRIGGER_START(lmdev) CATC_TRIGGER((lmdev), 0xcafecafe)
1029*d14abf15SRobert Mustacchi
1030*d14abf15SRobert Mustacchi void BnxeDumpMem(um_device_t * pUM,
1031*d14abf15SRobert Mustacchi char * pTag,
1032*d14abf15SRobert Mustacchi u8_t * pMem,
1033*d14abf15SRobert Mustacchi u32_t len);
1034*d14abf15SRobert Mustacchi void BnxeDumpPkt(um_device_t * pUM,
1035*d14abf15SRobert Mustacchi char * pTag,
1036*d14abf15SRobert Mustacchi mblk_t * pMblk,
1037*d14abf15SRobert Mustacchi boolean_t contents);
1038*d14abf15SRobert Mustacchi
1039*d14abf15SRobert Mustacchi /* XXX yuck (beware return strings lengths with kstat and mdb) */
1040*d14abf15SRobert Mustacchi
BnxeIsClientBound(um_device_t * pUM)1041*d14abf15SRobert Mustacchi inline boolean_t BnxeIsClientBound(um_device_t * pUM)
1042*d14abf15SRobert Mustacchi {
1043*d14abf15SRobert Mustacchi return (CLIENT_HW(pUM, LM_CLI_IDX_NDIS) ||
1044*d14abf15SRobert Mustacchi CLIENT_BOUND(pUM, LM_CLI_IDX_FCOE));
1045*d14abf15SRobert Mustacchi }
1046*d14abf15SRobert Mustacchi
BnxeClientsHw(um_device_t * pUM)1047*d14abf15SRobert Mustacchi inline char * BnxeClientsHw(um_device_t * pUM)
1048*d14abf15SRobert Mustacchi {
1049*d14abf15SRobert Mustacchi if (CLIENT_HW(pUM, LM_CLI_IDX_NDIS) &&
1050*d14abf15SRobert Mustacchi CLIENT_HW(pUM, LM_CLI_IDX_FCOE)) { return "L2,FCoE"; }
1051*d14abf15SRobert Mustacchi else if (CLIENT_HW(pUM, LM_CLI_IDX_NDIS)) { return "L2"; }
1052*d14abf15SRobert Mustacchi else if (CLIENT_HW(pUM, LM_CLI_IDX_FCOE)) { return "FCoE"; }
1053*d14abf15SRobert Mustacchi else { return "None"; }
1054*d14abf15SRobert Mustacchi }
1055*d14abf15SRobert Mustacchi
BnxeClientsDevi(um_device_t * pUM)1056*d14abf15SRobert Mustacchi inline char * BnxeClientsDevi(um_device_t * pUM)
1057*d14abf15SRobert Mustacchi {
1058*d14abf15SRobert Mustacchi if (CLIENT_DEVI(pUM, LM_CLI_IDX_FCOE)) { return "FCoE"; }
1059*d14abf15SRobert Mustacchi else { return "None"; }
1060*d14abf15SRobert Mustacchi }
1061*d14abf15SRobert Mustacchi
BnxeClientsBound(um_device_t * pUM)1062*d14abf15SRobert Mustacchi inline char * BnxeClientsBound(um_device_t * pUM)
1063*d14abf15SRobert Mustacchi {
1064*d14abf15SRobert Mustacchi if (CLIENT_HW(pUM, LM_CLI_IDX_NDIS) &&
1065*d14abf15SRobert Mustacchi CLIENT_BOUND(pUM, LM_CLI_IDX_FCOE)) { return "L2,FCoE"; }
1066*d14abf15SRobert Mustacchi else if (CLIENT_HW(pUM, LM_CLI_IDX_NDIS)) { return "L2"; }
1067*d14abf15SRobert Mustacchi else if (CLIENT_BOUND(pUM, LM_CLI_IDX_FCOE)) { return "FCoE"; }
1068*d14abf15SRobert Mustacchi else { return "None"; }
1069*d14abf15SRobert Mustacchi }
1070*d14abf15SRobert Mustacchi
1071*d14abf15SRobert Mustacchi #endif /* BNXE_H */
1072*d14abf15SRobert Mustacchi
1073