From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E71145D7C; Fri, 22 Nov 2024 16:18:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D688C433C4; Fri, 22 Nov 2024 16:18:49 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by mails.dpdk.org (Postfix) with ESMTP id EBA8940264 for ; Fri, 22 Nov 2024 16:18:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732288728; x=1763824728; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=kmYr6tFiKcrkU1lduYVhg1Qy+KDfTboO3p1recW32Pw=; b=RsAazXkwBPX14jQir++Jx9xVWZDPONCuhI2UiUyiYz6HH6KnW2hTcup0 /Dt9b/8gTFNtKGn0n6QOVkxjsJNULr2YKsfqlejaUEtY9P2sgRNhlSYDS 5g1k3R/2uebUJEZ5jXUPwR85WmOxwbdFJTvFU4cPch+9jAecAiuWwtYsF tqQDF/FDR+txBSyGQz30KkYRjCdF3Zvr1wviSK7NZdBIYYznsdyyPO+TZ g5qzjfKJmrUrh/nD74CPzaBy4QrWde/Zq1kToexkOLLjRCQ0+gA+orpp/ 83as/RZV4hUGe28CLf7C5jfkIBoPkMW0mfoiZgiRj5Ug57NroQoWa12iJ A==; X-CSE-ConnectionGUID: +jdrTWprSKKDYIPr1kLqSQ== X-CSE-MsgGUID: pzBxiu97QPOdZNJqR91oyQ== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32373138" X-IronPort-AV: E=Sophos;i="6.12,176,1728975600"; d="scan'208";a="32373138" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 07:18:47 -0800 X-CSE-ConnectionGUID: FlVkXmpJRoCE1ShMijktzQ== X-CSE-MsgGUID: HTuuxsVSSWav09LZyv84fQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,176,1728975600"; d="scan'208";a="94690137" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by fmviesa003.fm.intel.com with ESMTP; 22 Nov 2024 07:18:46 -0800 From: Anatoly Burakov To: dev@dpdk.org, Ian Stokes , Bruce Richardson Subject: [PATCH v1 2/3] net/i40e: initialize PTP to system time Date: Fri, 22 Nov 2024 15:18:42 +0000 Message-ID: X-Mailer: git-send-email 2.43.5 In-Reply-To: <38eca384ecd00e1601532dd10e20ef45aedf8434.1732288709.git.anatoly.burakov@intel.com> References: <38eca384ecd00e1601532dd10e20ef45aedf8434.1732288709.git.anatoly.burakov@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Currently, i40e driver initializes PTP timestamp to 0. This is different from what kernel driver does (which initializes it to system time). Align the DPDK driver to kernel driver by setting PTP timestamp to system time when enabling PTP. Note that i40e driver always uses zero-based timestamps for PTP, so we would only ever update the internal timecounter and not the actual NIC registers. Signed-off-by: Anatoly Burakov --- drivers/net/i40e/i40e_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ca128c7556..30dcdc68a8 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -10556,6 +10556,9 @@ i40e_timesync_enable(struct rte_eth_dev *dev) struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t tsync_ctl_l; uint32_t tsync_ctl_h; + struct timespec ts; + + memset(&ts, 0, sizeof(struct timespec)); /* Stop the timesync system time. */ I40E_WRITE_REG(hw, I40E_PRTTSYN_INC_L, 0x0); @@ -10585,6 +10588,9 @@ i40e_timesync_enable(struct rte_eth_dev *dev) I40E_WRITE_REG(hw, I40E_PRTTSYN_CTL0, tsync_ctl_l); I40E_WRITE_REG(hw, I40E_PRTTSYN_CTL1, tsync_ctl_h); + /* i40e uses zero-based timestamping so only adjust timecounter */ + i40e_timesync_write_time(dev, &ts); + return 0; } -- 2.43.5