1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright (c) 2016-2018 Solarflare Communications Inc.
6 * This software was jointly developed between OKTET Labs (under contract
7 * for Solarflare) and Solarflare Communications, Inc.
10 #ifndef _SFC_COMMON_EFSYS_H
11 #define _SFC_COMMON_EFSYS_H
15 #include <rte_spinlock.h>
16 #include <rte_byteorder.h>
17 #include <rte_debug.h>
18 #include <rte_memzone.h>
19 #include <rte_memory.h>
20 #include <rte_memcpy.h>
21 #include <rte_cycles.h>
22 #include <rte_prefetch.h>
23 #include <rte_common.h>
24 #include <rte_malloc.h>
28 #include "sfc_debug.h"
35 #define EFSYS_HAS_UINT64 1
36 #define EFSYS_USE_UINT64 1
37 #define EFSYS_HAS_SSE2_M128 1
39 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
40 #define EFSYS_IS_BIG_ENDIAN 1
41 #define EFSYS_IS_LITTLE_ENDIAN 0
42 #elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
43 #define EFSYS_IS_BIG_ENDIAN 0
44 #define EFSYS_IS_LITTLE_ENDIAN 1
46 #error "Cannot determine system endianness"
48 #include "efx_types.h"
55 typedef bool boolean_t;
65 * RTE_MAX() and RTE_MIN() cannot be used since braced-group within
66 * expression allowed only inside a function, but MAX() is used as
67 * a number of elements in array.
70 #define MAX(v1, v2) ((v1) > (v2) ? (v1) : (v2))
73 #define MIN(v1, v2) ((v1) < (v2) ? (v1) : (v2))
76 /* There are macros for alignment in DPDK, but we need to make a proper
77 * correspondence here, if we want to re-use them at all
80 #define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
84 #define P2ROUNDUP(x, align) (-(-(x) & -(align)))
88 #define P2ALIGN(_x, _a) ((_x) & -(_a))
92 #define ISP2(x) rte_is_power_of_2(x)
95 #define ENOTACTIVE ENOTCONN
98 prefetch_read_many(const volatile void *addr)
104 prefetch_read_once(const volatile void *addr)
106 rte_prefetch_non_temporal(addr);
109 /* Modifiers used for Windows builds */
112 #define __in_ecount(_n)
113 #define __in_ecount_opt(_n)
114 #define __in_bcount(_n)
115 #define __in_bcount_opt(_n)
119 #define __out_ecount(_n)
120 #define __out_ecount_opt(_n)
121 #define __out_bcount(_n)
122 #define __out_bcount_opt(_n)
123 #define __out_bcount_part(_n, _l)
124 #define __out_bcount_part_opt(_n, _l)
130 #define __inout_ecount(_n)
131 #define __inout_ecount_opt(_n)
132 #define __inout_bcount(_n)
133 #define __inout_bcount_opt(_n)
134 #define __inout_bcount_full_opt(_n)
136 #define __deref_out_bcount_opt(n)
138 #define __checkReturn
139 #define __success(_x)
141 #define __drv_when(_p, _c)
143 /* Code inclusion options */
146 #define EFSYS_OPT_NAMES 1
148 /* Disable SFN5xxx/SFN6xxx since it requires specific support in the PMD */
149 #define EFSYS_OPT_SIENA 0
150 /* Enable SFN7xxx support */
151 #define EFSYS_OPT_HUNTINGTON 1
152 /* Enable SFN8xxx support */
153 #define EFSYS_OPT_MEDFORD 1
154 /* Enable SFN2xxx support */
155 #define EFSYS_OPT_MEDFORD2 1
156 #ifdef RTE_LIBRTE_SFC_EFX_DEBUG
157 #define EFSYS_OPT_CHECK_REG 1
159 #define EFSYS_OPT_CHECK_REG 0
162 /* MCDI is required for SFN7xxx and SFN8xx */
163 #define EFSYS_OPT_MCDI 1
164 #define EFSYS_OPT_MCDI_LOGGING 1
165 #define EFSYS_OPT_MCDI_PROXY_AUTH 1
167 #define EFSYS_OPT_MAC_STATS 1
169 #define EFSYS_OPT_LOOPBACK 1
171 #define EFSYS_OPT_MON_MCDI 0
172 #define EFSYS_OPT_MON_STATS 0
174 #define EFSYS_OPT_PHY_STATS 0
175 #define EFSYS_OPT_BIST 0
176 #define EFSYS_OPT_PHY_LED_CONTROL 0
177 #define EFSYS_OPT_PHY_FLAGS 0
179 #define EFSYS_OPT_VPD 0
180 #define EFSYS_OPT_NVRAM 0
181 #define EFSYS_OPT_BOOTCFG 0
182 #define EFSYS_OPT_IMAGE_LAYOUT 0
184 #define EFSYS_OPT_DIAG 0
185 #define EFSYS_OPT_RX_SCALE 1
186 #define EFSYS_OPT_QSTATS 0
187 /* Filters support is required for SFN7xxx and SFN8xx */
188 #define EFSYS_OPT_FILTER 1
189 #define EFSYS_OPT_RX_SCATTER 0
191 #define EFSYS_OPT_EV_PREFETCH 0
193 #define EFSYS_OPT_DECODE_INTR_FATAL 0
195 #define EFSYS_OPT_LICENSING 0
197 #define EFSYS_OPT_ALLOW_UNCONFIGURED_NIC 0
199 #define EFSYS_OPT_RX_PACKED_STREAM 0
201 #define EFSYS_OPT_RX_ES_SUPER_BUFFER 1
203 #define EFSYS_OPT_TUNNEL 1
205 #define EFSYS_OPT_FW_SUBVARIANT_AWARE 1
209 typedef struct __efsys_identifier_s efsys_identifier_t;
212 #define EFSYS_PROBE(_name) \
215 #define EFSYS_PROBE1(_name, _type1, _arg1) \
218 #define EFSYS_PROBE2(_name, _type1, _arg1, _type2, _arg2) \
221 #define EFSYS_PROBE3(_name, _type1, _arg1, _type2, _arg2, \
225 #define EFSYS_PROBE4(_name, _type1, _arg1, _type2, _arg2, \
226 _type3, _arg3, _type4, _arg4) \
229 #define EFSYS_PROBE5(_name, _type1, _arg1, _type2, _arg2, \
230 _type3, _arg3, _type4, _arg4, _type5, _arg5) \
233 #define EFSYS_PROBE6(_name, _type1, _arg1, _type2, _arg2, \
234 _type3, _arg3, _type4, _arg4, _type5, _arg5, \
238 #define EFSYS_PROBE7(_name, _type1, _arg1, _type2, _arg2, \
239 _type3, _arg3, _type4, _arg4, _type5, _arg5, \
240 _type6, _arg6, _type7, _arg7) \
246 typedef rte_iova_t efsys_dma_addr_t;
248 typedef struct efsys_mem_s {
249 const struct rte_memzone *esm_mz;
251 * Ideally it should have volatile qualifier to denote that
252 * the memory may be updated by someone else. However, it adds
253 * qualifier discard warnings when the pointer or its derivative
254 * is passed to memset() or rte_mov16().
255 * So, skip the qualifier here, but make sure that it is added
256 * below in access macros.
259 efsys_dma_addr_t esm_addr;
263 #define EFSYS_MEM_ZERO(_esmp, _size) \
265 (void)memset((void *)(_esmp)->esm_base, 0, (_size)); \
267 _NOTE(CONSTANTCONDITION); \
270 #define EFSYS_MEM_READD(_esmp, _offset, _edp) \
272 volatile uint8_t *_base = (_esmp)->esm_base; \
273 volatile uint32_t *_addr; \
275 _NOTE(CONSTANTCONDITION); \
276 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_dword_t))); \
278 _addr = (volatile uint32_t *)(_base + (_offset)); \
279 (_edp)->ed_u32[0] = _addr[0]; \
281 EFSYS_PROBE2(mem_readl, unsigned int, (_offset), \
282 uint32_t, (_edp)->ed_u32[0]); \
284 _NOTE(CONSTANTCONDITION); \
287 #define EFSYS_MEM_READQ(_esmp, _offset, _eqp) \
289 volatile uint8_t *_base = (_esmp)->esm_base; \
290 volatile uint64_t *_addr; \
292 _NOTE(CONSTANTCONDITION); \
293 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_qword_t))); \
295 _addr = (volatile uint64_t *)(_base + (_offset)); \
296 (_eqp)->eq_u64[0] = _addr[0]; \
298 EFSYS_PROBE3(mem_readq, unsigned int, (_offset), \
299 uint32_t, (_eqp)->eq_u32[1], \
300 uint32_t, (_eqp)->eq_u32[0]); \
302 _NOTE(CONSTANTCONDITION); \
305 #define EFSYS_MEM_READO(_esmp, _offset, _eop) \
307 volatile uint8_t *_base = (_esmp)->esm_base; \
308 volatile __m128i *_addr; \
310 _NOTE(CONSTANTCONDITION); \
311 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_oword_t))); \
313 _addr = (volatile __m128i *)(_base + (_offset)); \
314 (_eop)->eo_u128[0] = _addr[0]; \
316 EFSYS_PROBE5(mem_reado, unsigned int, (_offset), \
317 uint32_t, (_eop)->eo_u32[3], \
318 uint32_t, (_eop)->eo_u32[2], \
319 uint32_t, (_eop)->eo_u32[1], \
320 uint32_t, (_eop)->eo_u32[0]); \
322 _NOTE(CONSTANTCONDITION); \
326 #define EFSYS_MEM_WRITED(_esmp, _offset, _edp) \
328 volatile uint8_t *_base = (_esmp)->esm_base; \
329 volatile uint32_t *_addr; \
331 _NOTE(CONSTANTCONDITION); \
332 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_dword_t))); \
334 EFSYS_PROBE2(mem_writed, unsigned int, (_offset), \
335 uint32_t, (_edp)->ed_u32[0]); \
337 _addr = (volatile uint32_t *)(_base + (_offset)); \
338 _addr[0] = (_edp)->ed_u32[0]; \
340 _NOTE(CONSTANTCONDITION); \
343 #define EFSYS_MEM_WRITEQ(_esmp, _offset, _eqp) \
345 volatile uint8_t *_base = (_esmp)->esm_base; \
346 volatile uint64_t *_addr; \
348 _NOTE(CONSTANTCONDITION); \
349 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_qword_t))); \
351 EFSYS_PROBE3(mem_writeq, unsigned int, (_offset), \
352 uint32_t, (_eqp)->eq_u32[1], \
353 uint32_t, (_eqp)->eq_u32[0]); \
355 _addr = (volatile uint64_t *)(_base + (_offset)); \
356 _addr[0] = (_eqp)->eq_u64[0]; \
358 _NOTE(CONSTANTCONDITION); \
361 #define EFSYS_MEM_WRITEO(_esmp, _offset, _eop) \
363 volatile uint8_t *_base = (_esmp)->esm_base; \
364 volatile __m128i *_addr; \
366 _NOTE(CONSTANTCONDITION); \
367 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_oword_t))); \
370 EFSYS_PROBE5(mem_writeo, unsigned int, (_offset), \
371 uint32_t, (_eop)->eo_u32[3], \
372 uint32_t, (_eop)->eo_u32[2], \
373 uint32_t, (_eop)->eo_u32[1], \
374 uint32_t, (_eop)->eo_u32[0]); \
376 _addr = (volatile __m128i *)(_base + (_offset)); \
377 _addr[0] = (_eop)->eo_u128[0]; \
379 _NOTE(CONSTANTCONDITION); \
383 #define EFSYS_MEM_SIZE(_esmp) \
384 ((_esmp)->esm_mz->len)
386 #define EFSYS_MEM_ADDR(_esmp) \
389 #define EFSYS_MEM_IS_NULL(_esmp) \
390 ((_esmp)->esm_base == NULL)
392 #define EFSYS_MEM_PREFETCH(_esmp, _offset) \
394 volatile uint8_t *_base = (_esmp)->esm_base; \
396 rte_prefetch0(_base + (_offset)); \
402 typedef struct efsys_bar_s {
403 rte_spinlock_t esb_lock;
405 struct rte_pci_device *esb_dev;
407 * Ideally it should have volatile qualifier to denote that
408 * the memory may be updated by someone else. However, it adds
409 * qualifier discard warnings when the pointer or its derivative
410 * is passed to memset() or rte_mov16().
411 * So, skip the qualifier here, but make sure that it is added
412 * below in access macros.
417 #define SFC_BAR_LOCK_INIT(_esbp, _ifname) \
419 rte_spinlock_init(&(_esbp)->esb_lock); \
420 _NOTE(CONSTANTCONDITION); \
422 #define SFC_BAR_LOCK_DESTROY(_esbp) ((void)0)
423 #define SFC_BAR_LOCK(_esbp) rte_spinlock_lock(&(_esbp)->esb_lock)
424 #define SFC_BAR_UNLOCK(_esbp) rte_spinlock_unlock(&(_esbp)->esb_lock)
426 #define EFSYS_BAR_READD(_esbp, _offset, _edp, _lock) \
428 volatile uint8_t *_base = (_esbp)->esb_base; \
429 volatile uint32_t *_addr; \
431 _NOTE(CONSTANTCONDITION); \
432 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_dword_t))); \
433 _NOTE(CONSTANTCONDITION); \
435 SFC_BAR_LOCK(_esbp); \
437 _addr = (volatile uint32_t *)(_base + (_offset)); \
439 (_edp)->ed_u32[0] = rte_read32_relaxed(_addr); \
441 EFSYS_PROBE2(bar_readd, unsigned int, (_offset), \
442 uint32_t, (_edp)->ed_u32[0]); \
444 _NOTE(CONSTANTCONDITION); \
446 SFC_BAR_UNLOCK(_esbp); \
447 _NOTE(CONSTANTCONDITION); \
450 #define EFSYS_BAR_READQ(_esbp, _offset, _eqp) \
452 volatile uint8_t *_base = (_esbp)->esb_base; \
453 volatile uint64_t *_addr; \
455 _NOTE(CONSTANTCONDITION); \
456 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_qword_t))); \
458 SFC_BAR_LOCK(_esbp); \
460 _addr = (volatile uint64_t *)(_base + (_offset)); \
462 (_eqp)->eq_u64[0] = rte_read64_relaxed(_addr); \
464 EFSYS_PROBE3(bar_readq, unsigned int, (_offset), \
465 uint32_t, (_eqp)->eq_u32[1], \
466 uint32_t, (_eqp)->eq_u32[0]); \
468 SFC_BAR_UNLOCK(_esbp); \
469 _NOTE(CONSTANTCONDITION); \
472 #define EFSYS_BAR_READO(_esbp, _offset, _eop, _lock) \
474 volatile uint8_t *_base = (_esbp)->esb_base; \
475 volatile __m128i *_addr; \
477 _NOTE(CONSTANTCONDITION); \
478 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_oword_t))); \
480 _NOTE(CONSTANTCONDITION); \
482 SFC_BAR_LOCK(_esbp); \
484 _addr = (volatile __m128i *)(_base + (_offset)); \
486 /* There is no rte_read128_relaxed() yet */ \
487 (_eop)->eo_u128[0] = _addr[0]; \
489 EFSYS_PROBE5(bar_reado, unsigned int, (_offset), \
490 uint32_t, (_eop)->eo_u32[3], \
491 uint32_t, (_eop)->eo_u32[2], \
492 uint32_t, (_eop)->eo_u32[1], \
493 uint32_t, (_eop)->eo_u32[0]); \
495 _NOTE(CONSTANTCONDITION); \
497 SFC_BAR_UNLOCK(_esbp); \
498 _NOTE(CONSTANTCONDITION); \
502 #define EFSYS_BAR_WRITED(_esbp, _offset, _edp, _lock) \
504 volatile uint8_t *_base = (_esbp)->esb_base; \
505 volatile uint32_t *_addr; \
507 _NOTE(CONSTANTCONDITION); \
508 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_dword_t))); \
510 _NOTE(CONSTANTCONDITION); \
512 SFC_BAR_LOCK(_esbp); \
514 EFSYS_PROBE2(bar_writed, unsigned int, (_offset), \
515 uint32_t, (_edp)->ed_u32[0]); \
517 _addr = (volatile uint32_t *)(_base + (_offset)); \
518 rte_write32_relaxed((_edp)->ed_u32[0], _addr); \
521 _NOTE(CONSTANTCONDITION); \
523 SFC_BAR_UNLOCK(_esbp); \
524 _NOTE(CONSTANTCONDITION); \
527 #define EFSYS_BAR_WRITEQ(_esbp, _offset, _eqp) \
529 volatile uint8_t *_base = (_esbp)->esb_base; \
530 volatile uint64_t *_addr; \
532 _NOTE(CONSTANTCONDITION); \
533 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_qword_t))); \
535 SFC_BAR_LOCK(_esbp); \
537 EFSYS_PROBE3(bar_writeq, unsigned int, (_offset), \
538 uint32_t, (_eqp)->eq_u32[1], \
539 uint32_t, (_eqp)->eq_u32[0]); \
541 _addr = (volatile uint64_t *)(_base + (_offset)); \
542 rte_write64_relaxed((_eqp)->eq_u64[0], _addr); \
545 SFC_BAR_UNLOCK(_esbp); \
546 _NOTE(CONSTANTCONDITION); \
550 * Guarantees 64bit aligned 64bit writes to write combined BAR mapping
551 * (required by PIO hardware).
553 * Neither VFIO, nor UIO, nor NIC UIO (on FreeBSD) support
554 * write-combined memory mapped to user-land, so just abort if used.
556 #define EFSYS_BAR_WC_WRITEQ(_esbp, _offset, _eqp) \
558 rte_panic("Write-combined BAR access not supported"); \
561 #define EFSYS_BAR_WRITEO(_esbp, _offset, _eop, _lock) \
563 volatile uint8_t *_base = (_esbp)->esb_base; \
564 volatile __m128i *_addr; \
566 _NOTE(CONSTANTCONDITION); \
567 SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_oword_t))); \
569 _NOTE(CONSTANTCONDITION); \
571 SFC_BAR_LOCK(_esbp); \
573 EFSYS_PROBE5(bar_writeo, unsigned int, (_offset), \
574 uint32_t, (_eop)->eo_u32[3], \
575 uint32_t, (_eop)->eo_u32[2], \
576 uint32_t, (_eop)->eo_u32[1], \
577 uint32_t, (_eop)->eo_u32[0]); \
579 _addr = (volatile __m128i *)(_base + (_offset)); \
580 /* There is no rte_write128_relaxed() yet */ \
581 _addr[0] = (_eop)->eo_u128[0]; \
584 _NOTE(CONSTANTCONDITION); \
586 SFC_BAR_UNLOCK(_esbp); \
587 _NOTE(CONSTANTCONDITION); \
590 /* Use the standard octo-word write for doorbell writes */
591 #define EFSYS_BAR_DOORBELL_WRITEO(_esbp, _offset, _eop) \
593 EFSYS_BAR_WRITEO((_esbp), (_offset), (_eop), B_FALSE); \
594 _NOTE(CONSTANTCONDITION); \
599 #define EFSYS_SPIN(_us) \
602 _NOTE(CONSTANTCONDITION); \
605 #define EFSYS_SLEEP EFSYS_SPIN
609 #define EFSYS_MEM_READ_BARRIER() rte_rmb()
610 #define EFSYS_PIO_WRITE_BARRIER() rte_io_wmb()
615 * DPDK does not provide any DMA syncing API, and no PMD drivers
616 * have any traces of explicit DMA syncing.
617 * DMA mapping is assumed to be coherent.
620 #define EFSYS_DMA_SYNC_FOR_KERNEL(_esmp, _offset, _size) ((void)0)
622 /* Just avoid store and compiler (impliciltly) reordering */
623 #define EFSYS_DMA_SYNC_FOR_DEVICE(_esmp, _offset, _size) rte_wmb()
627 typedef uint64_t efsys_timestamp_t;
629 #define EFSYS_TIMESTAMP(_usp) \
631 *(_usp) = rte_get_timer_cycles() * 1000000 / \
632 rte_get_timer_hz(); \
633 _NOTE(CONSTANTCONDITION); \
638 #define EFSYS_KMEM_ALLOC(_esip, _size, _p) \
641 (_p) = rte_zmalloc("sfc", (_size), 0); \
642 _NOTE(CONSTANTCONDITION); \
645 #define EFSYS_KMEM_FREE(_esip, _size, _p) \
650 _NOTE(CONSTANTCONDITION); \
655 typedef rte_spinlock_t efsys_lock_t;
657 #define SFC_EFSYS_LOCK_INIT(_eslp, _ifname, _label) \
658 rte_spinlock_init((_eslp))
659 #define SFC_EFSYS_LOCK_DESTROY(_eslp) ((void)0)
660 #define SFC_EFSYS_LOCK(_eslp) \
661 rte_spinlock_lock((_eslp))
662 #define SFC_EFSYS_UNLOCK(_eslp) \
663 rte_spinlock_unlock((_eslp))
664 #define SFC_EFSYS_LOCK_ASSERT_OWNED(_eslp) \
665 SFC_ASSERT(rte_spinlock_is_locked((_eslp)))
667 typedef int efsys_lock_state_t;
669 #define EFSYS_LOCK_MAGIC 0x000010c4
671 #define EFSYS_LOCK(_lockp, _state) \
673 SFC_EFSYS_LOCK(_lockp); \
674 (_state) = EFSYS_LOCK_MAGIC; \
675 _NOTE(CONSTANTCONDITION); \
678 #define EFSYS_UNLOCK(_lockp, _state) \
680 SFC_ASSERT((_state) == EFSYS_LOCK_MAGIC); \
681 SFC_EFSYS_UNLOCK(_lockp); \
682 _NOTE(CONSTANTCONDITION); \
687 typedef uint64_t efsys_stat_t;
689 #define EFSYS_STAT_INCR(_knp, _delta) \
691 *(_knp) += (_delta); \
692 _NOTE(CONSTANTCONDITION); \
695 #define EFSYS_STAT_DECR(_knp, _delta) \
697 *(_knp) -= (_delta); \
698 _NOTE(CONSTANTCONDITION); \
701 #define EFSYS_STAT_SET(_knp, _val) \
704 _NOTE(CONSTANTCONDITION); \
707 #define EFSYS_STAT_SET_QWORD(_knp, _valp) \
709 *(_knp) = rte_le_to_cpu_64((_valp)->eq_u64[0]); \
710 _NOTE(CONSTANTCONDITION); \
713 #define EFSYS_STAT_SET_DWORD(_knp, _valp) \
715 *(_knp) = rte_le_to_cpu_32((_valp)->ed_u32[0]); \
716 _NOTE(CONSTANTCONDITION); \
719 #define EFSYS_STAT_INCR_QWORD(_knp, _valp) \
721 *(_knp) += rte_le_to_cpu_64((_valp)->eq_u64[0]); \
722 _NOTE(CONSTANTCONDITION); \
725 #define EFSYS_STAT_SUBR_QWORD(_knp, _valp) \
727 *(_knp) -= rte_le_to_cpu_64((_valp)->eq_u64[0]); \
728 _NOTE(CONSTANTCONDITION); \
733 #if EFSYS_OPT_DECODE_INTR_FATAL
734 #define EFSYS_ERR(_esip, _code, _dword0, _dword1) \
737 SFC_GENERIC_LOG(ERR, "FATAL ERROR #%u (0x%08x%08x)", \
738 (_code), (_dword0), (_dword1)); \
739 _NOTE(CONSTANTCONDITION); \
745 /* RTE_VERIFY from DPDK treats expressions with % operator incorrectly,
746 * so we re-implement it here
748 #ifdef RTE_LIBRTE_SFC_EFX_DEBUG
749 #define EFSYS_ASSERT(_exp) \
751 if (unlikely(!(_exp))) \
752 rte_panic("line %d\tassert \"%s\" failed\n", \
753 __LINE__, (#_exp)); \
756 #define EFSYS_ASSERT(_exp) (void)(_exp)
759 #define EFSYS_ASSERT3(_x, _op, _y, _t) EFSYS_ASSERT((_t)(_x) _op (_t)(_y))
761 #define EFSYS_ASSERT3U(_x, _op, _y) EFSYS_ASSERT3(_x, _op, _y, uint64_t)
762 #define EFSYS_ASSERT3S(_x, _op, _y) EFSYS_ASSERT3(_x, _op, _y, int64_t)
763 #define EFSYS_ASSERT3P(_x, _op, _y) EFSYS_ASSERT3(_x, _op, _y, uintptr_t)
767 #define EFSYS_HAS_ROTL_DWORD 0
773 #endif /* _SFC_COMMON_EFSYS_H */