cxgb4: Add LE hash collision bug fix path in LLD driver
[linux-2.6-block.git] / drivers / net / ethernet / chelsio / cxgb4 / t4fw_api.h
CommitLineData
bbc02c7e
DM
1/*
2 * This file is part of the Chelsio T4 Ethernet driver for Linux.
3 *
4 * Copyright (c) 2009-2010 Chelsio Communications, Inc. All rights reserved.
5 *
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
11 *
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
14 * conditions are met:
15 *
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer.
19 *
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 * SOFTWARE.
33 */
34
35#ifndef _T4FW_INTERFACE_H_
36#define _T4FW_INTERFACE_H_
37
f2b7e78d
VP
38enum fw_ret_val {
39 FW_ENOEXEC = 8, /* Exec format error; inv microcode */
40};
41
bbc02c7e
DM
42#define FW_T4VF_SGE_BASE_ADDR 0x0000
43#define FW_T4VF_MPS_BASE_ADDR 0x0100
44#define FW_T4VF_PL_BASE_ADDR 0x0200
45#define FW_T4VF_MBDATA_BASE_ADDR 0x0240
46#define FW_T4VF_CIM_BASE_ADDR 0x0300
47
48enum fw_wr_opcodes {
49 FW_FILTER_WR = 0x02,
50 FW_ULPTX_WR = 0x04,
51 FW_TP_WR = 0x05,
52 FW_ETH_TX_PKT_WR = 0x08,
53 FW_FLOWC_WR = 0x0a,
54 FW_OFLD_TX_DATA_WR = 0x0b,
55 FW_CMD_WR = 0x10,
56 FW_ETH_TX_PKT_VM_WR = 0x11,
57 FW_RI_RES_WR = 0x0c,
58 FW_RI_INIT_WR = 0x0d,
59 FW_RI_RDMA_WRITE_WR = 0x14,
60 FW_RI_SEND_WR = 0x15,
61 FW_RI_RDMA_READ_WR = 0x16,
62 FW_RI_RECV_WR = 0x17,
63 FW_RI_BIND_MW_WR = 0x18,
64 FW_RI_FR_NSMR_WR = 0x19,
65 FW_RI_INV_LSTAG_WR = 0x1a,
66 FW_LASTC2E_WR = 0x40
67};
68
69struct fw_wr_hdr {
70 __be32 hi;
71 __be32 lo;
72};
73
74#define FW_WR_OP(x) ((x) << 24)
ce91a923 75#define FW_WR_OP_GET(x) (((x) >> 24) & 0xff)
bbc02c7e
DM
76#define FW_WR_ATOMIC(x) ((x) << 23)
77#define FW_WR_FLUSH(x) ((x) << 22)
78#define FW_WR_COMPL(x) ((x) << 21)
81323b74 79#define FW_WR_IMMDLEN_MASK 0xff
bbc02c7e
DM
80#define FW_WR_IMMDLEN(x) ((x) << 0)
81
82#define FW_WR_EQUIQ (1U << 31)
83#define FW_WR_EQUEQ (1U << 30)
84#define FW_WR_FLOWID(x) ((x) << 8)
85#define FW_WR_LEN16(x) ((x) << 0)
86
13ee15d3
VP
87#define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
88
f2b7e78d
VP
89/* filter wr reply code in cookie in CPL_SET_TCB_RPL */
90enum fw_filter_wr_cookie {
91 FW_FILTER_WR_SUCCESS,
92 FW_FILTER_WR_FLT_ADDED,
93 FW_FILTER_WR_FLT_DELETED,
94 FW_FILTER_WR_SMT_TBL_FULL,
95 FW_FILTER_WR_EINVAL,
96};
97
98struct fw_filter_wr {
99 __be32 op_pkd;
100 __be32 len16_pkd;
101 __be64 r3;
102 __be32 tid_to_iq;
103 __be32 del_filter_to_l2tix;
104 __be16 ethtype;
105 __be16 ethtypem;
106 __u8 frag_to_ovlan_vldm;
107 __u8 smac_sel;
108 __be16 rx_chan_rx_rpl_iq;
109 __be32 maci_to_matchtypem;
110 __u8 ptcl;
111 __u8 ptclm;
112 __u8 ttyp;
113 __u8 ttypm;
114 __be16 ivlan;
115 __be16 ivlanm;
116 __be16 ovlan;
117 __be16 ovlanm;
118 __u8 lip[16];
119 __u8 lipm[16];
120 __u8 fip[16];
121 __u8 fipm[16];
122 __be16 lp;
123 __be16 lpm;
124 __be16 fp;
125 __be16 fpm;
126 __be16 r7;
127 __u8 sma[6];
128};
129
130#define S_FW_FILTER_WR_TID 12
131#define M_FW_FILTER_WR_TID 0xfffff
132#define V_FW_FILTER_WR_TID(x) ((x) << S_FW_FILTER_WR_TID)
133#define G_FW_FILTER_WR_TID(x) \
134 (((x) >> S_FW_FILTER_WR_TID) & M_FW_FILTER_WR_TID)
135
136#define S_FW_FILTER_WR_RQTYPE 11
137#define M_FW_FILTER_WR_RQTYPE 0x1
138#define V_FW_FILTER_WR_RQTYPE(x) ((x) << S_FW_FILTER_WR_RQTYPE)
139#define G_FW_FILTER_WR_RQTYPE(x) \
140 (((x) >> S_FW_FILTER_WR_RQTYPE) & M_FW_FILTER_WR_RQTYPE)
141#define F_FW_FILTER_WR_RQTYPE V_FW_FILTER_WR_RQTYPE(1U)
142
143#define S_FW_FILTER_WR_NOREPLY 10
144#define M_FW_FILTER_WR_NOREPLY 0x1
145#define V_FW_FILTER_WR_NOREPLY(x) ((x) << S_FW_FILTER_WR_NOREPLY)
146#define G_FW_FILTER_WR_NOREPLY(x) \
147 (((x) >> S_FW_FILTER_WR_NOREPLY) & M_FW_FILTER_WR_NOREPLY)
148#define F_FW_FILTER_WR_NOREPLY V_FW_FILTER_WR_NOREPLY(1U)
149
150#define S_FW_FILTER_WR_IQ 0
151#define M_FW_FILTER_WR_IQ 0x3ff
152#define V_FW_FILTER_WR_IQ(x) ((x) << S_FW_FILTER_WR_IQ)
153#define G_FW_FILTER_WR_IQ(x) \
154 (((x) >> S_FW_FILTER_WR_IQ) & M_FW_FILTER_WR_IQ)
155
156#define S_FW_FILTER_WR_DEL_FILTER 31
157#define M_FW_FILTER_WR_DEL_FILTER 0x1
158#define V_FW_FILTER_WR_DEL_FILTER(x) ((x) << S_FW_FILTER_WR_DEL_FILTER)
159#define G_FW_FILTER_WR_DEL_FILTER(x) \
160 (((x) >> S_FW_FILTER_WR_DEL_FILTER) & M_FW_FILTER_WR_DEL_FILTER)
161#define F_FW_FILTER_WR_DEL_FILTER V_FW_FILTER_WR_DEL_FILTER(1U)
162
163#define S_FW_FILTER_WR_RPTTID 25
164#define M_FW_FILTER_WR_RPTTID 0x1
165#define V_FW_FILTER_WR_RPTTID(x) ((x) << S_FW_FILTER_WR_RPTTID)
166#define G_FW_FILTER_WR_RPTTID(x) \
167 (((x) >> S_FW_FILTER_WR_RPTTID) & M_FW_FILTER_WR_RPTTID)
168#define F_FW_FILTER_WR_RPTTID V_FW_FILTER_WR_RPTTID(1U)
169
170#define S_FW_FILTER_WR_DROP 24
171#define M_FW_FILTER_WR_DROP 0x1
172#define V_FW_FILTER_WR_DROP(x) ((x) << S_FW_FILTER_WR_DROP)
173#define G_FW_FILTER_WR_DROP(x) \
174 (((x) >> S_FW_FILTER_WR_DROP) & M_FW_FILTER_WR_DROP)
175#define F_FW_FILTER_WR_DROP V_FW_FILTER_WR_DROP(1U)
176
177#define S_FW_FILTER_WR_DIRSTEER 23
178#define M_FW_FILTER_WR_DIRSTEER 0x1
179#define V_FW_FILTER_WR_DIRSTEER(x) ((x) << S_FW_FILTER_WR_DIRSTEER)
180#define G_FW_FILTER_WR_DIRSTEER(x) \
181 (((x) >> S_FW_FILTER_WR_DIRSTEER) & M_FW_FILTER_WR_DIRSTEER)
182#define F_FW_FILTER_WR_DIRSTEER V_FW_FILTER_WR_DIRSTEER(1U)
183
184#define S_FW_FILTER_WR_MASKHASH 22
185#define M_FW_FILTER_WR_MASKHASH 0x1
186#define V_FW_FILTER_WR_MASKHASH(x) ((x) << S_FW_FILTER_WR_MASKHASH)
187#define G_FW_FILTER_WR_MASKHASH(x) \
188 (((x) >> S_FW_FILTER_WR_MASKHASH) & M_FW_FILTER_WR_MASKHASH)
189#define F_FW_FILTER_WR_MASKHASH V_FW_FILTER_WR_MASKHASH(1U)
190
191#define S_FW_FILTER_WR_DIRSTEERHASH 21
192#define M_FW_FILTER_WR_DIRSTEERHASH 0x1
193#define V_FW_FILTER_WR_DIRSTEERHASH(x) ((x) << S_FW_FILTER_WR_DIRSTEERHASH)
194#define G_FW_FILTER_WR_DIRSTEERHASH(x) \
195 (((x) >> S_FW_FILTER_WR_DIRSTEERHASH) & M_FW_FILTER_WR_DIRSTEERHASH)
196#define F_FW_FILTER_WR_DIRSTEERHASH V_FW_FILTER_WR_DIRSTEERHASH(1U)
197
198#define S_FW_FILTER_WR_LPBK 20
199#define M_FW_FILTER_WR_LPBK 0x1
200#define V_FW_FILTER_WR_LPBK(x) ((x) << S_FW_FILTER_WR_LPBK)
201#define G_FW_FILTER_WR_LPBK(x) \
202 (((x) >> S_FW_FILTER_WR_LPBK) & M_FW_FILTER_WR_LPBK)
203#define F_FW_FILTER_WR_LPBK V_FW_FILTER_WR_LPBK(1U)
204
205#define S_FW_FILTER_WR_DMAC 19
206#define M_FW_FILTER_WR_DMAC 0x1
207#define V_FW_FILTER_WR_DMAC(x) ((x) << S_FW_FILTER_WR_DMAC)
208#define G_FW_FILTER_WR_DMAC(x) \
209 (((x) >> S_FW_FILTER_WR_DMAC) & M_FW_FILTER_WR_DMAC)
210#define F_FW_FILTER_WR_DMAC V_FW_FILTER_WR_DMAC(1U)
211
212#define S_FW_FILTER_WR_SMAC 18
213#define M_FW_FILTER_WR_SMAC 0x1
214#define V_FW_FILTER_WR_SMAC(x) ((x) << S_FW_FILTER_WR_SMAC)
215#define G_FW_FILTER_WR_SMAC(x) \
216 (((x) >> S_FW_FILTER_WR_SMAC) & M_FW_FILTER_WR_SMAC)
217#define F_FW_FILTER_WR_SMAC V_FW_FILTER_WR_SMAC(1U)
218
219#define S_FW_FILTER_WR_INSVLAN 17
220#define M_FW_FILTER_WR_INSVLAN 0x1
221#define V_FW_FILTER_WR_INSVLAN(x) ((x) << S_FW_FILTER_WR_INSVLAN)
222#define G_FW_FILTER_WR_INSVLAN(x) \
223 (((x) >> S_FW_FILTER_WR_INSVLAN) & M_FW_FILTER_WR_INSVLAN)
224#define F_FW_FILTER_WR_INSVLAN V_FW_FILTER_WR_INSVLAN(1U)
225
226#define S_FW_FILTER_WR_RMVLAN 16
227#define M_FW_FILTER_WR_RMVLAN 0x1
228#define V_FW_FILTER_WR_RMVLAN(x) ((x) << S_FW_FILTER_WR_RMVLAN)
229#define G_FW_FILTER_WR_RMVLAN(x) \
230 (((x) >> S_FW_FILTER_WR_RMVLAN) & M_FW_FILTER_WR_RMVLAN)
231#define F_FW_FILTER_WR_RMVLAN V_FW_FILTER_WR_RMVLAN(1U)
232
233#define S_FW_FILTER_WR_HITCNTS 15
234#define M_FW_FILTER_WR_HITCNTS 0x1
235#define V_FW_FILTER_WR_HITCNTS(x) ((x) << S_FW_FILTER_WR_HITCNTS)
236#define G_FW_FILTER_WR_HITCNTS(x) \
237 (((x) >> S_FW_FILTER_WR_HITCNTS) & M_FW_FILTER_WR_HITCNTS)
238#define F_FW_FILTER_WR_HITCNTS V_FW_FILTER_WR_HITCNTS(1U)
239
240#define S_FW_FILTER_WR_TXCHAN 13
241#define M_FW_FILTER_WR_TXCHAN 0x3
242#define V_FW_FILTER_WR_TXCHAN(x) ((x) << S_FW_FILTER_WR_TXCHAN)
243#define G_FW_FILTER_WR_TXCHAN(x) \
244 (((x) >> S_FW_FILTER_WR_TXCHAN) & M_FW_FILTER_WR_TXCHAN)
245
246#define S_FW_FILTER_WR_PRIO 12
247#define M_FW_FILTER_WR_PRIO 0x1
248#define V_FW_FILTER_WR_PRIO(x) ((x) << S_FW_FILTER_WR_PRIO)
249#define G_FW_FILTER_WR_PRIO(x) \
250 (((x) >> S_FW_FILTER_WR_PRIO) & M_FW_FILTER_WR_PRIO)
251#define F_FW_FILTER_WR_PRIO V_FW_FILTER_WR_PRIO(1U)
252
253#define S_FW_FILTER_WR_L2TIX 0
254#define M_FW_FILTER_WR_L2TIX 0xfff
255#define V_FW_FILTER_WR_L2TIX(x) ((x) << S_FW_FILTER_WR_L2TIX)
256#define G_FW_FILTER_WR_L2TIX(x) \
257 (((x) >> S_FW_FILTER_WR_L2TIX) & M_FW_FILTER_WR_L2TIX)
258
259#define S_FW_FILTER_WR_FRAG 7
260#define M_FW_FILTER_WR_FRAG 0x1
261#define V_FW_FILTER_WR_FRAG(x) ((x) << S_FW_FILTER_WR_FRAG)
262#define G_FW_FILTER_WR_FRAG(x) \
263 (((x) >> S_FW_FILTER_WR_FRAG) & M_FW_FILTER_WR_FRAG)
264#define F_FW_FILTER_WR_FRAG V_FW_FILTER_WR_FRAG(1U)
265
266#define S_FW_FILTER_WR_FRAGM 6
267#define M_FW_FILTER_WR_FRAGM 0x1
268#define V_FW_FILTER_WR_FRAGM(x) ((x) << S_FW_FILTER_WR_FRAGM)
269#define G_FW_FILTER_WR_FRAGM(x) \
270 (((x) >> S_FW_FILTER_WR_FRAGM) & M_FW_FILTER_WR_FRAGM)
271#define F_FW_FILTER_WR_FRAGM V_FW_FILTER_WR_FRAGM(1U)
272
273#define S_FW_FILTER_WR_IVLAN_VLD 5
274#define M_FW_FILTER_WR_IVLAN_VLD 0x1
275#define V_FW_FILTER_WR_IVLAN_VLD(x) ((x) << S_FW_FILTER_WR_IVLAN_VLD)
276#define G_FW_FILTER_WR_IVLAN_VLD(x) \
277 (((x) >> S_FW_FILTER_WR_IVLAN_VLD) & M_FW_FILTER_WR_IVLAN_VLD)
278#define F_FW_FILTER_WR_IVLAN_VLD V_FW_FILTER_WR_IVLAN_VLD(1U)
279
280#define S_FW_FILTER_WR_OVLAN_VLD 4
281#define M_FW_FILTER_WR_OVLAN_VLD 0x1
282#define V_FW_FILTER_WR_OVLAN_VLD(x) ((x) << S_FW_FILTER_WR_OVLAN_VLD)
283#define G_FW_FILTER_WR_OVLAN_VLD(x) \
284 (((x) >> S_FW_FILTER_WR_OVLAN_VLD) & M_FW_FILTER_WR_OVLAN_VLD)
285#define F_FW_FILTER_WR_OVLAN_VLD V_FW_FILTER_WR_OVLAN_VLD(1U)
286
287#define S_FW_FILTER_WR_IVLAN_VLDM 3
288#define M_FW_FILTER_WR_IVLAN_VLDM 0x1
289#define V_FW_FILTER_WR_IVLAN_VLDM(x) ((x) << S_FW_FILTER_WR_IVLAN_VLDM)
290#define G_FW_FILTER_WR_IVLAN_VLDM(x) \
291 (((x) >> S_FW_FILTER_WR_IVLAN_VLDM) & M_FW_FILTER_WR_IVLAN_VLDM)
292#define F_FW_FILTER_WR_IVLAN_VLDM V_FW_FILTER_WR_IVLAN_VLDM(1U)
293
294#define S_FW_FILTER_WR_OVLAN_VLDM 2
295#define M_FW_FILTER_WR_OVLAN_VLDM 0x1
296#define V_FW_FILTER_WR_OVLAN_VLDM(x) ((x) << S_FW_FILTER_WR_OVLAN_VLDM)
297#define G_FW_FILTER_WR_OVLAN_VLDM(x) \
298 (((x) >> S_FW_FILTER_WR_OVLAN_VLDM) & M_FW_FILTER_WR_OVLAN_VLDM)
299#define F_FW_FILTER_WR_OVLAN_VLDM V_FW_FILTER_WR_OVLAN_VLDM(1U)
300
301#define S_FW_FILTER_WR_RX_CHAN 15
302#define M_FW_FILTER_WR_RX_CHAN 0x1
303#define V_FW_FILTER_WR_RX_CHAN(x) ((x) << S_FW_FILTER_WR_RX_CHAN)
304#define G_FW_FILTER_WR_RX_CHAN(x) \
305 (((x) >> S_FW_FILTER_WR_RX_CHAN) & M_FW_FILTER_WR_RX_CHAN)
306#define F_FW_FILTER_WR_RX_CHAN V_FW_FILTER_WR_RX_CHAN(1U)
307
308#define S_FW_FILTER_WR_RX_RPL_IQ 0
309#define M_FW_FILTER_WR_RX_RPL_IQ 0x3ff
310#define V_FW_FILTER_WR_RX_RPL_IQ(x) ((x) << S_FW_FILTER_WR_RX_RPL_IQ)
311#define G_FW_FILTER_WR_RX_RPL_IQ(x) \
312 (((x) >> S_FW_FILTER_WR_RX_RPL_IQ) & M_FW_FILTER_WR_RX_RPL_IQ)
313
314#define S_FW_FILTER_WR_MACI 23
315#define M_FW_FILTER_WR_MACI 0x1ff
316#define V_FW_FILTER_WR_MACI(x) ((x) << S_FW_FILTER_WR_MACI)
317#define G_FW_FILTER_WR_MACI(x) \
318 (((x) >> S_FW_FILTER_WR_MACI) & M_FW_FILTER_WR_MACI)
319
320#define S_FW_FILTER_WR_MACIM 14
321#define M_FW_FILTER_WR_MACIM 0x1ff
322#define V_FW_FILTER_WR_MACIM(x) ((x) << S_FW_FILTER_WR_MACIM)
323#define G_FW_FILTER_WR_MACIM(x) \
324 (((x) >> S_FW_FILTER_WR_MACIM) & M_FW_FILTER_WR_MACIM)
325
326#define S_FW_FILTER_WR_FCOE 13
327#define M_FW_FILTER_WR_FCOE 0x1
328#define V_FW_FILTER_WR_FCOE(x) ((x) << S_FW_FILTER_WR_FCOE)
329#define G_FW_FILTER_WR_FCOE(x) \
330 (((x) >> S_FW_FILTER_WR_FCOE) & M_FW_FILTER_WR_FCOE)
331#define F_FW_FILTER_WR_FCOE V_FW_FILTER_WR_FCOE(1U)
332
333#define S_FW_FILTER_WR_FCOEM 12
334#define M_FW_FILTER_WR_FCOEM 0x1
335#define V_FW_FILTER_WR_FCOEM(x) ((x) << S_FW_FILTER_WR_FCOEM)
336#define G_FW_FILTER_WR_FCOEM(x) \
337 (((x) >> S_FW_FILTER_WR_FCOEM) & M_FW_FILTER_WR_FCOEM)
338#define F_FW_FILTER_WR_FCOEM V_FW_FILTER_WR_FCOEM(1U)
339
340#define S_FW_FILTER_WR_PORT 9
341#define M_FW_FILTER_WR_PORT 0x7
342#define V_FW_FILTER_WR_PORT(x) ((x) << S_FW_FILTER_WR_PORT)
343#define G_FW_FILTER_WR_PORT(x) \
344 (((x) >> S_FW_FILTER_WR_PORT) & M_FW_FILTER_WR_PORT)
345
346#define S_FW_FILTER_WR_PORTM 6
347#define M_FW_FILTER_WR_PORTM 0x7
348#define V_FW_FILTER_WR_PORTM(x) ((x) << S_FW_FILTER_WR_PORTM)
349#define G_FW_FILTER_WR_PORTM(x) \
350 (((x) >> S_FW_FILTER_WR_PORTM) & M_FW_FILTER_WR_PORTM)
351
352#define S_FW_FILTER_WR_MATCHTYPE 3
353#define M_FW_FILTER_WR_MATCHTYPE 0x7
354#define V_FW_FILTER_WR_MATCHTYPE(x) ((x) << S_FW_FILTER_WR_MATCHTYPE)
355#define G_FW_FILTER_WR_MATCHTYPE(x) \
356 (((x) >> S_FW_FILTER_WR_MATCHTYPE) & M_FW_FILTER_WR_MATCHTYPE)
357
358#define S_FW_FILTER_WR_MATCHTYPEM 0
359#define M_FW_FILTER_WR_MATCHTYPEM 0x7
360#define V_FW_FILTER_WR_MATCHTYPEM(x) ((x) << S_FW_FILTER_WR_MATCHTYPEM)
361#define G_FW_FILTER_WR_MATCHTYPEM(x) \
362 (((x) >> S_FW_FILTER_WR_MATCHTYPEM) & M_FW_FILTER_WR_MATCHTYPEM)
363
bbc02c7e
DM
364struct fw_ulptx_wr {
365 __be32 op_to_compl;
366 __be32 flowid_len16;
367 u64 cookie;
368};
369
370struct fw_tp_wr {
371 __be32 op_to_immdlen;
372 __be32 flowid_len16;
373 u64 cookie;
374};
375
376struct fw_eth_tx_pkt_wr {
377 __be32 op_immdlen;
378 __be32 equiq_to_len16;
379 __be64 r3;
380};
381
382enum fw_flowc_mnem {
383 FW_FLOWC_MNEM_PFNVFN, /* PFN [15:8] VFN [7:0] */
384 FW_FLOWC_MNEM_CH,
385 FW_FLOWC_MNEM_PORT,
386 FW_FLOWC_MNEM_IQID,
387 FW_FLOWC_MNEM_SNDNXT,
388 FW_FLOWC_MNEM_RCVNXT,
389 FW_FLOWC_MNEM_SNDBUF,
390 FW_FLOWC_MNEM_MSS,
391};
392
393struct fw_flowc_mnemval {
394 u8 mnemonic;
395 u8 r4[3];
396 __be32 val;
397};
398
399struct fw_flowc_wr {
400 __be32 op_to_nparams;
401#define FW_FLOWC_WR_NPARAMS(x) ((x) << 0)
402 __be32 flowid_len16;
403 struct fw_flowc_mnemval mnemval[0];
404};
405
406struct fw_ofld_tx_data_wr {
407 __be32 op_to_immdlen;
408 __be32 flowid_len16;
409 __be32 plen;
410 __be32 tunnel_to_proxy;
411#define FW_OFLD_TX_DATA_WR_TUNNEL(x) ((x) << 19)
412#define FW_OFLD_TX_DATA_WR_SAVE(x) ((x) << 18)
413#define FW_OFLD_TX_DATA_WR_FLUSH(x) ((x) << 17)
414#define FW_OFLD_TX_DATA_WR_URGENT(x) ((x) << 16)
415#define FW_OFLD_TX_DATA_WR_MORE(x) ((x) << 15)
416#define FW_OFLD_TX_DATA_WR_SHOVE(x) ((x) << 14)
417#define FW_OFLD_TX_DATA_WR_ULPMODE(x) ((x) << 10)
418#define FW_OFLD_TX_DATA_WR_ULPSUBMODE(x) ((x) << 6)
419};
420
421struct fw_cmd_wr {
422 __be32 op_dma;
423#define FW_CMD_WR_DMA (1U << 17)
424 __be32 len16_pkd;
425 __be64 cookie_daddr;
426};
427
428struct fw_eth_tx_pkt_vm_wr {
429 __be32 op_immdlen;
430 __be32 equiq_to_len16;
431 __be32 r3[2];
432 u8 ethmacdst[6];
433 u8 ethmacsrc[6];
434 __be16 ethtype;
435 __be16 vlantci;
436};
437
438#define FW_CMD_MAX_TIMEOUT 3000
439
636f9d37
VP
440/*
441 * If a host driver does a HELLO and discovers that there's already a MASTER
442 * selected, we may have to wait for that MASTER to finish issuing RESET,
443 * configuration and INITIALIZE commands. Also, there's a possibility that
444 * our own HELLO may get lost if it happens right as the MASTER is issuign a
445 * RESET command, so we need to be willing to make a few retries of our HELLO.
446 */
447#define FW_CMD_HELLO_TIMEOUT (3 * FW_CMD_MAX_TIMEOUT)
448#define FW_CMD_HELLO_RETRIES 3
449
450
bbc02c7e
DM
451enum fw_cmd_opcodes {
452 FW_LDST_CMD = 0x01,
453 FW_RESET_CMD = 0x03,
454 FW_HELLO_CMD = 0x04,
455 FW_BYE_CMD = 0x05,
456 FW_INITIALIZE_CMD = 0x06,
457 FW_CAPS_CONFIG_CMD = 0x07,
458 FW_PARAMS_CMD = 0x08,
459 FW_PFVF_CMD = 0x09,
460 FW_IQ_CMD = 0x10,
461 FW_EQ_MNGT_CMD = 0x11,
462 FW_EQ_ETH_CMD = 0x12,
463 FW_EQ_CTRL_CMD = 0x13,
464 FW_EQ_OFLD_CMD = 0x21,
465 FW_VI_CMD = 0x14,
466 FW_VI_MAC_CMD = 0x15,
467 FW_VI_RXMODE_CMD = 0x16,
468 FW_VI_ENABLE_CMD = 0x17,
469 FW_ACL_MAC_CMD = 0x18,
470 FW_ACL_VLAN_CMD = 0x19,
471 FW_VI_STATS_CMD = 0x1a,
472 FW_PORT_CMD = 0x1b,
473 FW_PORT_STATS_CMD = 0x1c,
474 FW_PORT_LB_STATS_CMD = 0x1d,
475 FW_PORT_TRACE_CMD = 0x1e,
476 FW_PORT_TRACE_MMAP_CMD = 0x1f,
477 FW_RSS_IND_TBL_CMD = 0x20,
478 FW_RSS_GLB_CONFIG_CMD = 0x22,
479 FW_RSS_VI_CONFIG_CMD = 0x23,
480 FW_LASTC2E_CMD = 0x40,
481 FW_ERROR_CMD = 0x80,
482 FW_DEBUG_CMD = 0x81,
483};
484
485enum fw_cmd_cap {
486 FW_CMD_CAP_PF = 0x01,
487 FW_CMD_CAP_DMAQ = 0x02,
488 FW_CMD_CAP_PORT = 0x04,
489 FW_CMD_CAP_PORTPROMISC = 0x08,
490 FW_CMD_CAP_PORTSTATS = 0x10,
491 FW_CMD_CAP_VF = 0x80,
492};
493
494/*
495 * Generic command header flit0
496 */
497struct fw_cmd_hdr {
498 __be32 hi;
499 __be32 lo;
500};
501
502#define FW_CMD_OP(x) ((x) << 24)
503#define FW_CMD_OP_GET(x) (((x) >> 24) & 0xff)
504#define FW_CMD_REQUEST (1U << 23)
ce91a923 505#define FW_CMD_REQUEST_GET(x) (((x) >> 23) & 0x1)
bbc02c7e
DM
506#define FW_CMD_READ (1U << 22)
507#define FW_CMD_WRITE (1U << 21)
508#define FW_CMD_EXEC (1U << 20)
509#define FW_CMD_RAMASK(x) ((x) << 20)
510#define FW_CMD_RETVAL(x) ((x) << 8)
511#define FW_CMD_RETVAL_GET(x) (((x) >> 8) & 0xff)
512#define FW_CMD_LEN16(x) ((x) << 0)
ce91a923 513#define FW_LEN16(fw_struct) FW_CMD_LEN16(sizeof(fw_struct) / 16)
bbc02c7e
DM
514
515enum fw_ldst_addrspc {
516 FW_LDST_ADDRSPC_FIRMWARE = 0x0001,
517 FW_LDST_ADDRSPC_SGE_EGRC = 0x0008,
518 FW_LDST_ADDRSPC_SGE_INGC = 0x0009,
519 FW_LDST_ADDRSPC_SGE_FLMC = 0x000a,
520 FW_LDST_ADDRSPC_SGE_CONMC = 0x000b,
521 FW_LDST_ADDRSPC_TP_PIO = 0x0010,
522 FW_LDST_ADDRSPC_TP_TM_PIO = 0x0011,
523 FW_LDST_ADDRSPC_TP_MIB = 0x0012,
524 FW_LDST_ADDRSPC_MDIO = 0x0018,
525 FW_LDST_ADDRSPC_MPS = 0x0020,
ce91a923
NKI
526 FW_LDST_ADDRSPC_FUNC = 0x0028,
527 FW_LDST_ADDRSPC_FUNC_PCIE = 0x0029,
bbc02c7e
DM
528};
529
530enum fw_ldst_mps_fid {
531 FW_LDST_MPS_ATRB,
532 FW_LDST_MPS_RPLC
533};
534
535enum fw_ldst_func_access_ctl {
536 FW_LDST_FUNC_ACC_CTL_VIID,
537 FW_LDST_FUNC_ACC_CTL_FID
538};
539
540enum fw_ldst_func_mod_index {
541 FW_LDST_FUNC_MPS
542};
543
544struct fw_ldst_cmd {
545 __be32 op_to_addrspace;
546#define FW_LDST_CMD_ADDRSPACE(x) ((x) << 0)
547 __be32 cycles_to_len16;
548 union fw_ldst {
549 struct fw_ldst_addrval {
550 __be32 addr;
551 __be32 val;
552 } addrval;
553 struct fw_ldst_idctxt {
554 __be32 physid;
555 __be32 msg_pkd;
556 __be32 ctxt_data7;
557 __be32 ctxt_data6;
558 __be32 ctxt_data5;
559 __be32 ctxt_data4;
560 __be32 ctxt_data3;
561 __be32 ctxt_data2;
562 __be32 ctxt_data1;
563 __be32 ctxt_data0;
564 } idctxt;
565 struct fw_ldst_mdio {
566 __be16 paddr_mmd;
567 __be16 raddr;
568 __be16 vctl;
569 __be16 rval;
570 } mdio;
571 struct fw_ldst_mps {
572 __be16 fid_ctl;
573 __be16 rplcpf_pkd;
574 __be32 rplc127_96;
575 __be32 rplc95_64;
576 __be32 rplc63_32;
577 __be32 rplc31_0;
578 __be32 atrb;
579 __be16 vlan[16];
580 } mps;
581 struct fw_ldst_func {
582 u8 access_ctl;
583 u8 mod_index;
584 __be16 ctl_id;
585 __be32 offset;
586 __be64 data0;
587 __be64 data1;
588 } func;
ce91a923
NKI
589 struct fw_ldst_pcie {
590 u8 ctrl_to_fn;
591 u8 bnum;
592 u8 r;
593 u8 ext_r;
594 u8 select_naccess;
595 u8 pcie_fn;
596 __be16 nset_pkd;
597 __be32 data[12];
598 } pcie;
bbc02c7e
DM
599 } u;
600};
601
602#define FW_LDST_CMD_MSG(x) ((x) << 31)
603#define FW_LDST_CMD_PADDR(x) ((x) << 8)
604#define FW_LDST_CMD_MMD(x) ((x) << 0)
605#define FW_LDST_CMD_FID(x) ((x) << 15)
606#define FW_LDST_CMD_CTL(x) ((x) << 0)
607#define FW_LDST_CMD_RPLCPF(x) ((x) << 0)
ce91a923
NKI
608#define FW_LDST_CMD_LC (1U << 4)
609#define FW_LDST_CMD_NACCESS(x) ((x) << 0)
610#define FW_LDST_CMD_FN(x) ((x) << 0)
bbc02c7e
DM
611
612struct fw_reset_cmd {
613 __be32 op_to_write;
614 __be32 retval_len16;
615 __be32 val;
26f7cbc0 616 __be32 halt_pkd;
bbc02c7e
DM
617};
618
26f7cbc0
VP
619#define FW_RESET_CMD_HALT_SHIFT 31
620#define FW_RESET_CMD_HALT_MASK 0x1
621#define FW_RESET_CMD_HALT(x) ((x) << FW_RESET_CMD_HALT_SHIFT)
622#define FW_RESET_CMD_HALT_GET(x) \
623 (((x) >> FW_RESET_CMD_HALT_SHIFT) & FW_RESET_CMD_HALT_MASK)
624
636f9d37
VP
625enum fw_hellow_cmd {
626 fw_hello_cmd_stage_os = 0x0
627};
628
bbc02c7e
DM
629struct fw_hello_cmd {
630 __be32 op_to_write;
631 __be32 retval_len16;
ce91a923 632 __be32 err_to_clearinit;
bbc02c7e
DM
633#define FW_HELLO_CMD_ERR (1U << 31)
634#define FW_HELLO_CMD_INIT (1U << 30)
635#define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)
636#define FW_HELLO_CMD_MASTERFORCE(x) ((x) << 28)
636f9d37
VP
637#define FW_HELLO_CMD_MBMASTER_MASK 0xfU
638#define FW_HELLO_CMD_MBMASTER_SHIFT 24
639#define FW_HELLO_CMD_MBMASTER(x) ((x) << FW_HELLO_CMD_MBMASTER_SHIFT)
640#define FW_HELLO_CMD_MBMASTER_GET(x) \
641 (((x) >> FW_HELLO_CMD_MBMASTER_SHIFT) & FW_HELLO_CMD_MBMASTER_MASK)
ce91a923 642#define FW_HELLO_CMD_MBASYNCNOTINT(x) ((x) << 23)
bbc02c7e 643#define FW_HELLO_CMD_MBASYNCNOT(x) ((x) << 20)
636f9d37
VP
644#define FW_HELLO_CMD_STAGE(x) ((x) << 17)
645#define FW_HELLO_CMD_CLEARINIT (1U << 16)
bbc02c7e
DM
646 __be32 fwrev;
647};
648
649struct fw_bye_cmd {
650 __be32 op_to_write;
651 __be32 retval_len16;
652 __be64 r3;
653};
654
655struct fw_initialize_cmd {
656 __be32 op_to_write;
657 __be32 retval_len16;
658 __be64 r3;
659};
660
661enum fw_caps_config_hm {
662 FW_CAPS_CONFIG_HM_PCIE = 0x00000001,
663 FW_CAPS_CONFIG_HM_PL = 0x00000002,
664 FW_CAPS_CONFIG_HM_SGE = 0x00000004,
665 FW_CAPS_CONFIG_HM_CIM = 0x00000008,
666 FW_CAPS_CONFIG_HM_ULPTX = 0x00000010,
667 FW_CAPS_CONFIG_HM_TP = 0x00000020,
668 FW_CAPS_CONFIG_HM_ULPRX = 0x00000040,
669 FW_CAPS_CONFIG_HM_PMRX = 0x00000080,
670 FW_CAPS_CONFIG_HM_PMTX = 0x00000100,
671 FW_CAPS_CONFIG_HM_MC = 0x00000200,
672 FW_CAPS_CONFIG_HM_LE = 0x00000400,
673 FW_CAPS_CONFIG_HM_MPS = 0x00000800,
674 FW_CAPS_CONFIG_HM_XGMAC = 0x00001000,
675 FW_CAPS_CONFIG_HM_CPLSWITCH = 0x00002000,
676 FW_CAPS_CONFIG_HM_T4DBG = 0x00004000,
677 FW_CAPS_CONFIG_HM_MI = 0x00008000,
678 FW_CAPS_CONFIG_HM_I2CM = 0x00010000,
679 FW_CAPS_CONFIG_HM_NCSI = 0x00020000,
680 FW_CAPS_CONFIG_HM_SMB = 0x00040000,
681 FW_CAPS_CONFIG_HM_MA = 0x00080000,
682 FW_CAPS_CONFIG_HM_EDRAM = 0x00100000,
683 FW_CAPS_CONFIG_HM_PMU = 0x00200000,
684 FW_CAPS_CONFIG_HM_UART = 0x00400000,
685 FW_CAPS_CONFIG_HM_SF = 0x00800000,
686};
687
688enum fw_caps_config_nbm {
689 FW_CAPS_CONFIG_NBM_IPMI = 0x00000001,
690 FW_CAPS_CONFIG_NBM_NCSI = 0x00000002,
691};
692
693enum fw_caps_config_link {
694 FW_CAPS_CONFIG_LINK_PPP = 0x00000001,
695 FW_CAPS_CONFIG_LINK_QFC = 0x00000002,
696 FW_CAPS_CONFIG_LINK_DCBX = 0x00000004,
697};
698
699enum fw_caps_config_switch {
700 FW_CAPS_CONFIG_SWITCH_INGRESS = 0x00000001,
701 FW_CAPS_CONFIG_SWITCH_EGRESS = 0x00000002,
702};
703
704enum fw_caps_config_nic {
705 FW_CAPS_CONFIG_NIC = 0x00000001,
706 FW_CAPS_CONFIG_NIC_VM = 0x00000002,
707};
708
709enum fw_caps_config_ofld {
710 FW_CAPS_CONFIG_OFLD = 0x00000001,
711};
712
713enum fw_caps_config_rdma {
714 FW_CAPS_CONFIG_RDMA_RDDP = 0x00000001,
715 FW_CAPS_CONFIG_RDMA_RDMAC = 0x00000002,
716};
717
718enum fw_caps_config_iscsi {
719 FW_CAPS_CONFIG_ISCSI_INITIATOR_PDU = 0x00000001,
720 FW_CAPS_CONFIG_ISCSI_TARGET_PDU = 0x00000002,
721 FW_CAPS_CONFIG_ISCSI_INITIATOR_CNXOFLD = 0x00000004,
722 FW_CAPS_CONFIG_ISCSI_TARGET_CNXOFLD = 0x00000008,
723};
724
725enum fw_caps_config_fcoe {
726 FW_CAPS_CONFIG_FCOE_INITIATOR = 0x00000001,
727 FW_CAPS_CONFIG_FCOE_TARGET = 0x00000002,
ce91a923 728 FW_CAPS_CONFIG_FCOE_CTRL_OFLD = 0x00000004,
bbc02c7e
DM
729};
730
52367a76
VP
731enum fw_memtype_cf {
732 FW_MEMTYPE_CF_EDC0 = 0x0,
733 FW_MEMTYPE_CF_EDC1 = 0x1,
734 FW_MEMTYPE_CF_EXTMEM = 0x2,
735 FW_MEMTYPE_CF_FLASH = 0x4,
736 FW_MEMTYPE_CF_INTERNAL = 0x5,
737};
738
bbc02c7e
DM
739struct fw_caps_config_cmd {
740 __be32 op_to_write;
ce91a923 741 __be32 cfvalid_to_len16;
bbc02c7e
DM
742 __be32 r2;
743 __be32 hwmbitmap;
744 __be16 nbmcaps;
745 __be16 linkcaps;
746 __be16 switchcaps;
747 __be16 r3;
748 __be16 niccaps;
749 __be16 ofldcaps;
750 __be16 rdmacaps;
751 __be16 r4;
752 __be16 iscsicaps;
753 __be16 fcoecaps;
52367a76
VP
754 __be32 cfcsum;
755 __be32 finiver;
756 __be32 finicsum;
bbc02c7e
DM
757};
758
52367a76
VP
759#define FW_CAPS_CONFIG_CMD_CFVALID (1U << 27)
760#define FW_CAPS_CONFIG_CMD_MEMTYPE_CF(x) ((x) << 24)
761#define FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(x) ((x) << 16)
762
bbc02c7e
DM
763/*
764 * params command mnemonics
765 */
766enum fw_params_mnem {
767 FW_PARAMS_MNEM_DEV = 1, /* device params */
768 FW_PARAMS_MNEM_PFVF = 2, /* function params */
769 FW_PARAMS_MNEM_REG = 3, /* limited register access */
770 FW_PARAMS_MNEM_DMAQ = 4, /* dma queue params */
771 FW_PARAMS_MNEM_LAST
772};
773
774/*
775 * device parameters
776 */
777enum fw_params_param_dev {
778 FW_PARAMS_PARAM_DEV_CCLK = 0x00, /* chip core clock in khz */
779 FW_PARAMS_PARAM_DEV_PORTVEC = 0x01, /* the port vector */
780 FW_PARAMS_PARAM_DEV_NTID = 0x02, /* reads the number of TIDs
781 * allocated by the device's
782 * Lookup Engine
783 */
784 FW_PARAMS_PARAM_DEV_FLOWC_BUFFIFO_SZ = 0x03,
785 FW_PARAMS_PARAM_DEV_INTVER_NIC = 0x04,
786 FW_PARAMS_PARAM_DEV_INTVER_VNIC = 0x05,
787 FW_PARAMS_PARAM_DEV_INTVER_OFLD = 0x06,
788 FW_PARAMS_PARAM_DEV_INTVER_RI = 0x07,
789 FW_PARAMS_PARAM_DEV_INTVER_ISCSIPDU = 0x08,
790 FW_PARAMS_PARAM_DEV_INTVER_ISCSI = 0x09,
81323b74
CL
791 FW_PARAMS_PARAM_DEV_INTVER_FCOE = 0x0A,
792 FW_PARAMS_PARAM_DEV_FWREV = 0x0B,
793 FW_PARAMS_PARAM_DEV_TPREV = 0x0C,
52367a76 794 FW_PARAMS_PARAM_DEV_CF = 0x0D,
bbc02c7e
DM
795};
796
797/*
798 * physical and virtual function parameters
799 */
800enum fw_params_param_pfvf {
801 FW_PARAMS_PARAM_PFVF_RWXCAPS = 0x00,
802 FW_PARAMS_PARAM_PFVF_ROUTE_START = 0x01,
803 FW_PARAMS_PARAM_PFVF_ROUTE_END = 0x02,
804 FW_PARAMS_PARAM_PFVF_CLIP_START = 0x03,
805 FW_PARAMS_PARAM_PFVF_CLIP_END = 0x04,
806 FW_PARAMS_PARAM_PFVF_FILTER_START = 0x05,
807 FW_PARAMS_PARAM_PFVF_FILTER_END = 0x06,
808 FW_PARAMS_PARAM_PFVF_SERVER_START = 0x07,
809 FW_PARAMS_PARAM_PFVF_SERVER_END = 0x08,
810 FW_PARAMS_PARAM_PFVF_TDDP_START = 0x09,
811 FW_PARAMS_PARAM_PFVF_TDDP_END = 0x0A,
812 FW_PARAMS_PARAM_PFVF_ISCSI_START = 0x0B,
813 FW_PARAMS_PARAM_PFVF_ISCSI_END = 0x0C,
814 FW_PARAMS_PARAM_PFVF_STAG_START = 0x0D,
815 FW_PARAMS_PARAM_PFVF_STAG_END = 0x0E,
816 FW_PARAMS_PARAM_PFVF_RQ_START = 0x1F,
817 FW_PARAMS_PARAM_PFVF_RQ_END = 0x10,
818 FW_PARAMS_PARAM_PFVF_PBL_START = 0x11,
819 FW_PARAMS_PARAM_PFVF_PBL_END = 0x12,
820 FW_PARAMS_PARAM_PFVF_L2T_START = 0x13,
821 FW_PARAMS_PARAM_PFVF_L2T_END = 0x14,
a0881cab
DM
822 FW_PARAMS_PARAM_PFVF_SQRQ_START = 0x15,
823 FW_PARAMS_PARAM_PFVF_SQRQ_END = 0x16,
824 FW_PARAMS_PARAM_PFVF_CQ_START = 0x17,
825 FW_PARAMS_PARAM_PFVF_CQ_END = 0x18,
bbc02c7e 826 FW_PARAMS_PARAM_PFVF_SCHEDCLASS_ETH = 0x20,
a0881cab
DM
827 FW_PARAMS_PARAM_PFVF_VIID = 0x24,
828 FW_PARAMS_PARAM_PFVF_CPMASK = 0x25,
1ae970e0
DM
829 FW_PARAMS_PARAM_PFVF_OCQ_START = 0x26,
830 FW_PARAMS_PARAM_PFVF_OCQ_END = 0x27,
e46dab4d
DM
831 FW_PARAMS_PARAM_PFVF_CONM_MAP = 0x28,
832 FW_PARAMS_PARAM_PFVF_IQFLINT_START = 0x29,
833 FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A,
834 FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B,
835 FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C,
52367a76
VP
836 FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D,
837 FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E
bbc02c7e
DM
838};
839
840/*
841 * dma queue parameters
842 */
843enum fw_params_param_dmaq {
844 FW_PARAMS_PARAM_DMAQ_IQ_DCAEN_DCACPU = 0x00,
845 FW_PARAMS_PARAM_DMAQ_IQ_INTCNTTHRESH = 0x01,
846 FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_MNGT = 0x10,
847 FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_CTRL = 0x11,
848 FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH = 0x12,
849};
850
851#define FW_PARAMS_MNEM(x) ((x) << 24)
852#define FW_PARAMS_PARAM_X(x) ((x) << 16)
52367a76
VP
853#define FW_PARAMS_PARAM_Y_SHIFT 8
854#define FW_PARAMS_PARAM_Y_MASK 0xffU
855#define FW_PARAMS_PARAM_Y(x) ((x) << FW_PARAMS_PARAM_Y_SHIFT)
856#define FW_PARAMS_PARAM_Y_GET(x) (((x) >> FW_PARAMS_PARAM_Y_SHIFT) &\
857 FW_PARAMS_PARAM_Y_MASK)
858#define FW_PARAMS_PARAM_Z_SHIFT 0
859#define FW_PARAMS_PARAM_Z_MASK 0xffu
860#define FW_PARAMS_PARAM_Z(x) ((x) << FW_PARAMS_PARAM_Z_SHIFT)
861#define FW_PARAMS_PARAM_Z_GET(x) (((x) >> FW_PARAMS_PARAM_Z_SHIFT) &\
862 FW_PARAMS_PARAM_Z_MASK)
bbc02c7e
DM
863#define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)
864#define FW_PARAMS_PARAM_YZ(x) ((x) << 0)
865
866struct fw_params_cmd {
867 __be32 op_to_vfn;
868 __be32 retval_len16;
869 struct fw_params_param {
870 __be32 mnem;
871 __be32 val;
872 } param[7];
873};
874
875#define FW_PARAMS_CMD_PFN(x) ((x) << 8)
876#define FW_PARAMS_CMD_VFN(x) ((x) << 0)
877
878struct fw_pfvf_cmd {
879 __be32 op_to_vfn;
880 __be32 retval_len16;
881 __be32 niqflint_niq;
81323b74 882 __be32 type_to_neq;
bbc02c7e
DM
883 __be32 tc_to_nexactf;
884 __be32 r_caps_to_nethctrl;
885 __be16 nricq;
886 __be16 nriqp;
887 __be32 r4;
888};
889
890#define FW_PFVF_CMD_PFN(x) ((x) << 8)
891#define FW_PFVF_CMD_VFN(x) ((x) << 0)
892
893#define FW_PFVF_CMD_NIQFLINT(x) ((x) << 20)
894#define FW_PFVF_CMD_NIQFLINT_GET(x) (((x) >> 20) & 0xfff)
895
896#define FW_PFVF_CMD_NIQ(x) ((x) << 0)
897#define FW_PFVF_CMD_NIQ_GET(x) (((x) >> 0) & 0xfffff)
898
81323b74
CL
899#define FW_PFVF_CMD_TYPE (1 << 31)
900#define FW_PFVF_CMD_TYPE_GET(x) (((x) >> 31) & 0x1)
901
bbc02c7e 902#define FW_PFVF_CMD_CMASK(x) ((x) << 24)
81323b74
CL
903#define FW_PFVF_CMD_CMASK_MASK 0xf
904#define FW_PFVF_CMD_CMASK_GET(x) (((x) >> 24) & FW_PFVF_CMD_CMASK_MASK)
bbc02c7e
DM
905
906#define FW_PFVF_CMD_PMASK(x) ((x) << 20)
81323b74
CL
907#define FW_PFVF_CMD_PMASK_MASK 0xf
908#define FW_PFVF_CMD_PMASK_GET(x) (((x) >> 20) & FW_PFVF_CMD_PMASK_MASK)
bbc02c7e
DM
909
910#define FW_PFVF_CMD_NEQ(x) ((x) << 0)
911#define FW_PFVF_CMD_NEQ_GET(x) (((x) >> 0) & 0xfffff)
912
913#define FW_PFVF_CMD_TC(x) ((x) << 24)
914#define FW_PFVF_CMD_TC_GET(x) (((x) >> 24) & 0xff)
915
916#define FW_PFVF_CMD_NVI(x) ((x) << 16)
917#define FW_PFVF_CMD_NVI_GET(x) (((x) >> 16) & 0xff)
918
919#define FW_PFVF_CMD_NEXACTF(x) ((x) << 0)
920#define FW_PFVF_CMD_NEXACTF_GET(x) (((x) >> 0) & 0xffff)
921
922#define FW_PFVF_CMD_R_CAPS(x) ((x) << 24)
923#define FW_PFVF_CMD_R_CAPS_GET(x) (((x) >> 24) & 0xff)
924
925#define FW_PFVF_CMD_WX_CAPS(x) ((x) << 16)
926#define FW_PFVF_CMD_WX_CAPS_GET(x) (((x) >> 16) & 0xff)
927
928#define FW_PFVF_CMD_NETHCTRL(x) ((x) << 0)
929#define FW_PFVF_CMD_NETHCTRL_GET(x) (((x) >> 0) & 0xffff)
930
931enum fw_iq_type {
932 FW_IQ_TYPE_FL_INT_CAP,
933 FW_IQ_TYPE_NO_FL_INT_CAP
934};
935
936struct fw_iq_cmd {
937 __be32 op_to_vfn;
938 __be32 alloc_to_len16;
939 __be16 physiqid;
940 __be16 iqid;
941 __be16 fl0id;
942 __be16 fl1id;
943 __be32 type_to_iqandstindex;
944 __be16 iqdroprss_to_iqesize;
945 __be16 iqsize;
946 __be64 iqaddr;
947 __be32 iqns_to_fl0congen;
948 __be16 fl0dcaen_to_fl0cidxfthresh;
949 __be16 fl0size;
950 __be64 fl0addr;
951 __be32 fl1cngchmap_to_fl1congen;
952 __be16 fl1dcaen_to_fl1cidxfthresh;
953 __be16 fl1size;
954 __be64 fl1addr;
955};
956
957#define FW_IQ_CMD_PFN(x) ((x) << 8)
958#define FW_IQ_CMD_VFN(x) ((x) << 0)
959
960#define FW_IQ_CMD_ALLOC (1U << 31)
961#define FW_IQ_CMD_FREE (1U << 30)
962#define FW_IQ_CMD_MODIFY (1U << 29)
963#define FW_IQ_CMD_IQSTART(x) ((x) << 28)
964#define FW_IQ_CMD_IQSTOP(x) ((x) << 27)
965
966#define FW_IQ_CMD_TYPE(x) ((x) << 29)
967#define FW_IQ_CMD_IQASYNCH(x) ((x) << 28)
968#define FW_IQ_CMD_VIID(x) ((x) << 16)
969#define FW_IQ_CMD_IQANDST(x) ((x) << 15)
970#define FW_IQ_CMD_IQANUS(x) ((x) << 14)
971#define FW_IQ_CMD_IQANUD(x) ((x) << 12)
972#define FW_IQ_CMD_IQANDSTINDEX(x) ((x) << 0)
973
974#define FW_IQ_CMD_IQDROPRSS (1U << 15)
975#define FW_IQ_CMD_IQGTSMODE (1U << 14)
976#define FW_IQ_CMD_IQPCIECH(x) ((x) << 12)
977#define FW_IQ_CMD_IQDCAEN(x) ((x) << 11)
978#define FW_IQ_CMD_IQDCACPU(x) ((x) << 6)
979#define FW_IQ_CMD_IQINTCNTTHRESH(x) ((x) << 4)
980#define FW_IQ_CMD_IQO (1U << 3)
981#define FW_IQ_CMD_IQCPRIO(x) ((x) << 2)
982#define FW_IQ_CMD_IQESIZE(x) ((x) << 0)
983
984#define FW_IQ_CMD_IQNS(x) ((x) << 31)
985#define FW_IQ_CMD_IQRO(x) ((x) << 30)
986#define FW_IQ_CMD_IQFLINTIQHSEN(x) ((x) << 28)
987#define FW_IQ_CMD_IQFLINTCONGEN(x) ((x) << 27)
988#define FW_IQ_CMD_IQFLINTISCSIC(x) ((x) << 26)
989#define FW_IQ_CMD_FL0CNGCHMAP(x) ((x) << 20)
990#define FW_IQ_CMD_FL0CACHELOCK(x) ((x) << 15)
991#define FW_IQ_CMD_FL0DBP(x) ((x) << 14)
992#define FW_IQ_CMD_FL0DATANS(x) ((x) << 13)
993#define FW_IQ_CMD_FL0DATARO(x) ((x) << 12)
994#define FW_IQ_CMD_FL0CONGCIF(x) ((x) << 11)
995#define FW_IQ_CMD_FL0ONCHIP(x) ((x) << 10)
996#define FW_IQ_CMD_FL0STATUSPGNS(x) ((x) << 9)
997#define FW_IQ_CMD_FL0STATUSPGRO(x) ((x) << 8)
998#define FW_IQ_CMD_FL0FETCHNS(x) ((x) << 7)
999#define FW_IQ_CMD_FL0FETCHRO(x) ((x) << 6)
1000#define FW_IQ_CMD_FL0HOSTFCMODE(x) ((x) << 4)
1001#define FW_IQ_CMD_FL0CPRIO(x) ((x) << 3)
ce91a923
NKI
1002#define FW_IQ_CMD_FL0PADEN(x) ((x) << 2)
1003#define FW_IQ_CMD_FL0PACKEN(x) ((x) << 1)
bbc02c7e
DM
1004#define FW_IQ_CMD_FL0CONGEN (1U << 0)
1005
1006#define FW_IQ_CMD_FL0DCAEN(x) ((x) << 15)
1007#define FW_IQ_CMD_FL0DCACPU(x) ((x) << 10)
1008#define FW_IQ_CMD_FL0FBMIN(x) ((x) << 7)
1009#define FW_IQ_CMD_FL0FBMAX(x) ((x) << 4)
1010#define FW_IQ_CMD_FL0CIDXFTHRESHO (1U << 3)
1011#define FW_IQ_CMD_FL0CIDXFTHRESH(x) ((x) << 0)
1012
1013#define FW_IQ_CMD_FL1CNGCHMAP(x) ((x) << 20)
1014#define FW_IQ_CMD_FL1CACHELOCK(x) ((x) << 15)
1015#define FW_IQ_CMD_FL1DBP(x) ((x) << 14)
1016#define FW_IQ_CMD_FL1DATANS(x) ((x) << 13)
1017#define FW_IQ_CMD_FL1DATARO(x) ((x) << 12)
1018#define FW_IQ_CMD_FL1CONGCIF(x) ((x) << 11)
1019#define FW_IQ_CMD_FL1ONCHIP(x) ((x) << 10)
1020#define FW_IQ_CMD_FL1STATUSPGNS(x) ((x) << 9)
1021#define FW_IQ_CMD_FL1STATUSPGRO(x) ((x) << 8)
1022#define FW_IQ_CMD_FL1FETCHNS(x) ((x) << 7)
1023#define FW_IQ_CMD_FL1FETCHRO(x) ((x) << 6)
1024#define FW_IQ_CMD_FL1HOSTFCMODE(x) ((x) << 4)
1025#define FW_IQ_CMD_FL1CPRIO(x) ((x) << 3)
1026#define FW_IQ_CMD_FL1PADEN (1U << 2)
1027#define FW_IQ_CMD_FL1PACKEN (1U << 1)
1028#define FW_IQ_CMD_FL1CONGEN (1U << 0)
1029
1030#define FW_IQ_CMD_FL1DCAEN(x) ((x) << 15)
1031#define FW_IQ_CMD_FL1DCACPU(x) ((x) << 10)
1032#define FW_IQ_CMD_FL1FBMIN(x) ((x) << 7)
1033#define FW_IQ_CMD_FL1FBMAX(x) ((x) << 4)
1034#define FW_IQ_CMD_FL1CIDXFTHRESHO (1U << 3)
1035#define FW_IQ_CMD_FL1CIDXFTHRESH(x) ((x) << 0)
1036
1037struct fw_eq_eth_cmd {
1038 __be32 op_to_vfn;
1039 __be32 alloc_to_len16;
1040 __be32 eqid_pkd;
1041 __be32 physeqid_pkd;
1042 __be32 fetchszm_to_iqid;
1043 __be32 dcaen_to_eqsize;
1044 __be64 eqaddr;
1045 __be32 viid_pkd;
1046 __be32 r8_lo;
1047 __be64 r9;
1048};
1049
1050#define FW_EQ_ETH_CMD_PFN(x) ((x) << 8)
1051#define FW_EQ_ETH_CMD_VFN(x) ((x) << 0)
1052#define FW_EQ_ETH_CMD_ALLOC (1U << 31)
1053#define FW_EQ_ETH_CMD_FREE (1U << 30)
1054#define FW_EQ_ETH_CMD_MODIFY (1U << 29)
1055#define FW_EQ_ETH_CMD_EQSTART (1U << 28)
1056#define FW_EQ_ETH_CMD_EQSTOP (1U << 27)
1057
1058#define FW_EQ_ETH_CMD_EQID(x) ((x) << 0)
1059#define FW_EQ_ETH_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
1060#define FW_EQ_ETH_CMD_PHYSEQID(x) ((x) << 0)
81323b74 1061#define FW_EQ_ETH_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
bbc02c7e
DM
1062
1063#define FW_EQ_ETH_CMD_FETCHSZM(x) ((x) << 26)
1064#define FW_EQ_ETH_CMD_STATUSPGNS(x) ((x) << 25)
1065#define FW_EQ_ETH_CMD_STATUSPGRO(x) ((x) << 24)
1066#define FW_EQ_ETH_CMD_FETCHNS(x) ((x) << 23)
1067#define FW_EQ_ETH_CMD_FETCHRO(x) ((x) << 22)
1068#define FW_EQ_ETH_CMD_HOSTFCMODE(x) ((x) << 20)
1069#define FW_EQ_ETH_CMD_CPRIO(x) ((x) << 19)
1070#define FW_EQ_ETH_CMD_ONCHIP(x) ((x) << 18)
1071#define FW_EQ_ETH_CMD_PCIECHN(x) ((x) << 16)
1072#define FW_EQ_ETH_CMD_IQID(x) ((x) << 0)
1073
1074#define FW_EQ_ETH_CMD_DCAEN(x) ((x) << 31)
1075#define FW_EQ_ETH_CMD_DCACPU(x) ((x) << 26)
1076#define FW_EQ_ETH_CMD_FBMIN(x) ((x) << 23)
1077#define FW_EQ_ETH_CMD_FBMAX(x) ((x) << 20)
1078#define FW_EQ_ETH_CMD_CIDXFTHRESHO(x) ((x) << 19)
1079#define FW_EQ_ETH_CMD_CIDXFTHRESH(x) ((x) << 16)
1080#define FW_EQ_ETH_CMD_EQSIZE(x) ((x) << 0)
1081
1082#define FW_EQ_ETH_CMD_VIID(x) ((x) << 16)
1083
1084struct fw_eq_ctrl_cmd {
1085 __be32 op_to_vfn;
1086 __be32 alloc_to_len16;
1087 __be32 cmpliqid_eqid;
1088 __be32 physeqid_pkd;
1089 __be32 fetchszm_to_iqid;
1090 __be32 dcaen_to_eqsize;
1091 __be64 eqaddr;
1092};
1093
1094#define FW_EQ_CTRL_CMD_PFN(x) ((x) << 8)
1095#define FW_EQ_CTRL_CMD_VFN(x) ((x) << 0)
1096
1097#define FW_EQ_CTRL_CMD_ALLOC (1U << 31)
1098#define FW_EQ_CTRL_CMD_FREE (1U << 30)
1099#define FW_EQ_CTRL_CMD_MODIFY (1U << 29)
1100#define FW_EQ_CTRL_CMD_EQSTART (1U << 28)
1101#define FW_EQ_CTRL_CMD_EQSTOP (1U << 27)
1102
1103#define FW_EQ_CTRL_CMD_CMPLIQID(x) ((x) << 20)
1104#define FW_EQ_CTRL_CMD_EQID(x) ((x) << 0)
1105#define FW_EQ_CTRL_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
1106#define FW_EQ_CTRL_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
1107
1108#define FW_EQ_CTRL_CMD_FETCHSZM (1U << 26)
1109#define FW_EQ_CTRL_CMD_STATUSPGNS (1U << 25)
1110#define FW_EQ_CTRL_CMD_STATUSPGRO (1U << 24)
1111#define FW_EQ_CTRL_CMD_FETCHNS (1U << 23)
1112#define FW_EQ_CTRL_CMD_FETCHRO (1U << 22)
1113#define FW_EQ_CTRL_CMD_HOSTFCMODE(x) ((x) << 20)
1114#define FW_EQ_CTRL_CMD_CPRIO(x) ((x) << 19)
1115#define FW_EQ_CTRL_CMD_ONCHIP(x) ((x) << 18)
1116#define FW_EQ_CTRL_CMD_PCIECHN(x) ((x) << 16)
1117#define FW_EQ_CTRL_CMD_IQID(x) ((x) << 0)
1118
1119#define FW_EQ_CTRL_CMD_DCAEN(x) ((x) << 31)
1120#define FW_EQ_CTRL_CMD_DCACPU(x) ((x) << 26)
1121#define FW_EQ_CTRL_CMD_FBMIN(x) ((x) << 23)
1122#define FW_EQ_CTRL_CMD_FBMAX(x) ((x) << 20)
1123#define FW_EQ_CTRL_CMD_CIDXFTHRESHO(x) ((x) << 19)
1124#define FW_EQ_CTRL_CMD_CIDXFTHRESH(x) ((x) << 16)
1125#define FW_EQ_CTRL_CMD_EQSIZE(x) ((x) << 0)
1126
1127struct fw_eq_ofld_cmd {
1128 __be32 op_to_vfn;
1129 __be32 alloc_to_len16;
1130 __be32 eqid_pkd;
1131 __be32 physeqid_pkd;
1132 __be32 fetchszm_to_iqid;
1133 __be32 dcaen_to_eqsize;
1134 __be64 eqaddr;
1135};
1136
1137#define FW_EQ_OFLD_CMD_PFN(x) ((x) << 8)
1138#define FW_EQ_OFLD_CMD_VFN(x) ((x) << 0)
1139
1140#define FW_EQ_OFLD_CMD_ALLOC (1U << 31)
1141#define FW_EQ_OFLD_CMD_FREE (1U << 30)
1142#define FW_EQ_OFLD_CMD_MODIFY (1U << 29)
1143#define FW_EQ_OFLD_CMD_EQSTART (1U << 28)
1144#define FW_EQ_OFLD_CMD_EQSTOP (1U << 27)
1145
1146#define FW_EQ_OFLD_CMD_EQID(x) ((x) << 0)
1147#define FW_EQ_OFLD_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
1148#define FW_EQ_OFLD_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
1149
1150#define FW_EQ_OFLD_CMD_FETCHSZM(x) ((x) << 26)
1151#define FW_EQ_OFLD_CMD_STATUSPGNS(x) ((x) << 25)
1152#define FW_EQ_OFLD_CMD_STATUSPGRO(x) ((x) << 24)
1153#define FW_EQ_OFLD_CMD_FETCHNS(x) ((x) << 23)
1154#define FW_EQ_OFLD_CMD_FETCHRO(x) ((x) << 22)
1155#define FW_EQ_OFLD_CMD_HOSTFCMODE(x) ((x) << 20)
1156#define FW_EQ_OFLD_CMD_CPRIO(x) ((x) << 19)
1157#define FW_EQ_OFLD_CMD_ONCHIP(x) ((x) << 18)
1158#define FW_EQ_OFLD_CMD_PCIECHN(x) ((x) << 16)
1159#define FW_EQ_OFLD_CMD_IQID(x) ((x) << 0)
1160
1161#define FW_EQ_OFLD_CMD_DCAEN(x) ((x) << 31)
1162#define FW_EQ_OFLD_CMD_DCACPU(x) ((x) << 26)
1163#define FW_EQ_OFLD_CMD_FBMIN(x) ((x) << 23)
1164#define FW_EQ_OFLD_CMD_FBMAX(x) ((x) << 20)
1165#define FW_EQ_OFLD_CMD_CIDXFTHRESHO(x) ((x) << 19)
1166#define FW_EQ_OFLD_CMD_CIDXFTHRESH(x) ((x) << 16)
1167#define FW_EQ_OFLD_CMD_EQSIZE(x) ((x) << 0)
1168
1169/*
1170 * Macros for VIID parsing:
1171 * VIID - [10:8] PFN, [7] VI Valid, [6:0] VI number
1172 */
1173#define FW_VIID_PFN_GET(x) (((x) >> 8) & 0x7)
1174#define FW_VIID_VIVLD_GET(x) (((x) >> 7) & 0x1)
1175#define FW_VIID_VIN_GET(x) (((x) >> 0) & 0x7F)
1176
1177struct fw_vi_cmd {
1178 __be32 op_to_vfn;
1179 __be32 alloc_to_len16;
a0881cab 1180 __be16 type_viid;
bbc02c7e
DM
1181 u8 mac[6];
1182 u8 portid_pkd;
1183 u8 nmac;
1184 u8 nmac0[6];
1185 __be16 rsssize_pkd;
1186 u8 nmac1[6];
a0881cab 1187 __be16 idsiiq_pkd;
bbc02c7e 1188 u8 nmac2[6];
a0881cab 1189 __be16 idseiq_pkd;
bbc02c7e
DM
1190 u8 nmac3[6];
1191 __be64 r9;
1192 __be64 r10;
1193};
1194
1195#define FW_VI_CMD_PFN(x) ((x) << 8)
1196#define FW_VI_CMD_VFN(x) ((x) << 0)
1197#define FW_VI_CMD_ALLOC (1U << 31)
1198#define FW_VI_CMD_FREE (1U << 30)
1199#define FW_VI_CMD_VIID(x) ((x) << 0)
a0881cab 1200#define FW_VI_CMD_VIID_GET(x) ((x) & 0xfff)
bbc02c7e 1201#define FW_VI_CMD_PORTID(x) ((x) << 4)
81323b74 1202#define FW_VI_CMD_PORTID_GET(x) (((x) >> 4) & 0xf)
bbc02c7e
DM
1203#define FW_VI_CMD_RSSSIZE_GET(x) (((x) >> 0) & 0x7ff)
1204
1205/* Special VI_MAC command index ids */
1206#define FW_VI_MAC_ADD_MAC 0x3FF
1207#define FW_VI_MAC_ADD_PERSIST_MAC 0x3FE
1208#define FW_VI_MAC_MAC_BASED_FREE 0x3FD
81323b74 1209#define FW_CLS_TCAM_NUM_ENTRIES 336
bbc02c7e
DM
1210
1211enum fw_vi_mac_smac {
1212 FW_VI_MAC_MPS_TCAM_ENTRY,
1213 FW_VI_MAC_MPS_TCAM_ONLY,
1214 FW_VI_MAC_SMT_ONLY,
1215 FW_VI_MAC_SMT_AND_MPSTCAM
1216};
1217
1218enum fw_vi_mac_result {
1219 FW_VI_MAC_R_SUCCESS,
1220 FW_VI_MAC_R_F_NONEXISTENT_NOMEM,
1221 FW_VI_MAC_R_SMAC_FAIL,
1222 FW_VI_MAC_R_F_ACL_CHECK
1223};
1224
1225struct fw_vi_mac_cmd {
1226 __be32 op_to_viid;
1227 __be32 freemacs_to_len16;
1228 union fw_vi_mac {
1229 struct fw_vi_mac_exact {
1230 __be16 valid_to_idx;
1231 u8 macaddr[6];
1232 } exact[7];
1233 struct fw_vi_mac_hash {
1234 __be64 hashvec;
1235 } hash;
1236 } u;
1237};
1238
1239#define FW_VI_MAC_CMD_VIID(x) ((x) << 0)
1240#define FW_VI_MAC_CMD_FREEMACS(x) ((x) << 31)
1241#define FW_VI_MAC_CMD_HASHVECEN (1U << 23)
1242#define FW_VI_MAC_CMD_HASHUNIEN(x) ((x) << 22)
1243#define FW_VI_MAC_CMD_VALID (1U << 15)
1244#define FW_VI_MAC_CMD_PRIO(x) ((x) << 12)
1245#define FW_VI_MAC_CMD_SMAC_RESULT(x) ((x) << 10)
1246#define FW_VI_MAC_CMD_SMAC_RESULT_GET(x) (((x) >> 10) & 0x3)
1247#define FW_VI_MAC_CMD_IDX(x) ((x) << 0)
1248#define FW_VI_MAC_CMD_IDX_GET(x) (((x) >> 0) & 0x3ff)
1249
1250#define FW_RXMODE_MTU_NO_CHG 65535
1251
1252struct fw_vi_rxmode_cmd {
1253 __be32 op_to_viid;
1254 __be32 retval_len16;
f8f5aafa 1255 __be32 mtu_to_vlanexen;
bbc02c7e
DM
1256 __be32 r4_lo;
1257};
1258
1259#define FW_VI_RXMODE_CMD_VIID(x) ((x) << 0)
81323b74 1260#define FW_VI_RXMODE_CMD_MTU_MASK 0xffff
bbc02c7e
DM
1261#define FW_VI_RXMODE_CMD_MTU(x) ((x) << 16)
1262#define FW_VI_RXMODE_CMD_PROMISCEN_MASK 0x3
1263#define FW_VI_RXMODE_CMD_PROMISCEN(x) ((x) << 14)
1264#define FW_VI_RXMODE_CMD_ALLMULTIEN_MASK 0x3
1265#define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12)
1266#define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3
1267#define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10)
f8f5aafa
DM
1268#define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3
1269#define FW_VI_RXMODE_CMD_VLANEXEN(x) ((x) << 8)
bbc02c7e
DM
1270
1271struct fw_vi_enable_cmd {
1272 __be32 op_to_viid;
1273 __be32 ien_to_len16;
1274 __be16 blinkdur;
1275 __be16 r3;
1276 __be32 r4;
1277};
1278
1279#define FW_VI_ENABLE_CMD_VIID(x) ((x) << 0)
1280#define FW_VI_ENABLE_CMD_IEN(x) ((x) << 31)
1281#define FW_VI_ENABLE_CMD_EEN(x) ((x) << 30)
1282#define FW_VI_ENABLE_CMD_LED (1U << 29)
1283
1284/* VI VF stats offset definitions */
1285#define VI_VF_NUM_STATS 16
1286enum fw_vi_stats_vf_index {
1287 FW_VI_VF_STAT_TX_BCAST_BYTES_IX,
1288 FW_VI_VF_STAT_TX_BCAST_FRAMES_IX,
1289 FW_VI_VF_STAT_TX_MCAST_BYTES_IX,
1290 FW_VI_VF_STAT_TX_MCAST_FRAMES_IX,
1291 FW_VI_VF_STAT_TX_UCAST_BYTES_IX,
1292 FW_VI_VF_STAT_TX_UCAST_FRAMES_IX,
1293 FW_VI_VF_STAT_TX_DROP_FRAMES_IX,
1294 FW_VI_VF_STAT_TX_OFLD_BYTES_IX,
1295 FW_VI_VF_STAT_TX_OFLD_FRAMES_IX,
1296 FW_VI_VF_STAT_RX_BCAST_BYTES_IX,
1297 FW_VI_VF_STAT_RX_BCAST_FRAMES_IX,
1298 FW_VI_VF_STAT_RX_MCAST_BYTES_IX,
1299 FW_VI_VF_STAT_RX_MCAST_FRAMES_IX,
1300 FW_VI_VF_STAT_RX_UCAST_BYTES_IX,
1301 FW_VI_VF_STAT_RX_UCAST_FRAMES_IX,
1302 FW_VI_VF_STAT_RX_ERR_FRAMES_IX
1303};
1304
1305/* VI PF stats offset definitions */
1306#define VI_PF_NUM_STATS 17
1307enum fw_vi_stats_pf_index {
1308 FW_VI_PF_STAT_TX_BCAST_BYTES_IX,
1309 FW_VI_PF_STAT_TX_BCAST_FRAMES_IX,
1310 FW_VI_PF_STAT_TX_MCAST_BYTES_IX,
1311 FW_VI_PF_STAT_TX_MCAST_FRAMES_IX,
1312 FW_VI_PF_STAT_TX_UCAST_BYTES_IX,
1313 FW_VI_PF_STAT_TX_UCAST_FRAMES_IX,
1314 FW_VI_PF_STAT_TX_OFLD_BYTES_IX,
1315 FW_VI_PF_STAT_TX_OFLD_FRAMES_IX,
1316 FW_VI_PF_STAT_RX_BYTES_IX,
1317 FW_VI_PF_STAT_RX_FRAMES_IX,
1318 FW_VI_PF_STAT_RX_BCAST_BYTES_IX,
1319 FW_VI_PF_STAT_RX_BCAST_FRAMES_IX,
1320 FW_VI_PF_STAT_RX_MCAST_BYTES_IX,
1321 FW_VI_PF_STAT_RX_MCAST_FRAMES_IX,
1322 FW_VI_PF_STAT_RX_UCAST_BYTES_IX,
1323 FW_VI_PF_STAT_RX_UCAST_FRAMES_IX,
1324 FW_VI_PF_STAT_RX_ERR_FRAMES_IX
1325};
1326
1327struct fw_vi_stats_cmd {
1328 __be32 op_to_viid;
1329 __be32 retval_len16;
1330 union fw_vi_stats {
1331 struct fw_vi_stats_ctl {
1332 __be16 nstats_ix;
1333 __be16 r6;
1334 __be32 r7;
1335 __be64 stat0;
1336 __be64 stat1;
1337 __be64 stat2;
1338 __be64 stat3;
1339 __be64 stat4;
1340 __be64 stat5;
1341 } ctl;
1342 struct fw_vi_stats_pf {
1343 __be64 tx_bcast_bytes;
1344 __be64 tx_bcast_frames;
1345 __be64 tx_mcast_bytes;
1346 __be64 tx_mcast_frames;
1347 __be64 tx_ucast_bytes;
1348 __be64 tx_ucast_frames;
1349 __be64 tx_offload_bytes;
1350 __be64 tx_offload_frames;
1351 __be64 rx_pf_bytes;
1352 __be64 rx_pf_frames;
1353 __be64 rx_bcast_bytes;
1354 __be64 rx_bcast_frames;
1355 __be64 rx_mcast_bytes;
1356 __be64 rx_mcast_frames;
1357 __be64 rx_ucast_bytes;
1358 __be64 rx_ucast_frames;
1359 __be64 rx_err_frames;
1360 } pf;
1361 struct fw_vi_stats_vf {
1362 __be64 tx_bcast_bytes;
1363 __be64 tx_bcast_frames;
1364 __be64 tx_mcast_bytes;
1365 __be64 tx_mcast_frames;
1366 __be64 tx_ucast_bytes;
1367 __be64 tx_ucast_frames;
1368 __be64 tx_drop_frames;
1369 __be64 tx_offload_bytes;
1370 __be64 tx_offload_frames;
1371 __be64 rx_bcast_bytes;
1372 __be64 rx_bcast_frames;
1373 __be64 rx_mcast_bytes;
1374 __be64 rx_mcast_frames;
1375 __be64 rx_ucast_bytes;
1376 __be64 rx_ucast_frames;
1377 __be64 rx_err_frames;
1378 } vf;
1379 } u;
1380};
1381
1382#define FW_VI_STATS_CMD_VIID(x) ((x) << 0)
1383#define FW_VI_STATS_CMD_NSTATS(x) ((x) << 12)
1384#define FW_VI_STATS_CMD_IX(x) ((x) << 0)
1385
1386struct fw_acl_mac_cmd {
1387 __be32 op_to_vfn;
1388 __be32 en_to_len16;
1389 u8 nmac;
1390 u8 r3[7];
1391 __be16 r4;
1392 u8 macaddr0[6];
1393 __be16 r5;
1394 u8 macaddr1[6];
1395 __be16 r6;
1396 u8 macaddr2[6];
1397 __be16 r7;
1398 u8 macaddr3[6];
1399};
1400
1401#define FW_ACL_MAC_CMD_PFN(x) ((x) << 8)
1402#define FW_ACL_MAC_CMD_VFN(x) ((x) << 0)
1403#define FW_ACL_MAC_CMD_EN(x) ((x) << 31)
1404
1405struct fw_acl_vlan_cmd {
1406 __be32 op_to_vfn;
1407 __be32 en_to_len16;
1408 u8 nvlan;
1409 u8 dropnovlan_fm;
1410 u8 r3_lo[6];
1411 __be16 vlanid[16];
1412};
1413
1414#define FW_ACL_VLAN_CMD_PFN(x) ((x) << 8)
1415#define FW_ACL_VLAN_CMD_VFN(x) ((x) << 0)
1416#define FW_ACL_VLAN_CMD_EN(x) ((x) << 31)
1417#define FW_ACL_VLAN_CMD_DROPNOVLAN(x) ((x) << 7)
1418#define FW_ACL_VLAN_CMD_FM(x) ((x) << 6)
1419
1420enum fw_port_cap {
1421 FW_PORT_CAP_SPEED_100M = 0x0001,
1422 FW_PORT_CAP_SPEED_1G = 0x0002,
1423 FW_PORT_CAP_SPEED_2_5G = 0x0004,
1424 FW_PORT_CAP_SPEED_10G = 0x0008,
1425 FW_PORT_CAP_SPEED_40G = 0x0010,
1426 FW_PORT_CAP_SPEED_100G = 0x0020,
1427 FW_PORT_CAP_FC_RX = 0x0040,
1428 FW_PORT_CAP_FC_TX = 0x0080,
1429 FW_PORT_CAP_ANEG = 0x0100,
1430 FW_PORT_CAP_MDI_0 = 0x0200,
1431 FW_PORT_CAP_MDI_1 = 0x0400,
1432 FW_PORT_CAP_BEAN = 0x0800,
1433 FW_PORT_CAP_PMA_LPBK = 0x1000,
1434 FW_PORT_CAP_PCS_LPBK = 0x2000,
1435 FW_PORT_CAP_PHYXS_LPBK = 0x4000,
1436 FW_PORT_CAP_FAR_END_LPBK = 0x8000,
1437};
1438
1439enum fw_port_mdi {
1440 FW_PORT_MDI_UNCHANGED,
1441 FW_PORT_MDI_AUTO,
1442 FW_PORT_MDI_F_STRAIGHT,
1443 FW_PORT_MDI_F_CROSSOVER
1444};
1445
1446#define FW_PORT_MDI(x) ((x) << 9)
1447
1448enum fw_port_action {
1449 FW_PORT_ACTION_L1_CFG = 0x0001,
1450 FW_PORT_ACTION_L2_CFG = 0x0002,
1451 FW_PORT_ACTION_GET_PORT_INFO = 0x0003,
1452 FW_PORT_ACTION_L2_PPP_CFG = 0x0004,
1453 FW_PORT_ACTION_L2_DCB_CFG = 0x0005,
1454 FW_PORT_ACTION_LOW_PWR_TO_NORMAL = 0x0010,
1455 FW_PORT_ACTION_L1_LOW_PWR_EN = 0x0011,
1456 FW_PORT_ACTION_L2_WOL_MODE_EN = 0x0012,
1457 FW_PORT_ACTION_LPBK_TO_NORMAL = 0x0020,
1458 FW_PORT_ACTION_L1_LPBK = 0x0021,
1459 FW_PORT_ACTION_L1_PMA_LPBK = 0x0022,
1460 FW_PORT_ACTION_L1_PCS_LPBK = 0x0023,
1461 FW_PORT_ACTION_L1_PHYXS_CSIDE_LPBK = 0x0024,
1462 FW_PORT_ACTION_L1_PHYXS_ESIDE_LPBK = 0x0025,
1463 FW_PORT_ACTION_PHY_RESET = 0x0040,
1464 FW_PORT_ACTION_PMA_RESET = 0x0041,
1465 FW_PORT_ACTION_PCS_RESET = 0x0042,
1466 FW_PORT_ACTION_PHYXS_RESET = 0x0043,
1467 FW_PORT_ACTION_DTEXS_REEST = 0x0044,
1468 FW_PORT_ACTION_AN_RESET = 0x0045
1469};
1470
1471enum fw_port_l2cfg_ctlbf {
1472 FW_PORT_L2_CTLBF_OVLAN0 = 0x01,
1473 FW_PORT_L2_CTLBF_OVLAN1 = 0x02,
1474 FW_PORT_L2_CTLBF_OVLAN2 = 0x04,
1475 FW_PORT_L2_CTLBF_OVLAN3 = 0x08,
1476 FW_PORT_L2_CTLBF_IVLAN = 0x10,
1477 FW_PORT_L2_CTLBF_TXIPG = 0x20
1478};
1479
1480enum fw_port_dcb_cfg {
1481 FW_PORT_DCB_CFG_PG = 0x01,
1482 FW_PORT_DCB_CFG_PFC = 0x02,
1483 FW_PORT_DCB_CFG_APPL = 0x04
1484};
1485
1486enum fw_port_dcb_cfg_rc {
1487 FW_PORT_DCB_CFG_SUCCESS = 0x0,
1488 FW_PORT_DCB_CFG_ERROR = 0x1
1489};
1490
ce91a923
NKI
1491enum fw_port_dcb_type {
1492 FW_PORT_DCB_TYPE_PGID = 0x00,
1493 FW_PORT_DCB_TYPE_PGRATE = 0x01,
1494 FW_PORT_DCB_TYPE_PRIORATE = 0x02,
1495 FW_PORT_DCB_TYPE_PFC = 0x03,
1496 FW_PORT_DCB_TYPE_APP_ID = 0x04,
1497};
1498
bbc02c7e
DM
1499struct fw_port_cmd {
1500 __be32 op_to_portid;
1501 __be32 action_to_len16;
1502 union fw_port {
1503 struct fw_port_l1cfg {
1504 __be32 rcap;
1505 __be32 r;
1506 } l1cfg;
1507 struct fw_port_l2cfg {
1508 __be16 ctlbf_to_ivlan0;
1509 __be16 ivlantype;
1510 __be32 txipg_pkd;
1511 __be16 ovlan0mask;
1512 __be16 ovlan0type;
1513 __be16 ovlan1mask;
1514 __be16 ovlan1type;
1515 __be16 ovlan2mask;
1516 __be16 ovlan2type;
1517 __be16 ovlan3mask;
1518 __be16 ovlan3type;
1519 } l2cfg;
1520 struct fw_port_info {
1521 __be32 lstatus_to_modtype;
1522 __be16 pcap;
1523 __be16 acap;
a0881cab
DM
1524 __be16 mtu;
1525 __u8 cbllen;
1526 __u8 r9;
1527 __be32 r10;
1528 __be64 r11;
bbc02c7e
DM
1529 } info;
1530 struct fw_port_ppp {
1531 __be32 pppen_to_ncsich;
1532 __be32 r11;
1533 } ppp;
1534 struct fw_port_dcb {
1535 __be16 cfg;
1536 u8 up_map;
1537 u8 sf_cfgrc;
1538 __be16 prot_ix;
1539 u8 pe7_to_pe0;
1540 u8 numTCPFCs;
1541 __be32 pgid0_to_pgid7;
1542 __be32 numTCs_oui;
1543 u8 pgpc[8];
1544 } dcb;
1545 } u;
1546};
1547
1548#define FW_PORT_CMD_READ (1U << 22)
1549
1550#define FW_PORT_CMD_PORTID(x) ((x) << 0)
1551#define FW_PORT_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
1552
1553#define FW_PORT_CMD_ACTION(x) ((x) << 16)
81323b74 1554#define FW_PORT_CMD_ACTION_GET(x) (((x) >> 16) & 0xffff)
bbc02c7e
DM
1555
1556#define FW_PORT_CMD_CTLBF(x) ((x) << 10)
1557#define FW_PORT_CMD_OVLAN3(x) ((x) << 7)
1558#define FW_PORT_CMD_OVLAN2(x) ((x) << 6)
1559#define FW_PORT_CMD_OVLAN1(x) ((x) << 5)
1560#define FW_PORT_CMD_OVLAN0(x) ((x) << 4)
1561#define FW_PORT_CMD_IVLAN0(x) ((x) << 3)
1562
1563#define FW_PORT_CMD_TXIPG(x) ((x) << 19)
1564
1565#define FW_PORT_CMD_LSTATUS (1U << 31)
ce91a923 1566#define FW_PORT_CMD_LSTATUS_GET(x) (((x) >> 31) & 0x1)
bbc02c7e
DM
1567#define FW_PORT_CMD_LSPEED(x) ((x) << 24)
1568#define FW_PORT_CMD_LSPEED_GET(x) (((x) >> 24) & 0x3f)
1569#define FW_PORT_CMD_TXPAUSE (1U << 23)
1570#define FW_PORT_CMD_RXPAUSE (1U << 22)
1571#define FW_PORT_CMD_MDIOCAP (1U << 21)
1572#define FW_PORT_CMD_MDIOADDR_GET(x) (((x) >> 16) & 0x1f)
1573#define FW_PORT_CMD_LPTXPAUSE (1U << 15)
1574#define FW_PORT_CMD_LPRXPAUSE (1U << 14)
1575#define FW_PORT_CMD_PTYPE_MASK 0x1f
1576#define FW_PORT_CMD_PTYPE_GET(x) (((x) >> 8) & FW_PORT_CMD_PTYPE_MASK)
1577#define FW_PORT_CMD_MODTYPE_MASK 0x1f
1578#define FW_PORT_CMD_MODTYPE_GET(x) (((x) >> 0) & FW_PORT_CMD_MODTYPE_MASK)
1579
1580#define FW_PORT_CMD_PPPEN(x) ((x) << 31)
1581#define FW_PORT_CMD_TPSRC(x) ((x) << 28)
1582#define FW_PORT_CMD_NCSISRC(x) ((x) << 24)
1583
1584#define FW_PORT_CMD_CH0(x) ((x) << 20)
1585#define FW_PORT_CMD_CH1(x) ((x) << 16)
1586#define FW_PORT_CMD_CH2(x) ((x) << 12)
1587#define FW_PORT_CMD_CH3(x) ((x) << 8)
1588#define FW_PORT_CMD_NCSICH(x) ((x) << 4)
1589
1590enum fw_port_type {
a0881cab
DM
1591 FW_PORT_TYPE_FIBER_XFI,
1592 FW_PORT_TYPE_FIBER_XAUI,
bbc02c7e 1593 FW_PORT_TYPE_BT_SGMII,
a0881cab 1594 FW_PORT_TYPE_BT_XFI,
bbc02c7e 1595 FW_PORT_TYPE_BT_XAUI,
a0881cab 1596 FW_PORT_TYPE_KX4,
bbc02c7e 1597 FW_PORT_TYPE_CX4,
a0881cab
DM
1598 FW_PORT_TYPE_KX,
1599 FW_PORT_TYPE_KR,
1600 FW_PORT_TYPE_SFP,
1601 FW_PORT_TYPE_BP_AP,
7d5e77aa 1602 FW_PORT_TYPE_BP4_AP,
bbc02c7e
DM
1603
1604 FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK
1605};
1606
1607enum fw_port_module_type {
1608 FW_PORT_MOD_TYPE_NA,
1609 FW_PORT_MOD_TYPE_LR,
1610 FW_PORT_MOD_TYPE_SR,
1611 FW_PORT_MOD_TYPE_ER,
a0881cab
DM
1612 FW_PORT_MOD_TYPE_TWINAX_PASSIVE,
1613 FW_PORT_MOD_TYPE_TWINAX_ACTIVE,
1614 FW_PORT_MOD_TYPE_LRM,
ce91a923
NKI
1615 FW_PORT_MOD_TYPE_ERROR = FW_PORT_CMD_MODTYPE_MASK - 3,
1616 FW_PORT_MOD_TYPE_UNKNOWN = FW_PORT_CMD_MODTYPE_MASK - 2,
1617 FW_PORT_MOD_TYPE_NOTSUPPORTED = FW_PORT_CMD_MODTYPE_MASK - 1,
bbc02c7e
DM
1618
1619 FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK
1620};
1621
1622/* port stats */
1623#define FW_NUM_PORT_STATS 50
1624#define FW_NUM_PORT_TX_STATS 23
1625#define FW_NUM_PORT_RX_STATS 27
1626
1627enum fw_port_stats_tx_index {
1628 FW_STAT_TX_PORT_BYTES_IX,
1629 FW_STAT_TX_PORT_FRAMES_IX,
1630 FW_STAT_TX_PORT_BCAST_IX,
1631 FW_STAT_TX_PORT_MCAST_IX,
1632 FW_STAT_TX_PORT_UCAST_IX,
1633 FW_STAT_TX_PORT_ERROR_IX,
1634 FW_STAT_TX_PORT_64B_IX,
1635 FW_STAT_TX_PORT_65B_127B_IX,
1636 FW_STAT_TX_PORT_128B_255B_IX,
1637 FW_STAT_TX_PORT_256B_511B_IX,
1638 FW_STAT_TX_PORT_512B_1023B_IX,
1639 FW_STAT_TX_PORT_1024B_1518B_IX,
1640 FW_STAT_TX_PORT_1519B_MAX_IX,
1641 FW_STAT_TX_PORT_DROP_IX,
1642 FW_STAT_TX_PORT_PAUSE_IX,
1643 FW_STAT_TX_PORT_PPP0_IX,
1644 FW_STAT_TX_PORT_PPP1_IX,
1645 FW_STAT_TX_PORT_PPP2_IX,
1646 FW_STAT_TX_PORT_PPP3_IX,
1647 FW_STAT_TX_PORT_PPP4_IX,
1648 FW_STAT_TX_PORT_PPP5_IX,
1649 FW_STAT_TX_PORT_PPP6_IX,
1650 FW_STAT_TX_PORT_PPP7_IX
1651};
1652
1653enum fw_port_stat_rx_index {
1654 FW_STAT_RX_PORT_BYTES_IX,
1655 FW_STAT_RX_PORT_FRAMES_IX,
1656 FW_STAT_RX_PORT_BCAST_IX,
1657 FW_STAT_RX_PORT_MCAST_IX,
1658 FW_STAT_RX_PORT_UCAST_IX,
1659 FW_STAT_RX_PORT_MTU_ERROR_IX,
1660 FW_STAT_RX_PORT_MTU_CRC_ERROR_IX,
1661 FW_STAT_RX_PORT_CRC_ERROR_IX,
1662 FW_STAT_RX_PORT_LEN_ERROR_IX,
1663 FW_STAT_RX_PORT_SYM_ERROR_IX,
1664 FW_STAT_RX_PORT_64B_IX,
1665 FW_STAT_RX_PORT_65B_127B_IX,
1666 FW_STAT_RX_PORT_128B_255B_IX,
1667 FW_STAT_RX_PORT_256B_511B_IX,
1668 FW_STAT_RX_PORT_512B_1023B_IX,
1669 FW_STAT_RX_PORT_1024B_1518B_IX,
1670 FW_STAT_RX_PORT_1519B_MAX_IX,
1671 FW_STAT_RX_PORT_PAUSE_IX,
1672 FW_STAT_RX_PORT_PPP0_IX,
1673 FW_STAT_RX_PORT_PPP1_IX,
1674 FW_STAT_RX_PORT_PPP2_IX,
1675 FW_STAT_RX_PORT_PPP3_IX,
1676 FW_STAT_RX_PORT_PPP4_IX,
1677 FW_STAT_RX_PORT_PPP5_IX,
1678 FW_STAT_RX_PORT_PPP6_IX,
1679 FW_STAT_RX_PORT_PPP7_IX,
1680 FW_STAT_RX_PORT_LESS_64B_IX
1681};
1682
1683struct fw_port_stats_cmd {
1684 __be32 op_to_portid;
1685 __be32 retval_len16;
1686 union fw_port_stats {
1687 struct fw_port_stats_ctl {
1688 u8 nstats_bg_bm;
1689 u8 tx_ix;
1690 __be16 r6;
1691 __be32 r7;
1692 __be64 stat0;
1693 __be64 stat1;
1694 __be64 stat2;
1695 __be64 stat3;
1696 __be64 stat4;
1697 __be64 stat5;
1698 } ctl;
1699 struct fw_port_stats_all {
1700 __be64 tx_bytes;
1701 __be64 tx_frames;
1702 __be64 tx_bcast;
1703 __be64 tx_mcast;
1704 __be64 tx_ucast;
1705 __be64 tx_error;
1706 __be64 tx_64b;
1707 __be64 tx_65b_127b;
1708 __be64 tx_128b_255b;
1709 __be64 tx_256b_511b;
1710 __be64 tx_512b_1023b;
1711 __be64 tx_1024b_1518b;
1712 __be64 tx_1519b_max;
1713 __be64 tx_drop;
1714 __be64 tx_pause;
1715 __be64 tx_ppp0;
1716 __be64 tx_ppp1;
1717 __be64 tx_ppp2;
1718 __be64 tx_ppp3;
1719 __be64 tx_ppp4;
1720 __be64 tx_ppp5;
1721 __be64 tx_ppp6;
1722 __be64 tx_ppp7;
1723 __be64 rx_bytes;
1724 __be64 rx_frames;
1725 __be64 rx_bcast;
1726 __be64 rx_mcast;
1727 __be64 rx_ucast;
1728 __be64 rx_mtu_error;
1729 __be64 rx_mtu_crc_error;
1730 __be64 rx_crc_error;
1731 __be64 rx_len_error;
1732 __be64 rx_sym_error;
1733 __be64 rx_64b;
1734 __be64 rx_65b_127b;
1735 __be64 rx_128b_255b;
1736 __be64 rx_256b_511b;
1737 __be64 rx_512b_1023b;
1738 __be64 rx_1024b_1518b;
1739 __be64 rx_1519b_max;
1740 __be64 rx_pause;
1741 __be64 rx_ppp0;
1742 __be64 rx_ppp1;
1743 __be64 rx_ppp2;
1744 __be64 rx_ppp3;
1745 __be64 rx_ppp4;
1746 __be64 rx_ppp5;
1747 __be64 rx_ppp6;
1748 __be64 rx_ppp7;
1749 __be64 rx_less_64b;
1750 __be64 rx_bg_drop;
1751 __be64 rx_bg_trunc;
1752 } all;
1753 } u;
1754};
1755
1756#define FW_PORT_STATS_CMD_NSTATS(x) ((x) << 4)
1757#define FW_PORT_STATS_CMD_BG_BM(x) ((x) << 0)
1758#define FW_PORT_STATS_CMD_TX(x) ((x) << 7)
1759#define FW_PORT_STATS_CMD_IX(x) ((x) << 0)
1760
1761/* port loopback stats */
1762#define FW_NUM_LB_STATS 16
1763enum fw_port_lb_stats_index {
1764 FW_STAT_LB_PORT_BYTES_IX,
1765 FW_STAT_LB_PORT_FRAMES_IX,
1766 FW_STAT_LB_PORT_BCAST_IX,
1767 FW_STAT_LB_PORT_MCAST_IX,
1768 FW_STAT_LB_PORT_UCAST_IX,
1769 FW_STAT_LB_PORT_ERROR_IX,
1770 FW_STAT_LB_PORT_64B_IX,
1771 FW_STAT_LB_PORT_65B_127B_IX,
1772 FW_STAT_LB_PORT_128B_255B_IX,
1773 FW_STAT_LB_PORT_256B_511B_IX,
1774 FW_STAT_LB_PORT_512B_1023B_IX,
1775 FW_STAT_LB_PORT_1024B_1518B_IX,
1776 FW_STAT_LB_PORT_1519B_MAX_IX,
1777 FW_STAT_LB_PORT_DROP_FRAMES_IX
1778};
1779
1780struct fw_port_lb_stats_cmd {
1781 __be32 op_to_lbport;
1782 __be32 retval_len16;
1783 union fw_port_lb_stats {
1784 struct fw_port_lb_stats_ctl {
1785 u8 nstats_bg_bm;
1786 u8 ix_pkd;
1787 __be16 r6;
1788 __be32 r7;
1789 __be64 stat0;
1790 __be64 stat1;
1791 __be64 stat2;
1792 __be64 stat3;
1793 __be64 stat4;
1794 __be64 stat5;
1795 } ctl;
1796 struct fw_port_lb_stats_all {
1797 __be64 tx_bytes;
1798 __be64 tx_frames;
1799 __be64 tx_bcast;
1800 __be64 tx_mcast;
1801 __be64 tx_ucast;
1802 __be64 tx_error;
1803 __be64 tx_64b;
1804 __be64 tx_65b_127b;
1805 __be64 tx_128b_255b;
1806 __be64 tx_256b_511b;
1807 __be64 tx_512b_1023b;
1808 __be64 tx_1024b_1518b;
1809 __be64 tx_1519b_max;
1810 __be64 rx_lb_drop;
1811 __be64 rx_lb_trunc;
1812 } all;
1813 } u;
1814};
1815
1816#define FW_PORT_LB_STATS_CMD_LBPORT(x) ((x) << 0)
1817#define FW_PORT_LB_STATS_CMD_NSTATS(x) ((x) << 4)
1818#define FW_PORT_LB_STATS_CMD_BG_BM(x) ((x) << 0)
1819#define FW_PORT_LB_STATS_CMD_IX(x) ((x) << 0)
1820
1821struct fw_rss_ind_tbl_cmd {
1822 __be32 op_to_viid;
1823#define FW_RSS_IND_TBL_CMD_VIID(x) ((x) << 0)
1824 __be32 retval_len16;
1825 __be16 niqid;
1826 __be16 startidx;
1827 __be32 r3;
1828 __be32 iq0_to_iq2;
1829#define FW_RSS_IND_TBL_CMD_IQ0(x) ((x) << 20)
1830#define FW_RSS_IND_TBL_CMD_IQ1(x) ((x) << 10)
1831#define FW_RSS_IND_TBL_CMD_IQ2(x) ((x) << 0)
1832 __be32 iq3_to_iq5;
1833 __be32 iq6_to_iq8;
1834 __be32 iq9_to_iq11;
1835 __be32 iq12_to_iq14;
1836 __be32 iq15_to_iq17;
1837 __be32 iq18_to_iq20;
1838 __be32 iq21_to_iq23;
1839 __be32 iq24_to_iq26;
1840 __be32 iq27_to_iq29;
1841 __be32 iq30_iq31;
1842 __be32 r15_lo;
1843};
1844
1845struct fw_rss_glb_config_cmd {
1846 __be32 op_to_write;
1847 __be32 retval_len16;
1848 union fw_rss_glb_config {
1849 struct fw_rss_glb_config_manual {
1850 __be32 mode_pkd;
1851 __be32 r3;
1852 __be64 r4;
1853 __be64 r5;
1854 } manual;
1855 struct fw_rss_glb_config_basicvirtual {
1856 __be32 mode_pkd;
1857 __be32 synmapen_to_hashtoeplitz;
1858#define FW_RSS_GLB_CONFIG_CMD_SYNMAPEN (1U << 8)
1859#define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV6 (1U << 7)
1860#define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV6 (1U << 6)
1861#define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV4 (1U << 5)
1862#define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV4 (1U << 4)
1863#define FW_RSS_GLB_CONFIG_CMD_OFDMAPEN (1U << 3)
1864#define FW_RSS_GLB_CONFIG_CMD_TNLMAPEN (1U << 2)
1865#define FW_RSS_GLB_CONFIG_CMD_TNLALLLKP (1U << 1)
1866#define FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ (1U << 0)
1867 __be64 r8;
1868 __be64 r9;
1869 } basicvirtual;
1870 } u;
1871};
1872
1873#define FW_RSS_GLB_CONFIG_CMD_MODE(x) ((x) << 28)
81323b74 1874#define FW_RSS_GLB_CONFIG_CMD_MODE_GET(x) (((x) >> 28) & 0xf)
bbc02c7e
DM
1875
1876#define FW_RSS_GLB_CONFIG_CMD_MODE_MANUAL 0
1877#define FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL 1
1878
1879struct fw_rss_vi_config_cmd {
1880 __be32 op_to_viid;
1881#define FW_RSS_VI_CONFIG_CMD_VIID(x) ((x) << 0)
1882 __be32 retval_len16;
1883 union fw_rss_vi_config {
1884 struct fw_rss_vi_config_manual {
1885 __be64 r3;
1886 __be64 r4;
1887 __be64 r5;
1888 } manual;
1889 struct fw_rss_vi_config_basicvirtual {
1890 __be32 r6;
81323b74 1891 __be32 defaultq_to_udpen;
bbc02c7e 1892#define FW_RSS_VI_CONFIG_CMD_DEFAULTQ(x) ((x) << 16)
81323b74 1893#define FW_RSS_VI_CONFIG_CMD_DEFAULTQ_GET(x) (((x) >> 16) & 0x3ff)
bbc02c7e
DM
1894#define FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN (1U << 4)
1895#define FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN (1U << 3)
1896#define FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN (1U << 2)
1897#define FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN (1U << 1)
81323b74 1898#define FW_RSS_VI_CONFIG_CMD_UDPEN (1U << 0)
bbc02c7e
DM
1899 __be64 r9;
1900 __be64 r10;
1901 } basicvirtual;
1902 } u;
1903};
1904
1905enum fw_error_type {
1906 FW_ERROR_TYPE_EXCEPTION = 0x0,
1907 FW_ERROR_TYPE_HWMODULE = 0x1,
1908 FW_ERROR_TYPE_WR = 0x2,
1909 FW_ERROR_TYPE_ACL = 0x3,
1910};
1911
1912struct fw_error_cmd {
1913 __be32 op_to_type;
1914 __be32 len16_pkd;
1915 union fw_error {
1916 struct fw_error_exception {
1917 __be32 info[6];
1918 } exception;
1919 struct fw_error_hwmodule {
1920 __be32 regaddr;
1921 __be32 regval;
1922 } hwmodule;
1923 struct fw_error_wr {
1924 __be16 cidx;
1925 __be16 pfn_vfn;
1926 __be32 eqid;
1927 u8 wrhdr[16];
1928 } wr;
1929 struct fw_error_acl {
1930 __be16 cidx;
1931 __be16 pfn_vfn;
1932 __be32 eqid;
1933 __be16 mv_pkd;
1934 u8 val[6];
1935 __be64 r4;
1936 } acl;
1937 } u;
1938};
1939
1940struct fw_debug_cmd {
1941 __be32 op_type;
1942#define FW_DEBUG_CMD_TYPE_GET(x) ((x) & 0xff)
1943 __be32 len16_pkd;
1944 union fw_debug {
1945 struct fw_debug_assert {
1946 __be32 fcid;
1947 __be32 line;
1948 __be32 x;
1949 __be32 y;
1950 u8 filename_0_7[8];
1951 u8 filename_8_15[8];
1952 __be64 r3;
1953 } assert;
1954 struct fw_debug_prt {
1955 __be16 dprtstridx;
1956 __be16 r3[3];
1957 __be32 dprtstrparam0;
1958 __be32 dprtstrparam1;
1959 __be32 dprtstrparam2;
1960 __be32 dprtstrparam3;
1961 } prt;
1962 } u;
1963};
1964
52367a76
VP
1965#define FW_PCIE_FW_ERR (1U << 31)
1966#define FW_PCIE_FW_INIT (1U << 30)
26f7cbc0 1967#define FW_PCIE_FW_HALT (1U << 29)
52367a76
VP
1968#define FW_PCIE_FW_MASTER_VLD (1U << 15)
1969#define FW_PCIE_FW_MASTER_MASK 0x7
1970#define FW_PCIE_FW_MASTER_SHIFT 12
1971#define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT)
1972#define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \
1973 FW_PCIE_FW_MASTER_MASK)
1974
bbc02c7e
DM
1975struct fw_hdr {
1976 u8 ver;
1977 u8 reserved1;
1978 __be16 len512; /* bin length in units of 512-bytes */
1979 __be32 fw_ver; /* firmware version */
1980 __be32 tp_microcode_ver;
1981 u8 intfver_nic;
1982 u8 intfver_vnic;
1983 u8 intfver_ofld;
1984 u8 intfver_ri;
1985 u8 intfver_iscsipdu;
1986 u8 intfver_iscsi;
1987 u8 intfver_fcoe;
1988 u8 reserved2;
26f7cbc0
VP
1989 __u32 reserved3;
1990 __u32 reserved4;
1991 __u32 reserved5;
1992 __be32 flags;
1993 __be32 reserved6[23];
bbc02c7e
DM
1994};
1995
1996#define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
1997#define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff)
1998#define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
1999#define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)
3069ee9b 2000
26f7cbc0
VP
2001enum fw_hdr_flags {
2002 FW_HDR_FLAGS_RESET_HALT = 0x00000001,
2003};
2004
bbc02c7e 2005#endif /* _T4FW_INTERFACE_H_ */