diff options
author | Janne Peltonen <janne.peltonen@nokia.com> | 2021-09-13 13:50:41 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2021-09-23 12:08:02 +0300 |
commit | e108b53c8d3138151257bebfd918305cc7479b73 (patch) | |
tree | b83496be439e53f7524c05f437f22508f0962116 /platform/linux-generic/pktio/loop.c | |
parent | 6b93469a77232031113e63616d124dfe41627e29 (diff) |
linux-gen: pktio: loop: fix parsing of segmented packets
The receive processing in loop pktio processes packets that have the same
underlying packet buffers as they had when sent. This means that, unlike
other pktios that allocate packet buffers, loop may have packets with
inconvenient segment boundaries in the receive path. Such packets may
get parsed incorrectly since loop uses a parsing function that assumes
contiguous packet data for the parsed headers.
Fix the problem by doing parsing using odp_packet_parse() which can
handle segmented packets too.
Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'platform/linux-generic/pktio/loop.c')
-rw-r--r-- | platform/linux-generic/pktio/loop.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 437977771..889a270ea 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -172,9 +172,16 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, pkt_hdr = packet_hdr(new_pkt); } } else { - _odp_packet_parse_layer(pkt_hdr, - pktio_entry->s.config.parser.layer, - pktio_entry->s.in_chksums); + odp_packet_parse_param_t param; + + /* + * Use odp_packet_parse() which can handle segmented + * packets. + */ + param.proto = ODP_PROTO_ETH; + param.last_layer = pktio_entry->s.config.parser.layer; + param.chksums = pktio_entry->s.in_chksums; + odp_packet_parse(packet_handle(pkt_hdr), 0, ¶m); } packet_set_ts(pkt_hdr, ts); |