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