From patchwork Mon Feb 20 18:34:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 124204 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 18F7541CEE; Mon, 20 Feb 2023 19:35:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 69A3A430D9; Mon, 20 Feb 2023 19:35:29 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 8CD88430D5 for ; Mon, 20 Feb 2023 19:35:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676918127; 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=M4RUKBAAIUF/12KlptDW/rpDntaMAn7V+5WvnFfgiO3v6wXlnxmdg6al9/LRNand5jUyM9 Ndnkl6YNCKccdfviv27L+N+je3M6RRxHzxLkOT+vSgZvflzvz278CdhKAI/QYCispQkAxL wgW5L4mDe9TAjXw4WklWu2DAyufsOJg= 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-612-2nrI3l_9PISFD3cbcE-8-w-1; Mon, 20 Feb 2023 13:35:24 -0500 X-MC-Unique: 2nrI3l_9PISFD3cbcE-8-w-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 E73D13C0F187; Mon, 20 Feb 2023 18:35:23 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEDDD492B00; Mon, 20 Feb 2023 18:35:22 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Ferruh Yigit , Aman Singh , Yuying Zhang , Robin Jarry Subject: [PATCH v3 3/9] app/testpmd: rework ieee1588 engine fwd configuration Date: Mon, 20 Feb 2023 19:34:56 +0100 Message-Id: <20230220183502.3348368-4-david.marchand@redhat.com> In-Reply-To: <20230220183502.3348368-1-david.marchand@redhat.com> References: <20230124104742.1265439-1-david.marchand@redhat.com> <20230220183502.3348368-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 Reviewed-by: Ferruh Yigit --- 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 ==