| 21cab84f | 24-Jan-2025 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
bitops: find first set bit
Provide toolchain abstraction for __builtin_ffs{,l,ll} gcc built-in intrinsics. Add associated unit tests.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Si
bitops: find first set bit
Provide toolchain abstraction for __builtin_ffs{,l,ll} gcc built-in intrinsics. Add associated unit tests.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
show more ...
|
| feb9fd6a | 24-Jan-2025 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal/x86: add write combining store for MSVC
MSVC does not support inline assembly. Instead it provides compiler intrinsics. Provide conditional compile for MSVC for movdiri using the _directstoreu_u
eal/x86: add write combining store for MSVC
MSVC does not support inline assembly. Instead it provides compiler intrinsics. Provide conditional compile for MSVC for movdiri using the _directstoreu_u32 intrinsic.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|
| 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 ...
|
| 4d2aa150 | 14-Jan-2025 |
Ariel Otilibili <otilibil@eurecom.fr> |
vhost: remove check around mutex init
pthread_mutex_init always returns 0. The other mutex functions return 0 on success and a non-zero error code on error.
Link: https://man7.org/linux/man-pages/m
vhost: remove check around mutex init
pthread_mutex_init always returns 0. The other mutex functions return 0 on success and a non-zero error code on error.
Link: https://man7.org/linux/man-pages/man3/pthread_mutex_lock.3.html Bugzilla ID: 1586
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
show more ...
|
| c171a2d5 | 19-Dec-2024 |
Stephen Hemminger <stephen@networkplumber.org> |
vhost: use strlcpy instead of strncpy
Some tools such as gcc address sanitizer will complain if strncpy is used to completely fill a string since it will not be null terminated. Since the previous c
vhost: use strlcpy instead of strncpy
Some tools such as gcc address sanitizer will complain if strncpy is used to completely fill a string since it will not be null terminated. Since the previous code forced as null at end, use strlcpy() to get the same effect.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
show more ...
|
| 5b856206 | 14-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
eal/x86: fix some intrinsics header include for Windows
Error reported: ../lib/net/net_crc_sse.c:49:17: error: call to undeclared function '_mm_clmulepi64_si128'; ISO C99 and later do not support im
eal/x86: fix some intrinsics header include for Windows
Error reported: ../lib/net/net_crc_sse.c:49:17: error: call to undeclared function '_mm_clmulepi64_si128'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
The fix is to remove the unnecessary ifdef around the inclusion of header file immintrin.h. This header also contains functions that do not require AVX instructions, so should not be included only when AVX is available.
Bugzilla ID: 1595 Fixes: da826b7135a4 ("eal: introduce ymm type for AVX 256-bit") Cc: stable@dpdk.org
Reported-by: Pier Damouny <pdamouny@nvidia.com> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com> Acked-by: Bruce Richardson <bruce.richardson@intel.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 ...
|
| 6d7e741b | 16-Jan-2025 |
Maxime Coquelin <maxime.coquelin@redhat.com> |
vhost: improve RARP handling in dequeue paths
With previous refactoring, we can now simplify the RARP packet injection handling in both the sync and async dequeue paths.
Signed-off-by: Maxime Coque
vhost: improve RARP handling in dequeue paths
With previous refactoring, we can now simplify the RARP packet injection handling in both the sync and async dequeue paths.
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: David Marchand <david.marchand@redhat.com> Reviewed-by: Chenbo Xia <chenbox@nvidia.com>
show more ...
|
| 6ee0cf80 | 16-Jan-2025 |
Maxime Coquelin <maxime.coquelin@redhat.com> |
vhost: rework dequeue paths error handling
This patch refactors the error handling in the Vhost dequeue paths to ease its maintenance and readability.
Suggested-by: David Marchand <david.marchand@r
vhost: rework dequeue paths error handling
This patch refactors the error handling in the Vhost dequeue paths to ease its maintenance and readability.
Suggested-by: David Marchand <david.marchand@redhat.com> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: David Marchand <david.marchand@redhat.com> Reviewed-by: Chenbo Xia <chenbox@nvidia.com>
show more ...
|
| 8b96508a | 16-Jan-2025 |
Maxime Coquelin <maxime.coquelin@redhat.com> |
vhost: reset packets count when not ready
This patch fixes the rte_vhost_dequeue_burst return value when the virtqueue is not ready. Without it, a discrepancy between the packet array and its size i
vhost: reset packets count when not ready
This patch fixes the rte_vhost_dequeue_burst return value when the virtqueue is not ready. Without it, a discrepancy between the packet array and its size is faced by the caller of this API when the virtqueue is not ready.
Fixes: 9fc93a1e2320 ("vhost: fix virtqueue access check in datapath") Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: David Marchand <david.marchand@redhat.com> Reviewed-by: Chenbo Xia <chenbox@nvidia.com>
show more ...
|
| 27429219 | 09-Jan-2025 |
Maxime Coquelin <maxime.coquelin@redhat.com> |
vhost: fix log when setting max queue num
rte_vhost_driver_set_max_queue_num API returns early when called for a Vhost-user device, as this API is intended to limit the maximum number of queue pairs
vhost: fix log when setting max queue num
rte_vhost_driver_set_max_queue_num API returns early when called for a Vhost-user device, as this API is intended to limit the maximum number of queue pairs supported by VDUSE devices. However, a log mentioning the maximum number of queue pairs is being set is emitted unconditionally, which may confuse the end user.
This patch moves this log after the backend type is checked, so that it is only called with VDUSE backends. The check on the requested value is also moved at the same place.
Fixes: e1808999d36b ("vhost: restrict set max queue pair API to VDUSE") Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: Ilya Maximets <i.maximets@ovn.org> Reviewed-by: Chenbo Xia <chenbox@nvidia.com> Acked-by: Kevin Traynor <ktraynor@redhat.com>
show more ...
|
| 7023f3e5 | 20-Dec-2024 |
Yunjian Wang <wangyunjian@huawei.com> |
vhost: check GSO size validity
The value of tso_segsz cannot be 0, instead check that value of gso_size was set.
Fixes: d0cf91303d73 ("vhost: add Tx offload capabilities") Cc: stable@dpdk.org
Sign
vhost: check GSO size validity
The value of tso_segsz cannot be 0, instead check that value of gso_size was set.
Fixes: d0cf91303d73 ("vhost: add Tx offload capabilities") Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
show more ...
|
| 1846fe76 | 27-Nov-2024 |
Jianping Zhao <zhao305149619@gmail.com> |
vhost: clear ring addresses when getting vring base
Clear ring addresses during vring base retrieval to handle guest reboot scenarios correctly. This is particularly important for vdpa-blk devices w
vhost: clear ring addresses when getting vring base
Clear ring addresses during vring base retrieval to handle guest reboot scenarios correctly. This is particularly important for vdpa-blk devices where the following issue occurs:
When a guest OS with vdpa-blk device reboots, during UEFI stage, only one vring is actually used and configured. However, QEMU still sends enable messages for all configured queues. The remaining queues retain their addresses from before reboot, which reference invalid memory mappings in the rebooted guest.
The issue manifests in vq_is_ready():
static bool vq_is_ready(struct virtio_net *dev, struct vhost_virtqueue *vq) { /* Only checks pointer validity, not address freshness */ rings_ok = vq->desc && vq->avail && vq->used; ... }
vq_is_ready() incorrectly considers these queues as ready because it only checks if desc/avail/used pointers are non-NULL, but cannot detect that these addresses are stale from the previous boot.
Clear the ring addresses in vhost_user_get_vring_base() to force the guest driver to reconfigure them before use. This ensures that vq_is_ready() will return false for queues with stale addresses until they are properly reconfigured by the guest driver.
Fixes: 3ea7052f4b1b ("vhost: postpone rings addresses translation") Cc: stable@dpdk.org
Signed-off-by: Jianping Zhao <zhao305149619@gmail.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
show more ...
|
| b5458e2c | 06-Dec-2024 |
Konstantin Ananyev <konstantin.ananyev@huawei.com> |
ring: introduce staged ordered ring
Staged-Ordered-Ring (SORING) provides a SW abstraction for 'ordered' queues with multiple processing 'stages'. It is based on conventional DPDK rte_ring, re-uses
ring: introduce staged ordered ring
Staged-Ordered-Ring (SORING) provides a SW abstraction for 'ordered' queues with multiple processing 'stages'. It is based on conventional DPDK rte_ring, re-uses many of its concepts, and even substantial part of its code. It can be viewed as an 'extension' of rte_ring functionality. In particular, main SORING properties: - circular ring buffer with fixed size objects - producer, consumer plus multiple processing stages in the middle. - allows to split objects processing into multiple stages. - objects remain in the same ring while moving from one stage to the other, initial order is preserved, no extra copying needed. - preserves the ingress order of objects within the queue across multiple stages, i.e.: at the same stage multiple threads can process objects from the ring in any order, but for the next stage objects will always appear in the original order. - each stage (and producer/consumer) can be served by single and/or multiple threads. - number of stages, size and number of objects in the ring are configurable at ring initialization time.
Data-path API provides four main operations: - enqueue/dequeue works in the same manner as for conventional rte_ring, all rte_ring synchronization types are supported. - acquire/release - for each stage there is an acquire (start) and release (finish) operation. after some objects are 'acquired' - given thread can safely assume that it has exclusive possession of these objects till 'release' for them is invoked. Note that right now user has to release exactly the same number of objects that was acquired before. After 'release', objects can be 'acquired' by next stage and/or dequeued by the consumer (in case of last stage).
Expected use-case: applications that uses pipeline model (probably with multiple stages) for packet processing, when preserving incoming packet order is important. I.E.: IPsec processing, etc.
Signed-off-by: Eimear Morrissey <eimear.morrissey@huawei.com> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
show more ...
|
| 700989f5 | 06-Dec-2024 |
Eimear Morrissey <eimear.morrissey@huawei.com> |
ring: make dump function more verbose
The current rte_ring_dump function uses the generic rte_ring_headtail structure to access head/tail positions. This is incorrect for the RTS case where the head
ring: make dump function more verbose
The current rte_ring_dump function uses the generic rte_ring_headtail structure to access head/tail positions. This is incorrect for the RTS case where the head is stored in a different offset in the union of structs. Switching to a separate function for each sync type allows to dump correct head/tail values and extra metadata.
Signed-off-by: Eimear Morrissey <eimear.morrissey@huawei.com> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
show more ...
|
| e4251abd | 06-Dec-2024 |
Konstantin Ananyev <konstantin.ananyev@huawei.com> |
ring: make copying functions generic
Note upfront: that change doesn't introduce any functional or performance changes. It is just a code-reordering for: - improve code modularity and re-usability
ring: make copying functions generic
Note upfront: that change doesn't introduce any functional or performance changes. It is just a code-reordering for: - improve code modularity and re-usability - ability in future to re-use the same code to introduce new functionality
There is no real need for enqueue_elems()/dequeue_elems() to get pointer to actual rte_ring structure, instead it is enough to pass a pointer to actual elements buffer inside the ring. In return, we'll get a copying functions that could be used for other queueing abstractions that do have circular ring buffer inside.
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
show more ...
|
| 3197a1ff | 06-Dec-2024 |
Konstantin Ananyev <konstantin.ananyev@huawei.com> |
ring: deduplicate move head functions
Note upfront: that change doesn't introduce any functional or performance changes. It is just a code-reordering for: - code deduplication - ability in future
ring: deduplicate move head functions
Note upfront: that change doesn't introduce any functional or performance changes. It is just a code-reordering for: - code deduplication - ability in future to re-use the same code to introduce new functionality
For each sync mode corresponding move_prod_head() and move_cons_head() are nearly identical to each other, the only differences are: - do we need to use a @capacity to calculate number of entries or not. - what we need to update (prod/cons) and what is used as read-only counterpart. So instead of having 2 copies of nearly identical functions, introduce a new common one that could be used by both functions: move_prod_head() and move_cons_head().
As another positive thing - we can get rid of referencing whole rte_ring structure in that new common sub-function.
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@huawei.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
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> |
| fba98755 | 10-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
lib: replace packed attributes
MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rt
lib: replace packed attributes
MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and 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.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
show more ...
|
| 3cd0547a | 10-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
net: remove packed attribute on IPv6 scope
This change affects the storage size of a variable of enum rte_ipv6_mc_scope (at least with gcc). It should be OK from an ABI POV though: there is one (inl
net: remove packed attribute on IPv6 scope
This change affects the storage size of a variable of enum rte_ipv6_mc_scope (at least with gcc). It should be OK from an ABI POV though: there is one (inline) helper using this type, and nothing else in DPDK takes a IPv6 multicast scope as input.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
show more ...
|
| 5dc68f2b | 10-Jan-2025 |
Andre Muezerie <andremue@linux.microsoft.com> |
eal: remove some packed attributes
Removed the packed attributes from some structures that don't need them.
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 ...
|
| ba9fb279 | 29-Nov-2024 |
Robin Jarry <rjarry@redhat.com> |
log: fix double free on cleanup
Fix the following crash when closing a log file after rte_eal_cleanup():
double free or corruption (!prev)
Thread 1 "grout" received signal SIGABRT, Aborted
log: fix double free on cleanup
Fix the following crash when closing a log file after rte_eal_cleanup():
double free or corruption (!prev)
Thread 1 "grout" received signal SIGABRT, Aborted. __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44 ... #10 _IO_new_fclose (fp=0xb63090) at iofclose.c:74 #11 0x000000000049c04e in dpdk_fini () at ../main/dpdk.c:204 #12 0x0000000000402ab8 in main (...) at ../main/main.c:217 (gdb) up 11 #11 0x000000000049c04e in dpdk_fini () at ../main/dpdk.c:204 202 rte_eal_cleanup(); 203 if (log_stream != NULL) 204 fclose(log_stream);
When the application has passed a custom file via rte_openlog_stream() DPDK should not call fclose() on it.
Add an internal is_internal_file field to track whether the file has been allocated by DPDK (syslog or journald) to determine if it should be closed or not.
Fixes: 985130369be3 ("log: rework syslog handling") Cc: stable@dpdk.org
Signed-off-by: Robin Jarry <rjarry@redhat.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
show more ...
|
| 4dc4e33f | 28-Nov-2024 |
Olivier Matz <olivier.matz@6wind.com> |
net/virtio: fix Rx checksum calculation
If hdr->csum_start is larger than packet length, the len argument passed to rte_raw_cksum_mbuf() overflows and causes a segmentation fault.
Ignore checksum c
net/virtio: fix Rx checksum calculation
If hdr->csum_start is larger than packet length, the len argument passed to rte_raw_cksum_mbuf() overflows and causes a segmentation fault.
Ignore checksum computation in this case.
CVE-2024-11614
Fixes: ca7036b4af3a ("vhost: fix offload flags in Rx path")
Signed-off-by: Maxime Gouin <maxime.gouin@6wind.com> Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
show more ...
|
| 0cbf2752 | 20-Nov-2024 |
Stephen Hemminger <stephen@networkplumber.org> |
pcapng: avoid potential unaligned data
The buffer used to construct headers (which contain 32 bit values) was declared as uint8_t which can lead to unaligned access. Change to declare buffer as uint
pcapng: avoid potential unaligned data
The buffer used to construct headers (which contain 32 bit values) was declared as uint8_t which can lead to unaligned access. Change to declare buffer as uint32_t.
Fixes: dc2d6d20047e ("pcapng: avoid using alloca") Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
show more ...
|