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 EB80B45D7C; Fri, 22 Nov 2024 16:18:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DAE75433B3; Fri, 22 Nov 2024 16:18:48 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by mails.dpdk.org (Postfix) with ESMTP id 4D14C40264 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=1732288727; x=1763824727; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=kDW2zR3ib77Miozsh6Xfxlz1zFwFlMeQtFew5/kLCqg=; b=nzQbi+QbDBV8/CAZuPAOcMjJLI2fFXGH1YjptSIbVRuMjOhyyMf55mit CRgp0mRrh5Zu9280AqVB0kiZ5FMwQACMD0tPf1ftC7ZaW38RtoxNchu0k +TO1fWufSXnT+qmIqc/tIInDLe4G5JVbQC3d0F6Cv9WnWSB4jWZGZt0BA mA0dY3RdM7s/BhI9PzG4BjjDaip7MbUGmEC/8AcgTNS9r0GG7gW5RrXYA P+hP1sCEazjLane7B6LtQ+ydP1oqNVUixDsFanzmmFEybamCpKrtKXZta gRTNBcpFnEuikotSb+vsnj1rJkhgm1hV5HhbVyxXpzqpfR5mexIShdVlD g==; X-CSE-ConnectionGUID: 6uQqrGaMQA2/MGFs13ZBRg== X-CSE-MsgGUID: NLzBjtt4SjerLscHR8KDBA== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32373133" X-IronPort-AV: E=Sophos;i="6.12,176,1728975600"; d="scan'208";a="32373133" 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:46 -0800 X-CSE-ConnectionGUID: QUWqDOSgTuiYD+CD2v9RZA== X-CSE-MsgGUID: +phTC4SnTY2Y6F5Gt6/zqA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,176,1728975600"; d="scan'208";a="94690132" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by fmviesa003.fm.intel.com with ESMTP; 22 Nov 2024 07:18:45 -0800 From: Anatoly Burakov To: dev@dpdk.org, Vladimir Medvedkin Subject: [PATCH v1 1/3] net/ixgbe: initialize PTP to system time Date: Fri, 22 Nov 2024 15:18:41 +0000 Message-ID: <38eca384ecd00e1601532dd10e20ef45aedf8434.1732288709.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.5 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, ixgbe 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 ixgbe 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/ixgbe/ixgbe_ethdev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index d02d1e43a3..8bc706f97b 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -6924,6 +6924,12 @@ ixgbe_timesync_enable(struct rte_eth_dev *dev) struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t tsync_ctl; uint32_t tsauxc; + struct timespec ts; + + memset(&ts, 0, sizeof(struct timespec)); + + /* get current system time */ + clock_gettime(CLOCK_REALTIME, &ts); /* Stop the timesync system time. */ IXGBE_WRITE_REG(hw, IXGBE_TIMINCA, 0x0); @@ -6956,6 +6962,9 @@ ixgbe_timesync_enable(struct rte_eth_dev *dev) IXGBE_WRITE_FLUSH(hw); + /* ixgbe uses zero-based timestamping so only adjust timecounter */ + ixgbe_timesync_write_time(dev, &ts); + return 0; } -- 2.43.5