diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2022-03-14 20:33:25 +0200 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2022-03-31 16:35:49 +0300 |
commit | 491d1d2eea16c418af5e96f1fa9eaac96e6c9945 (patch) | |
tree | 3298df6585de524dce5008920dd76f8c44c6be58 /platform/linux-generic/pktio | |
parent | cdc5358b0067dab6da858d5341c40152969294c8 (diff) |
linux-gen: pktio: loop: fix copying segmented data to memory
Copy packet data to memory for parsing if segment size is smaller than
parser requirement (PARSE_BYTES) and the packet is longer than a
segment. The latter check was for whether the packet is longer than
PARSE_BYTES, but that leaves the possibility of a multi-segment packet
equal to or shorter than PARSE_BYTES.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'platform/linux-generic/pktio')
-rw-r--r-- | platform/linux-generic/pktio/loop.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 71b99c3c6..986be743c 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -27,6 +27,7 @@ #include <odp_ipsec_internal.h> #include <odp_packet_internal.h> #include <odp_packet_io_internal.h> +#include <odp_macros_internal.h> #include <odp_queue_if.h> #include <protocols/eth.h> @@ -195,10 +196,9 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, /* Make sure there is enough data for the packet * parser in the case of a segmented packet. */ if (odp_unlikely(seg_len < PARSE_BYTES && - pkt_len > PARSE_BYTES)) { - odp_packet_copy_to_mem(pkt, 0, PARSE_BYTES, - buf); - seg_len = PARSE_BYTES; + pkt_len > seg_len)) { + seg_len = MIN(pkt_len, PARSE_BYTES); + odp_packet_copy_to_mem(pkt, 0, seg_len, buf); pkt_addr = buf; } else { pkt_addr = odp_packet_data(pkt); |