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