1 /*- 2 * Copyright (c) 2015-2016 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_EF10_IMPL_H 34 #define _SYS_EF10_IMPL_H 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 #if (EFSYS_OPT_HUNTINGTON && EFSYS_OPT_MEDFORD) 41 #define EF10_MAX_PIOBUF_NBUFS MAX(HUNT_PIOBUF_NBUFS, MEDFORD_PIOBUF_NBUFS) 42 #elif EFSYS_OPT_HUNTINGTON 43 #define EF10_MAX_PIOBUF_NBUFS HUNT_PIOBUF_NBUFS 44 #elif EFSYS_OPT_MEDFORD 45 #define EF10_MAX_PIOBUF_NBUFS MEDFORD_PIOBUF_NBUFS 46 #endif 47 48 /* 49 * FIXME: This is just a power of 2 which fits in an MCDI v1 message, and could 50 * possibly be increased, or the write size reported by newer firmware used 51 * instead. 52 */ 53 #define EF10_NVRAM_CHUNK 0x80 54 55 /* Alignment requirement for value written to RX WPTR: 56 * the WPTR must be aligned to an 8 descriptor boundary 57 */ 58 #define EF10_RX_WPTR_ALIGN 8 59 60 /* 61 * Max byte offset into the packet the TCP header must start for the hardware 62 * to be able to parse the packet correctly. 63 */ 64 #define EF10_TCP_HEADER_OFFSET_LIMIT 208 65 66 /* Invalid RSS context handle */ 67 #define EF10_RSS_CONTEXT_INVALID (0xffffffff) 68 69 70 /* EV */ 71 72 __checkReturn efx_rc_t 73 ef10_ev_init( 74 __in efx_nic_t *enp); 75 76 void 77 ef10_ev_fini( 78 __in efx_nic_t *enp); 79 80 __checkReturn efx_rc_t 81 ef10_ev_qcreate( 82 __in efx_nic_t *enp, 83 __in unsigned int index, 84 __in efsys_mem_t *esmp, 85 __in size_t n, 86 __in uint32_t id, 87 __in uint32_t us, 88 __in efx_evq_t *eep); 89 90 void 91 ef10_ev_qdestroy( 92 __in efx_evq_t *eep); 93 94 __checkReturn efx_rc_t 95 ef10_ev_qprime( 96 __in efx_evq_t *eep, 97 __in unsigned int count); 98 99 void 100 ef10_ev_qpost( 101 __in efx_evq_t *eep, 102 __in uint16_t data); 103 104 __checkReturn efx_rc_t 105 ef10_ev_qmoderate( 106 __in efx_evq_t *eep, 107 __in unsigned int us); 108 109 #if EFSYS_OPT_QSTATS 110 void 111 ef10_ev_qstats_update( 112 __in efx_evq_t *eep, 113 __inout_ecount(EV_NQSTATS) efsys_stat_t *stat); 114 #endif /* EFSYS_OPT_QSTATS */ 115 116 void 117 ef10_ev_rxlabel_init( 118 __in efx_evq_t *eep, 119 __in efx_rxq_t *erp, 120 __in unsigned int label); 121 122 void 123 ef10_ev_rxlabel_fini( 124 __in efx_evq_t *eep, 125 __in unsigned int label); 126 127 /* INTR */ 128 129 __checkReturn efx_rc_t 130 ef10_intr_init( 131 __in efx_nic_t *enp, 132 __in efx_intr_type_t type, 133 __in efsys_mem_t *esmp); 134 135 void 136 ef10_intr_enable( 137 __in efx_nic_t *enp); 138 139 void 140 ef10_intr_disable( 141 __in efx_nic_t *enp); 142 143 void 144 ef10_intr_disable_unlocked( 145 __in efx_nic_t *enp); 146 147 __checkReturn efx_rc_t 148 ef10_intr_trigger( 149 __in efx_nic_t *enp, 150 __in unsigned int level); 151 152 void 153 ef10_intr_status_line( 154 __in efx_nic_t *enp, 155 __out boolean_t *fatalp, 156 __out uint32_t *qmaskp); 157 158 void 159 ef10_intr_status_message( 160 __in efx_nic_t *enp, 161 __in unsigned int message, 162 __out boolean_t *fatalp); 163 164 void 165 ef10_intr_fatal( 166 __in efx_nic_t *enp); 167 void 168 ef10_intr_fini( 169 __in efx_nic_t *enp); 170 171 /* NIC */ 172 173 extern __checkReturn efx_rc_t 174 ef10_nic_probe( 175 __in efx_nic_t *enp); 176 177 extern __checkReturn efx_rc_t 178 ef10_nic_set_drv_limits( 179 __inout efx_nic_t *enp, 180 __in efx_drv_limits_t *edlp); 181 182 extern __checkReturn efx_rc_t 183 ef10_nic_get_vi_pool( 184 __in efx_nic_t *enp, 185 __out uint32_t *vi_countp); 186 187 extern __checkReturn efx_rc_t 188 ef10_nic_get_bar_region( 189 __in efx_nic_t *enp, 190 __in efx_nic_region_t region, 191 __out uint32_t *offsetp, 192 __out size_t *sizep); 193 194 extern __checkReturn efx_rc_t 195 ef10_nic_reset( 196 __in efx_nic_t *enp); 197 198 extern __checkReturn efx_rc_t 199 ef10_nic_init( 200 __in efx_nic_t *enp); 201 202 #if EFSYS_OPT_DIAG 203 204 extern __checkReturn efx_rc_t 205 ef10_nic_register_test( 206 __in efx_nic_t *enp); 207 208 #endif /* EFSYS_OPT_DIAG */ 209 210 extern void 211 ef10_nic_fini( 212 __in efx_nic_t *enp); 213 214 extern void 215 ef10_nic_unprobe( 216 __in efx_nic_t *enp); 217 218 219 /* MAC */ 220 221 extern __checkReturn efx_rc_t 222 ef10_mac_poll( 223 __in efx_nic_t *enp, 224 __out efx_link_mode_t *link_modep); 225 226 extern __checkReturn efx_rc_t 227 ef10_mac_up( 228 __in efx_nic_t *enp, 229 __out boolean_t *mac_upp); 230 231 extern __checkReturn efx_rc_t 232 ef10_mac_addr_set( 233 __in efx_nic_t *enp); 234 235 extern __checkReturn efx_rc_t 236 ef10_mac_pdu_set( 237 __in efx_nic_t *enp); 238 239 extern __checkReturn efx_rc_t 240 ef10_mac_pdu_get( 241 __in efx_nic_t *enp, 242 __out size_t *pdu); 243 244 extern __checkReturn efx_rc_t 245 ef10_mac_reconfigure( 246 __in efx_nic_t *enp); 247 248 extern __checkReturn efx_rc_t 249 ef10_mac_multicast_list_set( 250 __in efx_nic_t *enp); 251 252 extern __checkReturn efx_rc_t 253 ef10_mac_filter_default_rxq_set( 254 __in efx_nic_t *enp, 255 __in efx_rxq_t *erp, 256 __in boolean_t using_rss); 257 258 extern void 259 ef10_mac_filter_default_rxq_clear( 260 __in efx_nic_t *enp); 261 262 #if EFSYS_OPT_LOOPBACK 263 264 extern __checkReturn efx_rc_t 265 ef10_mac_loopback_set( 266 __in efx_nic_t *enp, 267 __in efx_link_mode_t link_mode, 268 __in efx_loopback_type_t loopback_type); 269 270 #endif /* EFSYS_OPT_LOOPBACK */ 271 272 #if EFSYS_OPT_MAC_STATS 273 274 extern __checkReturn efx_rc_t 275 ef10_mac_stats_update( 276 __in efx_nic_t *enp, 277 __in efsys_mem_t *esmp, 278 __inout_ecount(EFX_MAC_NSTATS) efsys_stat_t *stat, 279 __inout_opt uint32_t *generationp); 280 281 #endif /* EFSYS_OPT_MAC_STATS */ 282 283 284 /* MCDI */ 285 286 #if EFSYS_OPT_MCDI 287 288 extern __checkReturn efx_rc_t 289 ef10_mcdi_init( 290 __in efx_nic_t *enp, 291 __in const efx_mcdi_transport_t *mtp); 292 293 extern void 294 ef10_mcdi_fini( 295 __in efx_nic_t *enp); 296 297 extern void 298 ef10_mcdi_send_request( 299 __in efx_nic_t *enp, 300 __in void *hdrp, 301 __in size_t hdr_len, 302 __in void *sdup, 303 __in size_t sdu_len); 304 305 extern __checkReturn boolean_t 306 ef10_mcdi_poll_response( 307 __in efx_nic_t *enp); 308 309 extern void 310 ef10_mcdi_read_response( 311 __in efx_nic_t *enp, 312 __out_bcount(length) void *bufferp, 313 __in size_t offset, 314 __in size_t length); 315 316 extern efx_rc_t 317 ef10_mcdi_poll_reboot( 318 __in efx_nic_t *enp); 319 320 extern __checkReturn efx_rc_t 321 ef10_mcdi_feature_supported( 322 __in efx_nic_t *enp, 323 __in efx_mcdi_feature_id_t id, 324 __out boolean_t *supportedp); 325 326 #endif /* EFSYS_OPT_MCDI */ 327 328 /* NVRAM */ 329 330 #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD 331 332 extern __checkReturn efx_rc_t 333 ef10_nvram_buf_read_tlv( 334 __in efx_nic_t *enp, 335 __in_bcount(max_seg_size) caddr_t seg_data, 336 __in size_t max_seg_size, 337 __in uint32_t tag, 338 __deref_out_bcount_opt(*sizep) caddr_t *datap, 339 __out size_t *sizep); 340 341 extern __checkReturn efx_rc_t 342 ef10_nvram_buf_write_tlv( 343 __inout_bcount(partn_size) caddr_t partn_data, 344 __in size_t partn_size, 345 __in uint32_t tag, 346 __in_bcount(tag_size) caddr_t tag_data, 347 __in size_t tag_size, 348 __out size_t *total_lengthp); 349 350 extern __checkReturn efx_rc_t 351 ef10_nvram_partn_read_tlv( 352 __in efx_nic_t *enp, 353 __in uint32_t partn, 354 __in uint32_t tag, 355 __deref_out_bcount_opt(*sizep) caddr_t *datap, 356 __out size_t *sizep); 357 358 extern __checkReturn efx_rc_t 359 ef10_nvram_partn_write_tlv( 360 __in efx_nic_t *enp, 361 __in uint32_t partn, 362 __in uint32_t tag, 363 __in_bcount(size) caddr_t data, 364 __in size_t size); 365 366 extern __checkReturn efx_rc_t 367 ef10_nvram_partn_write_segment_tlv( 368 __in efx_nic_t *enp, 369 __in uint32_t partn, 370 __in uint32_t tag, 371 __in_bcount(size) caddr_t data, 372 __in size_t size, 373 __in boolean_t all_segments); 374 375 extern __checkReturn efx_rc_t 376 ef10_nvram_partn_lock( 377 __in efx_nic_t *enp, 378 __in uint32_t partn); 379 380 extern void 381 ef10_nvram_partn_unlock( 382 __in efx_nic_t *enp, 383 __in uint32_t partn); 384 385 #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */ 386 387 #if EFSYS_OPT_NVRAM 388 389 #if EFSYS_OPT_DIAG 390 391 extern __checkReturn efx_rc_t 392 ef10_nvram_test( 393 __in efx_nic_t *enp); 394 395 #endif /* EFSYS_OPT_DIAG */ 396 397 extern __checkReturn efx_rc_t 398 ef10_nvram_type_to_partn( 399 __in efx_nic_t *enp, 400 __in efx_nvram_type_t type, 401 __out uint32_t *partnp); 402 403 extern __checkReturn efx_rc_t 404 ef10_nvram_partn_size( 405 __in efx_nic_t *enp, 406 __in uint32_t partn, 407 __out size_t *sizep); 408 409 extern __checkReturn efx_rc_t 410 ef10_nvram_partn_rw_start( 411 __in efx_nic_t *enp, 412 __in uint32_t partn, 413 __out size_t *chunk_sizep); 414 415 extern __checkReturn efx_rc_t 416 ef10_nvram_partn_read_mode( 417 __in efx_nic_t *enp, 418 __in uint32_t partn, 419 __in unsigned int offset, 420 __out_bcount(size) caddr_t data, 421 __in size_t size, 422 __in uint32_t mode); 423 424 extern __checkReturn efx_rc_t 425 ef10_nvram_partn_read( 426 __in efx_nic_t *enp, 427 __in uint32_t partn, 428 __in unsigned int offset, 429 __out_bcount(size) caddr_t data, 430 __in size_t size); 431 432 extern __checkReturn efx_rc_t 433 ef10_nvram_partn_erase( 434 __in efx_nic_t *enp, 435 __in uint32_t partn, 436 __in unsigned int offset, 437 __in size_t size); 438 439 extern __checkReturn efx_rc_t 440 ef10_nvram_partn_write( 441 __in efx_nic_t *enp, 442 __in uint32_t partn, 443 __in unsigned int offset, 444 __out_bcount(size) caddr_t data, 445 __in size_t size); 446 447 extern void 448 ef10_nvram_partn_rw_finish( 449 __in efx_nic_t *enp, 450 __in uint32_t partn); 451 452 extern __checkReturn efx_rc_t 453 ef10_nvram_partn_get_version( 454 __in efx_nic_t *enp, 455 __in uint32_t partn, 456 __out uint32_t *subtypep, 457 __out_ecount(4) uint16_t version[4]); 458 459 extern __checkReturn efx_rc_t 460 ef10_nvram_partn_set_version( 461 __in efx_nic_t *enp, 462 __in uint32_t partn, 463 __in_ecount(4) uint16_t version[4]); 464 465 extern __checkReturn efx_rc_t 466 ef10_nvram_buffer_validate( 467 __in efx_nic_t *enp, 468 __in uint32_t partn, 469 __in_bcount(buffer_size) 470 caddr_t bufferp, 471 __in size_t buffer_size); 472 473 extern __checkReturn efx_rc_t 474 ef10_nvram_buffer_create( 475 __in efx_nic_t *enp, 476 __in uint16_t partn_type, 477 __in_bcount(buffer_size) 478 caddr_t bufferp, 479 __in size_t buffer_size); 480 481 extern __checkReturn efx_rc_t 482 ef10_nvram_buffer_find_item_start( 483 __in_bcount(buffer_size) 484 caddr_t bufferp, 485 __in size_t buffer_size, 486 __out uint32_t *startp 487 ); 488 489 extern __checkReturn efx_rc_t 490 ef10_nvram_buffer_find_end( 491 __in_bcount(buffer_size) 492 caddr_t bufferp, 493 __in size_t buffer_size, 494 __in uint32_t offset, 495 __out uint32_t *endp 496 ); 497 498 extern __checkReturn __success(return != B_FALSE) boolean_t 499 ef10_nvram_buffer_find_item( 500 __in_bcount(buffer_size) 501 caddr_t bufferp, 502 __in size_t buffer_size, 503 __in uint32_t offset, 504 __out uint32_t *startp, 505 __out uint32_t *lengthp 506 ); 507 508 extern __checkReturn efx_rc_t 509 ef10_nvram_buffer_get_item( 510 __in_bcount(buffer_size) 511 caddr_t bufferp, 512 __in size_t buffer_size, 513 __in uint32_t offset, 514 __in uint32_t length, 515 __out_bcount_part(item_max_size, *lengthp) 516 caddr_t itemp, 517 __in size_t item_max_size, 518 __out uint32_t *lengthp 519 ); 520 521 extern __checkReturn efx_rc_t 522 ef10_nvram_buffer_insert_item( 523 __in_bcount(buffer_size) 524 caddr_t bufferp, 525 __in size_t buffer_size, 526 __in uint32_t offset, 527 __in_bcount(length) caddr_t keyp, 528 __in uint32_t length, 529 __out uint32_t *lengthp 530 ); 531 532 extern __checkReturn efx_rc_t 533 ef10_nvram_buffer_delete_item( 534 __in_bcount(buffer_size) 535 caddr_t bufferp, 536 __in size_t buffer_size, 537 __in uint32_t offset, 538 __in uint32_t length, 539 __in uint32_t end 540 ); 541 542 extern __checkReturn efx_rc_t 543 ef10_nvram_buffer_finish( 544 __in_bcount(buffer_size) 545 caddr_t bufferp, 546 __in size_t buffer_size 547 ); 548 549 #endif /* EFSYS_OPT_NVRAM */ 550 551 552 /* PHY */ 553 554 typedef struct ef10_link_state_s { 555 uint32_t els_adv_cap_mask; 556 uint32_t els_lp_cap_mask; 557 unsigned int els_fcntl; 558 efx_link_mode_t els_link_mode; 559 #if EFSYS_OPT_LOOPBACK 560 efx_loopback_type_t els_loopback; 561 #endif 562 boolean_t els_mac_up; 563 } ef10_link_state_t; 564 565 extern void 566 ef10_phy_link_ev( 567 __in efx_nic_t *enp, 568 __in efx_qword_t *eqp, 569 __out efx_link_mode_t *link_modep); 570 571 extern __checkReturn efx_rc_t 572 ef10_phy_get_link( 573 __in efx_nic_t *enp, 574 __out ef10_link_state_t *elsp); 575 576 extern __checkReturn efx_rc_t 577 ef10_phy_power( 578 __in efx_nic_t *enp, 579 __in boolean_t on); 580 581 extern __checkReturn efx_rc_t 582 ef10_phy_reconfigure( 583 __in efx_nic_t *enp); 584 585 extern __checkReturn efx_rc_t 586 ef10_phy_verify( 587 __in efx_nic_t *enp); 588 589 extern __checkReturn efx_rc_t 590 ef10_phy_oui_get( 591 __in efx_nic_t *enp, 592 __out uint32_t *ouip); 593 594 #if EFSYS_OPT_PHY_STATS 595 596 extern __checkReturn efx_rc_t 597 ef10_phy_stats_update( 598 __in efx_nic_t *enp, 599 __in efsys_mem_t *esmp, 600 __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat); 601 602 #endif /* EFSYS_OPT_PHY_STATS */ 603 604 605 /* TX */ 606 607 extern __checkReturn efx_rc_t 608 ef10_tx_init( 609 __in efx_nic_t *enp); 610 611 extern void 612 ef10_tx_fini( 613 __in efx_nic_t *enp); 614 615 extern __checkReturn efx_rc_t 616 ef10_tx_qcreate( 617 __in efx_nic_t *enp, 618 __in unsigned int index, 619 __in unsigned int label, 620 __in efsys_mem_t *esmp, 621 __in size_t n, 622 __in uint32_t id, 623 __in uint16_t flags, 624 __in efx_evq_t *eep, 625 __in efx_txq_t *etp, 626 __out unsigned int *addedp); 627 628 extern void 629 ef10_tx_qdestroy( 630 __in efx_txq_t *etp); 631 632 extern __checkReturn efx_rc_t 633 ef10_tx_qpost( 634 __in efx_txq_t *etp, 635 __in_ecount(n) efx_buffer_t *eb, 636 __in unsigned int n, 637 __in unsigned int completed, 638 __inout unsigned int *addedp); 639 640 extern void 641 ef10_tx_qpush( 642 __in efx_txq_t *etp, 643 __in unsigned int added, 644 __in unsigned int pushed); 645 646 extern __checkReturn efx_rc_t 647 ef10_tx_qpace( 648 __in efx_txq_t *etp, 649 __in unsigned int ns); 650 651 extern __checkReturn efx_rc_t 652 ef10_tx_qflush( 653 __in efx_txq_t *etp); 654 655 extern void 656 ef10_tx_qenable( 657 __in efx_txq_t *etp); 658 659 extern __checkReturn efx_rc_t 660 ef10_tx_qpio_enable( 661 __in efx_txq_t *etp); 662 663 extern void 664 ef10_tx_qpio_disable( 665 __in efx_txq_t *etp); 666 667 extern __checkReturn efx_rc_t 668 ef10_tx_qpio_write( 669 __in efx_txq_t *etp, 670 __in_ecount(buf_length) uint8_t *buffer, 671 __in size_t buf_length, 672 __in size_t pio_buf_offset); 673 674 extern __checkReturn efx_rc_t 675 ef10_tx_qpio_post( 676 __in efx_txq_t *etp, 677 __in size_t pkt_length, 678 __in unsigned int completed, 679 __inout unsigned int *addedp); 680 681 extern __checkReturn efx_rc_t 682 ef10_tx_qdesc_post( 683 __in efx_txq_t *etp, 684 __in_ecount(n) efx_desc_t *ed, 685 __in unsigned int n, 686 __in unsigned int completed, 687 __inout unsigned int *addedp); 688 689 extern void 690 ef10_tx_qdesc_dma_create( 691 __in efx_txq_t *etp, 692 __in efsys_dma_addr_t addr, 693 __in size_t size, 694 __in boolean_t eop, 695 __out efx_desc_t *edp); 696 697 extern void 698 ef10_tx_qdesc_tso_create( 699 __in efx_txq_t *etp, 700 __in uint16_t ipv4_id, 701 __in uint32_t tcp_seq, 702 __in uint8_t tcp_flags, 703 __out efx_desc_t *edp); 704 705 extern void 706 ef10_tx_qdesc_tso2_create( 707 __in efx_txq_t *etp, 708 __in uint16_t ipv4_id, 709 __in uint32_t tcp_seq, 710 __in uint16_t tcp_mss, 711 __out_ecount(count) efx_desc_t *edp, 712 __in int count); 713 714 extern void 715 ef10_tx_qdesc_vlantci_create( 716 __in efx_txq_t *etp, 717 __in uint16_t vlan_tci, 718 __out efx_desc_t *edp); 719 720 721 #if EFSYS_OPT_QSTATS 722 723 extern void 724 ef10_tx_qstats_update( 725 __in efx_txq_t *etp, 726 __inout_ecount(TX_NQSTATS) efsys_stat_t *stat); 727 728 #endif /* EFSYS_OPT_QSTATS */ 729 730 typedef uint32_t efx_piobuf_handle_t; 731 732 #define EFX_PIOBUF_HANDLE_INVALID ((efx_piobuf_handle_t) -1) 733 734 extern __checkReturn efx_rc_t 735 ef10_nic_pio_alloc( 736 __inout efx_nic_t *enp, 737 __out uint32_t *bufnump, 738 __out efx_piobuf_handle_t *handlep, 739 __out uint32_t *blknump, 740 __out uint32_t *offsetp, 741 __out size_t *sizep); 742 743 extern __checkReturn efx_rc_t 744 ef10_nic_pio_free( 745 __inout efx_nic_t *enp, 746 __in uint32_t bufnum, 747 __in uint32_t blknum); 748 749 extern __checkReturn efx_rc_t 750 ef10_nic_pio_link( 751 __inout efx_nic_t *enp, 752 __in uint32_t vi_index, 753 __in efx_piobuf_handle_t handle); 754 755 extern __checkReturn efx_rc_t 756 ef10_nic_pio_unlink( 757 __inout efx_nic_t *enp, 758 __in uint32_t vi_index); 759 760 761 /* VPD */ 762 763 #if EFSYS_OPT_VPD 764 765 extern __checkReturn efx_rc_t 766 ef10_vpd_init( 767 __in efx_nic_t *enp); 768 769 extern __checkReturn efx_rc_t 770 ef10_vpd_size( 771 __in efx_nic_t *enp, 772 __out size_t *sizep); 773 774 extern __checkReturn efx_rc_t 775 ef10_vpd_read( 776 __in efx_nic_t *enp, 777 __out_bcount(size) caddr_t data, 778 __in size_t size); 779 780 extern __checkReturn efx_rc_t 781 ef10_vpd_verify( 782 __in efx_nic_t *enp, 783 __in_bcount(size) caddr_t data, 784 __in size_t size); 785 786 extern __checkReturn efx_rc_t 787 ef10_vpd_reinit( 788 __in efx_nic_t *enp, 789 __in_bcount(size) caddr_t data, 790 __in size_t size); 791 792 extern __checkReturn efx_rc_t 793 ef10_vpd_get( 794 __in efx_nic_t *enp, 795 __in_bcount(size) caddr_t data, 796 __in size_t size, 797 __inout efx_vpd_value_t *evvp); 798 799 extern __checkReturn efx_rc_t 800 ef10_vpd_set( 801 __in efx_nic_t *enp, 802 __in_bcount(size) caddr_t data, 803 __in size_t size, 804 __in efx_vpd_value_t *evvp); 805 806 extern __checkReturn efx_rc_t 807 ef10_vpd_next( 808 __in efx_nic_t *enp, 809 __in_bcount(size) caddr_t data, 810 __in size_t size, 811 __out efx_vpd_value_t *evvp, 812 __inout unsigned int *contp); 813 814 extern __checkReturn efx_rc_t 815 ef10_vpd_write( 816 __in efx_nic_t *enp, 817 __in_bcount(size) caddr_t data, 818 __in size_t size); 819 820 extern void 821 ef10_vpd_fini( 822 __in efx_nic_t *enp); 823 824 #endif /* EFSYS_OPT_VPD */ 825 826 827 /* RX */ 828 829 extern __checkReturn efx_rc_t 830 ef10_rx_init( 831 __in efx_nic_t *enp); 832 833 #if EFSYS_OPT_RX_SCATTER 834 extern __checkReturn efx_rc_t 835 ef10_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 ef10_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 ef10_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 ef10_rx_scale_tbl_set( 858 __in efx_nic_t *enp, 859 __in_ecount(n) unsigned int *table, 860 __in size_t n); 861 862 extern __checkReturn uint32_t 863 ef10_rx_prefix_hash( 864 __in efx_nic_t *enp, 865 __in efx_rx_hash_alg_t func, 866 __in uint8_t *buffer); 867 868 #endif /* EFSYS_OPT_RX_SCALE */ 869 870 extern __checkReturn efx_rc_t 871 ef10_rx_prefix_pktlen( 872 __in efx_nic_t *enp, 873 __in uint8_t *buffer, 874 __out uint16_t *lengthp); 875 876 extern void 877 ef10_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 ef10_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 ef10_rx_qflush( 893 __in efx_rxq_t *erp); 894 895 extern void 896 ef10_rx_qenable( 897 __in efx_rxq_t *erp); 898 899 extern __checkReturn efx_rc_t 900 ef10_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 ef10_rx_qdestroy( 913 __in efx_rxq_t *erp); 914 915 extern void 916 ef10_rx_fini( 917 __in efx_nic_t *enp); 918 919 #if EFSYS_OPT_FILTER 920 921 typedef struct ef10_filter_handle_s { 922 uint32_t efh_lo; 923 uint32_t efh_hi; 924 } ef10_filter_handle_t; 925 926 typedef struct ef10_filter_entry_s { 927 uintptr_t efe_spec; /* pointer to filter spec plus busy bit */ 928 ef10_filter_handle_t efe_handle; 929 } ef10_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_EF10_FILTER_FLAG_BUSY 1U 936 #define EFX_EF10_FILTER_FLAG_AUTO_OLD 2U 937 #define EFX_EF10_FILTER_FLAGS 3U 938 939 /* 940 * Size of the hash table used by the driver. Doesn't need to be the 941 * same size as the hardware's table. 942 */ 943 #define EFX_EF10_FILTER_TBL_ROWS 8192 944 945 /* Only need to allow for one directed and one unknown unicast filter */ 946 #define EFX_EF10_FILTER_UNICAST_FILTERS_MAX 2 947 948 /* Allow for the broadcast address to be added to the multicast list */ 949 #define EFX_EF10_FILTER_MULTICAST_FILTERS_MAX (EFX_MAC_MULTICAST_LIST_MAX + 1) 950 951 typedef struct ef10_filter_table_s { 952 ef10_filter_entry_t eft_entry[EFX_EF10_FILTER_TBL_ROWS]; 953 efx_rxq_t * eft_default_rxq; 954 boolean_t eft_using_rss; 955 uint32_t eft_unicst_filter_indexes[ 956 EFX_EF10_FILTER_UNICAST_FILTERS_MAX]; 957 boolean_t eft_unicst_filter_count; 958 uint32_t eft_mulcst_filter_indexes[ 959 EFX_EF10_FILTER_MULTICAST_FILTERS_MAX]; 960 uint32_t eft_mulcst_filter_count; 961 boolean_t eft_using_all_mulcst; 962 } ef10_filter_table_t; 963 964 __checkReturn efx_rc_t 965 ef10_filter_init( 966 __in efx_nic_t *enp); 967 968 void 969 ef10_filter_fini( 970 __in efx_nic_t *enp); 971 972 __checkReturn efx_rc_t 973 ef10_filter_restore( 974 __in efx_nic_t *enp); 975 976 __checkReturn efx_rc_t 977 ef10_filter_add( 978 __in efx_nic_t *enp, 979 __inout efx_filter_spec_t *spec, 980 __in boolean_t may_replace); 981 982 __checkReturn efx_rc_t 983 ef10_filter_delete( 984 __in efx_nic_t *enp, 985 __inout efx_filter_spec_t *spec); 986 987 extern __checkReturn efx_rc_t 988 ef10_filter_supported_filters( 989 __in efx_nic_t *enp, 990 __out uint32_t *list, 991 __out size_t *length); 992 993 extern __checkReturn efx_rc_t 994 ef10_filter_reconfigure( 995 __in efx_nic_t *enp, 996 __in_ecount(6) uint8_t const *mac_addr, 997 __in boolean_t all_unicst, 998 __in boolean_t mulcst, 999 __in boolean_t all_mulcst, 1000 __in boolean_t brdcst, 1001 __in_ecount(6*count) uint8_t const *addrs, 1002 __in uint32_t count); 1003 1004 extern void 1005 ef10_filter_get_default_rxq( 1006 __in efx_nic_t *enp, 1007 __out efx_rxq_t **erpp, 1008 __out boolean_t *using_rss); 1009 1010 extern void 1011 ef10_filter_default_rxq_set( 1012 __in efx_nic_t *enp, 1013 __in efx_rxq_t *erp, 1014 __in boolean_t using_rss); 1015 1016 extern void 1017 ef10_filter_default_rxq_clear( 1018 __in efx_nic_t *enp); 1019 1020 1021 #endif /* EFSYS_OPT_FILTER */ 1022 1023 extern __checkReturn efx_rc_t 1024 efx_mcdi_get_function_info( 1025 __in efx_nic_t *enp, 1026 __out uint32_t *pfp, 1027 __out_opt uint32_t *vfp); 1028 1029 extern __checkReturn efx_rc_t 1030 efx_mcdi_privilege_mask( 1031 __in efx_nic_t *enp, 1032 __in uint32_t pf, 1033 __in uint32_t vf, 1034 __out uint32_t *maskp); 1035 1036 extern __checkReturn efx_rc_t 1037 efx_mcdi_get_port_assignment( 1038 __in efx_nic_t *enp, 1039 __out uint32_t *portp); 1040 1041 extern __checkReturn efx_rc_t 1042 efx_mcdi_get_port_modes( 1043 __in efx_nic_t *enp, 1044 __out uint32_t *modesp, 1045 __out_opt uint32_t *current_modep); 1046 1047 extern __checkReturn efx_rc_t 1048 ef10_nic_get_port_mode_bandwidth( 1049 __in uint32_t port_mode, 1050 __out uint32_t *bandwidth_mbpsp); 1051 1052 extern __checkReturn efx_rc_t 1053 efx_mcdi_get_mac_address_pf( 1054 __in efx_nic_t *enp, 1055 __out_ecount_opt(6) uint8_t mac_addrp[6]); 1056 1057 extern __checkReturn efx_rc_t 1058 efx_mcdi_get_mac_address_vf( 1059 __in efx_nic_t *enp, 1060 __out_ecount_opt(6) uint8_t mac_addrp[6]); 1061 1062 extern __checkReturn efx_rc_t 1063 efx_mcdi_get_clock( 1064 __in efx_nic_t *enp, 1065 __out uint32_t *sys_freqp, 1066 __out uint32_t *dpcpu_freqp); 1067 1068 1069 extern __checkReturn efx_rc_t 1070 efx_mcdi_get_vector_cfg( 1071 __in efx_nic_t *enp, 1072 __out_opt uint32_t *vec_basep, 1073 __out_opt uint32_t *pf_nvecp, 1074 __out_opt uint32_t *vf_nvecp); 1075 1076 extern __checkReturn efx_rc_t 1077 ef10_get_datapath_caps( 1078 __in efx_nic_t *enp); 1079 1080 extern __checkReturn efx_rc_t 1081 ef10_get_privilege_mask( 1082 __in efx_nic_t *enp, 1083 __out uint32_t *maskp); 1084 1085 extern __checkReturn efx_rc_t 1086 ef10_external_port_mapping( 1087 __in efx_nic_t *enp, 1088 __in uint32_t port, 1089 __out uint8_t *external_portp); 1090 1091 1092 #ifdef __cplusplus 1093 } 1094 #endif 1095 1096 #endif /* _SYS_EF10_IMPL_H */ 1097