gatekeeper
gatekeeper copied to clipboard
Adopting rte_pktmbuf_read()
We have written Gatekeeper without using rte_pktmbuf_read()
, so the code assumes that the headers that need to be inspected are in the first segment of the struct rte_mbuf
and the code explicitly checks that there are still bytes to be read in the packet whenever a new header must be inspected. Our code can drop that assumption and simplify the buffer size verification adopting rte_pktmbuf_read()
.
A related concern to reading bytes from packets is the usage of fields data_len
and pkt_len
of struct rte_mbuf
.
pkt_len
is the length of all segments of a struct rte_mbuf
and data_len
is the data length of the individual buffer itself.
We mostly use data_len
but there is at least one usage of pkt_len
that should be looked at in sol/main.c.
While we review the fields data_len
and pkt_len
of struct rte_mbuf
, we should also adopt the macros rte_pktmbuf_pkt_len()
and rte_pktmbuf_data_len()
to use instead of the fields.