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 B944645D27; Mon, 25 Nov 2024 12:34:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82D7240A77; Mon, 25 Nov 2024 12:34:06 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by mails.dpdk.org (Postfix) with ESMTP id BB8F34067B 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=cV5BieRPzksIaXJJZsNuxvuoXQPHHAU3tGBjUVEMrro=; b=hk4/Xg7vF1o5sJBcE49YKti8V+MTAQB/tQJeyz6K2hlDi2aqs4b80bFz VMC7ZzxIZbbVuEkitMj1s0s0a1NLDSfRQlFh8dQvFGEpfAsLHem8p33SH b1i7A9pcu5oqX8w45jAU33DD4SDH0Ky7KBZxWNZIif03pGqhDYWj7zIpW omcRQIYBGbMCk3xcfO0cAd6rW16FSv80GoCmOtRHwXcKHWTcdTZATKCkE uQY02Lyufjh7sdXKnSorgEZFLg4ffcFiEkPv0ds8GKcX3N99J/KpN5KIs BZaIcH3vNjKk4W77A1bBpuZ43cZpzAKjni6cAZ/t4kHlPQEKr7cUCJ9os Q==; X-CSE-ConnectionGUID: CKr1xTO6R1GmJ8S2wZeYEA== X-CSE-MsgGUID: 2+quDIhOTl2Q4Hu/30tqGQ== X-IronPort-AV: E=McAfee;i="6700,10204,11266"; a="44015600" X-IronPort-AV: E=Sophos;i="6.12,182,1728975600"; d="scan'208";a="44015600" 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:32 -0800 X-CSE-ConnectionGUID: BjxxhC2rTkK5PDN7O+4lug== X-CSE-MsgGUID: ppjGrm/BQqeoxGaWaP+NqA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,182,1728975600"; d="scan'208";a="90867934" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by fmviesa006.fm.intel.com with ESMTP; 25 Nov 2024 03:33:31 -0800 From: Anatoly Burakov To: dev@dpdk.org Subject: [PATCH v2 3/3] net/e1000: initialize PTP to system time Date: Mon, 25 Nov 2024 11:33:26 +0000 Message-ID: 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, e1000 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 e1000 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/e1000/igb_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index d3a9181874..c695f44c4c 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -4817,6 +4817,9 @@ igb_timesync_enable(struct rte_eth_dev *dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t tsync_ctl; uint32_t tsauxc; + struct timespec ts; + + memset(&ts, 0, sizeof(struct timespec)); /* Stop the timesync system time. */ E1000_WRITE_REG(hw, E1000_TIMINCA, 0x0); @@ -4861,6 +4864,9 @@ igb_timesync_enable(struct rte_eth_dev *dev) tsync_ctl |= E1000_TSYNCTXCTL_ENABLED; E1000_WRITE_REG(hw, E1000_TSYNCTXCTL, tsync_ctl); + /* e1000 uses zero-based timestamping so only adjust timecounter */ + igb_timesync_write_time(dev, &ts); + return 0; } -- 2.43.5