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 efx_rc_t 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 efx_rc_t 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 efx_rc_t 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 efx_rc_t 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 efx_rc_t 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 efx_rc_t 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 efx_rc_t 144 hunt_nic_probe( 145 __in efx_nic_t *enp); 146 147 extern __checkReturn efx_rc_t 148 hunt_nic_set_drv_limits( 149 __inout efx_nic_t *enp, 150 __in efx_drv_limits_t *edlp); 151 152 extern __checkReturn efx_rc_t 153 hunt_nic_get_vi_pool( 154 __in efx_nic_t *enp, 155 __out uint32_t *vi_countp); 156 157 extern __checkReturn efx_rc_t 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 efx_rc_t 165 hunt_nic_reset( 166 __in efx_nic_t *enp); 167 168 extern __checkReturn efx_rc_t 169 hunt_nic_init( 170 __in efx_nic_t *enp); 171 172 #if EFSYS_OPT_DIAG 173 174 extern __checkReturn efx_rc_t 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 efx_rc_t 192 hunt_mac_poll( 193 __in efx_nic_t *enp, 194 __out efx_link_mode_t *link_modep); 195 196 extern __checkReturn efx_rc_t 197 hunt_mac_up( 198 __in efx_nic_t *enp, 199 __out boolean_t *mac_upp); 200 201 extern __checkReturn efx_rc_t 202 hunt_mac_addr_set( 203 __in efx_nic_t *enp); 204 205 extern __checkReturn efx_rc_t 206 hunt_mac_reconfigure( 207 __in efx_nic_t *enp); 208 209 extern __checkReturn efx_rc_t 210 hunt_mac_multicast_list_set( 211 __in efx_nic_t *enp); 212 213 extern __checkReturn efx_rc_t 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 efx_rc_t 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 efx_rc_t 236 hunt_mac_stats_update( 237 __in efx_nic_t *enp, 238 __in efsys_mem_t *esmp, 239 __inout_ecount(EFX_MAC_NSTATS) efsys_stat_t *stat, 240 __inout_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 efx_rc_t 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 efx_rc_t 276 hunt_mcdi_poll_reboot( 277 __in efx_nic_t *enp); 278 279 extern __checkReturn efx_rc_t 280 hunt_mcdi_fw_update_supported( 281 __in efx_nic_t *enp, 282 __out boolean_t *supportedp); 283 284 extern __checkReturn efx_rc_t 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 efx_rc_t 296 hunt_nvram_buf_read_tlv( 297 __in efx_nic_t *enp, 298 __in_bcount(max_seg_size) caddr_t seg_data, 299 __in size_t max_seg_size, 300 __in uint32_t tag, 301 __deref_out_bcount_opt(*sizep) caddr_t *datap, 302 __out size_t *sizep); 303 304 extern __checkReturn efx_rc_t 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 efx_rc_t 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 efx_rc_t 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 efx_rc_t 330 hunt_nvram_partn_write_segment_tlv( 331 __in efx_nic_t *enp, 332 __in uint32_t partn, 333 __in uint32_t tag, 334 __in_bcount(size) caddr_t data, 335 __in size_t size, 336 __in boolean_t all_segments); 337 338 extern __checkReturn efx_rc_t 339 hunt_nvram_partn_size( 340 __in efx_nic_t *enp, 341 __in unsigned int partn, 342 __out size_t *sizep); 343 344 extern __checkReturn efx_rc_t 345 hunt_nvram_partn_lock( 346 __in efx_nic_t *enp, 347 __in unsigned int partn); 348 349 extern __checkReturn efx_rc_t 350 hunt_nvram_partn_read( 351 __in efx_nic_t *enp, 352 __in unsigned int partn, 353 __in unsigned int offset, 354 __out_bcount(size) caddr_t data, 355 __in size_t size); 356 357 extern __checkReturn efx_rc_t 358 hunt_nvram_partn_erase( 359 __in efx_nic_t *enp, 360 __in unsigned int partn, 361 __in unsigned int offset, 362 __in size_t size); 363 364 extern __checkReturn efx_rc_t 365 hunt_nvram_partn_write( 366 __in efx_nic_t *enp, 367 __in unsigned int partn, 368 __in unsigned int offset, 369 __out_bcount(size) caddr_t data, 370 __in size_t size); 371 372 extern void 373 hunt_nvram_partn_unlock( 374 __in efx_nic_t *enp, 375 __in unsigned int partn); 376 377 #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */ 378 379 #if EFSYS_OPT_NVRAM 380 381 #if EFSYS_OPT_DIAG 382 383 extern __checkReturn efx_rc_t 384 hunt_nvram_test( 385 __in efx_nic_t *enp); 386 387 #endif /* EFSYS_OPT_DIAG */ 388 389 extern __checkReturn efx_rc_t 390 hunt_nvram_size( 391 __in efx_nic_t *enp, 392 __in efx_nvram_type_t type, 393 __out size_t *sizep); 394 395 extern __checkReturn efx_rc_t 396 hunt_nvram_get_version( 397 __in efx_nic_t *enp, 398 __in efx_nvram_type_t type, 399 __out uint32_t *subtypep, 400 __out_ecount(4) uint16_t version[4]); 401 402 extern __checkReturn efx_rc_t 403 hunt_nvram_rw_start( 404 __in efx_nic_t *enp, 405 __in efx_nvram_type_t type, 406 __out size_t *pref_chunkp); 407 408 extern __checkReturn efx_rc_t 409 hunt_nvram_read_chunk( 410 __in efx_nic_t *enp, 411 __in efx_nvram_type_t type, 412 __in unsigned int offset, 413 __out_bcount(size) caddr_t data, 414 __in size_t size); 415 416 extern __checkReturn efx_rc_t 417 hunt_nvram_erase( 418 __in efx_nic_t *enp, 419 __in efx_nvram_type_t type); 420 421 extern __checkReturn efx_rc_t 422 hunt_nvram_write_chunk( 423 __in efx_nic_t *enp, 424 __in efx_nvram_type_t type, 425 __in unsigned int offset, 426 __in_bcount(size) caddr_t data, 427 __in size_t size); 428 429 extern void 430 hunt_nvram_rw_finish( 431 __in efx_nic_t *enp, 432 __in efx_nvram_type_t type); 433 434 extern __checkReturn efx_rc_t 435 hunt_nvram_partn_set_version( 436 __in efx_nic_t *enp, 437 __in unsigned int partn, 438 __in_ecount(4) uint16_t version[4]); 439 440 extern __checkReturn efx_rc_t 441 hunt_nvram_set_version( 442 __in efx_nic_t *enp, 443 __in efx_nvram_type_t type, 444 __in_ecount(4) uint16_t version[4]); 445 446 #endif /* EFSYS_OPT_NVRAM */ 447 448 449 /* PHY */ 450 451 typedef struct hunt_link_state_s { 452 uint32_t hls_adv_cap_mask; 453 uint32_t hls_lp_cap_mask; 454 unsigned int hls_fcntl; 455 efx_link_mode_t hls_link_mode; 456 #if EFSYS_OPT_LOOPBACK 457 efx_loopback_type_t hls_loopback; 458 #endif 459 boolean_t hls_mac_up; 460 } hunt_link_state_t; 461 462 extern void 463 hunt_phy_link_ev( 464 __in efx_nic_t *enp, 465 __in efx_qword_t *eqp, 466 __out efx_link_mode_t *link_modep); 467 468 extern __checkReturn efx_rc_t 469 hunt_phy_get_link( 470 __in efx_nic_t *enp, 471 __out hunt_link_state_t *hlsp); 472 473 extern __checkReturn efx_rc_t 474 hunt_phy_power( 475 __in efx_nic_t *enp, 476 __in boolean_t on); 477 478 extern __checkReturn efx_rc_t 479 hunt_phy_reconfigure( 480 __in efx_nic_t *enp); 481 482 extern __checkReturn efx_rc_t 483 hunt_phy_verify( 484 __in efx_nic_t *enp); 485 486 extern __checkReturn efx_rc_t 487 hunt_phy_oui_get( 488 __in efx_nic_t *enp, 489 __out uint32_t *ouip); 490 491 #if EFSYS_OPT_PHY_STATS 492 493 extern __checkReturn efx_rc_t 494 hunt_phy_stats_update( 495 __in efx_nic_t *enp, 496 __in efsys_mem_t *esmp, 497 __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat); 498 499 #endif /* EFSYS_OPT_PHY_STATS */ 500 501 #if EFSYS_OPT_PHY_PROPS 502 503 #if EFSYS_OPT_NAMES 504 505 extern const char * 506 hunt_phy_prop_name( 507 __in efx_nic_t *enp, 508 __in unsigned int id); 509 510 #endif /* EFSYS_OPT_NAMES */ 511 512 extern __checkReturn efx_rc_t 513 hunt_phy_prop_get( 514 __in efx_nic_t *enp, 515 __in unsigned int id, 516 __in uint32_t flags, 517 __out uint32_t *valp); 518 519 extern __checkReturn efx_rc_t 520 hunt_phy_prop_set( 521 __in efx_nic_t *enp, 522 __in unsigned int id, 523 __in uint32_t val); 524 525 #endif /* EFSYS_OPT_PHY_PROPS */ 526 527 #if EFSYS_OPT_BIST 528 529 extern __checkReturn efx_rc_t 530 hunt_bist_enable_offline( 531 __in efx_nic_t *enp); 532 533 extern __checkReturn efx_rc_t 534 hunt_bist_start( 535 __in efx_nic_t *enp, 536 __in efx_bist_type_t type); 537 538 extern __checkReturn efx_rc_t 539 hunt_bist_poll( 540 __in efx_nic_t *enp, 541 __in efx_bist_type_t type, 542 __out efx_bist_result_t *resultp, 543 __out_opt __drv_when(count > 0, __notnull) 544 uint32_t *value_maskp, 545 __out_ecount_opt(count) __drv_when(count > 0, __notnull) 546 unsigned long *valuesp, 547 __in size_t count); 548 549 extern void 550 hunt_bist_stop( 551 __in efx_nic_t *enp, 552 __in efx_bist_type_t type); 553 554 #endif /* EFSYS_OPT_BIST */ 555 556 557 /* SRAM */ 558 559 #if EFSYS_OPT_DIAG 560 561 extern __checkReturn efx_rc_t 562 hunt_sram_test( 563 __in efx_nic_t *enp, 564 __in efx_sram_pattern_fn_t func); 565 566 #endif /* EFSYS_OPT_DIAG */ 567 568 569 /* TX */ 570 571 extern __checkReturn efx_rc_t 572 hunt_tx_init( 573 __in efx_nic_t *enp); 574 575 extern void 576 hunt_tx_fini( 577 __in efx_nic_t *enp); 578 579 extern __checkReturn efx_rc_t 580 hunt_tx_qcreate( 581 __in efx_nic_t *enp, 582 __in unsigned int index, 583 __in unsigned int label, 584 __in efsys_mem_t *esmp, 585 __in size_t n, 586 __in uint32_t id, 587 __in uint16_t flags, 588 __in efx_evq_t *eep, 589 __in efx_txq_t *etp, 590 __out unsigned int *addedp); 591 592 extern void 593 hunt_tx_qdestroy( 594 __in efx_txq_t *etp); 595 596 extern __checkReturn efx_rc_t 597 hunt_tx_qpost( 598 __in efx_txq_t *etp, 599 __in_ecount(n) efx_buffer_t *eb, 600 __in unsigned int n, 601 __in unsigned int completed, 602 __inout unsigned int *addedp); 603 604 extern void 605 hunt_tx_qpush( 606 __in efx_txq_t *etp, 607 __in unsigned int added, 608 __in unsigned int pushed); 609 610 extern __checkReturn efx_rc_t 611 hunt_tx_qpace( 612 __in efx_txq_t *etp, 613 __in unsigned int ns); 614 615 extern __checkReturn efx_rc_t 616 hunt_tx_qflush( 617 __in efx_txq_t *etp); 618 619 extern void 620 hunt_tx_qenable( 621 __in efx_txq_t *etp); 622 623 extern __checkReturn efx_rc_t 624 hunt_tx_qpio_enable( 625 __in efx_txq_t *etp); 626 627 extern void 628 hunt_tx_qpio_disable( 629 __in efx_txq_t *etp); 630 631 extern __checkReturn efx_rc_t 632 hunt_tx_qpio_write( 633 __in efx_txq_t *etp, 634 __in_ecount(buf_length) uint8_t *buffer, 635 __in size_t buf_length, 636 __in size_t pio_buf_offset); 637 638 extern __checkReturn efx_rc_t 639 hunt_tx_qpio_post( 640 __in efx_txq_t *etp, 641 __in size_t pkt_length, 642 __in unsigned int completed, 643 __inout unsigned int *addedp); 644 645 extern __checkReturn efx_rc_t 646 hunt_tx_qdesc_post( 647 __in efx_txq_t *etp, 648 __in_ecount(n) efx_desc_t *ed, 649 __in unsigned int n, 650 __in unsigned int completed, 651 __inout unsigned int *addedp); 652 653 extern void 654 hunt_tx_qdesc_dma_create( 655 __in efx_txq_t *etp, 656 __in efsys_dma_addr_t addr, 657 __in size_t size, 658 __in boolean_t eop, 659 __out efx_desc_t *edp); 660 661 extern void 662 hunt_tx_qdesc_tso_create( 663 __in efx_txq_t *etp, 664 __in uint16_t ipv4_id, 665 __in uint32_t tcp_seq, 666 __in uint8_t tcp_flags, 667 __out efx_desc_t *edp); 668 669 extern void 670 hunt_tx_qdesc_vlantci_create( 671 __in efx_txq_t *etp, 672 __in uint16_t vlan_tci, 673 __out efx_desc_t *edp); 674 675 676 #if EFSYS_OPT_QSTATS 677 678 extern void 679 hunt_tx_qstats_update( 680 __in efx_txq_t *etp, 681 __inout_ecount(TX_NQSTATS) efsys_stat_t *stat); 682 683 #endif /* EFSYS_OPT_QSTATS */ 684 685 /* PIO */ 686 687 /* Missing register definitions */ 688 #ifndef ER_DZ_TX_PIOBUF_OFST 689 #define ER_DZ_TX_PIOBUF_OFST 0x00001000 690 #endif 691 #ifndef ER_DZ_TX_PIOBUF_STEP 692 #define ER_DZ_TX_PIOBUF_STEP 8192 693 #endif 694 #ifndef ER_DZ_TX_PIOBUF_ROWS 695 #define ER_DZ_TX_PIOBUF_ROWS 2048 696 #endif 697 698 #ifndef ER_DZ_TX_PIOBUF_SIZE 699 #define ER_DZ_TX_PIOBUF_SIZE 2048 700 #endif 701 702 #define HUNT_PIOBUF_NBUFS (16) 703 #define HUNT_PIOBUF_SIZE (ER_DZ_TX_PIOBUF_SIZE) 704 705 #define HUNT_MIN_PIO_ALLOC_SIZE (HUNT_PIOBUF_SIZE / 32) 706 707 #define HUNT_LEGACY_PF_PRIVILEGE_MASK \ 708 (MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN | \ 709 MC_CMD_PRIVILEGE_MASK_IN_GRP_LINK | \ 710 MC_CMD_PRIVILEGE_MASK_IN_GRP_ONLOAD | \ 711 MC_CMD_PRIVILEGE_MASK_IN_GRP_PTP | \ 712 MC_CMD_PRIVILEGE_MASK_IN_GRP_INSECURE_FILTERS | \ 713 MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING | \ 714 MC_CMD_PRIVILEGE_MASK_IN_GRP_UNICAST | \ 715 MC_CMD_PRIVILEGE_MASK_IN_GRP_MULTICAST | \ 716 MC_CMD_PRIVILEGE_MASK_IN_GRP_BROADCAST | \ 717 MC_CMD_PRIVILEGE_MASK_IN_GRP_ALL_MULTICAST | \ 718 MC_CMD_PRIVILEGE_MASK_IN_GRP_PROMISCUOUS) 719 720 #define HUNT_LEGACY_VF_PRIVILEGE_MASK 0 721 722 typedef uint32_t efx_piobuf_handle_t; 723 724 #define EFX_PIOBUF_HANDLE_INVALID ((efx_piobuf_handle_t) -1) 725 726 extern __checkReturn efx_rc_t 727 hunt_nic_pio_alloc( 728 __inout efx_nic_t *enp, 729 __out uint32_t *bufnump, 730 __out efx_piobuf_handle_t *handlep, 731 __out uint32_t *blknump, 732 __out uint32_t *offsetp, 733 __out size_t *sizep); 734 735 extern __checkReturn efx_rc_t 736 hunt_nic_pio_free( 737 __inout efx_nic_t *enp, 738 __in uint32_t bufnum, 739 __in uint32_t blknum); 740 741 extern __checkReturn efx_rc_t 742 hunt_nic_pio_link( 743 __inout efx_nic_t *enp, 744 __in uint32_t vi_index, 745 __in efx_piobuf_handle_t handle); 746 747 extern __checkReturn efx_rc_t 748 hunt_nic_pio_unlink( 749 __inout efx_nic_t *enp, 750 __in uint32_t vi_index); 751 752 753 /* VPD */ 754 755 #if EFSYS_OPT_VPD 756 757 extern __checkReturn efx_rc_t 758 hunt_vpd_init( 759 __in efx_nic_t *enp); 760 761 extern __checkReturn efx_rc_t 762 hunt_vpd_size( 763 __in efx_nic_t *enp, 764 __out size_t *sizep); 765 766 extern __checkReturn efx_rc_t 767 hunt_vpd_read( 768 __in efx_nic_t *enp, 769 __out_bcount(size) caddr_t data, 770 __in size_t size); 771 772 extern __checkReturn efx_rc_t 773 hunt_vpd_verify( 774 __in efx_nic_t *enp, 775 __in_bcount(size) caddr_t data, 776 __in size_t size); 777 778 extern __checkReturn efx_rc_t 779 hunt_vpd_reinit( 780 __in efx_nic_t *enp, 781 __in_bcount(size) caddr_t data, 782 __in size_t size); 783 784 extern __checkReturn efx_rc_t 785 hunt_vpd_get( 786 __in efx_nic_t *enp, 787 __in_bcount(size) caddr_t data, 788 __in size_t size, 789 __inout efx_vpd_value_t *evvp); 790 791 extern __checkReturn efx_rc_t 792 hunt_vpd_set( 793 __in efx_nic_t *enp, 794 __in_bcount(size) caddr_t data, 795 __in size_t size, 796 __in efx_vpd_value_t *evvp); 797 798 extern __checkReturn efx_rc_t 799 hunt_vpd_next( 800 __in efx_nic_t *enp, 801 __in_bcount(size) caddr_t data, 802 __in size_t size, 803 __out efx_vpd_value_t *evvp, 804 __inout unsigned int *contp); 805 806 extern __checkReturn efx_rc_t 807 hunt_vpd_write( 808 __in efx_nic_t *enp, 809 __in_bcount(size) caddr_t data, 810 __in size_t size); 811 812 extern void 813 hunt_vpd_fini( 814 __in efx_nic_t *enp); 815 816 #endif /* EFSYS_OPT_VPD */ 817 818 819 /* RX */ 820 821 extern __checkReturn efx_rc_t 822 hunt_rx_init( 823 __in efx_nic_t *enp); 824 825 #if EFSYS_OPT_RX_HDR_SPLIT 826 extern __checkReturn efx_rc_t 827 hunt_rx_hdr_split_enable( 828 __in efx_nic_t *enp, 829 __in unsigned int hdr_buf_size, 830 __in unsigned int pld_buf_size); 831 #endif /* EFSYS_OPT_RX_HDR_SPLIT */ 832 833 #if EFSYS_OPT_RX_SCATTER 834 extern __checkReturn efx_rc_t 835 hunt_rx_scatter_enable( 836 __in efx_nic_t *enp, 837 __in unsigned int buf_size); 838 #endif /* EFSYS_OPT_RX_SCATTER */ 839 840 841 #if EFSYS_OPT_RX_SCALE 842 843 extern __checkReturn efx_rc_t 844 hunt_rx_scale_mode_set( 845 __in efx_nic_t *enp, 846 __in efx_rx_hash_alg_t alg, 847 __in efx_rx_hash_type_t type, 848 __in boolean_t insert); 849 850 extern __checkReturn efx_rc_t 851 hunt_rx_scale_key_set( 852 __in efx_nic_t *enp, 853 __in_ecount(n) uint8_t *key, 854 __in size_t n); 855 856 extern __checkReturn efx_rc_t 857 hunt_rx_scale_tbl_set( 858 __in efx_nic_t *enp, 859 __in_ecount(n) unsigned int *table, 860 __in size_t n); 861 862 #endif /* EFSYS_OPT_RX_SCALE */ 863 864 extern void 865 hunt_rx_qpost( 866 __in efx_rxq_t *erp, 867 __in_ecount(n) efsys_dma_addr_t *addrp, 868 __in size_t size, 869 __in unsigned int n, 870 __in unsigned int completed, 871 __in unsigned int added); 872 873 extern void 874 hunt_rx_qpush( 875 __in efx_rxq_t *erp, 876 __in unsigned int added, 877 __inout unsigned int *pushedp); 878 879 extern __checkReturn efx_rc_t 880 hunt_rx_qflush( 881 __in efx_rxq_t *erp); 882 883 extern void 884 hunt_rx_qenable( 885 __in efx_rxq_t *erp); 886 887 extern __checkReturn efx_rc_t 888 hunt_rx_qcreate( 889 __in efx_nic_t *enp, 890 __in unsigned int index, 891 __in unsigned int label, 892 __in efx_rxq_type_t type, 893 __in efsys_mem_t *esmp, 894 __in size_t n, 895 __in uint32_t id, 896 __in efx_evq_t *eep, 897 __in efx_rxq_t *erp); 898 899 extern void 900 hunt_rx_qdestroy( 901 __in efx_rxq_t *erp); 902 903 extern void 904 hunt_rx_fini( 905 __in efx_nic_t *enp); 906 907 #if EFSYS_OPT_FILTER 908 909 typedef struct hunt_filter_handle_s { 910 uint32_t hfh_lo; 911 uint32_t hfh_hi; 912 } hunt_filter_handle_t; 913 914 typedef struct hunt_filter_entry_s { 915 uintptr_t hfe_spec; /* pointer to filter spec plus busy bit */ 916 hunt_filter_handle_t hfe_handle; 917 } hunt_filter_entry_t; 918 919 /* 920 * BUSY flag indicates that an update is in progress. 921 * AUTO_OLD flag is used to mark and sweep MAC packet filters. 922 */ 923 #define EFX_HUNT_FILTER_FLAG_BUSY 1U 924 #define EFX_HUNT_FILTER_FLAG_AUTO_OLD 2U 925 #define EFX_HUNT_FILTER_FLAGS 3U 926 927 #define EFX_HUNT_FILTER_TBL_ROWS 8192 928 929 /* Allow for the broadcast address to be added to the multicast list */ 930 #define EFX_HUNT_FILTER_MULTICAST_FILTERS_MAX (EFX_MAC_MULTICAST_LIST_MAX + 1) 931 932 typedef struct hunt_filter_table_s { 933 hunt_filter_entry_t hft_entry[EFX_HUNT_FILTER_TBL_ROWS]; 934 efx_rxq_t * hft_default_rxq; 935 boolean_t hft_using_rss; 936 uint32_t hft_unicst_filter_index; 937 boolean_t hft_unicst_filter_set; 938 uint32_t hft_mulcst_filter_indexes[ 939 EFX_HUNT_FILTER_MULTICAST_FILTERS_MAX]; 940 uint32_t hft_mulcst_filter_count; 941 } hunt_filter_table_t; 942 943 __checkReturn efx_rc_t 944 hunt_filter_init( 945 __in efx_nic_t *enp); 946 947 void 948 hunt_filter_fini( 949 __in efx_nic_t *enp); 950 951 __checkReturn efx_rc_t 952 hunt_filter_restore( 953 __in efx_nic_t *enp); 954 955 __checkReturn efx_rc_t 956 hunt_filter_add( 957 __in efx_nic_t *enp, 958 __inout efx_filter_spec_t *spec, 959 __in boolean_t may_replace); 960 961 __checkReturn efx_rc_t 962 hunt_filter_delete( 963 __in efx_nic_t *enp, 964 __inout efx_filter_spec_t *spec); 965 966 extern __checkReturn efx_rc_t 967 hunt_filter_supported_filters( 968 __in efx_nic_t *enp, 969 __out uint32_t *list, 970 __out size_t *length); 971 972 extern __checkReturn efx_rc_t 973 hunt_filter_reconfigure( 974 __in efx_nic_t *enp, 975 __in_ecount(6) uint8_t const *mac_addr, 976 __in boolean_t all_unicst, 977 __in boolean_t mulcst, 978 __in boolean_t all_mulcst, 979 __in boolean_t brdcst, 980 __in_ecount(6*count) uint8_t const *addrs, 981 __in int count); 982 983 extern void 984 hunt_filter_get_default_rxq( 985 __in efx_nic_t *enp, 986 __out efx_rxq_t **erpp, 987 __out boolean_t *using_rss); 988 989 extern void 990 hunt_filter_default_rxq_set( 991 __in efx_nic_t *enp, 992 __in efx_rxq_t *erp, 993 __in boolean_t using_rss); 994 995 extern void 996 hunt_filter_default_rxq_clear( 997 __in efx_nic_t *enp); 998 999 1000 #endif /* EFSYS_OPT_FILTER */ 1001 1002 extern __checkReturn efx_rc_t 1003 hunt_pktfilter_set( 1004 __in efx_nic_t *enp, 1005 __in boolean_t unicst, 1006 __in boolean_t brdcst); 1007 1008 #if EFSYS_OPT_MCAST_FILTER_LIST 1009 1010 extern __checkReturn efx_rc_t 1011 hunt_pktfilter_mcast_set( 1012 __in efx_nic_t *enp, 1013 __in uint8_t const *addrs, 1014 __in int count); 1015 1016 #endif /* EFSYS_OPT_MCAST_FILTER_LIST */ 1017 1018 extern __checkReturn efx_rc_t 1019 hunt_pktfilter_mcast_all( 1020 __in efx_nic_t *enp); 1021 1022 extern __checkReturn efx_rc_t 1023 efx_mcdi_get_function_info( 1024 __in efx_nic_t *enp, 1025 __out uint32_t *pfp, 1026 __out_opt uint32_t *vfp); 1027 1028 extern __checkReturn efx_rc_t 1029 efx_mcdi_privilege_mask( 1030 __in efx_nic_t *enp, 1031 __in uint32_t pf, 1032 __in uint32_t vf, 1033 __out uint32_t *maskp); 1034 1035 #ifdef __cplusplus 1036 } 1037 #endif 1038 1039 #endif /* _SYS_HUNT_IMPL_H */ 1040