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 6A853A04DD for ; Wed, 28 Oct 2020 11:51:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 62FA4C9F6; Wed, 28 Oct 2020 11:51:24 +0100 (CET) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 203B02C2A for ; Wed, 28 Oct 2020 11:51:22 +0100 (CET) Received: by mail-wr1-f68.google.com with SMTP id y12so5147640wrp.6 for ; Wed, 28 Oct 2020 03:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v7A2bsWI0VEMIkiWoKIVWBxzBD/HgiKRmiVSVesoT4M=; b=nQATbt6cR8Ecj0w6E2pjm0zOnjSLaYLtN3f3dXPPTcTJBEclc+6pQX9Ttv+K/lqvoE thHwCU2hpU2fOqhXMNlaRMOnXLVwW9kDaELzltclPBLx8Zwjk5ILL1zoo08iPRV9Q4Vi jNJl513ciJoOF0CfnuPTdZ5mcWdIMNYXmFTEoBrkThSbcXPxkk+oNWQIJhMYyIuiYgQA S1F6kmOIMosA/lprzcYxE1lBAG/KNdEO/droIjX1c5EOL2UXwO2VJrlcYOiYdsfiS2s3 GjmpNFWUqQQ4F7MrKkno1KYdCFLkrrnBB52gfmVb4ix1zfPrpk3ZdADG7jCHf1RiA7+m yjSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v7A2bsWI0VEMIkiWoKIVWBxzBD/HgiKRmiVSVesoT4M=; b=JtQ8bzbPXTLUTrUqZq1zMYIfhdyynPuByZrGNKGG8SOuyFYBZgLNWXA5jG0hMDn+5n daHc7PiUZlpkGf2OYIZllfkbyxAI3W1TrGMET/fhImwLO0ryWyU5E2nb4YqPp+k5r1bf nZfYD3STLxp5V6Xz6Lk9CDgiWm8du+K3WJsXSKpaGDEICs+HDQABJOJffD7Dw1cbf+H6 aQC3ASxGiVkJnbUnT+3gUOo+CUeLdi0xUF8fYaKVfYo3pIOYY+FvSI0TJeUOaZ+Ytm+7 xya5vL0/jCkkb0+kEohBuNN9J02yGM1Mwo/JMzMIv6phVZmuqaNMIVE11tzuK72mvixQ gfsQ== X-Gm-Message-State: AOAM533lxufEhgMEUvqLQeN6VY+rj36cQGq0uRL0YfsdYcDhhVKBbRVm OQ6IYb55pksoxFH9kyPk4p7lRS3sOVDYojRD X-Google-Smtp-Source: ABdhPJzQ2gidSRi7VtG6DeATuiZDmznqz9pG2VrbAKCt2Zu/rIAOBFbUz8eCyb3w3jaST1AyRNKbYA== X-Received: by 2002:adf:f482:: with SMTP id l2mr8084471wro.26.1603882280876; Wed, 28 Oct 2020 03:51:20 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id l8sm6501794wrn.28.2020.10.28.03.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:51:20 -0700 (PDT) From: luca.boccassi@gmail.com To: Marvin Liu Cc: Maxime Coquelin , dpdk stable Date: Wed, 28 Oct 2020 10:44:17 +0000 Message-Id: <20201028104606.3504127-98-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/virtio: fix packed ring indirect descricptors setup' has been queued to stable release 19.11.6 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 stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/20. 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. Thanks. Luca Boccassi --- >From c39ba61a44ed25a899b5a1d68029b2d2bb830345 Mon Sep 17 00:00:00 2001 From: Marvin Liu Date: Mon, 28 Sep 2020 16:20:51 +0800 Subject: [PATCH] net/virtio: fix packed ring indirect descricptors setup [ upstream commit 381f39ebb78a35d8dcc2d4500419644c7de5400f ] Add packed indirect descriptors format into virtio Tx region. When initializing vring, packed indirect descriptors will be initialized if ring type is packed. Fixes: bc80357cd677 ("net/virtio: drop unused field in Tx region structure") Signed-off-by: Marvin Liu Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_ethdev.c | 13 +++++++++++-- drivers/net/virtio/virtqueue.h | 17 +++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 35203940a7..8a107ebf9e 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -610,10 +610,9 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) txr = hdr_mz->addr; memset(txr, 0, vq_size * sizeof(*txr)); for (i = 0; i < vq_size; i++) { - struct vring_desc *start_dp = txr[i].tx_indir; - /* first indirect descriptor is always the tx header */ if (!vtpci_packed_queue(hw)) { + struct vring_desc *start_dp = txr[i].tx_indir; vring_desc_init_split(start_dp, RTE_DIM(txr[i].tx_indir)); start_dp->addr = txvq->virtio_net_hdr_mem @@ -622,6 +621,16 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) tx_hdr); start_dp->len = hw->vtnet_hdr_size; start_dp->flags = VRING_DESC_F_NEXT; + } else { + struct vring_packed_desc *start_dp = + txr[i].tx_packed_indir; + vring_desc_init_indirect_packed(start_dp, + RTE_DIM(txr[i].tx_packed_indir)); + start_dp->addr = txvq->virtio_net_hdr_mem + + i * sizeof(*txr) + + offsetof(struct virtio_tx_region, + tx_hdr); + start_dp->len = hw->vtnet_hdr_size; } } } diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index 58ad7309ae..e901249601 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -324,8 +324,11 @@ struct virtio_net_hdr_mrg_rxbuf { #define VIRTIO_MAX_TX_INDIRECT 8 struct virtio_tx_region { struct virtio_net_hdr_mrg_rxbuf tx_hdr; - struct vring_desc tx_indir[VIRTIO_MAX_TX_INDIRECT] - __attribute__((__aligned__(16))); + union { + struct vring_desc tx_indir[VIRTIO_MAX_TX_INDIRECT]; + struct vring_packed_desc + tx_packed_indir[VIRTIO_MAX_TX_INDIRECT]; + } __attribute__((__aligned__(16))); }; static inline int @@ -363,6 +366,16 @@ vring_desc_init_split(struct vring_desc *dp, uint16_t n) dp[i].next = VQ_RING_DESC_CHAIN_END; } +static inline void +vring_desc_init_indirect_packed(struct vring_packed_desc *dp, int n) +{ + int i; + for (i = 0; i < n; i++) { + dp[i].id = (uint16_t)i; + dp[i].flags = VRING_DESC_F_WRITE; + } +} + /** * Tell the backend not to interrupt us. Implementation for packed virtqueues. */ -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:14.827590704 +0000 +++ 0098-net-virtio-fix-packed-ring-indirect-descricptors-set.patch 2020-10-28 10:35:11.652832202 +0000 @@ -1,14 +1,15 @@ -From 381f39ebb78a35d8dcc2d4500419644c7de5400f Mon Sep 17 00:00:00 2001 +From c39ba61a44ed25a899b5a1d68029b2d2bb830345 Mon Sep 17 00:00:00 2001 From: Marvin Liu Date: Mon, 28 Sep 2020 16:20:51 +0800 Subject: [PATCH] net/virtio: fix packed ring indirect descricptors setup +[ upstream commit 381f39ebb78a35d8dcc2d4500419644c7de5400f ] + Add packed indirect descriptors format into virtio Tx region. When initializing vring, packed indirect descriptors will be initialized if ring type is packed. Fixes: bc80357cd677 ("net/virtio: drop unused field in Tx region structure") -Cc: stable@dpdk.org Signed-off-by: Marvin Liu Reviewed-by: Maxime Coquelin @@ -18,10 +19,10 @@ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c -index 1eb3240d89..0236c756dc 100644 +index 35203940a7..8a107ebf9e 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c -@@ -609,10 +609,9 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) +@@ -610,10 +610,9 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) txr = hdr_mz->addr; memset(txr, 0, vq_size * sizeof(*txr)); for (i = 0; i < vq_size; i++) { @@ -33,7 +34,7 @@ vring_desc_init_split(start_dp, RTE_DIM(txr[i].tx_indir)); start_dp->addr = txvq->virtio_net_hdr_mem -@@ -621,6 +620,16 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) +@@ -622,6 +621,16 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) tx_hdr); start_dp->len = hw->vtnet_hdr_size; start_dp->flags = VRING_DESC_F_NEXT; @@ -51,24 +52,24 @@ } } diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h -index 738b1a519c..a41363219d 100644 +index 58ad7309ae..e901249601 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h -@@ -329,8 +329,11 @@ struct virtio_net_hdr_mrg_rxbuf { +@@ -324,8 +324,11 @@ struct virtio_net_hdr_mrg_rxbuf { #define VIRTIO_MAX_TX_INDIRECT 8 struct virtio_tx_region { struct virtio_net_hdr_mrg_rxbuf tx_hdr; - struct vring_desc tx_indir[VIRTIO_MAX_TX_INDIRECT] -- __rte_aligned(16); +- __attribute__((__aligned__(16))); + union { + struct vring_desc tx_indir[VIRTIO_MAX_TX_INDIRECT]; + struct vring_packed_desc + tx_packed_indir[VIRTIO_MAX_TX_INDIRECT]; -+ } __rte_aligned(16); ++ } __attribute__((__aligned__(16))); }; static inline int -@@ -368,6 +371,16 @@ vring_desc_init_split(struct vring_desc *dp, uint16_t n) +@@ -363,6 +366,16 @@ vring_desc_init_split(struct vring_desc *dp, uint16_t n) dp[i].next = VQ_RING_DESC_CHAIN_END; }