From patchwork Mon Feb 20 16:40:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 124192 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9465C41CEC; Mon, 20 Feb 2023 17:41:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7EF5F430B1; Mon, 20 Feb 2023 17:41:45 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id CE380430AE for ; Mon, 20 Feb 2023 17:41:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676911303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fWiSG1Ux7y6BujLhoys+3EZU3EOHRDJZThF41O4yP9s=; b=cYf7oC/3YEQ+5Rb5MWompv56yJJZDYClLKg3t1dePDzol0/clvM2qgW+CFUmhNJlutoh2i HJVN9+YTndJvbKrYTqNPoHEPc4Lm6/XmaqojmxUlDKe86UNhvBi9g5+xmAy0YzAOp268uB RBt0DYRQ2havqTFuPZi8IG/Vh0fLasU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-3iuF3qoCMIO9NoW96ayOjQ-1; Mon, 20 Feb 2023 11:41:40 -0500 X-MC-Unique: 3iuF3qoCMIO9NoW96ayOjQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DE84538123A3; Mon, 20 Feb 2023 16:41:39 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7A3A492B00; Mon, 20 Feb 2023 16:41:38 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Ferruh Yigit , Aman Singh , Yuying Zhang , Robin Jarry Subject: [PATCH v2 3/9] app/testpmd: rework ieee1588 engine fwd configuration Date: Mon, 20 Feb 2023 17:40:57 +0100 Message-Id: <20230220164103.3041538-4-david.marchand@redhat.com> In-Reply-To: <20230220164103.3041538-1-david.marchand@redhat.com> References: <20230124104742.1265439-1-david.marchand@redhat.com> <20230220164103.3041538-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Acked-by: Aman Singh --- app/test-pmd/ieee1588fwd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 ==