From: Junfeng Guo <junfeng.guo@intel.com>
To: qi.z.zhang@intel.com, jingjing.wu@intel.com,
ferruh.yigit@amd.com, beilei.xing@intel.com
Cc: dev@dpdk.org, xiaoyun.li@intel.com, helin.zhang@intel.com,
Junfeng Guo <junfeng.guo@intel.com>,
Rushil Gupta <rushilg@google.com>,
Jordan Kimbrough <jrkim@google.com>,
Jeroen de Borst <jeroendb@google.com>
Subject: [RFC v2 5/9] net/gve: support basic Tx data path for DQO
Date: Mon, 30 Jan 2023 14:26:38 +0800 [thread overview]
Message-ID: <20230130062642.3337239-6-junfeng.guo@intel.com> (raw)
In-Reply-To: <20230130062642.3337239-1-junfeng.guo@intel.com>
Add basic Tx data path support for DQO.
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Signed-off-by: Rushil Gupta <rushilg@google.com>
Signed-off-by: Jordan Kimbrough <jrkim@google.com>
Signed-off-by: Jeroen de Borst <jeroendb@google.com>
---
drivers/net/gve/gve_ethdev.c | 1 +
drivers/net/gve/gve_ethdev.h | 4 +
drivers/net/gve/gve_tx_dqo.c | 141 +++++++++++++++++++++++++++++++++++
3 files changed, 146 insertions(+)
diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index 7c4be3a1cb..512a038968 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -703,6 +703,7 @@ gve_dev_init(struct rte_eth_dev *eth_dev)
} else {
/* override Tx/Rx setup/release eth_dev ops */
gve_eth_dev_ops_override(&gve_local_eth_dev_ops);
+ eth_dev->tx_pkt_burst = gve_tx_burst_dqo;
}
eth_dev->dev_ops = &gve_local_eth_dev_ops;
diff --git a/drivers/net/gve/gve_ethdev.h b/drivers/net/gve/gve_ethdev.h
index 93314f2db3..ba657dd6c1 100644
--- a/drivers/net/gve/gve_ethdev.h
+++ b/drivers/net/gve/gve_ethdev.h
@@ -125,6 +125,7 @@ struct gve_tx_queue {
uint8_t cur_gen_bit;
uint32_t last_desc_cleaned;
void **txqs;
+ uint16_t re_cnt;
/* Only valid for DQO_RDA queue format */
struct gve_tx_queue *complq;
@@ -365,4 +366,7 @@ gve_stop_tx_queues_dqo(struct rte_eth_dev *dev);
void
gve_stop_rx_queues_dqo(struct rte_eth_dev *dev);
+uint16_t
+gve_tx_burst_dqo(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
+
#endif /* _GVE_ETHDEV_H_ */
diff --git a/drivers/net/gve/gve_tx_dqo.c b/drivers/net/gve/gve_tx_dqo.c
index e2e4153f27..3583c82246 100644
--- a/drivers/net/gve/gve_tx_dqo.c
+++ b/drivers/net/gve/gve_tx_dqo.c
@@ -5,6 +5,147 @@
#include "gve_ethdev.h"
#include "base/gve_adminq.h"
+static inline void
+gve_tx_clean_dqo(struct gve_tx_queue *txq)
+{
+ struct gve_tx_compl_desc *compl_ring;
+ struct gve_tx_compl_desc *compl_desc;
+ struct gve_tx_queue *aim_txq;
+ uint16_t nb_desc_clean;
+ struct rte_mbuf *txe;
+ uint16_t compl_tag;
+ uint16_t next;
+
+ next = txq->complq_tail;
+ compl_ring = txq->compl_ring;
+ compl_desc = &compl_ring[next];
+
+ if (compl_desc->generation != txq->cur_gen_bit)
+ return;
+
+ compl_tag = rte_le_to_cpu_16(compl_desc->completion_tag);
+
+ aim_txq = txq->txqs[compl_desc->id];
+
+ switch (compl_desc->type) {
+ case GVE_COMPL_TYPE_DQO_DESC:
+ /* need to clean Descs from last_cleaned to compl_tag */
+ if (aim_txq->last_desc_cleaned > compl_tag)
+ nb_desc_clean = aim_txq->nb_tx_desc - aim_txq->last_desc_cleaned +
+ compl_tag;
+ else
+ nb_desc_clean = compl_tag - aim_txq->last_desc_cleaned;
+ aim_txq->nb_free += nb_desc_clean;
+ aim_txq->last_desc_cleaned = compl_tag;
+ break;
+ case GVE_COMPL_TYPE_DQO_REINJECTION:
+ PMD_DRV_LOG(DEBUG, "GVE_COMPL_TYPE_DQO_REINJECTION !!!");
+ /* FALLTHROUGH */
+ case GVE_COMPL_TYPE_DQO_PKT:
+ txe = aim_txq->sw_ring[compl_tag];
+ if (txe != NULL) {
+ rte_pktmbuf_free_seg(txe);
+ txe = NULL;
+ }
+ break;
+ case GVE_COMPL_TYPE_DQO_MISS:
+ rte_delay_us_sleep(1);
+ PMD_DRV_LOG(DEBUG, "GVE_COMPL_TYPE_DQO_MISS ignored !!!");
+ break;
+ default:
+ PMD_DRV_LOG(ERR, "unknown completion type.");
+ return;
+ }
+
+ next++;
+ if (next == txq->nb_tx_desc * DQO_TX_MULTIPLIER) {
+ next = 0;
+ txq->cur_gen_bit ^= 1;
+ }
+
+ txq->complq_tail = next;
+}
+
+uint16_t
+gve_tx_burst_dqo(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+ struct gve_tx_queue *txq = tx_queue;
+ volatile union gve_tx_desc_dqo *txr;
+ volatile union gve_tx_desc_dqo *txd;
+ struct rte_mbuf **sw_ring;
+ struct rte_mbuf *tx_pkt;
+ uint16_t mask, sw_mask;
+ uint16_t nb_to_clean;
+ uint16_t nb_tx = 0;
+ uint16_t nb_used;
+ uint16_t tx_id;
+ uint16_t sw_id;
+
+ sw_ring = txq->sw_ring;
+ txr = txq->tx_ring;
+
+ mask = txq->nb_tx_desc - 1;
+ sw_mask = txq->sw_size - 1;
+ tx_id = txq->tx_tail;
+ sw_id = txq->sw_tail;
+
+ for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
+ tx_pkt = tx_pkts[nb_tx];
+
+ if (txq->nb_free <= txq->free_thresh) {
+ nb_to_clean = DQO_TX_MULTIPLIER * txq->rs_thresh;
+ while (nb_to_clean--)
+ gve_tx_clean_dqo(txq);
+ }
+
+ if (txq->nb_free < tx_pkt->nb_segs)
+ break;
+
+ nb_used = tx_pkt->nb_segs;
+
+ do {
+ 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.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;
+
+ tx_pkt = tx_pkt->next;
+ } while (tx_pkt);
+
+ /* fill the last descriptor with End of Packet (EOP) bit */
+ txd->pkt.end_of_packet = 1;
+
+ txq->nb_free -= nb_used;
+ txq->nb_used += nb_used;
+ }
+
+ /* update the tail pointer if any packets were processed */
+ if (nb_tx > 0) {
+ /* Request a descriptor completion on the last descriptor */
+ txq->re_cnt += nb_tx;
+ if (txq->re_cnt >= GVE_TX_MIN_RE_INTERVAL) {
+ txd = &txr[(tx_id - 1) & mask];
+ txd->pkt.report_event = true;
+ txq->re_cnt = 0;
+ }
+
+ rte_write32(tx_id, txq->qtx_tail);
+ txq->tx_tail = tx_id;
+ txq->sw_tail = sw_id;
+ }
+
+ return nb_tx;
+}
+
static inline void
gve_release_txq_mbufs_dqo(struct gve_tx_queue *txq)
{
--
2.34.1
next prev parent reply other threads:[~2023-01-30 6:32 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 2:53 [RFC 0/8] gve PMD enhancement Junfeng Guo
2023-01-18 2:53 ` [RFC 1/8] net/gve: add Rx queue setup for DQO Junfeng Guo
2023-01-18 2:53 ` [RFC 2/8] net/gve: support device start and close " Junfeng Guo
2023-01-18 2:53 ` [RFC 3/8] net/gve: support queue release and stop " Junfeng Guo
2023-01-18 2:53 ` [RFC 4/8] net/gve: support basic Tx data path " Junfeng Guo
2023-01-18 2:53 ` [RFC 5/8] net/gve: support basic Rx " Junfeng Guo
2023-01-18 2:53 ` [RFC 6/8] net/gve: support basic stats " Junfeng Guo
2023-01-18 2:53 ` [RFC 7/8] net/gve: support jumbo frame for GQI Junfeng Guo
2023-01-18 2:53 ` [RFC 8/8] net/gve: add AdminQ command to verify driver compatibility Junfeng Guo
2023-01-25 13:37 ` [RFC 0/8] gve PMD enhancement Li, Xiaoyun
2023-01-30 6:26 ` [RFC v2 0/9] " Junfeng Guo
2023-01-30 6:26 ` [RFC v2 1/9] net/gve: add Tx queue setup for DQO Junfeng Guo
2023-01-30 6:26 ` [RFC v2 2/9] net/gve: add Rx " Junfeng Guo
2023-01-30 6:26 ` [RFC v2 3/9] net/gve: support device start and close " Junfeng Guo
2023-01-30 6:26 ` [RFC v2 4/9] net/gve: support queue release and stop " Junfeng Guo
2023-01-30 6:26 ` Junfeng Guo [this message]
2023-01-30 6:26 ` [RFC v2 6/9] net/gve: support basic Rx data path " Junfeng Guo
2023-01-30 18:32 ` Honnappa Nagarahalli
2023-01-30 6:26 ` [RFC v2 7/9] net/gve: support basic stats " Junfeng Guo
2023-01-30 18:27 ` Honnappa Nagarahalli
2023-01-30 6:26 ` [RFC v2 8/9] net/gve: support jumbo frame for GQI Junfeng Guo
2023-01-30 6:26 ` [RFC v2 9/9] net/gve: add AdminQ command to verify driver compatibility Junfeng Guo
2023-02-17 7:32 ` [RFC v3 00/10] gve PMD enhancement Junfeng Guo
2023-02-17 7:32 ` [RFC v3 01/10] net/gve: add Tx queue setup for DQO Junfeng Guo
2023-02-17 7:32 ` [RFC v3 02/10] net/gve: add Rx " Junfeng Guo
2023-02-17 7:32 ` [RFC v3 03/10] net/gve: support device start and close " Junfeng Guo
2023-02-17 7:32 ` [RFC v3 04/10] net/gve: support queue release and stop " Junfeng Guo
2023-02-17 7:32 ` [RFC v3 05/10] net/gve: support basic Tx data path " Junfeng Guo
2023-02-17 7:32 ` [RFC v3 06/10] net/gve: support basic Rx " Junfeng Guo
2023-02-17 15:17 ` Honnappa Nagarahalli
2023-02-23 5:32 ` Guo, Junfeng
2023-02-17 7:32 ` [RFC v3 07/10] net/gve: support basic stats " Junfeng Guo
2023-02-17 15:28 ` Honnappa Nagarahalli
2023-02-17 7:32 ` [RFC v3 08/10] net/gve: enable Tx checksum offload " Junfeng Guo
2023-02-17 7:32 ` [RFC v3 09/10] net/gve: support jumbo frame for GQI Junfeng Guo
2023-02-17 7:32 ` [RFC v3 10/10] net/gve: add AdminQ command to verify driver compatibility Junfeng Guo
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=20230130062642.3337239-6-junfeng.guo@intel.com \
--to=junfeng.guo@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=helin.zhang@intel.com \
--cc=jeroendb@google.com \
--cc=jingjing.wu@intel.com \
--cc=jrkim@google.com \
--cc=qi.z.zhang@intel.com \
--cc=rushilg@google.com \
--cc=xiaoyun.li@intel.com \
/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).