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