mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: renjun wang <renjunw0@foxmail.com>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: update fields of mii_ioctl_data for transferring C45 data.
Date: Sat, 20 Apr 2024 09:37:00 +0100	[thread overview]
Message-ID: <ZiN+rBvYQ6vktNCW@shell.armlinux.org.uk> (raw)
In-Reply-To: <tencent_78F3412B4E523FEC8F19FADAC32475318706@qq.com>

On Sat, Apr 20, 2024 at 08:41:10AM +0800, renjun wang wrote:
> The phy_id is used as u32 type in function mdio_phy_id_is_c45()
> with the 30th bit for distinguishing C22 and C45. The reg_num is
> also used as u32 type in function mdiobus_c45_read() or someplace
> else. For more C45 information needed and data structure alignment
> consideration, change these two fields to __u32 type which can make
> user space program transferring clause 45 type information to kernel
> directly.

You haven't understood the user API, and are making a change that will
break existing userspace users of this API. Hence this is not
acceptable.

mdio_phy_id_is_c45() is indeed for determining if the "phy_id" field
in mii_ioctl_data is indicating a clause 45 transaction. This checks
the following bits, defined using these macros:

#define MDIO_PHY_ID_C45                 0x8000
#define MDIO_PHY_ID_PRTAD               0x03e0
#define MDIO_PHY_ID_DEVAD               0x001f

and all of these fit within the __u16.

The format used by userspace pre-dates clause 45, and bit 15 was
added to indicate clause 45 along with the "prtad" in bits 9 to
5.

However, the kernel translates this data structure into something
that the MDIO accessors can deal with. See for example phy_mii_ioctl().

Also note that the old method of shoe-horning clause 45 into just
one set of mii bus methods has gone, meaning there is now no need
to convert from mii_ioctl_data into a 32-bit reg_num.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  parent reply	other threads:[~2024-04-20  8:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20  0:41 renjun wang
2024-04-20  8:00 ` Heiner Kallweit
2024-04-20  8:37 ` Russell King (Oracle) [this message]
2024-04-20 14:17 ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZiN+rBvYQ6vktNCW@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=renjunw0@foxmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®