[dpdk-dev] [PATCH v2 12/12] virtio: add Tso support

Yuanhan Liu yuanhan.liu at linux.intel.com
Thu Oct 13 17:04:04 CEST 2016


On Thu, Oct 13, 2016 at 04:52:25PM +0200, Olivier MATZ wrote:
> >In the "else" clause, the ip header is still in the mbuf, right?
> >Why do you have to access it the way like:
> >
> >	ip_version = *rte_pktmbuf_mtod_offset(m, uint8_t *,
> >		m->l2_len) >> 4;
> >
> >Why can't you just use
> >
> >	iph = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len);
> >	iph->version_ihl ....;
> 
> AFAIK, there is no requirement that each network header has to be contiguous
> in a mbuf segment.
> 
> Of course, a split in the middle of a network header probably never
> happens... but we never knows, as it is not forbidden. I think the code
> should be robust enough to avoid accesses to wrong addresses.

One more question is do you have any case to trigger the "else" clause?

	--yliu


More information about the dev mailing list