blob: 6278a9ed46391fa51ab406fe03a1ff84aca0f2f4 [file] [log] [blame]
Ariel Elior1ab44342013-01-01 05:22:23 +00001/* bnx2x_vfpf.h: Broadcom Everest network driver.
2 *
3 * Copyright (c) 2011-2012 Broadcom Corporation
4 *
5 * Unless you and Broadcom execute a separate written software license
6 * agreement governing use of this software, this software is licensed to you
7 * under the terms of the GNU General Public License version 2, available
8 * at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL").
9 *
10 * Notwithstanding the above, under no circumstances may you combine this
11 * software in any way with any other Broadcom software provided under a
12 * license other than the GPL, without Broadcom's express prior written
13 * consent.
14 *
15 * Maintained by: Eilon Greenstein <eilong@broadcom.com>
16 * Written by: Ariel Elior <ariele@broadcom.com>
17 */
18#ifndef VF_PF_IF_H
19#define VF_PF_IF_H
20
Ariel Eliorbe1f1ffa2013-01-01 05:22:24 +000021/* Common definitions for all HVs */
22struct vf_pf_resc_request {
23 u8 num_rxqs;
24 u8 num_txqs;
25 u8 num_sbs;
26 u8 num_mac_filters;
27 u8 num_vlan_filters;
28 u8 num_mc_filters; /* No limit so superfluous */
29};
30
31struct hw_sb_info {
32 u8 hw_sb_id; /* aka absolute igu id, used to ack the sb */
33 u8 sb_qid; /* used to update DHC for sb */
34};
35
Ariel Elior1ab44342013-01-01 05:22:23 +000036/* HW VF-PF channel definitions
37 * A.K.A VF-PF mailbox
38 */
39#define TLV_BUFFER_SIZE 1024
40
Ariel Elior8d9ac292013-01-01 05:22:27 +000041#define VFPF_QUEUE_FLG_TPA 0x0001
42#define VFPF_QUEUE_FLG_TPA_IPV6 0x0002
43#define VFPF_QUEUE_FLG_TPA_GRO 0x0004
44#define VFPF_QUEUE_FLG_CACHE_ALIGN 0x0008
45#define VFPF_QUEUE_FLG_STATS 0x0010
46#define VFPF_QUEUE_FLG_OV 0x0020
47#define VFPF_QUEUE_FLG_VLAN 0x0040
48#define VFPF_QUEUE_FLG_COS 0x0080
49#define VFPF_QUEUE_FLG_HC 0x0100
50#define VFPF_QUEUE_FLG_DHC 0x0200
51
52#define VFPF_QUEUE_DROP_IP_CS_ERR (1 << 0)
53#define VFPF_QUEUE_DROP_TCP_CS_ERR (1 << 1)
54#define VFPF_QUEUE_DROP_TTL0 (1 << 2)
55#define VFPF_QUEUE_DROP_UDP_CS_ERR (1 << 3)
56
Ariel Elior381ac162013-01-01 05:22:29 +000057#define VFPF_RX_MASK_ACCEPT_NONE 0x00000000
58#define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST 0x00000001
59#define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST 0x00000002
60#define VFPF_RX_MASK_ACCEPT_ALL_UNICAST 0x00000004
61#define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST 0x00000008
62#define VFPF_RX_MASK_ACCEPT_BROADCAST 0x00000010
63
Ariel Eliorbe1f1ffa2013-01-01 05:22:24 +000064enum {
65 PFVF_STATUS_WAITING = 0,
66 PFVF_STATUS_SUCCESS,
67 PFVF_STATUS_FAILURE,
68 PFVF_STATUS_NOT_SUPPORTED,
69 PFVF_STATUS_NO_RESOURCE
70};
71
72/* vf pf channel tlvs */
73/* general tlv header (used for both vf->pf request and pf->vf response) */
74struct channel_tlv {
75 u16 type;
76 u16 length;
77};
78
79/* header of first vf->pf tlv carries the offset used to calculate response
80 * buffer address
81 */
82struct vfpf_first_tlv {
83 struct channel_tlv tl;
84 u32 resp_msg_offset;
85};
86
87/* header of pf->vf tlvs, carries the status of handling the request */
88struct pfvf_tlv {
89 struct channel_tlv tl;
90 u8 status;
91 u8 padding[3];
92};
93
Ariel Elior4513f922013-01-01 05:22:25 +000094/* response tlv used for most tlvs */
95struct pfvf_general_resp_tlv {
96 struct pfvf_tlv hdr;
97};
98
Ariel Eliorbe1f1ffa2013-01-01 05:22:24 +000099/* used to terminate and pad a tlv list */
100struct channel_list_end_tlv {
101 struct channel_tlv tl;
102 u8 padding[4];
103};
104
105/* Acquire */
106struct vfpf_acquire_tlv {
107 struct vfpf_first_tlv first_tlv;
108
109 struct vf_pf_vfdev_info {
110 /* the following fields are for debug purposes */
111 u8 vf_id; /* ME register value */
112 u8 vf_os; /* e.g. Linux, W2K8 */
113 u8 padding[2];
114 } vfdev_info;
115
116 struct vf_pf_resc_request resc_request;
117
118 aligned_u64 bulletin_addr;
119};
120
Ariel Elior9b176b62013-01-01 05:22:28 +0000121/* simple operation request on queue */
122struct vfpf_q_op_tlv {
123 struct vfpf_first_tlv first_tlv;
124 u8 vf_qid;
125 u8 padding[3];
126};
127
Ariel Eliorbe1f1ffa2013-01-01 05:22:24 +0000128/* acquire response tlv - carries the allocated resources */
129struct pfvf_acquire_resp_tlv {
130 struct pfvf_tlv hdr;
131 struct pf_vf_pfdev_info {
132 u32 chip_num;
133 u32 pf_cap;
134#define PFVF_CAP_RSS 0x00000001
135#define PFVF_CAP_DHC 0x00000002
136#define PFVF_CAP_TPA 0x00000004
137 char fw_ver[32];
138 u16 db_size;
139 u8 indices_per_sb;
140 u8 padding;
141 } pfdev_info;
142 struct pf_vf_resc {
143 /* in case of status NO_RESOURCE in message hdr, pf will fill
144 * this struct with suggested amount of resources for next
145 * acquire request
146 */
147#define PFVF_MAX_QUEUES_PER_VF 16
148#define PFVF_MAX_SBS_PER_VF 16
149 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
150 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
151 u8 num_rxqs;
152 u8 num_txqs;
153 u8 num_sbs;
154 u8 num_mac_filters;
155 u8 num_vlan_filters;
156 u8 num_mc_filters;
157 u8 permanent_mac_addr[ETH_ALEN];
158 u8 current_mac_addr[ETH_ALEN];
159 u8 padding[2];
160 } resc;
161};
162
Ariel Elior8d9ac292013-01-01 05:22:27 +0000163/* Init VF */
164struct vfpf_init_tlv {
165 struct vfpf_first_tlv first_tlv;
166 aligned_u64 sb_addr[PFVF_MAX_SBS_PER_VF]; /* vf_sb based */
167 aligned_u64 spq_addr;
168 aligned_u64 stats_addr;
169};
170
171/* Setup Queue */
172struct vfpf_setup_q_tlv {
173 struct vfpf_first_tlv first_tlv;
174
175 struct vf_pf_rxq_params {
176 /* physical addresses */
177 aligned_u64 rcq_addr;
178 aligned_u64 rcq_np_addr;
179 aligned_u64 rxq_addr;
180 aligned_u64 sge_addr;
181
182 /* sb + hc info */
183 u8 vf_sb; /* index in hw_sbs[] */
184 u8 sb_index; /* Index in the SB */
185 u16 hc_rate; /* desired interrupts per sec. */
186 /* valid iff VFPF_QUEUE_FLG_HC */
187 /* rx buffer info */
188 u16 mtu;
189 u16 buf_sz;
190 u16 flags; /* VFPF_QUEUE_FLG_X flags */
191 u16 stat_id; /* valid iff VFPF_QUEUE_FLG_STATS */
192
193 /* valid iff VFPF_QUEUE_FLG_TPA */
194 u16 sge_buf_sz;
195 u16 tpa_agg_sz;
196 u8 max_sge_pkt;
197
198 u8 drop_flags; /* VFPF_QUEUE_DROP_X, for Linux VMs
199 * all the flags are turned off
200 */
201
202 u8 cache_line_log; /* VFPF_QUEUE_FLG_CACHE_ALIGN */
203 u8 padding;
204 } rxq;
205
206 struct vf_pf_txq_params {
207 /* physical addresses */
208 aligned_u64 txq_addr;
209
210 /* sb + hc info */
211 u8 vf_sb; /* index in hw_sbs[] */
212 u8 sb_index; /* Index in the SB */
213 u16 hc_rate; /* desired interrupts per sec. */
214 /* valid iff VFPF_QUEUE_FLG_HC */
215 u32 flags; /* VFPF_QUEUE_FLG_X flags */
216 u16 stat_id; /* valid iff VFPF_QUEUE_FLG_STATS */
217 u8 traffic_type; /* see in setup_context() */
218 u8 padding;
219 } txq;
220
221 u8 vf_qid; /* index in hw_qid[] */
222 u8 param_valid;
223#define VFPF_RXQ_VALID 0x01
224#define VFPF_TXQ_VALID 0x02
225 u8 padding[2];
226};
227
228/* Set Queue Filters */
229struct vfpf_q_mac_vlan_filter {
230 u32 flags;
231#define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
232#define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
233#define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
234 u8 mac[ETH_ALEN];
235 u16 vlan_tag;
236};
237
238/* configure queue filters */
239struct vfpf_set_q_filters_tlv {
240 struct vfpf_first_tlv first_tlv;
241
242 u32 flags;
243#define VFPF_SET_Q_FILTERS_MAC_VLAN_CHANGED 0x01
244#define VFPF_SET_Q_FILTERS_MULTICAST_CHANGED 0x02
245#define VFPF_SET_Q_FILTERS_RX_MASK_CHANGED 0x04
246
247 u8 vf_qid; /* index in hw_qid[] */
248 u8 n_mac_vlan_filters;
249 u8 n_multicast;
250 u8 padding;
251
252#define PFVF_MAX_MAC_FILTERS 16
253#define PFVF_MAX_VLAN_FILTERS 16
254#define PFVF_MAX_FILTERS (PFVF_MAX_MAC_FILTERS +\
255 PFVF_MAX_VLAN_FILTERS)
256 struct vfpf_q_mac_vlan_filter filters[PFVF_MAX_FILTERS];
257
258#define PFVF_MAX_MULTICAST_PER_VF 32
259 u8 multicast[PFVF_MAX_MULTICAST_PER_VF][ETH_ALEN];
260
261 u32 rx_mask; /* see mask constants at the top of the file */
262};
263
Ariel Elior9b176b62013-01-01 05:22:28 +0000264/* close VF (disable VF) */
265struct vfpf_close_tlv {
266 struct vfpf_first_tlv first_tlv;
267 u16 vf_id; /* for debug */
268 u8 padding[2];
269};
270
Ariel Elior4513f922013-01-01 05:22:25 +0000271/* release the VF's acquired resources */
272struct vfpf_release_tlv {
273 struct vfpf_first_tlv first_tlv;
274 u16 vf_id;
275 u8 padding[2];
276};
277
Ariel Elior1ab44342013-01-01 05:22:23 +0000278struct tlv_buffer_size {
279 u8 tlv_buffer[TLV_BUFFER_SIZE];
280};
281
282union vfpf_tlvs {
Ariel Eliorbe1f1ffa2013-01-01 05:22:24 +0000283 struct vfpf_first_tlv first_tlv;
284 struct vfpf_acquire_tlv acquire;
Ariel Elior8d9ac292013-01-01 05:22:27 +0000285 struct vfpf_init_tlv init;
Ariel Elior9b176b62013-01-01 05:22:28 +0000286 struct vfpf_close_tlv close;
287 struct vfpf_q_op_tlv q_op;
Ariel Elior8d9ac292013-01-01 05:22:27 +0000288 struct vfpf_setup_q_tlv setup_q;
289 struct vfpf_set_q_filters_tlv set_q_filters;
Ariel Elior4513f922013-01-01 05:22:25 +0000290 struct vfpf_release_tlv release;
Ariel Eliorbe1f1ffa2013-01-01 05:22:24 +0000291 struct channel_list_end_tlv list_end;
Ariel Elior1ab44342013-01-01 05:22:23 +0000292 struct tlv_buffer_size tlv_buf_size;
293};
294
295union pfvf_tlvs {
Ariel Elior4513f922013-01-01 05:22:25 +0000296 struct pfvf_general_resp_tlv general_resp;
Ariel Eliorbe1f1ffa2013-01-01 05:22:24 +0000297 struct pfvf_acquire_resp_tlv acquire_resp;
298 struct channel_list_end_tlv list_end;
Ariel Elior1ab44342013-01-01 05:22:23 +0000299 struct tlv_buffer_size tlv_buf_size;
300};
Ariel Eliorbe1f1ffa2013-01-01 05:22:24 +0000301
302#define MAX_TLVS_IN_LIST 50
303
304enum channel_tlvs {
305 CHANNEL_TLV_NONE,
306 CHANNEL_TLV_ACQUIRE,
Ariel Elior8d9ac292013-01-01 05:22:27 +0000307 CHANNEL_TLV_INIT,
308 CHANNEL_TLV_SETUP_Q,
309 CHANNEL_TLV_SET_Q_FILTERS,
Ariel Elior9b176b62013-01-01 05:22:28 +0000310 CHANNEL_TLV_TEARDOWN_Q,
311 CHANNEL_TLV_CLOSE,
Ariel Elior4513f922013-01-01 05:22:25 +0000312 CHANNEL_TLV_RELEASE,
Ariel Eliorf1929b02013-01-01 05:22:41 +0000313 CHANNEL_TLV_PF_RELEASE_VF,
Ariel Eliorbe1f1ffa2013-01-01 05:22:24 +0000314 CHANNEL_TLV_LIST_END,
315 CHANNEL_TLV_MAX
316};
317
Ariel Elior1ab44342013-01-01 05:22:23 +0000318#endif /* VF_PF_IF_H */