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 4A71745D27; Mon, 25 Nov 2024 12:34:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A22A40A6E; Mon, 25 Nov 2024 12:34:05 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by mails.dpdk.org (Postfix) with ESMTP id 7D15D402C9 for ; Mon, 25 Nov 2024 12:34:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732534443; x=1764070443; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=kmYr6tFiKcrkU1lduYVhg1Qy+KDfTboO3p1recW32Pw=; b=NjLQMQmm3G5lyc3qgOaEq7vi3/lqSWYDTlKPwD48q4DkUtW95XXyfF5i m3S8AD3FhfPvZ+kTiPL11vo6sthgwmKpIPI+x1vwVnASfOiK73Dxxgxe2 CnmiuA6KQGsTMQekO2LdD5IwxersHwSV7+Yyi34sbRvX919Bizi83EyOg ZqLwsLyXs0Il9ibt+3oKtIas0CEpltIKuHg0a6QBQ6x8HevahcIXSO4QI wmZyvjGy/+8NCRei2tlV7VtBxEiP4YjJcsXqtmPitB+anmNUMn+fRoKx0 Jwl/HuLHV625xVfEQcYYryCR92uft0PWGxULrQ12y2Hp3s5hQ3qFX5fP6 A==; X-CSE-ConnectionGUID: 1zgOmNFFQuWATRlUqKnaLQ== X-CSE-MsgGUID: c3P3b5X+TVeDb+ZK1Bb7gg== X-IronPort-AV: E=McAfee;i="6700,10204,11266"; a="44015592" X-IronPort-AV: E=Sophos;i="6.12,182,1728975600"; d="scan'208";a="44015592" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2024 03:33:31 -0800 X-CSE-ConnectionGUID: nFrfQD4yRPKtYQbiJjn3oQ== X-CSE-MsgGUID: onNEXLdHRLOSYopFb+elcg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,182,1728975600"; d="scan'208";a="90867932" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by fmviesa006.fm.intel.com with ESMTP; 25 Nov 2024 03:33:30 -0800 From: Anatoly Burakov To: dev@dpdk.org, Ian Stokes , Bruce Richardson Subject: [PATCH v2 2/3] net/i40e: initialize PTP to system time Date: Mon, 25 Nov 2024 11:33:25 +0000 Message-ID: <8d96c68882f0cab115220fabc9ffa3ac2ec013c0.1732534388.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <672ea483818966221e348a09531a9975e2b83b38.1732534388.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