DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC] function to parse packet headers
@ 2019-01-09  3:43 longtb5
  2019-01-09 15:38 ` Morten Brørup
  0 siblings, 1 reply; 16+ messages in thread
From: longtb5 @ 2019-01-09  3:43 UTC (permalink / raw)
  To: mb, roszenrami; +Cc: dev

Hi Morten,

What is the difference compare to rte_net_get_ptype(), which also parses
packet types and reports on header length.

In my application I have also done something similar about malformed
packets. IMO it's very useful to have return value indicate different types
of malformed packets, not just -1, e.g. invalid IP options, IP loopback,
etc. 

Regards,
BL

^ permalink raw reply	[flat|nested] 16+ messages in thread
* [dpdk-dev] [RFC] function to parse packet headers
@ 2019-01-08 16:48 Morten Brørup
  2019-01-08 20:09 ` Rami Rosen
  0 siblings, 1 reply; 16+ messages in thread
From: Morten Brørup @ 2019-01-08 16:48 UTC (permalink / raw)
  To: dev

I'm volunteering to provide a function to set the mbuf's l2_len/l3_len/... (tx_offload) fields by parsing the packet headers, possibly assisted by the packet_type field, if set.

I'm seeking initial feedback before submitting my first version of the code.

The single packet parser function header is straightforward, and returns 0 if OK and -1 if the packet is malformed:
int rte_hdr_parse(struct rte_mbuf * const m);


The bulk parser function needs a well defined and simple way to mark malformed packets, e.g. if the IPv4 header length field value is less than 5. There are multiple ways of doing this.

The bulk function could take the mbuf array as input and simply mark malformed packets by setting MBUF->tx_offload = 0:
void rte_hdr_parse_bulk(struct rte_mbuf **pkts, uint_fast16_t nb_pkts);

Or the bulk function could take both input and output arrays, and return the number of non-malformed packets in the output array like this:
uint_fast16_t rte_hdr_parse_bulk(struct rte_mbuf **pkts_in, struct rte_mbuf **pkts_out, uint_fast16_t nb_pkts_in);

The first is obviously faster. Which do you prefer?


Suggested file location and name:
root/lib/librte_net/rte_hdr_parse.[ch]


PS: Inspired by the discussion about GRO (https://mails.dpdk.org/archives/dev/2019-January/122572.html), where Konstantin called for volunteers. I already have some of it lying around, so I will contribute if useful. But it needs some cleaning up first.


Med venlig hilsen / kind regards

Morten Brørup
CTO


SmartShare Systems A/S
Tonsbakken 16-18
DK-2740 Skovlunde
Denmark

Office      +45 70 20 00 93
Direct      +45 89 93 50 22
Mobile     +45 25 40 82 12

mb@smartsharesystems.com
www.smartsharesystems.com



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-01-11 12:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09  3:43 [dpdk-dev] [RFC] function to parse packet headers longtb5
2019-01-09 15:38 ` Morten Brørup
2019-01-10  3:25   ` longtb5
2019-01-10  8:21     ` Morten Brørup
  -- strict thread matches above, loose matches on Subject: below --
2019-01-08 16:48 Morten Brørup
2019-01-08 20:09 ` Rami Rosen
2019-01-09 15:53   ` Morten Brørup
2019-01-09 23:57     ` Thomas Monjalon
2019-01-10  1:03       ` Rami Rosen
2019-01-11  0:11         ` Stephen Hemminger
2019-01-11  7:56           ` Andrew Rybchenko
2019-01-11  8:16             ` Morten Brørup
2019-01-11  8:28               ` Andrew Rybchenko
2019-01-11  8:35             ` Olivier Matz
2019-01-11  9:49               ` Ananyev, Konstantin
2019-01-11 12:04                 ` Morten Brørup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).