[OpenWrt-Devel] [PATCH][RFC] kernel: swconfig: add API for setting port link speed
Stefan Rompf
stefan at loplof.de
Sun Dec 13 07:40:31 EST 2015
Hi Rafał,
> int (*get_port_link)(struct switch_dev *dev, int port,
> struct switch_port_link *link);
> + int (*set_port_link)(struct switch_dev *dev, int port,
> + enum switch_port_speed speed);
this creates an assymetric API. I think the prototype of the set function
should be
int (*set_port_link)(struct switch_dev *dev, int port,
struct switch_port_link *link);
to allow setting other parameters that are part of struct switch_port_link,
like duplex or flow control. I'd be rather happy to disable crappy ethernet
flow control on my router...
API should be:
If switch_port_link.aneg is enabled, the switch driver should advertise the
capabilities as set in the struct. May be this requires making
switch_port_speed a bit field for the allowed speeds.
If switch_port_link.aneg is disabled, the driver should disable autonegotation
and force the parameters set.
If anything is set the switch does not support, the driver should return
-EINVAL.
Stefan
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list