From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pdx-out-001.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-001.esa.us-west-2.outbound.mail-perimeter.amazon.com [44.245.243.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A97C27FD75 for ; Tue, 28 Apr 2026 16:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=44.245.243.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777395551; cv=none; b=IxMFePUuhXMQz9GCsBUhIu9ONOHDtagiV4hriCoMDpyYhwGMnPuwKY5yQjAdiXWV9g/TwODqqo88m09Y8uwk54UYYmCFIGJ/h+mBrTZqOrbFCvxtoPyC2/+TWFsKTVGqaUUvGQSvFf6Ot/1hQ2+47V4YaScTaj19jQv7q7z3/P0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777395551; c=relaxed/simple; bh=cu5T5Muj3uCPb/NrgIRkDqcKv0a9zohBYkI4eFNvowM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iXJCowsGIaB6g6ONBAEknO/ZYheT2mmozb0fPjKNXnP/TD+1agtPHXXzfBMHX+fscDzrKDYMGLmE8YxLiu92KsMn15fKEVqgSwKvQz3hSp5pbD7Z1vjSX2919f1MYf5evj0ZvpPUCjD2efvbEw0u0kCSspXyw4Ga2vGBGa7ZOQ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=ZGw6FT+l; arc=none smtp.client-ip=44.245.243.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="ZGw6FT+l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1777395550; x=1808931550; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9wgrgHRLp51Nb6ayC2+GmGHAyGh/2PeXXSJPiOoeTP4=; b=ZGw6FT+lwl83cQV01xL1vRem1TxSVWQW4rJk9WgG56G/V4fHtgbnmmfB G9nuoLui+2v3Rg2Rrh5lXZPFNdkKYQpM+4KBSNoQrbbTFHSL0GRYEdodx 0nkmKt2Xb6Vp3BgpPi1BAHiJjzY7e5gQSIkGT4JGtUyG5YQPsIgnldobl XrQnMTVVvQQydE8aThIvRbIk1aofMw9nbaeOoCbOmyN1T/vjuNd9jtrZ5 10qYo5ZuWZz9N/SOPPkpgQ6wJs8uJOSLvIpBOca0o1hrnuKvD/sW9WvAG /RZNjyAQBcr+O6i58n80mghx/GAI1HAc4EPp+sFfMPZ50YZz0yPbEaWSM A==; X-CSE-ConnectionGUID: tNSxy9dxQx+RVJiNKrGb4A== X-CSE-MsgGUID: spPkFDyvQme3pkVd5QbDqw== X-IronPort-AV: E=Sophos;i="6.23,204,1770595200"; d="scan'208";a="17913100" Received: from ip-10-5-9-48.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.9.48]) by internal-pdx-out-001.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2026 16:59:09 +0000 Received: from EX19MTAUWC001.ant.amazon.com [205.251.233.53:5914] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.57.50:2525] with esmtp (Farcaster) id 5515b717-809a-46ed-96c3-185fae202a33; Tue, 28 Apr 2026 16:59:09 +0000 (UTC) X-Farcaster-Flow-ID: 5515b717-809a-46ed-96c3-185fae202a33 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC001.ant.amazon.com (10.250.64.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Tue, 28 Apr 2026 16:59:04 +0000 Received: from dev-dsk-akiyano-1c-2138b29d.eu-west-1.amazon.com (172.19.83.6) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Tue, 28 Apr 2026 16:59:00 +0000 From: Arthur Kiyanovski To: David Miller , Jakub Kicinski , CC: Arthur Kiyanovski , Richard Cochran , Eric Dumazet , Paolo Abeni , David Woodhouse , Thomas Gleixner , Miroslav Lichvar , Andrew Lunn , Wen Gu , Xuan Zhuo , "Woodhouse, David" , "Sarna, Yonatan" , "Machulsky, Zorik" , "Matushevsky, Alexander" , Saeed Bshara , "Wilson, Matt" , "Liguori, Anthony" , "Bshara, Nafea" , "Schmeilin, Evgeny" , "Belgazal, Netanel" , "Saidi, Ali" , "Herrenschmidt, Benjamin" , "Dagan, Noam" , "Arinzon, David" , "Ostrovsky, Evgeny" , "Tabachnik, Ofir" , Amit Bernstein Subject: [PATCH net-next 8/8] net: ena: Implement gettimexattrs64 callback for PTP attributes Date: Tue, 28 Apr 2026 16:54:26 +0000 Message-ID: <20260428165659.2811-9-akiyano@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260428165659.2811-1-akiyano@amazon.com> References: <20260428165659.2811-1-akiyano@amazon.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D031UWA002.ant.amazon.com (10.13.139.96) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Implement the gettimexattrs64 callback in the ENA driver to support the PTP_SYS_OFFSET_EXTENDED_ATTRS ioctl. This enables applications to retrieve PHC timestamps with quality attributes through the standard PTP ioctl interface. The ENA device currently reports only error_bound. clock_status and timescale attributes are set to default values. Signed-off-by: Amit Bernstein Signed-off-by: Arthur Kiyanovski --- drivers/net/ethernet/amazon/ena/ena_phc.c | 62 +++++++++++++++++++---- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_phc.c b/drivers/net/ethernet/amazon/ena/ena_phc.c index c2a3ff1..2ce5d45 100644 --- a/drivers/net/ethernet/amazon/ena/ena_phc.c +++ b/drivers/net/ethernet/amazon/ena/ena_phc.c @@ -25,6 +25,44 @@ static int ena_phc_feature_enable(struct ptp_clock_info *clock_info, return -EOPNOTSUPP; } +static int ena_phc_gettimexattrs64(struct ptp_clock_info *clock_info, + struct timespec64 *ts, + struct ptp_system_timestamp *sts, + struct ptp_clock_attributes *att) +{ + struct ena_phc_info *phc_info = + container_of(clock_info, struct ena_phc_info, clock_info); + u32 error_bound_nsec; + unsigned long flags; + u64 timestamp_nsec; + int rc; + + spin_lock_irqsave(&phc_info->lock, flags); + + ptp_read_system_prets(sts); + + rc = ena_com_phc_get_timestamp(phc_info->adapter->ena_dev, + ×tamp_nsec, + &error_bound_nsec); + + ptp_read_system_postts(sts); + + spin_unlock_irqrestore(&phc_info->lock, flags); + + if (rc) + return rc; + + *ts = ns_to_timespec64(timestamp_nsec); + + if (att) { + att->error_bound = error_bound_nsec; + att->status = PTP_CLOCK_STATUS_UNKNOWN; + att->timescale = PTP_TIMESCALE_UNKNOWN; + } + + return 0; +} + static int ena_phc_gettimex64(struct ptp_clock_info *clock_info, struct timespec64 *ts, struct ptp_system_timestamp *sts) @@ -40,7 +78,8 @@ static int ena_phc_gettimex64(struct ptp_clock_info *clock_info, ptp_read_system_prets(sts); rc = ena_com_phc_get_timestamp(phc_info->adapter->ena_dev, - ×tamp_nsec); + ×tamp_nsec, + NULL); ptp_read_system_postts(sts); @@ -61,16 +100,17 @@ static int ena_phc_settime64(struct ptp_clock_info *clock_info, } static struct ptp_clock_info ena_ptp_clock_info = { - .owner = THIS_MODULE, - .n_alarm = 0, - .n_ext_ts = 0, - .n_per_out = 0, - .pps = 0, - .adjtime = ena_phc_adjtime, - .adjfine = ena_phc_adjfine, - .gettimex64 = ena_phc_gettimex64, - .settime64 = ena_phc_settime64, - .enable = ena_phc_feature_enable, + .owner = THIS_MODULE, + .n_alarm = 0, + .n_ext_ts = 0, + .n_per_out = 0, + .pps = 0, + .adjtime = ena_phc_adjtime, + .adjfine = ena_phc_adjfine, + .gettimexattrs64 = ena_phc_gettimexattrs64, + .gettimex64 = ena_phc_gettimex64, + .settime64 = ena_phc_settime64, + .enable = ena_phc_feature_enable, }; /* Enable/Disable PHC by the kernel, affects on the next init flow */ -- 2.47.3