1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright (c) 2006-2018 Solarflare Communications Inc.
10 #include "efx_annote.h"
12 #include "efx_check.h"
13 #include "efx_phy_ids.h"
19 #define EFX_STATIC_ASSERT(_cond) \
20 ((void)sizeof (char[(_cond) ? 1 : -1]))
22 #define EFX_ARRAY_SIZE(_array) \
23 (sizeof (_array) / sizeof ((_array)[0]))
25 #define EFX_FIELD_OFFSET(_type, _field) \
26 ((size_t)&(((_type *)0)->_field))
28 /* The macro expands divider twice */
29 #define EFX_DIV_ROUND_UP(_n, _d) (((_n) + (_d) - 1) / (_d))
33 typedef __success(return == 0) int efx_rc_t;
38 typedef enum efx_family_e {
40 EFX_FAMILY_FALCON, /* Obsolete and not supported */
42 EFX_FAMILY_HUNTINGTON,
48 extern __checkReturn efx_rc_t
52 __out efx_family_t *efp,
53 __out unsigned int *membarp);
56 #define EFX_PCI_VENID_SFC 0x1924
58 #define EFX_PCI_DEVID_FALCON 0x0710 /* SFC4000 */
60 #define EFX_PCI_DEVID_BETHPAGE 0x0803 /* SFC9020 */
61 #define EFX_PCI_DEVID_SIENA 0x0813 /* SFL9021 */
62 #define EFX_PCI_DEVID_SIENA_F1_UNINIT 0x0810
64 #define EFX_PCI_DEVID_HUNTINGTON_PF_UNINIT 0x0901
65 #define EFX_PCI_DEVID_FARMINGDALE 0x0903 /* SFC9120 PF */
66 #define EFX_PCI_DEVID_GREENPORT 0x0923 /* SFC9140 PF */
68 #define EFX_PCI_DEVID_FARMINGDALE_VF 0x1903 /* SFC9120 VF */
69 #define EFX_PCI_DEVID_GREENPORT_VF 0x1923 /* SFC9140 VF */
71 #define EFX_PCI_DEVID_MEDFORD_PF_UNINIT 0x0913
72 #define EFX_PCI_DEVID_MEDFORD 0x0A03 /* SFC9240 PF */
73 #define EFX_PCI_DEVID_MEDFORD_VF 0x1A03 /* SFC9240 VF */
75 #define EFX_PCI_DEVID_MEDFORD2_PF_UNINIT 0x0B13
76 #define EFX_PCI_DEVID_MEDFORD2 0x0B03 /* SFC9250 PF */
77 #define EFX_PCI_DEVID_MEDFORD2_VF 0x1B03 /* SFC9250 VF */
80 #define EFX_MEM_BAR_SIENA 2
82 #define EFX_MEM_BAR_HUNTINGTON_PF 2
83 #define EFX_MEM_BAR_HUNTINGTON_VF 0
85 #define EFX_MEM_BAR_MEDFORD_PF 2
86 #define EFX_MEM_BAR_MEDFORD_VF 0
88 #define EFX_MEM_BAR_MEDFORD2 0
109 /* Calculate the IEEE 802.3 CRC32 of a MAC addr */
110 extern __checkReturn uint32_t
112 __in uint32_t crc_init,
113 __in_ecount(length) uint8_t const *input,
117 /* Type prototypes */
119 typedef struct efx_rxq_s efx_rxq_t;
123 typedef struct efx_nic_s efx_nic_t;
125 extern __checkReturn efx_rc_t
127 __in efx_family_t family,
128 __in efsys_identifier_t *esip,
129 __in efsys_bar_t *esbp,
130 __in efsys_lock_t *eslp,
131 __deref_out efx_nic_t **enpp);
133 /* EFX_FW_VARIANT codes map one to one on MC_CMD_FW codes */
134 typedef enum efx_fw_variant_e {
135 EFX_FW_VARIANT_FULL_FEATURED,
136 EFX_FW_VARIANT_LOW_LATENCY,
137 EFX_FW_VARIANT_PACKED_STREAM,
138 EFX_FW_VARIANT_HIGH_TX_RATE,
139 EFX_FW_VARIANT_PACKED_STREAM_HASH_MODE_1,
140 EFX_FW_VARIANT_RULES_ENGINE,
142 EFX_FW_VARIANT_DONT_CARE = 0xffffffff
145 extern __checkReturn efx_rc_t
148 __in efx_fw_variant_t efv);
150 extern __checkReturn efx_rc_t
152 __in efx_nic_t *enp);
154 extern __checkReturn efx_rc_t
156 __in efx_nic_t *enp);
158 extern __checkReturn boolean_t
159 efx_nic_hw_unavailable(
160 __in efx_nic_t *enp);
163 efx_nic_set_hw_unavailable(
164 __in efx_nic_t *enp);
168 extern __checkReturn efx_rc_t
169 efx_nic_register_test(
170 __in efx_nic_t *enp);
172 #endif /* EFSYS_OPT_DIAG */
176 __in efx_nic_t *enp);
180 __in efx_nic_t *enp);
184 __in efx_nic_t *enp);
186 #define EFX_PCIE_LINK_SPEED_GEN1 1
187 #define EFX_PCIE_LINK_SPEED_GEN2 2
188 #define EFX_PCIE_LINK_SPEED_GEN3 3
190 typedef enum efx_pcie_link_performance_e {
191 EFX_PCIE_LINK_PERFORMANCE_UNKNOWN_BANDWIDTH,
192 EFX_PCIE_LINK_PERFORMANCE_SUBOPTIMAL_BANDWIDTH,
193 EFX_PCIE_LINK_PERFORMANCE_SUBOPTIMAL_LATENCY,
194 EFX_PCIE_LINK_PERFORMANCE_OPTIMAL
195 } efx_pcie_link_performance_t;
197 extern __checkReturn efx_rc_t
198 efx_nic_calculate_pcie_link_bandwidth(
199 __in uint32_t pcie_link_width,
200 __in uint32_t pcie_link_gen,
201 __out uint32_t *bandwidth_mbpsp);
203 extern __checkReturn efx_rc_t
204 efx_nic_check_pcie_link_speed(
206 __in uint32_t pcie_link_width,
207 __in uint32_t pcie_link_gen,
208 __out efx_pcie_link_performance_t *resultp);
212 #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
213 /* Huntington and Medford require MCDIv2 commands */
214 #define WITH_MCDI_V2 1
217 typedef struct efx_mcdi_req_s efx_mcdi_req_t;
219 typedef enum efx_mcdi_exception_e {
220 EFX_MCDI_EXCEPTION_MC_REBOOT,
221 EFX_MCDI_EXCEPTION_MC_BADASSERT,
222 } efx_mcdi_exception_t;
224 #if EFSYS_OPT_MCDI_LOGGING
225 typedef enum efx_log_msg_e {
227 EFX_LOG_MCDI_REQUEST,
228 EFX_LOG_MCDI_RESPONSE,
230 #endif /* EFSYS_OPT_MCDI_LOGGING */
232 typedef struct efx_mcdi_transport_s {
234 efsys_mem_t *emt_dma_mem;
235 void (*emt_execute)(void *, efx_mcdi_req_t *);
236 void (*emt_ev_cpl)(void *);
237 void (*emt_exception)(void *, efx_mcdi_exception_t);
238 #if EFSYS_OPT_MCDI_LOGGING
239 void (*emt_logger)(void *, efx_log_msg_t,
240 void *, size_t, void *, size_t);
241 #endif /* EFSYS_OPT_MCDI_LOGGING */
242 #if EFSYS_OPT_MCDI_PROXY_AUTH
243 void (*emt_ev_proxy_response)(void *, uint32_t, efx_rc_t);
244 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH */
245 } efx_mcdi_transport_t;
247 extern __checkReturn efx_rc_t
250 __in const efx_mcdi_transport_t *mtp);
252 extern __checkReturn efx_rc_t
254 __in efx_nic_t *enp);
258 __in efx_nic_t *enp);
261 efx_mcdi_get_timeout(
263 __in efx_mcdi_req_t *emrp,
264 __out uint32_t *usec_timeoutp);
267 efx_mcdi_request_start(
269 __in efx_mcdi_req_t *emrp,
270 __in boolean_t ev_cpl);
272 extern __checkReturn boolean_t
273 efx_mcdi_request_poll(
274 __in efx_nic_t *enp);
276 extern __checkReturn boolean_t
277 efx_mcdi_request_abort(
278 __in efx_nic_t *enp);
282 __in efx_nic_t *enp);
284 #endif /* EFSYS_OPT_MCDI */
288 #define EFX_NINTR_SIENA 1024
290 typedef enum efx_intr_type_e {
291 EFX_INTR_INVALID = 0,
297 #define EFX_INTR_SIZE (sizeof (efx_oword_t))
299 extern __checkReturn efx_rc_t
302 __in efx_intr_type_t type,
303 __in efsys_mem_t *esmp);
307 __in efx_nic_t *enp);
311 __in efx_nic_t *enp);
314 efx_intr_disable_unlocked(
315 __in efx_nic_t *enp);
317 #define EFX_INTR_NEVQS 32
319 extern __checkReturn efx_rc_t
322 __in unsigned int level);
325 efx_intr_status_line(
327 __out boolean_t *fatalp,
328 __out uint32_t *maskp);
331 efx_intr_status_message(
333 __in unsigned int message,
334 __out boolean_t *fatalp);
338 __in efx_nic_t *enp);
342 __in efx_nic_t *enp);
346 #if EFSYS_OPT_MAC_STATS
348 /* START MKCONFIG GENERATED EfxHeaderMacBlock ea466a9bc8789994 */
349 typedef enum efx_mac_stat_e {
352 EFX_MAC_RX_UNICST_PKTS,
353 EFX_MAC_RX_MULTICST_PKTS,
354 EFX_MAC_RX_BRDCST_PKTS,
355 EFX_MAC_RX_PAUSE_PKTS,
356 EFX_MAC_RX_LE_64_PKTS,
357 EFX_MAC_RX_65_TO_127_PKTS,
358 EFX_MAC_RX_128_TO_255_PKTS,
359 EFX_MAC_RX_256_TO_511_PKTS,
360 EFX_MAC_RX_512_TO_1023_PKTS,
361 EFX_MAC_RX_1024_TO_15XX_PKTS,
362 EFX_MAC_RX_GE_15XX_PKTS,
364 EFX_MAC_RX_FCS_ERRORS,
365 EFX_MAC_RX_DROP_EVENTS,
366 EFX_MAC_RX_FALSE_CARRIER_ERRORS,
367 EFX_MAC_RX_SYMBOL_ERRORS,
368 EFX_MAC_RX_ALIGN_ERRORS,
369 EFX_MAC_RX_INTERNAL_ERRORS,
370 EFX_MAC_RX_JABBER_PKTS,
371 EFX_MAC_RX_LANE0_CHAR_ERR,
372 EFX_MAC_RX_LANE1_CHAR_ERR,
373 EFX_MAC_RX_LANE2_CHAR_ERR,
374 EFX_MAC_RX_LANE3_CHAR_ERR,
375 EFX_MAC_RX_LANE0_DISP_ERR,
376 EFX_MAC_RX_LANE1_DISP_ERR,
377 EFX_MAC_RX_LANE2_DISP_ERR,
378 EFX_MAC_RX_LANE3_DISP_ERR,
379 EFX_MAC_RX_MATCH_FAULT,
380 EFX_MAC_RX_NODESC_DROP_CNT,
383 EFX_MAC_TX_UNICST_PKTS,
384 EFX_MAC_TX_MULTICST_PKTS,
385 EFX_MAC_TX_BRDCST_PKTS,
386 EFX_MAC_TX_PAUSE_PKTS,
387 EFX_MAC_TX_LE_64_PKTS,
388 EFX_MAC_TX_65_TO_127_PKTS,
389 EFX_MAC_TX_128_TO_255_PKTS,
390 EFX_MAC_TX_256_TO_511_PKTS,
391 EFX_MAC_TX_512_TO_1023_PKTS,
392 EFX_MAC_TX_1024_TO_15XX_PKTS,
393 EFX_MAC_TX_GE_15XX_PKTS,
395 EFX_MAC_TX_SGL_COL_PKTS,
396 EFX_MAC_TX_MULT_COL_PKTS,
397 EFX_MAC_TX_EX_COL_PKTS,
398 EFX_MAC_TX_LATE_COL_PKTS,
400 EFX_MAC_TX_EX_DEF_PKTS,
401 EFX_MAC_PM_TRUNC_BB_OVERFLOW,
402 EFX_MAC_PM_DISCARD_BB_OVERFLOW,
403 EFX_MAC_PM_TRUNC_VFIFO_FULL,
404 EFX_MAC_PM_DISCARD_VFIFO_FULL,
405 EFX_MAC_PM_TRUNC_QBB,
406 EFX_MAC_PM_DISCARD_QBB,
407 EFX_MAC_PM_DISCARD_MAPPING,
408 EFX_MAC_RXDP_Q_DISABLED_PKTS,
409 EFX_MAC_RXDP_DI_DROPPED_PKTS,
410 EFX_MAC_RXDP_STREAMING_PKTS,
411 EFX_MAC_RXDP_HLB_FETCH,
412 EFX_MAC_RXDP_HLB_WAIT,
413 EFX_MAC_VADAPTER_RX_UNICAST_PACKETS,
414 EFX_MAC_VADAPTER_RX_UNICAST_BYTES,
415 EFX_MAC_VADAPTER_RX_MULTICAST_PACKETS,
416 EFX_MAC_VADAPTER_RX_MULTICAST_BYTES,
417 EFX_MAC_VADAPTER_RX_BROADCAST_PACKETS,
418 EFX_MAC_VADAPTER_RX_BROADCAST_BYTES,
419 EFX_MAC_VADAPTER_RX_BAD_PACKETS,
420 EFX_MAC_VADAPTER_RX_BAD_BYTES,
421 EFX_MAC_VADAPTER_RX_OVERFLOW,
422 EFX_MAC_VADAPTER_TX_UNICAST_PACKETS,
423 EFX_MAC_VADAPTER_TX_UNICAST_BYTES,
424 EFX_MAC_VADAPTER_TX_MULTICAST_PACKETS,
425 EFX_MAC_VADAPTER_TX_MULTICAST_BYTES,
426 EFX_MAC_VADAPTER_TX_BROADCAST_PACKETS,
427 EFX_MAC_VADAPTER_TX_BROADCAST_BYTES,
428 EFX_MAC_VADAPTER_TX_BAD_PACKETS,
429 EFX_MAC_VADAPTER_TX_BAD_BYTES,
430 EFX_MAC_VADAPTER_TX_OVERFLOW,
431 EFX_MAC_FEC_UNCORRECTED_ERRORS,
432 EFX_MAC_FEC_CORRECTED_ERRORS,
433 EFX_MAC_FEC_CORRECTED_SYMBOLS_LANE0,
434 EFX_MAC_FEC_CORRECTED_SYMBOLS_LANE1,
435 EFX_MAC_FEC_CORRECTED_SYMBOLS_LANE2,
436 EFX_MAC_FEC_CORRECTED_SYMBOLS_LANE3,
437 EFX_MAC_CTPIO_VI_BUSY_FALLBACK,
438 EFX_MAC_CTPIO_LONG_WRITE_SUCCESS,
439 EFX_MAC_CTPIO_MISSING_DBELL_FAIL,
440 EFX_MAC_CTPIO_OVERFLOW_FAIL,
441 EFX_MAC_CTPIO_UNDERFLOW_FAIL,
442 EFX_MAC_CTPIO_TIMEOUT_FAIL,
443 EFX_MAC_CTPIO_NONCONTIG_WR_FAIL,
444 EFX_MAC_CTPIO_FRM_CLOBBER_FAIL,
445 EFX_MAC_CTPIO_INVALID_WR_FAIL,
446 EFX_MAC_CTPIO_VI_CLOBBER_FALLBACK,
447 EFX_MAC_CTPIO_UNQUALIFIED_FALLBACK,
448 EFX_MAC_CTPIO_RUNT_FALLBACK,
449 EFX_MAC_CTPIO_SUCCESS,
450 EFX_MAC_CTPIO_FALLBACK,
451 EFX_MAC_CTPIO_POISON,
453 EFX_MAC_RXDP_SCATTER_DISABLED_TRUNC,
454 EFX_MAC_RXDP_HLB_IDLE,
455 EFX_MAC_RXDP_HLB_TIMEOUT,
459 /* END MKCONFIG GENERATED EfxHeaderMacBlock */
461 #endif /* EFSYS_OPT_MAC_STATS */
463 typedef enum efx_link_mode_e {
464 EFX_LINK_UNKNOWN = 0,
480 #define EFX_MAC_ADDR_LEN 6
482 #define EFX_VNI_OR_VSID_LEN 3
484 #define EFX_MAC_ADDR_IS_MULTICAST(_address) (((uint8_t *)_address)[0] & 0x01)
486 #define EFX_MAC_MULTICAST_LIST_MAX 256
488 #define EFX_MAC_SDU_MAX 9202
490 #define EFX_MAC_PDU_ADJUSTMENT \
494 + /* bug16011 */ 16) \
496 #define EFX_MAC_PDU(_sdu) \
497 P2ROUNDUP((_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8)
500 * Due to the P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give
501 * the SDU rounded up slightly.
503 #define EFX_MAC_SDU_FROM_PDU(_pdu) ((_pdu) - EFX_MAC_PDU_ADJUSTMENT)
505 #define EFX_MAC_PDU_MIN 60
506 #define EFX_MAC_PDU_MAX EFX_MAC_PDU(EFX_MAC_SDU_MAX)
508 extern __checkReturn efx_rc_t
513 extern __checkReturn efx_rc_t
518 extern __checkReturn efx_rc_t
523 extern __checkReturn efx_rc_t
526 __in boolean_t all_unicst,
527 __in boolean_t mulcst,
528 __in boolean_t all_mulcst,
529 __in boolean_t brdcst);
531 extern __checkReturn efx_rc_t
532 efx_mac_multicast_list_set(
534 __in_ecount(6*count) uint8_t const *addrs,
537 extern __checkReturn efx_rc_t
538 efx_mac_filter_default_rxq_set(
541 __in boolean_t using_rss);
544 efx_mac_filter_default_rxq_clear(
545 __in efx_nic_t *enp);
547 extern __checkReturn efx_rc_t
550 __in boolean_t enabled);
552 extern __checkReturn efx_rc_t
555 __out boolean_t *mac_upp);
557 #define EFX_FCNTL_RESPOND 0x00000001
558 #define EFX_FCNTL_GENERATE 0x00000002
560 extern __checkReturn efx_rc_t
563 __in unsigned int fcntl,
564 __in boolean_t autoneg);
569 __out unsigned int *fcntl_wantedp,
570 __out unsigned int *fcntl_linkp);
573 #if EFSYS_OPT_MAC_STATS
577 extern __checkReturn const char *
580 __in unsigned int id);
582 #endif /* EFSYS_OPT_NAMES */
584 #define EFX_MAC_STATS_MASK_BITS_PER_PAGE (8 * sizeof (uint32_t))
586 #define EFX_MAC_STATS_MASK_NPAGES \
587 (P2ROUNDUP(EFX_MAC_NSTATS, EFX_MAC_STATS_MASK_BITS_PER_PAGE) / \
588 EFX_MAC_STATS_MASK_BITS_PER_PAGE)
591 * Get mask of MAC statistics supported by the hardware.
593 * If mask_size is insufficient to return the mask, EINVAL error is
594 * returned. EFX_MAC_STATS_MASK_NPAGES multiplied by size of the page
595 * (which is sizeof (uint32_t)) is sufficient.
597 extern __checkReturn efx_rc_t
598 efx_mac_stats_get_mask(
600 __out_bcount(mask_size) uint32_t *maskp,
601 __in size_t mask_size);
603 #define EFX_MAC_STAT_SUPPORTED(_mask, _stat) \
604 ((_mask)[(_stat) / EFX_MAC_STATS_MASK_BITS_PER_PAGE] & \
605 (1ULL << ((_stat) & (EFX_MAC_STATS_MASK_BITS_PER_PAGE - 1))))
608 extern __checkReturn efx_rc_t
610 __in efx_nic_t *enp);
613 * Upload mac statistics supported by the hardware into the given buffer.
615 * The DMA buffer must be 4Kbyte aligned and sized to hold at least
616 * efx_nic_cfg_t::enc_mac_stats_nstats 64bit counters.
618 * The hardware will only DMA statistics that it understands (of course).
619 * Drivers should not make any assumptions about which statistics are
620 * supported, especially when the statistics are generated by firmware.
622 * Thus, drivers should zero this buffer before use, so that not-understood
623 * statistics read back as zero.
625 extern __checkReturn efx_rc_t
626 efx_mac_stats_upload(
628 __in efsys_mem_t *esmp);
630 extern __checkReturn efx_rc_t
631 efx_mac_stats_periodic(
633 __in efsys_mem_t *esmp,
634 __in uint16_t period_ms,
635 __in boolean_t events);
637 extern __checkReturn efx_rc_t
638 efx_mac_stats_update(
640 __in efsys_mem_t *esmp,
641 __inout_ecount(EFX_MAC_NSTATS) efsys_stat_t *stat,
642 __inout_opt uint32_t *generationp);
644 #endif /* EFSYS_OPT_MAC_STATS */
648 typedef enum efx_mon_type_e {
660 __in efx_nic_t *enp);
662 #endif /* EFSYS_OPT_NAMES */
664 extern __checkReturn efx_rc_t
666 __in efx_nic_t *enp);
668 #if EFSYS_OPT_MON_STATS
670 #define EFX_MON_STATS_PAGE_SIZE 0x100
671 #define EFX_MON_MASK_ELEMENT_SIZE 32
673 /* START MKCONFIG GENERATED MonitorHeaderStatsBlock 78b65c8d5af9747b */
674 typedef enum efx_mon_stat_e {
675 EFX_MON_STAT_CONTROLLER_TEMP,
676 EFX_MON_STAT_PHY_COMMON_TEMP,
677 EFX_MON_STAT_CONTROLLER_COOLING,
678 EFX_MON_STAT_PHY0_TEMP,
679 EFX_MON_STAT_PHY0_COOLING,
680 EFX_MON_STAT_PHY1_TEMP,
681 EFX_MON_STAT_PHY1_COOLING,
687 EFX_MON_STAT_IN_12V0,
688 EFX_MON_STAT_IN_1V2A,
689 EFX_MON_STAT_IN_VREF,
690 EFX_MON_STAT_OUT_VAOE,
691 EFX_MON_STAT_AOE_TEMP,
692 EFX_MON_STAT_PSU_AOE_TEMP,
693 EFX_MON_STAT_PSU_TEMP,
699 EFX_MON_STAT_IN_VAOE,
700 EFX_MON_STAT_OUT_IAOE,
701 EFX_MON_STAT_IN_IAOE,
702 EFX_MON_STAT_NIC_POWER,
704 EFX_MON_STAT_IN_I0V9,
705 EFX_MON_STAT_IN_I1V2,
706 EFX_MON_STAT_IN_0V9_ADC,
707 EFX_MON_STAT_CONTROLLER_2_TEMP,
708 EFX_MON_STAT_VREG_INTERNAL_TEMP,
709 EFX_MON_STAT_VREG_0V9_TEMP,
710 EFX_MON_STAT_VREG_1V2_TEMP,
711 EFX_MON_STAT_CONTROLLER_VPTAT,
712 EFX_MON_STAT_CONTROLLER_INTERNAL_TEMP,
713 EFX_MON_STAT_CONTROLLER_VPTAT_EXTADC,
714 EFX_MON_STAT_CONTROLLER_INTERNAL_TEMP_EXTADC,
715 EFX_MON_STAT_AMBIENT_TEMP,
716 EFX_MON_STAT_AIRFLOW,
717 EFX_MON_STAT_VDD08D_VSS08D_CSR,
718 EFX_MON_STAT_VDD08D_VSS08D_CSR_EXTADC,
719 EFX_MON_STAT_HOTPOINT_TEMP,
720 EFX_MON_STAT_PHY_POWER_PORT0,
721 EFX_MON_STAT_PHY_POWER_PORT1,
722 EFX_MON_STAT_MUM_VCC,
723 EFX_MON_STAT_IN_0V9_A,
724 EFX_MON_STAT_IN_I0V9_A,
725 EFX_MON_STAT_VREG_0V9_A_TEMP,
726 EFX_MON_STAT_IN_0V9_B,
727 EFX_MON_STAT_IN_I0V9_B,
728 EFX_MON_STAT_VREG_0V9_B_TEMP,
729 EFX_MON_STAT_CCOM_AVREG_1V2_SUPPLY,
730 EFX_MON_STAT_CCOM_AVREG_1V2_SUPPLY_EXTADC,
731 EFX_MON_STAT_CCOM_AVREG_1V8_SUPPLY,
732 EFX_MON_STAT_CCOM_AVREG_1V8_SUPPLY_EXTADC,
733 EFX_MON_STAT_CONTROLLER_MASTER_VPTAT,
734 EFX_MON_STAT_CONTROLLER_MASTER_INTERNAL_TEMP,
735 EFX_MON_STAT_CONTROLLER_MASTER_VPTAT_EXTADC,
736 EFX_MON_STAT_CONTROLLER_MASTER_INTERNAL_TEMP_EXTADC,
737 EFX_MON_STAT_CONTROLLER_SLAVE_VPTAT,
738 EFX_MON_STAT_CONTROLLER_SLAVE_INTERNAL_TEMP,
739 EFX_MON_STAT_CONTROLLER_SLAVE_VPTAT_EXTADC,
740 EFX_MON_STAT_CONTROLLER_SLAVE_INTERNAL_TEMP_EXTADC,
741 EFX_MON_STAT_SODIMM_VOUT,
742 EFX_MON_STAT_SODIMM_0_TEMP,
743 EFX_MON_STAT_SODIMM_1_TEMP,
744 EFX_MON_STAT_PHY0_VCC,
745 EFX_MON_STAT_PHY1_VCC,
746 EFX_MON_STAT_CONTROLLER_TDIODE_TEMP,
747 EFX_MON_STAT_BOARD_FRONT_TEMP,
748 EFX_MON_STAT_BOARD_BACK_TEMP,
749 EFX_MON_STAT_IN_I1V8,
750 EFX_MON_STAT_IN_I2V5,
751 EFX_MON_STAT_IN_I3V3,
752 EFX_MON_STAT_IN_I12V0,
754 EFX_MON_STAT_IN_I1V3,
758 /* END MKCONFIG GENERATED MonitorHeaderStatsBlock */
760 typedef enum efx_mon_stat_state_e {
761 EFX_MON_STAT_STATE_OK = 0,
762 EFX_MON_STAT_STATE_WARNING = 1,
763 EFX_MON_STAT_STATE_FATAL = 2,
764 EFX_MON_STAT_STATE_BROKEN = 3,
765 EFX_MON_STAT_STATE_NO_READING = 4,
766 } efx_mon_stat_state_t;
768 typedef enum efx_mon_stat_unit_e {
769 EFX_MON_STAT_UNIT_UNKNOWN = 0,
770 EFX_MON_STAT_UNIT_BOOL,
771 EFX_MON_STAT_UNIT_TEMP_C,
772 EFX_MON_STAT_UNIT_VOLTAGE_MV,
773 EFX_MON_STAT_UNIT_CURRENT_MA,
774 EFX_MON_STAT_UNIT_POWER_W,
775 EFX_MON_STAT_UNIT_RPM,
777 } efx_mon_stat_unit_t;
779 typedef struct efx_mon_stat_value_s {
781 efx_mon_stat_state_t emsv_state;
782 efx_mon_stat_unit_t emsv_unit;
783 } efx_mon_stat_value_t;
785 typedef struct efx_mon_limit_value_s {
786 uint16_t emlv_warning_min;
787 uint16_t emlv_warning_max;
788 uint16_t emlv_fatal_min;
789 uint16_t emlv_fatal_max;
790 } efx_mon_stat_limits_t;
792 typedef enum efx_mon_stat_portmask_e {
793 EFX_MON_STAT_PORTMAP_NONE = 0,
794 EFX_MON_STAT_PORTMAP_PORT0 = 1,
795 EFX_MON_STAT_PORTMAP_PORT1 = 2,
796 EFX_MON_STAT_PORTMAP_PORT2 = 3,
797 EFX_MON_STAT_PORTMAP_PORT3 = 4,
798 EFX_MON_STAT_PORTMAP_ALL = (-1),
799 EFX_MON_STAT_PORTMAP_UNKNOWN = (-2)
800 } efx_mon_stat_portmask_t;
807 __in efx_mon_stat_t id);
810 efx_mon_stat_description(
812 __in efx_mon_stat_t id);
814 #endif /* EFSYS_OPT_NAMES */
816 extern __checkReturn boolean_t
817 efx_mon_mcdi_to_efx_stat(
819 __out efx_mon_stat_t *statp);
821 extern __checkReturn boolean_t
822 efx_mon_get_stat_unit(
823 __in efx_mon_stat_t stat,
824 __out efx_mon_stat_unit_t *unitp);
826 extern __checkReturn boolean_t
827 efx_mon_get_stat_portmap(
828 __in efx_mon_stat_t stat,
829 __out efx_mon_stat_portmask_t *maskp);
831 extern __checkReturn efx_rc_t
832 efx_mon_stats_update(
834 __in efsys_mem_t *esmp,
835 __inout_ecount(EFX_MON_NSTATS) efx_mon_stat_value_t *values);
837 extern __checkReturn efx_rc_t
838 efx_mon_limits_update(
840 __inout_ecount(EFX_MON_NSTATS) efx_mon_stat_limits_t *values);
842 #endif /* EFSYS_OPT_MON_STATS */
846 __in efx_nic_t *enp);
850 extern __checkReturn efx_rc_t
852 __in efx_nic_t *enp);
854 #if EFSYS_OPT_PHY_LED_CONTROL
856 typedef enum efx_phy_led_mode_e {
857 EFX_PHY_LED_DEFAULT = 0,
862 } efx_phy_led_mode_t;
864 extern __checkReturn efx_rc_t
867 __in efx_phy_led_mode_t mode);
869 #endif /* EFSYS_OPT_PHY_LED_CONTROL */
871 extern __checkReturn efx_rc_t
873 __in efx_nic_t *enp);
875 #if EFSYS_OPT_LOOPBACK
877 typedef enum efx_loopback_type_e {
878 EFX_LOOPBACK_OFF = 0,
879 EFX_LOOPBACK_DATA = 1,
880 EFX_LOOPBACK_GMAC = 2,
881 EFX_LOOPBACK_XGMII = 3,
882 EFX_LOOPBACK_XGXS = 4,
883 EFX_LOOPBACK_XAUI = 5,
884 EFX_LOOPBACK_GMII = 6,
885 EFX_LOOPBACK_SGMII = 7,
886 EFX_LOOPBACK_XGBR = 8,
887 EFX_LOOPBACK_XFI = 9,
888 EFX_LOOPBACK_XAUI_FAR = 10,
889 EFX_LOOPBACK_GMII_FAR = 11,
890 EFX_LOOPBACK_SGMII_FAR = 12,
891 EFX_LOOPBACK_XFI_FAR = 13,
892 EFX_LOOPBACK_GPHY = 14,
893 EFX_LOOPBACK_PHY_XS = 15,
894 EFX_LOOPBACK_PCS = 16,
895 EFX_LOOPBACK_PMA_PMD = 17,
896 EFX_LOOPBACK_XPORT = 18,
897 EFX_LOOPBACK_XGMII_WS = 19,
898 EFX_LOOPBACK_XAUI_WS = 20,
899 EFX_LOOPBACK_XAUI_WS_FAR = 21,
900 EFX_LOOPBACK_XAUI_WS_NEAR = 22,
901 EFX_LOOPBACK_GMII_WS = 23,
902 EFX_LOOPBACK_XFI_WS = 24,
903 EFX_LOOPBACK_XFI_WS_FAR = 25,
904 EFX_LOOPBACK_PHYXS_WS = 26,
905 EFX_LOOPBACK_PMA_INT = 27,
906 EFX_LOOPBACK_SD_NEAR = 28,
907 EFX_LOOPBACK_SD_FAR = 29,
908 EFX_LOOPBACK_PMA_INT_WS = 30,
909 EFX_LOOPBACK_SD_FEP2_WS = 31,
910 EFX_LOOPBACK_SD_FEP1_5_WS = 32,
911 EFX_LOOPBACK_SD_FEP_WS = 33,
912 EFX_LOOPBACK_SD_FES_WS = 34,
913 EFX_LOOPBACK_AOE_INT_NEAR = 35,
914 EFX_LOOPBACK_DATA_WS = 36,
915 EFX_LOOPBACK_FORCE_EXT_LINK = 37,
917 } efx_loopback_type_t;
919 typedef enum efx_loopback_kind_e {
920 EFX_LOOPBACK_KIND_OFF = 0,
921 EFX_LOOPBACK_KIND_ALL,
922 EFX_LOOPBACK_KIND_MAC,
923 EFX_LOOPBACK_KIND_PHY,
925 } efx_loopback_kind_t;
929 __in efx_loopback_kind_t loopback_kind,
930 __out efx_qword_t *maskp);
932 extern __checkReturn efx_rc_t
933 efx_port_loopback_set(
935 __in efx_link_mode_t link_mode,
936 __in efx_loopback_type_t type);
940 extern __checkReturn const char *
941 efx_loopback_type_name(
943 __in efx_loopback_type_t type);
945 #endif /* EFSYS_OPT_NAMES */
947 #endif /* EFSYS_OPT_LOOPBACK */
949 extern __checkReturn efx_rc_t
952 __out_opt efx_link_mode_t *link_modep);
956 __in efx_nic_t *enp);
958 typedef enum efx_phy_cap_type_e {
959 EFX_PHY_CAP_INVALID = 0,
966 EFX_PHY_CAP_10000FDX,
970 EFX_PHY_CAP_40000FDX,
972 EFX_PHY_CAP_100000FDX,
973 EFX_PHY_CAP_25000FDX,
974 EFX_PHY_CAP_50000FDX,
975 EFX_PHY_CAP_BASER_FEC,
976 EFX_PHY_CAP_BASER_FEC_REQUESTED,
978 EFX_PHY_CAP_RS_FEC_REQUESTED,
979 EFX_PHY_CAP_25G_BASER_FEC,
980 EFX_PHY_CAP_25G_BASER_FEC_REQUESTED,
982 } efx_phy_cap_type_t;
985 #define EFX_PHY_CAP_CURRENT 0x00000000
986 #define EFX_PHY_CAP_DEFAULT 0x00000001
987 #define EFX_PHY_CAP_PERM 0x00000002
993 __out uint32_t *maskp);
995 extern __checkReturn efx_rc_t
1002 __in efx_nic_t *enp,
1003 __out uint32_t *maskp);
1005 extern __checkReturn efx_rc_t
1007 __in efx_nic_t *enp,
1008 __out uint32_t *ouip);
1010 typedef enum efx_phy_media_type_e {
1011 EFX_PHY_MEDIA_INVALID = 0,
1016 EFX_PHY_MEDIA_SFP_PLUS,
1017 EFX_PHY_MEDIA_BASE_T,
1018 EFX_PHY_MEDIA_QSFP_PLUS,
1019 EFX_PHY_MEDIA_NTYPES
1020 } efx_phy_media_type_t;
1023 * Get the type of medium currently used. If the board has ports for
1024 * modules, a module is present, and we recognise the media type of
1025 * the module, then this will be the media type of the module.
1026 * Otherwise it will be the media type of the port.
1029 efx_phy_media_type_get(
1030 __in efx_nic_t *enp,
1031 __out efx_phy_media_type_t *typep);
1034 * 2-wire device address of the base information in accordance with SFF-8472
1035 * Diagnostic Monitoring Interface for Optical Transceivers section
1036 * 4 Memory Organization.
1038 #define EFX_PHY_MEDIA_INFO_DEV_ADDR_SFP_BASE 0xA0
1041 * 2-wire device address of the digital diagnostics monitoring interface
1042 * in accordance with SFF-8472 Diagnostic Monitoring Interface for Optical
1043 * Transceivers section 4 Memory Organization.
1045 #define EFX_PHY_MEDIA_INFO_DEV_ADDR_SFP_DDM 0xA2
1048 * Hard wired 2-wire device address for QSFP+ in accordance with SFF-8436
1049 * QSFP+ 10 Gbs 4X PLUGGABLE TRANSCEIVER section 7.4 Device Addressing and
1052 #define EFX_PHY_MEDIA_INFO_DEV_ADDR_QSFP 0xA0
1054 extern __checkReturn efx_rc_t
1055 efx_phy_module_get_info(
1056 __in efx_nic_t *enp,
1057 __in uint8_t dev_addr,
1058 __in uint8_t offset,
1060 __out_bcount(len) uint8_t *data);
1062 #if EFSYS_OPT_PHY_STATS
1064 /* START MKCONFIG GENERATED PhyHeaderStatsBlock 30ed56ad501f8e36 */
1065 typedef enum efx_phy_stat_e {
1067 EFX_PHY_STAT_PMA_PMD_LINK_UP,
1068 EFX_PHY_STAT_PMA_PMD_RX_FAULT,
1069 EFX_PHY_STAT_PMA_PMD_TX_FAULT,
1070 EFX_PHY_STAT_PMA_PMD_REV_A,
1071 EFX_PHY_STAT_PMA_PMD_REV_B,
1072 EFX_PHY_STAT_PMA_PMD_REV_C,
1073 EFX_PHY_STAT_PMA_PMD_REV_D,
1074 EFX_PHY_STAT_PCS_LINK_UP,
1075 EFX_PHY_STAT_PCS_RX_FAULT,
1076 EFX_PHY_STAT_PCS_TX_FAULT,
1077 EFX_PHY_STAT_PCS_BER,
1078 EFX_PHY_STAT_PCS_BLOCK_ERRORS,
1079 EFX_PHY_STAT_PHY_XS_LINK_UP,
1080 EFX_PHY_STAT_PHY_XS_RX_FAULT,
1081 EFX_PHY_STAT_PHY_XS_TX_FAULT,
1082 EFX_PHY_STAT_PHY_XS_ALIGN,
1083 EFX_PHY_STAT_PHY_XS_SYNC_A,
1084 EFX_PHY_STAT_PHY_XS_SYNC_B,
1085 EFX_PHY_STAT_PHY_XS_SYNC_C,
1086 EFX_PHY_STAT_PHY_XS_SYNC_D,
1087 EFX_PHY_STAT_AN_LINK_UP,
1088 EFX_PHY_STAT_AN_MASTER,
1089 EFX_PHY_STAT_AN_LOCAL_RX_OK,
1090 EFX_PHY_STAT_AN_REMOTE_RX_OK,
1091 EFX_PHY_STAT_CL22EXT_LINK_UP,
1096 EFX_PHY_STAT_PMA_PMD_SIGNAL_A,
1097 EFX_PHY_STAT_PMA_PMD_SIGNAL_B,
1098 EFX_PHY_STAT_PMA_PMD_SIGNAL_C,
1099 EFX_PHY_STAT_PMA_PMD_SIGNAL_D,
1100 EFX_PHY_STAT_AN_COMPLETE,
1101 EFX_PHY_STAT_PMA_PMD_REV_MAJOR,
1102 EFX_PHY_STAT_PMA_PMD_REV_MINOR,
1103 EFX_PHY_STAT_PMA_PMD_REV_MICRO,
1104 EFX_PHY_STAT_PCS_FW_VERSION_0,
1105 EFX_PHY_STAT_PCS_FW_VERSION_1,
1106 EFX_PHY_STAT_PCS_FW_VERSION_2,
1107 EFX_PHY_STAT_PCS_FW_VERSION_3,
1108 EFX_PHY_STAT_PCS_FW_BUILD_YY,
1109 EFX_PHY_STAT_PCS_FW_BUILD_MM,
1110 EFX_PHY_STAT_PCS_FW_BUILD_DD,
1111 EFX_PHY_STAT_PCS_OP_MODE,
1115 /* END MKCONFIG GENERATED PhyHeaderStatsBlock */
1121 __in efx_nic_t *enp,
1122 __in efx_phy_stat_t stat);
1124 #endif /* EFSYS_OPT_NAMES */
1126 #define EFX_PHY_STATS_SIZE 0x100
1128 extern __checkReturn efx_rc_t
1129 efx_phy_stats_update(
1130 __in efx_nic_t *enp,
1131 __in efsys_mem_t *esmp,
1132 __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat);
1134 #endif /* EFSYS_OPT_PHY_STATS */
1139 typedef enum efx_bist_type_e {
1140 EFX_BIST_TYPE_UNKNOWN,
1141 EFX_BIST_TYPE_PHY_NORMAL,
1142 EFX_BIST_TYPE_PHY_CABLE_SHORT,
1143 EFX_BIST_TYPE_PHY_CABLE_LONG,
1144 EFX_BIST_TYPE_MC_MEM, /* Test the MC DMEM and IMEM */
1145 EFX_BIST_TYPE_SAT_MEM, /* Test the DMEM and IMEM of satellite cpus */
1146 EFX_BIST_TYPE_REG, /* Test the register memories */
1147 EFX_BIST_TYPE_NTYPES,
1150 typedef enum efx_bist_result_e {
1151 EFX_BIST_RESULT_UNKNOWN,
1152 EFX_BIST_RESULT_RUNNING,
1153 EFX_BIST_RESULT_PASSED,
1154 EFX_BIST_RESULT_FAILED,
1155 } efx_bist_result_t;
1157 typedef enum efx_phy_cable_status_e {
1158 EFX_PHY_CABLE_STATUS_OK,
1159 EFX_PHY_CABLE_STATUS_INVALID,
1160 EFX_PHY_CABLE_STATUS_OPEN,
1161 EFX_PHY_CABLE_STATUS_INTRAPAIRSHORT,
1162 EFX_PHY_CABLE_STATUS_INTERPAIRSHORT,
1163 EFX_PHY_CABLE_STATUS_BUSY,
1164 } efx_phy_cable_status_t;
1166 typedef enum efx_bist_value_e {
1167 EFX_BIST_PHY_CABLE_LENGTH_A,
1168 EFX_BIST_PHY_CABLE_LENGTH_B,
1169 EFX_BIST_PHY_CABLE_LENGTH_C,
1170 EFX_BIST_PHY_CABLE_LENGTH_D,
1171 EFX_BIST_PHY_CABLE_STATUS_A,
1172 EFX_BIST_PHY_CABLE_STATUS_B,
1173 EFX_BIST_PHY_CABLE_STATUS_C,
1174 EFX_BIST_PHY_CABLE_STATUS_D,
1175 EFX_BIST_FAULT_CODE,
1177 * Memory BIST specific values. These match to the MC_CMD_BIST_POLL
1183 EFX_BIST_MEM_EXPECT,
1184 EFX_BIST_MEM_ACTUAL,
1186 EFX_BIST_MEM_ECC_PARITY,
1187 EFX_BIST_MEM_ECC_FATAL,
1191 extern __checkReturn efx_rc_t
1192 efx_bist_enable_offline(
1193 __in efx_nic_t *enp);
1195 extern __checkReturn efx_rc_t
1197 __in efx_nic_t *enp,
1198 __in efx_bist_type_t type);
1200 extern __checkReturn efx_rc_t
1202 __in efx_nic_t *enp,
1203 __in efx_bist_type_t type,
1204 __out efx_bist_result_t *resultp,
1205 __out_opt uint32_t *value_maskp,
1206 __out_ecount_opt(count) unsigned long *valuesp,
1211 __in efx_nic_t *enp,
1212 __in efx_bist_type_t type);
1214 #endif /* EFSYS_OPT_BIST */
1216 #define EFX_FEATURE_IPV6 0x00000001
1217 #define EFX_FEATURE_LFSR_HASH_INSERT 0x00000002
1218 #define EFX_FEATURE_LINK_EVENTS 0x00000004
1219 #define EFX_FEATURE_PERIODIC_MAC_STATS 0x00000008
1220 #define EFX_FEATURE_MCDI 0x00000020
1221 #define EFX_FEATURE_LOOKAHEAD_SPLIT 0x00000040
1222 #define EFX_FEATURE_MAC_HEADER_FILTERS 0x00000080
1223 #define EFX_FEATURE_TURBO 0x00000100
1224 #define EFX_FEATURE_MCDI_DMA 0x00000200
1225 #define EFX_FEATURE_TX_SRC_FILTERS 0x00000400
1226 #define EFX_FEATURE_PIO_BUFFERS 0x00000800
1227 #define EFX_FEATURE_FW_ASSISTED_TSO 0x00001000
1228 #define EFX_FEATURE_FW_ASSISTED_TSO_V2 0x00002000
1229 #define EFX_FEATURE_PACKED_STREAM 0x00004000
1231 typedef enum efx_tunnel_protocol_e {
1232 EFX_TUNNEL_PROTOCOL_NONE = 0,
1233 EFX_TUNNEL_PROTOCOL_VXLAN,
1234 EFX_TUNNEL_PROTOCOL_GENEVE,
1235 EFX_TUNNEL_PROTOCOL_NVGRE,
1237 } efx_tunnel_protocol_t;
1239 typedef enum efx_vi_window_shift_e {
1240 EFX_VI_WINDOW_SHIFT_INVALID = 0,
1241 EFX_VI_WINDOW_SHIFT_8K = 13,
1242 EFX_VI_WINDOW_SHIFT_16K = 14,
1243 EFX_VI_WINDOW_SHIFT_64K = 16,
1244 } efx_vi_window_shift_t;
1246 typedef struct efx_nic_cfg_s {
1247 uint32_t enc_board_type;
1248 uint32_t enc_phy_type;
1250 char enc_phy_name[21];
1252 char enc_phy_revision[21];
1253 efx_mon_type_t enc_mon_type;
1254 #if EFSYS_OPT_MON_STATS
1255 uint32_t enc_mon_stat_dma_buf_size;
1256 uint32_t enc_mon_stat_mask[(EFX_MON_NSTATS + 31) / 32];
1258 unsigned int enc_features;
1259 efx_vi_window_shift_t enc_vi_window_shift;
1260 uint8_t enc_mac_addr[6];
1261 uint8_t enc_port; /* PHY port number */
1262 uint32_t enc_intr_vec_base;
1263 uint32_t enc_intr_limit;
1264 uint32_t enc_evq_limit;
1265 uint32_t enc_txq_limit;
1266 uint32_t enc_rxq_limit;
1267 uint32_t enc_txq_max_ndescs;
1268 uint32_t enc_buftbl_limit;
1269 uint32_t enc_piobuf_limit;
1270 uint32_t enc_piobuf_size;
1271 uint32_t enc_piobuf_min_alloc_size;
1272 uint32_t enc_evq_timer_quantum_ns;
1273 uint32_t enc_evq_timer_max_us;
1274 uint32_t enc_clk_mult;
1275 uint32_t enc_rx_prefix_size;
1276 uint32_t enc_rx_buf_align_start;
1277 uint32_t enc_rx_buf_align_end;
1278 uint32_t enc_rx_scale_max_exclusive_contexts;
1280 * Mask of supported hash algorithms.
1281 * Hash algorithm types are used as the bit indices.
1283 uint32_t enc_rx_scale_hash_alg_mask;
1285 * Indicates whether port numbers can be included to the
1286 * input data for hash computation.
1288 boolean_t enc_rx_scale_l4_hash_supported;
1289 boolean_t enc_rx_scale_additional_modes_supported;
1290 #if EFSYS_OPT_LOOPBACK
1291 efx_qword_t enc_loopback_types[EFX_LINK_NMODES];
1292 #endif /* EFSYS_OPT_LOOPBACK */
1293 #if EFSYS_OPT_PHY_FLAGS
1294 uint32_t enc_phy_flags_mask;
1295 #endif /* EFSYS_OPT_PHY_FLAGS */
1296 #if EFSYS_OPT_PHY_LED_CONTROL
1297 uint32_t enc_led_mask;
1298 #endif /* EFSYS_OPT_PHY_LED_CONTROL */
1299 #if EFSYS_OPT_PHY_STATS
1300 uint64_t enc_phy_stat_mask;
1301 #endif /* EFSYS_OPT_PHY_STATS */
1303 uint8_t enc_mcdi_mdio_channel;
1304 #if EFSYS_OPT_PHY_STATS
1305 uint32_t enc_mcdi_phy_stat_mask;
1306 #endif /* EFSYS_OPT_PHY_STATS */
1307 #if EFSYS_OPT_MON_STATS
1308 uint32_t *enc_mcdi_sensor_maskp;
1309 uint32_t enc_mcdi_sensor_mask_size;
1310 #endif /* EFSYS_OPT_MON_STATS */
1311 #endif /* EFSYS_OPT_MCDI */
1313 uint32_t enc_bist_mask;
1314 #endif /* EFSYS_OPT_BIST */
1315 #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
1318 uint32_t enc_privilege_mask;
1319 #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
1320 boolean_t enc_bug26807_workaround;
1321 boolean_t enc_bug35388_workaround;
1322 boolean_t enc_bug41750_workaround;
1323 boolean_t enc_bug61265_workaround;
1324 boolean_t enc_bug61297_workaround;
1325 boolean_t enc_rx_batching_enabled;
1326 /* Maximum number of descriptors completed in an rx event. */
1327 uint32_t enc_rx_batch_max;
1328 /* Number of rx descriptors the hardware requires for a push. */
1329 uint32_t enc_rx_push_align;
1330 /* Maximum amount of data in DMA descriptor */
1331 uint32_t enc_tx_dma_desc_size_max;
1333 * Boundary which DMA descriptor data must not cross or 0 if no
1336 uint32_t enc_tx_dma_desc_boundary;
1338 * Maximum number of bytes into the packet the TCP header can start for
1339 * the hardware to apply TSO packet edits.
1341 uint32_t enc_tx_tso_tcp_header_offset_limit;
1342 boolean_t enc_fw_assisted_tso_enabled;
1343 boolean_t enc_fw_assisted_tso_v2_enabled;
1344 boolean_t enc_fw_assisted_tso_v2_encap_enabled;
1345 /* Number of TSO contexts on the NIC (FATSOv2) */
1346 uint32_t enc_fw_assisted_tso_v2_n_contexts;
1347 boolean_t enc_hw_tx_insert_vlan_enabled;
1348 /* Number of PFs on the NIC */
1349 uint32_t enc_hw_pf_count;
1350 /* Datapath firmware vadapter/vport/vswitch support */
1351 boolean_t enc_datapath_cap_evb;
1352 boolean_t enc_rx_disable_scatter_supported;
1353 boolean_t enc_allow_set_mac_with_installed_filters;
1354 boolean_t enc_enhanced_set_mac_supported;
1355 boolean_t enc_init_evq_v2_supported;
1356 boolean_t enc_rx_packed_stream_supported;
1357 boolean_t enc_rx_var_packed_stream_supported;
1358 boolean_t enc_rx_es_super_buffer_supported;
1359 boolean_t enc_fw_subvariant_no_tx_csum_supported;
1360 boolean_t enc_pm_and_rxdp_counters;
1361 boolean_t enc_mac_stats_40g_tx_size_bins;
1362 uint32_t enc_tunnel_encapsulations_supported;
1364 * NIC global maximum for unique UDP tunnel ports shared by all
1367 uint32_t enc_tunnel_config_udp_entries_max;
1368 /* External port identifier */
1369 uint8_t enc_external_port;
1370 uint32_t enc_mcdi_max_payload_length;
1371 /* VPD may be per-PF or global */
1372 boolean_t enc_vpd_is_global;
1373 /* Minimum unidirectional bandwidth in Mb/s to max out all ports */
1374 uint32_t enc_required_pcie_bandwidth_mbps;
1375 uint32_t enc_max_pcie_link_gen;
1376 /* Firmware verifies integrity of NVRAM updates */
1377 uint32_t enc_nvram_update_verify_result_supported;
1378 /* Firmware support for extended MAC_STATS buffer */
1379 uint32_t enc_mac_stats_nstats;
1380 boolean_t enc_fec_counters;
1381 boolean_t enc_hlb_counters;
1382 /* Firmware support for "FLAG" and "MARK" filter actions */
1383 boolean_t enc_filter_action_flag_supported;
1384 boolean_t enc_filter_action_mark_supported;
1385 uint32_t enc_filter_action_mark_max;
1388 #define EFX_PCI_FUNCTION_IS_PF(_encp) ((_encp)->enc_vf == 0xffff)
1389 #define EFX_PCI_FUNCTION_IS_VF(_encp) ((_encp)->enc_vf != 0xffff)
1391 #define EFX_PCI_FUNCTION(_encp) \
1392 (EFX_PCI_FUNCTION_IS_PF(_encp) ? (_encp)->enc_pf : (_encp)->enc_vf)
1394 #define EFX_PCI_VF_PARENT(_encp) ((_encp)->enc_pf)
1396 extern const efx_nic_cfg_t *
1398 __in efx_nic_t *enp);
1400 /* RxDPCPU firmware id values by which FW variant can be identified */
1401 #define EFX_RXDP_FULL_FEATURED_FW_ID 0x0
1402 #define EFX_RXDP_LOW_LATENCY_FW_ID 0x1
1403 #define EFX_RXDP_PACKED_STREAM_FW_ID 0x2
1404 #define EFX_RXDP_RULES_ENGINE_FW_ID 0x5
1405 #define EFX_RXDP_DPDK_FW_ID 0x6
1407 typedef struct efx_nic_fw_info_s {
1408 /* Basic FW version information */
1409 uint16_t enfi_mc_fw_version[4];
1411 * If datapath capabilities can be detected,
1412 * additional FW information is to be shown
1414 boolean_t enfi_dpcpu_fw_ids_valid;
1415 /* Rx and Tx datapath CPU FW IDs */
1416 uint16_t enfi_rx_dpcpu_fw_id;
1417 uint16_t enfi_tx_dpcpu_fw_id;
1418 } efx_nic_fw_info_t;
1420 extern __checkReturn efx_rc_t
1421 efx_nic_get_fw_version(
1422 __in efx_nic_t *enp,
1423 __out efx_nic_fw_info_t *enfip);
1425 /* Driver resource limits (minimum required/maximum usable). */
1426 typedef struct efx_drv_limits_s {
1427 uint32_t edl_min_evq_count;
1428 uint32_t edl_max_evq_count;
1430 uint32_t edl_min_rxq_count;
1431 uint32_t edl_max_rxq_count;
1433 uint32_t edl_min_txq_count;
1434 uint32_t edl_max_txq_count;
1436 /* PIO blocks (sub-allocated from piobuf) */
1437 uint32_t edl_min_pio_alloc_size;
1438 uint32_t edl_max_pio_alloc_count;
1441 extern __checkReturn efx_rc_t
1442 efx_nic_set_drv_limits(
1443 __inout efx_nic_t *enp,
1444 __in efx_drv_limits_t *edlp);
1446 typedef enum efx_nic_region_e {
1447 EFX_REGION_VI, /* Memory BAR UC mapping */
1448 EFX_REGION_PIO_WRITE_VI, /* Memory BAR WC mapping */
1451 extern __checkReturn efx_rc_t
1452 efx_nic_get_bar_region(
1453 __in efx_nic_t *enp,
1454 __in efx_nic_region_t region,
1455 __out uint32_t *offsetp,
1456 __out size_t *sizep);
1458 extern __checkReturn efx_rc_t
1459 efx_nic_get_vi_pool(
1460 __in efx_nic_t *enp,
1461 __out uint32_t *evq_countp,
1462 __out uint32_t *rxq_countp,
1463 __out uint32_t *txq_countp);
1468 typedef enum efx_vpd_tag_e {
1475 typedef uint16_t efx_vpd_keyword_t;
1477 typedef struct efx_vpd_value_s {
1478 efx_vpd_tag_t evv_tag;
1479 efx_vpd_keyword_t evv_keyword;
1481 uint8_t evv_value[0x100];
1485 #define EFX_VPD_KEYWORD(x, y) ((x) | ((y) << 8))
1487 extern __checkReturn efx_rc_t
1489 __in efx_nic_t *enp);
1491 extern __checkReturn efx_rc_t
1493 __in efx_nic_t *enp,
1494 __out size_t *sizep);
1496 extern __checkReturn efx_rc_t
1498 __in efx_nic_t *enp,
1499 __out_bcount(size) caddr_t data,
1502 extern __checkReturn efx_rc_t
1504 __in efx_nic_t *enp,
1505 __in_bcount(size) caddr_t data,
1508 extern __checkReturn efx_rc_t
1510 __in efx_nic_t *enp,
1511 __in_bcount(size) caddr_t data,
1514 extern __checkReturn efx_rc_t
1516 __in efx_nic_t *enp,
1517 __in_bcount(size) caddr_t data,
1519 __inout efx_vpd_value_t *evvp);
1521 extern __checkReturn efx_rc_t
1523 __in efx_nic_t *enp,
1524 __inout_bcount(size) caddr_t data,
1526 __in efx_vpd_value_t *evvp);
1528 extern __checkReturn efx_rc_t
1530 __in efx_nic_t *enp,
1531 __inout_bcount(size) caddr_t data,
1533 __out efx_vpd_value_t *evvp,
1534 __inout unsigned int *contp);
1536 extern __checkReturn efx_rc_t
1538 __in efx_nic_t *enp,
1539 __in_bcount(size) caddr_t data,
1544 __in efx_nic_t *enp);
1546 #endif /* EFSYS_OPT_VPD */
1552 typedef enum efx_nvram_type_e {
1553 EFX_NVRAM_INVALID = 0,
1555 EFX_NVRAM_BOOTROM_CFG,
1556 EFX_NVRAM_MC_FIRMWARE,
1557 EFX_NVRAM_MC_GOLDEN,
1563 EFX_NVRAM_FPGA_BACKUP,
1564 EFX_NVRAM_DYNAMIC_CFG,
1567 EFX_NVRAM_MUM_FIRMWARE,
1568 EFX_NVRAM_DYNCONFIG_DEFAULTS,
1569 EFX_NVRAM_ROMCONFIG_DEFAULTS,
1573 extern __checkReturn efx_rc_t
1575 __in efx_nic_t *enp);
1579 extern __checkReturn efx_rc_t
1581 __in efx_nic_t *enp);
1583 #endif /* EFSYS_OPT_DIAG */
1585 extern __checkReturn efx_rc_t
1587 __in efx_nic_t *enp,
1588 __in efx_nvram_type_t type,
1589 __out size_t *sizep);
1591 extern __checkReturn efx_rc_t
1593 __in efx_nic_t *enp,
1594 __in efx_nvram_type_t type,
1595 __out_opt size_t *pref_chunkp);
1597 extern __checkReturn efx_rc_t
1598 efx_nvram_rw_finish(
1599 __in efx_nic_t *enp,
1600 __in efx_nvram_type_t type,
1601 __out_opt uint32_t *verify_resultp);
1603 extern __checkReturn efx_rc_t
1604 efx_nvram_get_version(
1605 __in efx_nic_t *enp,
1606 __in efx_nvram_type_t type,
1607 __out uint32_t *subtypep,
1608 __out_ecount(4) uint16_t version[4]);
1610 extern __checkReturn efx_rc_t
1611 efx_nvram_read_chunk(
1612 __in efx_nic_t *enp,
1613 __in efx_nvram_type_t type,
1614 __in unsigned int offset,
1615 __out_bcount(size) caddr_t data,
1618 extern __checkReturn efx_rc_t
1619 efx_nvram_read_backup(
1620 __in efx_nic_t *enp,
1621 __in efx_nvram_type_t type,
1622 __in unsigned int offset,
1623 __out_bcount(size) caddr_t data,
1626 extern __checkReturn efx_rc_t
1627 efx_nvram_set_version(
1628 __in efx_nic_t *enp,
1629 __in efx_nvram_type_t type,
1630 __in_ecount(4) uint16_t version[4]);
1632 extern __checkReturn efx_rc_t
1634 __in efx_nic_t *enp,
1635 __in efx_nvram_type_t type,
1636 __in_bcount(partn_size) caddr_t partn_data,
1637 __in size_t partn_size);
1639 extern __checkReturn efx_rc_t
1641 __in efx_nic_t *enp,
1642 __in efx_nvram_type_t type);
1644 extern __checkReturn efx_rc_t
1645 efx_nvram_write_chunk(
1646 __in efx_nic_t *enp,
1647 __in efx_nvram_type_t type,
1648 __in unsigned int offset,
1649 __in_bcount(size) caddr_t data,
1654 __in efx_nic_t *enp);
1656 #endif /* EFSYS_OPT_NVRAM */
1658 #if EFSYS_OPT_BOOTCFG
1660 /* Report size and offset of bootcfg sector in NVRAM partition. */
1661 extern __checkReturn efx_rc_t
1662 efx_bootcfg_sector_info(
1663 __in efx_nic_t *enp,
1665 __out_opt uint32_t *sector_countp,
1666 __out size_t *offsetp,
1667 __out size_t *max_sizep);
1670 * Copy bootcfg sector data to a target buffer which may differ in size.
1671 * Optionally corrects format errors in source buffer.
1674 efx_bootcfg_copy_sector(
1675 __in efx_nic_t *enp,
1676 __inout_bcount(sector_length)
1678 __in size_t sector_length,
1679 __out_bcount(data_size) uint8_t *data,
1680 __in size_t data_size,
1681 __in boolean_t handle_format_errors);
1685 __in efx_nic_t *enp,
1686 __out_bcount(size) uint8_t *data,
1691 __in efx_nic_t *enp,
1692 __in_bcount(size) uint8_t *data,
1697 * Processing routines for buffers arranged in the DHCP/BOOTP option format
1698 * (see https://tools.ietf.org/html/rfc1533)
1700 * Summarising the format: the buffer is a sequence of options. All options
1701 * begin with a tag octet, which uniquely identifies the option. Fixed-
1702 * length options without data consist of only a tag octet. Only options PAD
1703 * (0) and END (255) are fixed length. All other options are variable-length
1704 * with a length octet following the tag octet. The value of the length
1705 * octet does not include the two octets specifying the tag and length. The
1706 * length octet is followed by "length" octets of data.
1708 * Option data may be a sequence of sub-options in the same format. The data
1709 * content of the encapsulating option is one or more encapsulated sub-options,
1710 * with no terminating END tag is required.
1712 * To be valid, the top-level sequence of options should be terminated by an
1713 * END tag. The buffer should be padded with the PAD byte.
1715 * When stored to NVRAM, the DHCP option format buffer is preceded by a
1716 * checksum octet. The full buffer (including after the END tag) contributes
1717 * to the checksum, hence the need to fill the buffer to the end with PAD.
1720 #define EFX_DHCP_END ((uint8_t)0xff)
1721 #define EFX_DHCP_PAD ((uint8_t)0)
1723 #define EFX_DHCP_ENCAP_OPT(encapsulator, encapsulated) \
1724 (uint16_t)(((encapsulator) << 8) | (encapsulated))
1726 extern __checkReturn uint8_t
1728 __in_bcount(size) uint8_t const *data,
1731 extern __checkReturn efx_rc_t
1733 __in_bcount(size) uint8_t const *data,
1735 __out_opt size_t *usedp);
1737 extern __checkReturn efx_rc_t
1739 __in_bcount(buffer_length) uint8_t *bufferp,
1740 __in size_t buffer_length,
1742 __deref_out uint8_t **valuepp,
1743 __out size_t *value_lengthp);
1745 extern __checkReturn efx_rc_t
1747 __in_bcount(buffer_length) uint8_t *bufferp,
1748 __in size_t buffer_length,
1749 __deref_out uint8_t **endpp);
1752 extern __checkReturn efx_rc_t
1753 efx_dhcp_delete_tag(
1754 __inout_bcount(buffer_length) uint8_t *bufferp,
1755 __in size_t buffer_length,
1758 extern __checkReturn efx_rc_t
1760 __inout_bcount(buffer_length) uint8_t *bufferp,
1761 __in size_t buffer_length,
1763 __in_bcount_opt(value_length) uint8_t *valuep,
1764 __in size_t value_length);
1766 extern __checkReturn efx_rc_t
1767 efx_dhcp_update_tag(
1768 __inout_bcount(buffer_length) uint8_t *bufferp,
1769 __in size_t buffer_length,
1771 __in uint8_t *value_locationp,
1772 __in_bcount_opt(value_length) uint8_t *valuep,
1773 __in size_t value_length);
1776 #endif /* EFSYS_OPT_BOOTCFG */
1778 #if EFSYS_OPT_IMAGE_LAYOUT
1780 #include "ef10_signed_image_layout.h"
1783 * Image header used in unsigned and signed image layouts (see SF-102785-PS).
1786 * The image header format is extensible. However, older drivers require an
1787 * exact match of image header version and header length when validating and
1788 * writing firmware images.
1790 * To avoid breaking backward compatibility, we use the upper bits of the
1791 * controller version fields to contain an extra version number used for
1792 * combined bootROM and UEFI ROM images on EF10 and later (to hold the UEFI ROM
1793 * version). See bug39254 and SF-102785-PS for details.
1795 typedef struct efx_image_header_s {
1797 uint32_t eih_version;
1799 uint32_t eih_subtype;
1800 uint32_t eih_code_size;
1803 uint32_t eih_controller_version_min;
1805 uint16_t eih_controller_version_min_short;
1806 uint8_t eih_extra_version_a;
1807 uint8_t eih_extra_version_b;
1811 uint32_t eih_controller_version_max;
1813 uint16_t eih_controller_version_max_short;
1814 uint8_t eih_extra_version_c;
1815 uint8_t eih_extra_version_d;
1818 uint16_t eih_code_version_a;
1819 uint16_t eih_code_version_b;
1820 uint16_t eih_code_version_c;
1821 uint16_t eih_code_version_d;
1822 } efx_image_header_t;
1824 #define EFX_IMAGE_HEADER_SIZE (40)
1825 #define EFX_IMAGE_HEADER_VERSION (4)
1826 #define EFX_IMAGE_HEADER_MAGIC (0x106F1A5)
1829 typedef struct efx_image_trailer_s {
1831 } efx_image_trailer_t;
1833 #define EFX_IMAGE_TRAILER_SIZE (4)
1835 typedef enum efx_image_format_e {
1836 EFX_IMAGE_FORMAT_NO_IMAGE,
1837 EFX_IMAGE_FORMAT_INVALID,
1838 EFX_IMAGE_FORMAT_UNSIGNED,
1839 EFX_IMAGE_FORMAT_SIGNED,
1840 } efx_image_format_t;
1842 typedef struct efx_image_info_s {
1843 efx_image_format_t eii_format;
1844 uint8_t * eii_imagep;
1845 size_t eii_image_size;
1846 efx_image_header_t * eii_headerp;
1849 extern __checkReturn efx_rc_t
1850 efx_check_reflash_image(
1852 __in uint32_t buffer_size,
1853 __out efx_image_info_t *infop);
1855 extern __checkReturn efx_rc_t
1856 efx_build_signed_image_write_buffer(
1857 __out_bcount(buffer_size)
1859 __in uint32_t buffer_size,
1860 __in efx_image_info_t *infop,
1861 __out efx_image_header_t **headerpp);
1863 #endif /* EFSYS_OPT_IMAGE_LAYOUT */
1867 typedef enum efx_pattern_type_t {
1868 EFX_PATTERN_BYTE_INCREMENT = 0,
1869 EFX_PATTERN_ALL_THE_SAME,
1870 EFX_PATTERN_BIT_ALTERNATE,
1871 EFX_PATTERN_BYTE_ALTERNATE,
1872 EFX_PATTERN_BYTE_CHANGING,
1873 EFX_PATTERN_BIT_SWEEP,
1875 } efx_pattern_type_t;
1878 (*efx_sram_pattern_fn_t)(
1880 __in boolean_t negate,
1881 __out efx_qword_t *eqp);
1883 extern __checkReturn efx_rc_t
1885 __in efx_nic_t *enp,
1886 __in efx_pattern_type_t type);
1888 #endif /* EFSYS_OPT_DIAG */
1890 extern __checkReturn efx_rc_t
1891 efx_sram_buf_tbl_set(
1892 __in efx_nic_t *enp,
1894 __in efsys_mem_t *esmp,
1898 efx_sram_buf_tbl_clear(
1899 __in efx_nic_t *enp,
1903 #define EFX_BUF_TBL_SIZE 0x20000
1905 #define EFX_BUF_SIZE 4096
1909 typedef struct efx_evq_s efx_evq_t;
1911 #if EFSYS_OPT_QSTATS
1913 /* START MKCONFIG GENERATED EfxHeaderEventQueueBlock 6f3843f5fe7cc843 */
1914 typedef enum efx_ev_qstat_e {
1920 EV_RX_PAUSE_FRM_ERR,
1921 EV_RX_BUF_OWNER_ID_ERR,
1922 EV_RX_IPV4_HDR_CHKSUM_ERR,
1923 EV_RX_TCP_UDP_CHKSUM_ERR,
1927 EV_RX_MCAST_HASH_MATCH,
1944 EV_DRIVER_SRM_UPD_DONE,
1945 EV_DRIVER_TX_DESCQ_FLS_DONE,
1946 EV_DRIVER_RX_DESCQ_FLS_DONE,
1947 EV_DRIVER_RX_DESCQ_FLS_FAILED,
1948 EV_DRIVER_RX_DSC_ERROR,
1949 EV_DRIVER_TX_DSC_ERROR,
1955 /* END MKCONFIG GENERATED EfxHeaderEventQueueBlock */
1957 #endif /* EFSYS_OPT_QSTATS */
1959 extern __checkReturn efx_rc_t
1961 __in efx_nic_t *enp);
1965 __in efx_nic_t *enp);
1967 #define EFX_EVQ_MAXNEVS 32768
1968 #define EFX_EVQ_MINNEVS 512
1970 #define EFX_EVQ_SIZE(_nevs) ((_nevs) * sizeof (efx_qword_t))
1971 #define EFX_EVQ_NBUFS(_nevs) (EFX_EVQ_SIZE(_nevs) / EFX_BUF_SIZE)
1973 #define EFX_EVQ_FLAGS_TYPE_MASK (0x3)
1974 #define EFX_EVQ_FLAGS_TYPE_AUTO (0x0)
1975 #define EFX_EVQ_FLAGS_TYPE_THROUGHPUT (0x1)
1976 #define EFX_EVQ_FLAGS_TYPE_LOW_LATENCY (0x2)
1978 #define EFX_EVQ_FLAGS_NOTIFY_MASK (0xC)
1979 #define EFX_EVQ_FLAGS_NOTIFY_INTERRUPT (0x0) /* Interrupting (default) */
1980 #define EFX_EVQ_FLAGS_NOTIFY_DISABLED (0x4) /* Non-interrupting */
1982 extern __checkReturn efx_rc_t
1984 __in efx_nic_t *enp,
1985 __in unsigned int index,
1986 __in efsys_mem_t *esmp,
1990 __in uint32_t flags,
1991 __deref_out efx_evq_t **eepp);
1995 __in efx_evq_t *eep,
1996 __in uint16_t data);
1998 typedef __checkReturn boolean_t
1999 (*efx_initialized_ev_t)(
2000 __in_opt void *arg);
2002 #define EFX_PKT_UNICAST 0x0004
2003 #define EFX_PKT_START 0x0008
2005 #define EFX_PKT_VLAN_TAGGED 0x0010
2006 #define EFX_CKSUM_TCPUDP 0x0020
2007 #define EFX_CKSUM_IPV4 0x0040
2008 #define EFX_PKT_CONT 0x0080
2010 #define EFX_CHECK_VLAN 0x0100
2011 #define EFX_PKT_TCP 0x0200
2012 #define EFX_PKT_UDP 0x0400
2013 #define EFX_PKT_IPV4 0x0800
2015 #define EFX_PKT_IPV6 0x1000
2016 #define EFX_PKT_PREFIX_LEN 0x2000
2017 #define EFX_ADDR_MISMATCH 0x4000
2018 #define EFX_DISCARD 0x8000
2021 * The following flags are used only for packed stream
2022 * mode. The values for the flags are reused to fit into 16 bit,
2023 * since EFX_PKT_START and EFX_PKT_CONT are never used in
2024 * packed stream mode
2026 #define EFX_PKT_PACKED_STREAM_NEW_BUFFER EFX_PKT_START
2027 #define EFX_PKT_PACKED_STREAM_PARSE_INCOMPLETE EFX_PKT_CONT
2030 #define EFX_EV_RX_NLABELS 32
2031 #define EFX_EV_TX_NLABELS 32
2033 typedef __checkReturn boolean_t
2036 __in uint32_t label,
2039 __in uint16_t flags);
2041 #if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
2044 * Packed stream mode is documented in SF-112241-TC.
2045 * The general idea is that, instead of putting each incoming
2046 * packet into a separate buffer which is specified in a RX
2047 * descriptor, a large buffer is provided to the hardware and
2048 * packets are put there in a continuous stream.
2049 * The main advantage of such an approach is that RX queue refilling
2050 * happens much less frequently.
2052 * Equal stride packed stream mode is documented in SF-119419-TC.
2053 * The general idea is to utilize advantages of the packed stream,
2054 * but avoid indirection in packets representation.
2055 * The main advantage of such an approach is that RX queue refilling
2056 * happens much less frequently and packets buffers are independent
2057 * from upper layers point of view.
2060 typedef __checkReturn boolean_t
2063 __in uint32_t label,
2065 __in uint32_t pkt_count,
2066 __in uint16_t flags);
2070 typedef __checkReturn boolean_t
2073 __in uint32_t label,
2076 #define EFX_EXCEPTION_RX_RECOVERY 0x00000001
2077 #define EFX_EXCEPTION_RX_DSC_ERROR 0x00000002
2078 #define EFX_EXCEPTION_TX_DSC_ERROR 0x00000003
2079 #define EFX_EXCEPTION_UNKNOWN_SENSOREVT 0x00000004
2080 #define EFX_EXCEPTION_FWALERT_SRAM 0x00000005
2081 #define EFX_EXCEPTION_UNKNOWN_FWALERT 0x00000006
2082 #define EFX_EXCEPTION_RX_ERROR 0x00000007
2083 #define EFX_EXCEPTION_TX_ERROR 0x00000008
2084 #define EFX_EXCEPTION_EV_ERROR 0x00000009
2086 typedef __checkReturn boolean_t
2087 (*efx_exception_ev_t)(
2089 __in uint32_t label,
2090 __in uint32_t data);
2092 typedef __checkReturn boolean_t
2093 (*efx_rxq_flush_done_ev_t)(
2095 __in uint32_t rxq_index);
2097 typedef __checkReturn boolean_t
2098 (*efx_rxq_flush_failed_ev_t)(
2100 __in uint32_t rxq_index);
2102 typedef __checkReturn boolean_t
2103 (*efx_txq_flush_done_ev_t)(
2105 __in uint32_t txq_index);
2107 typedef __checkReturn boolean_t
2108 (*efx_software_ev_t)(
2110 __in uint16_t magic);
2112 typedef __checkReturn boolean_t
2115 __in uint32_t code);
2117 #define EFX_SRAM_CLEAR 0
2118 #define EFX_SRAM_UPDATE 1
2119 #define EFX_SRAM_ILLEGAL_CLEAR 2
2121 typedef __checkReturn boolean_t
2122 (*efx_wake_up_ev_t)(
2124 __in uint32_t label);
2126 typedef __checkReturn boolean_t
2129 __in uint32_t label);
2131 typedef __checkReturn boolean_t
2132 (*efx_link_change_ev_t)(
2134 __in efx_link_mode_t link_mode);
2136 #if EFSYS_OPT_MON_STATS
2138 typedef __checkReturn boolean_t
2139 (*efx_monitor_ev_t)(
2141 __in efx_mon_stat_t id,
2142 __in efx_mon_stat_value_t value);
2144 #endif /* EFSYS_OPT_MON_STATS */
2146 #if EFSYS_OPT_MAC_STATS
2148 typedef __checkReturn boolean_t
2149 (*efx_mac_stats_ev_t)(
2151 __in uint32_t generation);
2153 #endif /* EFSYS_OPT_MAC_STATS */
2155 typedef struct efx_ev_callbacks_s {
2156 efx_initialized_ev_t eec_initialized;
2158 #if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
2159 efx_rx_ps_ev_t eec_rx_ps;
2162 efx_exception_ev_t eec_exception;
2163 efx_rxq_flush_done_ev_t eec_rxq_flush_done;
2164 efx_rxq_flush_failed_ev_t eec_rxq_flush_failed;
2165 efx_txq_flush_done_ev_t eec_txq_flush_done;
2166 efx_software_ev_t eec_software;
2167 efx_sram_ev_t eec_sram;
2168 efx_wake_up_ev_t eec_wake_up;
2169 efx_timer_ev_t eec_timer;
2170 efx_link_change_ev_t eec_link_change;
2171 #if EFSYS_OPT_MON_STATS
2172 efx_monitor_ev_t eec_monitor;
2173 #endif /* EFSYS_OPT_MON_STATS */
2174 #if EFSYS_OPT_MAC_STATS
2175 efx_mac_stats_ev_t eec_mac_stats;
2176 #endif /* EFSYS_OPT_MAC_STATS */
2177 } efx_ev_callbacks_t;
2179 extern __checkReturn boolean_t
2181 __in efx_evq_t *eep,
2182 __in unsigned int count);
2184 #if EFSYS_OPT_EV_PREFETCH
2188 __in efx_evq_t *eep,
2189 __in unsigned int count);
2191 #endif /* EFSYS_OPT_EV_PREFETCH */
2195 __in efx_evq_t *eep,
2196 __inout unsigned int *countp,
2197 __in const efx_ev_callbacks_t *eecp,
2198 __in_opt void *arg);
2200 extern __checkReturn efx_rc_t
2201 efx_ev_usecs_to_ticks(
2202 __in efx_nic_t *enp,
2203 __in unsigned int usecs,
2204 __out unsigned int *ticksp);
2206 extern __checkReturn efx_rc_t
2208 __in efx_evq_t *eep,
2209 __in unsigned int us);
2211 extern __checkReturn efx_rc_t
2213 __in efx_evq_t *eep,
2214 __in unsigned int count);
2216 #if EFSYS_OPT_QSTATS
2222 __in efx_nic_t *enp,
2223 __in unsigned int id);
2225 #endif /* EFSYS_OPT_NAMES */
2228 efx_ev_qstats_update(
2229 __in efx_evq_t *eep,
2230 __inout_ecount(EV_NQSTATS) efsys_stat_t *stat);
2232 #endif /* EFSYS_OPT_QSTATS */
2236 __in efx_evq_t *eep);
2240 extern __checkReturn efx_rc_t
2242 __inout efx_nic_t *enp);
2246 __in efx_nic_t *enp);
2248 #if EFSYS_OPT_RX_SCATTER
2249 __checkReturn efx_rc_t
2250 efx_rx_scatter_enable(
2251 __in efx_nic_t *enp,
2252 __in unsigned int buf_size);
2253 #endif /* EFSYS_OPT_RX_SCATTER */
2255 /* Handle to represent use of the default RSS context. */
2256 #define EFX_RSS_CONTEXT_DEFAULT 0xffffffff
2258 #if EFSYS_OPT_RX_SCALE
2260 typedef enum efx_rx_hash_alg_e {
2261 EFX_RX_HASHALG_LFSR = 0,
2262 EFX_RX_HASHALG_TOEPLITZ,
2263 EFX_RX_HASHALG_PACKED_STREAM,
2265 } efx_rx_hash_alg_t;
2268 * Legacy hash type flags.
2270 * They represent standard tuples for distinct traffic classes.
2272 #define EFX_RX_HASH_IPV4 (1U << 0)
2273 #define EFX_RX_HASH_TCPIPV4 (1U << 1)
2274 #define EFX_RX_HASH_IPV6 (1U << 2)
2275 #define EFX_RX_HASH_TCPIPV6 (1U << 3)
2277 #define EFX_RX_HASH_LEGACY_MASK \
2278 (EFX_RX_HASH_IPV4 | \
2279 EFX_RX_HASH_TCPIPV4 | \
2280 EFX_RX_HASH_IPV6 | \
2281 EFX_RX_HASH_TCPIPV6)
2284 * The type of the argument used by efx_rx_scale_mode_set() to
2285 * provide a means for the client drivers to configure hashing.
2287 * A properly constructed value can either be:
2288 * - a combination of legacy flags
2289 * - a combination of EFX_RX_HASH() flags
2291 typedef uint32_t efx_rx_hash_type_t;
2293 typedef enum efx_rx_hash_support_e {
2294 EFX_RX_HASH_UNAVAILABLE = 0, /* Hardware hash not inserted */
2295 EFX_RX_HASH_AVAILABLE /* Insert hash with/without RSS */
2296 } efx_rx_hash_support_t;
2298 #define EFX_RSS_KEY_SIZE 40 /* RSS key size (bytes) */
2299 #define EFX_RSS_TBL_SIZE 128 /* Rows in RX indirection table */
2300 #define EFX_MAXRSS 64 /* RX indirection entry range */
2301 #define EFX_MAXRSS_LEGACY 16 /* See bug16611 and bug17213 */
2303 typedef enum efx_rx_scale_context_type_e {
2304 EFX_RX_SCALE_UNAVAILABLE = 0, /* No RX scale context */
2305 EFX_RX_SCALE_EXCLUSIVE, /* Writable key/indirection table */
2306 EFX_RX_SCALE_SHARED /* Read-only key/indirection table */
2307 } efx_rx_scale_context_type_t;
2310 * Traffic classes eligible for hash computation.
2312 * Select packet headers used in computing the receive hash.
2313 * This uses the same encoding as the RSS_MODES field of
2314 * MC_CMD_RSS_CONTEXT_SET_FLAGS.
2316 #define EFX_RX_CLASS_IPV4_TCP_LBN 8
2317 #define EFX_RX_CLASS_IPV4_TCP_WIDTH 4
2318 #define EFX_RX_CLASS_IPV4_UDP_LBN 12
2319 #define EFX_RX_CLASS_IPV4_UDP_WIDTH 4
2320 #define EFX_RX_CLASS_IPV4_LBN 16
2321 #define EFX_RX_CLASS_IPV4_WIDTH 4
2322 #define EFX_RX_CLASS_IPV6_TCP_LBN 20
2323 #define EFX_RX_CLASS_IPV6_TCP_WIDTH 4
2324 #define EFX_RX_CLASS_IPV6_UDP_LBN 24
2325 #define EFX_RX_CLASS_IPV6_UDP_WIDTH 4
2326 #define EFX_RX_CLASS_IPV6_LBN 28
2327 #define EFX_RX_CLASS_IPV6_WIDTH 4
2329 #define EFX_RX_NCLASSES 6
2332 * Ancillary flags used to construct generic hash tuples.
2333 * This uses the same encoding as RSS_MODE_HASH_SELECTOR.
2335 #define EFX_RX_CLASS_HASH_SRC_ADDR (1U << 0)
2336 #define EFX_RX_CLASS_HASH_DST_ADDR (1U << 1)
2337 #define EFX_RX_CLASS_HASH_SRC_PORT (1U << 2)
2338 #define EFX_RX_CLASS_HASH_DST_PORT (1U << 3)
2341 * Generic hash tuples.
2343 * They express combinations of packet fields
2344 * which can contribute to the hash value for
2345 * a particular traffic class.
2347 #define EFX_RX_CLASS_HASH_DISABLE 0
2349 #define EFX_RX_CLASS_HASH_1TUPLE_SRC EFX_RX_CLASS_HASH_SRC_ADDR
2350 #define EFX_RX_CLASS_HASH_1TUPLE_DST EFX_RX_CLASS_HASH_DST_ADDR
2352 #define EFX_RX_CLASS_HASH_2TUPLE \
2353 (EFX_RX_CLASS_HASH_SRC_ADDR | \
2354 EFX_RX_CLASS_HASH_DST_ADDR)
2356 #define EFX_RX_CLASS_HASH_2TUPLE_SRC \
2357 (EFX_RX_CLASS_HASH_SRC_ADDR | \
2358 EFX_RX_CLASS_HASH_SRC_PORT)
2360 #define EFX_RX_CLASS_HASH_2TUPLE_DST \
2361 (EFX_RX_CLASS_HASH_DST_ADDR | \
2362 EFX_RX_CLASS_HASH_DST_PORT)
2364 #define EFX_RX_CLASS_HASH_4TUPLE \
2365 (EFX_RX_CLASS_HASH_SRC_ADDR | \
2366 EFX_RX_CLASS_HASH_DST_ADDR | \
2367 EFX_RX_CLASS_HASH_SRC_PORT | \
2368 EFX_RX_CLASS_HASH_DST_PORT)
2370 #define EFX_RX_CLASS_HASH_NTUPLES 7
2373 * Hash flag constructor.
2375 * Resulting flags encode hash tuples for specific traffic classes.
2376 * The client drivers are encouraged to use these flags to form
2377 * a hash type value.
2379 #define EFX_RX_HASH(_class, _tuple) \
2380 EFX_INSERT_FIELD_NATIVE32(0, 31, \
2381 EFX_RX_CLASS_##_class, EFX_RX_CLASS_HASH_##_tuple)
2384 * The maximum number of EFX_RX_HASH() flags.
2386 #define EFX_RX_HASH_NFLAGS (EFX_RX_NCLASSES * EFX_RX_CLASS_HASH_NTUPLES)
2388 extern __checkReturn efx_rc_t
2389 efx_rx_scale_hash_flags_get(
2390 __in efx_nic_t *enp,
2391 __in efx_rx_hash_alg_t hash_alg,
2392 __out_ecount_part(max_nflags, *nflagsp) unsigned int *flagsp,
2393 __in unsigned int max_nflags,
2394 __out unsigned int *nflagsp);
2396 extern __checkReturn efx_rc_t
2397 efx_rx_hash_default_support_get(
2398 __in efx_nic_t *enp,
2399 __out efx_rx_hash_support_t *supportp);
2402 extern __checkReturn efx_rc_t
2403 efx_rx_scale_default_support_get(
2404 __in efx_nic_t *enp,
2405 __out efx_rx_scale_context_type_t *typep);
2407 extern __checkReturn efx_rc_t
2408 efx_rx_scale_context_alloc(
2409 __in efx_nic_t *enp,
2410 __in efx_rx_scale_context_type_t type,
2411 __in uint32_t num_queues,
2412 __out uint32_t *rss_contextp);
2414 extern __checkReturn efx_rc_t
2415 efx_rx_scale_context_free(
2416 __in efx_nic_t *enp,
2417 __in uint32_t rss_context);
2419 extern __checkReturn efx_rc_t
2420 efx_rx_scale_mode_set(
2421 __in efx_nic_t *enp,
2422 __in uint32_t rss_context,
2423 __in efx_rx_hash_alg_t alg,
2424 __in efx_rx_hash_type_t type,
2425 __in boolean_t insert);
2427 extern __checkReturn efx_rc_t
2428 efx_rx_scale_tbl_set(
2429 __in efx_nic_t *enp,
2430 __in uint32_t rss_context,
2431 __in_ecount(n) unsigned int *table,
2434 extern __checkReturn efx_rc_t
2435 efx_rx_scale_key_set(
2436 __in efx_nic_t *enp,
2437 __in uint32_t rss_context,
2438 __in_ecount(n) uint8_t *key,
2441 extern __checkReturn uint32_t
2442 efx_pseudo_hdr_hash_get(
2443 __in efx_rxq_t *erp,
2444 __in efx_rx_hash_alg_t func,
2445 __in uint8_t *buffer);
2447 #endif /* EFSYS_OPT_RX_SCALE */
2449 extern __checkReturn efx_rc_t
2450 efx_pseudo_hdr_pkt_length_get(
2451 __in efx_rxq_t *erp,
2452 __in uint8_t *buffer,
2453 __out uint16_t *pkt_lengthp);
2455 #define EFX_RXQ_MAXNDESCS 4096
2456 #define EFX_RXQ_MINNDESCS 512
2458 #define EFX_RXQ_SIZE(_ndescs) ((_ndescs) * sizeof (efx_qword_t))
2459 #define EFX_RXQ_NBUFS(_ndescs) (EFX_RXQ_SIZE(_ndescs) / EFX_BUF_SIZE)
2460 #define EFX_RXQ_LIMIT(_ndescs) ((_ndescs) - 16)
2461 #define EFX_RXQ_DC_NDESCS(_dcsize) (8 << _dcsize)
2463 typedef enum efx_rxq_type_e {
2464 EFX_RXQ_TYPE_DEFAULT,
2465 EFX_RXQ_TYPE_PACKED_STREAM,
2466 EFX_RXQ_TYPE_ES_SUPER_BUFFER,
2471 * Dummy flag to be used instead of 0 to make it clear that the argument
2472 * is receive queue flags.
2474 #define EFX_RXQ_FLAG_NONE 0x0
2475 #define EFX_RXQ_FLAG_SCATTER 0x1
2477 * If tunnels are supported and Rx event can provide information about
2478 * either outer or inner packet classes (e.g. SFN8xxx adapters with
2479 * full-feature firmware variant running), outer classes are requested by
2480 * default. However, if the driver supports tunnels, the flag allows to
2481 * request inner classes which are required to be able to interpret inner
2482 * Rx checksum offload results.
2484 #define EFX_RXQ_FLAG_INNER_CLASSES 0x2
2486 extern __checkReturn efx_rc_t
2488 __in efx_nic_t *enp,
2489 __in unsigned int index,
2490 __in unsigned int label,
2491 __in efx_rxq_type_t type,
2492 __in efsys_mem_t *esmp,
2495 __in unsigned int flags,
2496 __in efx_evq_t *eep,
2497 __deref_out efx_rxq_t **erpp);
2499 #if EFSYS_OPT_RX_PACKED_STREAM
2501 #define EFX_RXQ_PACKED_STREAM_BUF_SIZE_1M (1U * 1024 * 1024)
2502 #define EFX_RXQ_PACKED_STREAM_BUF_SIZE_512K (512U * 1024)
2503 #define EFX_RXQ_PACKED_STREAM_BUF_SIZE_256K (256U * 1024)
2504 #define EFX_RXQ_PACKED_STREAM_BUF_SIZE_128K (128U * 1024)
2505 #define EFX_RXQ_PACKED_STREAM_BUF_SIZE_64K (64U * 1024)
2507 extern __checkReturn efx_rc_t
2508 efx_rx_qcreate_packed_stream(
2509 __in efx_nic_t *enp,
2510 __in unsigned int index,
2511 __in unsigned int label,
2512 __in uint32_t ps_buf_size,
2513 __in efsys_mem_t *esmp,
2515 __in efx_evq_t *eep,
2516 __deref_out efx_rxq_t **erpp);
2520 #if EFSYS_OPT_RX_ES_SUPER_BUFFER
2522 /* Maximum head-of-line block timeout in nanoseconds */
2523 #define EFX_RXQ_ES_SUPER_BUFFER_HOL_BLOCK_MAX (400U * 1000 * 1000)
2525 extern __checkReturn efx_rc_t
2526 efx_rx_qcreate_es_super_buffer(
2527 __in efx_nic_t *enp,
2528 __in unsigned int index,
2529 __in unsigned int label,
2530 __in uint32_t n_bufs_per_desc,
2531 __in uint32_t max_dma_len,
2532 __in uint32_t buf_stride,
2533 __in uint32_t hol_block_timeout,
2534 __in efsys_mem_t *esmp,
2536 __in unsigned int flags,
2537 __in efx_evq_t *eep,
2538 __deref_out efx_rxq_t **erpp);
2542 typedef struct efx_buffer_s {
2543 efsys_dma_addr_t eb_addr;
2548 typedef struct efx_desc_s {
2554 __in efx_rxq_t *erp,
2555 __in_ecount(ndescs) efsys_dma_addr_t *addrp,
2557 __in unsigned int ndescs,
2558 __in unsigned int completed,
2559 __in unsigned int added);
2563 __in efx_rxq_t *erp,
2564 __in unsigned int added,
2565 __inout unsigned int *pushedp);
2567 #if EFSYS_OPT_RX_PACKED_STREAM
2570 efx_rx_qpush_ps_credits(
2571 __in efx_rxq_t *erp);
2573 extern __checkReturn uint8_t *
2574 efx_rx_qps_packet_info(
2575 __in efx_rxq_t *erp,
2576 __in uint8_t *buffer,
2577 __in uint32_t buffer_length,
2578 __in uint32_t current_offset,
2579 __out uint16_t *lengthp,
2580 __out uint32_t *next_offsetp,
2581 __out uint32_t *timestamp);
2584 extern __checkReturn efx_rc_t
2586 __in efx_rxq_t *erp);
2590 __in efx_rxq_t *erp);
2594 __in efx_rxq_t *erp);
2598 typedef struct efx_txq_s efx_txq_t;
2600 #if EFSYS_OPT_QSTATS
2602 /* START MKCONFIG GENERATED EfxHeaderTransmitQueueBlock 12dff8778598b2db */
2603 typedef enum efx_tx_qstat_e {
2609 /* END MKCONFIG GENERATED EfxHeaderTransmitQueueBlock */
2611 #endif /* EFSYS_OPT_QSTATS */
2613 extern __checkReturn efx_rc_t
2615 __in efx_nic_t *enp);
2619 __in efx_nic_t *enp);
2621 #define EFX_TXQ_MINNDESCS 512
2623 #define EFX_TXQ_SIZE(_ndescs) ((_ndescs) * sizeof (efx_qword_t))
2624 #define EFX_TXQ_NBUFS(_ndescs) (EFX_TXQ_SIZE(_ndescs) / EFX_BUF_SIZE)
2625 #define EFX_TXQ_LIMIT(_ndescs) ((_ndescs) - 16)
2627 #define EFX_TXQ_MAX_BUFS 8 /* Maximum independent of EFX_BUG35388_WORKAROUND. */
2629 #define EFX_TXQ_CKSUM_IPV4 0x0001
2630 #define EFX_TXQ_CKSUM_TCPUDP 0x0002
2631 #define EFX_TXQ_FATSOV2 0x0004
2632 #define EFX_TXQ_CKSUM_INNER_IPV4 0x0008
2633 #define EFX_TXQ_CKSUM_INNER_TCPUDP 0x0010
2635 extern __checkReturn efx_rc_t
2637 __in efx_nic_t *enp,
2638 __in unsigned int index,
2639 __in unsigned int label,
2640 __in efsys_mem_t *esmp,
2643 __in uint16_t flags,
2644 __in efx_evq_t *eep,
2645 __deref_out efx_txq_t **etpp,
2646 __out unsigned int *addedp);
2648 extern __checkReturn efx_rc_t
2650 __in efx_txq_t *etp,
2651 __in_ecount(ndescs) efx_buffer_t *eb,
2652 __in unsigned int ndescs,
2653 __in unsigned int completed,
2654 __inout unsigned int *addedp);
2656 extern __checkReturn efx_rc_t
2658 __in efx_txq_t *etp,
2659 __in unsigned int ns);
2663 __in efx_txq_t *etp,
2664 __in unsigned int added,
2665 __in unsigned int pushed);
2667 extern __checkReturn efx_rc_t
2669 __in efx_txq_t *etp);
2673 __in efx_txq_t *etp);
2675 extern __checkReturn efx_rc_t
2677 __in efx_txq_t *etp);
2680 efx_tx_qpio_disable(
2681 __in efx_txq_t *etp);
2683 extern __checkReturn efx_rc_t
2685 __in efx_txq_t *etp,
2686 __in_ecount(buf_length) uint8_t *buffer,
2687 __in size_t buf_length,
2688 __in size_t pio_buf_offset);
2690 extern __checkReturn efx_rc_t
2692 __in efx_txq_t *etp,
2693 __in size_t pkt_length,
2694 __in unsigned int completed,
2695 __inout unsigned int *addedp);
2697 extern __checkReturn efx_rc_t
2699 __in efx_txq_t *etp,
2700 __in_ecount(n) efx_desc_t *ed,
2701 __in unsigned int n,
2702 __in unsigned int completed,
2703 __inout unsigned int *addedp);
2706 efx_tx_qdesc_dma_create(
2707 __in efx_txq_t *etp,
2708 __in efsys_dma_addr_t addr,
2711 __out efx_desc_t *edp);
2714 efx_tx_qdesc_tso_create(
2715 __in efx_txq_t *etp,
2716 __in uint16_t ipv4_id,
2717 __in uint32_t tcp_seq,
2718 __in uint8_t tcp_flags,
2719 __out efx_desc_t *edp);
2721 /* Number of FATSOv2 option descriptors */
2722 #define EFX_TX_FATSOV2_OPT_NDESCS 2
2724 /* Maximum number of DMA segments per TSO packet (not superframe) */
2725 #define EFX_TX_FATSOV2_DMA_SEGS_PER_PKT_MAX 24
2728 efx_tx_qdesc_tso2_create(
2729 __in efx_txq_t *etp,
2730 __in uint16_t ipv4_id,
2731 __in uint16_t outer_ipv4_id,
2732 __in uint32_t tcp_seq,
2733 __in uint16_t tcp_mss,
2734 __out_ecount(count) efx_desc_t *edp,
2738 efx_tx_qdesc_vlantci_create(
2739 __in efx_txq_t *etp,
2741 __out efx_desc_t *edp);
2744 efx_tx_qdesc_checksum_create(
2745 __in efx_txq_t *etp,
2746 __in uint16_t flags,
2747 __out efx_desc_t *edp);
2749 #if EFSYS_OPT_QSTATS
2755 __in efx_nic_t *etp,
2756 __in unsigned int id);
2758 #endif /* EFSYS_OPT_NAMES */
2761 efx_tx_qstats_update(
2762 __in efx_txq_t *etp,
2763 __inout_ecount(TX_NQSTATS) efsys_stat_t *stat);
2765 #endif /* EFSYS_OPT_QSTATS */
2769 __in efx_txq_t *etp);
2774 #if EFSYS_OPT_FILTER
2776 #define EFX_ETHER_TYPE_IPV4 0x0800
2777 #define EFX_ETHER_TYPE_IPV6 0x86DD
2779 #define EFX_IPPROTO_TCP 6
2780 #define EFX_IPPROTO_UDP 17
2781 #define EFX_IPPROTO_GRE 47
2783 /* Use RSS to spread across multiple queues */
2784 #define EFX_FILTER_FLAG_RX_RSS 0x01
2785 /* Enable RX scatter */
2786 #define EFX_FILTER_FLAG_RX_SCATTER 0x02
2788 * Override an automatic filter (priority EFX_FILTER_PRI_AUTO).
2789 * May only be set by the filter implementation for each type.
2790 * A removal request will restore the automatic filter in its place.
2792 #define EFX_FILTER_FLAG_RX_OVER_AUTO 0x04
2793 /* Filter is for RX */
2794 #define EFX_FILTER_FLAG_RX 0x08
2795 /* Filter is for TX */
2796 #define EFX_FILTER_FLAG_TX 0x10
2797 /* Set match flag on the received packet */
2798 #define EFX_FILTER_FLAG_ACTION_FLAG 0x20
2799 /* Set match mark on the received packet */
2800 #define EFX_FILTER_FLAG_ACTION_MARK 0x40
2802 typedef uint8_t efx_filter_flags_t;
2805 * Flags which specify the fields to match on. The values are the same as in the
2806 * MC_CMD_FILTER_OP/MC_CMD_FILTER_OP_EXT commands.
2809 /* Match by remote IP host address */
2810 #define EFX_FILTER_MATCH_REM_HOST 0x00000001
2811 /* Match by local IP host address */
2812 #define EFX_FILTER_MATCH_LOC_HOST 0x00000002
2813 /* Match by remote MAC address */
2814 #define EFX_FILTER_MATCH_REM_MAC 0x00000004
2815 /* Match by remote TCP/UDP port */
2816 #define EFX_FILTER_MATCH_REM_PORT 0x00000008
2817 /* Match by remote TCP/UDP port */
2818 #define EFX_FILTER_MATCH_LOC_MAC 0x00000010
2819 /* Match by local TCP/UDP port */
2820 #define EFX_FILTER_MATCH_LOC_PORT 0x00000020
2821 /* Match by Ether-type */
2822 #define EFX_FILTER_MATCH_ETHER_TYPE 0x00000040
2823 /* Match by inner VLAN ID */
2824 #define EFX_FILTER_MATCH_INNER_VID 0x00000080
2825 /* Match by outer VLAN ID */
2826 #define EFX_FILTER_MATCH_OUTER_VID 0x00000100
2827 /* Match by IP transport protocol */
2828 #define EFX_FILTER_MATCH_IP_PROTO 0x00000200
2829 /* Match by VNI or VSID */
2830 #define EFX_FILTER_MATCH_VNI_OR_VSID 0x00000800
2831 /* For encapsulated packets, match by inner frame local MAC address */
2832 #define EFX_FILTER_MATCH_IFRM_LOC_MAC 0x00010000
2833 /* For encapsulated packets, match all multicast inner frames */
2834 #define EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST 0x01000000
2835 /* For encapsulated packets, match all unicast inner frames */
2836 #define EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST 0x02000000
2838 * Match by encap type, this flag does not correspond to
2839 * the MCDI match flags and any unoccupied value may be used
2841 #define EFX_FILTER_MATCH_ENCAP_TYPE 0x20000000
2842 /* Match otherwise-unmatched multicast and broadcast packets */
2843 #define EFX_FILTER_MATCH_UNKNOWN_MCAST_DST 0x40000000
2844 /* Match otherwise-unmatched unicast packets */
2845 #define EFX_FILTER_MATCH_UNKNOWN_UCAST_DST 0x80000000
2847 typedef uint32_t efx_filter_match_flags_t;
2849 typedef enum efx_filter_priority_s {
2850 EFX_FILTER_PRI_HINT = 0, /* Performance hint */
2851 EFX_FILTER_PRI_AUTO, /* Automatic filter based on device
2852 * address list or hardware
2853 * requirements. This may only be used
2854 * by the filter implementation for
2856 EFX_FILTER_PRI_MANUAL, /* Manually configured filter */
2857 EFX_FILTER_PRI_REQUIRED, /* Required for correct behaviour of the
2858 * client (e.g. SR-IOV, HyperV VMQ etc.)
2860 } efx_filter_priority_t;
2863 * FIXME: All these fields are assumed to be in little-endian byte order.
2864 * It may be better for some to be big-endian. See bug42804.
2867 typedef struct efx_filter_spec_s {
2868 efx_filter_match_flags_t efs_match_flags;
2869 uint8_t efs_priority;
2870 efx_filter_flags_t efs_flags;
2871 uint16_t efs_dmaq_id;
2872 uint32_t efs_rss_context;
2873 uint16_t efs_outer_vid;
2874 uint16_t efs_inner_vid;
2875 uint8_t efs_loc_mac[EFX_MAC_ADDR_LEN];
2876 uint8_t efs_rem_mac[EFX_MAC_ADDR_LEN];
2877 uint16_t efs_ether_type;
2878 uint8_t efs_ip_proto;
2879 efx_tunnel_protocol_t efs_encap_type;
2880 uint16_t efs_loc_port;
2881 uint16_t efs_rem_port;
2882 efx_oword_t efs_rem_host;
2883 efx_oword_t efs_loc_host;
2884 uint8_t efs_vni_or_vsid[EFX_VNI_OR_VSID_LEN];
2885 uint8_t efs_ifrm_loc_mac[EFX_MAC_ADDR_LEN];
2887 } efx_filter_spec_t;
2890 /* Default values for use in filter specifications */
2891 #define EFX_FILTER_SPEC_RX_DMAQ_ID_DROP 0xfff
2892 #define EFX_FILTER_SPEC_VID_UNSPEC 0xffff
2894 extern __checkReturn efx_rc_t
2896 __in efx_nic_t *enp);
2900 __in efx_nic_t *enp);
2902 extern __checkReturn efx_rc_t
2904 __in efx_nic_t *enp,
2905 __inout efx_filter_spec_t *spec);
2907 extern __checkReturn efx_rc_t
2909 __in efx_nic_t *enp,
2910 __inout efx_filter_spec_t *spec);
2912 extern __checkReturn efx_rc_t
2914 __in efx_nic_t *enp);
2916 extern __checkReturn efx_rc_t
2917 efx_filter_supported_filters(
2918 __in efx_nic_t *enp,
2919 __out_ecount(buffer_length) uint32_t *buffer,
2920 __in size_t buffer_length,
2921 __out size_t *list_lengthp);
2924 efx_filter_spec_init_rx(
2925 __out efx_filter_spec_t *spec,
2926 __in efx_filter_priority_t priority,
2927 __in efx_filter_flags_t flags,
2928 __in efx_rxq_t *erp);
2931 efx_filter_spec_init_tx(
2932 __out efx_filter_spec_t *spec,
2933 __in efx_txq_t *etp);
2935 extern __checkReturn efx_rc_t
2936 efx_filter_spec_set_ipv4_local(
2937 __inout efx_filter_spec_t *spec,
2940 __in uint16_t port);
2942 extern __checkReturn efx_rc_t
2943 efx_filter_spec_set_ipv4_full(
2944 __inout efx_filter_spec_t *spec,
2946 __in uint32_t lhost,
2947 __in uint16_t lport,
2948 __in uint32_t rhost,
2949 __in uint16_t rport);
2951 extern __checkReturn efx_rc_t
2952 efx_filter_spec_set_eth_local(
2953 __inout efx_filter_spec_t *spec,
2955 __in const uint8_t *addr);
2958 efx_filter_spec_set_ether_type(
2959 __inout efx_filter_spec_t *spec,
2960 __in uint16_t ether_type);
2962 extern __checkReturn efx_rc_t
2963 efx_filter_spec_set_uc_def(
2964 __inout efx_filter_spec_t *spec);
2966 extern __checkReturn efx_rc_t
2967 efx_filter_spec_set_mc_def(
2968 __inout efx_filter_spec_t *spec);
2970 typedef enum efx_filter_inner_frame_match_e {
2971 EFX_FILTER_INNER_FRAME_MATCH_OTHER = 0,
2972 EFX_FILTER_INNER_FRAME_MATCH_UNKNOWN_MCAST_DST,
2973 EFX_FILTER_INNER_FRAME_MATCH_UNKNOWN_UCAST_DST
2974 } efx_filter_inner_frame_match_t;
2976 extern __checkReturn efx_rc_t
2977 efx_filter_spec_set_encap_type(
2978 __inout efx_filter_spec_t *spec,
2979 __in efx_tunnel_protocol_t encap_type,
2980 __in efx_filter_inner_frame_match_t inner_frame_match);
2982 extern __checkReturn efx_rc_t
2983 efx_filter_spec_set_vxlan(
2984 __inout efx_filter_spec_t *spec,
2985 __in const uint8_t *vni,
2986 __in const uint8_t *inner_addr,
2987 __in const uint8_t *outer_addr);
2989 extern __checkReturn efx_rc_t
2990 efx_filter_spec_set_geneve(
2991 __inout efx_filter_spec_t *spec,
2992 __in const uint8_t *vni,
2993 __in const uint8_t *inner_addr,
2994 __in const uint8_t *outer_addr);
2996 extern __checkReturn efx_rc_t
2997 efx_filter_spec_set_nvgre(
2998 __inout efx_filter_spec_t *spec,
2999 __in const uint8_t *vsid,
3000 __in const uint8_t *inner_addr,
3001 __in const uint8_t *outer_addr);
3003 #if EFSYS_OPT_RX_SCALE
3004 extern __checkReturn efx_rc_t
3005 efx_filter_spec_set_rss_context(
3006 __inout efx_filter_spec_t *spec,
3007 __in uint32_t rss_context);
3009 #endif /* EFSYS_OPT_FILTER */
3013 extern __checkReturn uint32_t
3015 __in_ecount(count) uint32_t const *input,
3017 __in uint32_t init);
3019 extern __checkReturn uint32_t
3021 __in_ecount(length) uint8_t const *input,
3023 __in uint32_t init);
3025 #if EFSYS_OPT_LICENSING
3029 typedef struct efx_key_stats_s {
3031 uint32_t eks_invalid;
3032 uint32_t eks_blacklisted;
3033 uint32_t eks_unverifiable;
3034 uint32_t eks_wrong_node;
3035 uint32_t eks_licensed_apps_lo;
3036 uint32_t eks_licensed_apps_hi;
3037 uint32_t eks_licensed_features_lo;
3038 uint32_t eks_licensed_features_hi;
3041 extern __checkReturn efx_rc_t
3043 __in efx_nic_t *enp);
3047 __in efx_nic_t *enp);
3049 extern __checkReturn boolean_t
3050 efx_lic_check_support(
3051 __in efx_nic_t *enp);
3053 extern __checkReturn efx_rc_t
3054 efx_lic_update_licenses(
3055 __in efx_nic_t *enp);
3057 extern __checkReturn efx_rc_t
3058 efx_lic_get_key_stats(
3059 __in efx_nic_t *enp,
3060 __out efx_key_stats_t *ksp);
3062 extern __checkReturn efx_rc_t
3064 __in efx_nic_t *enp,
3065 __in uint64_t app_id,
3066 __out boolean_t *licensedp);
3068 extern __checkReturn efx_rc_t
3070 __in efx_nic_t *enp,
3071 __in size_t buffer_size,
3072 __out uint32_t *typep,
3073 __out size_t *lengthp,
3074 __out_opt uint8_t *bufferp);
3077 extern __checkReturn efx_rc_t
3079 __in efx_nic_t *enp,
3080 __in_bcount(buffer_size)
3082 __in size_t buffer_size,
3083 __out uint32_t *startp);
3085 extern __checkReturn efx_rc_t
3087 __in efx_nic_t *enp,
3088 __in_bcount(buffer_size)
3090 __in size_t buffer_size,
3091 __in uint32_t offset,
3092 __out uint32_t *endp);
3094 extern __checkReturn __success(return != B_FALSE) boolean_t
3096 __in efx_nic_t *enp,
3097 __in_bcount(buffer_size)
3099 __in size_t buffer_size,
3100 __in uint32_t offset,
3101 __out uint32_t *startp,
3102 __out uint32_t *lengthp);
3104 extern __checkReturn __success(return != B_FALSE) boolean_t
3105 efx_lic_validate_key(
3106 __in efx_nic_t *enp,
3107 __in_bcount(length) caddr_t keyp,
3108 __in uint32_t length);
3110 extern __checkReturn efx_rc_t
3112 __in efx_nic_t *enp,
3113 __in_bcount(buffer_size)
3115 __in size_t buffer_size,
3116 __in uint32_t offset,
3117 __in uint32_t length,
3118 __out_bcount_part(key_max_size, *lengthp)
3120 __in size_t key_max_size,
3121 __out uint32_t *lengthp);
3123 extern __checkReturn efx_rc_t
3125 __in efx_nic_t *enp,
3126 __in_bcount(buffer_size)
3128 __in size_t buffer_size,
3129 __in uint32_t offset,
3130 __in_bcount(length) caddr_t keyp,
3131 __in uint32_t length,
3132 __out uint32_t *lengthp);
3134 __checkReturn efx_rc_t
3136 __in efx_nic_t *enp,
3137 __in_bcount(buffer_size)
3139 __in size_t buffer_size,
3140 __in uint32_t offset,
3141 __in uint32_t length,
3143 __out uint32_t *deltap);
3145 extern __checkReturn efx_rc_t
3146 efx_lic_create_partition(
3147 __in efx_nic_t *enp,
3148 __in_bcount(buffer_size)
3150 __in size_t buffer_size);
3152 extern __checkReturn efx_rc_t
3153 efx_lic_finish_partition(
3154 __in efx_nic_t *enp,
3155 __in_bcount(buffer_size)
3157 __in size_t buffer_size);
3159 #endif /* EFSYS_OPT_LICENSING */
3163 #if EFSYS_OPT_TUNNEL
3165 extern __checkReturn efx_rc_t
3167 __in efx_nic_t *enp);
3171 __in efx_nic_t *enp);
3174 * For overlay network encapsulation using UDP, the firmware needs to know
3175 * the configured UDP port for the overlay so it can decode encapsulated
3177 * The UDP port/protocol list is global.
3180 extern __checkReturn efx_rc_t
3181 efx_tunnel_config_udp_add(
3182 __in efx_nic_t *enp,
3183 __in uint16_t port /* host/cpu-endian */,
3184 __in efx_tunnel_protocol_t protocol);
3186 extern __checkReturn efx_rc_t
3187 efx_tunnel_config_udp_remove(
3188 __in efx_nic_t *enp,
3189 __in uint16_t port /* host/cpu-endian */,
3190 __in efx_tunnel_protocol_t protocol);
3193 efx_tunnel_config_clear(
3194 __in efx_nic_t *enp);
3197 * Apply tunnel UDP ports configuration to hardware.
3199 * EAGAIN is returned if hardware will be reset (datapath and managment CPU
3202 extern __checkReturn efx_rc_t
3203 efx_tunnel_reconfigure(
3204 __in efx_nic_t *enp);
3206 #endif /* EFSYS_OPT_TUNNEL */
3208 #if EFSYS_OPT_FW_SUBVARIANT_AWARE
3211 * Firmware subvariant choice options.
3213 * It may be switched to no Tx checksum if attached drivers are either
3214 * preboot or firmware subvariant aware and no VIS are allocated.
3215 * If may be always switched to default explicitly using set request or
3216 * implicitly if unaware driver is attaching. If switching is done when
3217 * a driver is attached, it gets MC_REBOOT event and should recreate its
3220 * See SF-119419-TC DPDK Firmware Driver Interface and
3221 * SF-109306-TC EF10 for Driver Writers for details.
3223 typedef enum efx_nic_fw_subvariant_e {
3224 EFX_NIC_FW_SUBVARIANT_DEFAULT = 0,
3225 EFX_NIC_FW_SUBVARIANT_NO_TX_CSUM = 1,
3226 EFX_NIC_FW_SUBVARIANT_NTYPES
3227 } efx_nic_fw_subvariant_t;
3229 extern __checkReturn efx_rc_t
3230 efx_nic_get_fw_subvariant(
3231 __in efx_nic_t *enp,
3232 __out efx_nic_fw_subvariant_t *subvariantp);
3234 extern __checkReturn efx_rc_t
3235 efx_nic_set_fw_subvariant(
3236 __in efx_nic_t *enp,
3237 __in efx_nic_fw_subvariant_t subvariant);
3239 #endif /* EFSYS_OPT_FW_SUBVARIANT_AWARE */
3241 typedef enum efx_phy_fec_type_e {
3242 EFX_PHY_FEC_NONE = 0,
3245 } efx_phy_fec_type_t;
3247 extern __checkReturn efx_rc_t
3248 efx_phy_fec_type_get(
3249 __in efx_nic_t *enp,
3250 __out efx_phy_fec_type_t *typep);
3256 #endif /* _SYS_EFX_H */