Linux Audio

Check our new training course

Loading...
v6.8
   1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
   2/* QLogic qed NIC Driver
   3 * Copyright (c) 2015-2017  QLogic Corporation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
   4 */
   5
   6#ifndef _QED_VF_H
   7#define _QED_VF_H
   8
   9#include "qed_l2.h"
  10#include "qed_mcp.h"
  11
  12#define T_ETH_INDIRECTION_TABLE_SIZE 128
  13#define T_ETH_RSS_KEY_SIZE 10
  14
  15struct vf_pf_resc_request {
  16	u8 num_rxqs;
  17	u8 num_txqs;
  18	u8 num_sbs;
  19	u8 num_mac_filters;
  20	u8 num_vlan_filters;
  21	u8 num_mc_filters;
  22	u8 num_cids;
  23	u8 padding;
  24};
  25
  26struct hw_sb_info {
  27	u16 hw_sb_id;
  28	u8 sb_qid;
  29	u8 padding[5];
  30};
  31
  32#define TLV_BUFFER_SIZE                 1024
  33
  34enum {
  35	PFVF_STATUS_WAITING,
  36	PFVF_STATUS_SUCCESS,
  37	PFVF_STATUS_FAILURE,
  38	PFVF_STATUS_NOT_SUPPORTED,
  39	PFVF_STATUS_NO_RESOURCE,
  40	PFVF_STATUS_FORCED,
  41	PFVF_STATUS_MALICIOUS,
  42};
  43
  44/* vf pf channel tlvs */
  45/* general tlv header (used for both vf->pf request and pf->vf response) */
  46struct channel_tlv {
  47	u16 type;
  48	u16 length;
  49};
  50
  51/* header of first vf->pf tlv carries the offset used to calculate response
  52 * buffer address
  53 */
  54struct vfpf_first_tlv {
  55	struct channel_tlv tl;
  56	u32 padding;
  57	u64 reply_address;
  58};
  59
  60/* header of pf->vf tlvs, carries the status of handling the request */
  61struct pfvf_tlv {
  62	struct channel_tlv tl;
  63	u8 status;
  64	u8 padding[3];
  65};
  66
  67/* response tlv used for most tlvs */
  68struct pfvf_def_resp_tlv {
  69	struct pfvf_tlv hdr;
  70};
  71
  72/* used to terminate and pad a tlv list */
  73struct channel_list_end_tlv {
  74	struct channel_tlv tl;
  75	u8 padding[4];
  76};
  77
  78#define VFPF_ACQUIRE_OS_LINUX (0)
  79#define VFPF_ACQUIRE_OS_WINDOWS (1)
  80#define VFPF_ACQUIRE_OS_ESX (2)
  81#define VFPF_ACQUIRE_OS_SOLARIS (3)
  82#define VFPF_ACQUIRE_OS_LINUX_USERSPACE (4)
  83
  84struct vfpf_acquire_tlv {
  85	struct vfpf_first_tlv first_tlv;
  86
  87	struct vf_pf_vfdev_info {
  88#define VFPF_ACQUIRE_CAP_PRE_FP_HSI     BIT(0) /* VF pre-FP hsi version */
  89#define VFPF_ACQUIRE_CAP_100G		BIT(1) /* VF can support 100g */
  90	/* A requirement for supporting multi-Tx queues on a single queue-zone,
  91	 * VF would pass qids as additional information whenever passing queue
  92	 * references.
  93	 */
  94#define VFPF_ACQUIRE_CAP_QUEUE_QIDS     BIT(2)
  95
  96	/* The VF is using the physical bar. While this is mostly internal
  97	 * to the VF, might affect the number of CIDs supported assuming
  98	 * QUEUE_QIDS is set.
  99	 */
 100#define VFPF_ACQUIRE_CAP_PHYSICAL_BAR   BIT(3)
 101		u64 capabilities;
 102		u8 fw_major;
 103		u8 fw_minor;
 104		u8 fw_revision;
 105		u8 fw_engineering;
 106		u32 driver_version;
 107		u16 opaque_fid;	/* ME register value */
 108		u8 os_type;	/* VFPF_ACQUIRE_OS_* value */
 109		u8 eth_fp_hsi_major;
 110		u8 eth_fp_hsi_minor;
 111		u8 padding[3];
 112	} vfdev_info;
 113
 114	struct vf_pf_resc_request resc_request;
 115
 116	u64 bulletin_addr;
 117	u32 bulletin_size;
 118	u32 padding;
 119};
 120
 121/* receive side scaling tlv */
 122struct vfpf_vport_update_rss_tlv {
 123	struct channel_tlv tl;
 124
 125	u8 update_rss_flags;
 126#define VFPF_UPDATE_RSS_CONFIG_FLAG       BIT(0)
 127#define VFPF_UPDATE_RSS_CAPS_FLAG         BIT(1)
 128#define VFPF_UPDATE_RSS_IND_TABLE_FLAG    BIT(2)
 129#define VFPF_UPDATE_RSS_KEY_FLAG          BIT(3)
 130
 131	u8 rss_enable;
 132	u8 rss_caps;
 133	u8 rss_table_size_log;	/* The table size is 2 ^ rss_table_size_log */
 134	u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
 135	u32 rss_key[T_ETH_RSS_KEY_SIZE];
 136};
 137
 138struct pfvf_storm_stats {
 139	u32 address;
 140	u32 len;
 141};
 142
 143struct pfvf_stats_info {
 144	struct pfvf_storm_stats mstats;
 145	struct pfvf_storm_stats pstats;
 146	struct pfvf_storm_stats tstats;
 147	struct pfvf_storm_stats ustats;
 148};
 149
 150struct pfvf_acquire_resp_tlv {
 151	struct pfvf_tlv hdr;
 152
 153	struct pf_vf_pfdev_info {
 154		u32 chip_num;
 155		u32 mfw_ver;
 156
 157		u16 fw_major;
 158		u16 fw_minor;
 159		u16 fw_rev;
 160		u16 fw_eng;
 161
 162		u64 capabilities;
 163#define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED	BIT(0)
 164#define PFVF_ACQUIRE_CAP_100G			BIT(1)	/* If set, 100g PF */
 165/* There are old PF versions where the PF might mistakenly override the sanity
 166 * mechanism [version-based] and allow a VF that can't be supported to pass
 167 * the acquisition phase.
 168 * To overcome this, PFs now indicate that they're past that point and the new
 169 * VFs would fail probe on the older PFs that fail to do so.
 170 */
 171#define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE	BIT(2)
 172
 173	/* PF expects queues to be received with additional qids */
 174#define PFVF_ACQUIRE_CAP_QUEUE_QIDS             BIT(3)
 175
 176		u16 db_size;
 177		u8 indices_per_sb;
 178		u8 os_type;
 179
 180		/* These should match the PF's qed_dev values */
 181		u16 chip_rev;
 182		u8 dev_type;
 183
 184		/* Doorbell bar size configured in HW: log(size) or 0 */
 185		u8 bar_size;
 186
 187		struct pfvf_stats_info stats_info;
 188
 189		u8 port_mac[ETH_ALEN];
 190
 191		/* It's possible PF had to configure an older fastpath HSI
 192		 * [in case VF is newer than PF]. This is communicated back
 193		 * to the VF. It can also be used in case of error due to
 194		 * non-matching versions to shed light in VF about failure.
 195		 */
 196		u8 major_fp_hsi;
 197		u8 minor_fp_hsi;
 198	} pfdev_info;
 199
 200	struct pf_vf_resc {
 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 num_cids;
 214		u8 padding;
 215	} resc;
 216
 217	u32 bulletin_size;
 218	u32 padding;
 219};
 220
 221struct pfvf_start_queue_resp_tlv {
 222	struct pfvf_tlv hdr;
 223	u32 offset;		/* offset to consumer/producer of queue */
 224	u8 padding[4];
 225};
 226
 227/* Extended queue information - additional index for reference inside qzone.
 228 * If communicated between VF/PF, each TLV relating to queues should be
 229 * extended by one such [or have a future base TLV that already contains info].
 230 */
 231struct vfpf_qid_tlv {
 232	struct channel_tlv tl;
 233	u8 qid;
 234	u8 padding[3];
 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;
 278
 279	/* this field is deprecated and should *always* be set to '1' */
 280	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;
 290
 291	/* this field is deprecated and should *always* be set to '1' */
 292	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
 352struct 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
 364struct vfpf_vport_update_mcast_bin_tlv {
 365	struct channel_tlv tl;
 366	u8 padding[4];
 367
 368	/* There are only 256 approx bins, and in HSI they're divided into
 369	 * 32-bit values. As old VFs used to set-bit to the values on its side,
 370	 * the upper half of the array is never expected to contain any data.
 371	 */
 372	u64 bins[4];
 373	u64 obsolete_bins[4];
 374};
 375
 376struct vfpf_vport_update_accept_param_tlv {
 377	struct channel_tlv tl;
 378	u8 update_rx_mode;
 379	u8 update_tx_mode;
 380	u8 rx_accept_filter;
 381	u8 tx_accept_filter;
 382};
 383
 384struct vfpf_vport_update_accept_any_vlan_tlv {
 385	struct channel_tlv tl;
 386	u8 update_accept_any_vlan_flg;
 387	u8 accept_any_vlan;
 388
 389	u8 padding[2];
 390};
 391
 392struct vfpf_vport_update_sge_tpa_tlv {
 393	struct channel_tlv tl;
 394
 395	u16 sge_tpa_flags;
 396#define VFPF_TPA_IPV4_EN_FLAG		BIT(0)
 397#define VFPF_TPA_IPV6_EN_FLAG		BIT(1)
 398#define VFPF_TPA_PKT_SPLIT_FLAG		BIT(2)
 399#define VFPF_TPA_HDR_DATA_SPLIT_FLAG	BIT(3)
 400#define VFPF_TPA_GRO_CONSIST_FLAG	BIT(4)
 401
 402	u8 update_sge_tpa_flags;
 403#define VFPF_UPDATE_SGE_DEPRECATED_FLAG	BIT(0)
 404#define VFPF_UPDATE_TPA_EN_FLAG		BIT(1)
 405#define VFPF_UPDATE_TPA_PARAM_FLAG	BIT(2)
 406
 407	u8 max_buffers_per_cqe;
 408
 409	u16 deprecated_sge_buff_size;
 410	u16 tpa_max_size;
 411	u16 tpa_min_size_to_start;
 412	u16 tpa_min_size_to_cont;
 413
 414	u8 tpa_max_aggs_num;
 415	u8 padding[7];
 416};
 417
 418/* Primary tlv as a header for various extended tlvs for
 419 * various functionalities in vport update ramrod.
 420 */
 421struct vfpf_vport_update_tlv {
 422	struct vfpf_first_tlv first_tlv;
 423};
 424
 425struct vfpf_ucast_filter_tlv {
 426	struct vfpf_first_tlv first_tlv;
 427
 428	u8 opcode;
 429	u8 type;
 430
 431	u8 mac[ETH_ALEN];
 432
 433	u16 vlan;
 434	u16 padding[3];
 435};
 436
 437/* tunnel update param tlv */
 438struct vfpf_update_tunn_param_tlv {
 439	struct vfpf_first_tlv first_tlv;
 440
 441	u8 tun_mode_update_mask;
 442	u8 tunn_mode;
 443	u8 update_tun_cls;
 444	u8 vxlan_clss;
 445	u8 l2gre_clss;
 446	u8 ipgre_clss;
 447	u8 l2geneve_clss;
 448	u8 ipgeneve_clss;
 449	u8 update_geneve_port;
 450	u8 update_vxlan_port;
 451	u16 geneve_port;
 452	u16 vxlan_port;
 453	u8 padding[2];
 454};
 455
 456struct pfvf_update_tunn_param_tlv {
 457	struct pfvf_tlv hdr;
 458
 459	u16 tunn_feature_mask;
 460	u8 vxlan_mode;
 461	u8 l2geneve_mode;
 462	u8 ipgeneve_mode;
 463	u8 l2gre_mode;
 464	u8 ipgre_mode;
 465	u8 vxlan_clss;
 466	u8 l2gre_clss;
 467	u8 ipgre_clss;
 468	u8 l2geneve_clss;
 469	u8 ipgeneve_clss;
 470	u16 vxlan_udp_port;
 471	u16 geneve_udp_port;
 472};
 473
 474struct tlv_buffer_size {
 475	u8 tlv_buffer[TLV_BUFFER_SIZE];
 476};
 477
 478struct vfpf_update_coalesce {
 479	struct vfpf_first_tlv first_tlv;
 480	u16 rx_coal;
 481	u16 tx_coal;
 482	u16 qid;
 483	u8 padding[2];
 484};
 485
 486struct vfpf_read_coal_req_tlv {
 487	struct vfpf_first_tlv first_tlv;
 488	u16 qid;
 489	u8 is_rx;
 490	u8 padding[5];
 491};
 492
 493struct pfvf_read_coal_resp_tlv {
 494	struct pfvf_tlv hdr;
 495	u16 coal;
 496	u8 padding[6];
 497};
 498
 499struct vfpf_bulletin_update_mac_tlv {
 500	struct vfpf_first_tlv first_tlv;
 501	u8 mac[ETH_ALEN];
 502	u8 padding[2];
 503};
 504
 505union vfpf_tlvs {
 506	struct vfpf_first_tlv first_tlv;
 507	struct vfpf_acquire_tlv acquire;
 508	struct vfpf_start_rxq_tlv start_rxq;
 509	struct vfpf_start_txq_tlv start_txq;
 510	struct vfpf_stop_rxqs_tlv stop_rxqs;
 511	struct vfpf_stop_txqs_tlv stop_txqs;
 512	struct vfpf_update_rxq_tlv update_rxq;
 513	struct vfpf_vport_start_tlv start_vport;
 514	struct vfpf_vport_update_tlv vport_update;
 515	struct vfpf_ucast_filter_tlv ucast_filter;
 516	struct vfpf_update_tunn_param_tlv tunn_param_update;
 517	struct vfpf_update_coalesce update_coalesce;
 518	struct vfpf_read_coal_req_tlv read_coal_req;
 519	struct vfpf_bulletin_update_mac_tlv bulletin_update_mac;
 520	struct tlv_buffer_size tlv_buf_size;
 521};
 522
 523union pfvf_tlvs {
 524	struct pfvf_def_resp_tlv default_resp;
 525	struct pfvf_acquire_resp_tlv acquire_resp;
 526	struct tlv_buffer_size tlv_buf_size;
 527	struct pfvf_start_queue_resp_tlv queue_start;
 528	struct pfvf_update_tunn_param_tlv tunn_param_resp;
 529	struct pfvf_read_coal_resp_tlv read_coal_resp;
 530};
 531
 532enum qed_bulletin_bit {
 533	/* Alert the VF that a forced MAC was set by the PF */
 534	MAC_ADDR_FORCED = 0,
 535	/* Alert the VF that a forced VLAN was set by the PF */
 536	VLAN_ADDR_FORCED = 2,
 537
 538	/* Indicate that `default_only_untagged' contains actual data */
 539	VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
 540	VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
 541
 542	/* Alert the VF that suggested mac was sent by the PF.
 543	 * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set.
 544	 */
 545	VFPF_BULLETIN_MAC_ADDR = 5
 546};
 547
 548struct qed_bulletin_content {
 549	/* crc of structure to ensure is not in mid-update */
 550	u32 crc;
 551
 552	u32 version;
 553
 554	/* bitmap indicating which fields hold valid values */
 555	u64 valid_bitmap;
 556
 557	/* used for MAC_ADDR or MAC_ADDR_FORCED */
 558	u8 mac[ETH_ALEN];
 559
 560	/* If valid, 1 => only untagged Rx if no vlan is configured */
 561	u8 default_only_untagged;
 562	u8 padding;
 563
 564	/* The following is a 'copy' of qed_mcp_link_state,
 565	 * qed_mcp_link_params and qed_mcp_link_capabilities. Since it's
 566	 * possible the structs will increase further along the road we cannot
 567	 * have it here; Instead we need to have all of its fields.
 568	 */
 569	u8 req_autoneg;
 570	u8 req_autoneg_pause;
 571	u8 req_forced_rx;
 572	u8 req_forced_tx;
 573	u8 padding2[4];
 574
 575	u32 req_adv_speed;
 576	u32 req_forced_speed;
 577	u32 req_loopback;
 578	u32 padding3;
 579
 580	u8 link_up;
 581	u8 full_duplex;
 582	u8 autoneg;
 583	u8 autoneg_complete;
 584	u8 parallel_detection;
 585	u8 pfc_enabled;
 586	u8 partner_tx_flow_ctrl_en;
 587	u8 partner_rx_flow_ctrl_en;
 588	u8 partner_adv_pause;
 589	u8 sfp_tx_fault;
 590	u16 vxlan_udp_port;
 591	u16 geneve_udp_port;
 592	u8 padding4[2];
 593
 594	u32 speed;
 595	u32 partner_adv_speed;
 596
 597	u32 capability_speed;
 598
 599	/* Forced vlan */
 600	u16 pvid;
 601	u16 padding5;
 602};
 603
 604struct qed_bulletin {
 605	dma_addr_t phys;
 606	struct qed_bulletin_content *p_virt;
 607	u32 size;
 608};
 609
 610enum {
 611	CHANNEL_TLV_NONE,	/* ends tlv sequence */
 612	CHANNEL_TLV_ACQUIRE,
 613	CHANNEL_TLV_VPORT_START,
 614	CHANNEL_TLV_VPORT_UPDATE,
 615	CHANNEL_TLV_VPORT_TEARDOWN,
 616	CHANNEL_TLV_START_RXQ,
 617	CHANNEL_TLV_START_TXQ,
 618	CHANNEL_TLV_STOP_RXQS,
 619	CHANNEL_TLV_STOP_TXQS,
 620	CHANNEL_TLV_UPDATE_RXQ,
 621	CHANNEL_TLV_INT_CLEANUP,
 622	CHANNEL_TLV_CLOSE,
 623	CHANNEL_TLV_RELEASE,
 624	CHANNEL_TLV_LIST_END,
 625	CHANNEL_TLV_UCAST_FILTER,
 626	CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
 627	CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
 628	CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
 629	CHANNEL_TLV_VPORT_UPDATE_MCAST,
 630	CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
 631	CHANNEL_TLV_VPORT_UPDATE_RSS,
 632	CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
 633	CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
 634	CHANNEL_TLV_UPDATE_TUNN_PARAM,
 635	CHANNEL_TLV_COALESCE_UPDATE,
 636	CHANNEL_TLV_QID,
 637	CHANNEL_TLV_COALESCE_READ,
 638	CHANNEL_TLV_BULLETIN_UPDATE_MAC,
 639	CHANNEL_TLV_MAX,
 640
 641	/* Required for iterating over vport-update tlvs.
 642	 * Will break in case non-sequential vport-update tlvs.
 643	 */
 644	CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
 645};
 646
 647/* Default number of CIDs [total of both Rx and Tx] to be requested
 648 * by default, and maximum possible number.
 649 */
 650#define QED_ETH_VF_DEFAULT_NUM_CIDS (32)
 651#define QED_ETH_VF_MAX_NUM_CIDS (250)
 652
 653/* This data is held in the qed_hwfn structure for VFs only. */
 654struct qed_vf_iov {
 655	union vfpf_tlvs *vf2pf_request;
 656	dma_addr_t vf2pf_request_phys;
 657	union pfvf_tlvs *pf2vf_reply;
 658	dma_addr_t pf2vf_reply_phys;
 659
 660	/* Should be taken whenever the mailbox buffers are accessed */
 661	struct mutex mutex;
 662	u8 *offset;
 663
 664	/* Bulletin Board */
 665	struct qed_bulletin bulletin;
 666	struct qed_bulletin_content bulletin_shadow;
 667
 668	/* we set aside a copy of the acquire response */
 669	struct pfvf_acquire_resp_tlv acquire_resp;
 670
 671	/* In case PF originates prior to the fp-hsi version comparison,
 672	 * this has to be propagated as it affects the fastpath.
 673	 */
 674	bool b_pre_fp_hsi;
 675
 676	/* Current day VFs are passing the SBs physical address on vport
 677	 * start, and as they lack an IGU mapping they need to store the
 678	 * addresses of previously registered SBs.
 679	 * Even if we were to change configuration flow, due to backward
 680	 * compatibility [with older PFs] we'd still need to store these.
 681	 */
 682	struct qed_sb_info *sbs_info[PFVF_MAX_SBS_PER_VF];
 683
 684	/* Determines whether VF utilizes doorbells via limited register
 685	 * bar or via the doorbell bar.
 686	 */
 687	bool b_doorbell_bar;
 688};
 689
 690/**
 691 * qed_vf_pf_set_coalesce(): VF - Set Rx/Tx coalesce per VF's relative queue.
 692 *                                Coalesce value '0' will omit the
 693 *                                configuration.
 694 *
 695 * @p_hwfn: HW device data.
 696 * @rx_coal: coalesce value in micro second for rx queue.
 697 * @tx_coal: coalesce value in micro second for tx queue.
 698 * @p_cid: queue cid.
 699 *
 700 * Return: Int.
 
 
 
 701 *
 702 **/
 703int qed_vf_pf_set_coalesce(struct qed_hwfn *p_hwfn,
 704			   u16 rx_coal,
 705			   u16 tx_coal, struct qed_queue_cid *p_cid);
 706
 707/**
 708 * qed_vf_pf_get_coalesce(): VF - Get coalesce per VF's relative queue.
 709 *
 710 * @p_hwfn: HW device data.
 711 * @p_coal: coalesce value in micro second for VF queues.
 712 * @p_cid: queue cid.
 713 *
 714 * Return: Int.
 715 **/
 716int qed_vf_pf_get_coalesce(struct qed_hwfn *p_hwfn,
 717			   u16 *p_coal, struct qed_queue_cid *p_cid);
 718
 719#ifdef CONFIG_QED_SRIOV
 720/**
 721 * qed_vf_read_bulletin(): Read the VF bulletin and act on it if needed.
 722 *
 723 * @p_hwfn: HW device data.
 724 * @p_change: qed fills 1 iff bulletin board has changed, 0 otherwise.
 725 *
 726 * Return: enum _qed_status.
 727 */
 728int qed_vf_read_bulletin(struct qed_hwfn *p_hwfn, u8 *p_change);
 729
 730/**
 731 * qed_vf_get_link_params(): Get link parameters for VF from qed
 732 *
 733 * @p_hwfn: HW device data.
 734 * @params: the link params structure to be filled for the VF.
 735 *
 736 * Return: Void.
 
 737 */
 738void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
 739			    struct qed_mcp_link_params *params);
 740
 741/**
 742 * qed_vf_get_link_state(): Get link state for VF from qed.
 743 *
 744 * @p_hwfn: HW device data.
 745 * @link: the link state structure to be filled for the VF
 746 *
 747 * Return: Void.
 748 */
 749void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
 750			   struct qed_mcp_link_state *link);
 751
 752/**
 753 * qed_vf_get_link_caps(): Get link capabilities for VF from qed.
 754 *
 755 * @p_hwfn: HW device data.
 756 * @p_link_caps: the link capabilities structure to be filled for the VF
 757 *
 758 * Return: Void.
 
 759 */
 760void qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
 761			  struct qed_mcp_link_capabilities *p_link_caps);
 762
 763/**
 764 * qed_vf_get_num_rxqs(): Get number of Rx queues allocated for VF by qed
 765 *
 766 * @p_hwfn: HW device data.
 767 * @num_rxqs: allocated RX queues
 768 *
 769 * Return: Void.
 770 */
 771void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs);
 772
 773/**
 774 * qed_vf_get_num_txqs(): Get number of Rx queues allocated for VF by qed
 775 *
 776 * @p_hwfn: HW device data.
 777 * @num_txqs: allocated RX queues
 778 *
 779 * Return: Void.
 
 780 */
 781void qed_vf_get_num_txqs(struct qed_hwfn *p_hwfn, u8 *num_txqs);
 782
 783/**
 784 * qed_vf_get_num_cids(): Get number of available connections
 785 *                        [both Rx and Tx] for VF
 786 *
 787 * @p_hwfn: HW device data.
 788 * @num_cids: allocated number of connections
 789 *
 790 * Return: Void.
 791 */
 792void qed_vf_get_num_cids(struct qed_hwfn *p_hwfn, u8 *num_cids);
 793
 794/**
 795 * qed_vf_get_port_mac(): Get port mac address for VF.
 796 *
 797 * @p_hwfn: HW device data.
 798 * @port_mac: destination location for port mac
 799 *
 800 * Return: Void.
 
 801 */
 802void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac);
 803
 804/**
 805 * qed_vf_get_num_vlan_filters(): Get number of VLAN filters allocated
 806 *                                for VF by qed.
 807 *
 808 * @p_hwfn: HW device data.
 809 * @num_vlan_filters: allocated VLAN filters
 810 *
 811 * Return: Void.
 812 */
 813void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
 814				 u8 *num_vlan_filters);
 815
 816/**
 817 * qed_vf_get_num_mac_filters(): Get number of MAC filters allocated
 818 *                               for VF by qed
 819 *
 820 * @p_hwfn: HW device data.
 821 * @num_mac_filters: allocated MAC filters
 822 *
 823 * Return: Void.
 
 824 */
 825void qed_vf_get_num_mac_filters(struct qed_hwfn *p_hwfn, u8 *num_mac_filters);
 826
 827/**
 828 * qed_vf_check_mac(): Check if VF can set a MAC address
 829 *
 830 * @p_hwfn: HW device data.
 831 * @mac: Mac.
 832 *
 833 * Return: bool.
 834 */
 835bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac);
 836
 837/**
 838 * qed_vf_get_fw_version(): Set firmware version information
 839 *                          in dev_info from VFs acquire response tlv
 840 *
 841 * @p_hwfn: HW device data.
 842 * @fw_major: FW major.
 843 * @fw_minor: FW minor.
 844 * @fw_rev: FW rev.
 845 * @fw_eng: FW eng.
 846 *
 847 * Return: Void.
 848 */
 849void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
 850			   u16 *fw_major, u16 *fw_minor,
 851			   u16 *fw_rev, u16 *fw_eng);
 852
 853/**
 854 * qed_vf_hw_prepare(): hw preparation for VF  sends ACQUIRE message
 
 855 *
 856 * @p_hwfn: HW device data.
 857 *
 858 * Return: Int.
 859 */
 860int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn);
 861
 862/**
 863 * qed_vf_pf_rxq_start(): start the RX Queue by sending a message to the PF
 864 *
 865 * @p_hwfn: HW device data.
 866 * @p_cid: Only relative fields are relevant
 867 * @bd_max_bytes: maximum number of bytes per bd
 868 * @bd_chain_phys_addr: physical address of bd chain
 869 * @cqe_pbl_addr: physical address of pbl
 870 * @cqe_pbl_size: pbl size
 871 * @pp_prod: pointer to the producer to be used in fastpath
 872 *
 873 * Return: Int.
 874 */
 875int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
 876			struct qed_queue_cid *p_cid,
 877			u16 bd_max_bytes,
 878			dma_addr_t bd_chain_phys_addr,
 879			dma_addr_t cqe_pbl_addr,
 880			u16 cqe_pbl_size, void __iomem **pp_prod);
 881
 882/**
 883 * qed_vf_pf_txq_start(): VF - start the TX queue by sending a message to the
 884 *                        PF.
 885 *
 886 * @p_hwfn: HW device data.
 887 * @p_cid: CID.
 888 * @pbl_addr: PBL address.
 889 * @pbl_size: PBL Size.
 890 * @pp_doorbell: pointer to address to which to write the doorbell too.
 
 
 891 *
 892 * Return: Int.
 893 */
 894int
 895qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
 896		    struct qed_queue_cid *p_cid,
 897		    dma_addr_t pbl_addr,
 898		    u16 pbl_size, void __iomem **pp_doorbell);
 899
 900/**
 901 * qed_vf_pf_rxq_stop(): VF - stop the RX queue by sending a message to the PF.
 902 *
 903 * @p_hwfn: HW device data.
 904 * @p_cid: CID.
 905 * @cqe_completion: CQE Completion.
 906 *
 907 * Return: Int.
 908 */
 909int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
 910		       struct qed_queue_cid *p_cid, bool cqe_completion);
 911
 912/**
 913 * qed_vf_pf_txq_stop(): VF - stop the TX queue by sending a message to the PF.
 914 *
 915 * @p_hwfn: HW device data.
 916 * @p_cid: CID.
 917 *
 918 * Return: Int.
 919 */
 920int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, struct qed_queue_cid *p_cid);
 921
 922/**
 923 * qed_vf_pf_vport_update(): VF - send a vport update command.
 924 *
 925 * @p_hwfn: HW device data.
 926 * @p_params: Params
 927 *
 928 * Return: Int.
 929 */
 930int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
 931			   struct qed_sp_vport_update_params *p_params);
 932
 933/**
 934 * qed_vf_pf_reset(): VF - send a close message to PF.
 935 *
 936 * @p_hwfn: HW device data.
 937 *
 938 * Return: enum _qed_status
 
 
 939 */
 940int qed_vf_pf_reset(struct qed_hwfn *p_hwfn);
 941
 942/**
 943 * qed_vf_pf_release(): VF - free vf`s memories.
 944 *
 945 * @p_hwfn: HW device data.
 946 *
 947 * Return: enum _qed_status
 948 */
 949int qed_vf_pf_release(struct qed_hwfn *p_hwfn);
 950
 951/**
 952 * qed_vf_get_igu_sb_id(): Get the IGU SB ID for a given
 953 *        sb_id. For VFs igu sbs don't have to be contiguous
 954 *
 955 * @p_hwfn: HW device data.
 956 * @sb_id: SB ID.
 957 *
 958 * Return: INLINE u16
 959 */
 960u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id);
 961
 962/**
 963 * qed_vf_set_sb_info(): Stores [or removes] a configured sb_info.
 964 *
 965 * @p_hwfn: HW device data.
 966 * @sb_id: zero-based SB index [for fastpath]
 967 * @p_sb:  may be NULL [during removal].
 968 *
 969 * Return: Void.
 
 
 970 */
 971void qed_vf_set_sb_info(struct qed_hwfn *p_hwfn,
 972			u16 sb_id, struct qed_sb_info *p_sb);
 973
 974/**
 975 * qed_vf_pf_vport_start(): perform vport start for VF.
 976 *
 977 * @p_hwfn: HW device data.
 978 * @vport_id: Vport ID.
 979 * @mtu: MTU.
 980 * @inner_vlan_removal: Innter VLAN removal.
 981 * @tpa_mode: TPA mode
 982 * @max_buffers_per_cqe: Max buffer pre CQE.
 983 * @only_untagged: default behavior regarding vlan acceptance
 984 *
 985 * Return: enum _qed_status
 986 */
 987int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
 988			  u8 vport_id,
 989			  u16 mtu,
 990			  u8 inner_vlan_removal,
 991			  enum qed_tpa_mode tpa_mode,
 992			  u8 max_buffers_per_cqe, u8 only_untagged);
 993
 994/**
 995 * qed_vf_pf_vport_stop(): stop the VF's vport
 996 *
 997 * @p_hwfn: HW device data.
 998 *
 999 * Return: enum _qed_status
1000 */
1001int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn);
1002
1003int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
1004			   struct qed_filter_ucast *p_param);
1005
1006void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
1007			    struct qed_filter_mcast *p_filter_cmd);
1008
1009/**
1010 * qed_vf_pf_int_cleanup(): clean the SB of the VF
1011 *
1012 * @p_hwfn: HW device data.
1013 *
1014 * Return: enum _qed_status
1015 */
1016int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn);
1017
1018/**
1019 * __qed_vf_get_link_params(): return the link params in a given bulletin board
1020 *
1021 * @p_hwfn: HW device data.
1022 * @p_params: pointer to a struct to fill with link params
1023 * @p_bulletin: Bulletin.
1024 *
1025 * Return: Void.
1026 */
1027void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
1028			      struct qed_mcp_link_params *p_params,
1029			      struct qed_bulletin_content *p_bulletin);
1030
1031/**
1032 * __qed_vf_get_link_state(): return the link state in a given bulletin board
1033 *
1034 * @p_hwfn: HW device data.
1035 * @p_link: pointer to a struct to fill with link state
1036 * @p_bulletin: Bulletin.
1037 *
1038 * Return: Void.
 
 
1039 */
1040void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
1041			     struct qed_mcp_link_state *p_link,
1042			     struct qed_bulletin_content *p_bulletin);
1043
1044/**
1045 * __qed_vf_get_link_caps(): return the link capabilities in a given
1046 *                           bulletin board
1047 *
1048 * @p_hwfn: HW device data.
1049 * @p_link_caps: pointer to a struct to fill with link capabilities
1050 * @p_bulletin: Bulletin.
1051 *
1052 * Return: Void.
1053 */
1054void __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
1055			    struct qed_mcp_link_capabilities *p_link_caps,
1056			    struct qed_bulletin_content *p_bulletin);
1057
1058void qed_iov_vf_task(struct work_struct *work);
1059void qed_vf_set_vf_start_tunn_update_param(struct qed_tunnel_info *p_tun);
1060int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
1061				  struct qed_tunnel_info *p_tunn);
1062
1063u32 qed_vf_hw_bar_size(struct qed_hwfn *p_hwfn, enum BAR_ID bar_id);
1064/**
1065 * qed_vf_pf_bulletin_update_mac(): Ask PF to update the MAC address in
1066 *                                  it's bulletin board
1067 *
1068 * @p_hwfn: HW device data.
1069 * @p_mac: mac address to be updated in bulletin board
1070 *
1071 * Return: Int.
1072 */
1073int qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn, const u8 *p_mac);
1074
1075#else
1076static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
1077					  struct qed_mcp_link_params *params)
1078{
1079}
1080
1081static inline void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
1082					 struct qed_mcp_link_state *link)
1083{
1084}
1085
1086static inline void
1087qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
1088		     struct qed_mcp_link_capabilities *p_link_caps)
1089{
1090}
1091
1092static inline void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs)
1093{
1094}
1095
1096static inline void qed_vf_get_num_txqs(struct qed_hwfn *p_hwfn, u8 *num_txqs)
1097{
1098}
1099
1100static inline void qed_vf_get_num_cids(struct qed_hwfn *p_hwfn, u8 *num_cids)
1101{
1102}
1103
1104static inline void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac)
1105{
1106}
1107
1108static inline void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
1109					       u8 *num_vlan_filters)
1110{
1111}
1112
1113static inline void qed_vf_get_num_mac_filters(struct qed_hwfn *p_hwfn,
1114					      u8 *num_mac_filters)
1115{
1116}
1117
1118static inline bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac)
1119{
1120	return false;
1121}
1122
1123static inline void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
1124					 u16 *fw_major, u16 *fw_minor,
1125					 u16 *fw_rev, u16 *fw_eng)
1126{
1127}
1128
1129static inline int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
1130{
1131	return -EINVAL;
1132}
1133
1134static inline int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
1135				      struct qed_queue_cid *p_cid,
1136				      u16 bd_max_bytes,
1137				      dma_addr_t bd_chain_phys_adr,
1138				      dma_addr_t cqe_pbl_addr,
1139				      u16 cqe_pbl_size, void __iomem **pp_prod)
1140{
1141	return -EINVAL;
1142}
1143
1144static inline int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
1145				      struct qed_queue_cid *p_cid,
1146				      dma_addr_t pbl_addr,
1147				      u16 pbl_size, void __iomem **pp_doorbell)
1148{
1149	return -EINVAL;
1150}
1151
1152static inline int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
1153				     struct qed_queue_cid *p_cid,
1154				     bool cqe_completion)
1155{
1156	return -EINVAL;
1157}
1158
1159static inline int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn,
1160				     struct qed_queue_cid *p_cid)
1161{
1162	return -EINVAL;
1163}
1164
1165static inline int
1166qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
1167		       struct qed_sp_vport_update_params *p_params)
1168{
1169	return -EINVAL;
1170}
1171
1172static inline int qed_vf_pf_reset(struct qed_hwfn *p_hwfn)
1173{
1174	return -EINVAL;
1175}
1176
1177static inline int qed_vf_pf_release(struct qed_hwfn *p_hwfn)
1178{
1179	return -EINVAL;
1180}
1181
1182static inline u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id)
1183{
1184	return 0;
1185}
1186
1187static inline void qed_vf_set_sb_info(struct qed_hwfn *p_hwfn, u16 sb_id,
1188				      struct qed_sb_info *p_sb)
1189{
1190}
1191
1192static inline int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
1193					u8 vport_id,
1194					u16 mtu,
1195					u8 inner_vlan_removal,
1196					enum qed_tpa_mode tpa_mode,
1197					u8 max_buffers_per_cqe,
1198					u8 only_untagged)
1199{
1200	return -EINVAL;
1201}
1202
1203static inline int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn)
1204{
1205	return -EINVAL;
1206}
1207
1208static inline int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
1209					 struct qed_filter_ucast *p_param)
1210{
1211	return -EINVAL;
1212}
1213
1214static inline void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
1215					  struct qed_filter_mcast *p_filter_cmd)
1216{
1217}
1218
1219static inline int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn)
1220{
1221	return -EINVAL;
1222}
1223
1224static inline void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
1225					    struct qed_mcp_link_params
1226					    *p_params,
1227					    struct qed_bulletin_content
1228					    *p_bulletin)
1229{
1230}
1231
1232static inline void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
1233					   struct qed_mcp_link_state *p_link,
1234					   struct qed_bulletin_content
1235					   *p_bulletin)
1236{
1237}
1238
1239static inline void
1240__qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
1241		       struct qed_mcp_link_capabilities *p_link_caps,
1242		       struct qed_bulletin_content *p_bulletin)
1243{
1244}
1245
1246static inline void qed_iov_vf_task(struct work_struct *work)
1247{
1248}
1249
1250static inline void
1251qed_vf_set_vf_start_tunn_update_param(struct qed_tunnel_info *p_tun)
1252{
1253}
1254
1255static inline int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
1256						struct qed_tunnel_info *p_tunn)
1257{
1258	return -EINVAL;
1259}
1260
1261static inline int qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn,
1262						const u8 *p_mac)
1263{
1264	return -EINVAL;
1265}
1266
1267static inline u32
1268qed_vf_hw_bar_size(struct qed_hwfn  *p_hwfn,
1269		   enum BAR_ID bar_id)
1270{
1271	return 0;
1272}
1273#endif
1274
1275#endif
v4.17
 
   1/* QLogic qed NIC Driver
   2 * Copyright (c) 2015-2017  QLogic Corporation
   3 *
   4 * 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.
  31 */
  32
  33#ifndef _QED_VF_H
  34#define _QED_VF_H
  35
  36#include "qed_l2.h"
  37#include "qed_mcp.h"
  38
  39#define T_ETH_INDIRECTION_TABLE_SIZE 128
  40#define T_ETH_RSS_KEY_SIZE 10
  41
  42struct 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	u8 num_cids;
  50	u8 padding;
  51};
  52
  53struct hw_sb_info {
  54	u16 hw_sb_id;
  55	u8 sb_qid;
  56	u8 padding[5];
  57};
  58
  59#define TLV_BUFFER_SIZE                 1024
  60
  61enum {
  62	PFVF_STATUS_WAITING,
  63	PFVF_STATUS_SUCCESS,
  64	PFVF_STATUS_FAILURE,
  65	PFVF_STATUS_NOT_SUPPORTED,
  66	PFVF_STATUS_NO_RESOURCE,
  67	PFVF_STATUS_FORCED,
  68	PFVF_STATUS_MALICIOUS,
  69};
  70
  71/* vf pf channel tlvs */
  72/* general tlv header (used for both vf->pf request and pf->vf response) */
  73struct channel_tlv {
  74	u16 type;
  75	u16 length;
  76};
  77
  78/* header of first vf->pf tlv carries the offset used to calculate reponse
  79 * buffer address
  80 */
  81struct vfpf_first_tlv {
  82	struct channel_tlv tl;
  83	u32 padding;
  84	u64 reply_address;
  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
  94/* response tlv used for most tlvs */
  95struct pfvf_def_resp_tlv {
  96	struct pfvf_tlv hdr;
  97};
  98
  99/* 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#define VFPF_ACQUIRE_OS_LINUX (0)
 106#define VFPF_ACQUIRE_OS_WINDOWS (1)
 107#define VFPF_ACQUIRE_OS_ESX (2)
 108#define VFPF_ACQUIRE_OS_SOLARIS (3)
 109#define VFPF_ACQUIRE_OS_LINUX_USERSPACE (4)
 110
 111struct vfpf_acquire_tlv {
 112	struct vfpf_first_tlv first_tlv;
 113
 114	struct vf_pf_vfdev_info {
 115#define VFPF_ACQUIRE_CAP_PRE_FP_HSI     (1 << 0) /* VF pre-FP hsi version */
 116#define VFPF_ACQUIRE_CAP_100G		(1 << 1) /* VF can support 100g */
 117	/* A requirement for supporting multi-Tx queues on a single queue-zone,
 118	 * VF would pass qids as additional information whenever passing queue
 119	 * references.
 120	 */
 121#define VFPF_ACQUIRE_CAP_QUEUE_QIDS     BIT(2)
 122
 123	/* The VF is using the physical bar. While this is mostly internal
 124	 * to the VF, might affect the number of CIDs supported assuming
 125	 * QUEUE_QIDS is set.
 126	 */
 127#define VFPF_ACQUIRE_CAP_PHYSICAL_BAR   BIT(3)
 128		u64 capabilities;
 129		u8 fw_major;
 130		u8 fw_minor;
 131		u8 fw_revision;
 132		u8 fw_engineering;
 133		u32 driver_version;
 134		u16 opaque_fid;	/* ME register value */
 135		u8 os_type;	/* VFPF_ACQUIRE_OS_* value */
 136		u8 eth_fp_hsi_major;
 137		u8 eth_fp_hsi_minor;
 138		u8 padding[3];
 139	} vfdev_info;
 140
 141	struct vf_pf_resc_request resc_request;
 142
 143	u64 bulletin_addr;
 144	u32 bulletin_size;
 145	u32 padding;
 146};
 147
 148/* receive side scaling tlv */
 149struct vfpf_vport_update_rss_tlv {
 150	struct channel_tlv tl;
 151
 152	u8 update_rss_flags;
 153#define VFPF_UPDATE_RSS_CONFIG_FLAG       BIT(0)
 154#define VFPF_UPDATE_RSS_CAPS_FLAG         BIT(1)
 155#define VFPF_UPDATE_RSS_IND_TABLE_FLAG    BIT(2)
 156#define VFPF_UPDATE_RSS_KEY_FLAG          BIT(3)
 157
 158	u8 rss_enable;
 159	u8 rss_caps;
 160	u8 rss_table_size_log;	/* The table size is 2 ^ rss_table_size_log */
 161	u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
 162	u32 rss_key[T_ETH_RSS_KEY_SIZE];
 163};
 164
 165struct pfvf_storm_stats {
 166	u32 address;
 167	u32 len;
 168};
 169
 170struct pfvf_stats_info {
 171	struct pfvf_storm_stats mstats;
 172	struct pfvf_storm_stats pstats;
 173	struct pfvf_storm_stats tstats;
 174	struct pfvf_storm_stats ustats;
 175};
 176
 177struct pfvf_acquire_resp_tlv {
 178	struct pfvf_tlv hdr;
 179
 180	struct pf_vf_pfdev_info {
 181		u32 chip_num;
 182		u32 mfw_ver;
 183
 184		u16 fw_major;
 185		u16 fw_minor;
 186		u16 fw_rev;
 187		u16 fw_eng;
 188
 189		u64 capabilities;
 190#define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED	BIT(0)
 191#define PFVF_ACQUIRE_CAP_100G			BIT(1)	/* If set, 100g PF */
 192/* There are old PF versions where the PF might mistakenly override the sanity
 193 * mechanism [version-based] and allow a VF that can't be supported to pass
 194 * the acquisition phase.
 195 * To overcome this, PFs now indicate that they're past that point and the new
 196 * VFs would fail probe on the older PFs that fail to do so.
 197 */
 198#define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE	BIT(2)
 199
 200	/* PF expects queues to be received with additional qids */
 201#define PFVF_ACQUIRE_CAP_QUEUE_QIDS             BIT(3)
 202
 203		u16 db_size;
 204		u8 indices_per_sb;
 205		u8 os_type;
 206
 207		/* These should match the PF's qed_dev values */
 208		u16 chip_rev;
 209		u8 dev_type;
 210
 211		/* Doorbell bar size configured in HW: log(size) or 0 */
 212		u8 bar_size;
 213
 214		struct pfvf_stats_info stats_info;
 215
 216		u8 port_mac[ETH_ALEN];
 217
 218		/* It's possible PF had to configure an older fastpath HSI
 219		 * [in case VF is newer than PF]. This is communicated back
 220		 * to the VF. It can also be used in case of error due to
 221		 * non-matching versions to shed light in VF about failure.
 222		 */
 223		u8 major_fp_hsi;
 224		u8 minor_fp_hsi;
 225	} pfdev_info;
 226
 227	struct pf_vf_resc {
 228#define PFVF_MAX_QUEUES_PER_VF		16
 229#define PFVF_MAX_SBS_PER_VF		16
 230		struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
 231		u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
 232		u8 cid[PFVF_MAX_QUEUES_PER_VF];
 233
 234		u8 num_rxqs;
 235		u8 num_txqs;
 236		u8 num_sbs;
 237		u8 num_mac_filters;
 238		u8 num_vlan_filters;
 239		u8 num_mc_filters;
 240		u8 num_cids;
 241		u8 padding;
 242	} resc;
 243
 244	u32 bulletin_size;
 245	u32 padding;
 246};
 247
 248struct pfvf_start_queue_resp_tlv {
 249	struct pfvf_tlv hdr;
 250	u32 offset;		/* offset to consumer/producer of queue */
 251	u8 padding[4];
 252};
 253
 254/* Extended queue information - additional index for reference inside qzone.
 255 * If commmunicated between VF/PF, each TLV relating to queues should be
 256 * extended by one such [or have a future base TLV that already contains info].
 257 */
 258struct vfpf_qid_tlv {
 259	struct channel_tlv tl;
 260	u8 qid;
 261	u8 padding[3];
 262};
 263
 264/* Setup Queue */
 265struct vfpf_start_rxq_tlv {
 266	struct vfpf_first_tlv first_tlv;
 267
 268	/* physical addresses */
 269	u64 rxq_addr;
 270	u64 deprecated_sge_addr;
 271	u64 cqe_pbl_addr;
 272
 273	u16 cqe_pbl_size;
 274	u16 hw_sb;
 275	u16 rx_qid;
 276	u16 hc_rate;		/* desired interrupts per sec. */
 277
 278	u16 bd_max_bytes;
 279	u16 stat_id;
 280	u8 sb_index;
 281	u8 padding[3];
 282};
 283
 284struct vfpf_start_txq_tlv {
 285	struct vfpf_first_tlv first_tlv;
 286
 287	/* physical addresses */
 288	u64 pbl_addr;
 289	u16 pbl_size;
 290	u16 stat_id;
 291	u16 tx_qid;
 292	u16 hw_sb;
 293
 294	u32 flags;		/* VFPF_QUEUE_FLG_X flags */
 295	u16 hc_rate;		/* desired interrupts per sec. */
 296	u8 sb_index;
 297	u8 padding[3];
 298};
 299
 300/* Stop RX Queue */
 301struct vfpf_stop_rxqs_tlv {
 302	struct vfpf_first_tlv first_tlv;
 303
 304	u16 rx_qid;
 305
 306	/* this field is deprecated and should *always* be set to '1' */
 307	u8 num_rxqs;
 308	u8 cqe_completion;
 309	u8 padding[4];
 310};
 311
 312/* Stop TX Queues */
 313struct vfpf_stop_txqs_tlv {
 314	struct vfpf_first_tlv first_tlv;
 315
 316	u16 tx_qid;
 317
 318	/* this field is deprecated and should *always* be set to '1' */
 319	u8 num_txqs;
 320	u8 padding[5];
 321};
 322
 323struct vfpf_update_rxq_tlv {
 324	struct vfpf_first_tlv first_tlv;
 325
 326	u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
 327
 328	u16 rx_qid;
 329	u8 num_rxqs;
 330	u8 flags;
 331#define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG    BIT(0)
 332#define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG          BIT(1)
 333#define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG        BIT(2)
 334
 335	u8 padding[4];
 336};
 337
 338/* Set Queue Filters */
 339struct vfpf_q_mac_vlan_filter {
 340	u32 flags;
 341#define VFPF_Q_FILTER_DEST_MAC_VALID    0x01
 342#define VFPF_Q_FILTER_VLAN_TAG_VALID    0x02
 343#define VFPF_Q_FILTER_SET_MAC           0x100	/* set/clear */
 344
 345	u8 mac[ETH_ALEN];
 346	u16 vlan_tag;
 347
 348	u8 padding[4];
 349};
 350
 351/* Start a vport */
 352struct vfpf_vport_start_tlv {
 353	struct vfpf_first_tlv first_tlv;
 354
 355	u64 sb_addr[PFVF_MAX_SBS_PER_VF];
 356
 357	u32 tpa_mode;
 358	u16 dep1;
 359	u16 mtu;
 360
 361	u8 vport_id;
 362	u8 inner_vlan_removal;
 363
 364	u8 only_untagged;
 365	u8 max_buffers_per_cqe;
 366
 367	u8 padding[4];
 368};
 369
 370/* Extended tlvs - need to add rss, mcast, accept mode tlvs */
 371struct vfpf_vport_update_activate_tlv {
 372	struct channel_tlv tl;
 373	u8 update_rx;
 374	u8 update_tx;
 375	u8 active_rx;
 376	u8 active_tx;
 377};
 378
 379struct vfpf_vport_update_tx_switch_tlv {
 380	struct channel_tlv tl;
 381	u8 tx_switching;
 382	u8 padding[3];
 383};
 384
 385struct vfpf_vport_update_vlan_strip_tlv {
 386	struct channel_tlv tl;
 387	u8 remove_vlan;
 388	u8 padding[3];
 389};
 390
 391struct vfpf_vport_update_mcast_bin_tlv {
 392	struct channel_tlv tl;
 393	u8 padding[4];
 394
 395	u64 bins[8];
 
 
 
 
 
 396};
 397
 398struct vfpf_vport_update_accept_param_tlv {
 399	struct channel_tlv tl;
 400	u8 update_rx_mode;
 401	u8 update_tx_mode;
 402	u8 rx_accept_filter;
 403	u8 tx_accept_filter;
 404};
 405
 406struct vfpf_vport_update_accept_any_vlan_tlv {
 407	struct channel_tlv tl;
 408	u8 update_accept_any_vlan_flg;
 409	u8 accept_any_vlan;
 410
 411	u8 padding[2];
 412};
 413
 414struct vfpf_vport_update_sge_tpa_tlv {
 415	struct channel_tlv tl;
 416
 417	u16 sge_tpa_flags;
 418#define VFPF_TPA_IPV4_EN_FLAG		BIT(0)
 419#define VFPF_TPA_IPV6_EN_FLAG		BIT(1)
 420#define VFPF_TPA_PKT_SPLIT_FLAG		BIT(2)
 421#define VFPF_TPA_HDR_DATA_SPLIT_FLAG	BIT(3)
 422#define VFPF_TPA_GRO_CONSIST_FLAG	BIT(4)
 423
 424	u8 update_sge_tpa_flags;
 425#define VFPF_UPDATE_SGE_DEPRECATED_FLAG	BIT(0)
 426#define VFPF_UPDATE_TPA_EN_FLAG		BIT(1)
 427#define VFPF_UPDATE_TPA_PARAM_FLAG	BIT(2)
 428
 429	u8 max_buffers_per_cqe;
 430
 431	u16 deprecated_sge_buff_size;
 432	u16 tpa_max_size;
 433	u16 tpa_min_size_to_start;
 434	u16 tpa_min_size_to_cont;
 435
 436	u8 tpa_max_aggs_num;
 437	u8 padding[7];
 438};
 439
 440/* Primary tlv as a header for various extended tlvs for
 441 * various functionalities in vport update ramrod.
 442 */
 443struct vfpf_vport_update_tlv {
 444	struct vfpf_first_tlv first_tlv;
 445};
 446
 447struct vfpf_ucast_filter_tlv {
 448	struct vfpf_first_tlv first_tlv;
 449
 450	u8 opcode;
 451	u8 type;
 452
 453	u8 mac[ETH_ALEN];
 454
 455	u16 vlan;
 456	u16 padding[3];
 457};
 458
 459/* tunnel update param tlv */
 460struct vfpf_update_tunn_param_tlv {
 461	struct vfpf_first_tlv first_tlv;
 462
 463	u8 tun_mode_update_mask;
 464	u8 tunn_mode;
 465	u8 update_tun_cls;
 466	u8 vxlan_clss;
 467	u8 l2gre_clss;
 468	u8 ipgre_clss;
 469	u8 l2geneve_clss;
 470	u8 ipgeneve_clss;
 471	u8 update_geneve_port;
 472	u8 update_vxlan_port;
 473	u16 geneve_port;
 474	u16 vxlan_port;
 475	u8 padding[2];
 476};
 477
 478struct pfvf_update_tunn_param_tlv {
 479	struct pfvf_tlv hdr;
 480
 481	u16 tunn_feature_mask;
 482	u8 vxlan_mode;
 483	u8 l2geneve_mode;
 484	u8 ipgeneve_mode;
 485	u8 l2gre_mode;
 486	u8 ipgre_mode;
 487	u8 vxlan_clss;
 488	u8 l2gre_clss;
 489	u8 ipgre_clss;
 490	u8 l2geneve_clss;
 491	u8 ipgeneve_clss;
 492	u16 vxlan_udp_port;
 493	u16 geneve_udp_port;
 494};
 495
 496struct tlv_buffer_size {
 497	u8 tlv_buffer[TLV_BUFFER_SIZE];
 498};
 499
 500struct vfpf_update_coalesce {
 501	struct vfpf_first_tlv first_tlv;
 502	u16 rx_coal;
 503	u16 tx_coal;
 504	u16 qid;
 505	u8 padding[2];
 506};
 507
 508struct vfpf_read_coal_req_tlv {
 509	struct vfpf_first_tlv first_tlv;
 510	u16 qid;
 511	u8 is_rx;
 512	u8 padding[5];
 513};
 514
 515struct pfvf_read_coal_resp_tlv {
 516	struct pfvf_tlv hdr;
 517	u16 coal;
 518	u8 padding[6];
 519};
 520
 
 
 
 
 
 
 521union vfpf_tlvs {
 522	struct vfpf_first_tlv first_tlv;
 523	struct vfpf_acquire_tlv acquire;
 524	struct vfpf_start_rxq_tlv start_rxq;
 525	struct vfpf_start_txq_tlv start_txq;
 526	struct vfpf_stop_rxqs_tlv stop_rxqs;
 527	struct vfpf_stop_txqs_tlv stop_txqs;
 528	struct vfpf_update_rxq_tlv update_rxq;
 529	struct vfpf_vport_start_tlv start_vport;
 530	struct vfpf_vport_update_tlv vport_update;
 531	struct vfpf_ucast_filter_tlv ucast_filter;
 532	struct vfpf_update_tunn_param_tlv tunn_param_update;
 533	struct vfpf_update_coalesce update_coalesce;
 534	struct vfpf_read_coal_req_tlv read_coal_req;
 
 535	struct tlv_buffer_size tlv_buf_size;
 536};
 537
 538union pfvf_tlvs {
 539	struct pfvf_def_resp_tlv default_resp;
 540	struct pfvf_acquire_resp_tlv acquire_resp;
 541	struct tlv_buffer_size tlv_buf_size;
 542	struct pfvf_start_queue_resp_tlv queue_start;
 543	struct pfvf_update_tunn_param_tlv tunn_param_resp;
 544	struct pfvf_read_coal_resp_tlv read_coal_resp;
 545};
 546
 547enum qed_bulletin_bit {
 548	/* Alert the VF that a forced MAC was set by the PF */
 549	MAC_ADDR_FORCED = 0,
 550	/* Alert the VF that a forced VLAN was set by the PF */
 551	VLAN_ADDR_FORCED = 2,
 552
 553	/* Indicate that `default_only_untagged' contains actual data */
 554	VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
 555	VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
 556
 557	/* Alert the VF that suggested mac was sent by the PF.
 558	 * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set.
 559	 */
 560	VFPF_BULLETIN_MAC_ADDR = 5
 561};
 562
 563struct qed_bulletin_content {
 564	/* crc of structure to ensure is not in mid-update */
 565	u32 crc;
 566
 567	u32 version;
 568
 569	/* bitmap indicating which fields hold valid values */
 570	u64 valid_bitmap;
 571
 572	/* used for MAC_ADDR or MAC_ADDR_FORCED */
 573	u8 mac[ETH_ALEN];
 574
 575	/* If valid, 1 => only untagged Rx if no vlan is configured */
 576	u8 default_only_untagged;
 577	u8 padding;
 578
 579	/* The following is a 'copy' of qed_mcp_link_state,
 580	 * qed_mcp_link_params and qed_mcp_link_capabilities. Since it's
 581	 * possible the structs will increase further along the road we cannot
 582	 * have it here; Instead we need to have all of its fields.
 583	 */
 584	u8 req_autoneg;
 585	u8 req_autoneg_pause;
 586	u8 req_forced_rx;
 587	u8 req_forced_tx;
 588	u8 padding2[4];
 589
 590	u32 req_adv_speed;
 591	u32 req_forced_speed;
 592	u32 req_loopback;
 593	u32 padding3;
 594
 595	u8 link_up;
 596	u8 full_duplex;
 597	u8 autoneg;
 598	u8 autoneg_complete;
 599	u8 parallel_detection;
 600	u8 pfc_enabled;
 601	u8 partner_tx_flow_ctrl_en;
 602	u8 partner_rx_flow_ctrl_en;
 603	u8 partner_adv_pause;
 604	u8 sfp_tx_fault;
 605	u16 vxlan_udp_port;
 606	u16 geneve_udp_port;
 607	u8 padding4[2];
 608
 609	u32 speed;
 610	u32 partner_adv_speed;
 611
 612	u32 capability_speed;
 613
 614	/* Forced vlan */
 615	u16 pvid;
 616	u16 padding5;
 617};
 618
 619struct qed_bulletin {
 620	dma_addr_t phys;
 621	struct qed_bulletin_content *p_virt;
 622	u32 size;
 623};
 624
 625enum {
 626	CHANNEL_TLV_NONE,	/* ends tlv sequence */
 627	CHANNEL_TLV_ACQUIRE,
 628	CHANNEL_TLV_VPORT_START,
 629	CHANNEL_TLV_VPORT_UPDATE,
 630	CHANNEL_TLV_VPORT_TEARDOWN,
 631	CHANNEL_TLV_START_RXQ,
 632	CHANNEL_TLV_START_TXQ,
 633	CHANNEL_TLV_STOP_RXQS,
 634	CHANNEL_TLV_STOP_TXQS,
 635	CHANNEL_TLV_UPDATE_RXQ,
 636	CHANNEL_TLV_INT_CLEANUP,
 637	CHANNEL_TLV_CLOSE,
 638	CHANNEL_TLV_RELEASE,
 639	CHANNEL_TLV_LIST_END,
 640	CHANNEL_TLV_UCAST_FILTER,
 641	CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
 642	CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
 643	CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
 644	CHANNEL_TLV_VPORT_UPDATE_MCAST,
 645	CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
 646	CHANNEL_TLV_VPORT_UPDATE_RSS,
 647	CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
 648	CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
 649	CHANNEL_TLV_UPDATE_TUNN_PARAM,
 650	CHANNEL_TLV_COALESCE_UPDATE,
 651	CHANNEL_TLV_QID,
 652	CHANNEL_TLV_COALESCE_READ,
 
 653	CHANNEL_TLV_MAX,
 654
 655	/* Required for iterating over vport-update tlvs.
 656	 * Will break in case non-sequential vport-update tlvs.
 657	 */
 658	CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
 659};
 660
 661/* Default number of CIDs [total of both Rx and Tx] to be requested
 662 * by default, and maximum possible number.
 663 */
 664#define QED_ETH_VF_DEFAULT_NUM_CIDS (32)
 665#define QED_ETH_VF_MAX_NUM_CIDS (250)
 666
 667/* This data is held in the qed_hwfn structure for VFs only. */
 668struct qed_vf_iov {
 669	union vfpf_tlvs *vf2pf_request;
 670	dma_addr_t vf2pf_request_phys;
 671	union pfvf_tlvs *pf2vf_reply;
 672	dma_addr_t pf2vf_reply_phys;
 673
 674	/* Should be taken whenever the mailbox buffers are accessed */
 675	struct mutex mutex;
 676	u8 *offset;
 677
 678	/* Bulletin Board */
 679	struct qed_bulletin bulletin;
 680	struct qed_bulletin_content bulletin_shadow;
 681
 682	/* we set aside a copy of the acquire response */
 683	struct pfvf_acquire_resp_tlv acquire_resp;
 684
 685	/* In case PF originates prior to the fp-hsi version comparison,
 686	 * this has to be propagated as it affects the fastpath.
 687	 */
 688	bool b_pre_fp_hsi;
 689
 690	/* Current day VFs are passing the SBs physical address on vport
 691	 * start, and as they lack an IGU mapping they need to store the
 692	 * addresses of previously registered SBs.
 693	 * Even if we were to change configuration flow, due to backward
 694	 * compatibility [with older PFs] we'd still need to store these.
 695	 */
 696	struct qed_sb_info *sbs_info[PFVF_MAX_SBS_PER_VF];
 697
 698	/* Determines whether VF utilizes doorbells via limited register
 699	 * bar or via the doorbell bar.
 700	 */
 701	bool b_doorbell_bar;
 702};
 703
 704/**
 705 * @brief VF - Set Rx/Tx coalesce per VF's relative queue.
 706 *             Coalesce value '0' will omit the configuration.
 
 
 
 
 
 
 707 *
 708 * @param p_hwfn
 709 * @param rx_coal - coalesce value in micro second for rx queue
 710 * @param tx_coal - coalesce value in micro second for tx queue
 711 * @param p_cid   - queue cid
 712 *
 713 **/
 714int qed_vf_pf_set_coalesce(struct qed_hwfn *p_hwfn,
 715			   u16 rx_coal,
 716			   u16 tx_coal, struct qed_queue_cid *p_cid);
 717
 718/**
 719 * @brief VF - Get coalesce per VF's relative queue.
 720 *
 721 * @param p_hwfn
 722 * @param p_coal - coalesce value in micro second for VF queues.
 723 * @param p_cid  - queue cid
 724 *
 
 725 **/
 726int qed_vf_pf_get_coalesce(struct qed_hwfn *p_hwfn,
 727			   u16 *p_coal, struct qed_queue_cid *p_cid);
 728
 729#ifdef CONFIG_QED_SRIOV
 730/**
 731 * @brief Read the VF bulletin and act on it if needed
 732 *
 733 * @param p_hwfn
 734 * @param p_change - qed fills 1 iff bulletin board has changed, 0 otherwise.
 735 *
 736 * @return enum _qed_status
 737 */
 738int qed_vf_read_bulletin(struct qed_hwfn *p_hwfn, u8 *p_change);
 739
 740/**
 741 * @brief Get link paramters for VF from qed
 
 
 
 742 *
 743 * @param p_hwfn
 744 * @param params - the link params structure to be filled for the VF
 745 */
 746void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
 747			    struct qed_mcp_link_params *params);
 748
 749/**
 750 * @brief Get link state for VF from qed
 751 *
 752 * @param p_hwfn
 753 * @param link - the link state structure to be filled for the VF
 
 
 754 */
 755void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
 756			   struct qed_mcp_link_state *link);
 757
 758/**
 759 * @brief Get link capabilities for VF from qed
 
 
 
 760 *
 761 * @param p_hwfn
 762 * @param p_link_caps - the link capabilities structure to be filled for the VF
 763 */
 764void qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
 765			  struct qed_mcp_link_capabilities *p_link_caps);
 766
 767/**
 768 * @brief Get number of Rx queues allocated for VF by qed
 769 *
 770 *  @param p_hwfn
 771 *  @param num_rxqs - allocated RX queues
 
 
 772 */
 773void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs);
 774
 775/**
 776 * @brief Get number of Rx queues allocated for VF by qed
 
 
 
 777 *
 778 *  @param p_hwfn
 779 *  @param num_txqs - allocated RX queues
 780 */
 781void qed_vf_get_num_txqs(struct qed_hwfn *p_hwfn, u8 *num_txqs);
 782
 783/**
 784 * @brief Get number of available connections [both Rx and Tx] for VF
 
 785 *
 786 * @param p_hwfn
 787 * @param num_cids - allocated number of connections
 
 
 788 */
 789void qed_vf_get_num_cids(struct qed_hwfn *p_hwfn, u8 *num_cids);
 790
 791/**
 792 * @brief Get port mac address for VF
 
 
 
 793 *
 794 * @param p_hwfn
 795 * @param port_mac - destination location for port mac
 796 */
 797void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac);
 798
 799/**
 800 * @brief Get number of VLAN filters allocated for VF by qed
 
 801 *
 802 *  @param p_hwfn
 803 *  @param num_rxqs - allocated VLAN filters
 
 
 804 */
 805void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
 806				 u8 *num_vlan_filters);
 807
 808/**
 809 * @brief Get number of MAC filters allocated for VF by qed
 
 
 
 
 810 *
 811 *  @param p_hwfn
 812 *  @param num_rxqs - allocated MAC filters
 813 */
 814void qed_vf_get_num_mac_filters(struct qed_hwfn *p_hwfn, u8 *num_mac_filters);
 815
 816/**
 817 * @brief Check if VF can set a MAC address
 818 *
 819 * @param p_hwfn
 820 * @param mac
 821 *
 822 * @return bool
 823 */
 824bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac);
 825
 826/**
 827 * @brief Set firmware version information in dev_info from VFs acquire response tlv
 
 828 *
 829 * @param p_hwfn
 830 * @param fw_major
 831 * @param fw_minor
 832 * @param fw_rev
 833 * @param fw_eng
 
 
 834 */
 835void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
 836			   u16 *fw_major, u16 *fw_minor,
 837			   u16 *fw_rev, u16 *fw_eng);
 838
 839/**
 840 * @brief hw preparation for VF
 841 *      sends ACQUIRE message
 842 *
 843 * @param p_hwfn
 844 *
 845 * @return int
 846 */
 847int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn);
 848
 849/**
 850 * @brief VF - start the RX Queue by sending a message to the PF
 851 * @param p_hwfn
 852 * @param p_cid			- Only relative fields are relevant
 853 * @param bd_max_bytes          - maximum number of bytes per bd
 854 * @param bd_chain_phys_addr    - physical address of bd chain
 855 * @param cqe_pbl_addr          - physical address of pbl
 856 * @param cqe_pbl_size          - pbl size
 857 * @param pp_prod               - pointer to the producer to be
 858 *				  used in fastpath
 859 *
 860 * @return int
 861 */
 862int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
 863			struct qed_queue_cid *p_cid,
 864			u16 bd_max_bytes,
 865			dma_addr_t bd_chain_phys_addr,
 866			dma_addr_t cqe_pbl_addr,
 867			u16 cqe_pbl_size, void __iomem **pp_prod);
 868
 869/**
 870 * @brief VF - start the TX queue by sending a message to the
 871 *        PF.
 872 *
 873 * @param p_hwfn
 874 * @param tx_queue_id           - zero based within the VF
 875 * @param sb                    - status block for this queue
 876 * @param sb_index              - index within the status block
 877 * @param bd_chain_phys_addr    - physical address of tx chain
 878 * @param pp_doorbell           - pointer to address to which to
 879 *                      write the doorbell too..
 880 *
 881 * @return int
 882 */
 883int
 884qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
 885		    struct qed_queue_cid *p_cid,
 886		    dma_addr_t pbl_addr,
 887		    u16 pbl_size, void __iomem **pp_doorbell);
 888
 889/**
 890 * @brief VF - stop the RX queue by sending a message to the PF
 891 *
 892 * @param p_hwfn
 893 * @param p_cid
 894 * @param cqe_completion
 895 *
 896 * @return int
 897 */
 898int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
 899		       struct qed_queue_cid *p_cid, bool cqe_completion);
 900
 901/**
 902 * @brief VF - stop the TX queue by sending a message to the PF
 903 *
 904 * @param p_hwfn
 905 * @param tx_qid
 906 *
 907 * @return int
 908 */
 909int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, struct qed_queue_cid *p_cid);
 910
 911/**
 912 * @brief VF - send a vport update command
 913 *
 914 * @param p_hwfn
 915 * @param params
 916 *
 917 * @return int
 918 */
 919int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
 920			   struct qed_sp_vport_update_params *p_params);
 921
 922/**
 
 923 *
 924 * @brief VF - send a close message to PF
 925 *
 926 * @param p_hwfn
 927 *
 928 * @return enum _qed_status
 929 */
 930int qed_vf_pf_reset(struct qed_hwfn *p_hwfn);
 931
 932/**
 933 * @brief VF - free vf`s memories
 934 *
 935 * @param p_hwfn
 936 *
 937 * @return enum _qed_status
 938 */
 939int qed_vf_pf_release(struct qed_hwfn *p_hwfn);
 940
 941/**
 942 * @brief qed_vf_get_igu_sb_id - Get the IGU SB ID for a given
 943 *        sb_id. For VFs igu sbs don't have to be contiguous
 944 *
 945 * @param p_hwfn
 946 * @param sb_id
 947 *
 948 * @return INLINE u16
 949 */
 950u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id);
 951
 952/**
 953 * @brief Stores [or removes] a configured sb_info.
 
 
 
 
 954 *
 955 * @param p_hwfn
 956 * @param sb_id - zero-based SB index [for fastpath]
 957 * @param sb_info - may be NULL [during removal].
 958 */
 959void qed_vf_set_sb_info(struct qed_hwfn *p_hwfn,
 960			u16 sb_id, struct qed_sb_info *p_sb);
 961
 962/**
 963 * @brief qed_vf_pf_vport_start - perform vport start for VF.
 964 *
 965 * @param p_hwfn
 966 * @param vport_id
 967 * @param mtu
 968 * @param inner_vlan_removal
 969 * @param tpa_mode
 970 * @param max_buffers_per_cqe,
 971 * @param only_untagged - default behavior regarding vlan acceptance
 972 *
 973 * @return enum _qed_status
 974 */
 975int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
 976			  u8 vport_id,
 977			  u16 mtu,
 978			  u8 inner_vlan_removal,
 979			  enum qed_tpa_mode tpa_mode,
 980			  u8 max_buffers_per_cqe, u8 only_untagged);
 981
 982/**
 983 * @brief qed_vf_pf_vport_stop - stop the VF's vport
 984 *
 985 * @param p_hwfn
 986 *
 987 * @return enum _qed_status
 988 */
 989int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn);
 990
 991int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
 992			   struct qed_filter_ucast *p_param);
 993
 994void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
 995			    struct qed_filter_mcast *p_filter_cmd);
 996
 997/**
 998 * @brief qed_vf_pf_int_cleanup - clean the SB of the VF
 999 *
1000 * @param p_hwfn
1001 *
1002 * @return enum _qed_status
1003 */
1004int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn);
1005
1006/**
1007 * @brief - return the link params in a given bulletin board
1008 *
1009 * @param p_hwfn
1010 * @param p_params - pointer to a struct to fill with link params
1011 * @param p_bulletin
 
 
1012 */
1013void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
1014			      struct qed_mcp_link_params *p_params,
1015			      struct qed_bulletin_content *p_bulletin);
1016
1017/**
1018 * @brief - return the link state in a given bulletin board
 
 
 
 
1019 *
1020 * @param p_hwfn
1021 * @param p_link - pointer to a struct to fill with link state
1022 * @param p_bulletin
1023 */
1024void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
1025			     struct qed_mcp_link_state *p_link,
1026			     struct qed_bulletin_content *p_bulletin);
1027
1028/**
1029 * @brief - return the link capabilities in a given bulletin board
 
1030 *
1031 * @param p_hwfn
1032 * @param p_link - pointer to a struct to fill with link capabilities
1033 * @param p_bulletin
 
 
1034 */
1035void __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
1036			    struct qed_mcp_link_capabilities *p_link_caps,
1037			    struct qed_bulletin_content *p_bulletin);
1038
1039void qed_iov_vf_task(struct work_struct *work);
1040void qed_vf_set_vf_start_tunn_update_param(struct qed_tunnel_info *p_tun);
1041int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
1042				  struct qed_tunnel_info *p_tunn);
1043
1044u32 qed_vf_hw_bar_size(struct qed_hwfn *p_hwfn, enum BAR_ID bar_id);
 
 
 
 
 
 
 
 
 
 
 
1045#else
1046static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
1047					  struct qed_mcp_link_params *params)
1048{
1049}
1050
1051static inline void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
1052					 struct qed_mcp_link_state *link)
1053{
1054}
1055
1056static inline void
1057qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
1058		     struct qed_mcp_link_capabilities *p_link_caps)
1059{
1060}
1061
1062static inline void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs)
1063{
1064}
1065
1066static inline void qed_vf_get_num_txqs(struct qed_hwfn *p_hwfn, u8 *num_txqs)
1067{
1068}
1069
1070static inline void qed_vf_get_num_cids(struct qed_hwfn *p_hwfn, u8 *num_cids)
1071{
1072}
1073
1074static inline void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac)
1075{
1076}
1077
1078static inline void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
1079					       u8 *num_vlan_filters)
1080{
1081}
1082
1083static inline void qed_vf_get_num_mac_filters(struct qed_hwfn *p_hwfn,
1084					      u8 *num_mac_filters)
1085{
1086}
1087
1088static inline bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac)
1089{
1090	return false;
1091}
1092
1093static inline void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
1094					 u16 *fw_major, u16 *fw_minor,
1095					 u16 *fw_rev, u16 *fw_eng)
1096{
1097}
1098
1099static inline int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
1100{
1101	return -EINVAL;
1102}
1103
1104static inline int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
1105				      struct qed_queue_cid *p_cid,
1106				      u16 bd_max_bytes,
1107				      dma_addr_t bd_chain_phys_adr,
1108				      dma_addr_t cqe_pbl_addr,
1109				      u16 cqe_pbl_size, void __iomem **pp_prod)
1110{
1111	return -EINVAL;
1112}
1113
1114static inline int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
1115				      struct qed_queue_cid *p_cid,
1116				      dma_addr_t pbl_addr,
1117				      u16 pbl_size, void __iomem **pp_doorbell)
1118{
1119	return -EINVAL;
1120}
1121
1122static inline int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
1123				     struct qed_queue_cid *p_cid,
1124				     bool cqe_completion)
1125{
1126	return -EINVAL;
1127}
1128
1129static inline int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn,
1130				     struct qed_queue_cid *p_cid)
1131{
1132	return -EINVAL;
1133}
1134
1135static inline int
1136qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
1137		       struct qed_sp_vport_update_params *p_params)
1138{
1139	return -EINVAL;
1140}
1141
1142static inline int qed_vf_pf_reset(struct qed_hwfn *p_hwfn)
1143{
1144	return -EINVAL;
1145}
1146
1147static inline int qed_vf_pf_release(struct qed_hwfn *p_hwfn)
1148{
1149	return -EINVAL;
1150}
1151
1152static inline u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id)
1153{
1154	return 0;
1155}
1156
1157static inline void qed_vf_set_sb_info(struct qed_hwfn *p_hwfn, u16 sb_id,
1158				      struct qed_sb_info *p_sb)
1159{
1160}
1161
1162static inline int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
1163					u8 vport_id,
1164					u16 mtu,
1165					u8 inner_vlan_removal,
1166					enum qed_tpa_mode tpa_mode,
1167					u8 max_buffers_per_cqe,
1168					u8 only_untagged)
1169{
1170	return -EINVAL;
1171}
1172
1173static inline int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn)
1174{
1175	return -EINVAL;
1176}
1177
1178static inline int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
1179					 struct qed_filter_ucast *p_param)
1180{
1181	return -EINVAL;
1182}
1183
1184static inline void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
1185					  struct qed_filter_mcast *p_filter_cmd)
1186{
1187}
1188
1189static inline int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn)
1190{
1191	return -EINVAL;
1192}
1193
1194static inline void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
1195					    struct qed_mcp_link_params
1196					    *p_params,
1197					    struct qed_bulletin_content
1198					    *p_bulletin)
1199{
1200}
1201
1202static inline void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
1203					   struct qed_mcp_link_state *p_link,
1204					   struct qed_bulletin_content
1205					   *p_bulletin)
1206{
1207}
1208
1209static inline void
1210__qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
1211		       struct qed_mcp_link_capabilities *p_link_caps,
1212		       struct qed_bulletin_content *p_bulletin)
1213{
1214}
1215
1216static inline void qed_iov_vf_task(struct work_struct *work)
1217{
1218}
1219
1220static inline void
1221qed_vf_set_vf_start_tunn_update_param(struct qed_tunnel_info *p_tun)
1222{
1223}
1224
1225static inline int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
1226						struct qed_tunnel_info *p_tunn)
 
 
 
 
 
 
1227{
1228	return -EINVAL;
1229}
1230
1231static inline u32
1232qed_vf_hw_bar_size(struct qed_hwfn  *p_hwfn,
1233		   enum BAR_ID bar_id)
1234{
1235	return 0;
1236}
1237#endif
1238
1239#endif