From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 62415A2EFC for ; Tue, 15 Oct 2019 10:14:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3C8851D505; Tue, 15 Oct 2019 10:14:41 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 4332B1D453; Tue, 15 Oct 2019 10:14:40 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us5.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 4E94D4C0058; Tue, 15 Oct 2019 08:14:39 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 15 Oct 2019 01:14:36 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 15 Oct 2019 01:14:36 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x9F8EY98015639; Tue, 15 Oct 2019 09:14:34 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id CE2DF1613D1; Tue, 15 Oct 2019 09:14:34 +0100 (BST) From: Andrew Rybchenko To: Maxime Coquelin , Tiwei Bie , Zhihong Wang CC: , Date: Tue, 15 Oct 2019 09:11:27 +0100 Message-ID: <1571127088-26656-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24978.005 X-TM-AS-Result: No-4.551900-4.000000-10 X-TMASE-MatchedRID: PZMqI2AhqDTaLQaWqxuYKbsHVDDM5xAPrRJ8yUEQMO+5ZjHyzYrpGuml /E2CK49bgxsnsk8u9Mfm/NFG85WHUpGlJ5QKyUiCqJSK+HSPY+9LXPA26IG0hN9RlPzeVuQQvnw PkToqUsLfolU3vG/XqFZ6+kJr7AqTkfRhdidsajMURSScn+QSXt0H8LFZNFG7CKFCmhdu5cUXz5 4hZCH8xCnxELAQ6QE9vUNzLjGxvkG1wyUtv38nK2wvOxn2YR6iRoIKSSmouUfmqR2U50ml7RnpX pfYoNQkR3kWO1m95e0PXLxHfxLeXVRHOSKs7RDUXmH0pBaurgG+4xOvsJAknp6oP1a0mRIj X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.551900-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24978.005 X-MDID: 1571127279-W481nEMhaCX1 Subject: [dpdk-dev] [PATCH] net/virtio: fix broken transmit functionality X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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: c100fc6849fb ("net/virtio: fix mbuf data and pkt length mismatch") Cc: stable@dpdk.org Signed-off-by: Andrew Rybchenko --- drivers/net/virtio/virtio_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 929aa4cbd..434e0fedd 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -649,7 +649,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; @@ -696,7 +697,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; @@ -779,6 +780,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; } @@ -882,6 +884,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; } -- 2.20.1