virtio: retrieve header size from device setting
authorYuanhan Liu <yuanhan.liu@linux.intel.com>
Tue, 2 Feb 2016 13:48:17 +0000 (21:48 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 3 Feb 2016 15:07:49 +0000 (16:07 +0100)
commit1905e101dc4aabff6e0cd4dc58ed095d3f0a5c26
tree0d731bcd3c8ff03c9ef8c389cb41cce18aef9f4c
parent3891f233f76270e00e45addf221bc280c585a1d9
virtio: retrieve header size from device setting

The mergeable virtio net hdr format has been the standard and the
only virtio net hdr format since virtio 1.0. Therefore, we can
not hardcode hdr_size to "sizeof(struct virtio_net_hdr)" any more
at virtio_recv_pkts(), otherwise, there would be a mismatch of
hdr size from rte_vhost_enqueue_burst() and virtio_recv_pkts(),
leading a packet corruption.

Instead, we should retrieve it from hw->vtnet_hdr_size; we will
do proper settings at eth_virtio_dev_init() in later patches.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Tested-by: Qian Xu <qian.q.xu@intel.com>
Reviewed-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Tested-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Huawei Xie <huawei.xie@intel.com>
drivers/net/virtio/virtio_rxtx.c
drivers/net/virtio/virtio_rxtx_simple.c