diff options
author | Mike Pattrick <mkp@redhat.com> | 2023-01-30 17:04:16 -0500 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2023-02-03 22:18:16 +0100 |
commit | 4339e7b19f721d6f6813118effb47144f4a2aade (patch) | |
tree | 06c803f5cdf6d1baf5fe9bade8bbef6bc520c3f9 | |
parent | 531c17023cd21cdbdc876b544507fc4f723afd7b (diff) | |
download | openvswitch-4339e7b19f721d6f6813118effb47144f4a2aade.tar.gz |
dp-packet: Allocate on cacheline boundary with DPDK.
UB Sanitizer report:
lib/dp-packet.h:587:22: runtime error: member access within misaligned
address 0x000001ecde10 for type 'struct dp_packet', which requires 64
byte alignment
#0 in dp_packet_set_base lib/dp-packet.h:587
#1 in dp_packet_use__ lib/dp-packet.c:46
#2 in dp_packet_use lib/dp-packet.c:60
#3 in dp_packet_init lib/dp-packet.c:126
#4 in dp_packet_new lib/dp-packet.c:150
[...]
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r-- | lib/dp-packet.c | 4 | ||||
-rw-r--r-- | lib/dp-packet.h | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/dp-packet.c b/lib/dp-packet.c index 61e405460..ae8ab5800 100644 --- a/lib/dp-packet.c +++ b/lib/dp-packet.c @@ -146,7 +146,11 @@ dp_packet_uninit(struct dp_packet *b) struct dp_packet * dp_packet_new(size_t size) { +#ifdef DPDK_NETDEV + struct dp_packet *b = xmalloc_cacheline(sizeof *b); +#else struct dp_packet *b = xmalloc(sizeof *b); +#endif dp_packet_init(b, size); return b; } diff --git a/lib/dp-packet.h b/lib/dp-packet.h index ed1e5b3f6..b3e6a5d10 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h @@ -257,7 +257,11 @@ dp_packet_delete(struct dp_packet *b) } dp_packet_uninit(b); +#ifdef DPDK_NETDEV + free_cacheline(b); +#else free(b); +#endif } } |