From: Rushil Gupta <rushilg@google.com>
To: junfeng.guo@intel.com, jeroendb@google.com, joshwash@google.com,
ferruh.yigit@amd.com
Cc: dev@dpdk.org, stable@dpdk.org, Rushil Gupta <rushilg@google.com>
Subject: [PATCH] net/gve: fix dqo bug for chained descriptors
Date: Thu, 15 Feb 2024 09:52:50 +0000 [thread overview]
Message-ID: <20240215095250.233572-1-rushilg@google.com> (raw)
net/gve: fix completion path for chained segments
Dqo Tx path had a bug where driver was overwriting mbufs in sw-ring.
We fixed this bug by cleaning slots for all segments.
Fixes: 4022f9 ("net/gve: support basic Tx data path for DQO")
Cc: stable@dpdk.org
Signed-off-by: Rushil Gupta <rushilg@google.com>
Reviewed-by: Joshua Washington <joshwash@google.com>
---
drivers/net/gve/gve_tx_dqo.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/net/gve/gve_tx_dqo.c b/drivers/net/gve/gve_tx_dqo.c
index 16101de..d060664 100644
--- a/drivers/net/gve/gve_tx_dqo.c
+++ b/drivers/net/gve/gve_tx_dqo.c
@@ -13,7 +13,7 @@ gve_tx_clean_dqo(struct gve_tx_queue *txq)
struct gve_tx_compl_desc *compl_desc;
struct gve_tx_queue *aim_txq;
uint16_t nb_desc_clean;
- struct rte_mbuf *txe;
+ struct rte_mbuf *txe, *txe_next;
uint16_t compl_tag;
uint16_t next;
@@ -43,10 +43,15 @@ gve_tx_clean_dqo(struct gve_tx_queue *txq)
PMD_DRV_LOG(DEBUG, "GVE_COMPL_TYPE_DQO_REINJECTION !!!");
/* FALLTHROUGH */
case GVE_COMPL_TYPE_DQO_PKT:
+ /* free all segments. */
txe = aim_txq->sw_ring[compl_tag];
- if (txe != NULL) {
+ while (txe != NULL) {
+ txe_next = txe->next;
rte_pktmbuf_free_seg(txe);
- txe = NULL;
+ if (aim_txq->sw_ring[compl_tag] == txe)
+ aim_txq->sw_ring[compl_tag] = NULL;
+ txe = txe_next;
+ compl_tag = (compl_tag + 1) & (aim_txq->sw_size - 1);
}
break;
case GVE_COMPL_TYPE_DQO_MISS:
@@ -83,6 +88,7 @@ gve_tx_burst_dqo(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
uint16_t tx_id;
uint16_t sw_id;
uint64_t bytes;
+ uint16_t first_sw_id;
sw_ring = txq->sw_ring;
txr = txq->tx_ring;
@@ -107,23 +113,26 @@ gve_tx_burst_dqo(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
ol_flags = tx_pkt->ol_flags;
nb_used = tx_pkt->nb_segs;
-
+ first_sw_id = sw_id;
do {
- txd = &txr[tx_id];
+ if (sw_ring[sw_id] != NULL) {
+ PMD_DRV_LOG(ERR, "Overwriting an entry in sw_ring");
+ }
+ txd = &txr[tx_id];
sw_ring[sw_id] = tx_pkt;
/* fill Tx descriptor */
txd->pkt.buf_addr = rte_cpu_to_le_64(rte_mbuf_data_iova(tx_pkt));
txd->pkt.dtype = GVE_TX_PKT_DESC_DTYPE_DQO;
- txd->pkt.compl_tag = rte_cpu_to_le_16(sw_id);
+ txd->pkt.compl_tag = rte_cpu_to_le_16(first_sw_id);
txd->pkt.buf_size = RTE_MIN(tx_pkt->data_len, GVE_TX_MAX_BUF_SIZE_DQO);
/* size of desc_ring and sw_ring could be different */
tx_id = (tx_id + 1) & mask;
sw_id = (sw_id + 1) & sw_mask;
- bytes += tx_pkt->pkt_len;
+ bytes += tx_pkt->data_len;
tx_pkt = tx_pkt->next;
} while (tx_pkt);
--
2.44.0.rc0.258.g7320e95886-goog
next reply other threads:[~2024-02-15 9:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 9:52 Rushil Gupta [this message]
2024-02-15 10:02 Rushil Gupta
2024-02-15 14:42 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240215095250.233572-1-rushilg@google.com \
--to=rushilg@google.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=jeroendb@google.com \
--cc=joshwash@google.com \
--cc=junfeng.guo@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).