#
a1b873f1 |
| 21-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
eal: add casting and GCC diagnostics macros
"GCC diagnostic ignored" pragmas have been commonly sprinkled over the code. Clang supports GCC's pragma for compatibility with existing source code, so #
eal: add casting and GCC diagnostics macros
"GCC diagnostic ignored" pragmas have been commonly sprinkled over the code. Clang supports GCC's pragma for compatibility with existing source code, so #pragma GCC diagnostic and #pragma clang diagnostic are synonyms for Clang (https://clang.llvm.org/docs/UsersManual.html).
Now that effort is being made to make the code compatible with MSVC these expressions would become more complex. It makes sense to hide this complexity behind macros. This makes maintenance easier as these macros are defined in a single place. As a plus the code becomes more readable as well.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
#
4b4ed9cc |
| 22-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
eal: add inlining hints for MSVC
MSVC supports forcing code to be inlined or forcing code to not be inlined, like other compilers. It does not support the "hot" hint though.
This patch fixes existi
eal: add inlining hints for MSVC
MSVC supports forcing code to be inlined or forcing code to not be inlined, like other compilers. It does not support the "hot" hint though.
This patch fixes existing macros __rte_noinline and __rte_always_inline so that they also do what is expected from them when used with MSVC.
__rte_hot is updated to become a noop when MSVC is used.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com> Acked-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
#
154303b0 |
| 10-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
eal: deprecate legacy packed attribute
Macro __rte_packed was marked as deprecated and replaced with __rte_packed_begin/__rte_packed_end.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
|
#
fac4bc0d |
| 10-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
eal: add packing macros for MSVC
MSVC struct packing is not compatible with GCC. Add macro __rte_packed_begin which can be used to push existing pack value and set packing to 1-byte. Add macro __rte
eal: add packing macros for MSVC
MSVC struct packing is not compatible with GCC. Add macro __rte_packed_begin which can be used to push existing pack value and set packing to 1-byte. Add macro __rte_packed_end to restore the pack value prior to the push.
Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing.
Ensure __rte_packed_begin and __rte_packed_end show up in pairs when checking patches.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|
#
bf7ded9a |
| 25-Oct-2024 |
Morten Brørup <mb@smartsharesystems.com> |
eal: add unreachable and precondition hints
Added two new compiler/optimizer hints: * The __rte_unreachable hint for use in points in code known never to be reached. * The __rte_assume hint for prov
eal: add unreachable and precondition hints
Added two new compiler/optimizer hints: * The __rte_unreachable hint for use in points in code known never to be reached. * The __rte_assume hint for providing information about preconditions the compiler/optimizer might be unable to figure out by itself.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
show more ...
|
#
80da7efb |
| 08-Oct-2024 |
Stephen Hemminger <stephen@networkplumber.org> |
eal: annotate allocation functions
The allocation functions take a alignment argument that can be useful to hint the compiler optimizer. This is supported by GCC and Clang but only useful with GCC b
eal: annotate allocation functions
The allocation functions take a alignment argument that can be useful to hint the compiler optimizer. This is supported by GCC and Clang but only useful with GCC because Clang gives warning if alignment is 0.
Newer versions of GCC have a malloc attribute that can be used to find mismatches between allocation and free; the typical problem caught is a pointer allocated with rte_malloc() that is then incorrectly freed using free(). The name of the DPDK wrapper macros for these attributes are chosen to be similar to what GLIBC is using in cdefs.h.
Note: The rte_free function prototype was moved ahead of the allocation functions since the dealloc attribute now refers to it.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com> Acked-by: Wathsala Vithanage <wathsala.vithanage@arm.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
show more ...
|
#
719834a6 |
| 20-Sep-2024 |
Mattias Rönnblom <mattias.ronnblom@ericsson.com> |
use C linkage where appropriate in headers
Assure that 'extern "C" { /../ }' do not cover files included from a particular header file, and address minor issues resulting from this change of order.
use C linkage where appropriate in headers
Assure that 'extern "C" { /../ }' do not cover files included from a particular header file, and address minor issues resulting from this change of order.
Dealing with C++ should delegate to the individual include file level, rather than being imposed by the user of that file. For example, forcing C linkage prevents __Generic macros being replaced with overloaded static inline functions in C++ translation units.
Eliminate 'extern "C"' from files which do not declare any symbols (e.g., only macros or struct types).
On the other hand, the headers check is too naive in assuming that all headers must contain a 'extern "C"'. Such a check was added in commit 1ee492bdc4ff ("buildtools/chkincs: check missing C++ guards"). Since this current change results in many headers not containing such a token, remove the check for 'extern "C"' until we have a better implementation.
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Signed-off-by: David Marchand <david.marchand@redhat.com>
show more ...
|
#
940daadd |
| 20-Mar-2024 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: provide macro for builtin constant intrinsic
MSVC does not have a __builtin_constant_p intrinsic so provide __rte_constant(e) that expands false for MSVC and to the intrinsic for GCC.
Signed-o
eal: provide macro for builtin constant intrinsic
MSVC does not have a __builtin_constant_p intrinsic so provide __rte_constant(e) that expands false for MSVC and to the intrinsic for GCC.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|
#
ff933786 |
| 06-Mar-2024 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
replace pure attribute
Add __rte_pure for GCC __attribute__((pure)) and remove direct use in other places in DPDK.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Reviewed-by: Morten B
replace pure attribute
Add __rte_pure for GCC __attribute__((pure)) and remove direct use in other places in DPDK.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
#
e5bf3e39 |
| 16-Apr-2024 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: fix type in destructor macro for MSVC
RTE_FINI expansion failed to specify void * type for storage of destructor function pointer resulting it defaulting to type ``int``.
Update the macro to s
eal: fix type in destructor macro for MSVC
RTE_FINI expansion failed to specify void * type for storage of destructor function pointer resulting it defaulting to type ``int``.
Update the macro to specify ``void *`` as the type so the correct size is allocated in the segment.
Fixes: 64eff943ca82 ("eal: implement constructors for MSVC") Cc: stable@dpdk.org
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
#
d065725b |
| 27-Feb-2024 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
build: build EAL library with MSVC
* MSVC now has limited handling of GCC __extension__ keyword when compiling C so only expand __extension__ empty on MSVC when building with C++.
* When buildi
build: build EAL library with MSVC
* MSVC now has limited handling of GCC __extension__ keyword when compiling C so only expand __extension__ empty on MSVC when building with C++.
* When building with MSVC enable the statement expressions compiler extension.
* When building with MSVC enable building of eal library.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
show more ...
|
#
c6552d9a |
| 04-Mar-2024 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
lib: move alignment attribute on types for MSVC
The current location used for __rte_aligned(a) for alignment of types is not compatible with MSVC. There is only a single location accepted by both to
lib: move alignment attribute on types for MSVC
The current location used for __rte_aligned(a) for alignment of types is not compatible with MSVC. There is only a single location accepted by both toolchains.
The standard offers no alignment facility that compatibly interoperates with C and C++ but it may be achieved by relocating the placement of __rte_aligned(a) to the aforementioned location accepted by all currently supported toolchains.
To allow alignment for both compilers, do the following:
* Expand __rte_aligned(a) to __declspec(align(a)) when building with MSVC.
* Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag.
The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++.
Note: this move has an additional benefit as Doxygen is not confused anymore like for the rte_event_vector struct definition.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Signed-off-by: David Marchand <david.marchand@redhat.com>
show more ...
|
#
e9fd1ebf |
| 04-Mar-2024 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
lib: use C11 alignment attribute on variables
The current location used for __rte_aligned(a) for alignment of variables is not compatible with MSVC.
For variables, standard C11 offers alignas(a) su
lib: use C11 alignment attribute on variables
The current location used for __rte_aligned(a) for alignment of variables is not compatible with MSVC.
For variables, standard C11 offers alignas(a) supported by conformant compilers i.e. both MSVC and GCC.
Replace use of __rte_aligned(a) on variables/fields with alignas(a).
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com> Signed-off-by: David Marchand <david.marchand@redhat.com>
show more ...
|
#
537caad2 |
| 18-Jan-2024 |
Stephen Hemminger <stephen@networkplumber.org> |
eal: enhance compile-time checks using C11 assert
Both Gcc, clang and MSVC have better way to do compile time assertions rather than using out of bounds array access. The old method would fail if -W
eal: enhance compile-time checks using C11 assert
Both Gcc, clang and MSVC have better way to do compile time assertions rather than using out of bounds array access. The old method would fail if -Wvla is enabled because compiler can't determine size in that code. Also, the use of new _Static_assert will catch broken code that is passing non-constant expression to RTE_BUILD_BUG_ON().
Add workaround for clang static_assert in switch, and missing static_assert in older FreeBSD.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
show more ...
|
#
ac718eda |
| 18-Jan-2024 |
Stephen Hemminger <stephen@networkplumber.org> |
eal: introduce alternative min/max macros
These macros work like RTE_MIN and RTE_MAX but take an explicit type. Necessary when being used in static assertions since RTE_MIN and RTE_MAX use temporary
eal: introduce alternative min/max macros
These macros work like RTE_MIN and RTE_MAX but take an explicit type. Necessary when being used in static assertions since RTE_MIN and RTE_MAX use temporary variables which confuses compilers constant expression checks. These macros could also be useful in other scenarios when bounded range is useful.
Naming is chosen to be similar to Linux kernel conventions.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
show more ...
|
#
74fff67a |
| 12-Feb-2024 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: add macro to allocate and name a section or segment
Provide __rte_section(name) macro that allocates and names a section or segment that works with both MSVC and GCC.
Update RTE_TRACE_POINT_RE
eal: add macro to allocate and name a section or segment
Provide __rte_section(name) macro that allocates and names a section or segment that works with both MSVC and GCC.
Update RTE_TRACE_POINT_REGISTER with __rte_section("__rte_trace_point") instead of __attribute__(section(name)) so the macro may be compatibly expanded when using MSVC.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
#
a24456c2 |
| 01-Nov-2023 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: add extension keyword to alignment macro
add missing __extension__ keyword to RTE_ALIGN_MUL_NEAR statement expression to be consistent with other macros using statement expressions
Signed-off-
eal: add extension keyword to alignment macro
add missing __extension__ keyword to RTE_ALIGN_MUL_NEAR statement expression to be consistent with other macros using statement expressions
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|
#
65f600c0 |
| 04-Sep-2023 |
Morten Brørup <mb@smartsharesystems.com> |
eal: add empty cache line macro
This patch introduces the generic RTE_CACHE_GUARD macro into the EAL, and replaces vaguely described empty cache lines in the rte_ring structure with this macro.
Alt
eal: add empty cache line macro
This patch introduces the generic RTE_CACHE_GUARD macro into the EAL, and replaces vaguely described empty cache lines in the rte_ring structure with this macro.
Although the implementation of the rte_ring structure assumes that the hardware speculatively prefetches 1 cache line, this number can be changed at build time by modifying RTE_CACHE_GUARD_LINES in rte_config.h.
The background and the RFC was discussed in this thread: http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35D87B39@smartserver.smartshare.dk/
Signed-off-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
show more ...
|
#
64eff943 |
| 11-Aug-2023 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: implement constructors for MSVC
Provide RTE_INIT_PRIO and RTE_FINI_PRIO for MSVC allowing priority based equivalents to __attribute__(({constructor,destructor})
Signed-off-by: Tyler Retzlaff <
eal: implement constructors for MSVC
Provide RTE_INIT_PRIO and RTE_FINI_PRIO for MSVC allowing priority based equivalents to __attribute__(({constructor,destructor})
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|
#
e7afce06 |
| 11-Aug-2023 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: hide typeof macro for MSVC
When building with MSVC do not assume typeof is a macro and don't define a typeof macro that conflicts with C23 typeof keyword.
Signed-off-by: Tyler Retzlaff <roretz
eal: hide typeof macro for MSVC
When building with MSVC do not assume typeof is a macro and don't define a typeof macro that conflicts with C23 typeof keyword.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
#
51574a4f |
| 11-Aug-2023 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: implement some common macros for MSVC
For now expand a lot of common rte macros empty. The catch here is we need to test that most of the macros do what they should but at the same time they ar
eal: implement some common macros for MSVC
For now expand a lot of common rte macros empty. The catch here is we need to test that most of the macros do what they should but at the same time they are blocking work needed to bootstrap of the unit tests.
Later we will return and provide (where possible) expansions that work correctly for msvc and where not possible provide some alternate macros to achieve the same outcome.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Signed-off-by: David Marchand <david.marchand@redhat.com>
show more ...
|
#
fc9fa366 |
| 11-Aug-2023 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: hide alignment markers for MSVC
When compiling with MSVC don't expose typedefs used as alignment markers, implemented with GCC extensions.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microso
eal: hide alignment markers for MSVC
When compiling with MSVC don't expose typedefs used as alignment markers, implemented with GCC extensions.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
#
7253e3d2 |
| 04-Apr-2023 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
bitops: move bit count functions
Move the following inline functions from rte_common.h to rte_bitops.h
rte_combine32ms1b rte_combine64ms1b rte_bsf32 rte_bsf32_safe rte_bsf64 rte_bsf64_s
bitops: move bit count functions
Move the following inline functions from rte_common.h to rte_bitops.h
rte_combine32ms1b rte_combine64ms1b rte_bsf32 rte_bsf32_safe rte_bsf64 rte_bsf64_safe rte_fls_u32 rte_fls_u64 rte_is_power_of_2 rte_align32pow2 rte_align32prevpow2 rte_align64pow2 rte_align64prevpow2 rte_log2_u32 rte_log2_u64
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Ferruh Yigit <ferruh.yigit@amd.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
show more ...
|
#
971d2b57 |
| 11-Aug-2023 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
remove C11 compatibility macro
C11 conformant compiler is documented as a minimum requirement to build and consume DPDK. Remove use of RTE_STD_C11 macro marking use of C11 features with __extension_
remove C11 compatibility macro
C11 conformant compiler is documented as a minimum requirement to build and consume DPDK. Remove use of RTE_STD_C11 macro marking use of C11 features with __extension__ since it is no longer necessary and then remove definition of RTE_STD_C11 macro.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
show more ...
|
#
690493fd |
| 05-Oct-2022 |
Thomas Monjalon <thomas@monjalon.net> |
eal: fix return type of bsf safe functions
In a recent commit, changing return type from int to uint32_t, I did a last minute change to functions rte_bsf32_safe and rte_bsf64_safe, because thought t
eal: fix return type of bsf safe functions
In a recent commit, changing return type from int to uint32_t, I did a last minute change to functions rte_bsf32_safe and rte_bsf64_safe, because thought they were forgotten. Actually these functions are returning 0 or 1, so it should be int. The return type is reverted to the original type for these 2 functions.
Fixes: 4b81c145ae37 ("eal: change return type of bsf/fls functions")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Reviewed-by: David Marchand <david.marchand@redhat.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|