🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #1949

Re: [PATCH net-next 1/5] net: mdio: add timestamped write operation

#1949
From: James Clark
Date: Sun, 11 Oct 2026 14:33
60 lines
12077 bytes
On Sun, Oct 11, 2026 at 9:03 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> > + * If @sts is NULL, perform an ordinary write.
> > + *
>
> Please don't do that. We don't want drivers calling this when they
> don't need to.

Agreed.

> > +             if (!ktime_before(now.monoraw, sts->post_sts.monoraw))
> > +                     return 0;
> > +
> > +             /* Cap the wait at 1 ms, which is more than any single
> > +              * write's delay. This guards against an aux clock being
> > +              * disabled and reenabled, which restarts its raw time.
> > +              */
> > +             if (!ktime_before(ktime_get_raw(), deadline))
> > +                     return -EBUSY;
>
> A bit banging MDIO bus might be slower.

The comment is misleading; I'll fix it. The 1 ms doesn't limit how
long the write takes, but how long the core waits after write_sts()
returns. It allows for a driver that returns before the transfer is
complete, at worst as soon as it has started. A bit-banging driver
returns only after the last bit, so it doesn't wait at all.

> Also, i've not thought about the mux case, where the write gets
> blocked until some other operation is performed on the shared hardware
> of the mux.

In the mux case, mdio_mux_write_sts() takes the parent bus lock and
switches the mux before calling the parent's write_sts(). So any time
spent blocked on the mux comes before the lower bound. Or did you have
another case in mind?

> > +     /**
> > +      * @write_sts: Perform a write transfer on the bus,
> > +      * with system timestamps bounding its completion. Set only
> > +      * if timestamps can always be provided. Must not return
> > +      * -EOPNOTSUPP.
> > +      */
> > +     int (*write_sts)(struct mii_bus *bus, int addr, int regnum, u16 val,
> > +                      struct ptp_system_timestamp *sts);
>
> I suggest putting C22 in the comment. At some point, somebody might
> need C45. And that gets complex because of C45 over C22.

Agreed.

> Is there any need for read_sts?

Not for this series, I think. The BCM54210PE captures its time on a
write, so a timestamped read isn't needed here. I'd leave read_sts
until a driver needs one.

James
Technical Details
Message-ID: <CANz3_Ead154hG=5H7fmnamUDbhEv==sGMHdiY+jUhjzYLRzLaw@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344524-linux-kernel-netdev=dewy.ru
References: <20261009143506.2507607-1-jjc@jclark.com> <20261009143506.2507607-2-jjc@jclark.com> <af97fa4b-d817-4e8b-bbd7-aaefa23d4d7a@lunn.ch>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344524-linux-kernel-netdev=dewy.ru
From: jjc@jclark.com (James Clark)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 1/5] net: mdio: add timestamped write operation
Date: Sun, 11 Oct 2026 21:33:32 +0700
Organization: Usenet Network
Message-ID: <CANz3_Ead154hG=5H7fmnamUDbhEv==sGMHdiY+jUhjzYLRzLaw@mail.gmail.com>
References: <20261009143506.2507607-1-jjc@jclark.com> <20261009143506.2507607-2-jjc@jclark.com>
 <af97fa4b-d817-4e8b-bbd7-aaefa23d4d7a@lunn.ch>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1556806"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:/6BtXjRoTuEDrnXkHGznlf7VOes= sha256:JxpH4SlbHKZfTDfPocE3JtB3kCfB2t3uFxMylicxoeg=
	sha1:yyyHSmHdY/ObzVloyUsHPEPnNQ0= sha256:3YupDP20luImTJCiCbWn7u+Ucbw555SPbkdfeKIJYMM=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 6958010FA19; Sun, 11 Oct 2026 17:33:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=jclark-com.20251104.gappssmtp.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Xyv2u10xpNgC;
	Sun, 11 Oct 2026 17:33:56 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-344524-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=jclark.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id BF5A110F57F; Sun, 11 Oct 2026 17:33:50 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by tor.lore.kernel.org (Postfix) with ESMTP id 008062C3E1; Sun, 11 Oct 2026 14:33:47 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id C48C73C0607;
	Sun, 11 Oct 2026 14:33:45 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=jclark-com.20251104.gappssmtp.com header.i=@jclark-com.20251104.gappssmtp.com header.b="U3IsH7xc"
X-Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F47E2F7EF3
	for <netdev@vger.kernel.org>; Sun, 11 Oct 2026 14:33:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.219.51
X-ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791729225; cv=pass; b=dulDTmar+hM7qac+CEK3R/ztqI8AjVdo4dZqA6eEjXdRcUdBaT5nTb8UIOJOTNtJ+QpEM9FpVmiBwdPq2GBqjokBgA5xORaj73t8XTQoHdCPMMFZUugNHilWa/DVy1zjPOIjTVLmOiD8gxeVjSM3vOEW6x5ey4DfmABGcEfI0hw=
X-ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791729225; c=relaxed/simple;
	bh=mfpOKnIb2lPxTOneML/VhNInEmWNxWvTH6pPXHsj6Mg=;
	h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
	 To:Cc:Content-Type; b=Xbo5ieixIlKnwlfewI9DHKvlsH8MGD0GjbDjdBTCfYOF7wmdo2DkTZZpm7ZptWyjs9kwJiZW3foU7q7HHAlJ5PVbu/NZC3I1ZGPCxmGkm6T0e7yuxLoruW/Pq+iQ0uCWOnxNwhcm7IrsCORjHMYw1PGjLxfJEpsknwP6gaSNDJ0=
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jclark.com; spf=pass smtp.mailfrom=jclark.com; dkim=pass (2048-bit key) header.d=jclark-com.20251104.gappssmtp.com header.i=@jclark-com.20251104.gappssmtp.com header.b=U3IsH7xc; arc=pass smtp.client-ip=209.85.219.51
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jclark.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jclark.com
X-Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-91b83459526so76466d6.2
        for <netdev@vger.kernel.org>; Sun, 11 Oct 2026 07:33:44 -0700 (PDT)
X-ARC-Seal: i=1; a=rsa-sha256; t=1791729223; cv=none;
        d=google.com; s=arc-20260327;
        b=TMQKSc97Bn+21klfIwyEiink48XemuwL6+ahal3lpFmSKq7mRMW6/o5wwJ3VqP3hPz
         RCTcfXcC+XnKgceuQ+IkM5EIs/wJJIXdDSXSScCEfUhPXlkyMYgRO8vsI+6ij3I44OWH
         1ar4X4hDq/7Y6T/CvF2d5aG+Y9T36LqkY44nF08qFSt8BH9kbPBVLPXL6smm2DNmrj8u
         6kVmNN57JF/hjQCNxokwSha5ewgZF33NikmAbFU4kWYN8FUDgMGQ/7j6CAA/E01Ho2W0
         CRdFPkCsKXo33Q5miSPgBhrhYj9GBm0lBs4B+uKBp1U1Jr0XaER6RjIX9+/dIVXSw+Jx
         ttLQ==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:dkim-signature;
        bh=RimT+BJQr+BZd/nBQf4bNoeClkAHtE09xphYwHOsuq8=;
        fh=QLvHrAuliOcCAK+wcwl3r0ftqneoyE6IjOjcoWXa54I=;
        b=X+b2Mopo0FnVGOPSkT546tl8pxJAfDfFj4GzEEpGMmdJVs3LxeH430/4EATfaG7gb+
         /Tub/67YuzNdRO1oL0+Lja+I7lUxX/4OrnPuSeod4Sc8rIwQYsiQC88JJKhZZJrw8P9c
         b/rcqy3oi7mGFUJ4tgJDyMk24PJJpi2rKrH40g0Py0WUJbn4oh3zYngonIQOSEkfe15Y
         mnYHGMtsGEgHgdeAo2POZC1mB7AirpCEslV1zCaL0QIzzDSsm33c4dXdIaAz92n7WSD5
         vq0RwvHof9A7S1ag3MT3VfD4tTGm6nngTQXGvCfX2w/XqaIh/dLnmiSdQ4RzhUcE9ine
         xx7w==;
        darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=jclark-com.20251104.gappssmtp.com; s=20251104; t=1791729223; x=1792334023; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=RimT+BJQr+BZd/nBQf4bNoeClkAHtE09xphYwHOsuq8=;
        b=U3IsH7xc4UI1OMR8uEmylufAXs3JQYpiCszNIR7ghf2aMaxaTjeilvwDVJQuSiwC+M
         2Y/IFQ+gQF8qI2Vftb6CdDDk6ca9Srq1MvpFUk32y/jyYY4Bb2GHz7lPGkCIDiW2yvxY
         coRx/WrTRDVXcdInyFcSpdD9dp78yqqpI/mvNHWdqd80B5VlQJjQDmYgNfNTrRLvETGS
         Jq8t8ZiADDV5Gv6WyxByJ2LtWBHNs7HxeTYbV7cBiQIhBYDmPdM6ULf0PLBtO/Pvglm5
         Pe3d6sEx5iKm4sgaKvMTnGyTKbjzbtIU+RD80fcD+o6BgakySPV7CYfl5yanYskipydU
         M3Yw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1791729223; x=1792334023;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=RimT+BJQr+BZd/nBQf4bNoeClkAHtE09xphYwHOsuq8=;
        b=IRk4d37QpMBtsq1xiAH/PEyjiX9RvLNgMMC6oCTNFguQH71hzaT9KNbXPLy+Ab3u7+
         m39GYAkZ+rtINeSen3KPcyy+nu0QskhxyuF2NBKyAtZJFBYqw9rotUzvN9WqE5zlnx8Q
         WqAuwrkvil2V+1hdor9W08MCotONansgSMkfis8f0WRj8E8SFr9O84Em6M1Js2B7XRe0
         cVhv3X91xoa9pUJuCmL9KDLIVOar6MTGS2/zfnfiBp6ls9ArWJac1re3NtRRb+AVGg86
         paDDkpO/MOwEcT1c6mS6jQhAcC17BIXhBuUWDZe4c56dnMPvlfP67KEPGrFR8iQTJ9pP
         fNJw==
X-Forwarded-Encrypted: i=1; AKwUvByDN7hUuhyzx8K+fLAH9bB9HeD7wpFM6sfFhVoTkKNST6QEDKrYAOqqqHDbumUPpfMEx/tKhyA=@vger.kernel.org
X-Gm-Message-State: AFq9FYKdz5/zNOuJplncDGluRKea2XYRGhHYrNaTaWIWwxlY3ataq/nF
	J7lhS//QaVsaVy1M7FzNsyNE5KwD8cM8YbO6UqRPGzBUHmjUchPB5tnHLr0aPFoFItw5eClD7c3
	wO4vQhj9MR9pF9kagZ8Ly2VyJlD7r+44SUI9f61LR
X-Gm-Gg: AYBFou31hwaqwSOCdYu/jp+xPvt/3BB96+JFNfjBQ70ge0jcoBWLHlVj0DWNimAR3NX
	BOBTI3rx6EYstKz9olKDCXSiOq3UTM3pRd3P9HQOnrvoYkPIHXL9WA0XFrz6oRQ6Vf4/50+saIu
	R+bCNj3XALctnZinGi/N3yuGimlH+ldKbDczoaysGT4futARsLKpwyO70/v6c8BMH1JaTaN4VCo
	MXW3YTbmfKdFT0xVMyiBbJrAlBBBmpjBPTaCAojXb85BnmYrUa0Q/ITxw9NeSlroEPdbmOA7Kp6
	3esi+Tk4YK/IGD5bgn7HCtw/XOhRyJerFhhtUzBFyqgL1NyN9F+aX/I=
X-Received: by 2002:a05:6214:ca4:b0:91b:5d3b:4ac0 with SMTP id
 6a1803df08f44-91b5d3b4e68mr123540436d6.53.1791729223287; Sun, 11 Oct 2026
 07:33:43 -0700 (PDT)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <af97fa4b-d817-4e8b-bbd7-aaefa23d4d7a@lunn.ch>
X-Gm-Features: AclHuK9eexRlWA5M879Crhtnp6jM6vwO493yA7pfOJjE5VhMdHya6ZQFlGC7FHo
X-Cc: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, 
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Andrew Lunn <andrew+netdev@lunn.ch>, 
	Heiner Kallweit <hkallweit1@gmail.com>, Richard Cochran <richardcochran@gmail.com>, 
	Florian Fainelli <florian.fainelli@broadcom.com>, Doug Berger <opendmb@gmail.com>, 
	Nicolai Buchwitz <nb@tipi-net.de>, Théo Lebrun <theo.lebrun@bootlin.com>, 
	Russell King <linux@armlinux.org.uk>, Conor Dooley <conor.dooley@microchip.com>, 
	Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Thomas Gleixner <tglx@kernel.org>, 
	Miroslav Lichvar <mlichvar@redhat.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org