summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Rybchenko <arybchenko@solarflare.com>2019-10-15 09:11:27 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-20 15:43:27 +0100
commitd168fce24d6a42aab4876ebd146b07420cebd1f4 (patch)
treeb1bcb4c57f83b94bfb4997e319328c3dce68cb11
parent0e294c0a219f40decbc702243a16def80d4c05a7 (diff)
downloaddpdk-next-net-intel-d168fce24d6a42aab4876ebd146b07420cebd1f4.zip
dpdk-next-net-intel-d168fce24d6a42aab4876ebd146b07420cebd1f4.tar.gz
dpdk-next-net-intel-d168fce24d6a42aab4876ebd146b07420cebd1f4.tar.xz
net/virtio: fix descriptor addressed in Tx
Previous fix removes usage of rte_pktmbuf_prepend() to get pointer to virtio net header which changes mbuf data_off and data_len. Size of virtio net header is added to segment length when Tx descriptor is composed, but segment address (calculated using data_off) is not adjusted to take size of virtio net header into account. Fixes: 1ae55ad38e5e ("net/virtio: fix mbuf data and packet length mismatch") Cc: stable@dpdk.org Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
-rw-r--r--drivers/net/virtio/virtio_rxtx.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 701c1cf..b5fc4ec 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -657,7 +657,8 @@ virtqueue_enqueue_xmit_inorder(struct virtnet_tx *txvq,
else
virtqueue_xmit_offload(hdr, cookies[i], true);
- start_dp[idx].addr = VIRTIO_MBUF_DATA_DMA_ADDR(cookies[i], vq);
+ start_dp[idx].addr =
+ VIRTIO_MBUF_DATA_DMA_ADDR(cookies[i], vq) - head_size;
start_dp[idx].len = cookies[i]->data_len + head_size;
start_dp[idx].flags = 0;
@@ -704,7 +705,7 @@ virtqueue_enqueue_xmit_packed_fast(struct virtnet_tx *txvq,
else
virtqueue_xmit_offload(hdr, cookie, true);
- dp->addr = VIRTIO_MBUF_DATA_DMA_ADDR(cookie, vq);
+ dp->addr = VIRTIO_MBUF_DATA_DMA_ADDR(cookie, vq) - head_size;
dp->len = cookie->data_len + head_size;
dp->id = id;
@@ -786,6 +787,7 @@ virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
start_dp[idx].addr = VIRTIO_MBUF_DATA_DMA_ADDR(cookie, vq);
start_dp[idx].len = cookie->data_len;
if (prepend_header) {
+ start_dp[idx].addr -= head_size;
start_dp[idx].len += head_size;
prepend_header = false;
}
@@ -889,6 +891,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
start_dp[idx].addr = VIRTIO_MBUF_DATA_DMA_ADDR(cookie, vq);
start_dp[idx].len = cookie->data_len;
if (prepend_header) {
+ start_dp[idx].addr -= head_size;
start_dp[idx].len += head_size;
prepend_header = false;
}