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 84A6B45D7C; Fri, 22 Nov 2024 16:19:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5E2E433D6; Fri, 22 Nov 2024 16:18:51 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by mails.dpdk.org (Postfix) with ESMTP id BE99940264 for ; Fri, 22 Nov 2024 16:18:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732288729; x=1763824729; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=cV5BieRPzksIaXJJZsNuxvuoXQPHHAU3tGBjUVEMrro=; b=YJ4ko7f9/UCa2zh3jnhdfQ4Of/Fcy+2W4wDhjXqiF1e5CK7B58xktqAX mRgrYUk58Q46ts/ZOiNhCWec+mzs532I95C8qwDHLkqzdZxNthFc0YI2Q yyYmrTuhhY+d0IRgwKAXfhoKonzwb4rnEHBzT6HiIvRak6ppL2EEcuune FRwhWjOZfqMrFgbXFk9Fzs+SFxsfXpNAAG5BCFfZoy+Z4oyx6TwMQJoOf cRlsz+4qGKdRlExmlN2/7uZkRz2ajWPVEKWd24QC+RXALb6mGropBD6zM iX729VFy2RKTKF6IfwE/cXUfGGzW3ghy26JJI0NMaLc7RKBejA+9arJW5 Q==; X-CSE-ConnectionGUID: +LfJaY5rQGensV7qGJQD6g== X-CSE-MsgGUID: m3Orzp8SSOW0Z3libR902g== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32373140" X-IronPort-AV: E=Sophos;i="6.12,176,1728975600"; d="scan'208";a="32373140" 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:48 -0800 X-CSE-ConnectionGUID: /Veu3XSUSwykReWPDXofVQ== X-CSE-MsgGUID: U+nrTXPxQimUITsEZffAaw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,176,1728975600"; d="scan'208";a="94690139" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by fmviesa003.fm.intel.com with ESMTP; 22 Nov 2024 07:18:48 -0800 From: Anatoly Burakov To: dev@dpdk.org Subject: [PATCH v1 3/3] net/e1000: initialize PTP to system time Date: Fri, 22 Nov 2024 15:18:43 +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, 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