[PATCH v3 5/9] net/pcap: support Tx offloads
Stephen Hemminger
stephen at networkplumber.org
Tue Jan 13 20:23:37 CET 2026
The driver already handles multi-segment mbufs but did not report
that in offload flags. Driver can easily insert vlan tag making
testing easier.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
doc/guides/nics/features/pcap.ini | 1 +
drivers/net/pcap/pcap_ethdev.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/doc/guides/nics/features/pcap.ini b/doc/guides/nics/features/pcap.ini
index e75bf03051..c4772031be 100644
--- a/doc/guides/nics/features/pcap.ini
+++ b/doc/guides/nics/features/pcap.ini
@@ -10,6 +10,7 @@ Scattered Rx = Y
Rx Timestamp = Y
Basic stats = Y
Stats per queue = Y
+VLAN offload = P
Multiprocess aware = Y
FreeBSD = Y
Linux = Y
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index 7002f8034a..fde04bd1b2 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -403,6 +403,9 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
if (unlikely(len > mtu))
continue;
+ if ((mbuf->ol_flags & RTE_MBUF_F_TX_VLAN) && rte_vlan_insert(&mbuf))
+ continue;
+
calculate_timestamp(&header.ts);
header.len = len;
header.caplen = len;
@@ -485,6 +488,9 @@ eth_pcap_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
if (unlikely(len > mtu))
continue;
+ if ((mbuf->ol_flags & RTE_MBUF_F_TX_VLAN) && rte_vlan_insert(&mbuf))
+ continue;
+
/* rte_pktmbuf_read() returns a pointer to the data directly
* in the mbuf (when the mbuf is contiguous) or, otherwise,
* a pointer to temp_data after copying into it.
@@ -741,6 +747,8 @@ eth_dev_info(struct rte_eth_dev *dev,
dev_info->min_rx_bufsize = 0;
dev_info->min_mtu = RTE_ETHER_MIN_LEN - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN;
dev_info->max_mtu = RTE_ETH_PCAP_SNAPLEN;
+ dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS |
+ RTE_ETH_TX_OFFLOAD_VLAN_INSERT;
return 0;
}
--
2.51.0
More information about the dev
mailing list