From: Roger Melton <rmelton@cisco.com>
To: maxime.coquelin@redhat.com, chenbox@nvidia.com
Cc: dev@dpdk.org, Roger Melton <rmelton@cisco.com>
Subject: [PATCH] net/virtio: support Rx/Tx burst mode info
Date: Wed, 16 Apr 2025 13:35:50 -0400 [thread overview]
Message-ID: <20250416173550.603338-1-rmelton@cisco.com> (raw)
Return burst mode according to the selected Rx/Tx burst
function name.
Update 25.07 release notes with this information.
Signed-off-by: Roger Melton <rmelton@cisco.com>
---
doc/guides/rel_notes/release_25_07.rst | 3 +
drivers/net/virtio/virtio_ethdev.c | 76 ++++++++++++++++++++++++++
2 files changed, 79 insertions(+)
diff --git a/doc/guides/rel_notes/release_25_07.rst b/doc/guides/rel_notes/release_25_07.rst
index 093b85d206..ff2d81b400 100644
--- a/doc/guides/rel_notes/release_25_07.rst
+++ b/doc/guides/rel_notes/release_25_07.rst
@@ -55,6 +55,9 @@ New Features
Also, make sure to start the actual text at the margin.
=======================================================
+* **Updated virtio driver.**
+
+ * Added support for rx_burst_mode_get and tx_burst_mode_get.
Removed Items
-------------
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 1d7d10575c..2d2635b669 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -98,6 +98,11 @@ static int virtio_dev_queue_stats_mapping_set(
static void virtio_notify_peers(struct rte_eth_dev *dev);
static void virtio_ack_link_announce(struct rte_eth_dev *dev);
+static int virtio_rx_burst_mode_get(struct rte_eth_dev *dev,
+ __rte_unused uint16_t queue_id, struct rte_eth_burst_mode *mode);
+static int virtio_tx_burst_mode_get(struct rte_eth_dev *dev,
+ __rte_unused uint16_t queue_id, struct rte_eth_burst_mode *mode);
+
struct rte_virtio_xstats_name_off {
char name[RTE_ETH_XSTATS_NAME_SIZE];
unsigned offset;
@@ -636,6 +641,8 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {
.rx_queue_intr_enable = virtio_dev_rx_queue_intr_enable,
.rx_queue_intr_disable = virtio_dev_rx_queue_intr_disable,
.tx_queue_setup = virtio_dev_tx_queue_setup,
+ .rx_burst_mode_get = virtio_rx_burst_mode_get,
+ .tx_burst_mode_get = virtio_tx_burst_mode_get,
.rss_hash_update = virtio_dev_rss_hash_update,
.rss_hash_conf_get = virtio_dev_rss_hash_conf_get,
.reta_update = virtio_dev_rss_reta_update,
@@ -1242,6 +1249,75 @@ virtio_interrupt_handler(void *param)
}
}
+static const struct {
+ eth_tx_burst_t pkt_burst;
+ const char *info;
+} virtio_tx_burst_info[] = {
+ { virtio_xmit_pkts, "Scalar"},
+ { virtio_xmit_pkts_packed, "Scalar packed ring"},
+ { virtio_xmit_pkts_inorder, "Scalar in order"},
+ { virtio_xmit_pkts_packed_vec, "Vector packed ring"},
+};
+
+static int
+virtio_tx_burst_mode_get(struct rte_eth_dev *dev,
+ __rte_unused uint16_t queue_id,
+ struct rte_eth_burst_mode *mode)
+{
+ eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
+ size_t i;
+
+ for (i = 0; i < RTE_DIM(virtio_tx_burst_info); i++) {
+ if (pkt_burst == virtio_tx_burst_info[i].pkt_burst) {
+ snprintf(mode->info, sizeof(mode->info), "%s",
+ virtio_tx_burst_info[i].info);
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
+static const struct {
+ eth_rx_burst_t pkt_burst;
+ const char *info;
+} virtio_rx_burst_info[] = {
+ { virtio_recv_pkts, "Scalar"},
+ { virtio_recv_pkts_packed, "Scalar standard packed ring"},
+ { virtio_recv_pkts_inorder, "Scalar"},
+ { virtio_recv_mergeable_pkts, "Scalar mergeable"},
+ { virtio_recv_mergeable_pkts_packed, "Scalar mergeable packed ring"},
+#ifdef RTE_ARCH_x86
+ { virtio_recv_pkts_vec, "Vector SSE"},
+ { virtio_recv_pkts_packed_vec, "Vector AVX512 packed ring"},
+#elif defined(RTE_ARCH_ARM)
+ { virtio_recv_pkts_vec, "Vector NEON"},
+ { virtio_recv_pkts_packed_vec, "Vector NEON packed ring"},
+#elif defined(RTE_ARCH_PPC_64)
+ { virtio_recv_pkts_vec, "Vector Altivec"},
+ { virtio_recv_pkts_packed_vec, "Vector Altivec packed ring"},
+#endif
+};
+
+static int
+virtio_rx_burst_mode_get(struct rte_eth_dev *dev,
+ __rte_unused uint16_t queue_id,
+ struct rte_eth_burst_mode *mode)
+{
+ eth_tx_burst_t pkt_burst = dev->rx_pkt_burst;
+ size_t i;
+
+ for (i = 0; i < RTE_DIM(virtio_rx_burst_info); i++) {
+ if (pkt_burst == virtio_rx_burst_info[i].pkt_burst) {
+ snprintf(mode->info, sizeof(mode->info), "%s",
+ virtio_rx_burst_info[i].info);
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
/* set rx and tx handlers according to what is supported */
static void
set_rxtx_funcs(struct rte_eth_dev *eth_dev)
--
2.35.6
next reply other threads:[~2025-04-16 17:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 17:35 Roger Melton [this message]
2025-05-12 11:58 ` Maxime Coquelin
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=20250416173550.603338-1-rmelton@cisco.com \
--to=rmelton@cisco.com \
--cc=chenbox@nvidia.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.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).