]> git.proxmox.com Git - ceph.git/blob - ceph/src/dpdk/drivers/net/qede/base/ecore_vfpf_if.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / dpdk / drivers / net / qede / base / ecore_vfpf_if.h
1 /*
2 * Copyright (c) 2016 QLogic Corporation.
3 * All rights reserved.
4 * www.qlogic.com
5 *
6 * See LICENSE.qede_pmd for copyright and licensing details.
7 */
8
9 #ifndef __ECORE_VF_PF_IF_H__
10 #define __ECORE_VF_PF_IF_H__
11
12 /* @@@ TBD MichalK this should be HSI? */
13 #define T_ETH_INDIRECTION_TABLE_SIZE 128
14 #define T_ETH_RSS_KEY_SIZE 10 /* @@@ TBD this should be HSI? */
15
16 /***********************************************
17 *
18 * Common definitions for all HVs
19 *
20 **/
21 struct vf_pf_resc_request {
22 u8 num_rxqs;
23 u8 num_txqs;
24 u8 num_sbs;
25 u8 num_mac_filters;
26 u8 num_vlan_filters;
27 u8 num_mc_filters; /* No limit so superfluous */
28 u16 padding;
29 };
30
31 struct hw_sb_info {
32 u16 hw_sb_id; /* aka absolute igu id, used to ack the sb */
33 u8 sb_qid; /* used to update DHC for sb */
34 u8 padding[5];
35 };
36
37 /***********************************************
38 *
39 * HW VF-PF channel definitions
40 *
41 * A.K.A VF-PF mailbox
42 *
43 **/
44 #define TLV_BUFFER_SIZE 1024
45
46 /* vf pf channel tlvs */
47 /* general tlv header (used for both vf->pf request and pf->vf response) */
48 struct channel_tlv {
49 u16 type;
50 u16 length;
51 };
52
53 /* header of first vf->pf tlv carries the offset used to calculate response
54 * buffer address
55 */
56 struct vfpf_first_tlv {
57 struct channel_tlv tl;
58 u32 padding;
59 u64 reply_address;
60 };
61
62 /* header of pf->vf tlvs, carries the status of handling the request */
63 struct pfvf_tlv {
64 struct channel_tlv tl;
65 u8 status;
66 u8 padding[3];
67 };
68
69 /* response tlv used for most tlvs */
70 struct pfvf_def_resp_tlv {
71 struct pfvf_tlv hdr;
72 };
73
74 /* used to terminate and pad a tlv list */
75 struct channel_list_end_tlv {
76 struct channel_tlv tl;
77 u8 padding[4];
78 };
79
80 /* Acquire */
81 struct vfpf_acquire_tlv {
82 struct vfpf_first_tlv first_tlv;
83
84 struct vf_pf_vfdev_info {
85 #ifndef LINUX_REMOVE
86 /* First bit was used on 8.7.x and 8.8.x versions, which had different
87 * FWs used but with the same faspath HSI. As this was prior to the
88 * fastpath versioning, wanted to have ability to override fw matching
89 * and allow them to interact.
90 */
91 #endif
92 /* VF pre-FP hsi version */
93 #define VFPF_ACQUIRE_CAP_PRE_FP_HSI (1 << 0)
94 #define VFPF_ACQUIRE_CAP_100G (1 << 1) /* VF can support 100g */
95 u64 capabilities;
96 u8 fw_major;
97 u8 fw_minor;
98 u8 fw_revision;
99 u8 fw_engineering;
100 u32 driver_version;
101 u16 opaque_fid; /* ME register value */
102 u8 os_type; /* VFPF_ACQUIRE_OS_* value */
103 u8 eth_fp_hsi_major;
104 u8 eth_fp_hsi_minor;
105 u8 padding[3];
106 } vfdev_info;
107
108 struct vf_pf_resc_request resc_request;
109
110 u64 bulletin_addr;
111 u32 bulletin_size;
112 u32 padding;
113 };
114
115 /* receive side scaling tlv */
116 struct vfpf_vport_update_rss_tlv {
117 struct channel_tlv tl;
118
119 u8 update_rss_flags;
120 #define VFPF_UPDATE_RSS_CONFIG_FLAG (1 << 0)
121 #define VFPF_UPDATE_RSS_CAPS_FLAG (1 << 1)
122 #define VFPF_UPDATE_RSS_IND_TABLE_FLAG (1 << 2)
123 #define VFPF_UPDATE_RSS_KEY_FLAG (1 << 3)
124
125 u8 rss_enable;
126 u8 rss_caps;
127 u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
128 u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
129 u32 rss_key[T_ETH_RSS_KEY_SIZE];
130 };
131
132 struct pfvf_storm_stats {
133 u32 address;
134 u32 len;
135 };
136
137 struct pfvf_stats_info {
138 struct pfvf_storm_stats mstats;
139 struct pfvf_storm_stats pstats;
140 struct pfvf_storm_stats tstats;
141 struct pfvf_storm_stats ustats;
142 };
143
144 /* acquire response tlv - carries the allocated resources */
145 struct pfvf_acquire_resp_tlv {
146 struct pfvf_tlv hdr;
147
148 struct pf_vf_pfdev_info {
149 u32 chip_num;
150 u32 mfw_ver;
151
152 u16 fw_major;
153 u16 fw_minor;
154 u16 fw_rev;
155 u16 fw_eng;
156
157 u64 capabilities;
158 #define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED (1 << 0)
159 #define PFVF_ACQUIRE_CAP_100G (1 << 1) /* If set, 100g PF */
160 /* There are old PF versions where the PF might mistakenly override the sanity
161 * mechanism [version-based] and allow a VF that can't be supported to pass
162 * the acquisition phase.
163 * To overcome this, PFs now indicate that they're past that point and the new
164 * VFs would fail probe on the older PFs that fail to do so.
165 */
166 #ifndef LINUX_REMOVE
167 /* Said bug was in quest/serpens; Can't be certain no official release included
168 * the bug since the fix arrived very late in the programs.
169 */
170 #endif
171 #define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE (1 << 2)
172
173 u16 db_size;
174 u8 indices_per_sb;
175 u8 os_type;
176
177 /* These should match the PF's ecore_dev values */
178 u16 chip_rev;
179 u8 dev_type;
180
181 u8 padding;
182
183 struct pfvf_stats_info stats_info;
184
185 u8 port_mac[ETH_ALEN];
186
187 /* It's possible PF had to configure an older fastpath HSI
188 * [in case VF is newer than PF]. This is communicated back
189 * to the VF. It can also be used in case of error due to
190 * non-matching versions to shed light in VF about failure.
191 */
192 u8 major_fp_hsi;
193 u8 minor_fp_hsi;
194 } pfdev_info;
195
196 struct pf_vf_resc {
197 /* in case of status NO_RESOURCE in message hdr, pf will fill
198 * this struct with suggested amount of resources for next
199 * acquire request
200 */
201 #define PFVF_MAX_QUEUES_PER_VF 16
202 #define PFVF_MAX_SBS_PER_VF 16
203 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
204 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
205 u8 cid[PFVF_MAX_QUEUES_PER_VF];
206
207 u8 num_rxqs;
208 u8 num_txqs;
209 u8 num_sbs;
210 u8 num_mac_filters;
211 u8 num_vlan_filters;
212 u8 num_mc_filters;
213 u8 padding[2];
214 } resc;
215
216 u32 bulletin_size;
217 u32 padding;
218 };
219
220 struct pfvf_start_queue_resp_tlv {
221 struct pfvf_tlv hdr;
222 u32 offset; /* offset to consumer/producer of queue */
223 u8 padding[4];
224 };
225
226 /* Setup Queue */
227 struct vfpf_start_rxq_tlv {
228 struct vfpf_first_tlv first_tlv;
229
230 /* physical addresses */
231 u64 rxq_addr;
232 u64 deprecated_sge_addr;
233 u64 cqe_pbl_addr;
234
235 u16 cqe_pbl_size;
236 u16 hw_sb;
237 u16 rx_qid;
238 u16 hc_rate; /* desired interrupts per sec. */
239
240 u16 bd_max_bytes;
241 u16 stat_id;
242 u8 sb_index;
243 u8 padding[3];
244
245 };
246
247 struct vfpf_start_txq_tlv {
248 struct vfpf_first_tlv first_tlv;
249
250 /* physical addresses */
251 u64 pbl_addr;
252 u16 pbl_size;
253 u16 stat_id;
254 u16 tx_qid;
255 u16 hw_sb;
256
257 u32 flags; /* VFPF_QUEUE_FLG_X flags */
258 u16 hc_rate; /* desired interrupts per sec. */
259 u8 sb_index;
260 u8 padding[3];
261 };
262
263 /* Stop RX Queue */
264 struct vfpf_stop_rxqs_tlv {
265 struct vfpf_first_tlv first_tlv;
266
267 u16 rx_qid;
268 u8 num_rxqs;
269 u8 cqe_completion;
270 u8 padding[4];
271 };
272
273 /* Stop TX Queues */
274 struct vfpf_stop_txqs_tlv {
275 struct vfpf_first_tlv first_tlv;
276
277 u16 tx_qid;
278 u8 num_txqs;
279 u8 padding[5];
280 };
281
282 struct vfpf_update_rxq_tlv {
283 struct vfpf_first_tlv first_tlv;
284
285 u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
286
287 u16 rx_qid;
288 u8 num_rxqs;
289 u8 flags;
290 #define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG (1 << 0)
291 #define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG (1 << 1)
292 #define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG (1 << 2)
293
294 u8 padding[4];
295 };
296
297 /* Set Queue Filters */
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_MAC 0x100 /* set/clear */
303
304 u8 mac[ETH_ALEN];
305 u16 vlan_tag;
306
307 u8 padding[4];
308 };
309
310 /* Start a vport */
311 struct vfpf_vport_start_tlv {
312 struct vfpf_first_tlv first_tlv;
313
314 u64 sb_addr[PFVF_MAX_SBS_PER_VF];
315
316 u32 tpa_mode;
317 u16 dep1;
318 u16 mtu;
319
320 u8 vport_id;
321 u8 inner_vlan_removal;
322
323 u8 only_untagged;
324 u8 max_buffers_per_cqe;
325
326 u8 padding[4];
327 };
328
329 /* Extended tlvs - need to add rss, mcast, accept mode tlvs */
330 struct vfpf_vport_update_activate_tlv {
331 struct channel_tlv tl;
332 u8 update_rx;
333 u8 update_tx;
334 u8 active_rx;
335 u8 active_tx;
336 };
337
338 struct vfpf_vport_update_tx_switch_tlv {
339 struct channel_tlv tl;
340 u8 tx_switching;
341 u8 padding[3];
342 };
343
344 struct vfpf_vport_update_vlan_strip_tlv {
345 struct channel_tlv tl;
346 u8 remove_vlan;
347 u8 padding[3];
348 };
349
350 struct vfpf_vport_update_mcast_bin_tlv {
351 struct channel_tlv tl;
352 u8 padding[4];
353
354 u64 bins[8];
355 };
356
357 struct vfpf_vport_update_accept_param_tlv {
358 struct channel_tlv tl;
359 u8 update_rx_mode;
360 u8 update_tx_mode;
361 u8 rx_accept_filter;
362 u8 tx_accept_filter;
363 };
364
365 struct vfpf_vport_update_accept_any_vlan_tlv {
366 struct channel_tlv tl;
367 u8 update_accept_any_vlan_flg;
368 u8 accept_any_vlan;
369
370 u8 padding[2];
371 };
372
373 struct vfpf_vport_update_sge_tpa_tlv {
374 struct channel_tlv tl;
375
376 u16 sge_tpa_flags;
377 #define VFPF_TPA_IPV4_EN_FLAG (1 << 0)
378 #define VFPF_TPA_IPV6_EN_FLAG (1 << 1)
379 #define VFPF_TPA_PKT_SPLIT_FLAG (1 << 2)
380 #define VFPF_TPA_HDR_DATA_SPLIT_FLAG (1 << 3)
381 #define VFPF_TPA_GRO_CONSIST_FLAG (1 << 4)
382
383 u8 update_sge_tpa_flags;
384 #define VFPF_UPDATE_SGE_DEPRECATED_FLAG (1 << 0)
385 #define VFPF_UPDATE_TPA_EN_FLAG (1 << 1)
386 #define VFPF_UPDATE_TPA_PARAM_FLAG (1 << 2)
387
388 u8 max_buffers_per_cqe;
389
390 u16 deprecated_sge_buff_size;
391 u16 tpa_max_size;
392 u16 tpa_min_size_to_start;
393 u16 tpa_min_size_to_cont;
394
395 u8 tpa_max_aggs_num;
396 u8 padding[7];
397
398 };
399
400 /* Primary tlv as a header for various extended tlvs for
401 * various functionalities in vport update ramrod.
402 */
403 struct vfpf_vport_update_tlv {
404 struct vfpf_first_tlv first_tlv;
405 };
406
407 struct vfpf_ucast_filter_tlv {
408 struct vfpf_first_tlv first_tlv;
409
410 u8 opcode;
411 u8 type;
412
413 u8 mac[ETH_ALEN];
414
415 u16 vlan;
416 u16 padding[3];
417 };
418
419 struct tlv_buffer_size {
420 u8 tlv_buffer[TLV_BUFFER_SIZE];
421 };
422
423 union vfpf_tlvs {
424 struct vfpf_first_tlv first_tlv;
425 struct vfpf_acquire_tlv acquire;
426 struct vfpf_start_rxq_tlv start_rxq;
427 struct vfpf_start_txq_tlv start_txq;
428 struct vfpf_stop_rxqs_tlv stop_rxqs;
429 struct vfpf_stop_txqs_tlv stop_txqs;
430 struct vfpf_update_rxq_tlv update_rxq;
431 struct vfpf_vport_start_tlv start_vport;
432 struct vfpf_vport_update_tlv vport_update;
433 struct vfpf_ucast_filter_tlv ucast_filter;
434 struct tlv_buffer_size tlv_buf_size;
435 };
436
437 union pfvf_tlvs {
438 struct pfvf_def_resp_tlv default_resp;
439 struct pfvf_acquire_resp_tlv acquire_resp;
440 struct tlv_buffer_size tlv_buf_size;
441 struct pfvf_start_queue_resp_tlv queue_start;
442 };
443
444 /* This is a structure which is allocated in the VF, which the PF may update
445 * when it deems it necessary to do so. The bulletin board is sampled
446 * periodically by the VF. A copy per VF is maintained in the PF (to prevent
447 * loss of data upon multiple updates (or the need for read modify write)).
448 */
449 enum ecore_bulletin_bit {
450 /* Alert the VF that a forced MAC was set by the PF */
451 MAC_ADDR_FORCED = 0,
452
453 /* The VF should not access the vfpf channel */
454 VFPF_CHANNEL_INVALID = 1,
455
456 /* Alert the VF that a forced VLAN was set by the PF */
457 VLAN_ADDR_FORCED = 2,
458
459 /* Indicate that `default_only_untagged' contains actual data */
460 VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
461 VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
462
463 /* Alert the VF that suggested mac was sent by the PF.
464 * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set
465 */
466 VFPF_BULLETIN_MAC_ADDR = 5
467 };
468
469 struct ecore_bulletin_content {
470 /* crc of structure to ensure is not in mid-update */
471 u32 crc;
472
473 u32 version;
474
475 /* bitmap indicating which fields hold valid values */
476 u64 valid_bitmap;
477
478 /* used for MAC_ADDR or MAC_ADDR_FORCED */
479 u8 mac[ETH_ALEN];
480
481 /* If valid, 1 => only untagged Rx if no vlan is configured */
482 u8 default_only_untagged;
483 u8 padding;
484
485 /* The following is a 'copy' of ecore_mcp_link_state,
486 * ecore_mcp_link_params and ecore_mcp_link_capabilities. Since it's
487 * possible the structs will increase further along the road we cannot
488 * have it here; Instead we need to have all of its fields.
489 */
490 u8 req_autoneg;
491 u8 req_autoneg_pause;
492 u8 req_forced_rx;
493 u8 req_forced_tx;
494 u8 padding2[4];
495
496 u32 req_adv_speed;
497 u32 req_forced_speed;
498 u32 req_loopback;
499 u32 padding3;
500
501 u8 link_up;
502 u8 full_duplex;
503 u8 autoneg;
504 u8 autoneg_complete;
505 u8 parallel_detection;
506 u8 pfc_enabled;
507 u8 partner_tx_flow_ctrl_en;
508 u8 partner_rx_flow_ctrl_en;
509 u8 partner_adv_pause;
510 u8 sfp_tx_fault;
511 u8 padding4[6];
512
513 u32 speed;
514 u32 partner_adv_speed;
515
516 u32 capability_speed;
517
518 /* Forced vlan */
519 u16 pvid;
520 u16 padding5;
521 };
522
523 struct ecore_bulletin {
524 dma_addr_t phys;
525 struct ecore_bulletin_content *p_virt;
526 u32 size;
527 };
528
529 enum {
530 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
531
532 CHANNEL_TLV_NONE, /* ends tlv sequence */
533 CHANNEL_TLV_ACQUIRE,
534 CHANNEL_TLV_VPORT_START,
535 CHANNEL_TLV_VPORT_UPDATE,
536 CHANNEL_TLV_VPORT_TEARDOWN,
537 CHANNEL_TLV_START_RXQ,
538 CHANNEL_TLV_START_TXQ,
539 CHANNEL_TLV_STOP_RXQS,
540 CHANNEL_TLV_STOP_TXQS,
541 CHANNEL_TLV_UPDATE_RXQ,
542 CHANNEL_TLV_INT_CLEANUP,
543 CHANNEL_TLV_CLOSE,
544 CHANNEL_TLV_RELEASE,
545 CHANNEL_TLV_LIST_END,
546 CHANNEL_TLV_UCAST_FILTER,
547 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
548 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
549 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
550 CHANNEL_TLV_VPORT_UPDATE_MCAST,
551 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
552 CHANNEL_TLV_VPORT_UPDATE_RSS,
553 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
554 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
555 CHANNEL_TLV_MAX,
556
557 /* Required for iterating over vport-update tlvs.
558 * Will break in case non-sequential vport-update tlvs.
559 */
560 CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
561
562 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
563 };
564 extern const char *ecore_channel_tlvs_string[];
565
566 #endif /* __ECORE_VF_PF_IF_H__ */