Subject: Re: [RFC net-next 0/4] ethtool: CMIS module diagnostic loopback support

From: Jakub Kicinski <[email-masked]>
Date: Fri, 20 Feb 2026 13:12:54 -0800

On Fri, 20 Feb 2026 15:18:40 +0100 Andrew Lunn wrote:
> > Something like:
> > 
> >   struct {
> >      enum type;   // MAC, PHY, SFP
> >      int type_id; // if type=PHY - phy id
> >      int depth;   // counting from CPU, first loopback opportunity is 1
> >                   // second is 2, etc.
> >      bool direction; // towards CPU/host vs towards network
> >      char name[16];  // "pcs", "far", "near", "post-fec", whatever
> >   }  
> 
> Lets see what comes from the drawing board, but i was more thinking
> about expanding the bitmap this proposal already has, extending it to
> other layers.

IIUC the bitmap this proposal has is basically a product of
direction x depth: [host, network] x [nearest, furthest]
plus its scoped to SFP.

> As use cases are implemented, we define the bits needed
> in the map. 

Sure, but if we are creating a dedicated API we should decompose 
the information from the start. Direction, and entity (MAC, PHY, SFP)
don't have to be part of the bitmap?

> The ethtool kAPI has the needed infrastructure to map bits
> to names, it is used for link modes etc, and that can be used here. So
> the ethtool(1) part should be reasonably generic.

Dunno if link modes are the right point of reference. Link mode is 
a combination of various parameters which must match on both sides
exactly. For the loopback the config is very simple, the expressiveness
is needed to explain where the configuration is applied.

IOW for link modes it's important to have an ID for the combination of
all params to easily check if the whole thing is as expected.
For loopback it's easier to think of it as traversing attribute by
attribute: MAC / PHY / SFP -> which one -> which depth -> which dir.
Single id has no benefit and would be cumbersome to define.

Or at least that's my intuition, I haven't use loopback much myself.