* [PATCH] net/virtio: support Rx/Tx burst mode info
@ 2025-04-16 17:35 Roger Melton
2025-05-12 11:58 ` Maxime Coquelin
0 siblings, 1 reply; 2+ messages in thread
From: Roger Melton @ 2025-04-16 17:35 UTC (permalink / raw)
To: maxime.coquelin, chenbox; +Cc: dev, Roger Melton
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net/virtio: support Rx/Tx burst mode info
2025-04-16 17:35 [PATCH] net/virtio: support Rx/Tx burst mode info Roger Melton
@ 2025-05-12 11:58 ` Maxime Coquelin
0 siblings, 0 replies; 2+ messages in thread
From: Maxime Coquelin @ 2025-05-12 11:58 UTC (permalink / raw)
To: Roger Melton, chenbox; +Cc: dev
Hi Roger,
On 4/16/25 7:35 PM, Roger Melton wrote:
> 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(+)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-12 11:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-16 17:35 [PATCH] net/virtio: support Rx/Tx burst mode info Roger Melton
2025-05-12 11:58 ` Maxime Coquelin
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).