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

m...@smartsharesystems.com
www.smartsharesystems.com


Reply via email to