[OpenWrt-Devel] [PATCH] swconfig: support setting SWITCH_TYPE_LINK attributes

Rafał Miłecki zajec5 at gmail.com
Thu Jan 7 01:53:51 EST 2016

On 30 December 2015 at 12:10, Rafał Miłecki <zajec5 at gmail.com> wrote:
> Supported syntax is inspired by ethtool. Example usage:
> swconfig dev switch0 port 2 set link "duplex half speed 100 autoneg off"

Any comments to this usage/syntax? It doesn't look too nice (this long
quoted string as a value), but swconfig is strongly focused on simple
values. Making swconfig accept something like:
swconfig dev switch0 port 2 set link duplex half speed 100 autoneg off
would require big rewrite of handling arguments in main function.

Moreover swconfig uses magic mapping of UCI options into swconfig
attributes. Thanks to this - with proposed patch - I can simply use:
network. at switch_port[0]=switch_port
network. at switch_port[0].device='switch0'
network. at switch_port[0].port='3'
network. at switch_port[0].link='duplex full speed 10 autoneg on'
and it works without any extra changes.

Making swconfig understand more friendly options, e.g.
network. at switch_port[0].link_duplex
network. at switch_port[0].link_speed
network. at switch_port[0].link_autoneg
would require big changes to swlib_apply_from_uci and swlib_map_settings.
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list