blob: 67862085f0321932205707fd555469a267ba5b56 [file] [log] [blame]
Yuval Mintz32a47e72016-05-11 16:36:12 +03001/* QLogic qed NIC Driver
Mintz, Yuvale8f1cb52017-01-01 13:57:00 +02002 * Copyright (c) 2015-2017 QLogic Corporation
Yuval Mintz32a47e72016-05-11 16:36:12 +03003 *
Mintz, Yuvale8f1cb52017-01-01 13:57:00 +02004 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and /or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
Yuval Mintz32a47e72016-05-11 16:36:12 +030031 */
32
33#ifndef _QED_VF_H
34#define _QED_VF_H
35
Yuval Mintzdacd88d2016-05-11 16:36:16 +030036#include "qed_l2.h"
Yuval Mintz36558c32016-05-11 16:36:17 +030037#include "qed_mcp.h"
Yuval Mintzdacd88d2016-05-11 16:36:16 +030038
39#define T_ETH_INDIRECTION_TABLE_SIZE 128
40#define T_ETH_RSS_KEY_SIZE 10
41
Yuval Mintz1408cc1f2016-05-11 16:36:14 +030042struct vf_pf_resc_request {
43 u8 num_rxqs;
44 u8 num_txqs;
45 u8 num_sbs;
46 u8 num_mac_filters;
47 u8 num_vlan_filters;
48 u8 num_mc_filters;
49 u16 padding;
50};
51
52struct hw_sb_info {
53 u16 hw_sb_id;
54 u8 sb_qid;
55 u8 padding[5];
56};
57
Yuval Mintzdacd88d2016-05-11 16:36:16 +030058#define TLV_BUFFER_SIZE 1024
59
Yuval Mintz37bff2b2016-05-11 16:36:13 +030060enum {
61 PFVF_STATUS_WAITING,
62 PFVF_STATUS_SUCCESS,
63 PFVF_STATUS_FAILURE,
64 PFVF_STATUS_NOT_SUPPORTED,
65 PFVF_STATUS_NO_RESOURCE,
66 PFVF_STATUS_FORCED,
Yuval Mintz7eff82b2016-10-14 05:19:22 -040067 PFVF_STATUS_MALICIOUS,
Yuval Mintz37bff2b2016-05-11 16:36:13 +030068};
69
70/* vf pf channel tlvs */
71/* general tlv header (used for both vf->pf request and pf->vf response) */
72struct channel_tlv {
73 u16 type;
74 u16 length;
75};
76
77/* header of first vf->pf tlv carries the offset used to calculate reponse
78 * buffer address
79 */
80struct vfpf_first_tlv {
81 struct channel_tlv tl;
82 u32 padding;
83 u64 reply_address;
84};
85
86/* header of pf->vf tlvs, carries the status of handling the request */
87struct pfvf_tlv {
88 struct channel_tlv tl;
89 u8 status;
90 u8 padding[3];
91};
92
93/* response tlv used for most tlvs */
94struct pfvf_def_resp_tlv {
95 struct pfvf_tlv hdr;
96};
97
98/* used to terminate and pad a tlv list */
99struct channel_list_end_tlv {
100 struct channel_tlv tl;
101 u8 padding[4];
102};
103
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300104#define VFPF_ACQUIRE_OS_LINUX (0)
105#define VFPF_ACQUIRE_OS_WINDOWS (1)
106#define VFPF_ACQUIRE_OS_ESX (2)
107#define VFPF_ACQUIRE_OS_SOLARIS (3)
108#define VFPF_ACQUIRE_OS_LINUX_USERSPACE (4)
109
110struct vfpf_acquire_tlv {
111 struct vfpf_first_tlv first_tlv;
112
113 struct vf_pf_vfdev_info {
Yuval Mintza044df82016-08-22 13:25:09 +0300114#define VFPF_ACQUIRE_CAP_PRE_FP_HSI (1 << 0) /* VF pre-FP hsi version */
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300115#define VFPF_ACQUIRE_CAP_100G (1 << 1) /* VF can support 100g */
116 u64 capabilities;
117 u8 fw_major;
118 u8 fw_minor;
119 u8 fw_revision;
120 u8 fw_engineering;
121 u32 driver_version;
122 u16 opaque_fid; /* ME register value */
123 u8 os_type; /* VFPF_ACQUIRE_OS_* value */
Yuval Mintz1fe614d2016-06-05 13:11:11 +0300124 u8 eth_fp_hsi_major;
125 u8 eth_fp_hsi_minor;
126 u8 padding[3];
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300127 } vfdev_info;
128
129 struct vf_pf_resc_request resc_request;
130
131 u64 bulletin_addr;
132 u32 bulletin_size;
133 u32 padding;
134};
135
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300136/* receive side scaling tlv */
137struct vfpf_vport_update_rss_tlv {
138 struct channel_tlv tl;
139
140 u8 update_rss_flags;
141#define VFPF_UPDATE_RSS_CONFIG_FLAG BIT(0)
142#define VFPF_UPDATE_RSS_CAPS_FLAG BIT(1)
143#define VFPF_UPDATE_RSS_IND_TABLE_FLAG BIT(2)
144#define VFPF_UPDATE_RSS_KEY_FLAG BIT(3)
145
146 u8 rss_enable;
147 u8 rss_caps;
148 u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
149 u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
150 u32 rss_key[T_ETH_RSS_KEY_SIZE];
151};
152
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300153struct pfvf_storm_stats {
154 u32 address;
155 u32 len;
156};
157
158struct pfvf_stats_info {
159 struct pfvf_storm_stats mstats;
160 struct pfvf_storm_stats pstats;
161 struct pfvf_storm_stats tstats;
162 struct pfvf_storm_stats ustats;
163};
164
165struct pfvf_acquire_resp_tlv {
166 struct pfvf_tlv hdr;
167
168 struct pf_vf_pfdev_info {
169 u32 chip_num;
170 u32 mfw_ver;
171
172 u16 fw_major;
173 u16 fw_minor;
174 u16 fw_rev;
175 u16 fw_eng;
176
177 u64 capabilities;
178#define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED BIT(0)
179#define PFVF_ACQUIRE_CAP_100G BIT(1) /* If set, 100g PF */
180/* There are old PF versions where the PF might mistakenly override the sanity
181 * mechanism [version-based] and allow a VF that can't be supported to pass
182 * the acquisition phase.
183 * To overcome this, PFs now indicate that they're past that point and the new
184 * VFs would fail probe on the older PFs that fail to do so.
185 */
186#define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE BIT(2)
187
188 u16 db_size;
189 u8 indices_per_sb;
190 u8 os_type;
191
192 /* These should match the PF's qed_dev values */
193 u16 chip_rev;
194 u8 dev_type;
195
196 u8 padding;
197
198 struct pfvf_stats_info stats_info;
199
200 u8 port_mac[ETH_ALEN];
Yuval Mintz1fe614d2016-06-05 13:11:11 +0300201
202 /* It's possible PF had to configure an older fastpath HSI
203 * [in case VF is newer than PF]. This is communicated back
204 * to the VF. It can also be used in case of error due to
205 * non-matching versions to shed light in VF about failure.
206 */
207 u8 major_fp_hsi;
208 u8 minor_fp_hsi;
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300209 } pfdev_info;
210
211 struct pf_vf_resc {
212#define PFVF_MAX_QUEUES_PER_VF 16
213#define PFVF_MAX_SBS_PER_VF 16
214 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
215 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
216 u8 cid[PFVF_MAX_QUEUES_PER_VF];
217
218 u8 num_rxqs;
219 u8 num_txqs;
220 u8 num_sbs;
221 u8 num_mac_filters;
222 u8 num_vlan_filters;
223 u8 num_mc_filters;
224 u8 padding[2];
225 } resc;
226
227 u32 bulletin_size;
228 u32 padding;
229};
230
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300231struct pfvf_start_queue_resp_tlv {
232 struct pfvf_tlv hdr;
233 u32 offset; /* offset to consumer/producer of queue */
234 u8 padding[4];
235};
236
237/* Setup Queue */
238struct vfpf_start_rxq_tlv {
239 struct vfpf_first_tlv first_tlv;
240
241 /* physical addresses */
242 u64 rxq_addr;
243 u64 deprecated_sge_addr;
244 u64 cqe_pbl_addr;
245
246 u16 cqe_pbl_size;
247 u16 hw_sb;
248 u16 rx_qid;
249 u16 hc_rate; /* desired interrupts per sec. */
250
251 u16 bd_max_bytes;
252 u16 stat_id;
253 u8 sb_index;
254 u8 padding[3];
255};
256
257struct vfpf_start_txq_tlv {
258 struct vfpf_first_tlv first_tlv;
259
260 /* physical addresses */
261 u64 pbl_addr;
262 u16 pbl_size;
263 u16 stat_id;
264 u16 tx_qid;
265 u16 hw_sb;
266
267 u32 flags; /* VFPF_QUEUE_FLG_X flags */
268 u16 hc_rate; /* desired interrupts per sec. */
269 u8 sb_index;
270 u8 padding[3];
271};
272
273/* Stop RX Queue */
274struct vfpf_stop_rxqs_tlv {
275 struct vfpf_first_tlv first_tlv;
276
277 u16 rx_qid;
Mintz, Yuval4c4fa792017-03-19 13:08:17 +0200278
279 /* this field is deprecated and should *always* be set to '1' */
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300280 u8 num_rxqs;
281 u8 cqe_completion;
282 u8 padding[4];
283};
284
285/* Stop TX Queues */
286struct vfpf_stop_txqs_tlv {
287 struct vfpf_first_tlv first_tlv;
288
289 u16 tx_qid;
Mintz, Yuval4c4fa792017-03-19 13:08:17 +0200290
291 /* this field is deprecated and should *always* be set to '1' */
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300292 u8 num_txqs;
293 u8 padding[5];
294};
295
296struct vfpf_update_rxq_tlv {
297 struct vfpf_first_tlv first_tlv;
298
299 u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
300
301 u16 rx_qid;
302 u8 num_rxqs;
303 u8 flags;
304#define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG BIT(0)
305#define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG BIT(1)
306#define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG BIT(2)
307
308 u8 padding[4];
309};
310
311/* Set Queue Filters */
312struct vfpf_q_mac_vlan_filter {
313 u32 flags;
314#define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
315#define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
316#define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
317
318 u8 mac[ETH_ALEN];
319 u16 vlan_tag;
320
321 u8 padding[4];
322};
323
324/* Start a vport */
325struct vfpf_vport_start_tlv {
326 struct vfpf_first_tlv first_tlv;
327
328 u64 sb_addr[PFVF_MAX_SBS_PER_VF];
329
330 u32 tpa_mode;
331 u16 dep1;
332 u16 mtu;
333
334 u8 vport_id;
335 u8 inner_vlan_removal;
336
337 u8 only_untagged;
338 u8 max_buffers_per_cqe;
339
340 u8 padding[4];
341};
342
343/* Extended tlvs - need to add rss, mcast, accept mode tlvs */
344struct vfpf_vport_update_activate_tlv {
345 struct channel_tlv tl;
346 u8 update_rx;
347 u8 update_tx;
348 u8 active_rx;
349 u8 active_tx;
350};
351
Yuval Mintz17b235c2016-05-11 16:36:18 +0300352struct vfpf_vport_update_tx_switch_tlv {
353 struct channel_tlv tl;
354 u8 tx_switching;
355 u8 padding[3];
356};
357
358struct vfpf_vport_update_vlan_strip_tlv {
359 struct channel_tlv tl;
360 u8 remove_vlan;
361 u8 padding[3];
362};
363
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300364struct vfpf_vport_update_mcast_bin_tlv {
365 struct channel_tlv tl;
366 u8 padding[4];
367
368 u64 bins[8];
369};
370
371struct vfpf_vport_update_accept_param_tlv {
372 struct channel_tlv tl;
373 u8 update_rx_mode;
374 u8 update_tx_mode;
375 u8 rx_accept_filter;
376 u8 tx_accept_filter;
377};
378
Yuval Mintz17b235c2016-05-11 16:36:18 +0300379struct vfpf_vport_update_accept_any_vlan_tlv {
380 struct channel_tlv tl;
381 u8 update_accept_any_vlan_flg;
382 u8 accept_any_vlan;
383
384 u8 padding[2];
385};
386
387struct vfpf_vport_update_sge_tpa_tlv {
388 struct channel_tlv tl;
389
390 u16 sge_tpa_flags;
391#define VFPF_TPA_IPV4_EN_FLAG BIT(0)
392#define VFPF_TPA_IPV6_EN_FLAG BIT(1)
393#define VFPF_TPA_PKT_SPLIT_FLAG BIT(2)
394#define VFPF_TPA_HDR_DATA_SPLIT_FLAG BIT(3)
395#define VFPF_TPA_GRO_CONSIST_FLAG BIT(4)
396
397 u8 update_sge_tpa_flags;
398#define VFPF_UPDATE_SGE_DEPRECATED_FLAG BIT(0)
399#define VFPF_UPDATE_TPA_EN_FLAG BIT(1)
400#define VFPF_UPDATE_TPA_PARAM_FLAG BIT(2)
401
402 u8 max_buffers_per_cqe;
403
404 u16 deprecated_sge_buff_size;
405 u16 tpa_max_size;
406 u16 tpa_min_size_to_start;
407 u16 tpa_min_size_to_cont;
408
409 u8 tpa_max_aggs_num;
410 u8 padding[7];
411};
412
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300413/* Primary tlv as a header for various extended tlvs for
414 * various functionalities in vport update ramrod.
415 */
416struct vfpf_vport_update_tlv {
417 struct vfpf_first_tlv first_tlv;
418};
419
420struct vfpf_ucast_filter_tlv {
421 struct vfpf_first_tlv first_tlv;
422
423 u8 opcode;
424 u8 type;
425
426 u8 mac[ETH_ALEN];
427
428 u16 vlan;
429 u16 padding[3];
430};
431
Chopra, Manisheaf3c0c2017-04-24 10:00:49 -0700432/* tunnel update param tlv */
433struct vfpf_update_tunn_param_tlv {
434 struct vfpf_first_tlv first_tlv;
435
436 u8 tun_mode_update_mask;
437 u8 tunn_mode;
438 u8 update_tun_cls;
439 u8 vxlan_clss;
440 u8 l2gre_clss;
441 u8 ipgre_clss;
442 u8 l2geneve_clss;
443 u8 ipgeneve_clss;
444 u8 update_geneve_port;
445 u8 update_vxlan_port;
446 u16 geneve_port;
447 u16 vxlan_port;
448 u8 padding[2];
449};
450
451struct pfvf_update_tunn_param_tlv {
452 struct pfvf_tlv hdr;
453
454 u16 tunn_feature_mask;
455 u8 vxlan_mode;
456 u8 l2geneve_mode;
457 u8 ipgeneve_mode;
458 u8 l2gre_mode;
459 u8 ipgre_mode;
460 u8 vxlan_clss;
461 u8 l2gre_clss;
462 u8 ipgre_clss;
463 u8 l2geneve_clss;
464 u8 ipgeneve_clss;
465 u16 vxlan_udp_port;
466 u16 geneve_udp_port;
467};
468
Yuval Mintz32a47e72016-05-11 16:36:12 +0300469struct tlv_buffer_size {
470 u8 tlv_buffer[TLV_BUFFER_SIZE];
471};
472
473union vfpf_tlvs {
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300474 struct vfpf_first_tlv first_tlv;
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300475 struct vfpf_acquire_tlv acquire;
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300476 struct vfpf_start_rxq_tlv start_rxq;
477 struct vfpf_start_txq_tlv start_txq;
478 struct vfpf_stop_rxqs_tlv stop_rxqs;
479 struct vfpf_stop_txqs_tlv stop_txqs;
Yuval Mintz17b235c2016-05-11 16:36:18 +0300480 struct vfpf_update_rxq_tlv update_rxq;
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300481 struct vfpf_vport_start_tlv start_vport;
482 struct vfpf_vport_update_tlv vport_update;
483 struct vfpf_ucast_filter_tlv ucast_filter;
Chopra, Manisheaf3c0c2017-04-24 10:00:49 -0700484 struct vfpf_update_tunn_param_tlv tunn_param_update;
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300485 struct channel_list_end_tlv list_end;
Yuval Mintz32a47e72016-05-11 16:36:12 +0300486 struct tlv_buffer_size tlv_buf_size;
487};
488
489union pfvf_tlvs {
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300490 struct pfvf_def_resp_tlv default_resp;
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300491 struct pfvf_acquire_resp_tlv acquire_resp;
Yuval Mintz32a47e72016-05-11 16:36:12 +0300492 struct tlv_buffer_size tlv_buf_size;
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300493 struct pfvf_start_queue_resp_tlv queue_start;
Chopra, Manisheaf3c0c2017-04-24 10:00:49 -0700494 struct pfvf_update_tunn_param_tlv tunn_param_resp;
Yuval Mintz32a47e72016-05-11 16:36:12 +0300495};
496
Yuval Mintz08feecd2016-05-11 16:36:20 +0300497enum qed_bulletin_bit {
Yuval Mintzeff16962016-05-11 16:36:21 +0300498 /* Alert the VF that a forced MAC was set by the PF */
499 MAC_ADDR_FORCED = 0,
Yuval Mintz08feecd2016-05-11 16:36:20 +0300500 /* Alert the VF that a forced VLAN was set by the PF */
501 VLAN_ADDR_FORCED = 2,
502
503 /* Indicate that `default_only_untagged' contains actual data */
504 VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
505 VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
506
Yuval Mintzeff16962016-05-11 16:36:21 +0300507 /* Alert the VF that suggested mac was sent by the PF.
508 * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set.
509 */
510 VFPF_BULLETIN_MAC_ADDR = 5
Yuval Mintz08feecd2016-05-11 16:36:20 +0300511};
512
Yuval Mintz32a47e72016-05-11 16:36:12 +0300513struct qed_bulletin_content {
514 /* crc of structure to ensure is not in mid-update */
515 u32 crc;
516
517 u32 version;
518
519 /* bitmap indicating which fields hold valid values */
520 u64 valid_bitmap;
Yuval Mintz36558c32016-05-11 16:36:17 +0300521
522 /* used for MAC_ADDR or MAC_ADDR_FORCED */
523 u8 mac[ETH_ALEN];
524
525 /* If valid, 1 => only untagged Rx if no vlan is configured */
526 u8 default_only_untagged;
527 u8 padding;
528
529 /* The following is a 'copy' of qed_mcp_link_state,
530 * qed_mcp_link_params and qed_mcp_link_capabilities. Since it's
531 * possible the structs will increase further along the road we cannot
532 * have it here; Instead we need to have all of its fields.
533 */
534 u8 req_autoneg;
535 u8 req_autoneg_pause;
536 u8 req_forced_rx;
537 u8 req_forced_tx;
538 u8 padding2[4];
539
540 u32 req_adv_speed;
541 u32 req_forced_speed;
542 u32 req_loopback;
543 u32 padding3;
544
545 u8 link_up;
546 u8 full_duplex;
547 u8 autoneg;
548 u8 autoneg_complete;
549 u8 parallel_detection;
550 u8 pfc_enabled;
551 u8 partner_tx_flow_ctrl_en;
552 u8 partner_rx_flow_ctrl_en;
553 u8 partner_adv_pause;
554 u8 sfp_tx_fault;
Chopra, Manish97379f12017-04-24 10:00:48 -0700555 u16 vxlan_udp_port;
556 u16 geneve_udp_port;
557 u8 padding4[2];
Yuval Mintz36558c32016-05-11 16:36:17 +0300558
559 u32 speed;
560 u32 partner_adv_speed;
561
562 u32 capability_speed;
Yuval Mintz08feecd2016-05-11 16:36:20 +0300563
564 /* Forced vlan */
565 u16 pvid;
566 u16 padding5;
Yuval Mintz32a47e72016-05-11 16:36:12 +0300567};
568
569struct qed_bulletin {
570 dma_addr_t phys;
571 struct qed_bulletin_content *p_virt;
572 u32 size;
573};
574
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300575enum {
576 CHANNEL_TLV_NONE, /* ends tlv sequence */
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300577 CHANNEL_TLV_ACQUIRE,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300578 CHANNEL_TLV_VPORT_START,
579 CHANNEL_TLV_VPORT_UPDATE,
580 CHANNEL_TLV_VPORT_TEARDOWN,
581 CHANNEL_TLV_START_RXQ,
582 CHANNEL_TLV_START_TXQ,
583 CHANNEL_TLV_STOP_RXQS,
584 CHANNEL_TLV_STOP_TXQS,
Yuval Mintz17b235c2016-05-11 16:36:18 +0300585 CHANNEL_TLV_UPDATE_RXQ,
Yuval Mintz0b55e272016-05-11 16:36:15 +0300586 CHANNEL_TLV_INT_CLEANUP,
587 CHANNEL_TLV_CLOSE,
588 CHANNEL_TLV_RELEASE,
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300589 CHANNEL_TLV_LIST_END,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300590 CHANNEL_TLV_UCAST_FILTER,
591 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
Yuval Mintz17b235c2016-05-11 16:36:18 +0300592 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
593 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300594 CHANNEL_TLV_VPORT_UPDATE_MCAST,
595 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
596 CHANNEL_TLV_VPORT_UPDATE_RSS,
Yuval Mintz17b235c2016-05-11 16:36:18 +0300597 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
598 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
Chopra, Manisheaf3c0c2017-04-24 10:00:49 -0700599 CHANNEL_TLV_UPDATE_TUNN_PARAM,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300600 CHANNEL_TLV_MAX,
601
602 /* Required for iterating over vport-update tlvs.
603 * Will break in case non-sequential vport-update tlvs.
604 */
Yuval Mintz17b235c2016-05-11 16:36:18 +0300605 CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
Yuval Mintz37bff2b2016-05-11 16:36:13 +0300606};
607
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300608/* This data is held in the qed_hwfn structure for VFs only. */
609struct qed_vf_iov {
610 union vfpf_tlvs *vf2pf_request;
611 dma_addr_t vf2pf_request_phys;
612 union pfvf_tlvs *pf2vf_reply;
613 dma_addr_t pf2vf_reply_phys;
614
615 /* Should be taken whenever the mailbox buffers are accessed */
616 struct mutex mutex;
617 u8 *offset;
618
619 /* Bulletin Board */
620 struct qed_bulletin bulletin;
621 struct qed_bulletin_content bulletin_shadow;
622
623 /* we set aside a copy of the acquire response */
624 struct pfvf_acquire_resp_tlv acquire_resp;
Yuval Mintzd8c2c7e2016-08-22 13:25:11 +0300625
626 /* In case PF originates prior to the fp-hsi version comparison,
627 * this has to be propagated as it affects the fastpath.
628 */
629 bool b_pre_fp_hsi;
Mintz, Yuval50a20712017-06-01 15:29:09 +0300630
631 /* Current day VFs are passing the SBs physical address on vport
632 * start, and as they lack an IGU mapping they need to store the
633 * addresses of previously registered SBs.
634 * Even if we were to change configuration flow, due to backward
635 * compatibility [with older PFs] we'd still need to store these.
636 */
637 struct qed_sb_info *sbs_info[PFVF_MAX_SBS_PER_VF];
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300638};
639
640#ifdef CONFIG_QED_SRIOV
641/**
Yuval Mintz36558c32016-05-11 16:36:17 +0300642 * @brief Read the VF bulletin and act on it if needed
643 *
644 * @param p_hwfn
645 * @param p_change - qed fills 1 iff bulletin board has changed, 0 otherwise.
646 *
647 * @return enum _qed_status
648 */
649int qed_vf_read_bulletin(struct qed_hwfn *p_hwfn, u8 *p_change);
650
651/**
652 * @brief Get link paramters for VF from qed
653 *
654 * @param p_hwfn
655 * @param params - the link params structure to be filled for the VF
656 */
657void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
658 struct qed_mcp_link_params *params);
659
660/**
661 * @brief Get link state for VF from qed
662 *
663 * @param p_hwfn
664 * @param link - the link state structure to be filled for the VF
665 */
666void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
667 struct qed_mcp_link_state *link);
668
669/**
670 * @brief Get link capabilities for VF from qed
671 *
672 * @param p_hwfn
673 * @param p_link_caps - the link capabilities structure to be filled for the VF
674 */
675void qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
676 struct qed_mcp_link_capabilities *p_link_caps);
677
678/**
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300679 * @brief Get number of Rx queues allocated for VF by qed
680 *
681 * @param p_hwfn
682 * @param num_rxqs - allocated RX queues
683 */
684void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs);
685
686/**
687 * @brief Get port mac address for VF
688 *
689 * @param p_hwfn
690 * @param port_mac - destination location for port mac
691 */
692void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac);
693
694/**
695 * @brief Get number of VLAN filters allocated for VF by qed
696 *
697 * @param p_hwfn
698 * @param num_rxqs - allocated VLAN filters
699 */
700void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
701 u8 *num_vlan_filters);
702
703/**
Mintz, Yuvalb0fca312016-10-31 22:26:54 +0200704 * @brief Get number of MAC filters allocated for VF by qed
705 *
706 * @param p_hwfn
707 * @param num_rxqs - allocated MAC filters
708 */
709void qed_vf_get_num_mac_filters(struct qed_hwfn *p_hwfn, u8 *num_mac_filters);
710
711/**
Yuval Mintzeff16962016-05-11 16:36:21 +0300712 * @brief Check if VF can set a MAC address
713 *
714 * @param p_hwfn
715 * @param mac
716 *
717 * @return bool
718 */
719bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac);
720
721/**
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300722 * @brief Set firmware version information in dev_info from VFs acquire response tlv
723 *
724 * @param p_hwfn
725 * @param fw_major
726 * @param fw_minor
727 * @param fw_rev
728 * @param fw_eng
729 */
730void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
731 u16 *fw_major, u16 *fw_minor,
732 u16 *fw_rev, u16 *fw_eng);
733
734/**
735 * @brief hw preparation for VF
736 * sends ACQUIRE message
737 *
738 * @param p_hwfn
739 *
740 * @return int
741 */
742int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn);
743
744/**
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300745 * @brief VF - start the RX Queue by sending a message to the PF
746 * @param p_hwfn
Mintz, Yuval3da7a372016-11-29 16:47:06 +0200747 * @param p_cid - Only relative fields are relevant
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300748 * @param bd_max_bytes - maximum number of bytes per bd
749 * @param bd_chain_phys_addr - physical address of bd chain
750 * @param cqe_pbl_addr - physical address of pbl
751 * @param cqe_pbl_size - pbl size
752 * @param pp_prod - pointer to the producer to be
753 * used in fastpath
754 *
755 * @return int
756 */
757int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
Mintz, Yuval3da7a372016-11-29 16:47:06 +0200758 struct qed_queue_cid *p_cid,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300759 u16 bd_max_bytes,
760 dma_addr_t bd_chain_phys_addr,
761 dma_addr_t cqe_pbl_addr,
762 u16 cqe_pbl_size, void __iomem **pp_prod);
763
764/**
765 * @brief VF - start the TX queue by sending a message to the
766 * PF.
767 *
768 * @param p_hwfn
769 * @param tx_queue_id - zero based within the VF
770 * @param sb - status block for this queue
771 * @param sb_index - index within the status block
772 * @param bd_chain_phys_addr - physical address of tx chain
773 * @param pp_doorbell - pointer to address to which to
774 * write the doorbell too..
775 *
776 * @return int
777 */
Mintz, Yuval3da7a372016-11-29 16:47:06 +0200778int
779qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
780 struct qed_queue_cid *p_cid,
781 dma_addr_t pbl_addr,
782 u16 pbl_size, void __iomem **pp_doorbell);
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300783
784/**
785 * @brief VF - stop the RX queue by sending a message to the PF
786 *
787 * @param p_hwfn
Mintz, Yuval3da7a372016-11-29 16:47:06 +0200788 * @param p_cid
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300789 * @param cqe_completion
790 *
791 * @return int
792 */
793int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
Mintz, Yuval3da7a372016-11-29 16:47:06 +0200794 struct qed_queue_cid *p_cid, bool cqe_completion);
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300795
796/**
797 * @brief VF - stop the TX queue by sending a message to the PF
798 *
799 * @param p_hwfn
800 * @param tx_qid
801 *
802 * @return int
803 */
Mintz, Yuval3da7a372016-11-29 16:47:06 +0200804int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, struct qed_queue_cid *p_cid);
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300805
806/**
807 * @brief VF - send a vport update command
808 *
809 * @param p_hwfn
810 * @param params
811 *
812 * @return int
813 */
814int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
815 struct qed_sp_vport_update_params *p_params);
816
817/**
Yuval Mintz0b55e272016-05-11 16:36:15 +0300818 *
819 * @brief VF - send a close message to PF
820 *
821 * @param p_hwfn
822 *
823 * @return enum _qed_status
824 */
825int qed_vf_pf_reset(struct qed_hwfn *p_hwfn);
826
827/**
828 * @brief VF - free vf`s memories
829 *
830 * @param p_hwfn
831 *
832 * @return enum _qed_status
833 */
834int qed_vf_pf_release(struct qed_hwfn *p_hwfn);
Yuval Mintz36558c32016-05-11 16:36:17 +0300835
Yuval Mintz0b55e272016-05-11 16:36:15 +0300836/**
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300837 * @brief qed_vf_get_igu_sb_id - Get the IGU SB ID for a given
838 * sb_id. For VFs igu sbs don't have to be contiguous
839 *
840 * @param p_hwfn
841 * @param sb_id
842 *
843 * @return INLINE u16
844 */
845u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id);
Yuval Mintz0b55e272016-05-11 16:36:15 +0300846
847/**
Mintz, Yuval50a20712017-06-01 15:29:09 +0300848 * @brief Stores [or removes] a configured sb_info.
849 *
850 * @param p_hwfn
851 * @param sb_id - zero-based SB index [for fastpath]
852 * @param sb_info - may be NULL [during removal].
853 */
854void qed_vf_set_sb_info(struct qed_hwfn *p_hwfn,
855 u16 sb_id, struct qed_sb_info *p_sb);
856
857/**
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300858 * @brief qed_vf_pf_vport_start - perform vport start for VF.
859 *
860 * @param p_hwfn
861 * @param vport_id
862 * @param mtu
863 * @param inner_vlan_removal
864 * @param tpa_mode
865 * @param max_buffers_per_cqe,
866 * @param only_untagged - default behavior regarding vlan acceptance
867 *
868 * @return enum _qed_status
869 */
870int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
871 u8 vport_id,
872 u16 mtu,
873 u8 inner_vlan_removal,
874 enum qed_tpa_mode tpa_mode,
Yuval Mintz08feecd2016-05-11 16:36:20 +0300875 u8 max_buffers_per_cqe, u8 only_untagged);
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300876
877/**
878 * @brief qed_vf_pf_vport_stop - stop the VF's vport
879 *
880 * @param p_hwfn
881 *
882 * @return enum _qed_status
883 */
884int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn);
885
886int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
887 struct qed_filter_ucast *p_param);
888
889void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
890 struct qed_filter_mcast *p_filter_cmd);
891
892/**
Yuval Mintz0b55e272016-05-11 16:36:15 +0300893 * @brief qed_vf_pf_int_cleanup - clean the SB of the VF
894 *
895 * @param p_hwfn
896 *
897 * @return enum _qed_status
898 */
899int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn);
Yuval Mintz36558c32016-05-11 16:36:17 +0300900
901/**
902 * @brief - return the link params in a given bulletin board
903 *
904 * @param p_hwfn
905 * @param p_params - pointer to a struct to fill with link params
906 * @param p_bulletin
907 */
908void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
909 struct qed_mcp_link_params *p_params,
910 struct qed_bulletin_content *p_bulletin);
911
912/**
913 * @brief - return the link state in a given bulletin board
914 *
915 * @param p_hwfn
916 * @param p_link - pointer to a struct to fill with link state
917 * @param p_bulletin
918 */
919void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
920 struct qed_mcp_link_state *p_link,
921 struct qed_bulletin_content *p_bulletin);
922
923/**
924 * @brief - return the link capabilities in a given bulletin board
925 *
926 * @param p_hwfn
927 * @param p_link - pointer to a struct to fill with link capabilities
928 * @param p_bulletin
929 */
930void __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
931 struct qed_mcp_link_capabilities *p_link_caps,
932 struct qed_bulletin_content *p_bulletin);
933
934void qed_iov_vf_task(struct work_struct *work);
Chopra, Manisheaf3c0c2017-04-24 10:00:49 -0700935void qed_vf_set_vf_start_tunn_update_param(struct qed_tunnel_info *p_tun);
936int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
937 struct qed_tunnel_info *p_tunn);
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300938#else
Yuval Mintz36558c32016-05-11 16:36:17 +0300939static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
940 struct qed_mcp_link_params *params)
941{
942}
943
944static inline void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
945 struct qed_mcp_link_state *link)
946{
947}
948
949static inline void
950qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
951 struct qed_mcp_link_capabilities *p_link_caps)
952{
953}
954
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300955static inline void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs)
956{
957}
958
959static inline void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac)
960{
961}
962
963static inline void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
964 u8 *num_vlan_filters)
965{
966}
967
Mintz, Yuvalb0fca312016-10-31 22:26:54 +0200968static inline void qed_vf_get_num_mac_filters(struct qed_hwfn *p_hwfn,
969 u8 *num_mac_filters)
970{
971}
972
Yuval Mintzeff16962016-05-11 16:36:21 +0300973static inline bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac)
974{
975 return false;
976}
977
Yuval Mintz1408cc1f2016-05-11 16:36:14 +0300978static inline void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
979 u16 *fw_major, u16 *fw_minor,
980 u16 *fw_rev, u16 *fw_eng)
981{
982}
983
984static inline int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
985{
986 return -EINVAL;
987}
988
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300989static inline int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
Mintz, Yuval3da7a372016-11-29 16:47:06 +0200990 struct qed_queue_cid *p_cid,
Yuval Mintzdacd88d2016-05-11 16:36:16 +0300991 u16 bd_max_bytes,
992 dma_addr_t bd_chain_phys_adr,
993 dma_addr_t cqe_pbl_addr,
994 u16 cqe_pbl_size, void __iomem **pp_prod)
995{
996 return -EINVAL;
997}
998
999static inline int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
Mintz, Yuval3da7a372016-11-29 16:47:06 +02001000 struct qed_queue_cid *p_cid,
Yuval Mintzdacd88d2016-05-11 16:36:16 +03001001 dma_addr_t pbl_addr,
1002 u16 pbl_size, void __iomem **pp_doorbell)
1003{
1004 return -EINVAL;
1005}
1006
1007static inline int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
Mintz, Yuval3da7a372016-11-29 16:47:06 +02001008 struct qed_queue_cid *p_cid,
1009 bool cqe_completion)
Yuval Mintzdacd88d2016-05-11 16:36:16 +03001010{
1011 return -EINVAL;
1012}
1013
Mintz, Yuval3da7a372016-11-29 16:47:06 +02001014static inline int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn,
1015 struct qed_queue_cid *p_cid)
Yuval Mintzdacd88d2016-05-11 16:36:16 +03001016{
1017 return -EINVAL;
1018}
1019
1020static inline int
1021qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
1022 struct qed_sp_vport_update_params *p_params)
1023{
1024 return -EINVAL;
1025}
1026
Yuval Mintz0b55e272016-05-11 16:36:15 +03001027static inline int qed_vf_pf_reset(struct qed_hwfn *p_hwfn)
1028{
1029 return -EINVAL;
1030}
1031
1032static inline int qed_vf_pf_release(struct qed_hwfn *p_hwfn)
1033{
1034 return -EINVAL;
1035}
1036
Yuval Mintz1408cc1f2016-05-11 16:36:14 +03001037static inline u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id)
1038{
1039 return 0;
1040}
Yuval Mintz0b55e272016-05-11 16:36:15 +03001041
Yuval Mintzdacd88d2016-05-11 16:36:16 +03001042static inline int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
1043 u8 vport_id,
1044 u16 mtu,
1045 u8 inner_vlan_removal,
1046 enum qed_tpa_mode tpa_mode,
Yuval Mintz08feecd2016-05-11 16:36:20 +03001047 u8 max_buffers_per_cqe,
1048 u8 only_untagged)
Yuval Mintzdacd88d2016-05-11 16:36:16 +03001049{
1050 return -EINVAL;
1051}
1052
1053static inline int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn)
1054{
1055 return -EINVAL;
1056}
1057
1058static inline int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
1059 struct qed_filter_ucast *p_param)
1060{
1061 return -EINVAL;
1062}
1063
1064static inline void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
1065 struct qed_filter_mcast *p_filter_cmd)
1066{
1067}
1068
Yuval Mintz0b55e272016-05-11 16:36:15 +03001069static inline int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn)
1070{
1071 return -EINVAL;
1072}
Yuval Mintz36558c32016-05-11 16:36:17 +03001073
1074static inline void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
1075 struct qed_mcp_link_params
1076 *p_params,
1077 struct qed_bulletin_content
1078 *p_bulletin)
1079{
1080}
1081
1082static inline void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
1083 struct qed_mcp_link_state *p_link,
1084 struct qed_bulletin_content
1085 *p_bulletin)
1086{
1087}
1088
1089static inline void
1090__qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
1091 struct qed_mcp_link_capabilities *p_link_caps,
1092 struct qed_bulletin_content *p_bulletin)
1093{
1094}
1095
1096static inline void qed_iov_vf_task(struct work_struct *work)
1097{
1098}
Chopra, Manisheaf3c0c2017-04-24 10:00:49 -07001099
1100static inline void
1101qed_vf_set_vf_start_tunn_update_param(struct qed_tunnel_info *p_tun)
1102{
1103}
1104
1105static inline int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
1106 struct qed_tunnel_info *p_tunn)
1107{
1108 return -EINVAL;
1109}
Yuval Mintz1408cc1f2016-05-11 16:36:14 +03001110#endif
1111
Yuval Mintz32a47e72016-05-11 16:36:12 +03001112#endif