2 * Copyright (c) 2006-2016 Solarflare Communications Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
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.
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.
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.
35 #include "efx_check.h"
36 #include "efx_phy_ids.h"
42 #define EFX_STATIC_ASSERT(_cond) \
43 ((void)sizeof(char[(_cond) ? 1 : -1]))
45 #define EFX_ARRAY_SIZE(_array) \
46 (sizeof(_array) / sizeof((_array)[0]))
48 #define EFX_FIELD_OFFSET(_type, _field) \
49 ((size_t) &(((_type *)0)->_field))
51 /* The macro expands divider twice */
52 #define EFX_DIV_ROUND_UP(_n, _d) (((_n) + (_d) - 1) / (_d))
56 typedef __success(return == 0) int efx_rc_t;
61 typedef enum efx_family_e {
63 EFX_FAMILY_FALCON, /* Obsolete and not supported */
65 EFX_FAMILY_HUNTINGTON,
70 extern __checkReturn efx_rc_t
74 __out efx_family_t *efp);
77 #define EFX_PCI_VENID_SFC 0x1924
79 #define EFX_PCI_DEVID_FALCON 0x0710 /* SFC4000 */
81 #define EFX_PCI_DEVID_BETHPAGE 0x0803 /* SFC9020 */
82 #define EFX_PCI_DEVID_SIENA 0x0813 /* SFL9021 */
83 #define EFX_PCI_DEVID_SIENA_F1_UNINIT 0x0810
85 #define EFX_PCI_DEVID_HUNTINGTON_PF_UNINIT 0x0901
86 #define EFX_PCI_DEVID_FARMINGDALE 0x0903 /* SFC9120 PF */
87 #define EFX_PCI_DEVID_GREENPORT 0x0923 /* SFC9140 PF */
89 #define EFX_PCI_DEVID_FARMINGDALE_VF 0x1903 /* SFC9120 VF */
90 #define EFX_PCI_DEVID_GREENPORT_VF 0x1923 /* SFC9140 VF */
92 #define EFX_PCI_DEVID_MEDFORD_PF_UNINIT 0x0913
93 #define EFX_PCI_DEVID_MEDFORD 0x0A03 /* SFC9240 PF */
94 #define EFX_PCI_DEVID_MEDFORD_VF 0x1A03 /* SFC9240 VF */
103 EFX_ERR_BUFID_DC_OOB,
116 /* Calculate the IEEE 802.3 CRC32 of a MAC addr */
117 extern __checkReturn uint32_t
119 __in uint32_t crc_init,
120 __in_ecount(length) uint8_t const *input,
124 /* Type prototypes */
126 typedef struct efx_rxq_s efx_rxq_t;
130 typedef struct efx_nic_s efx_nic_t;
132 extern __checkReturn efx_rc_t
134 __in efx_family_t family,
135 __in efsys_identifier_t *esip,
136 __in efsys_bar_t *esbp,
137 __in efsys_lock_t *eslp,
138 __deref_out efx_nic_t **enpp);
140 extern __checkReturn efx_rc_t
142 __in efx_nic_t *enp);
144 extern __checkReturn efx_rc_t
146 __in efx_nic_t *enp);
148 extern __checkReturn efx_rc_t
150 __in efx_nic_t *enp);
154 extern __checkReturn efx_rc_t
155 efx_nic_register_test(
156 __in efx_nic_t *enp);
158 #endif /* EFSYS_OPT_DIAG */
162 __in efx_nic_t *enp);
166 __in efx_nic_t *enp);
170 __in efx_nic_t *enp);
172 #define EFX_PCIE_LINK_SPEED_GEN1 1
173 #define EFX_PCIE_LINK_SPEED_GEN2 2
174 #define EFX_PCIE_LINK_SPEED_GEN3 3
176 typedef enum efx_pcie_link_performance_e {
177 EFX_PCIE_LINK_PERFORMANCE_UNKNOWN_BANDWIDTH,
178 EFX_PCIE_LINK_PERFORMANCE_SUBOPTIMAL_BANDWIDTH,
179 EFX_PCIE_LINK_PERFORMANCE_SUBOPTIMAL_LATENCY,
180 EFX_PCIE_LINK_PERFORMANCE_OPTIMAL
181 } efx_pcie_link_performance_t;
183 extern __checkReturn efx_rc_t
184 efx_nic_calculate_pcie_link_bandwidth(
185 __in uint32_t pcie_link_width,
186 __in uint32_t pcie_link_gen,
187 __out uint32_t *bandwidth_mbpsp);
189 extern __checkReturn efx_rc_t
190 efx_nic_check_pcie_link_speed(
192 __in uint32_t pcie_link_width,
193 __in uint32_t pcie_link_gen,
194 __out efx_pcie_link_performance_t *resultp);
198 #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
199 /* Huntington and Medford require MCDIv2 commands */
200 #define WITH_MCDI_V2 1
203 typedef struct efx_mcdi_req_s efx_mcdi_req_t;
205 typedef enum efx_mcdi_exception_e {
206 EFX_MCDI_EXCEPTION_MC_REBOOT,
207 EFX_MCDI_EXCEPTION_MC_BADASSERT,
208 } efx_mcdi_exception_t;
210 #if EFSYS_OPT_MCDI_LOGGING
211 typedef enum efx_log_msg_e {
213 EFX_LOG_MCDI_REQUEST,
214 EFX_LOG_MCDI_RESPONSE,
216 #endif /* EFSYS_OPT_MCDI_LOGGING */
218 typedef struct efx_mcdi_transport_s {
220 efsys_mem_t *emt_dma_mem;
221 void (*emt_execute)(void *, efx_mcdi_req_t *);
222 void (*emt_ev_cpl)(void *);
223 void (*emt_exception)(void *, efx_mcdi_exception_t);
224 #if EFSYS_OPT_MCDI_LOGGING
225 void (*emt_logger)(void *, efx_log_msg_t,
226 void *, size_t, void *, size_t);
227 #endif /* EFSYS_OPT_MCDI_LOGGING */
228 #if EFSYS_OPT_MCDI_PROXY_AUTH
229 void (*emt_ev_proxy_response)(void *, uint32_t, efx_rc_t);
230 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH */
231 } efx_mcdi_transport_t;
233 extern __checkReturn efx_rc_t
236 __in const efx_mcdi_transport_t *mtp);
238 extern __checkReturn efx_rc_t
240 __in efx_nic_t *enp);
244 __in efx_nic_t *enp);
247 efx_mcdi_get_timeout(
249 __in efx_mcdi_req_t *emrp,
250 __out uint32_t *usec_timeoutp);
253 efx_mcdi_request_start(
255 __in efx_mcdi_req_t *emrp,
256 __in boolean_t ev_cpl);
258 extern __checkReturn boolean_t
259 efx_mcdi_request_poll(
260 __in efx_nic_t *enp);
262 extern __checkReturn boolean_t
263 efx_mcdi_request_abort(
264 __in efx_nic_t *enp);
268 __in efx_nic_t *enp);
270 #endif /* EFSYS_OPT_MCDI */
274 #define EFX_NINTR_SIENA 1024
276 typedef enum efx_intr_type_e {
277 EFX_INTR_INVALID = 0,
283 #define EFX_INTR_SIZE (sizeof (efx_oword_t))
285 extern __checkReturn efx_rc_t
288 __in efx_intr_type_t type,
289 __in efsys_mem_t *esmp);
293 __in efx_nic_t *enp);
297 __in efx_nic_t *enp);
300 efx_intr_disable_unlocked(
301 __in efx_nic_t *enp);
303 #define EFX_INTR_NEVQS 32
305 extern __checkReturn efx_rc_t
308 __in unsigned int level);
311 efx_intr_status_line(
313 __out boolean_t *fatalp,
314 __out uint32_t *maskp);
317 efx_intr_status_message(
319 __in unsigned int message,
320 __out boolean_t *fatalp);
324 __in efx_nic_t *enp);
328 __in efx_nic_t *enp);
332 #if EFSYS_OPT_MAC_STATS
334 /* START MKCONFIG GENERATED EfxHeaderMacBlock e323546097fd7c65 */
335 typedef enum efx_mac_stat_e {
338 EFX_MAC_RX_UNICST_PKTS,
339 EFX_MAC_RX_MULTICST_PKTS,
340 EFX_MAC_RX_BRDCST_PKTS,
341 EFX_MAC_RX_PAUSE_PKTS,
342 EFX_MAC_RX_LE_64_PKTS,
343 EFX_MAC_RX_65_TO_127_PKTS,
344 EFX_MAC_RX_128_TO_255_PKTS,
345 EFX_MAC_RX_256_TO_511_PKTS,
346 EFX_MAC_RX_512_TO_1023_PKTS,
347 EFX_MAC_RX_1024_TO_15XX_PKTS,
348 EFX_MAC_RX_GE_15XX_PKTS,
350 EFX_MAC_RX_FCS_ERRORS,
351 EFX_MAC_RX_DROP_EVENTS,
352 EFX_MAC_RX_FALSE_CARRIER_ERRORS,
353 EFX_MAC_RX_SYMBOL_ERRORS,
354 EFX_MAC_RX_ALIGN_ERRORS,
355 EFX_MAC_RX_INTERNAL_ERRORS,
356 EFX_MAC_RX_JABBER_PKTS,
357 EFX_MAC_RX_LANE0_CHAR_ERR,
358 EFX_MAC_RX_LANE1_CHAR_ERR,
359 EFX_MAC_RX_LANE2_CHAR_ERR,
360 EFX_MAC_RX_LANE3_CHAR_ERR,
361 EFX_MAC_RX_LANE0_DISP_ERR,
362 EFX_MAC_RX_LANE1_DISP_ERR,
363 EFX_MAC_RX_LANE2_DISP_ERR,
364 EFX_MAC_RX_LANE3_DISP_ERR,
365 EFX_MAC_RX_MATCH_FAULT,
366 EFX_MAC_RX_NODESC_DROP_CNT,
369 EFX_MAC_TX_UNICST_PKTS,
370 EFX_MAC_TX_MULTICST_PKTS,
371 EFX_MAC_TX_BRDCST_PKTS,
372 EFX_MAC_TX_PAUSE_PKTS,
373 EFX_MAC_TX_LE_64_PKTS,
374 EFX_MAC_TX_65_TO_127_PKTS,
375 EFX_MAC_TX_128_TO_255_PKTS,
376 EFX_MAC_TX_256_TO_511_PKTS,
377 EFX_MAC_TX_512_TO_1023_PKTS,
378 EFX_MAC_TX_1024_TO_15XX_PKTS,
379 EFX_MAC_TX_GE_15XX_PKTS,
381 EFX_MAC_TX_SGL_COL_PKTS,
382 EFX_MAC_TX_MULT_COL_PKTS,
383 EFX_MAC_TX_EX_COL_PKTS,
384 EFX_MAC_TX_LATE_COL_PKTS,
386 EFX_MAC_TX_EX_DEF_PKTS,
387 EFX_MAC_PM_TRUNC_BB_OVERFLOW,
388 EFX_MAC_PM_DISCARD_BB_OVERFLOW,
389 EFX_MAC_PM_TRUNC_VFIFO_FULL,
390 EFX_MAC_PM_DISCARD_VFIFO_FULL,
391 EFX_MAC_PM_TRUNC_QBB,
392 EFX_MAC_PM_DISCARD_QBB,
393 EFX_MAC_PM_DISCARD_MAPPING,
394 EFX_MAC_RXDP_Q_DISABLED_PKTS,
395 EFX_MAC_RXDP_DI_DROPPED_PKTS,
396 EFX_MAC_RXDP_STREAMING_PKTS,
397 EFX_MAC_RXDP_HLB_FETCH,
398 EFX_MAC_RXDP_HLB_WAIT,
399 EFX_MAC_VADAPTER_RX_UNICAST_PACKETS,
400 EFX_MAC_VADAPTER_RX_UNICAST_BYTES,
401 EFX_MAC_VADAPTER_RX_MULTICAST_PACKETS,
402 EFX_MAC_VADAPTER_RX_MULTICAST_BYTES,
403 EFX_MAC_VADAPTER_RX_BROADCAST_PACKETS,
404 EFX_MAC_VADAPTER_RX_BROADCAST_BYTES,
405 EFX_MAC_VADAPTER_RX_BAD_PACKETS,
406 EFX_MAC_VADAPTER_RX_BAD_BYTES,
407 EFX_MAC_VADAPTER_RX_OVERFLOW,
408 EFX_MAC_VADAPTER_TX_UNICAST_PACKETS,
409 EFX_MAC_VADAPTER_TX_UNICAST_BYTES,
410 EFX_MAC_VADAPTER_TX_MULTICAST_PACKETS,
411 EFX_MAC_VADAPTER_TX_MULTICAST_BYTES,
412 EFX_MAC_VADAPTER_TX_BROADCAST_PACKETS,
413 EFX_MAC_VADAPTER_TX_BROADCAST_BYTES,
414 EFX_MAC_VADAPTER_TX_BAD_PACKETS,
415 EFX_MAC_VADAPTER_TX_BAD_BYTES,
416 EFX_MAC_VADAPTER_TX_OVERFLOW,
420 /* END MKCONFIG GENERATED EfxHeaderMacBlock */
422 #endif /* EFSYS_OPT_MAC_STATS */
424 typedef enum efx_link_mode_e {
425 EFX_LINK_UNKNOWN = 0,
438 #define EFX_MAC_ADDR_LEN 6
440 #define EFX_MAC_ADDR_IS_MULTICAST(_address) (((uint8_t *)_address)[0] & 0x01)
442 #define EFX_MAC_MULTICAST_LIST_MAX 256
444 #define EFX_MAC_SDU_MAX 9202
446 #define EFX_MAC_PDU_ADJUSTMENT \
450 + /* bug16011 */ 16) \
452 #define EFX_MAC_PDU(_sdu) \
453 P2ROUNDUP((_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8)
456 * Due to the P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give
457 * the SDU rounded up slightly.
459 #define EFX_MAC_SDU_FROM_PDU(_pdu) ((_pdu) - EFX_MAC_PDU_ADJUSTMENT)
461 #define EFX_MAC_PDU_MIN 60
462 #define EFX_MAC_PDU_MAX EFX_MAC_PDU(EFX_MAC_SDU_MAX)
464 extern __checkReturn efx_rc_t
469 extern __checkReturn efx_rc_t
474 extern __checkReturn efx_rc_t
479 extern __checkReturn efx_rc_t
482 __in boolean_t all_unicst,
483 __in boolean_t mulcst,
484 __in boolean_t all_mulcst,
485 __in boolean_t brdcst);
487 extern __checkReturn efx_rc_t
488 efx_mac_multicast_list_set(
490 __in_ecount(6*count) uint8_t const *addrs,
493 extern __checkReturn efx_rc_t
494 efx_mac_filter_default_rxq_set(
497 __in boolean_t using_rss);
500 efx_mac_filter_default_rxq_clear(
501 __in efx_nic_t *enp);
503 extern __checkReturn efx_rc_t
506 __in boolean_t enabled);
508 extern __checkReturn efx_rc_t
511 __out boolean_t *mac_upp);
513 #define EFX_FCNTL_RESPOND 0x00000001
514 #define EFX_FCNTL_GENERATE 0x00000002
516 extern __checkReturn efx_rc_t
519 __in unsigned int fcntl,
520 __in boolean_t autoneg);
525 __out unsigned int *fcntl_wantedp,
526 __out unsigned int *fcntl_linkp);
529 #if EFSYS_OPT_MAC_STATS
533 extern __checkReturn const char *
536 __in unsigned int id);
538 #endif /* EFSYS_OPT_NAMES */
540 #define EFX_MAC_STATS_MASK_BITS_PER_PAGE (8 * sizeof (uint32_t))
542 #define EFX_MAC_STATS_MASK_NPAGES \
543 (P2ROUNDUP(EFX_MAC_NSTATS, EFX_MAC_STATS_MASK_BITS_PER_PAGE) / \
544 EFX_MAC_STATS_MASK_BITS_PER_PAGE)
547 * Get mask of MAC statistics supported by the hardware.
549 * If mask_size is insufficient to return the mask, EINVAL error is
550 * returned. EFX_MAC_STATS_MASK_NPAGES multiplied by size of the page
551 * (which is sizeof (uint32_t)) is sufficient.
553 extern __checkReturn efx_rc_t
554 efx_mac_stats_get_mask(
556 __out_bcount(mask_size) uint32_t *maskp,
557 __in size_t mask_size);
559 #define EFX_MAC_STAT_SUPPORTED(_mask, _stat) \
560 ((_mask)[(_stat) / EFX_MAC_STATS_MASK_BITS_PER_PAGE] & \
561 (1ULL << ((_stat) & (EFX_MAC_STATS_MASK_BITS_PER_PAGE - 1))))
563 #define EFX_MAC_STATS_SIZE 0x400
565 extern __checkReturn efx_rc_t
567 __in efx_nic_t *enp);
570 * Upload mac statistics supported by the hardware into the given buffer.
572 * The reference buffer must be at least %EFX_MAC_STATS_SIZE bytes,
575 * The hardware will only DMA statistics that it understands (of course).
576 * Drivers should not make any assumptions about which statistics are
577 * supported, especially when the statistics are generated by firmware.
579 * Thus, drivers should zero this buffer before use, so that not-understood
580 * statistics read back as zero.
582 extern __checkReturn efx_rc_t
583 efx_mac_stats_upload(
585 __in efsys_mem_t *esmp);
587 extern __checkReturn efx_rc_t
588 efx_mac_stats_periodic(
590 __in efsys_mem_t *esmp,
591 __in uint16_t period_ms,
592 __in boolean_t events);
594 extern __checkReturn efx_rc_t
595 efx_mac_stats_update(
597 __in efsys_mem_t *esmp,
598 __inout_ecount(EFX_MAC_NSTATS) efsys_stat_t *stat,
599 __inout_opt uint32_t *generationp);
601 #endif /* EFSYS_OPT_MAC_STATS */
605 typedef enum efx_mon_type_e {
617 __in efx_nic_t *enp);
619 #endif /* EFSYS_OPT_NAMES */
621 extern __checkReturn efx_rc_t
623 __in efx_nic_t *enp);
625 #if EFSYS_OPT_MON_STATS
627 #define EFX_MON_STATS_PAGE_SIZE 0x100
628 #define EFX_MON_MASK_ELEMENT_SIZE 32
630 /* START MKCONFIG GENERATED MonitorHeaderStatsBlock 5d4ee5185e419abe */
631 typedef enum efx_mon_stat_e {
638 EFX_MON_STAT_EXT_TEMP,
639 EFX_MON_STAT_INT_TEMP,
642 EFX_MON_STAT_INT_COOLING,
643 EFX_MON_STAT_EXT_COOLING,
651 EFX_MON_STAT_AOE_TEMP,
652 EFX_MON_STAT_PSU_AOE_TEMP,
653 EFX_MON_STAT_PSU_TEMP,
659 EFX_MON_STAT_VAOE_IN,
661 EFX_MON_STAT_IAOE_IN,
662 EFX_MON_STAT_NIC_POWER,
666 EFX_MON_STAT_0_9V_ADC,
667 EFX_MON_STAT_INT_TEMP2,
668 EFX_MON_STAT_VREG_TEMP,
669 EFX_MON_STAT_VREG_0_9V_TEMP,
670 EFX_MON_STAT_VREG_1_2V_TEMP,
671 EFX_MON_STAT_INT_VPTAT,
672 EFX_MON_STAT_INT_ADC_TEMP,
673 EFX_MON_STAT_EXT_VPTAT,
674 EFX_MON_STAT_EXT_ADC_TEMP,
675 EFX_MON_STAT_AMBIENT_TEMP,
676 EFX_MON_STAT_AIRFLOW,
677 EFX_MON_STAT_VDD08D_VSS08D_CSR,
678 EFX_MON_STAT_VDD08D_VSS08D_CSR_EXTADC,
679 EFX_MON_STAT_HOTPOINT_TEMP,
680 EFX_MON_STAT_PHY_POWER_SWITCH_PORT0,
681 EFX_MON_STAT_PHY_POWER_SWITCH_PORT1,
682 EFX_MON_STAT_MUM_VCC,
685 EFX_MON_STAT_0V9_A_TEMP,
688 EFX_MON_STAT_0V9_B_TEMP,
689 EFX_MON_STAT_CCOM_AVREG_1V2_SUPPLY,
690 EFX_MON_STAT_CCOM_AVREG_1V2_SUPPLY_EXT_ADC,
691 EFX_MON_STAT_CCOM_AVREG_1V8_SUPPLY,
692 EFX_MON_STAT_CCOM_AVREG_1V8_SUPPLY_EXT_ADC,
693 EFX_MON_STAT_CONTROLLER_MASTER_VPTAT,
694 EFX_MON_STAT_CONTROLLER_MASTER_INTERNAL_TEMP,
695 EFX_MON_STAT_CONTROLLER_MASTER_VPTAT_EXT_ADC,
696 EFX_MON_STAT_CONTROLLER_MASTER_INTERNAL_TEMP_EXT_ADC,
697 EFX_MON_STAT_CONTROLLER_SLAVE_VPTAT,
698 EFX_MON_STAT_CONTROLLER_SLAVE_INTERNAL_TEMP,
699 EFX_MON_STAT_CONTROLLER_SLAVE_VPTAT_EXT_ADC,
700 EFX_MON_STAT_CONTROLLER_SLAVE_INTERNAL_TEMP_EXT_ADC,
701 EFX_MON_STAT_SODIMM_VOUT,
702 EFX_MON_STAT_SODIMM_0_TEMP,
703 EFX_MON_STAT_SODIMM_1_TEMP,
704 EFX_MON_STAT_PHY0_VCC,
705 EFX_MON_STAT_PHY1_VCC,
706 EFX_MON_STAT_CONTROLLER_TDIODE_TEMP,
707 EFX_MON_STAT_BOARD_FRONT_TEMP,
708 EFX_MON_STAT_BOARD_BACK_TEMP,
712 /* END MKCONFIG GENERATED MonitorHeaderStatsBlock */
714 typedef enum efx_mon_stat_state_e {
715 EFX_MON_STAT_STATE_OK = 0,
716 EFX_MON_STAT_STATE_WARNING = 1,
717 EFX_MON_STAT_STATE_FATAL = 2,
718 EFX_MON_STAT_STATE_BROKEN = 3,
719 EFX_MON_STAT_STATE_NO_READING = 4,
720 } efx_mon_stat_state_t;
722 typedef struct efx_mon_stat_value_s {
725 } efx_mon_stat_value_t;
732 __in efx_mon_stat_t id);
734 #endif /* EFSYS_OPT_NAMES */
736 extern __checkReturn efx_rc_t
737 efx_mon_stats_update(
739 __in efsys_mem_t *esmp,
740 __inout_ecount(EFX_MON_NSTATS) efx_mon_stat_value_t *values);
742 #endif /* EFSYS_OPT_MON_STATS */
746 __in efx_nic_t *enp);
750 extern __checkReturn efx_rc_t
752 __in efx_nic_t *enp);
754 #if EFSYS_OPT_PHY_LED_CONTROL
756 typedef enum efx_phy_led_mode_e {
757 EFX_PHY_LED_DEFAULT = 0,
762 } efx_phy_led_mode_t;
764 extern __checkReturn efx_rc_t
767 __in efx_phy_led_mode_t mode);
769 #endif /* EFSYS_OPT_PHY_LED_CONTROL */
771 extern __checkReturn efx_rc_t
773 __in efx_nic_t *enp);
775 #if EFSYS_OPT_LOOPBACK
777 typedef enum efx_loopback_type_e {
778 EFX_LOOPBACK_OFF = 0,
779 EFX_LOOPBACK_DATA = 1,
780 EFX_LOOPBACK_GMAC = 2,
781 EFX_LOOPBACK_XGMII = 3,
782 EFX_LOOPBACK_XGXS = 4,
783 EFX_LOOPBACK_XAUI = 5,
784 EFX_LOOPBACK_GMII = 6,
785 EFX_LOOPBACK_SGMII = 7,
786 EFX_LOOPBACK_XGBR = 8,
787 EFX_LOOPBACK_XFI = 9,
788 EFX_LOOPBACK_XAUI_FAR = 10,
789 EFX_LOOPBACK_GMII_FAR = 11,
790 EFX_LOOPBACK_SGMII_FAR = 12,
791 EFX_LOOPBACK_XFI_FAR = 13,
792 EFX_LOOPBACK_GPHY = 14,
793 EFX_LOOPBACK_PHY_XS = 15,
794 EFX_LOOPBACK_PCS = 16,
795 EFX_LOOPBACK_PMA_PMD = 17,
796 EFX_LOOPBACK_XPORT = 18,
797 EFX_LOOPBACK_XGMII_WS = 19,
798 EFX_LOOPBACK_XAUI_WS = 20,
799 EFX_LOOPBACK_XAUI_WS_FAR = 21,
800 EFX_LOOPBACK_XAUI_WS_NEAR = 22,
801 EFX_LOOPBACK_GMII_WS = 23,
802 EFX_LOOPBACK_XFI_WS = 24,
803 EFX_LOOPBACK_XFI_WS_FAR = 25,
804 EFX_LOOPBACK_PHYXS_WS = 26,
805 EFX_LOOPBACK_PMA_INT = 27,
806 EFX_LOOPBACK_SD_NEAR = 28,
807 EFX_LOOPBACK_SD_FAR = 29,
808 EFX_LOOPBACK_PMA_INT_WS = 30,
809 EFX_LOOPBACK_SD_FEP2_WS = 31,
810 EFX_LOOPBACK_SD_FEP1_5_WS = 32,
811 EFX_LOOPBACK_SD_FEP_WS = 33,
812 EFX_LOOPBACK_SD_FES_WS = 34,
814 } efx_loopback_type_t;
816 typedef enum efx_loopback_kind_e {
817 EFX_LOOPBACK_KIND_OFF = 0,
818 EFX_LOOPBACK_KIND_ALL,
819 EFX_LOOPBACK_KIND_MAC,
820 EFX_LOOPBACK_KIND_PHY,
822 } efx_loopback_kind_t;
826 __in efx_loopback_kind_t loopback_kind,
827 __out efx_qword_t *maskp);
829 extern __checkReturn efx_rc_t
830 efx_port_loopback_set(
832 __in efx_link_mode_t link_mode,
833 __in efx_loopback_type_t type);
837 extern __checkReturn const char *
838 efx_loopback_type_name(
840 __in efx_loopback_type_t type);
842 #endif /* EFSYS_OPT_NAMES */
844 #endif /* EFSYS_OPT_LOOPBACK */
846 extern __checkReturn efx_rc_t
849 __out_opt efx_link_mode_t *link_modep);
853 __in efx_nic_t *enp);
855 typedef enum efx_phy_cap_type_e {
856 EFX_PHY_CAP_INVALID = 0,
863 EFX_PHY_CAP_10000FDX,
867 EFX_PHY_CAP_40000FDX,
869 } efx_phy_cap_type_t;
872 #define EFX_PHY_CAP_CURRENT 0x00000000
873 #define EFX_PHY_CAP_DEFAULT 0x00000001
874 #define EFX_PHY_CAP_PERM 0x00000002
880 __out uint32_t *maskp);
882 extern __checkReturn efx_rc_t
890 __out uint32_t *maskp);
892 extern __checkReturn efx_rc_t
895 __out uint32_t *ouip);
897 typedef enum efx_phy_media_type_e {
898 EFX_PHY_MEDIA_INVALID = 0,
903 EFX_PHY_MEDIA_SFP_PLUS,
904 EFX_PHY_MEDIA_BASE_T,
905 EFX_PHY_MEDIA_QSFP_PLUS,
907 } efx_phy_media_type_t;
909 /* Get the type of medium currently used. If the board has ports for
910 * modules, a module is present, and we recognise the media type of
911 * the module, then this will be the media type of the module.
912 * Otherwise it will be the media type of the port.
915 efx_phy_media_type_get(
917 __out efx_phy_media_type_t *typep);
919 extern __checkReturn efx_rc_t
920 efx_phy_module_get_info(
922 __in uint8_t dev_addr,
925 __out_bcount(len) uint8_t *data);
927 #if EFSYS_OPT_PHY_STATS
929 /* START MKCONFIG GENERATED PhyHeaderStatsBlock 30ed56ad501f8e36 */
930 typedef enum efx_phy_stat_e {
932 EFX_PHY_STAT_PMA_PMD_LINK_UP,
933 EFX_PHY_STAT_PMA_PMD_RX_FAULT,
934 EFX_PHY_STAT_PMA_PMD_TX_FAULT,
935 EFX_PHY_STAT_PMA_PMD_REV_A,
936 EFX_PHY_STAT_PMA_PMD_REV_B,
937 EFX_PHY_STAT_PMA_PMD_REV_C,
938 EFX_PHY_STAT_PMA_PMD_REV_D,
939 EFX_PHY_STAT_PCS_LINK_UP,
940 EFX_PHY_STAT_PCS_RX_FAULT,
941 EFX_PHY_STAT_PCS_TX_FAULT,
942 EFX_PHY_STAT_PCS_BER,
943 EFX_PHY_STAT_PCS_BLOCK_ERRORS,
944 EFX_PHY_STAT_PHY_XS_LINK_UP,
945 EFX_PHY_STAT_PHY_XS_RX_FAULT,
946 EFX_PHY_STAT_PHY_XS_TX_FAULT,
947 EFX_PHY_STAT_PHY_XS_ALIGN,
948 EFX_PHY_STAT_PHY_XS_SYNC_A,
949 EFX_PHY_STAT_PHY_XS_SYNC_B,
950 EFX_PHY_STAT_PHY_XS_SYNC_C,
951 EFX_PHY_STAT_PHY_XS_SYNC_D,
952 EFX_PHY_STAT_AN_LINK_UP,
953 EFX_PHY_STAT_AN_MASTER,
954 EFX_PHY_STAT_AN_LOCAL_RX_OK,
955 EFX_PHY_STAT_AN_REMOTE_RX_OK,
956 EFX_PHY_STAT_CL22EXT_LINK_UP,
961 EFX_PHY_STAT_PMA_PMD_SIGNAL_A,
962 EFX_PHY_STAT_PMA_PMD_SIGNAL_B,
963 EFX_PHY_STAT_PMA_PMD_SIGNAL_C,
964 EFX_PHY_STAT_PMA_PMD_SIGNAL_D,
965 EFX_PHY_STAT_AN_COMPLETE,
966 EFX_PHY_STAT_PMA_PMD_REV_MAJOR,
967 EFX_PHY_STAT_PMA_PMD_REV_MINOR,
968 EFX_PHY_STAT_PMA_PMD_REV_MICRO,
969 EFX_PHY_STAT_PCS_FW_VERSION_0,
970 EFX_PHY_STAT_PCS_FW_VERSION_1,
971 EFX_PHY_STAT_PCS_FW_VERSION_2,
972 EFX_PHY_STAT_PCS_FW_VERSION_3,
973 EFX_PHY_STAT_PCS_FW_BUILD_YY,
974 EFX_PHY_STAT_PCS_FW_BUILD_MM,
975 EFX_PHY_STAT_PCS_FW_BUILD_DD,
976 EFX_PHY_STAT_PCS_OP_MODE,
980 /* END MKCONFIG GENERATED PhyHeaderStatsBlock */
987 __in efx_phy_stat_t stat);
989 #endif /* EFSYS_OPT_NAMES */
991 #define EFX_PHY_STATS_SIZE 0x100
993 extern __checkReturn efx_rc_t
994 efx_phy_stats_update(
996 __in efsys_mem_t *esmp,
997 __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat);
999 #endif /* EFSYS_OPT_PHY_STATS */
1004 typedef enum efx_bist_type_e {
1005 EFX_BIST_TYPE_UNKNOWN,
1006 EFX_BIST_TYPE_PHY_NORMAL,
1007 EFX_BIST_TYPE_PHY_CABLE_SHORT,
1008 EFX_BIST_TYPE_PHY_CABLE_LONG,
1009 EFX_BIST_TYPE_MC_MEM, /* Test the MC DMEM and IMEM */
1010 EFX_BIST_TYPE_SAT_MEM, /* Test the DMEM and IMEM of satellite cpus*/
1011 EFX_BIST_TYPE_REG, /* Test the register memories */
1012 EFX_BIST_TYPE_NTYPES,
1015 typedef enum efx_bist_result_e {
1016 EFX_BIST_RESULT_UNKNOWN,
1017 EFX_BIST_RESULT_RUNNING,
1018 EFX_BIST_RESULT_PASSED,
1019 EFX_BIST_RESULT_FAILED,
1020 } efx_bist_result_t;
1022 typedef enum efx_phy_cable_status_e {
1023 EFX_PHY_CABLE_STATUS_OK,
1024 EFX_PHY_CABLE_STATUS_INVALID,
1025 EFX_PHY_CABLE_STATUS_OPEN,
1026 EFX_PHY_CABLE_STATUS_INTRAPAIRSHORT,
1027 EFX_PHY_CABLE_STATUS_INTERPAIRSHORT,
1028 EFX_PHY_CABLE_STATUS_BUSY,
1029 } efx_phy_cable_status_t;
1031 typedef enum efx_bist_value_e {
1032 EFX_BIST_PHY_CABLE_LENGTH_A,
1033 EFX_BIST_PHY_CABLE_LENGTH_B,
1034 EFX_BIST_PHY_CABLE_LENGTH_C,
1035 EFX_BIST_PHY_CABLE_LENGTH_D,
1036 EFX_BIST_PHY_CABLE_STATUS_A,
1037 EFX_BIST_PHY_CABLE_STATUS_B,
1038 EFX_BIST_PHY_CABLE_STATUS_C,
1039 EFX_BIST_PHY_CABLE_STATUS_D,
1040 EFX_BIST_FAULT_CODE,
1041 /* Memory BIST specific values. These match to the MC_CMD_BIST_POLL
1046 EFX_BIST_MEM_EXPECT,
1047 EFX_BIST_MEM_ACTUAL,
1049 EFX_BIST_MEM_ECC_PARITY,
1050 EFX_BIST_MEM_ECC_FATAL,
1054 extern __checkReturn efx_rc_t
1055 efx_bist_enable_offline(
1056 __in efx_nic_t *enp);
1058 extern __checkReturn efx_rc_t
1060 __in efx_nic_t *enp,
1061 __in efx_bist_type_t type);
1063 extern __checkReturn efx_rc_t
1065 __in efx_nic_t *enp,
1066 __in efx_bist_type_t type,
1067 __out efx_bist_result_t *resultp,
1068 __out_opt uint32_t *value_maskp,
1069 __out_ecount_opt(count) unsigned long *valuesp,
1074 __in efx_nic_t *enp,
1075 __in efx_bist_type_t type);
1077 #endif /* EFSYS_OPT_BIST */
1079 #define EFX_FEATURE_IPV6 0x00000001
1080 #define EFX_FEATURE_LFSR_HASH_INSERT 0x00000002
1081 #define EFX_FEATURE_LINK_EVENTS 0x00000004
1082 #define EFX_FEATURE_PERIODIC_MAC_STATS 0x00000008
1083 #define EFX_FEATURE_MCDI 0x00000020
1084 #define EFX_FEATURE_LOOKAHEAD_SPLIT 0x00000040
1085 #define EFX_FEATURE_MAC_HEADER_FILTERS 0x00000080
1086 #define EFX_FEATURE_TURBO 0x00000100
1087 #define EFX_FEATURE_MCDI_DMA 0x00000200
1088 #define EFX_FEATURE_TX_SRC_FILTERS 0x00000400
1089 #define EFX_FEATURE_PIO_BUFFERS 0x00000800
1090 #define EFX_FEATURE_FW_ASSISTED_TSO 0x00001000
1091 #define EFX_FEATURE_FW_ASSISTED_TSO_V2 0x00002000
1092 #define EFX_FEATURE_PACKED_STREAM 0x00004000
1094 typedef enum efx_tunnel_protocol_e {
1095 EFX_TUNNEL_PROTOCOL_NONE = 0,
1096 EFX_TUNNEL_PROTOCOL_VXLAN,
1097 EFX_TUNNEL_PROTOCOL_GENEVE,
1098 EFX_TUNNEL_PROTOCOL_NVGRE,
1100 } efx_tunnel_protocol_t;
1102 typedef struct efx_nic_cfg_s {
1103 uint32_t enc_board_type;
1104 uint32_t enc_phy_type;
1106 char enc_phy_name[21];
1108 char enc_phy_revision[21];
1109 efx_mon_type_t enc_mon_type;
1110 #if EFSYS_OPT_MON_STATS
1111 uint32_t enc_mon_stat_dma_buf_size;
1112 uint32_t enc_mon_stat_mask[(EFX_MON_NSTATS + 31) / 32];
1114 unsigned int enc_features;
1115 uint8_t enc_mac_addr[6];
1116 uint8_t enc_port; /* PHY port number */
1117 uint32_t enc_intr_vec_base;
1118 uint32_t enc_intr_limit;
1119 uint32_t enc_evq_limit;
1120 uint32_t enc_txq_limit;
1121 uint32_t enc_rxq_limit;
1122 uint32_t enc_txq_max_ndescs;
1123 uint32_t enc_buftbl_limit;
1124 uint32_t enc_piobuf_limit;
1125 uint32_t enc_piobuf_size;
1126 uint32_t enc_piobuf_min_alloc_size;
1127 uint32_t enc_evq_timer_quantum_ns;
1128 uint32_t enc_evq_timer_max_us;
1129 uint32_t enc_clk_mult;
1130 uint32_t enc_rx_prefix_size;
1131 uint32_t enc_rx_buf_align_start;
1132 uint32_t enc_rx_buf_align_end;
1133 uint32_t enc_rx_scale_max_exclusive_contexts;
1134 #if EFSYS_OPT_LOOPBACK
1135 efx_qword_t enc_loopback_types[EFX_LINK_NMODES];
1136 #endif /* EFSYS_OPT_LOOPBACK */
1137 #if EFSYS_OPT_PHY_FLAGS
1138 uint32_t enc_phy_flags_mask;
1139 #endif /* EFSYS_OPT_PHY_FLAGS */
1140 #if EFSYS_OPT_PHY_LED_CONTROL
1141 uint32_t enc_led_mask;
1142 #endif /* EFSYS_OPT_PHY_LED_CONTROL */
1143 #if EFSYS_OPT_PHY_STATS
1144 uint64_t enc_phy_stat_mask;
1145 #endif /* EFSYS_OPT_PHY_STATS */
1147 uint8_t enc_mcdi_mdio_channel;
1148 #if EFSYS_OPT_PHY_STATS
1149 uint32_t enc_mcdi_phy_stat_mask;
1150 #endif /* EFSYS_OPT_PHY_STATS */
1151 #if EFSYS_OPT_MON_STATS
1152 uint32_t *enc_mcdi_sensor_maskp;
1153 uint32_t enc_mcdi_sensor_mask_size;
1154 #endif /* EFSYS_OPT_MON_STATS */
1155 #endif /* EFSYS_OPT_MCDI */
1157 uint32_t enc_bist_mask;
1158 #endif /* EFSYS_OPT_BIST */
1159 #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
1162 uint32_t enc_privilege_mask;
1163 #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
1164 boolean_t enc_bug26807_workaround;
1165 boolean_t enc_bug35388_workaround;
1166 boolean_t enc_bug41750_workaround;
1167 boolean_t enc_bug61265_workaround;
1168 boolean_t enc_rx_batching_enabled;
1169 /* Maximum number of descriptors completed in an rx event. */
1170 uint32_t enc_rx_batch_max;
1171 /* Number of rx descriptors the hardware requires for a push. */
1172 uint32_t enc_rx_push_align;
1173 /* Maximum amount of data in DMA descriptor */
1174 uint32_t enc_tx_dma_desc_size_max;
1176 * Boundary which DMA descriptor data must not cross or 0 if no
1179 uint32_t enc_tx_dma_desc_boundary;
1181 * Maximum number of bytes into the packet the TCP header can start for
1182 * the hardware to apply TSO packet edits.
1184 uint32_t enc_tx_tso_tcp_header_offset_limit;
1185 boolean_t enc_fw_assisted_tso_enabled;
1186 boolean_t enc_fw_assisted_tso_v2_enabled;
1187 /* Number of TSO contexts on the NIC (FATSOv2) */
1188 uint32_t enc_fw_assisted_tso_v2_n_contexts;
1189 boolean_t enc_hw_tx_insert_vlan_enabled;
1190 /* Number of PFs on the NIC */
1191 uint32_t enc_hw_pf_count;
1192 /* Datapath firmware vadapter/vport/vswitch support */
1193 boolean_t enc_datapath_cap_evb;
1194 boolean_t enc_rx_disable_scatter_supported;
1195 boolean_t enc_allow_set_mac_with_installed_filters;
1196 boolean_t enc_enhanced_set_mac_supported;
1197 boolean_t enc_init_evq_v2_supported;
1198 boolean_t enc_rx_packed_stream_supported;
1199 boolean_t enc_rx_var_packed_stream_supported;
1200 boolean_t enc_pm_and_rxdp_counters;
1201 boolean_t enc_mac_stats_40g_tx_size_bins;
1202 uint32_t enc_tunnel_encapsulations_supported;
1203 /* External port identifier */
1204 uint8_t enc_external_port;
1205 uint32_t enc_mcdi_max_payload_length;
1206 /* VPD may be per-PF or global */
1207 boolean_t enc_vpd_is_global;
1208 /* Minimum unidirectional bandwidth in Mb/s to max out all ports */
1209 uint32_t enc_required_pcie_bandwidth_mbps;
1210 uint32_t enc_max_pcie_link_gen;
1211 /* Firmware verifies integrity of NVRAM updates */
1212 uint32_t enc_nvram_update_verify_result_supported;
1215 #define EFX_PCI_FUNCTION_IS_PF(_encp) ((_encp)->enc_vf == 0xffff)
1216 #define EFX_PCI_FUNCTION_IS_VF(_encp) ((_encp)->enc_vf != 0xffff)
1218 #define EFX_PCI_FUNCTION(_encp) \
1219 (EFX_PCI_FUNCTION_IS_PF(_encp) ? (_encp)->enc_pf : (_encp)->enc_vf)
1221 #define EFX_PCI_VF_PARENT(_encp) ((_encp)->enc_pf)
1223 extern const efx_nic_cfg_t *
1225 __in efx_nic_t *enp);
1227 typedef struct efx_nic_fw_info_s {
1228 /* Basic FW version information */
1229 uint16_t enfi_mc_fw_version[4];
1231 * If datapath capabilities can be detected,
1232 * additional FW information is to be shown
1234 boolean_t enfi_dpcpu_fw_ids_valid;
1235 /* Rx and Tx datapath CPU FW IDs */
1236 uint16_t enfi_rx_dpcpu_fw_id;
1237 uint16_t enfi_tx_dpcpu_fw_id;
1238 } efx_nic_fw_info_t;
1240 extern __checkReturn efx_rc_t
1241 efx_nic_get_fw_version(
1242 __in efx_nic_t *enp,
1243 __out efx_nic_fw_info_t *enfip);
1245 /* Driver resource limits (minimum required/maximum usable). */
1246 typedef struct efx_drv_limits_s {
1247 uint32_t edl_min_evq_count;
1248 uint32_t edl_max_evq_count;
1250 uint32_t edl_min_rxq_count;
1251 uint32_t edl_max_rxq_count;
1253 uint32_t edl_min_txq_count;
1254 uint32_t edl_max_txq_count;
1256 /* PIO blocks (sub-allocated from piobuf) */
1257 uint32_t edl_min_pio_alloc_size;
1258 uint32_t edl_max_pio_alloc_count;
1261 extern __checkReturn efx_rc_t
1262 efx_nic_set_drv_limits(
1263 __inout efx_nic_t *enp,
1264 __in efx_drv_limits_t *edlp);
1266 typedef enum efx_nic_region_e {
1267 EFX_REGION_VI, /* Memory BAR UC mapping */
1268 EFX_REGION_PIO_WRITE_VI, /* Memory BAR WC mapping */
1271 extern __checkReturn efx_rc_t
1272 efx_nic_get_bar_region(
1273 __in efx_nic_t *enp,
1274 __in efx_nic_region_t region,
1275 __out uint32_t *offsetp,
1276 __out size_t *sizep);
1278 extern __checkReturn efx_rc_t
1279 efx_nic_get_vi_pool(
1280 __in efx_nic_t *enp,
1281 __out uint32_t *evq_countp,
1282 __out uint32_t *rxq_countp,
1283 __out uint32_t *txq_countp);
1288 typedef enum efx_vpd_tag_e {
1295 typedef uint16_t efx_vpd_keyword_t;
1297 typedef struct efx_vpd_value_s {
1298 efx_vpd_tag_t evv_tag;
1299 efx_vpd_keyword_t evv_keyword;
1301 uint8_t evv_value[0x100];
1305 #define EFX_VPD_KEYWORD(x, y) ((x) | ((y) << 8))
1307 extern __checkReturn efx_rc_t
1309 __in efx_nic_t *enp);
1311 extern __checkReturn efx_rc_t
1313 __in efx_nic_t *enp,
1314 __out size_t *sizep);
1316 extern __checkReturn efx_rc_t
1318 __in efx_nic_t *enp,
1319 __out_bcount(size) caddr_t data,
1322 extern __checkReturn efx_rc_t
1324 __in efx_nic_t *enp,
1325 __in_bcount(size) caddr_t data,
1328 extern __checkReturn efx_rc_t
1330 __in efx_nic_t *enp,
1331 __in_bcount(size) caddr_t data,
1334 extern __checkReturn efx_rc_t
1336 __in efx_nic_t *enp,
1337 __in_bcount(size) caddr_t data,
1339 __inout efx_vpd_value_t *evvp);
1341 extern __checkReturn efx_rc_t
1343 __in efx_nic_t *enp,
1344 __inout_bcount(size) caddr_t data,
1346 __in efx_vpd_value_t *evvp);
1348 extern __checkReturn efx_rc_t
1350 __in efx_nic_t *enp,
1351 __inout_bcount(size) caddr_t data,
1353 __out efx_vpd_value_t *evvp,
1354 __inout unsigned int *contp);
1356 extern __checkReturn efx_rc_t
1358 __in efx_nic_t *enp,
1359 __in_bcount(size) caddr_t data,
1364 __in efx_nic_t *enp);
1366 #endif /* EFSYS_OPT_VPD */
1372 typedef enum efx_nvram_type_e {
1373 EFX_NVRAM_INVALID = 0,
1375 EFX_NVRAM_BOOTROM_CFG,
1376 EFX_NVRAM_MC_FIRMWARE,
1377 EFX_NVRAM_MC_GOLDEN,
1383 EFX_NVRAM_FPGA_BACKUP,
1384 EFX_NVRAM_DYNAMIC_CFG,
1387 EFX_NVRAM_MUM_FIRMWARE,
1391 extern __checkReturn efx_rc_t
1393 __in efx_nic_t *enp);
1397 extern __checkReturn efx_rc_t
1399 __in efx_nic_t *enp);
1401 #endif /* EFSYS_OPT_DIAG */
1403 extern __checkReturn efx_rc_t
1405 __in efx_nic_t *enp,
1406 __in efx_nvram_type_t type,
1407 __out size_t *sizep);
1409 extern __checkReturn efx_rc_t
1411 __in efx_nic_t *enp,
1412 __in efx_nvram_type_t type,
1413 __out_opt size_t *pref_chunkp);
1415 extern __checkReturn efx_rc_t
1416 efx_nvram_rw_finish(
1417 __in efx_nic_t *enp,
1418 __in efx_nvram_type_t type,
1419 __out_opt uint32_t *verify_resultp);
1421 extern __checkReturn efx_rc_t
1422 efx_nvram_get_version(
1423 __in efx_nic_t *enp,
1424 __in efx_nvram_type_t type,
1425 __out uint32_t *subtypep,
1426 __out_ecount(4) uint16_t version[4]);
1428 extern __checkReturn efx_rc_t
1429 efx_nvram_read_chunk(
1430 __in efx_nic_t *enp,
1431 __in efx_nvram_type_t type,
1432 __in unsigned int offset,
1433 __out_bcount(size) caddr_t data,
1436 extern __checkReturn efx_rc_t
1437 efx_nvram_read_backup(
1438 __in efx_nic_t *enp,
1439 __in efx_nvram_type_t type,
1440 __in unsigned int offset,
1441 __out_bcount(size) caddr_t data,
1444 extern __checkReturn efx_rc_t
1445 efx_nvram_set_version(
1446 __in efx_nic_t *enp,
1447 __in efx_nvram_type_t type,
1448 __in_ecount(4) uint16_t version[4]);
1450 extern __checkReturn efx_rc_t
1452 __in efx_nic_t *enp,
1453 __in efx_nvram_type_t type,
1454 __in_bcount(partn_size) caddr_t partn_data,
1455 __in size_t partn_size);
1457 extern __checkReturn efx_rc_t
1459 __in efx_nic_t *enp,
1460 __in efx_nvram_type_t type);
1462 extern __checkReturn efx_rc_t
1463 efx_nvram_write_chunk(
1464 __in efx_nic_t *enp,
1465 __in efx_nvram_type_t type,
1466 __in unsigned int offset,
1467 __in_bcount(size) caddr_t data,
1472 __in efx_nic_t *enp);
1474 #endif /* EFSYS_OPT_NVRAM */
1476 #if EFSYS_OPT_BOOTCFG
1478 /* Report size and offset of bootcfg sector in NVRAM partition. */
1479 extern __checkReturn efx_rc_t
1480 efx_bootcfg_sector_info(
1481 __in efx_nic_t *enp,
1483 __out_opt uint32_t *sector_countp,
1484 __out size_t *offsetp,
1485 __out size_t *max_sizep);
1488 * Copy bootcfg sector data to a target buffer which may differ in size.
1489 * Optionally corrects format errors in source buffer.
1492 efx_bootcfg_copy_sector(
1493 __in efx_nic_t *enp,
1494 __inout_bcount(sector_length)
1496 __in size_t sector_length,
1497 __out_bcount(data_size) uint8_t *data,
1498 __in size_t data_size,
1499 __in boolean_t handle_format_errors);
1503 __in efx_nic_t *enp,
1504 __out_bcount(size) caddr_t data,
1509 __in efx_nic_t *enp,
1510 __in_bcount(size) caddr_t data,
1513 #endif /* EFSYS_OPT_BOOTCFG */
1517 typedef enum efx_pattern_type_t {
1518 EFX_PATTERN_BYTE_INCREMENT = 0,
1519 EFX_PATTERN_ALL_THE_SAME,
1520 EFX_PATTERN_BIT_ALTERNATE,
1521 EFX_PATTERN_BYTE_ALTERNATE,
1522 EFX_PATTERN_BYTE_CHANGING,
1523 EFX_PATTERN_BIT_SWEEP,
1525 } efx_pattern_type_t;
1528 (*efx_sram_pattern_fn_t)(
1530 __in boolean_t negate,
1531 __out efx_qword_t *eqp);
1533 extern __checkReturn efx_rc_t
1535 __in efx_nic_t *enp,
1536 __in efx_pattern_type_t type);
1538 #endif /* EFSYS_OPT_DIAG */
1540 extern __checkReturn efx_rc_t
1541 efx_sram_buf_tbl_set(
1542 __in efx_nic_t *enp,
1544 __in efsys_mem_t *esmp,
1548 efx_sram_buf_tbl_clear(
1549 __in efx_nic_t *enp,
1553 #define EFX_BUF_TBL_SIZE 0x20000
1555 #define EFX_BUF_SIZE 4096
1559 typedef struct efx_evq_s efx_evq_t;
1561 #if EFSYS_OPT_QSTATS
1563 /* START MKCONFIG GENERATED EfxHeaderEventQueueBlock 6f3843f5fe7cc843 */
1564 typedef enum efx_ev_qstat_e {
1570 EV_RX_PAUSE_FRM_ERR,
1571 EV_RX_BUF_OWNER_ID_ERR,
1572 EV_RX_IPV4_HDR_CHKSUM_ERR,
1573 EV_RX_TCP_UDP_CHKSUM_ERR,
1577 EV_RX_MCAST_HASH_MATCH,
1594 EV_DRIVER_SRM_UPD_DONE,
1595 EV_DRIVER_TX_DESCQ_FLS_DONE,
1596 EV_DRIVER_RX_DESCQ_FLS_DONE,
1597 EV_DRIVER_RX_DESCQ_FLS_FAILED,
1598 EV_DRIVER_RX_DSC_ERROR,
1599 EV_DRIVER_TX_DSC_ERROR,
1605 /* END MKCONFIG GENERATED EfxHeaderEventQueueBlock */
1607 #endif /* EFSYS_OPT_QSTATS */
1609 extern __checkReturn efx_rc_t
1611 __in efx_nic_t *enp);
1615 __in efx_nic_t *enp);
1617 #define EFX_EVQ_MAXNEVS 32768
1618 #define EFX_EVQ_MINNEVS 512
1620 #define EFX_EVQ_SIZE(_nevs) ((_nevs) * sizeof (efx_qword_t))
1621 #define EFX_EVQ_NBUFS(_nevs) (EFX_EVQ_SIZE(_nevs) / EFX_BUF_SIZE)
1623 #define EFX_EVQ_FLAGS_TYPE_MASK (0x3)
1624 #define EFX_EVQ_FLAGS_TYPE_AUTO (0x0)
1625 #define EFX_EVQ_FLAGS_TYPE_THROUGHPUT (0x1)
1626 #define EFX_EVQ_FLAGS_TYPE_LOW_LATENCY (0x2)
1628 #define EFX_EVQ_FLAGS_NOTIFY_MASK (0xC)
1629 #define EFX_EVQ_FLAGS_NOTIFY_INTERRUPT (0x0) /* Interrupting (default) */
1630 #define EFX_EVQ_FLAGS_NOTIFY_DISABLED (0x4) /* Non-interrupting */
1632 extern __checkReturn efx_rc_t
1634 __in efx_nic_t *enp,
1635 __in unsigned int index,
1636 __in efsys_mem_t *esmp,
1640 __in uint32_t flags,
1641 __deref_out efx_evq_t **eepp);
1645 __in efx_evq_t *eep,
1646 __in uint16_t data);
1648 typedef __checkReturn boolean_t
1649 (*efx_initialized_ev_t)(
1650 __in_opt void *arg);
1652 #define EFX_PKT_UNICAST 0x0004
1653 #define EFX_PKT_START 0x0008
1655 #define EFX_PKT_VLAN_TAGGED 0x0010
1656 #define EFX_CKSUM_TCPUDP 0x0020
1657 #define EFX_CKSUM_IPV4 0x0040
1658 #define EFX_PKT_CONT 0x0080
1660 #define EFX_CHECK_VLAN 0x0100
1661 #define EFX_PKT_TCP 0x0200
1662 #define EFX_PKT_UDP 0x0400
1663 #define EFX_PKT_IPV4 0x0800
1665 #define EFX_PKT_IPV6 0x1000
1666 #define EFX_PKT_PREFIX_LEN 0x2000
1667 #define EFX_ADDR_MISMATCH 0x4000
1668 #define EFX_DISCARD 0x8000
1671 * The following flags are used only for packed stream
1672 * mode. The values for the flags are reused to fit into 16 bit,
1673 * since EFX_PKT_START and EFX_PKT_CONT are never used in
1674 * packed stream mode
1676 #define EFX_PKT_PACKED_STREAM_NEW_BUFFER EFX_PKT_START
1677 #define EFX_PKT_PACKED_STREAM_PARSE_INCOMPLETE EFX_PKT_CONT
1680 #define EFX_EV_RX_NLABELS 32
1681 #define EFX_EV_TX_NLABELS 32
1683 typedef __checkReturn boolean_t
1686 __in uint32_t label,
1689 __in uint16_t flags);
1691 #if EFSYS_OPT_RX_PACKED_STREAM
1694 * Packed stream mode is documented in SF-112241-TC.
1695 * The general idea is that, instead of putting each incoming
1696 * packet into a separate buffer which is specified in a RX
1697 * descriptor, a large buffer is provided to the hardware and
1698 * packets are put there in a continuous stream.
1699 * The main advantage of such an approach is that RX queue refilling
1700 * happens much less frequently.
1703 typedef __checkReturn boolean_t
1706 __in uint32_t label,
1708 __in uint32_t pkt_count,
1709 __in uint16_t flags);
1713 typedef __checkReturn boolean_t
1716 __in uint32_t label,
1719 #define EFX_EXCEPTION_RX_RECOVERY 0x00000001
1720 #define EFX_EXCEPTION_RX_DSC_ERROR 0x00000002
1721 #define EFX_EXCEPTION_TX_DSC_ERROR 0x00000003
1722 #define EFX_EXCEPTION_UNKNOWN_SENSOREVT 0x00000004
1723 #define EFX_EXCEPTION_FWALERT_SRAM 0x00000005
1724 #define EFX_EXCEPTION_UNKNOWN_FWALERT 0x00000006
1725 #define EFX_EXCEPTION_RX_ERROR 0x00000007
1726 #define EFX_EXCEPTION_TX_ERROR 0x00000008
1727 #define EFX_EXCEPTION_EV_ERROR 0x00000009
1729 typedef __checkReturn boolean_t
1730 (*efx_exception_ev_t)(
1732 __in uint32_t label,
1733 __in uint32_t data);
1735 typedef __checkReturn boolean_t
1736 (*efx_rxq_flush_done_ev_t)(
1738 __in uint32_t rxq_index);
1740 typedef __checkReturn boolean_t
1741 (*efx_rxq_flush_failed_ev_t)(
1743 __in uint32_t rxq_index);
1745 typedef __checkReturn boolean_t
1746 (*efx_txq_flush_done_ev_t)(
1748 __in uint32_t txq_index);
1750 typedef __checkReturn boolean_t
1751 (*efx_software_ev_t)(
1753 __in uint16_t magic);
1755 typedef __checkReturn boolean_t
1758 __in uint32_t code);
1760 #define EFX_SRAM_CLEAR 0
1761 #define EFX_SRAM_UPDATE 1
1762 #define EFX_SRAM_ILLEGAL_CLEAR 2
1764 typedef __checkReturn boolean_t
1765 (*efx_wake_up_ev_t)(
1767 __in uint32_t label);
1769 typedef __checkReturn boolean_t
1772 __in uint32_t label);
1774 typedef __checkReturn boolean_t
1775 (*efx_link_change_ev_t)(
1777 __in efx_link_mode_t link_mode);
1779 #if EFSYS_OPT_MON_STATS
1781 typedef __checkReturn boolean_t
1782 (*efx_monitor_ev_t)(
1784 __in efx_mon_stat_t id,
1785 __in efx_mon_stat_value_t value);
1787 #endif /* EFSYS_OPT_MON_STATS */
1789 #if EFSYS_OPT_MAC_STATS
1791 typedef __checkReturn boolean_t
1792 (*efx_mac_stats_ev_t)(
1794 __in uint32_t generation
1797 #endif /* EFSYS_OPT_MAC_STATS */
1799 typedef struct efx_ev_callbacks_s {
1800 efx_initialized_ev_t eec_initialized;
1802 #if EFSYS_OPT_RX_PACKED_STREAM
1803 efx_rx_ps_ev_t eec_rx_ps;
1806 efx_exception_ev_t eec_exception;
1807 efx_rxq_flush_done_ev_t eec_rxq_flush_done;
1808 efx_rxq_flush_failed_ev_t eec_rxq_flush_failed;
1809 efx_txq_flush_done_ev_t eec_txq_flush_done;
1810 efx_software_ev_t eec_software;
1811 efx_sram_ev_t eec_sram;
1812 efx_wake_up_ev_t eec_wake_up;
1813 efx_timer_ev_t eec_timer;
1814 efx_link_change_ev_t eec_link_change;
1815 #if EFSYS_OPT_MON_STATS
1816 efx_monitor_ev_t eec_monitor;
1817 #endif /* EFSYS_OPT_MON_STATS */
1818 #if EFSYS_OPT_MAC_STATS
1819 efx_mac_stats_ev_t eec_mac_stats;
1820 #endif /* EFSYS_OPT_MAC_STATS */
1821 } efx_ev_callbacks_t;
1823 extern __checkReturn boolean_t
1825 __in efx_evq_t *eep,
1826 __in unsigned int count);
1828 #if EFSYS_OPT_EV_PREFETCH
1832 __in efx_evq_t *eep,
1833 __in unsigned int count);
1835 #endif /* EFSYS_OPT_EV_PREFETCH */
1839 __in efx_evq_t *eep,
1840 __inout unsigned int *countp,
1841 __in const efx_ev_callbacks_t *eecp,
1842 __in_opt void *arg);
1844 extern __checkReturn efx_rc_t
1845 efx_ev_usecs_to_ticks(
1846 __in efx_nic_t *enp,
1847 __in unsigned int usecs,
1848 __out unsigned int *ticksp);
1850 extern __checkReturn efx_rc_t
1852 __in efx_evq_t *eep,
1853 __in unsigned int us);
1855 extern __checkReturn efx_rc_t
1857 __in efx_evq_t *eep,
1858 __in unsigned int count);
1860 #if EFSYS_OPT_QSTATS
1866 __in efx_nic_t *enp,
1867 __in unsigned int id);
1869 #endif /* EFSYS_OPT_NAMES */
1872 efx_ev_qstats_update(
1873 __in efx_evq_t *eep,
1874 __inout_ecount(EV_NQSTATS) efsys_stat_t *stat);
1876 #endif /* EFSYS_OPT_QSTATS */
1880 __in efx_evq_t *eep);
1884 extern __checkReturn efx_rc_t
1886 __inout efx_nic_t *enp);
1890 __in efx_nic_t *enp);
1892 #if EFSYS_OPT_RX_SCATTER
1893 __checkReturn efx_rc_t
1894 efx_rx_scatter_enable(
1895 __in efx_nic_t *enp,
1896 __in unsigned int buf_size);
1897 #endif /* EFSYS_OPT_RX_SCATTER */
1899 /* Handle to represent use of the default RSS context. */
1900 #define EFX_RSS_CONTEXT_DEFAULT 0xffffffff
1902 #if EFSYS_OPT_RX_SCALE
1904 typedef enum efx_rx_hash_alg_e {
1905 EFX_RX_HASHALG_LFSR = 0,
1906 EFX_RX_HASHALG_TOEPLITZ
1907 } efx_rx_hash_alg_t;
1909 #define EFX_RX_HASH_IPV4 (1U << 0)
1910 #define EFX_RX_HASH_TCPIPV4 (1U << 1)
1911 #define EFX_RX_HASH_IPV6 (1U << 2)
1912 #define EFX_RX_HASH_TCPIPV6 (1U << 3)
1914 typedef unsigned int efx_rx_hash_type_t;
1916 typedef enum efx_rx_hash_support_e {
1917 EFX_RX_HASH_UNAVAILABLE = 0, /* Hardware hash not inserted */
1918 EFX_RX_HASH_AVAILABLE /* Insert hash with/without RSS */
1919 } efx_rx_hash_support_t;
1921 #define EFX_RSS_KEY_SIZE 40 /* RSS key size (bytes) */
1922 #define EFX_RSS_TBL_SIZE 128 /* Rows in RX indirection table */
1923 #define EFX_MAXRSS 64 /* RX indirection entry range */
1924 #define EFX_MAXRSS_LEGACY 16 /* See bug16611 and bug17213 */
1926 typedef enum efx_rx_scale_context_type_e {
1927 EFX_RX_SCALE_UNAVAILABLE = 0, /* No RX scale context */
1928 EFX_RX_SCALE_EXCLUSIVE, /* Writable key/indirection table */
1929 EFX_RX_SCALE_SHARED /* Read-only key/indirection table */
1930 } efx_rx_scale_context_type_t;
1932 extern __checkReturn efx_rc_t
1933 efx_rx_hash_default_support_get(
1934 __in efx_nic_t *enp,
1935 __out efx_rx_hash_support_t *supportp);
1938 extern __checkReturn efx_rc_t
1939 efx_rx_scale_default_support_get(
1940 __in efx_nic_t *enp,
1941 __out efx_rx_scale_context_type_t *typep);
1943 extern __checkReturn efx_rc_t
1944 efx_rx_scale_context_alloc(
1945 __in efx_nic_t *enp,
1946 __in efx_rx_scale_context_type_t type,
1947 __in uint32_t num_queues,
1948 __out uint32_t *rss_contextp);
1950 extern __checkReturn efx_rc_t
1951 efx_rx_scale_context_free(
1952 __in efx_nic_t *enp,
1953 __in uint32_t rss_context);
1955 extern __checkReturn efx_rc_t
1956 efx_rx_scale_mode_set(
1957 __in efx_nic_t *enp,
1958 __in uint32_t rss_context,
1959 __in efx_rx_hash_alg_t alg,
1960 __in efx_rx_hash_type_t type,
1961 __in boolean_t insert);
1963 extern __checkReturn efx_rc_t
1964 efx_rx_scale_tbl_set(
1965 __in efx_nic_t *enp,
1966 __in uint32_t rss_context,
1967 __in_ecount(n) unsigned int *table,
1970 extern __checkReturn efx_rc_t
1971 efx_rx_scale_key_set(
1972 __in efx_nic_t *enp,
1973 __in uint32_t rss_context,
1974 __in_ecount(n) uint8_t *key,
1977 extern __checkReturn uint32_t
1978 efx_pseudo_hdr_hash_get(
1979 __in efx_rxq_t *erp,
1980 __in efx_rx_hash_alg_t func,
1981 __in uint8_t *buffer);
1983 #endif /* EFSYS_OPT_RX_SCALE */
1985 extern __checkReturn efx_rc_t
1986 efx_pseudo_hdr_pkt_length_get(
1987 __in efx_rxq_t *erp,
1988 __in uint8_t *buffer,
1989 __out uint16_t *pkt_lengthp);
1991 #define EFX_RXQ_MAXNDESCS 4096
1992 #define EFX_RXQ_MINNDESCS 512
1994 #define EFX_RXQ_SIZE(_ndescs) ((_ndescs) * sizeof (efx_qword_t))
1995 #define EFX_RXQ_NBUFS(_ndescs) (EFX_RXQ_SIZE(_ndescs) / EFX_BUF_SIZE)
1996 #define EFX_RXQ_LIMIT(_ndescs) ((_ndescs) - 16)
1997 #define EFX_RXQ_DC_NDESCS(_dcsize) (8 << _dcsize)
1999 typedef enum efx_rxq_type_e {
2000 EFX_RXQ_TYPE_DEFAULT,
2001 EFX_RXQ_TYPE_SCATTER,
2002 EFX_RXQ_TYPE_PACKED_STREAM_1M,
2003 EFX_RXQ_TYPE_PACKED_STREAM_512K,
2004 EFX_RXQ_TYPE_PACKED_STREAM_256K,
2005 EFX_RXQ_TYPE_PACKED_STREAM_128K,
2006 EFX_RXQ_TYPE_PACKED_STREAM_64K,
2010 extern __checkReturn efx_rc_t
2012 __in efx_nic_t *enp,
2013 __in unsigned int index,
2014 __in unsigned int label,
2015 __in efx_rxq_type_t type,
2016 __in efsys_mem_t *esmp,
2019 __in efx_evq_t *eep,
2020 __deref_out efx_rxq_t **erpp);
2022 typedef struct efx_buffer_s {
2023 efsys_dma_addr_t eb_addr;
2028 typedef struct efx_desc_s {
2034 __in efx_rxq_t *erp,
2035 __in_ecount(n) efsys_dma_addr_t *addrp,
2037 __in unsigned int n,
2038 __in unsigned int completed,
2039 __in unsigned int added);
2043 __in efx_rxq_t *erp,
2044 __in unsigned int added,
2045 __inout unsigned int *pushedp);
2047 #if EFSYS_OPT_RX_PACKED_STREAM
2050 efx_rx_qpush_ps_credits(
2051 __in efx_rxq_t *erp);
2053 extern __checkReturn uint8_t *
2054 efx_rx_qps_packet_info(
2055 __in efx_rxq_t *erp,
2056 __in uint8_t *buffer,
2057 __in uint32_t buffer_length,
2058 __in uint32_t current_offset,
2059 __out uint16_t *lengthp,
2060 __out uint32_t *next_offsetp,
2061 __out uint32_t *timestamp);
2064 extern __checkReturn efx_rc_t
2066 __in efx_rxq_t *erp);
2070 __in efx_rxq_t *erp);
2074 __in efx_rxq_t *erp);
2078 typedef struct efx_txq_s efx_txq_t;
2080 #if EFSYS_OPT_QSTATS
2082 /* START MKCONFIG GENERATED EfxHeaderTransmitQueueBlock 12dff8778598b2db */
2083 typedef enum efx_tx_qstat_e {
2089 /* END MKCONFIG GENERATED EfxHeaderTransmitQueueBlock */
2091 #endif /* EFSYS_OPT_QSTATS */
2093 extern __checkReturn efx_rc_t
2095 __in efx_nic_t *enp);
2099 __in efx_nic_t *enp);
2101 #define EFX_TXQ_MINNDESCS 512
2103 #define EFX_TXQ_SIZE(_ndescs) ((_ndescs) * sizeof (efx_qword_t))
2104 #define EFX_TXQ_NBUFS(_ndescs) (EFX_TXQ_SIZE(_ndescs) / EFX_BUF_SIZE)
2105 #define EFX_TXQ_LIMIT(_ndescs) ((_ndescs) - 16)
2106 #define EFX_TXQ_DC_NDESCS(_dcsize) (8 << _dcsize)
2108 #define EFX_TXQ_MAX_BUFS 8 /* Maximum independent of EFX_BUG35388_WORKAROUND. */
2110 #define EFX_TXQ_CKSUM_IPV4 0x0001
2111 #define EFX_TXQ_CKSUM_TCPUDP 0x0002
2112 #define EFX_TXQ_FATSOV2 0x0004
2113 #define EFX_TXQ_CKSUM_INNER_IPV4 0x0008
2114 #define EFX_TXQ_CKSUM_INNER_TCPUDP 0x0010
2116 extern __checkReturn efx_rc_t
2118 __in efx_nic_t *enp,
2119 __in unsigned int index,
2120 __in unsigned int label,
2121 __in efsys_mem_t *esmp,
2124 __in uint16_t flags,
2125 __in efx_evq_t *eep,
2126 __deref_out efx_txq_t **etpp,
2127 __out unsigned int *addedp);
2129 extern __checkReturn efx_rc_t
2131 __in efx_txq_t *etp,
2132 __in_ecount(n) efx_buffer_t *eb,
2133 __in unsigned int n,
2134 __in unsigned int completed,
2135 __inout unsigned int *addedp);
2137 extern __checkReturn efx_rc_t
2139 __in efx_txq_t *etp,
2140 __in unsigned int ns);
2144 __in efx_txq_t *etp,
2145 __in unsigned int added,
2146 __in unsigned int pushed);
2148 extern __checkReturn efx_rc_t
2150 __in efx_txq_t *etp);
2154 __in efx_txq_t *etp);
2156 extern __checkReturn efx_rc_t
2158 __in efx_txq_t *etp);
2161 efx_tx_qpio_disable(
2162 __in efx_txq_t *etp);
2164 extern __checkReturn efx_rc_t
2166 __in efx_txq_t *etp,
2167 __in_ecount(buf_length) uint8_t *buffer,
2168 __in size_t buf_length,
2169 __in size_t pio_buf_offset);
2171 extern __checkReturn efx_rc_t
2173 __in efx_txq_t *etp,
2174 __in size_t pkt_length,
2175 __in unsigned int completed,
2176 __inout unsigned int *addedp);
2178 extern __checkReturn efx_rc_t
2180 __in efx_txq_t *etp,
2181 __in_ecount(n) efx_desc_t *ed,
2182 __in unsigned int n,
2183 __in unsigned int completed,
2184 __inout unsigned int *addedp);
2187 efx_tx_qdesc_dma_create(
2188 __in efx_txq_t *etp,
2189 __in efsys_dma_addr_t addr,
2192 __out efx_desc_t *edp);
2195 efx_tx_qdesc_tso_create(
2196 __in efx_txq_t *etp,
2197 __in uint16_t ipv4_id,
2198 __in uint32_t tcp_seq,
2199 __in uint8_t tcp_flags,
2200 __out efx_desc_t *edp);
2202 /* Number of FATSOv2 option descriptors */
2203 #define EFX_TX_FATSOV2_OPT_NDESCS 2
2205 /* Maximum number of DMA segments per TSO packet (not superframe) */
2206 #define EFX_TX_FATSOV2_DMA_SEGS_PER_PKT_MAX 24
2209 efx_tx_qdesc_tso2_create(
2210 __in efx_txq_t *etp,
2211 __in uint16_t ipv4_id,
2212 __in uint32_t tcp_seq,
2213 __in uint16_t tcp_mss,
2214 __out_ecount(count) efx_desc_t *edp,
2218 efx_tx_qdesc_vlantci_create(
2219 __in efx_txq_t *etp,
2221 __out efx_desc_t *edp);
2223 #if EFSYS_OPT_QSTATS
2229 __in efx_nic_t *etp,
2230 __in unsigned int id);
2232 #endif /* EFSYS_OPT_NAMES */
2235 efx_tx_qstats_update(
2236 __in efx_txq_t *etp,
2237 __inout_ecount(TX_NQSTATS) efsys_stat_t *stat);
2239 #endif /* EFSYS_OPT_QSTATS */
2243 __in efx_txq_t *etp);
2248 #if EFSYS_OPT_FILTER
2250 #define EFX_ETHER_TYPE_IPV4 0x0800
2251 #define EFX_ETHER_TYPE_IPV6 0x86DD
2253 #define EFX_IPPROTO_TCP 6
2254 #define EFX_IPPROTO_UDP 17
2255 #define EFX_IPPROTO_GRE 47
2257 /* Use RSS to spread across multiple queues */
2258 #define EFX_FILTER_FLAG_RX_RSS 0x01
2259 /* Enable RX scatter */
2260 #define EFX_FILTER_FLAG_RX_SCATTER 0x02
2262 * Override an automatic filter (priority EFX_FILTER_PRI_AUTO).
2263 * May only be set by the filter implementation for each type.
2264 * A removal request will restore the automatic filter in its place.
2266 #define EFX_FILTER_FLAG_RX_OVER_AUTO 0x04
2267 /* Filter is for RX */
2268 #define EFX_FILTER_FLAG_RX 0x08
2269 /* Filter is for TX */
2270 #define EFX_FILTER_FLAG_TX 0x10
2272 typedef unsigned int efx_filter_flags_t;
2275 * Flags which specify the fields to match on. The values are the same as in the
2276 * MC_CMD_FILTER_OP/MC_CMD_FILTER_OP_EXT commands.
2278 typedef enum efx_filter_match_flags_e {
2279 EFX_FILTER_MATCH_REM_HOST = 0x0001, /* Match by remote IP host
2281 EFX_FILTER_MATCH_LOC_HOST = 0x0002, /* Match by local IP host
2283 EFX_FILTER_MATCH_REM_MAC = 0x0004, /* Match by remote MAC address */
2284 EFX_FILTER_MATCH_REM_PORT = 0x0008, /* Match by remote TCP/UDP port */
2285 EFX_FILTER_MATCH_LOC_MAC = 0x0010, /* Match by remote TCP/UDP port */
2286 EFX_FILTER_MATCH_LOC_PORT = 0x0020, /* Match by local TCP/UDP port */
2287 EFX_FILTER_MATCH_ETHER_TYPE = 0x0040, /* Match by Ether-type */
2288 EFX_FILTER_MATCH_INNER_VID = 0x0080, /* Match by inner VLAN ID */
2289 EFX_FILTER_MATCH_OUTER_VID = 0x0100, /* Match by outer VLAN ID */
2290 EFX_FILTER_MATCH_IP_PROTO = 0x0200, /* Match by IP transport
2292 /* For encapsulated packets, match all multicast inner frames */
2293 EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST = 0x01000000,
2294 /* For encapsulated packets, match all unicast inner frames */
2295 EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST = 0x02000000,
2296 /* Match otherwise-unmatched multicast and broadcast packets */
2297 EFX_FILTER_MATCH_UNKNOWN_MCAST_DST = 0x40000000,
2298 /* Match otherwise-unmatched unicast packets */
2299 EFX_FILTER_MATCH_UNKNOWN_UCAST_DST = 0x80000000,
2300 } efx_filter_match_flags_t;
2302 typedef enum efx_filter_priority_s {
2303 EFX_FILTER_PRI_HINT = 0, /* Performance hint */
2304 EFX_FILTER_PRI_AUTO, /* Automatic filter based on device
2305 * address list or hardware
2306 * requirements. This may only be used
2307 * by the filter implementation for
2309 EFX_FILTER_PRI_MANUAL, /* Manually configured filter */
2310 EFX_FILTER_PRI_REQUIRED, /* Required for correct behaviour of the
2311 * client (e.g. SR-IOV, HyperV VMQ etc.)
2313 } efx_filter_priority_t;
2316 * FIXME: All these fields are assumed to be in little-endian byte order.
2317 * It may be better for some to be big-endian. See bug42804.
2320 typedef struct efx_filter_spec_s {
2321 uint32_t efs_match_flags;
2322 uint32_t efs_priority:2;
2323 uint32_t efs_flags:6;
2324 uint32_t efs_dmaq_id:12;
2325 uint32_t efs_rss_context;
2326 uint16_t efs_outer_vid;
2327 uint16_t efs_inner_vid;
2328 uint8_t efs_loc_mac[EFX_MAC_ADDR_LEN];
2329 uint8_t efs_rem_mac[EFX_MAC_ADDR_LEN];
2330 uint16_t efs_ether_type;
2331 uint8_t efs_ip_proto;
2332 efx_tunnel_protocol_t efs_encap_type;
2333 uint16_t efs_loc_port;
2334 uint16_t efs_rem_port;
2335 efx_oword_t efs_rem_host;
2336 efx_oword_t efs_loc_host;
2337 } efx_filter_spec_t;
2340 /* Default values for use in filter specifications */
2341 #define EFX_FILTER_SPEC_RX_DMAQ_ID_DROP 0xfff
2342 #define EFX_FILTER_SPEC_VID_UNSPEC 0xffff
2344 extern __checkReturn efx_rc_t
2346 __in efx_nic_t *enp);
2350 __in efx_nic_t *enp);
2352 extern __checkReturn efx_rc_t
2354 __in efx_nic_t *enp,
2355 __inout efx_filter_spec_t *spec);
2357 extern __checkReturn efx_rc_t
2359 __in efx_nic_t *enp,
2360 __inout efx_filter_spec_t *spec);
2362 extern __checkReturn efx_rc_t
2364 __in efx_nic_t *enp);
2366 extern __checkReturn efx_rc_t
2367 efx_filter_supported_filters(
2368 __in efx_nic_t *enp,
2369 __out_ecount(buffer_length) uint32_t *buffer,
2370 __in size_t buffer_length,
2371 __out size_t *list_lengthp);
2374 efx_filter_spec_init_rx(
2375 __out efx_filter_spec_t *spec,
2376 __in efx_filter_priority_t priority,
2377 __in efx_filter_flags_t flags,
2378 __in efx_rxq_t *erp);
2381 efx_filter_spec_init_tx(
2382 __out efx_filter_spec_t *spec,
2383 __in efx_txq_t *etp);
2385 extern __checkReturn efx_rc_t
2386 efx_filter_spec_set_ipv4_local(
2387 __inout efx_filter_spec_t *spec,
2390 __in uint16_t port);
2392 extern __checkReturn efx_rc_t
2393 efx_filter_spec_set_ipv4_full(
2394 __inout efx_filter_spec_t *spec,
2396 __in uint32_t lhost,
2397 __in uint16_t lport,
2398 __in uint32_t rhost,
2399 __in uint16_t rport);
2401 extern __checkReturn efx_rc_t
2402 efx_filter_spec_set_eth_local(
2403 __inout efx_filter_spec_t *spec,
2405 __in const uint8_t *addr);
2408 efx_filter_spec_set_ether_type(
2409 __inout efx_filter_spec_t *spec,
2410 __in uint16_t ether_type);
2412 extern __checkReturn efx_rc_t
2413 efx_filter_spec_set_uc_def(
2414 __inout efx_filter_spec_t *spec);
2416 extern __checkReturn efx_rc_t
2417 efx_filter_spec_set_mc_def(
2418 __inout efx_filter_spec_t *spec);
2420 typedef enum efx_filter_inner_frame_match_e {
2421 EFX_FILTER_INNER_FRAME_MATCH_OTHER = 0,
2422 EFX_FILTER_INNER_FRAME_MATCH_UNKNOWN_MCAST_DST,
2423 EFX_FILTER_INNER_FRAME_MATCH_UNKNOWN_UCAST_DST
2424 } efx_filter_inner_frame_match_t;
2426 extern __checkReturn efx_rc_t
2427 efx_filter_spec_set_encap_type(
2428 __inout efx_filter_spec_t *spec,
2429 __in efx_tunnel_protocol_t encap_type,
2430 __in efx_filter_inner_frame_match_t inner_frame_match);
2432 #if EFSYS_OPT_RX_SCALE
2433 extern __checkReturn efx_rc_t
2434 efx_filter_spec_set_rss_context(
2435 __inout efx_filter_spec_t *spec,
2436 __in uint32_t rss_context);
2438 #endif /* EFSYS_OPT_FILTER */
2442 extern __checkReturn uint32_t
2444 __in_ecount(count) uint32_t const *input,
2446 __in uint32_t init);
2448 extern __checkReturn uint32_t
2450 __in_ecount(length) uint8_t const *input,
2452 __in uint32_t init);
2454 #if EFSYS_OPT_LICENSING
2458 typedef struct efx_key_stats_s {
2460 uint32_t eks_invalid;
2461 uint32_t eks_blacklisted;
2462 uint32_t eks_unverifiable;
2463 uint32_t eks_wrong_node;
2464 uint32_t eks_licensed_apps_lo;
2465 uint32_t eks_licensed_apps_hi;
2466 uint32_t eks_licensed_features_lo;
2467 uint32_t eks_licensed_features_hi;
2470 extern __checkReturn efx_rc_t
2472 __in efx_nic_t *enp);
2476 __in efx_nic_t *enp);
2478 extern __checkReturn boolean_t
2479 efx_lic_check_support(
2480 __in efx_nic_t *enp);
2482 extern __checkReturn efx_rc_t
2483 efx_lic_update_licenses(
2484 __in efx_nic_t *enp);
2486 extern __checkReturn efx_rc_t
2487 efx_lic_get_key_stats(
2488 __in efx_nic_t *enp,
2489 __out efx_key_stats_t *ksp);
2491 extern __checkReturn efx_rc_t
2493 __in efx_nic_t *enp,
2494 __in uint64_t app_id,
2495 __out boolean_t *licensedp);
2497 extern __checkReturn efx_rc_t
2499 __in efx_nic_t *enp,
2500 __in size_t buffer_size,
2501 __out uint32_t *typep,
2502 __out size_t *lengthp,
2503 __out_opt uint8_t *bufferp);
2506 extern __checkReturn efx_rc_t
2508 __in efx_nic_t *enp,
2509 __in_bcount(buffer_size)
2511 __in size_t buffer_size,
2512 __out uint32_t *startp
2515 extern __checkReturn efx_rc_t
2517 __in efx_nic_t *enp,
2518 __in_bcount(buffer_size)
2520 __in size_t buffer_size,
2521 __in uint32_t offset,
2522 __out uint32_t *endp
2525 extern __checkReturn __success(return != B_FALSE) boolean_t
2527 __in efx_nic_t *enp,
2528 __in_bcount(buffer_size)
2530 __in size_t buffer_size,
2531 __in uint32_t offset,
2532 __out uint32_t *startp,
2533 __out uint32_t *lengthp
2536 extern __checkReturn __success(return != B_FALSE) boolean_t
2537 efx_lic_validate_key(
2538 __in efx_nic_t *enp,
2539 __in_bcount(length) caddr_t keyp,
2540 __in uint32_t length
2543 extern __checkReturn efx_rc_t
2545 __in efx_nic_t *enp,
2546 __in_bcount(buffer_size)
2548 __in size_t buffer_size,
2549 __in uint32_t offset,
2550 __in uint32_t length,
2551 __out_bcount_part(key_max_size, *lengthp)
2553 __in size_t key_max_size,
2554 __out uint32_t *lengthp
2557 extern __checkReturn efx_rc_t
2559 __in efx_nic_t *enp,
2560 __in_bcount(buffer_size)
2562 __in size_t buffer_size,
2563 __in uint32_t offset,
2564 __in_bcount(length) caddr_t keyp,
2565 __in uint32_t length,
2566 __out uint32_t *lengthp
2569 __checkReturn efx_rc_t
2571 __in efx_nic_t *enp,
2572 __in_bcount(buffer_size)
2574 __in size_t buffer_size,
2575 __in uint32_t offset,
2576 __in uint32_t length,
2578 __out uint32_t *deltap
2581 extern __checkReturn efx_rc_t
2582 efx_lic_create_partition(
2583 __in efx_nic_t *enp,
2584 __in_bcount(buffer_size)
2586 __in size_t buffer_size
2589 extern __checkReturn efx_rc_t
2590 efx_lic_finish_partition(
2591 __in efx_nic_t *enp,
2592 __in_bcount(buffer_size)
2594 __in size_t buffer_size
2597 #endif /* EFSYS_OPT_LICENSING */
2605 #endif /* _SYS_EFX_H */