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 typedef uint32_t efx_piobuf_handle_t; 699 700 #define EFX_PIOBUF_HANDLE_INVALID ((efx_piobuf_handle_t) -1) 701 702 extern __checkReturn int 703 hunt_nic_pio_alloc( 704 __inout efx_nic_t *enp, 705 __out uint32_t *bufnump, 706 __out efx_piobuf_handle_t *handlep, 707 __out uint32_t *blknump, 708 __out uint32_t *offsetp, 709 __out size_t *sizep); 710 711 extern __checkReturn int 712 hunt_nic_pio_free( 713 __inout efx_nic_t *enp, 714 __in uint32_t bufnum, 715 __in uint32_t blknum); 716 717 extern __checkReturn int 718 hunt_nic_pio_link( 719 __inout efx_nic_t *enp, 720 __in uint32_t vi_index, 721 __in efx_piobuf_handle_t handle); 722 723 extern __checkReturn int 724 hunt_nic_pio_unlink( 725 __inout efx_nic_t *enp, 726 __in uint32_t vi_index); 727 728 729 /* VPD */ 730 731 #if EFSYS_OPT_VPD 732 733 extern __checkReturn int 734 hunt_vpd_init( 735 __in efx_nic_t *enp); 736 737 extern __checkReturn int 738 hunt_vpd_size( 739 __in efx_nic_t *enp, 740 __out size_t *sizep); 741 742 extern __checkReturn int 743 hunt_vpd_read( 744 __in efx_nic_t *enp, 745 __out_bcount(size) caddr_t data, 746 __in size_t size); 747 748 extern __checkReturn int 749 hunt_vpd_verify( 750 __in efx_nic_t *enp, 751 __in_bcount(size) caddr_t data, 752 __in size_t size); 753 754 extern __checkReturn int 755 hunt_vpd_reinit( 756 __in efx_nic_t *enp, 757 __in_bcount(size) caddr_t data, 758 __in size_t size); 759 760 extern __checkReturn int 761 hunt_vpd_get( 762 __in efx_nic_t *enp, 763 __in_bcount(size) caddr_t data, 764 __in size_t size, 765 __inout efx_vpd_value_t *evvp); 766 767 extern __checkReturn int 768 hunt_vpd_set( 769 __in efx_nic_t *enp, 770 __in_bcount(size) caddr_t data, 771 __in size_t size, 772 __in efx_vpd_value_t *evvp); 773 774 extern __checkReturn int 775 hunt_vpd_next( 776 __in efx_nic_t *enp, 777 __in_bcount(size) caddr_t data, 778 __in size_t size, 779 __out efx_vpd_value_t *evvp, 780 __inout unsigned int *contp); 781 782 extern __checkReturn int 783 hunt_vpd_write( 784 __in efx_nic_t *enp, 785 __in_bcount(size) caddr_t data, 786 __in size_t size); 787 788 extern void 789 hunt_vpd_fini( 790 __in efx_nic_t *enp); 791 792 #endif /* EFSYS_OPT_VPD */ 793 794 795 /* RX */ 796 797 extern __checkReturn int 798 hunt_rx_init( 799 __in efx_nic_t *enp); 800 801 #if EFSYS_OPT_RX_HDR_SPLIT 802 extern __checkReturn int 803 hunt_rx_hdr_split_enable( 804 __in efx_nic_t *enp, 805 __in unsigned int hdr_buf_size, 806 __in unsigned int pld_buf_size); 807 #endif /* EFSYS_OPT_RX_HDR_SPLIT */ 808 809 #if EFSYS_OPT_RX_SCATTER 810 extern __checkReturn int 811 hunt_rx_scatter_enable( 812 __in efx_nic_t *enp, 813 __in unsigned int buf_size); 814 #endif /* EFSYS_OPT_RX_SCATTER */ 815 816 817 #if EFSYS_OPT_RX_SCALE 818 819 extern __checkReturn int 820 hunt_rx_scale_mode_set( 821 __in efx_nic_t *enp, 822 __in efx_rx_hash_alg_t alg, 823 __in efx_rx_hash_type_t type, 824 __in boolean_t insert); 825 826 extern __checkReturn int 827 hunt_rx_scale_key_set( 828 __in efx_nic_t *enp, 829 __in_ecount(n) uint8_t *key, 830 __in size_t n); 831 832 extern __checkReturn int 833 hunt_rx_scale_tbl_set( 834 __in efx_nic_t *enp, 835 __in_ecount(n) unsigned int *table, 836 __in size_t n); 837 838 #endif /* EFSYS_OPT_RX_SCALE */ 839 840 extern void 841 hunt_rx_qpost( 842 __in efx_rxq_t *erp, 843 __in_ecount(n) efsys_dma_addr_t *addrp, 844 __in size_t size, 845 __in unsigned int n, 846 __in unsigned int completed, 847 __in unsigned int added); 848 849 extern void 850 hunt_rx_qpush( 851 __in efx_rxq_t *erp, 852 __in unsigned int added, 853 __inout unsigned int *pushedp); 854 855 extern __checkReturn int 856 hunt_rx_qflush( 857 __in efx_rxq_t *erp); 858 859 extern void 860 hunt_rx_qenable( 861 __in efx_rxq_t *erp); 862 863 extern __checkReturn int 864 hunt_rx_qcreate( 865 __in efx_nic_t *enp, 866 __in unsigned int index, 867 __in unsigned int label, 868 __in efx_rxq_type_t type, 869 __in efsys_mem_t *esmp, 870 __in size_t n, 871 __in uint32_t id, 872 __in efx_evq_t *eep, 873 __in efx_rxq_t *erp); 874 875 extern void 876 hunt_rx_qdestroy( 877 __in efx_rxq_t *erp); 878 879 extern void 880 hunt_rx_fini( 881 __in efx_nic_t *enp); 882 883 #if EFSYS_OPT_FILTER 884 885 typedef struct hunt_filter_handle_s { 886 uint32_t hfh_lo; 887 uint32_t hfh_hi; 888 } hunt_filter_handle_t; 889 890 typedef struct hunt_filter_entry_s { 891 uintptr_t hfe_spec; /* pointer to filter spec plus busy bit */ 892 hunt_filter_handle_t hfe_handle; 893 } hunt_filter_entry_t; 894 895 /* 896 * BUSY flag indicates that an update is in progress. 897 * AUTO_OLD flag is used to mark and sweep MAC packet filters. 898 */ 899 #define EFX_HUNT_FILTER_FLAG_BUSY 1U 900 #define EFX_HUNT_FILTER_FLAG_AUTO_OLD 2U 901 #define EFX_HUNT_FILTER_FLAGS 3U 902 903 #define EFX_HUNT_FILTER_TBL_ROWS 8192 904 905 /* Allow for the broadcast address to be added to the multicast list */ 906 #define EFX_HUNT_FILTER_MULTICAST_FILTERS_MAX (EFX_MAC_MULTICAST_LIST_MAX + 1) 907 908 typedef struct hunt_filter_table_s { 909 hunt_filter_entry_t hft_entry[EFX_HUNT_FILTER_TBL_ROWS]; 910 efx_rxq_t * hft_default_rxq; 911 boolean_t hft_using_rss; 912 uint32_t hft_unicst_filter_index; 913 boolean_t hft_unicst_filter_set; 914 uint32_t hft_mulcst_filter_indexes[ 915 EFX_HUNT_FILTER_MULTICAST_FILTERS_MAX]; 916 uint32_t hft_mulcst_filter_count; 917 } hunt_filter_table_t; 918 919 __checkReturn int 920 hunt_filter_init( 921 __in efx_nic_t *enp); 922 923 void 924 hunt_filter_fini( 925 __in efx_nic_t *enp); 926 927 __checkReturn int 928 hunt_filter_restore( 929 __in efx_nic_t *enp); 930 931 __checkReturn int 932 hunt_filter_add( 933 __in efx_nic_t *enp, 934 __inout efx_filter_spec_t *spec, 935 __in boolean_t may_replace); 936 937 __checkReturn int 938 hunt_filter_delete( 939 __in efx_nic_t *enp, 940 __inout efx_filter_spec_t *spec); 941 942 extern __checkReturn int 943 hunt_filter_supported_filters( 944 __in efx_nic_t *enp, 945 __out uint32_t *list, 946 __out size_t *length); 947 948 extern __checkReturn int 949 hunt_filter_reconfigure( 950 __in efx_nic_t *enp, 951 __in_ecount(6) uint8_t const *mac_addr, 952 __in boolean_t all_unicst, 953 __in boolean_t mulcst, 954 __in boolean_t all_mulcst, 955 __in boolean_t brdcst, 956 __in_ecount(6*count) uint8_t const *addrs, 957 __in int count); 958 959 extern void 960 hunt_filter_get_default_rxq( 961 __in efx_nic_t *enp, 962 __out efx_rxq_t **erpp, 963 __out boolean_t *using_rss); 964 965 extern void 966 hunt_filter_default_rxq_set( 967 __in efx_nic_t *enp, 968 __in efx_rxq_t *erp, 969 __in boolean_t using_rss); 970 971 extern void 972 hunt_filter_default_rxq_clear( 973 __in efx_nic_t *enp); 974 975 976 #endif /* EFSYS_OPT_FILTER */ 977 978 extern __checkReturn int 979 hunt_pktfilter_set( 980 __in efx_nic_t *enp, 981 __in boolean_t unicst, 982 __in boolean_t brdcst); 983 984 #if EFSYS_OPT_MCAST_FILTER_LIST 985 986 extern __checkReturn int 987 hunt_pktfilter_mcast_set( 988 __in efx_nic_t *enp, 989 __in uint8_t const *addrs, 990 __in int count); 991 992 #endif /* EFSYS_OPT_MCAST_FILTER_LIST */ 993 994 extern __checkReturn int 995 hunt_pktfilter_mcast_all( 996 __in efx_nic_t *enp); 997 998 extern __checkReturn int 999 efx_mcdi_get_function_info( 1000 __in efx_nic_t *enp, 1001 __out uint32_t *pfp, 1002 __out_opt uint32_t *vfp); 1003 1004 extern __checkReturn int 1005 efx_mcdi_privilege_mask( 1006 __in efx_nic_t *enp, 1007 __in uint32_t pf, 1008 __in uint32_t vf, 1009 __out uint32_t *maskp); 1010 1011 #ifdef __cplusplus 1012 } 1013 #endif 1014 1015 #endif /* _SYS_HUNT_IMPL_H */ 1016