[v3,3/9] app/testpmd: rework ieee1588 engine fwd configuration

Message ID 20230220183502.3348368-4-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Testpmd code cleanup |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Feb. 20, 2023, 6:34 p.m. UTC
  This fwd engine currently ignores the forwarding configuration.
Force it explicitly when initialising the stream.
The code is then more consistent with other fwd engines (i.e. receiving
on fs->rx_port, transmitting on fs->tx_port).

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/ieee1588fwd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
  

Comments

Ferruh Yigit Feb. 28, 2023, 6:50 p.m. UTC | #1
On 2/20/2023 6:34 PM, David Marchand wrote:
> This fwd engine currently ignores the forwarding configuration.
> Force it explicitly when initialising the stream.
> The code is then more consistent with other fwd engines (i.e. receiving
> on fs->rx_port, transmitting on fs->tx_port).
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
  

Patch

diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c
index 896d5ef26a..242d272948 100644
--- a/app/test-pmd/ieee1588fwd.c
+++ b/app/test-pmd/ieee1588fwd.c
@@ -184,8 +184,8 @@  ieee1588_packet_fwd(struct fwd_stream *fs)
 
 	/* Forward PTP packet with hardware TX timestamp */
 	mb->ol_flags |= RTE_MBUF_F_TX_IEEE1588_TMST;
-	if (rte_eth_tx_burst(fs->rx_port, fs->tx_queue, &mb, 1) == 0) {
-		printf("Port %u sent PTP packet dropped\n", fs->rx_port);
+	if (rte_eth_tx_burst(fs->tx_port, fs->tx_queue, &mb, 1) == 0) {
+		printf("Port %u sent PTP packet dropped\n", fs->tx_port);
 		fs->fwd_dropped += 1;
 		rte_pktmbuf_free(mb);
 		return;
@@ -195,7 +195,7 @@  ieee1588_packet_fwd(struct fwd_stream *fs)
 	/*
 	 * Check the TX timestamp.
 	 */
-	port_ieee1588_tx_timestamp_check(fs->rx_port);
+	port_ieee1588_tx_timestamp_check(fs->tx_port);
 }
 
 static int
@@ -216,6 +216,9 @@  port_ieee1588_stream_init(struct fwd_stream *fs)
 {
 	bool rx_stopped, tx_stopped;
 
+	/* Force transmission on reception port */
+	fs->tx_port = fs->rx_port;
+
 	rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
 						RTE_ETH_QUEUE_STATE_STOPPED;
 	tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==