From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 011BFA09DE; Fri, 13 Nov 2020 11:40:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E9310C86A; Fri, 13 Nov 2020 11:40:15 +0100 (CET) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 61A03C868 for ; Fri, 13 Nov 2020 11:40:13 +0100 (CET) Received: from glumotte.dev.6wind.com. (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 2F71848AD8F; Fri, 13 Nov 2020 11:40:12 +0100 (CET) From: Olivier Matz To: dev@dpdk.org Cc: Ferruh Yigit , David Marchand , Thomas Monjalon Date: Fri, 13 Nov 2020 11:39:57 +0100 Message-Id: <20201113103957.19068-1-olivier.matz@6wind.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/pcap: fix registration of timestamp dynamic field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In pcap pmd, the timestamp mbuf dynamic field is mandatory. When the pcap pmd is created in a secondary process (this is the case for pdump), it cannot be registered because this is not allowed from a secondary process. To ensure that the field is properly registered, do it from probe() instead of configure(). Indeed, probe() is invoked on the primary process when a device is created in a secondary. Bugzilla ID: 571 Fixes: d23d73d088c1 ("net/pcap: switch Rx timestamp to dynamic mbuf field") Signed-off-by: Olivier Matz --- drivers/net/pcap/rte_eth_pcap.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 4e6d49370e..4930d7d382 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -661,15 +661,6 @@ eth_dev_stop(struct rte_eth_dev *dev) static int eth_dev_configure(struct rte_eth_dev *dev __rte_unused) { - int ret; - - ret = rte_mbuf_dyn_rx_timestamp_register(×tamp_dynfield_offset, - ×tamp_rx_dynflag); - if (ret != 0) { - PMD_LOG(ERR, "Failed to register Rx timestamp field/flag"); - return -rte_errno; - } - return 0; } @@ -1387,6 +1378,13 @@ pmd_pcap_probe(struct rte_vdev_device *dev) start_cycles = rte_get_timer_cycles(); hz = rte_get_timer_hz(); + ret = rte_mbuf_dyn_rx_timestamp_register(×tamp_dynfield_offset, + ×tamp_rx_dynflag); + if (ret != 0) { + PMD_LOG(ERR, "Failed to register Rx timestamp field/flag"); + return -1; + } + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { eth_dev = rte_eth_dev_attach_secondary(name); if (!eth_dev) { -- 2.25.1