From: Benno Lossin <benno.lossin@proton.me>
To: Andrew Lunn <andrew@lunn.ch>,
FUJITA Tomonori <fujita.tomonori@gmail.com>
Cc: tmgross@umich.edu, rust-for-linux@vger.kernel.org
Subject: Re: [RFC PATCH v1] rust: net::phy support to C45 registers access
Date: Thu, 30 May 2024 08:05:50 +0000 [thread overview]
Message-ID: <4a6aba6c-3e52-4ace-be88-58f9c1b44693@proton.me> (raw)
In-Reply-To: <8c47a50d-fbba-4884-b409-925aecf4686a@lunn.ch>
On 27.05.24 23:57, Andrew Lunn wrote:
>> +/// Accesses to C22 registers.
>> +#[derive(Clone, Copy)]
>> +pub enum RegC22 {
>> + /// Basic mode control.
>> + Bmcr = uapi::MII_BMCR as isize,
>> + /// Basic mode status.
>> + Bmsr = uapi::MII_BMSR as isize,
>> + /// PHY identifier 1.
>> + PhysId1 = uapi::MII_PHYSID1 as isize,
>> + /// PHY identifier 2.
>> + PhysId2 = uapi::MII_PHYSID2 as isize,
>> + /// Auto-negotiation advertisement.
>> + Advertise = uapi::MII_ADVERTISE as isize,
>> + /// Auto-negotiation link partner base page ability.
>> + Lpa = uapi::MII_LPA as isize,
>> + /// Auto-negotiation expansion.
>> + Expansion = uapi::MII_EXPANSION as isize,
>> + /// 1000BASE-T control.
>> + Ctrl1000 = uapi::MII_CTRL1000 as isize,
>> + /// 1000BASE-T status.
>> + Stat1000 = uapi::MII_STAT1000 as isize,
>> + /// MMD access control.
>> + MmdCtrl = uapi::MII_MMD_CTRL as isize,
>> + /// MMD access data.
>> + MmdData = uapi::MII_MMD_DATA as isize,
>> + /// Extended status.
>> + Estatus = uapi::MII_ESTATUS as isize,
>> + /// Disconnect counter.
>
>> + Dcounter = uapi::MII_DCOUNTER as isize,
>> + /// False carrier sense counter.
>> + Fcscounter = uapi::MII_FCSCOUNTER as isize,
>> + /// N-way auto-negotiation test.
>> + Nwaytest = uapi::MII_NWAYTEST as isize,
>> + /// Receive error counter.
>> + Rerrcounter = uapi::MII_RERRCOUNTER as isize,
>> + /// Silicon revision.
>> + Srervision = uapi::MII_SREVISION as isize,
>> + /// Reserved.
>> + Resv1 = uapi::MII_RESV1 as isize,
>> + /// Lpback, rx, bypass error.
>> + Lbrerror = uapi::MII_LBRERROR as isize,
>> + /// PHY address.
>> + Phyaddr = uapi::MII_PHYADDR as isize,
>> + /// Reserved.
>> + Resv2 = uapi::MII_RESV2 as isize,
>> + /// TPI status for 10Mbps.
>> + TpiStatus = uapi::MII_TPISTATUS as isize,
>> + /// Network interface configuration.
>> + Nconfig = uapi::MII_NCONFIG as isize,
>
> 802.3 C22 defines 16 through 31 as vendor specific. Most of the
> #defines appear to come from the S390 driver. We probably should not
> add them in the Rust API when there meaning is not clearly
> defined. However, a driver should be able to use them, e.g, by
> defining their own vendor specific name to a given value.
@Fujita, you could fix this by adding a `VendorSpecific(T)` enum variant
and add a generic parameter to `C22`. Then the user has the option to
declare their own variant. You will probably need another trait for the
`T` value to extract the correct register number (you can try to use
`build_assert!` to ensure that the custom registers are not in the 0..16
range).
---
Cheers,
Benno
next prev parent reply other threads:[~2024-05-30 8:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 1:46 [RFC PATCH v1] rust: net::phy support to C45 registers access FUJITA Tomonori
2024-05-27 21:57 ` Andrew Lunn
2024-05-27 23:03 ` FUJITA Tomonori
2024-05-28 0:18 ` Andrew Lunn
2024-05-30 5:52 ` FUJITA Tomonori
2024-05-31 14:12 ` Andrew Lunn
2024-05-30 8:05 ` Benno Lossin [this message]
2024-05-31 13:58 ` FUJITA Tomonori
2024-05-31 14:04 ` Benno Lossin
2024-06-01 4:51 ` FUJITA Tomonori
2024-05-30 8:02 ` Benno Lossin
2024-06-01 4:20 ` FUJITA Tomonori
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=4a6aba6c-3e52-4ace-be88-58f9c1b44693@proton.me \
--to=benno.lossin@proton.me \
--cc=andrew@lunn.ch \
--cc=fujita.tomonori@gmail.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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;
as well as URLs for NNTP newsgroup(s).