[PATCH v3 09/13] pcapng: make queue optional
Stephen Hemminger
stephen at networkplumber.org
Thu Jul 10 18:16:50 CEST 2025
The queue field is optional in pcapng received packet.
Use UINT16_MAX as flag value.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/pcapng/rte_pcapng.c | 7 ++++---
lib/pcapng/rte_pcapng.h | 4 ++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 6db5d4da50..c27cb9b48e 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -500,8 +500,8 @@ rte_pcapng_insert(struct rte_mbuf *m, uint32_t queue,
uint16_t optlen = pcapng_optlen(sizeof(flags));
- /* make queue optional? */
- optlen += pcapng_optlen(sizeof(queue));
+ if (queue != UINT16_MAX)
+ optlen += pcapng_optlen(sizeof(queue));
/* does packet have valid RSS hash to include */
bool rss_hash = (direction == RTE_PCAPNG_DIRECTION_IN &&
@@ -531,7 +531,8 @@ rte_pcapng_insert(struct rte_mbuf *m, uint32_t queue,
}
opt = pcapng_add_option(opt, PCAPNG_EPB_FLAGS, &flags, sizeof(flags));
- opt = pcapng_add_option(opt, PCAPNG_EPB_QUEUE, &queue, sizeof(queue));
+ if (queue != UINT16_MAX)
+ opt = pcapng_add_option(opt, PCAPNG_EPB_QUEUE, &queue, sizeof(queue));
if (rss_hash) {
uint8_t hash_opt[5];
diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h
index 4914ac9622..48aaab365c 100644
--- a/lib/pcapng/rte_pcapng.h
+++ b/lib/pcapng/rte_pcapng.h
@@ -135,8 +135,8 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue,
* @param m
* The mbuf to modify.
* @param queue
- * The queue on the Ethernet port where packet was received
- * or is going to be transmitted.
+ * The queue on the Ethernet port where packet was received or is going to be transmitted.
+ * Optional: use UINT16_MAX if not specified.
* @param direction
* The direction of the packer: receive, transmit or unknown.
* @param orig_len
--
2.47.2
More information about the dev
mailing list