[OpenWrt-Devel] [PATCH 2/3] swconfig: support receiving SWITCH_TYPE_LINK from kernel
Florian Fainelli
florian at openwrt.org
Sun Dec 20 16:56:55 EST 2015
Le 16 déc. 2015 09:21, "Rafał Miłecki" <zajec5 at gmail.com> a écrit :
>
> When using cli, print link state the same way kernel used to do it.
> This will allow kernel switching PORT_LINK from SWITCH_TYPE_STRING.
>
> Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
> ---
[snip]
> + link->eee &
SWLIB_LINK_FLAG_ADVERTISED_100BASET_FULL ? "eee100 " : "",
> + link->eee &
SWLIB_LINK_FLAG_ADVERTISED_1000BASET_FULL ? "eee1000 " : "",
EEE needs to be advertised, supported, and enabled on both link partners to
be used,what you are printing here is not very clear, as this is just the
advertised side
> + link->aneg ? "auto" : "");
> + else
> + printf("port:%d link:down", val->port_vlan);
> + break;
> default:
> printf("?unknown-type?");
> }
> diff --git a/package/network/config/swconfig/src/swlib.c
b/package/network/config/swconfig/src/swlib.c
> index 0dbace5..5239bf7 100644
> --- a/package/network/config/swconfig/src/swlib.c
> +++ b/package/network/config/swconfig/src/swlib.c
> @@ -51,6 +51,15 @@ static struct nla_policy
portmap_policy[SWITCH_PORTMAP_MAX] = {
> [SWITCH_PORTMAP_VIRT] = { .type = NLA_U32 },
> };
>
> +static struct nla_policy link_policy[SWITCH_LINK_ATTR_MAX] = {
> + [SWITCH_LINK_LINK] = { .type = NLA_U32 },
> + [SWITCH_LINK_DUPLEX] = { .type = NLA_U32 },
> + [SWITCH_LINK_ANEG] = { .type = NLA_U32 },
> + [SWITCH_LINK_SPEED] = { .type = NLA_U32 },
As mentioned in patch 1, some of this fits in a boolean.
--
Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20151220/394953f9/attachment.htm>
-------------- next part --------------
_______________________________________________
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