1 /*- 2 * Copyright (c) 2012-2015 Solarflare Communications Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * 26 * The views and conclusions contained in the software and documentation are 27 * those of the authors and should not be interpreted as representing official 28 * policies, either expressed or implied, of the FreeBSD Project. 29 * 30 * $FreeBSD$ 31 */ 32 33 #ifndef _SYS_HUNT_IMPL_H 34 #define _SYS_HUNT_IMPL_H 35 36 #include "efx.h" 37 #include "efx_regs.h" 38 #include "efx_regs_ef10.h" 39 #include "efx_mcdi.h" 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 #define HUNTINGTON_NVRAM_CHUNK 0x80 46 47 /* Alignment requirement for value written to RX WPTR: 48 * the WPTR must be aligned to an 8 descriptor boundary 49 */ 50 #define HUNTINGTON_RX_WPTR_ALIGN 8 51 52 /* Invalid RSS context handle */ 53 #define HUNTINGTON_RSS_CONTEXT_INVALID (0xffffffff) 54 55 56 /* EV */ 57 58 __checkReturn int 59 hunt_ev_init( 60 __in efx_nic_t *enp); 61 62 void 63 hunt_ev_fini( 64 __in efx_nic_t *enp); 65 66 __checkReturn int 67 hunt_ev_qcreate( 68 __in efx_nic_t *enp, 69 __in unsigned int index, 70 __in efsys_mem_t *esmp, 71 __in size_t n, 72 __in uint32_t id, 73 __in efx_evq_t *eep); 74 75 void 76 hunt_ev_qdestroy( 77 __in efx_evq_t *eep); 78 79 __checkReturn int 80 hunt_ev_qprime( 81 __in efx_evq_t *eep, 82 __in unsigned int count); 83 84 void 85 hunt_ev_qpost( 86 __in efx_evq_t *eep, 87 __in uint16_t data); 88 89 __checkReturn int 90 hunt_ev_qmoderate( 91 __in efx_evq_t *eep, 92 __in unsigned int us); 93 94 #if EFSYS_OPT_QSTATS 95 void 96 hunt_ev_qstats_update( 97 __in efx_evq_t *eep, 98 __inout_ecount(EV_NQSTATS) efsys_stat_t *stat); 99 #endif /* EFSYS_OPT_QSTATS */ 100 101 void 102 hunt_ev_rxlabel_init( 103 __in efx_evq_t *eep, 104 __in efx_rxq_t *erp, 105 __in unsigned int label); 106 107 void 108 hunt_ev_rxlabel_fini( 109 __in efx_evq_t *eep, 110 __in unsigned int label); 111 112 /* INTR */ 113 114 __checkReturn int 115 hunt_intr_init( 116 __in efx_nic_t *enp, 117 __in efx_intr_type_t type, 118 __in efsys_mem_t *esmp); 119 120 void 121 hunt_intr_enable( 122 __in efx_nic_t *enp); 123 124 void 125 hunt_intr_disable( 126 __in efx_nic_t *enp); 127 128 void 129 hunt_intr_disable_unlocked( 130 __in efx_nic_t *enp); 131 132 __checkReturn int 133 hunt_intr_trigger( 134 __in efx_nic_t *enp, 135 __in unsigned int level); 136 137 void 138 hunt_intr_fini( 139 __in efx_nic_t *enp); 140 141 /* NIC */ 142 143 extern __checkReturn int 144 hunt_nic_probe( 145 __in efx_nic_t *enp); 146 147 extern __checkReturn int 148 hunt_nic_set_drv_limits( 149 __inout efx_nic_t *enp, 150 __in efx_drv_limits_t *edlp); 151 152 extern __checkReturn int 153 hunt_nic_get_vi_pool( 154 __in efx_nic_t *enp, 155 __out uint32_t *vi_countp); 156 157 extern __checkReturn int 158 hunt_nic_get_bar_region( 159 __in efx_nic_t *enp, 160 __in efx_nic_region_t region, 161 __out uint32_t *offsetp, 162 __out size_t *sizep); 163 164 extern __checkReturn int 165 hunt_nic_reset( 166 __in efx_nic_t *enp); 167 168 extern __checkReturn int 169 hunt_nic_init( 170 __in efx_nic_t *enp); 171 172 #if EFSYS_OPT_DIAG 173 174 extern __checkReturn int 175 hunt_nic_register_test( 176 __in efx_nic_t *enp); 177 178 #endif /* EFSYS_OPT_DIAG */ 179 180 extern void 181 hunt_nic_fini( 182 __in efx_nic_t *enp); 183 184 extern void 185 hunt_nic_unprobe( 186 __in efx_nic_t *enp); 187 188 189 /* MAC */ 190 191 extern __checkReturn int 192 hunt_mac_poll( 193 __in efx_nic_t *enp, 194 __out efx_link_mode_t *link_modep); 195 196 extern __checkReturn int 197 hunt_mac_up( 198 __in efx_nic_t *enp, 199 __out boolean_t *mac_upp); 200 201 extern __checkReturn int 202 hunt_mac_addr_set( 203 __in efx_nic_t *enp); 204 205 extern __checkReturn int 206 hunt_mac_reconfigure( 207 __in efx_nic_t *enp); 208 209 extern __checkReturn int 210 hunt_mac_multicast_list_set( 211 __in efx_nic_t *enp); 212 213 extern __checkReturn int 214 hunt_mac_filter_default_rxq_set( 215 __in efx_nic_t *enp, 216 __in efx_rxq_t *erp, 217 __in boolean_t using_rss); 218 219 extern void 220 hunt_mac_filter_default_rxq_clear( 221 __in efx_nic_t *enp); 222 223 #if EFSYS_OPT_LOOPBACK 224 225 extern __checkReturn int 226 hunt_mac_loopback_set( 227 __in efx_nic_t *enp, 228 __in efx_link_mode_t link_mode, 229 __in efx_loopback_type_t loopback_type); 230 231 #endif /* EFSYS_OPT_LOOPBACK */ 232 233 #if EFSYS_OPT_MAC_STATS 234 235 extern __checkReturn int 236 hunt_mac_stats_update( 237 __in efx_nic_t *enp, 238 __in efsys_mem_t *esmp, 239 __out_ecount(EFX_MAC_NSTATS) efsys_stat_t *stat, 240 __out_opt uint32_t *generationp); 241 242 #endif /* EFSYS_OPT_MAC_STATS */ 243 244 245 /* MCDI */ 246 247 #if EFSYS_OPT_MCDI 248 249 extern __checkReturn int 250 hunt_mcdi_init( 251 __in efx_nic_t *enp, 252 __in const efx_mcdi_transport_t *mtp); 253 254 extern void 255 hunt_mcdi_fini( 256 __in efx_nic_t *enp); 257 258 extern void 259 hunt_mcdi_request_copyin( 260 __in efx_nic_t *enp, 261 __in efx_mcdi_req_t *emrp, 262 __in unsigned int seq, 263 __in boolean_t ev_cpl, 264 __in boolean_t new_epoch); 265 266 extern __checkReturn boolean_t 267 hunt_mcdi_request_poll( 268 __in efx_nic_t *enp); 269 270 extern void 271 hunt_mcdi_request_copyout( 272 __in efx_nic_t *enp, 273 __in efx_mcdi_req_t *emrp); 274 275 extern int 276 hunt_mcdi_poll_reboot( 277 __in efx_nic_t *enp); 278 279 extern __checkReturn int 280 hunt_mcdi_fw_update_supported( 281 __in efx_nic_t *enp, 282 __out boolean_t *supportedp); 283 284 extern __checkReturn int 285 hunt_mcdi_macaddr_change_supported( 286 __in efx_nic_t *enp, 287 __out boolean_t *supportedp); 288 289 #endif /* EFSYS_OPT_MCDI */ 290 291 /* NVRAM */ 292 293 #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD 294 295 extern __checkReturn int 296 hunt_nvram_buf_read_tlv( 297 __in efx_nic_t *enp, 298 __in_bcount(partn_size) caddr_t partn_data, 299 __in size_t partn_size, 300 __in uint32_t tag, 301 __deref_out_bcount_opt(*sizep) caddr_t *datap, 302 __out size_t *sizep); 303 304 extern __checkReturn int 305 hunt_nvram_buf_write_tlv( 306 __inout_bcount(partn_size) caddr_t partn_data, 307 __in size_t partn_size, 308 __in uint32_t tag, 309 __in_bcount(tag_size) caddr_t tag_data, 310 __in size_t tag_size, 311 __out size_t *total_lengthp); 312 313 extern __checkReturn int 314 hunt_nvram_partn_read_tlv( 315 __in efx_nic_t *enp, 316 __in uint32_t partn, 317 __in uint32_t tag, 318 __deref_out_bcount_opt(*sizep) caddr_t *datap, 319 __out size_t *sizep); 320 321 extern __checkReturn int 322 hunt_nvram_partn_write_tlv( 323 __in efx_nic_t *enp, 324 __in uint32_t partn, 325 __in uint32_t tag, 326 __in_bcount(size) caddr_t data, 327 __in size_t size); 328 329 extern __checkReturn int 330 hunt_nvram_partn_size( 331 __in efx_nic_t *enp, 332 __in unsigned int partn, 333 __out size_t *sizep); 334 335 extern __checkReturn int 336 hunt_nvram_partn_lock( 337 __in efx_nic_t *enp, 338 __in unsigned int partn); 339 340 extern __checkReturn int 341 hunt_nvram_partn_read( 342 __in efx_nic_t *enp, 343 __in unsigned int partn, 344 __in unsigned int offset, 345 __out_bcount(size) caddr_t data, 346 __in size_t size); 347 348 extern __checkReturn int 349 hunt_nvram_partn_erase( 350 __in efx_nic_t *enp, 351 __in unsigned int partn, 352 __in unsigned int offset, 353 __in size_t size); 354 355 extern __checkReturn int 356 hunt_nvram_partn_write( 357 __in efx_nic_t *enp, 358 __in unsigned int partn, 359 __in unsigned int offset, 360 __out_bcount(size) caddr_t data, 361 __in size_t size); 362 363 extern void 364 hunt_nvram_partn_unlock( 365 __in efx_nic_t *enp, 366 __in unsigned int partn); 367 368 #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */ 369 370 #if EFSYS_OPT_NVRAM 371 372 #if EFSYS_OPT_DIAG 373 374 extern __checkReturn int 375 hunt_nvram_test( 376 __in efx_nic_t *enp); 377 378 #endif /* EFSYS_OPT_DIAG */ 379 380 extern __checkReturn int 381 hunt_nvram_size( 382 __in efx_nic_t *enp, 383 __in efx_nvram_type_t type, 384 __out size_t *sizep); 385 386 extern __checkReturn int 387 hunt_nvram_get_version( 388 __in efx_nic_t *enp, 389 __in efx_nvram_type_t type, 390 __out uint32_t *subtypep, 391 __out_ecount(4) uint16_t version[4]); 392 393 extern __checkReturn int 394 hunt_nvram_rw_start( 395 __in efx_nic_t *enp, 396 __in efx_nvram_type_t type, 397 __out size_t *pref_chunkp); 398 399 extern __checkReturn int 400 hunt_nvram_read_chunk( 401 __in efx_nic_t *enp, 402 __in efx_nvram_type_t type, 403 __in unsigned int offset, 404 __out_bcount(size) caddr_t data, 405 __in size_t size); 406 407 extern __checkReturn int 408 hunt_nvram_erase( 409 __in efx_nic_t *enp, 410 __in efx_nvram_type_t type); 411 412 extern __checkReturn int 413 hunt_nvram_write_chunk( 414 __in efx_nic_t *enp, 415 __in efx_nvram_type_t type, 416 __in unsigned int offset, 417 __in_bcount(size) caddr_t data, 418 __in size_t size); 419 420 extern void 421 hunt_nvram_rw_finish( 422 __in efx_nic_t *enp, 423 __in efx_nvram_type_t type); 424 425 extern __checkReturn int 426 hunt_nvram_partn_set_version( 427 __in efx_nic_t *enp, 428 __in unsigned int partn, 429 __in_ecount(4) uint16_t version[4]); 430 431 extern __checkReturn int 432 hunt_nvram_set_version( 433 __in efx_nic_t *enp, 434 __in efx_nvram_type_t type, 435 __in_ecount(4) uint16_t version[4]); 436 437 #endif /* EFSYS_OPT_NVRAM */ 438 439 440 /* PHY */ 441 442 typedef struct hunt_link_state_s { 443 uint32_t hls_adv_cap_mask; 444 uint32_t hls_lp_cap_mask; 445 unsigned int hls_fcntl; 446 efx_link_mode_t hls_link_mode; 447 #if EFSYS_OPT_LOOPBACK 448 efx_loopback_type_t hls_loopback; 449 #endif 450 boolean_t hls_mac_up; 451 } hunt_link_state_t; 452 453 extern void 454 hunt_phy_link_ev( 455 __in efx_nic_t *enp, 456 __in efx_qword_t *eqp, 457 __out efx_link_mode_t *link_modep); 458 459 extern __checkReturn int 460 hunt_phy_get_link( 461 __in efx_nic_t *enp, 462 __out hunt_link_state_t *hlsp); 463 464 extern __checkReturn int 465 hunt_phy_power( 466 __in efx_nic_t *enp, 467 __in boolean_t on); 468 469 extern __checkReturn int 470 hunt_phy_reconfigure( 471 __in efx_nic_t *enp); 472 473 extern __checkReturn int 474 hunt_phy_verify( 475 __in efx_nic_t *enp); 476 477 extern __checkReturn int 478 hunt_phy_oui_get( 479 __in efx_nic_t *enp, 480 __out uint32_t *ouip); 481 482 #if EFSYS_OPT_PHY_STATS 483 484 extern __checkReturn int 485 hunt_phy_stats_update( 486 __in efx_nic_t *enp, 487 __in efsys_mem_t *esmp, 488 __out_ecount(EFX_PHY_NSTATS) uint32_t *stat); 489 490 #endif /* EFSYS_OPT_PHY_STATS */ 491 492 #if EFSYS_OPT_PHY_PROPS 493 494 #if EFSYS_OPT_NAMES 495 496 extern const char * 497 hunt_phy_prop_name( 498 __in efx_nic_t *enp, 499 __in unsigned int id); 500 501 #endif /* EFSYS_OPT_NAMES */ 502 503 extern __checkReturn int 504 hunt_phy_prop_get( 505 __in efx_nic_t *enp, 506 __in unsigned int id, 507 __in uint32_t flags, 508 __out uint32_t *valp); 509 510 extern __checkReturn int 511 hunt_phy_prop_set( 512 __in efx_nic_t *enp, 513 __in unsigned int id, 514 __in uint32_t val); 515 516 #endif /* EFSYS_OPT_PHY_PROPS */ 517 518 #if EFSYS_OPT_BIST 519 520 extern __checkReturn int 521 hunt_bist_enable_offline( 522 __in efx_nic_t *enp); 523 524 extern __checkReturn int 525 hunt_bist_start( 526 __in efx_nic_t *enp, 527 __in efx_bist_type_t type); 528 529 extern __checkReturn int 530 hunt_bist_poll( 531 __in efx_nic_t *enp, 532 __in efx_bist_type_t type, 533 __out efx_bist_result_t *resultp, 534 __out_opt __drv_when(count > 0, __notnull) 535 uint32_t *value_maskp, 536 __out_ecount_opt(count) __drv_when(count > 0, __notnull) 537 unsigned long *valuesp, 538 __in size_t count); 539 540 extern void 541 hunt_bist_stop( 542 __in efx_nic_t *enp, 543 __in efx_bist_type_t type); 544 545 #endif /* EFSYS_OPT_BIST */ 546 547 548 /* SRAM */ 549 550 #if EFSYS_OPT_DIAG 551 552 extern __checkReturn int 553 hunt_sram_test( 554 __in efx_nic_t *enp, 555 __in efx_sram_pattern_fn_t func); 556 557 #endif /* EFSYS_OPT_DIAG */ 558 559 560 /* TX */ 561 562 extern __checkReturn int 563 hunt_tx_init( 564 __in efx_nic_t *enp); 565 566 extern void 567 hunt_tx_fini( 568 __in efx_nic_t *enp); 569 570 extern __checkReturn int 571 hunt_tx_qcreate( 572 __in efx_nic_t *enp, 573 __in unsigned int index, 574 __in unsigned int label, 575 __in efsys_mem_t *esmp, 576 __in size_t n, 577 __in uint32_t id, 578 __in uint16_t flags, 579 __in efx_evq_t *eep, 580 __in efx_txq_t *etp, 581 __out unsigned int *addedp); 582 583 extern void 584 hunt_tx_qdestroy( 585 __in efx_txq_t *etp); 586 587 extern __checkReturn int 588 hunt_tx_qpost( 589 __in efx_txq_t *etp, 590 __in_ecount(n) efx_buffer_t *eb, 591 __in unsigned int n, 592 __in unsigned int completed, 593 __inout unsigned int *addedp); 594 595 extern void 596 hunt_tx_qpush( 597 __in efx_txq_t *etp, 598 __in unsigned int added, 599 __in unsigned int pushed); 600 601 extern __checkReturn int 602 hunt_tx_qpace( 603 __in efx_txq_t *etp, 604 __in unsigned int ns); 605 606 extern __checkReturn int 607 hunt_tx_qflush( 608 __in efx_txq_t *etp); 609 610 extern void 611 hunt_tx_qenable( 612 __in efx_txq_t *etp); 613 614 extern __checkReturn int 615 hunt_tx_qpio_enable( 616 __in efx_txq_t *etp); 617 618 extern void 619 hunt_tx_qpio_disable( 620 __in efx_txq_t *etp); 621 622 extern __checkReturn int 623 hunt_tx_qpio_write( 624 __in efx_txq_t *etp, 625 __in_ecount(buf_length) uint8_t *buffer, 626 __in size_t buf_length, 627 __in size_t pio_buf_offset); 628 629 extern __checkReturn int 630 hunt_tx_qpio_post( 631 __in efx_txq_t *etp, 632 __in size_t pkt_length, 633 __in unsigned int completed, 634 __inout unsigned int *addedp); 635 636 extern __checkReturn int 637 hunt_tx_qdesc_post( 638 __in efx_txq_t *etp, 639 __in_ecount(n) efx_desc_t *ed, 640 __in unsigned int n, 641 __in unsigned int completed, 642 __inout unsigned int *addedp); 643 644 extern void 645 hunt_tx_qdesc_dma_create( 646 __in efx_txq_t *etp, 647 __in efsys_dma_addr_t addr, 648 __in size_t size, 649 __in boolean_t eop, 650 __out efx_desc_t *edp); 651 652 extern void 653 hunt_tx_qdesc_tso_create( 654 __in efx_txq_t *etp, 655 __in uint16_t ipv4_id, 656 __in uint32_t tcp_seq, 657 __in uint8_t tcp_flags, 658 __out efx_desc_t *edp); 659 660 extern void 661 hunt_tx_qdesc_vlantci_create( 662 __in efx_txq_t *etp, 663 __in uint16_t vlan_tci, 664 __out efx_desc_t *edp); 665 666 667 #if EFSYS_OPT_QSTATS 668 669 extern void 670 hunt_tx_qstats_update( 671 __in efx_txq_t *etp, 672 __inout_ecount(TX_NQSTATS) efsys_stat_t *stat); 673 674 #endif /* EFSYS_OPT_QSTATS */ 675 676 /* PIO */ 677 678 /* Missing register definitions */ 679 #ifndef ER_DZ_TX_PIOBUF_OFST 680 #define ER_DZ_TX_PIOBUF_OFST 0x00001000 681 #endif 682 #ifndef ER_DZ_TX_PIOBUF_STEP 683 #define ER_DZ_TX_PIOBUF_STEP 8192 684 #endif 685 #ifndef ER_DZ_TX_PIOBUF_ROWS 686 #define ER_DZ_TX_PIOBUF_ROWS 2048 687 #endif 688 689 #ifndef ER_DZ_TX_PIOBUF_SIZE 690 #define ER_DZ_TX_PIOBUF_SIZE 2048 691 #endif 692 693 #define HUNT_PIOBUF_NBUFS (16) 694 #define HUNT_PIOBUF_SIZE (ER_DZ_TX_PIOBUF_SIZE) 695 696 #define HUNT_MIN_PIO_ALLOC_SIZE (HUNT_PIOBUF_SIZE / 32) 697 698 #define HUNT_LEGACY_PF_PRIVILEGE_MASK \ 699 (MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN | \ 700 MC_CMD_PRIVILEGE_MASK_IN_GRP_LINK | \ 701 MC_CMD_PRIVILEGE_MASK_IN_GRP_ONLOAD | \ 702 MC_CMD_PRIVILEGE_MASK_IN_GRP_PTP | \ 703 MC_CMD_PRIVILEGE_MASK_IN_GRP_INSECURE_FILTERS | \ 704 MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING | \ 705 MC_CMD_PRIVILEGE_MASK_IN_GRP_UNICAST | \ 706 MC_CMD_PRIVILEGE_MASK_IN_GRP_MULTICAST | \ 707 MC_CMD_PRIVILEGE_MASK_IN_GRP_BROADCAST | \ 708 MC_CMD_PRIVILEGE_MASK_IN_GRP_ALL_MULTICAST | \ 709 MC_CMD_PRIVILEGE_MASK_IN_GRP_PROMISCUOUS) 710 711 #define HUNT_LEGACY_VF_PRIVILEGE_MASK 0 712 713 typedef uint32_t efx_piobuf_handle_t; 714 715 #define EFX_PIOBUF_HANDLE_INVALID ((efx_piobuf_handle_t) -1) 716 717 extern __checkReturn int 718 hunt_nic_pio_alloc( 719 __inout efx_nic_t *enp, 720 __out uint32_t *bufnump, 721 __out efx_piobuf_handle_t *handlep, 722 __out uint32_t *blknump, 723 __out uint32_t *offsetp, 724 __out size_t *sizep); 725 726 extern __checkReturn int 727 hunt_nic_pio_free( 728 __inout efx_nic_t *enp, 729 __in uint32_t bufnum, 730 __in uint32_t blknum); 731 732 extern __checkReturn int 733 hunt_nic_pio_link( 734 __inout efx_nic_t *enp, 735 __in uint32_t vi_index, 736 __in efx_piobuf_handle_t handle); 737 738 extern __checkReturn int 739 hunt_nic_pio_unlink( 740 __inout efx_nic_t *enp, 741 __in uint32_t vi_index); 742 743 744 /* VPD */ 745 746 #if EFSYS_OPT_VPD 747 748 extern __checkReturn int 749 hunt_vpd_init( 750 __in efx_nic_t *enp); 751 752 extern __checkReturn int 753 hunt_vpd_size( 754 __in efx_nic_t *enp, 755 __out size_t *sizep); 756 757 extern __checkReturn int 758 hunt_vpd_read( 759 __in efx_nic_t *enp, 760 __out_bcount(size) caddr_t data, 761 __in size_t size); 762 763 extern __checkReturn int 764 hunt_vpd_verify( 765 __in efx_nic_t *enp, 766 __in_bcount(size) caddr_t data, 767 __in size_t size); 768 769 extern __checkReturn int 770 hunt_vpd_reinit( 771 __in efx_nic_t *enp, 772 __in_bcount(size) caddr_t data, 773 __in size_t size); 774 775 extern __checkReturn int 776 hunt_vpd_get( 777 __in efx_nic_t *enp, 778 __in_bcount(size) caddr_t data, 779 __in size_t size, 780 __inout efx_vpd_value_t *evvp); 781 782 extern __checkReturn int 783 hunt_vpd_set( 784 __in efx_nic_t *enp, 785 __in_bcount(size) caddr_t data, 786 __in size_t size, 787 __in efx_vpd_value_t *evvp); 788 789 extern __checkReturn int 790 hunt_vpd_next( 791 __in efx_nic_t *enp, 792 __in_bcount(size) caddr_t data, 793 __in size_t size, 794 __out efx_vpd_value_t *evvp, 795 __inout unsigned int *contp); 796 797 extern __checkReturn int 798 hunt_vpd_write( 799 __in efx_nic_t *enp, 800 __in_bcount(size) caddr_t data, 801 __in size_t size); 802 803 extern void 804 hunt_vpd_fini( 805 __in efx_nic_t *enp); 806 807 #endif /* EFSYS_OPT_VPD */ 808 809 810 /* RX */ 811 812 extern __checkReturn int 813 hunt_rx_init( 814 __in efx_nic_t *enp); 815 816 #if EFSYS_OPT_RX_HDR_SPLIT 817 extern __checkReturn int 818 hunt_rx_hdr_split_enable( 819 __in efx_nic_t *enp, 820 __in unsigned int hdr_buf_size, 821 __in unsigned int pld_buf_size); 822 #endif /* EFSYS_OPT_RX_HDR_SPLIT */ 823 824 #if EFSYS_OPT_RX_SCATTER 825 extern __checkReturn int 826 hunt_rx_scatter_enable( 827 __in efx_nic_t *enp, 828 __in unsigned int buf_size); 829 #endif /* EFSYS_OPT_RX_SCATTER */ 830 831 832 #if EFSYS_OPT_RX_SCALE 833 834 extern __checkReturn int 835 hunt_rx_scale_mode_set( 836 __in efx_nic_t *enp, 837 __in efx_rx_hash_alg_t alg, 838 __in efx_rx_hash_type_t type, 839 __in boolean_t insert); 840 841 extern __checkReturn int 842 hunt_rx_scale_key_set( 843 __in efx_nic_t *enp, 844 __in_ecount(n) uint8_t *key, 845 __in size_t n); 846 847 extern __checkReturn int 848 hunt_rx_scale_tbl_set( 849 __in efx_nic_t *enp, 850 __in_ecount(n) unsigned int *table, 851 __in size_t n); 852 853 #endif /* EFSYS_OPT_RX_SCALE */ 854 855 extern void 856 hunt_rx_qpost( 857 __in efx_rxq_t *erp, 858 __in_ecount(n) efsys_dma_addr_t *addrp, 859 __in size_t size, 860 __in unsigned int n, 861 __in unsigned int completed, 862 __in unsigned int added); 863 864 extern void 865 hunt_rx_qpush( 866 __in efx_rxq_t *erp, 867 __in unsigned int added, 868 __inout unsigned int *pushedp); 869 870 extern __checkReturn int 871 hunt_rx_qflush( 872 __in efx_rxq_t *erp); 873 874 extern void 875 hunt_rx_qenable( 876 __in efx_rxq_t *erp); 877 878 extern __checkReturn int 879 hunt_rx_qcreate( 880 __in efx_nic_t *enp, 881 __in unsigned int index, 882 __in unsigned int label, 883 __in efx_rxq_type_t type, 884 __in efsys_mem_t *esmp, 885 __in size_t n, 886 __in uint32_t id, 887 __in efx_evq_t *eep, 888 __in efx_rxq_t *erp); 889 890 extern void 891 hunt_rx_qdestroy( 892 __in efx_rxq_t *erp); 893 894 extern void 895 hunt_rx_fini( 896 __in efx_nic_t *enp); 897 898 #if EFSYS_OPT_FILTER 899 900 typedef struct hunt_filter_handle_s { 901 uint32_t hfh_lo; 902 uint32_t hfh_hi; 903 } hunt_filter_handle_t; 904 905 typedef struct hunt_filter_entry_s { 906 uintptr_t hfe_spec; /* pointer to filter spec plus busy bit */ 907 hunt_filter_handle_t hfe_handle; 908 } hunt_filter_entry_t; 909 910 /* 911 * BUSY flag indicates that an update is in progress. 912 * AUTO_OLD flag is used to mark and sweep MAC packet filters. 913 */ 914 #define EFX_HUNT_FILTER_FLAG_BUSY 1U 915 #define EFX_HUNT_FILTER_FLAG_AUTO_OLD 2U 916 #define EFX_HUNT_FILTER_FLAGS 3U 917 918 #define EFX_HUNT_FILTER_TBL_ROWS 8192 919 920 /* Allow for the broadcast address to be added to the multicast list */ 921 #define EFX_HUNT_FILTER_MULTICAST_FILTERS_MAX (EFX_MAC_MULTICAST_LIST_MAX + 1) 922 923 typedef struct hunt_filter_table_s { 924 hunt_filter_entry_t hft_entry[EFX_HUNT_FILTER_TBL_ROWS]; 925 efx_rxq_t * hft_default_rxq; 926 boolean_t hft_using_rss; 927 uint32_t hft_unicst_filter_index; 928 boolean_t hft_unicst_filter_set; 929 uint32_t hft_mulcst_filter_indexes[ 930 EFX_HUNT_FILTER_MULTICAST_FILTERS_MAX]; 931 uint32_t hft_mulcst_filter_count; 932 } hunt_filter_table_t; 933 934 __checkReturn int 935 hunt_filter_init( 936 __in efx_nic_t *enp); 937 938 void 939 hunt_filter_fini( 940 __in efx_nic_t *enp); 941 942 __checkReturn int 943 hunt_filter_restore( 944 __in efx_nic_t *enp); 945 946 __checkReturn int 947 hunt_filter_add( 948 __in efx_nic_t *enp, 949 __inout efx_filter_spec_t *spec, 950 __in boolean_t may_replace); 951 952 __checkReturn int 953 hunt_filter_delete( 954 __in efx_nic_t *enp, 955 __inout efx_filter_spec_t *spec); 956 957 extern __checkReturn int 958 hunt_filter_supported_filters( 959 __in efx_nic_t *enp, 960 __out uint32_t *list, 961 __out size_t *length); 962 963 extern __checkReturn int 964 hunt_filter_reconfigure( 965 __in efx_nic_t *enp, 966 __in_ecount(6) uint8_t const *mac_addr, 967 __in boolean_t all_unicst, 968 __in boolean_t mulcst, 969 __in boolean_t all_mulcst, 970 __in boolean_t brdcst, 971 __in_ecount(6*count) uint8_t const *addrs, 972 __in int count); 973 974 extern void 975 hunt_filter_get_default_rxq( 976 __in efx_nic_t *enp, 977 __out efx_rxq_t **erpp, 978 __out boolean_t *using_rss); 979 980 extern void 981 hunt_filter_default_rxq_set( 982 __in efx_nic_t *enp, 983 __in efx_rxq_t *erp, 984 __in boolean_t using_rss); 985 986 extern void 987 hunt_filter_default_rxq_clear( 988 __in efx_nic_t *enp); 989 990 991 #endif /* EFSYS_OPT_FILTER */ 992 993 extern __checkReturn int 994 hunt_pktfilter_set( 995 __in efx_nic_t *enp, 996 __in boolean_t unicst, 997 __in boolean_t brdcst); 998 999 #if EFSYS_OPT_MCAST_FILTER_LIST 1000 1001 extern __checkReturn int 1002 hunt_pktfilter_mcast_set( 1003 __in efx_nic_t *enp, 1004 __in uint8_t const *addrs, 1005 __in int count); 1006 1007 #endif /* EFSYS_OPT_MCAST_FILTER_LIST */ 1008 1009 extern __checkReturn int 1010 hunt_pktfilter_mcast_all( 1011 __in efx_nic_t *enp); 1012 1013 extern __checkReturn int 1014 efx_mcdi_get_function_info( 1015 __in efx_nic_t *enp, 1016 __out uint32_t *pfp, 1017 __out_opt uint32_t *vfp); 1018 1019 extern __checkReturn int 1020 efx_mcdi_privilege_mask( 1021 __in efx_nic_t *enp, 1022 __in uint32_t pf, 1023 __in uint32_t vf, 1024 __out uint32_t *maskp); 1025 1026 #ifdef __cplusplus 1027 } 1028 #endif 1029 1030 #endif /* _SYS_HUNT_IMPL_H */ 1031