From patchwork Fri Oct 26 16:27:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miroslav Lichvar X-Patchwork-Id: 989663 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42hTtV1Zh3z9s0t for ; Sat, 27 Oct 2018 03:27:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727591AbeJ0BFZ (ORCPT ); Fri, 26 Oct 2018 21:05:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35052 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727545AbeJ0BFZ (ORCPT ); Fri, 26 Oct 2018 21:05:25 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 43230C05D3EE; Fri, 26 Oct 2018 16:27:44 +0000 (UTC) Received: from holly.tpb.lab.eng.brq.redhat.com (holly.tpb.lab.eng.brq.redhat.com [10.43.134.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0711E600C5; Fri, 26 Oct 2018 16:27:42 +0000 (UTC) From: Miroslav Lichvar To: netdev@vger.kernel.org Cc: intel-wired-lan@lists.osuosl.org, Richard Cochran , Jacob Keller , Miroslav Lichvar Subject: [RFC PATCH 0/4] More accurate PHC<->system clock synchronization Date: Fri, 26 Oct 2018 18:27:38 +0200 Message-Id: <20181026162742.631-1-mlichvar@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 26 Oct 2018 16:27:44 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This series adds support for a more accurate synchronization between a PTP hardware clock and the system clock. The first patch adds an extended version of the PTP_SYS_OFFSET ioctl, which returns three timestamps for each measurement. The idea is to shorten the interval between the system timestamps to contain just the reading of the lowest register of the PHC in order to reduce the error in the measured offset and give a better bound on the maximum error. The other patches add support for the new ioctl to the e1000e, igb, and ixgbe driver. Tests with few different NICs in different machines (and PCIe slots) show that: - with an I219 (e1000e) the measured delay improved from 2500 to 1300 ns and the error in the measured offset, when compared to cross timestamping, was reduced by a factor of 5 - with an I210 (igb) the delay improved from 5100 to 1700 ns - with an I350 (igb) the delay improved from 2300 to 750 ns - with an X550 (ixgbe) the delay improved from 1950 to 650 ns There is some duplication of code in the igb and ixgbe drivers, which I don't like very much, but I thought it's better than extending and wrapping the existing functions like in the e1000e driver. Also, mixing SYSTIM and "system time" in the code will probably be confusing. I wasn't able to find a better name for the ioctl, the structures, and the driver function. If anyone has suggestions, please let me know. Miroslav Lichvar (4): ptp: add PTP_SYS_OFFSET_EXTENDED ioctl e1000e: add support for extended PHC gettime igb: add support for extended PHC gettime ixgbe: add support for extended PHC gettime drivers/net/ethernet/intel/e1000e/e1000.h | 3 ++ drivers/net/ethernet/intel/e1000e/netdev.c | 48 +++++++++++++---- drivers/net/ethernet/intel/e1000e/ptp.c | 21 ++++++++ drivers/net/ethernet/intel/igb/igb_ptp.c | 43 +++++++++++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 57 ++++++++++++++++++++ drivers/ptp/ptp_chardev.c | 39 ++++++++++++++ include/linux/ptp_clock_kernel.h | 26 +++++++++ include/uapi/linux/ptp_clock.h | 12 +++++ 8 files changed, 239 insertions(+), 10 deletions(-) Acked-by: Jacob Keller