On Wed, 13 Jan 2016 02:20:01 +0000 Yong Wang <yongwang at vmware.com> wrote:
> >Good idea to use a local region which optmizes the copy in the host, > >but this implementation needs to be more general. > > > >As written it is broken for multi-segment packets. A multi-segment > >packet will have a pktlen >= datalen as in: > > m -> mb_segs=3, pktlen=1200, datalen=200 > > -> datalen=900 > > -> datalen=100 > > > >There are two ways to fix this. You could test for nb_segs == 1 > >or better yet. Optimize each segment it might be that the first > >segment (or tail segment) would fit in the available data area. > > Currently the vmxnet3 backend has a limitation of 128B data area so > it should work even for the multi-segmented pkt shown above. But > I agree it does not work for all multi-segmented packets. The > following packet will be such an example. > > m -> nb_segs=3, pktlen=128, datalen=64 > -> datalen=32 > -> datalen=32 > > > It?s unclear if/how we might get into such a multi-segmented pkt > but I agree we should handle this case. Patch updated taking the > simple approach (checking for nb_segs == 1). I?ll leave the > optimization as a future patch. Such a packet can happen when adding a tunnel header such as VXLAN and the underlying packet is shared (refcnt > 1) or does not have enough headroom for the tunnel header.