From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 853BEA046B for ; Mon, 24 Jun 2019 17:28:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7C1071BEF4; Mon, 24 Jun 2019 17:28:13 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 277E41BEF4 for ; Mon, 24 Jun 2019 17:28:12 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3DAD230872D1; Mon, 24 Jun 2019 15:28:06 +0000 (UTC) Received: from rh.redhat.com (ovpn-116-250.ams2.redhat.com [10.36.116.250]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9864719C6A; Mon, 24 Jun 2019 15:28:03 +0000 (UTC) From: Kevin Traynor To: Dilshod Urazov Cc: Andrew Rybchenko , Tiwei Bie , Maxime Coquelin , dpdk stable Date: Mon, 24 Jun 2019 16:25:19 +0100 Message-Id: <20190624152525.19349-55-ktraynor@redhat.com> In-Reply-To: <20190624152525.19349-1-ktraynor@redhat.com> References: <20190624152525.19349-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 24 Jun 2019 15:28:11 +0000 (UTC) Subject: [dpdk-stable] patch 'net/virtio: add Tx preparation' has been queued to LTS release 18.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/3a47da2edff7cf3234454e45d2876354035e7d7b Thanks. Kevin Traynor --- >From 3a47da2edff7cf3234454e45d2876354035e7d7b Mon Sep 17 00:00:00 2001 From: Dilshod Urazov Date: Mon, 17 Jun 2019 12:31:37 +0100 Subject: [PATCH] net/virtio: add Tx preparation [ upstream commit 00a5ea02e12fc1409901c0149ce87c28a286ea60 ] Virtio requires pseudo-header checksum in TCP/UDP checksum to do offload, but it was lost when Tx prepare is introduced. Also rte_validate_tx_offload() should be used to validate Tx offloads. Also it is incorrect to do virtio_tso_fix_cksum() after prepend to mbuf without taking prepended size into account, since layer 2/3/4 lengths provide incorrect offsets after prepend. Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation") Signed-off-by: Dilshod Urazov Signed-off-by: Andrew Rybchenko Reviewed-by: Tiwei Bie --- drivers/net/virtio/virtio_ethdev.c | 1 + drivers/net/virtio/virtio_ethdev.h | 3 +++ drivers/net/virtio/virtio_rxtx.c | 32 +++++++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 74076b9a9..9098cb6f4 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1342,4 +1342,5 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) struct virtio_hw *hw = eth_dev->data->dev_private; + eth_dev->tx_pkt_prepare = virtio_xmit_pkts_prepare; if (hw->use_simple_rx) { PMD_INIT_LOG(INFO, "virtio: using simple Rx path on port %u", diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h index 39a9f7b7d..8eb866073 100644 --- a/drivers/net/virtio/virtio_ethdev.h +++ b/drivers/net/virtio/virtio_ethdev.h @@ -83,4 +83,7 @@ uint16_t virtio_recv_mergeable_pkts_inorder(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); +uint16_t virtio_xmit_pkts_prepare(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); + uint16_t virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index f8311b6e2..4d4487012 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -376,5 +376,4 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, /* TCP Segmentation Offload */ if (cookie->ol_flags & PKT_TX_TCP_SEG) { - virtio_tso_fix_cksum(cookie); hdr->gso_type = (cookie->ol_flags & PKT_TX_IPV6) ? VIRTIO_NET_HDR_GSO_TCPV6 : @@ -1333,4 +1332,35 @@ virtio_recv_mergeable_pkts(void *rx_queue, } +uint16_t +virtio_xmit_pkts_prepare(void *tx_queue __rte_unused, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts) +{ + uint16_t nb_tx; + int error; + + for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) { + struct rte_mbuf *m = tx_pkts[nb_tx]; + +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + error = rte_validate_tx_offload(m); + if (unlikely(error)) { + rte_errno = -error; + break; + } +#endif + + error = rte_net_intel_cksum_prepare(m); + if (unlikely(error)) { + rte_errno = -error; + break; + } + + if (m->ol_flags & PKT_TX_TCP_SEG) + virtio_tso_fix_cksum(m); + } + + return nb_tx; +} + uint16_t virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-06-24 16:18:57.906331697 +0100 +++ 0055-net-virtio-add-Tx-preparation.patch 2019-06-24 16:18:55.129428910 +0100 @@ -1 +1 @@ -From 00a5ea02e12fc1409901c0149ce87c28a286ea60 Mon Sep 17 00:00:00 2001 +From 3a47da2edff7cf3234454e45d2876354035e7d7b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 00a5ea02e12fc1409901c0149ce87c28a286ea60 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -27 +28 @@ -index afb2ca209..04aecb759 100644 +index 74076b9a9..9098cb6f4 100644 @@ -30 +31 @@ -@@ -1486,4 +1486,5 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) +@@ -1342,4 +1342,5 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) @@ -34,2 +35,2 @@ - if (vtpci_packed_queue(hw)) { - PMD_INIT_LOG(INFO, + if (hw->use_simple_rx) { + PMD_INIT_LOG(INFO, "virtio: using simple Rx path on port %u", @@ -37 +38 @@ -index 45e96f32b..20d331795 100644 +index 39a9f7b7d..8eb866073 100644 @@ -40 +41 @@ -@@ -90,4 +90,7 @@ uint16_t virtio_recv_pkts_inorder(void *rx_queue, +@@ -83,4 +83,7 @@ uint16_t virtio_recv_mergeable_pkts_inorder(void *rx_queue, @@ -49 +50 @@ -index 1f1178467..07f8f47de 100644 +index f8311b6e2..4d4487012 100644 @@ -52 +53 @@ -@@ -560,5 +560,4 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, +@@ -376,5 +376,4 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, @@ -58 +59 @@ -@@ -1950,4 +1949,35 @@ virtio_recv_mergeable_pkts_packed(void *rx_queue, +@@ -1333,4 +1332,35 @@ virtio_recv_mergeable_pkts(void *rx_queue, @@ -93 +94 @@ - virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts, + virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)