1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef VF_PF_IF_H
25 #define VF_PF_IF_H
26
27 #ifdef CONFIG_BNX2X_SRIOV
28
29
30 struct vf_pf_resc_request {
31 u8 num_rxqs;
32 u8 num_txqs;
33 u8 num_sbs;
34 u8 num_mac_filters;
35 u8 num_vlan_filters;
36 u8 num_mc_filters;
37 };
38
39 struct hw_sb_info {
40 u8 hw_sb_id;
41 u8 sb_qid;
42 };
43
44
45
46
47 #define TLV_BUFFER_SIZE 1024
48 #define PF_VF_BULLETIN_SIZE 512
49
50 #define VFPF_QUEUE_FLG_TPA 0x0001
51 #define VFPF_QUEUE_FLG_TPA_IPV6 0x0002
52 #define VFPF_QUEUE_FLG_TPA_GRO 0x0004
53 #define VFPF_QUEUE_FLG_CACHE_ALIGN 0x0008
54 #define VFPF_QUEUE_FLG_STATS 0x0010
55 #define VFPF_QUEUE_FLG_OV 0x0020
56 #define VFPF_QUEUE_FLG_VLAN 0x0040
57 #define VFPF_QUEUE_FLG_COS 0x0080
58 #define VFPF_QUEUE_FLG_HC 0x0100
59 #define VFPF_QUEUE_FLG_DHC 0x0200
60 #define VFPF_QUEUE_FLG_LEADING_RSS 0x0400
61
62 #define VFPF_QUEUE_DROP_IP_CS_ERR (1 << 0)
63 #define VFPF_QUEUE_DROP_TCP_CS_ERR (1 << 1)
64 #define VFPF_QUEUE_DROP_TTL0 (1 << 2)
65 #define VFPF_QUEUE_DROP_UDP_CS_ERR (1 << 3)
66
67 #define VFPF_RX_MASK_ACCEPT_NONE 0x00000000
68 #define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST 0x00000001
69 #define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST 0x00000002
70 #define VFPF_RX_MASK_ACCEPT_ALL_UNICAST 0x00000004
71 #define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST 0x00000008
72 #define VFPF_RX_MASK_ACCEPT_BROADCAST 0x00000010
73 #define VFPF_RX_MASK_ACCEPT_ANY_VLAN 0x00000020
74
75 #define BULLETIN_CONTENT_SIZE (sizeof(struct pf_vf_bulletin_content))
76 #define BULLETIN_CONTENT_LEGACY_SIZE (32)
77 #define BULLETIN_ATTEMPTS 5
78 #define BULLETIN_CRC_SEED 0
79
80 enum {
81 PFVF_STATUS_WAITING = 0,
82 PFVF_STATUS_SUCCESS,
83 PFVF_STATUS_FAILURE,
84 PFVF_STATUS_NOT_SUPPORTED,
85 PFVF_STATUS_NO_RESOURCE
86 };
87
88
89
90 struct channel_tlv {
91 u16 type;
92 u16 length;
93 };
94
95
96
97
98 struct vfpf_first_tlv {
99 struct channel_tlv tl;
100 u32 resp_msg_offset;
101 };
102
103
104 struct pfvf_tlv {
105 struct channel_tlv tl;
106 u8 status;
107 u8 padding[3];
108 };
109
110
111 struct pfvf_general_resp_tlv {
112 struct pfvf_tlv hdr;
113 };
114
115
116 struct channel_list_end_tlv {
117 struct channel_tlv tl;
118 u8 padding[4];
119 };
120
121
122 struct vfpf_acquire_tlv {
123 struct vfpf_first_tlv first_tlv;
124
125 struct vf_pf_vfdev_info {
126
127 u8 vf_id;
128 u8 vf_os;
129 #define VF_OS_SUBVERSION_MASK (0x1f)
130 #define VF_OS_MASK (0xe0)
131 #define VF_OS_SHIFT (5)
132 #define VF_OS_UNDEFINED (0 << VF_OS_SHIFT)
133 #define VF_OS_WINDOWS (1 << VF_OS_SHIFT)
134
135 u8 fp_hsi_ver;
136 u8 caps;
137 #define VF_CAP_SUPPORT_EXT_BULLETIN (1 << 0)
138 #define VF_CAP_SUPPORT_VLAN_FILTER (1 << 1)
139 } vfdev_info;
140
141 struct vf_pf_resc_request resc_request;
142
143 aligned_u64 bulletin_addr;
144 };
145
146
147 struct vfpf_q_op_tlv {
148 struct vfpf_first_tlv first_tlv;
149 u8 vf_qid;
150 u8 padding[3];
151 };
152
153
154 struct vfpf_rss_tlv {
155 struct vfpf_first_tlv first_tlv;
156 u32 rss_flags;
157 #define VFPF_RSS_MODE_DISABLED (1 << 0)
158 #define VFPF_RSS_MODE_REGULAR (1 << 1)
159 #define VFPF_RSS_SET_SRCH (1 << 2)
160 #define VFPF_RSS_IPV4 (1 << 3)
161 #define VFPF_RSS_IPV4_TCP (1 << 4)
162 #define VFPF_RSS_IPV4_UDP (1 << 5)
163 #define VFPF_RSS_IPV6 (1 << 6)
164 #define VFPF_RSS_IPV6_TCP (1 << 7)
165 #define VFPF_RSS_IPV6_UDP (1 << 8)
166 u8 rss_result_mask;
167 u8 ind_table_size;
168 u8 rss_key_size;
169 u8 padding;
170 u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
171 u32 rss_key[T_ETH_RSS_KEY];
172 };
173
174
175 struct pfvf_acquire_resp_tlv {
176 struct pfvf_tlv hdr;
177 struct pf_vf_pfdev_info {
178 u32 chip_num;
179 u32 pf_cap;
180 #define PFVF_CAP_RSS 0x00000001
181 #define PFVF_CAP_DHC 0x00000002
182 #define PFVF_CAP_TPA 0x00000004
183 #define PFVF_CAP_TPA_UPDATE 0x00000008
184 #define PFVF_CAP_VLAN_FILTER 0x00000010
185
186 char fw_ver[32];
187 u16 db_size;
188 u8 indices_per_sb;
189 u8 padding;
190 } pfdev_info;
191 struct pf_vf_resc {
192
193
194
195
196 #define PFVF_MAX_QUEUES_PER_VF 16
197 #define PFVF_MAX_SBS_PER_VF 16
198 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
199 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
200 u8 num_rxqs;
201 u8 num_txqs;
202 u8 num_sbs;
203 u8 num_mac_filters;
204 u8 num_vlan_filters;
205 u8 num_mc_filters;
206 u8 permanent_mac_addr[ETH_ALEN];
207 u8 current_mac_addr[ETH_ALEN];
208 u8 padding[2];
209 } resc;
210 };
211
212 struct vfpf_port_phys_id_resp_tlv {
213 struct channel_tlv tl;
214 u8 id[ETH_ALEN];
215 u8 padding[2];
216 };
217
218 struct vfpf_fp_hsi_resp_tlv {
219 struct channel_tlv tl;
220 u8 is_supported;
221 u8 padding[3];
222 };
223
224 #define VFPF_INIT_FLG_STATS_COALESCE (1 << 0)
225
226
227
228
229
230 struct vfpf_init_tlv {
231 struct vfpf_first_tlv first_tlv;
232 aligned_u64 sb_addr[PFVF_MAX_SBS_PER_VF];
233 aligned_u64 spq_addr;
234 aligned_u64 stats_addr;
235 u16 stats_stride;
236 u32 flags;
237 u32 padding[2];
238 };
239
240
241 struct vfpf_setup_q_tlv {
242 struct vfpf_first_tlv first_tlv;
243
244 struct vf_pf_rxq_params {
245
246 aligned_u64 rcq_addr;
247 aligned_u64 rcq_np_addr;
248 aligned_u64 rxq_addr;
249 aligned_u64 sge_addr;
250
251
252 u8 vf_sb;
253 u8 sb_index;
254 u16 hc_rate;
255
256
257 u16 mtu;
258 u16 buf_sz;
259 u16 flags;
260 u16 stat_id;
261
262
263 u16 sge_buf_sz;
264 u16 tpa_agg_sz;
265 u8 max_sge_pkt;
266
267 u8 drop_flags;
268
269
270
271 u8 cache_line_log;
272 u8 padding;
273 } rxq;
274
275 struct vf_pf_txq_params {
276
277 aligned_u64 txq_addr;
278
279
280 u8 vf_sb;
281 u8 sb_index;
282 u16 hc_rate;
283
284 u32 flags;
285 u16 stat_id;
286 u8 traffic_type;
287 u8 padding;
288 } txq;
289
290 u8 vf_qid;
291 u8 param_valid;
292 #define VFPF_RXQ_VALID 0x01
293 #define VFPF_TXQ_VALID 0x02
294 u8 padding[2];
295 };
296
297
298 struct vfpf_q_mac_vlan_filter {
299 u32 flags;
300 #define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
301 #define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
302 #define VFPF_Q_FILTER_SET 0x100
303 u8 mac[ETH_ALEN];
304 u16 vlan_tag;
305 };
306
307
308 struct vfpf_set_q_filters_tlv {
309 struct vfpf_first_tlv first_tlv;
310
311 u32 flags;
312 #define VFPF_SET_Q_FILTERS_MAC_VLAN_CHANGED 0x01
313 #define VFPF_SET_Q_FILTERS_MULTICAST_CHANGED 0x02
314 #define VFPF_SET_Q_FILTERS_RX_MASK_CHANGED 0x04
315
316 u8 vf_qid;
317 u8 n_mac_vlan_filters;
318 u8 n_multicast;
319 u8 padding;
320
321 #define PFVF_MAX_MAC_FILTERS 16
322 #define PFVF_MAX_VLAN_FILTERS 16
323 #define PFVF_MAX_FILTERS (PFVF_MAX_MAC_FILTERS +\
324 PFVF_MAX_VLAN_FILTERS)
325 struct vfpf_q_mac_vlan_filter filters[PFVF_MAX_FILTERS];
326
327 #define PFVF_MAX_MULTICAST_PER_VF 32
328 u8 multicast[PFVF_MAX_MULTICAST_PER_VF][ETH_ALEN];
329
330 u32 rx_mask;
331 };
332
333 struct vfpf_tpa_tlv {
334 struct vfpf_first_tlv first_tlv;
335
336 struct vf_pf_tpa_client_info {
337 aligned_u64 sge_addr[PFVF_MAX_QUEUES_PER_VF];
338 u8 update_ipv4;
339 u8 update_ipv6;
340 u8 max_tpa_queues;
341 u8 max_sges_for_packet;
342 u8 complete_on_both_clients;
343 u8 dont_verify_thr;
344 u8 tpa_mode;
345 u16 sge_buff_size;
346 u16 max_agg_size;
347 u16 sge_pause_thr_low;
348 u16 sge_pause_thr_high;
349 } tpa_client_info;
350 };
351
352
353 struct vfpf_close_tlv {
354 struct vfpf_first_tlv first_tlv;
355 u16 vf_id;
356 u8 padding[2];
357 };
358
359
360 struct vfpf_release_tlv {
361 struct vfpf_first_tlv first_tlv;
362 u16 vf_id;
363 u8 padding[2];
364 };
365
366 struct tlv_buffer_size {
367 u8 tlv_buffer[TLV_BUFFER_SIZE];
368 };
369
370 union vfpf_tlvs {
371 struct vfpf_first_tlv first_tlv;
372 struct vfpf_acquire_tlv acquire;
373 struct vfpf_init_tlv init;
374 struct vfpf_close_tlv close;
375 struct vfpf_q_op_tlv q_op;
376 struct vfpf_setup_q_tlv setup_q;
377 struct vfpf_set_q_filters_tlv set_q_filters;
378 struct vfpf_release_tlv release;
379 struct vfpf_rss_tlv update_rss;
380 struct vfpf_tpa_tlv update_tpa;
381 struct channel_list_end_tlv list_end;
382 struct tlv_buffer_size tlv_buf_size;
383 };
384
385 union pfvf_tlvs {
386 struct pfvf_general_resp_tlv general_resp;
387 struct pfvf_acquire_resp_tlv acquire_resp;
388 struct channel_list_end_tlv list_end;
389 struct tlv_buffer_size tlv_buf_size;
390 };
391
392
393
394
395
396
397 struct pf_vf_bulletin_size {
398 u8 size[PF_VF_BULLETIN_SIZE];
399 };
400
401 struct pf_vf_bulletin_content {
402 u32 crc;
403
404
405 u16 version;
406 u16 length;
407
408 aligned_u64 valid_bitmap;
409
410
411
412 #define MAC_ADDR_VALID 0
413
414
415 #define VLAN_VALID 1
416
417
418 #define CHANNEL_DOWN 2
419
420
421
422 #define LINK_VALID 3
423
424
425 u8 mac[ETH_ALEN];
426 u8 mac_padding[2];
427
428 u16 vlan;
429 u8 vlan_padding[6];
430
431 u16 link_speed;
432 u8 link_speed_padding[6];
433 u32 link_flags;
434 #define VFPF_LINK_REPORT_LINK_DOWN (1 << 0)
435 #define VFPF_LINK_REPORT_FULL_DUPLEX (1 << 1)
436 #define VFPF_LINK_REPORT_RX_FC_ON (1 << 2)
437 #define VFPF_LINK_REPORT_TX_FC_ON (1 << 3)
438 u8 link_flags_padding[4];
439 };
440
441 union pf_vf_bulletin {
442 struct pf_vf_bulletin_content content;
443 struct pf_vf_bulletin_size size;
444 };
445
446 #define MAX_TLVS_IN_LIST 50
447
448 enum channel_tlvs {
449 CHANNEL_TLV_NONE,
450 CHANNEL_TLV_ACQUIRE,
451 CHANNEL_TLV_INIT,
452 CHANNEL_TLV_SETUP_Q,
453 CHANNEL_TLV_SET_Q_FILTERS,
454 CHANNEL_TLV_ACTIVATE_Q,
455 CHANNEL_TLV_DEACTIVATE_Q,
456 CHANNEL_TLV_TEARDOWN_Q,
457 CHANNEL_TLV_CLOSE,
458 CHANNEL_TLV_RELEASE,
459 CHANNEL_TLV_UPDATE_RSS_DEPRECATED,
460 CHANNEL_TLV_PF_RELEASE_VF,
461 CHANNEL_TLV_LIST_END,
462 CHANNEL_TLV_FLR,
463 CHANNEL_TLV_PF_SET_MAC,
464 CHANNEL_TLV_PF_SET_VLAN,
465 CHANNEL_TLV_UPDATE_RSS,
466 CHANNEL_TLV_PHYS_PORT_ID,
467 CHANNEL_TLV_UPDATE_TPA,
468 CHANNEL_TLV_FP_HSI_SUPPORT,
469 CHANNEL_TLV_MAX
470 };
471
472 #endif
473 #endif