Subject: Re: [PATCH net-next v1 4/9] net: ethtool: Add attributes for cable test reports

From: Andrew Lunn <[email-masked]>
Date: Wed, 29 Apr 2020 20:57:27 +0200

On Wed, Apr 29, 2020 at 06:16:05PM +0200, Michael Walle wrote:
> Hi,
> 
> > > > > +enum {
> > > > > +	ETHTOOL_A_CABLE_PAIR_0,
> > > > > +	ETHTOOL_A_CABLE_PAIR_1,
> > > > > +	ETHTOOL_A_CABLE_PAIR_2,
> > > > > +	ETHTOOL_A_CABLE_PAIR_3,
> > > > > +};
> > > > 
> > > > Do we really need this enum, couldn't we simply use a number (possibly
> > > > with a sanity check of maximum value)?
> > > 
> > > They are not strictly required. But it helps with consistence. Are the
> > > pairs numbered 0, 1, 2, 3, or 1, 2, 3, 4?
> > 
> > OK, I'm not strictly opposed to it, it just felt a bit weird.
> 
> Speaking of the pairs. What is PAIR_0 and what is PAIR_3? Maybe
> it is specified somewhere in a standard, but IMHO an example for
> a normal TP cable would help to prevent wild growth amongst the
> PHY drivers and would help to provide consistent reporting towards
> the user space.

Hi Michael

Good question

Section 25.4.3 gives the pin out for 100BaseT. There is no pair
numbering, just transmit+, transmit- and receive+, receive- signals.

1000BaseT calls the signals BI_DA+, BI_DA-, BI_DB+, BI_DB-, BI_DC+,
BI_DC-, BI_DDA+, BI_DD-. Comparing the pinout 100BaseT would use
BI_DA+, BI_DA-, BI_DB+, BI_DB. But 1000BaseT does not really have
transmit and receive pairs due to Auto MDI-X.

BroadReach calls the one pair it has BI_DA+/BI_DA-.

Maybe it would be better to have:

enum {
	ETHTOOL_A_CABLE_PAIR_A,
	ETHTOOL_A_CABLE_PAIR_B,
	ETHTOOL_A_CABLE_PAIR_C,
	ETHTOOL_A_CABLE_PAIR_D,
};

	Andrew