Re: [PATCH v1] ethtool: provide UAPI for PHY master/slave configuration.

From: Oleksij Rempel
Date: Wed Apr 15 2020 - 09:37:57 EST


On Wed, Apr 15, 2020 at 03:11:04PM +0200, Andrew Lunn wrote:
> On Wed, Apr 15, 2020 at 02:12:09PM +0200, Oleksij Rempel wrote:
> > This UAPI is needed for BroadR-Reach 100BASE-T1 devices. Due to lack of
> > auto-negotiation support, we needed to be able to configure the
> > MASTER-SLAVE role of the port manually or from an application in user
> > space.
>
> Hi Oleksij
>
> This is a nice way to do this.
>
> > +/* Port mode */
> > +#define PORT_MODE_MASTER 0x00
> > +#define PORT_MODE_SLAVE 0x01
> > +#define PORT_MODE_MASTER_FORCE 0x02
> > +#define PORT_MODE_SLAVE_FORCE 0x03
> > +#define PORT_MODE_UNKNOWN 0xff
>
> It is not clear to me what PORT_MODE_MASTER and PORT_MODE_SLAVE. Do
> these mean to negotiate master/slave? Maybe some comments, or clearer
> names?

In the IEEE 802.3 it is described as:
---------------------------------------------------------------------------
Port type: Bit 9.10 is to be used to indicate the preference to operate
as MASTER (multiport device) or as SLAVE (single-port device) if the
MASTER-SLAVE Manual Configuration Enable bit, 9.12, is not set. Usage
of this bit is described in 40.5.2.
1 = Multiport device
0 = single-port device
---------------------------------------------------------------------------

Setting PORT_MODE_MASTER/PORT_MODE_SLAVE will increase the chance to get
MASTER or SLAVE mode, but not force it.

If we will follow strictly to the IEEE 802.3 spec, it should be named:

#define PORT_MODE_UNKNOWN 0x00
/* this two options will not force some specific mode, only influence
* the chance to get it */
#define PORT_TYPE_MULTI_PORT 0x01
#define PORT_TYPE_SINGLE_PORT 0x02
/* this two options will force master or slave mode */
#define PORT_MODE_MASTER 0x03
#define PORT_MODE_SLAVE 0x04

Please tell, if you have better ideas.

Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |