From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>, stable@dpdk.org
Subject: [PATCH v3] app/testpmd: use burst IO for IEEE1588 forwarding
Date: Thu, 26 Nov 2026 13:51:09 +0000 [thread overview]
Message-ID: <20261126135109.3493777-1-bruce.richardson@intel.com> (raw)
In-Reply-To: <20261118151155.2740034-1-bruce.richardson@intel.com>
The IEEE1588 forwarder in test-pmd read a single packet at a time rather
than using the burst size configuration parameter. This meant that it
cannot be used with vector driver paths which require a minimum burst
size for calling the Rx function.
Make the forwarding function respect the configured burst size and only
process packets one at a time, not Rx them one-at-a-time.
Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
V3: make per-packet forwarding function void rather than ignoring return
value
V2: align return value from ieee_packet_fwd() with other fwd fns.
---
app/test-pmd/ieee1588fwd.c | 44 +++++++++++++++++++++-----------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c
index afea7735c7..8c6a60aff1 100644
--- a/app/test-pmd/ieee1588fwd.c
+++ b/app/test-pmd/ieee1588fwd.c
@@ -34,10 +34,10 @@ struct ptpv2_msg {
/*
* Forwarding of IEEE1588 Precise Time Protocol (PTP) packets.
*
- * In this mode, packets are received one by one and are expected to be
- * PTP V2 L2 Ethernet frames (with the specific Ethernet type "0x88F7")
- * containing PTP "sync" messages (version 2 at offset 1, and message ID
- * 0 at offset 0).
+ * In this mode, packets are received in bursts and processed one by one.
+ * They are expected to be PTP V2 L2 Ethernet frames (with the specific
+ * Ethernet type "0x88F7") containing PTP "sync" messages (version 2 at
+ * offset 1, and message ID 0 at offset 0).
*
* Check that each received packet is a IEEE1588 PTP V2 packet of type
* PTP_SYNC_MESSAGE, and that it has been identified and timestamped
@@ -89,22 +89,15 @@ port_ieee1588_tx_timestamp_check(portid_t pi)
(wait_us == 1) ? "" : "s");
}
-static bool
-ieee1588_packet_fwd(struct fwd_stream *fs)
+static void
+ieee1588_process_packet(struct fwd_stream *fs, struct rte_mbuf *mb)
{
- struct rte_mbuf *mb;
struct rte_ether_hdr *eth_hdr;
struct rte_ether_addr addr;
struct ptpv2_msg *ptp_hdr;
uint16_t eth_type;
uint32_t timesync_index;
- /*
- * Receive 1 packet at a time.
- */
- if (common_fwd_stream_receive(fs, &mb, 1) == 0)
- return false;
-
/*
* Check that the received packet is a PTP packet that was detected
* by the hardware.
@@ -124,14 +117,14 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
(unsigned) mb->pkt_len);
}
rte_pktmbuf_free(mb);
- return false;
+ return;
}
if (eth_type != RTE_ETHER_TYPE_1588) {
printf("Port %u Received NON PTP packet incorrectly"
" detected by hardware\n",
fs->rx_port);
rte_pktmbuf_free(mb);
- return false;
+ return;
}
/*
@@ -145,14 +138,14 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
" protocol version 0x%x (should be 0x02)\n",
fs->rx_port, ptp_hdr->version);
rte_pktmbuf_free(mb);
- return false;
+ return;
}
if (ptp_hdr->msg_id != PTP_SYNC_MESSAGE) {
printf("Port %u Received PTP V2 Ethernet frame with unexpected"
" message ID 0x%x (expected 0x0 - PTP_SYNC_MESSAGE)\n",
fs->rx_port, ptp_hdr->msg_id);
rte_pktmbuf_free(mb);
- return false;
+ return;
}
printf("Port %u IEEE1588 PTP V2 SYNC Message filtered by hardware\n",
fs->rx_port);
@@ -166,7 +159,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
" by hardware\n",
fs->rx_port);
rte_pktmbuf_free(mb);
- return false;
+ return;
}
/* For i40e we need the timesync register index. It is ignored for the
@@ -184,14 +177,25 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
mb->ol_flags |= RTE_MBUF_F_TX_IEEE1588_TMST;
if (common_fwd_stream_transmit(fs, &mb, 1) == 0) {
printf("Port %u sent PTP packet dropped\n", fs->tx_port);
- return false;
+ return;
}
/*
* Check the TX timestamp.
*/
port_ieee1588_tx_timestamp_check(fs->tx_port);
- return true;
+}
+
+static bool
+ieee1588_packet_fwd(struct fwd_stream *fs)
+{
+ struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
+
+ const uint16_t nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst);
+ for (uint16_t i = 0; i < nb_rx; i++)
+ ieee1588_process_packet(fs, pkts_burst[i]);
+
+ return nb_rx > 0;
}
static int
--
2.55.0
prev parent reply other threads:[~2026-11-26 13:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 15:11 [PATCH] app/test-pmd: use burst IO for IEEE1588 forwarding Bruce Richardson
2026-11-22 17:44 ` Stephen Hemminger
2026-11-23 12:26 ` [PATCH v2] app/testpmd: " Bruce Richardson
2026-11-23 16:50 ` Stephen Hemminger
2026-11-23 16:53 ` Bruce Richardson
2026-11-23 18:38 ` Stephen Hemminger
2026-11-26 13:51 ` Bruce Richardson [this message]
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=20261126135109.3493777-1-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.