lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <87r1uqtybr.fsf@osv.gnss.ru>
Date:   Sun, 07 Jun 2020 23:28:40 +0300
From:   Sergey Organov <sorganov@...il.com>
To:     netdev@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, "NXP Linux Team" <linux-imx@....com>
Subject: iMX 6SX FEC: broken hardware timestamping using external PTP PHY

Hello,

I'm using DP83640 PTP PHY connected to builtin fec1 (that
has its own PTP support) of the iMX 6SX microcontroller.

Almost everything works fine out of the box, except hardware
timestamping. The problems are that I apparently get timestamps from fec
built-in PTP instead of external PHY, and that

  ioctl(fd, SIOCSHWTSTAMP, &ifr)

ends up being executed by fec1 built-in PTP code instead of being
forwarded to the external PHY, and that this happens despite the call to

   info.cmd = ETHTOOL_GET_TS_INFO;                                                                             
   ioctl(fd, SIOCETHTOOL, &ifr);                                                                     

returning phc_index = 1 that corresponds to external PHY, and reports
features of the external PHY, leading to major inconsistency as seen
from user-space.

I chased the ioctl() problem down to the fec_enet_ioctl() function in

  drivers/net/ethernet/freescale/fec_main.c:2722

that specifically for SIOCSHWTSTAMP (and SIOCGHWTSTAMP) explicitly
calls

  fec_ptp_set() (and fec_ptp_get())

instead of delegating to phy_mii_ioctl() as it does for the rest of
ioctls.

I've then commented-out this fec_ptp_set() calling code, and now ioctls
go to the external PHY, but I'd like to have proper fix instead of 
quick'n'dirty hack.

I checked DTS documentation, but didn't find a way to disable fec
builtin PTP support (nor would I actually like to, as it could be
useful as a hardware PPS source), or its timestamping feature.

I need to fix this, and, being newbie to the codebase, I don't even know
where to start, as I can't figure what's the supposed way of selecting
which unit should be used for hardware timestamping when there are two
of them on the current active path of newtork packets. I mean,
configuring PTP clocks is OK, as they are accessible separately through
'/dev/ptpX' interface, but hardware timestamping is to be configured
through (single) if-name, and there doesn't seem to be a way to address
different hardware timestamping units.

I'm using rather old 4.9.146 kernel, so I checked the tip of the git
master, and the code there still looks the same. I also didn't notice
any relevant commits in the recent git history.

Could somebody please help me implement (or point me to) proper fix to
reliably use external PHY to timestamp network packets?

-- Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ