Subject: Re: [patch net-next v5 06/21] net: introduce generic switch devices support

From: Lino Sanfilippo <[email-masked]>
Date: Sat, 29 Nov 2014 10:31:39 +0100

Hi,

On 28.11.2014 14:34, Jiri Pirko wrote:
> +
> +  ndo_switch_parent_id_get - This returns the same ID for two port netdevices
> +			     of the same physical switch chip. This is
> +			     mandatory to be implemented by all switch drivers
> +			     and serves the caller for recognition of a port
> +			     netdevice.
> +  ndo_switch_parent_* - Functions that serve for a manipulation of the switch
> +			chip itself (it can be though of as a "parent" of the
> +			port, therefore the name). They are not port-specific.
> +			Caller might use arbitrary port netdevice of the same
> +			switch and it will make no difference.

I doubt that this is a good solution. If you want to access some kind of
parent device why dont you provide a device structure for it along with
register and unregister functions? Also each device should IMHO show up
in sysfs somehow, which should also be part of a register function.
There is already an existing driver (see net/dsa) that addresses the
representation of switch devices. What is wrong with that?

Regards,
Lino