blob: d9a8aa684ad7ead0279dfd61d6430c0b51600556 [file] [log] [blame]
Yuval Mintz32a47e72016-05-11 16:36:12 +03001/* QLogic qed NIC Driver
2 * Copyright (c) 2015 QLogic Corporation
3 *
4 * This software is available under the terms of the GNU General Public License
5 * (GPL) Version 2, available from the file COPYING in the main directory of
6 * this source tree.
7 */
8
9#ifndef _QED_VF_H
10#define _QED_VF_H
11
Yuval Mintzdacd88d2016-05-11 16:36:16 +030012#include "qed_l2.h"
Yuval Mintz36558c32016-05-11 16:36:17 +030013#include "qed_mcp.h"
Yuval Mintzdacd88d2016-05-11 16:36:16 +030014
15#define T_ETH_INDIRECTION_TABLE_SIZE 128
16#define T_ETH_RSS_KEY_SIZE 10
17
Yuval Mintz1408cc1f2016-05-11 16:36:14 +030018struct vf_pf_resc_request {
19 u8 num_rxqs;
20 u8 num_txqs;
21 u8 num_sbs;
22 u8 num_mac_filters;
23 u8 num_vlan_filters;
24 u8 num_mc_filters;
25 u16 padding;
26};
27
28struct hw_sb_info {
29 u16 hw_sb_id;
30 u8 sb_qid;
31 u8 padding[5];
32};
33
Yuval Mintzdacd88d2016-05-11 16:36:16 +030034#define TLV_BUFFER_SIZE 1024
35
Yuval Mintz37bff2b2016-05-11 16:36:13 +030036enum {
37 PFVF_STATUS_WAITING,
38 PFVF_STATUS_SUCCESS,
39 PFVF_STATUS_FAILURE,
40 PFVF_STATUS_NOT_SUPPORTED,
41 PFVF_STATUS_NO_RESOURCE,
42 PFVF_STATUS_FORCED,
43};
44
45/* vf pf channel tlvs */
46/* general tlv header (used for both vf->pf request and pf->vf response) */
47struct channel_tlv {
48 u16 type;
49 u16 length;
50};
51
52/* header of first vf->pf tlv carries the offset used to calculate reponse
53 * buffer address
54 */
55struct vfpf_first_tlv {
56 struct channel_tlv tl;
57 u32 padding;
58 u64 reply_address;
59};
60
61/* header of pf->vf tlvs, carries the status of handling the request */
62struct pfvf_tlv {
63 struct channel_tlv tl;
64 u8 status;
65 u8 padding[3];
66};
67
68/* response tlv used for most tlvs */
69struct pfvf_def_resp_tlv {
70 struct pfvf_tlv hdr;
71};
72
73/* used to terminate and pad a tlv list */
74struct channel_list_end_tlv {
75 struct channel_tlv tl;
76 u8 padding[4];
77};
78
Yuval Mintz1408cc1f2016-05-11 16:36:14 +030079#define VFPF_ACQUIRE_OS_LINUX (0)
80#define VFPF_ACQUIRE_OS_WINDOWS (1)
81#define VFPF_ACQUIRE_OS_ESX (2)
82#define VFPF_ACQUIRE_OS_SOLARIS (3)
83#define VFPF_ACQUIRE_OS_LINUX_USERSPACE (4)
84
85struct vfpf_acquire_tlv {
86 struct vfpf_first_tlv first_tlv;
87
88 struct vf_pf_vfdev_info {
89#define VFPF_ACQUIRE_CAP_OBSOLETE (1 << 0)
90#define VFPF_ACQUIRE_CAP_100G (1 << 1) /* VF can support 100g */
91 u64 capabilities;
92 u8 fw_major;
93 u8 fw_minor;
94 u8 fw_revision;
95 u8 fw_engineering;
96 u32 driver_version;
97 u16 opaque_fid; /* ME register value */
98 u8 os_type; /* VFPF_ACQUIRE_OS_* value */
99 u8 padding[5];
100 } vfdev_info;
101
102 struct vf_pf_resc_request resc_request;
103
104 u64 bulletin_addr;
105 u32 bulletin_size;
106 u32 padding;
107};
108
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300109/* receive side scaling tlv */
110struct vfpf_vport_update_rss_tlv {
111 struct channel_tlv tl;
112
113 u8 update_rss_flags;
114#define VFPF_UPDATE_RSS_CONFIG_FLAG BIT(0)
115#define VFPF_UPDATE_RSS_CAPS_FLAG BIT(1)
116#define VFPF_UPDATE_RSS_IND_TABLE_FLAG BIT(2)
117#define VFPF_UPDATE_RSS_KEY_FLAG BIT(3)
118
119 u8 rss_enable;
120 u8 rss_caps;
121 u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
122 u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
123 u32 rss_key[T_ETH_RSS_KEY_SIZE];
124};
125
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300126struct pfvf_storm_stats {
127 u32 address;
128 u32 len;
129};
130
131struct pfvf_stats_info {
132 struct pfvf_storm_stats mstats;
133 struct pfvf_storm_stats pstats;
134 struct pfvf_storm_stats tstats;
135 struct pfvf_storm_stats ustats;
136};
137
138struct pfvf_acquire_resp_tlv {
139 struct pfvf_tlv hdr;
140
141 struct pf_vf_pfdev_info {
142 u32 chip_num;
143 u32 mfw_ver;
144
145 u16 fw_major;
146 u16 fw_minor;
147 u16 fw_rev;
148 u16 fw_eng;
149
150 u64 capabilities;
151#define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED BIT(0)
152#define PFVF_ACQUIRE_CAP_100G BIT(1) /* If set, 100g PF */
153/* There are old PF versions where the PF might mistakenly override the sanity
154 * mechanism [version-based] and allow a VF that can't be supported to pass
155 * the acquisition phase.
156 * To overcome this, PFs now indicate that they're past that point and the new
157 * VFs would fail probe on the older PFs that fail to do so.
158 */
159#define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE BIT(2)
160
161 u16 db_size;
162 u8 indices_per_sb;
163 u8 os_type;
164
165 /* These should match the PF's qed_dev values */
166 u16 chip_rev;
167 u8 dev_type;
168
169 u8 padding;
170
171 struct pfvf_stats_info stats_info;
172
173 u8 port_mac[ETH_ALEN];
174 u8 padding2[2];
175 } pfdev_info;
176
177 struct pf_vf_resc {
178#define PFVF_MAX_QUEUES_PER_VF 16
179#define PFVF_MAX_SBS_PER_VF 16
180 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
181 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
182 u8 cid[PFVF_MAX_QUEUES_PER_VF];
183
184 u8 num_rxqs;
185 u8 num_txqs;
186 u8 num_sbs;
187 u8 num_mac_filters;
188 u8 num_vlan_filters;
189 u8 num_mc_filters;
190 u8 padding[2];
191 } resc;
192
193 u32 bulletin_size;
194 u32 padding;
195};
196
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300197struct pfvf_start_queue_resp_tlv {
198 struct pfvf_tlv hdr;
199 u32 offset; /* offset to consumer/producer of queue */
200 u8 padding[4];
201};
202
203/* Setup Queue */
204struct vfpf_start_rxq_tlv {
205 struct vfpf_first_tlv first_tlv;
206
207 /* physical addresses */
208 u64 rxq_addr;
209 u64 deprecated_sge_addr;
210 u64 cqe_pbl_addr;
211
212 u16 cqe_pbl_size;
213 u16 hw_sb;
214 u16 rx_qid;
215 u16 hc_rate; /* desired interrupts per sec. */
216
217 u16 bd_max_bytes;
218 u16 stat_id;
219 u8 sb_index;
220 u8 padding[3];
221};
222
223struct vfpf_start_txq_tlv {
224 struct vfpf_first_tlv first_tlv;
225
226 /* physical addresses */
227 u64 pbl_addr;
228 u16 pbl_size;
229 u16 stat_id;
230 u16 tx_qid;
231 u16 hw_sb;
232
233 u32 flags; /* VFPF_QUEUE_FLG_X flags */
234 u16 hc_rate; /* desired interrupts per sec. */
235 u8 sb_index;
236 u8 padding[3];
237};
238
239/* Stop RX Queue */
240struct vfpf_stop_rxqs_tlv {
241 struct vfpf_first_tlv first_tlv;
242
243 u16 rx_qid;
244 u8 num_rxqs;
245 u8 cqe_completion;
246 u8 padding[4];
247};
248
249/* Stop TX Queues */
250struct vfpf_stop_txqs_tlv {
251 struct vfpf_first_tlv first_tlv;
252
253 u16 tx_qid;
254 u8 num_txqs;
255 u8 padding[5];
256};
257
258struct vfpf_update_rxq_tlv {
259 struct vfpf_first_tlv first_tlv;
260
261 u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
262
263 u16 rx_qid;
264 u8 num_rxqs;
265 u8 flags;
266#define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG BIT(0)
267#define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG BIT(1)
268#define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG BIT(2)
269
270 u8 padding[4];
271};
272
273/* Set Queue Filters */
274struct vfpf_q_mac_vlan_filter {
275 u32 flags;
276#define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
277#define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
278#define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
279
280 u8 mac[ETH_ALEN];
281 u16 vlan_tag;
282
283 u8 padding[4];
284};
285
286/* Start a vport */
287struct vfpf_vport_start_tlv {
288 struct vfpf_first_tlv first_tlv;
289
290 u64 sb_addr[PFVF_MAX_SBS_PER_VF];
291
292 u32 tpa_mode;
293 u16 dep1;
294 u16 mtu;
295
296 u8 vport_id;
297 u8 inner_vlan_removal;
298
299 u8 only_untagged;
300 u8 max_buffers_per_cqe;
301
302 u8 padding[4];
303};
304
305/* Extended tlvs - need to add rss, mcast, accept mode tlvs */
306struct vfpf_vport_update_activate_tlv {
307 struct channel_tlv tl;
308 u8 update_rx;
309 u8 update_tx;
310 u8 active_rx;
311 u8 active_tx;
312};
313
Yuval Mintz17b235c2016-05-11 16:36:18 +0300314struct vfpf_vport_update_tx_switch_tlv {
315 struct channel_tlv tl;
316 u8 tx_switching;
317 u8 padding[3];
318};
319
320struct vfpf_vport_update_vlan_strip_tlv {
321 struct channel_tlv tl;
322 u8 remove_vlan;
323 u8 padding[3];
324};
325
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300326struct vfpf_vport_update_mcast_bin_tlv {
327 struct channel_tlv tl;
328 u8 padding[4];
329
330 u64 bins[8];
331};
332
333struct vfpf_vport_update_accept_param_tlv {
334 struct channel_tlv tl;
335 u8 update_rx_mode;
336 u8 update_tx_mode;
337 u8 rx_accept_filter;
338 u8 tx_accept_filter;
339};
340
Yuval Mintz17b235c2016-05-11 16:36:18 +0300341struct vfpf_vport_update_accept_any_vlan_tlv {
342 struct channel_tlv tl;
343 u8 update_accept_any_vlan_flg;
344 u8 accept_any_vlan;
345
346 u8 padding[2];
347};
348
349struct vfpf_vport_update_sge_tpa_tlv {
350 struct channel_tlv tl;
351
352 u16 sge_tpa_flags;
353#define VFPF_TPA_IPV4_EN_FLAG BIT(0)
354#define VFPF_TPA_IPV6_EN_FLAG BIT(1)
355#define VFPF_TPA_PKT_SPLIT_FLAG BIT(2)
356#define VFPF_TPA_HDR_DATA_SPLIT_FLAG BIT(3)
357#define VFPF_TPA_GRO_CONSIST_FLAG BIT(4)
358
359 u8 update_sge_tpa_flags;
360#define VFPF_UPDATE_SGE_DEPRECATED_FLAG BIT(0)
361#define VFPF_UPDATE_TPA_EN_FLAG BIT(1)
362#define VFPF_UPDATE_TPA_PARAM_FLAG BIT(2)
363
364 u8 max_buffers_per_cqe;
365
366 u16 deprecated_sge_buff_size;
367 u16 tpa_max_size;
368 u16 tpa_min_size_to_start;
369 u16 tpa_min_size_to_cont;
370
371 u8 tpa_max_aggs_num;
372 u8 padding[7];
373};
374
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300375/* Primary tlv as a header for various extended tlvs for
376 * various functionalities in vport update ramrod.
377 */
378struct vfpf_vport_update_tlv {
379 struct vfpf_first_tlv first_tlv;
380};
381
382struct vfpf_ucast_filter_tlv {
383 struct vfpf_first_tlv first_tlv;
384
385 u8 opcode;
386 u8 type;
387
388 u8 mac[ETH_ALEN];
389
390 u16 vlan;
391 u16 padding[3];
392};
393
Yuval Mintz32a47e72016-05-11 16:36:12 +0300394struct tlv_buffer_size {
395 u8 tlv_buffer[TLV_BUFFER_SIZE];
396};
397
398union vfpf_tlvs {
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300399 struct vfpf_first_tlv first_tlv;
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300400 struct vfpf_acquire_tlv acquire;
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300401 struct vfpf_start_rxq_tlv start_rxq;
402 struct vfpf_start_txq_tlv start_txq;
403 struct vfpf_stop_rxqs_tlv stop_rxqs;
404 struct vfpf_stop_txqs_tlv stop_txqs;
Yuval Mintz17b235c2016-05-11 16:36:18 +0300405 struct vfpf_update_rxq_tlv update_rxq;
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300406 struct vfpf_vport_start_tlv start_vport;
407 struct vfpf_vport_update_tlv vport_update;
408 struct vfpf_ucast_filter_tlv ucast_filter;
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300409 struct channel_list_end_tlv list_end;
Yuval Mintz32a47e72016-05-11 16:36:12 +0300410 struct tlv_buffer_size tlv_buf_size;
411};
412
413union pfvf_tlvs {
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300414 struct pfvf_def_resp_tlv default_resp;
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300415 struct pfvf_acquire_resp_tlv acquire_resp;
Yuval Mintz32a47e72016-05-11 16:36:12 +0300416 struct tlv_buffer_size tlv_buf_size;
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300417 struct pfvf_start_queue_resp_tlv queue_start;
Yuval Mintz32a47e72016-05-11 16:36:12 +0300418};
419
420struct qed_bulletin_content {
421 /* crc of structure to ensure is not in mid-update */
422 u32 crc;
423
424 u32 version;
425
426 /* bitmap indicating which fields hold valid values */
427 u64 valid_bitmap;
Yuval Mintz36558c32016-05-11 16:36:17 +0300428
429 /* used for MAC_ADDR or MAC_ADDR_FORCED */
430 u8 mac[ETH_ALEN];
431
432 /* If valid, 1 => only untagged Rx if no vlan is configured */
433 u8 default_only_untagged;
434 u8 padding;
435
436 /* The following is a 'copy' of qed_mcp_link_state,
437 * qed_mcp_link_params and qed_mcp_link_capabilities. Since it's
438 * possible the structs will increase further along the road we cannot
439 * have it here; Instead we need to have all of its fields.
440 */
441 u8 req_autoneg;
442 u8 req_autoneg_pause;
443 u8 req_forced_rx;
444 u8 req_forced_tx;
445 u8 padding2[4];
446
447 u32 req_adv_speed;
448 u32 req_forced_speed;
449 u32 req_loopback;
450 u32 padding3;
451
452 u8 link_up;
453 u8 full_duplex;
454 u8 autoneg;
455 u8 autoneg_complete;
456 u8 parallel_detection;
457 u8 pfc_enabled;
458 u8 partner_tx_flow_ctrl_en;
459 u8 partner_rx_flow_ctrl_en;
460 u8 partner_adv_pause;
461 u8 sfp_tx_fault;
462 u8 padding4[6];
463
464 u32 speed;
465 u32 partner_adv_speed;
466
467 u32 capability_speed;
Yuval Mintz32a47e72016-05-11 16:36:12 +0300468};
469
470struct qed_bulletin {
471 dma_addr_t phys;
472 struct qed_bulletin_content *p_virt;
473 u32 size;
474};
475
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300476enum {
477 CHANNEL_TLV_NONE, /* ends tlv sequence */
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300478 CHANNEL_TLV_ACQUIRE,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300479 CHANNEL_TLV_VPORT_START,
480 CHANNEL_TLV_VPORT_UPDATE,
481 CHANNEL_TLV_VPORT_TEARDOWN,
482 CHANNEL_TLV_START_RXQ,
483 CHANNEL_TLV_START_TXQ,
484 CHANNEL_TLV_STOP_RXQS,
485 CHANNEL_TLV_STOP_TXQS,
Yuval Mintz17b235c2016-05-11 16:36:18 +0300486 CHANNEL_TLV_UPDATE_RXQ,
Yuval Mintz0b55e272016-05-11 16:36:15 +0300487 CHANNEL_TLV_INT_CLEANUP,
488 CHANNEL_TLV_CLOSE,
489 CHANNEL_TLV_RELEASE,
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300490 CHANNEL_TLV_LIST_END,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300491 CHANNEL_TLV_UCAST_FILTER,
492 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
Yuval Mintz17b235c2016-05-11 16:36:18 +0300493 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
494 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300495 CHANNEL_TLV_VPORT_UPDATE_MCAST,
496 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
497 CHANNEL_TLV_VPORT_UPDATE_RSS,
Yuval Mintz17b235c2016-05-11 16:36:18 +0300498 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
499 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300500 CHANNEL_TLV_MAX,
501
502 /* Required for iterating over vport-update tlvs.
503 * Will break in case non-sequential vport-update tlvs.
504 */
Yuval Mintz17b235c2016-05-11 16:36:18 +0300505 CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300506};
507
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300508/* This data is held in the qed_hwfn structure for VFs only. */
509struct qed_vf_iov {
510 union vfpf_tlvs *vf2pf_request;
511 dma_addr_t vf2pf_request_phys;
512 union pfvf_tlvs *pf2vf_reply;
513 dma_addr_t pf2vf_reply_phys;
514
515 /* Should be taken whenever the mailbox buffers are accessed */
516 struct mutex mutex;
517 u8 *offset;
518
519 /* Bulletin Board */
520 struct qed_bulletin bulletin;
521 struct qed_bulletin_content bulletin_shadow;
522
523 /* we set aside a copy of the acquire response */
524 struct pfvf_acquire_resp_tlv acquire_resp;
525};
526
527#ifdef CONFIG_QED_SRIOV
528/**
Yuval Mintz36558c32016-05-11 16:36:17 +0300529 * @brief Read the VF bulletin and act on it if needed
530 *
531 * @param p_hwfn
532 * @param p_change - qed fills 1 iff bulletin board has changed, 0 otherwise.
533 *
534 * @return enum _qed_status
535 */
536int qed_vf_read_bulletin(struct qed_hwfn *p_hwfn, u8 *p_change);
537
538/**
539 * @brief Get link paramters for VF from qed
540 *
541 * @param p_hwfn
542 * @param params - the link params structure to be filled for the VF
543 */
544void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
545 struct qed_mcp_link_params *params);
546
547/**
548 * @brief Get link state for VF from qed
549 *
550 * @param p_hwfn
551 * @param link - the link state structure to be filled for the VF
552 */
553void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
554 struct qed_mcp_link_state *link);
555
556/**
557 * @brief Get link capabilities for VF from qed
558 *
559 * @param p_hwfn
560 * @param p_link_caps - the link capabilities structure to be filled for the VF
561 */
562void qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
563 struct qed_mcp_link_capabilities *p_link_caps);
564
565/**
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300566 * @brief Get number of Rx queues allocated for VF by qed
567 *
568 * @param p_hwfn
569 * @param num_rxqs - allocated RX queues
570 */
571void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs);
572
573/**
574 * @brief Get port mac address for VF
575 *
576 * @param p_hwfn
577 * @param port_mac - destination location for port mac
578 */
579void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac);
580
581/**
582 * @brief Get number of VLAN filters allocated for VF by qed
583 *
584 * @param p_hwfn
585 * @param num_rxqs - allocated VLAN filters
586 */
587void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
588 u8 *num_vlan_filters);
589
590/**
591 * @brief Set firmware version information in dev_info from VFs acquire response tlv
592 *
593 * @param p_hwfn
594 * @param fw_major
595 * @param fw_minor
596 * @param fw_rev
597 * @param fw_eng
598 */
599void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
600 u16 *fw_major, u16 *fw_minor,
601 u16 *fw_rev, u16 *fw_eng);
602
603/**
604 * @brief hw preparation for VF
605 * sends ACQUIRE message
606 *
607 * @param p_hwfn
608 *
609 * @return int
610 */
611int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn);
612
613/**
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300614 * @brief VF - start the RX Queue by sending a message to the PF
615 * @param p_hwfn
616 * @param cid - zero based within the VF
617 * @param rx_queue_id - zero based within the VF
618 * @param sb - VF status block for this queue
619 * @param sb_index - Index within the status block
620 * @param bd_max_bytes - maximum number of bytes per bd
621 * @param bd_chain_phys_addr - physical address of bd chain
622 * @param cqe_pbl_addr - physical address of pbl
623 * @param cqe_pbl_size - pbl size
624 * @param pp_prod - pointer to the producer to be
625 * used in fastpath
626 *
627 * @return int
628 */
629int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
630 u8 rx_queue_id,
631 u16 sb,
632 u8 sb_index,
633 u16 bd_max_bytes,
634 dma_addr_t bd_chain_phys_addr,
635 dma_addr_t cqe_pbl_addr,
636 u16 cqe_pbl_size, void __iomem **pp_prod);
637
638/**
639 * @brief VF - start the TX queue by sending a message to the
640 * PF.
641 *
642 * @param p_hwfn
643 * @param tx_queue_id - zero based within the VF
644 * @param sb - status block for this queue
645 * @param sb_index - index within the status block
646 * @param bd_chain_phys_addr - physical address of tx chain
647 * @param pp_doorbell - pointer to address to which to
648 * write the doorbell too..
649 *
650 * @return int
651 */
652int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
653 u16 tx_queue_id,
654 u16 sb,
655 u8 sb_index,
656 dma_addr_t pbl_addr,
657 u16 pbl_size, void __iomem **pp_doorbell);
658
659/**
660 * @brief VF - stop the RX queue by sending a message to the PF
661 *
662 * @param p_hwfn
663 * @param rx_qid
664 * @param cqe_completion
665 *
666 * @return int
667 */
668int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
669 u16 rx_qid, bool cqe_completion);
670
671/**
672 * @brief VF - stop the TX queue by sending a message to the PF
673 *
674 * @param p_hwfn
675 * @param tx_qid
676 *
677 * @return int
678 */
679int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, u16 tx_qid);
680
681/**
682 * @brief VF - send a vport update command
683 *
684 * @param p_hwfn
685 * @param params
686 *
687 * @return int
688 */
689int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
690 struct qed_sp_vport_update_params *p_params);
691
692/**
Yuval Mintz0b55e272016-05-11 16:36:15 +0300693 *
694 * @brief VF - send a close message to PF
695 *
696 * @param p_hwfn
697 *
698 * @return enum _qed_status
699 */
700int qed_vf_pf_reset(struct qed_hwfn *p_hwfn);
701
702/**
703 * @brief VF - free vf`s memories
704 *
705 * @param p_hwfn
706 *
707 * @return enum _qed_status
708 */
709int qed_vf_pf_release(struct qed_hwfn *p_hwfn);
Yuval Mintz36558c32016-05-11 16:36:17 +0300710
Yuval Mintz0b55e272016-05-11 16:36:15 +0300711/**
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300712 * @brief qed_vf_get_igu_sb_id - Get the IGU SB ID for a given
713 * sb_id. For VFs igu sbs don't have to be contiguous
714 *
715 * @param p_hwfn
716 * @param sb_id
717 *
718 * @return INLINE u16
719 */
720u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id);
Yuval Mintz0b55e272016-05-11 16:36:15 +0300721
722/**
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300723 * @brief qed_vf_pf_vport_start - perform vport start for VF.
724 *
725 * @param p_hwfn
726 * @param vport_id
727 * @param mtu
728 * @param inner_vlan_removal
729 * @param tpa_mode
730 * @param max_buffers_per_cqe,
731 * @param only_untagged - default behavior regarding vlan acceptance
732 *
733 * @return enum _qed_status
734 */
735int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
736 u8 vport_id,
737 u16 mtu,
738 u8 inner_vlan_removal,
739 enum qed_tpa_mode tpa_mode,
740 u8 max_buffers_per_cqe);
741
742/**
743 * @brief qed_vf_pf_vport_stop - stop the VF's vport
744 *
745 * @param p_hwfn
746 *
747 * @return enum _qed_status
748 */
749int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn);
750
751int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
752 struct qed_filter_ucast *p_param);
753
754void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
755 struct qed_filter_mcast *p_filter_cmd);
756
757/**
Yuval Mintz0b55e272016-05-11 16:36:15 +0300758 * @brief qed_vf_pf_int_cleanup - clean the SB of the VF
759 *
760 * @param p_hwfn
761 *
762 * @return enum _qed_status
763 */
764int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn);
Yuval Mintz36558c32016-05-11 16:36:17 +0300765
766/**
767 * @brief - return the link params in a given bulletin board
768 *
769 * @param p_hwfn
770 * @param p_params - pointer to a struct to fill with link params
771 * @param p_bulletin
772 */
773void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
774 struct qed_mcp_link_params *p_params,
775 struct qed_bulletin_content *p_bulletin);
776
777/**
778 * @brief - return the link state in a given bulletin board
779 *
780 * @param p_hwfn
781 * @param p_link - pointer to a struct to fill with link state
782 * @param p_bulletin
783 */
784void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
785 struct qed_mcp_link_state *p_link,
786 struct qed_bulletin_content *p_bulletin);
787
788/**
789 * @brief - return the link capabilities in a given bulletin board
790 *
791 * @param p_hwfn
792 * @param p_link - pointer to a struct to fill with link capabilities
793 * @param p_bulletin
794 */
795void __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
796 struct qed_mcp_link_capabilities *p_link_caps,
797 struct qed_bulletin_content *p_bulletin);
798
799void qed_iov_vf_task(struct work_struct *work);
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300800#else
Yuval Mintz36558c32016-05-11 16:36:17 +0300801static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
802 struct qed_mcp_link_params *params)
803{
804}
805
806static inline void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
807 struct qed_mcp_link_state *link)
808{
809}
810
811static inline void
812qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
813 struct qed_mcp_link_capabilities *p_link_caps)
814{
815}
816
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300817static inline void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs)
818{
819}
820
821static inline void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac)
822{
823}
824
825static inline void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
826 u8 *num_vlan_filters)
827{
828}
829
830static inline void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
831 u16 *fw_major, u16 *fw_minor,
832 u16 *fw_rev, u16 *fw_eng)
833{
834}
835
836static inline int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
837{
838 return -EINVAL;
839}
840
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300841static inline int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
842 u8 rx_queue_id,
843 u16 sb,
844 u8 sb_index,
845 u16 bd_max_bytes,
846 dma_addr_t bd_chain_phys_adr,
847 dma_addr_t cqe_pbl_addr,
848 u16 cqe_pbl_size, void __iomem **pp_prod)
849{
850 return -EINVAL;
851}
852
853static inline int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
854 u16 tx_queue_id,
855 u16 sb,
856 u8 sb_index,
857 dma_addr_t pbl_addr,
858 u16 pbl_size, void __iomem **pp_doorbell)
859{
860 return -EINVAL;
861}
862
863static inline int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
864 u16 rx_qid, bool cqe_completion)
865{
866 return -EINVAL;
867}
868
869static inline int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, u16 tx_qid)
870{
871 return -EINVAL;
872}
873
874static inline int
875qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
876 struct qed_sp_vport_update_params *p_params)
877{
878 return -EINVAL;
879}
880
Yuval Mintz0b55e272016-05-11 16:36:15 +0300881static inline int qed_vf_pf_reset(struct qed_hwfn *p_hwfn)
882{
883 return -EINVAL;
884}
885
886static inline int qed_vf_pf_release(struct qed_hwfn *p_hwfn)
887{
888 return -EINVAL;
889}
890
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300891static inline u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id)
892{
893 return 0;
894}
Yuval Mintz0b55e272016-05-11 16:36:15 +0300895
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300896static inline int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
897 u8 vport_id,
898 u16 mtu,
899 u8 inner_vlan_removal,
900 enum qed_tpa_mode tpa_mode,
901 u8 max_buffers_per_cqe)
902{
903 return -EINVAL;
904}
905
906static inline int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn)
907{
908 return -EINVAL;
909}
910
911static inline int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
912 struct qed_filter_ucast *p_param)
913{
914 return -EINVAL;
915}
916
917static inline void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
918 struct qed_filter_mcast *p_filter_cmd)
919{
920}
921
Yuval Mintz0b55e272016-05-11 16:36:15 +0300922static inline int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn)
923{
924 return -EINVAL;
925}
Yuval Mintz36558c32016-05-11 16:36:17 +0300926
927static inline void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
928 struct qed_mcp_link_params
929 *p_params,
930 struct qed_bulletin_content
931 *p_bulletin)
932{
933}
934
935static inline void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
936 struct qed_mcp_link_state *p_link,
937 struct qed_bulletin_content
938 *p_bulletin)
939{
940}
941
942static inline void
943__qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
944 struct qed_mcp_link_capabilities *p_link_caps,
945 struct qed_bulletin_content *p_bulletin)
946{
947}
948
949static inline void qed_iov_vf_task(struct work_struct *work)
950{
951}
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300952#endif
953
Yuval Mintz32a47e72016-05-11 16:36:12 +0300954#endif