Le 16 déc. 2015 09:19, "Rafał Miłecki" <zaj...@gmail.com> a écrit : > > So far we were sending link data as a string. It got some drawbacks: > 1) Didn't allow writing clean user space apps reading link state. It was > needed to do some screen scraping. > 2) Forced whole PORT_LINK communication to be string based. Adding > support for *setting* port link required passing string and parting > it in the kernel space. > > Signed-off-by: Rafał Miłecki <zaj...@gmail.com> > ---
[snip] (struct sk_buff *msg, struct genl_info *info, int attr, > + const struct switch_port_link *link) > +{ > + struct nlattr *p = NULL; > + int err = 0; > + > + p = nla_nest_start(msg, attr); > + if (nla_put_u32(msg, SWITCH_LINK_LINK, link->link)) Boolean? > + goto nla_put_failure; > + if (nla_put_u32(msg, SWITCH_LINK_DUPLEX, link->duplex)) Same here > + goto nla_put_failure; > + if (nla_put_u32(msg, SWITCH_LINK_ANEG, link->aneg)) And here > + goto nla_put_failure; > + if (nla_put_u32(msg, SWITCH_LINK_TX_FLOW, link->tx_flow)) And here > + goto nla_put_failure; > + if (nla_put_u32(msg, SWITCH_LINK_RX_FLOW, link->rx_flow)) And here too > + goto nla_put_failure; > + if (nla_put_u32(msg, SWITCH_LINK_SPEED, link->speed)) > + goto nla_put_failure; > + if (link->eee & ADVERTISED_100baseT_Full) { > + if (nla_put_flag(msg, SWITCH_LINK_FLAG_ADVERTISED_100BASET_FULL)) > + goto nla_put_failure; > + } > + if (link->eee & ADVERTISED_1000baseT_Full) { > + if (nla_put_flag(msg, SWITCH_LINK_FLAG_ADVERTISED_1000BASET_FULL)) > + goto nla_put_failure; > + } As mentioned by Stefan, these should reflect that is is EEE-related. -- Florian
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel