Signed-off-by: Greg Armstrong <greg.armstrong...@renesas.com> Signed-off-by: Leon Goldin <leon.goldin...@renesas.com> Signed-off-by: Devasish Dey <devasish....@syncmonk.net> Signed-off-by: Vipin Sharma <vipin.sha...@syncmonk.net> --- clock.c | 2 ++ interface.c | 11 +++++++++++ interface.h | 14 ++++++++++++++ port.c | 5 +++++ 4 files changed, 32 insertions(+)
diff --git a/clock.c b/clock.c index f808b35..8f328e5 100644 --- a/clock.c +++ b/clock.c @@ -1005,6 +1005,8 @@ struct clock *clock_create(enum clock_type type, struct config *config, rtnl_get_ts_device(interface_name(iface), ts_label); interface_set_label(iface, ts_label); interface_ensure_tslabel(iface); + /* Interface speed information */ + interface_get_ifinfo(iface); interface_get_tsinfo(iface); if (interface_tsinfo_valid(iface) && !interface_tsmodes_supported(iface, required_modes)) { diff --git a/interface.c b/interface.c index 445a270..44d6588 100644 --- a/interface.c +++ b/interface.c @@ -12,6 +12,7 @@ struct interface { char name[MAX_IFNAME_SIZE + 1]; char ts_label[MAX_IFNAME_SIZE + 1]; struct sk_ts_info ts_info; + struct sk_if_info if_info; int vclock; }; @@ -46,6 +47,11 @@ int interface_get_tsinfo(struct interface *iface) return sk_get_ts_info(iface->ts_label, &iface->ts_info); } +int interface_get_ifinfo(struct interface *iface) +{ + return sk_get_if_info(iface->ts_label, &iface->if_info); +} + const char *interface_label(struct interface *iface) { return iface->ts_label; @@ -71,6 +77,11 @@ bool interface_tsinfo_valid(struct interface *iface) return iface->ts_info.valid ? true : false; } +bool interface_ifinfo_valid(struct interface *iface) +{ + return iface->if_info.valid ? true : false; +} + bool interface_tsmodes_supported(struct interface *iface, int modes) { if ((iface->ts_info.so_timestamping & modes) == modes) { diff --git a/interface.h b/interface.h index 752f4f1..fbbe919 100644 --- a/interface.h +++ b/interface.h @@ -46,6 +46,13 @@ void interface_ensure_tslabel(struct interface *iface); */ int interface_get_tsinfo(struct interface *iface); +/** + * Populate the time stamping information of a given interface. + * @param iface The interface of interest. + * @return zero on success, negative on failure. + */ +int interface_get_ifinfo(struct interface *iface); + /** * Obtain the time stamping label of a network interface. This can be * different from the name of the interface when bonding is in effect. @@ -83,6 +90,13 @@ void interface_set_label(struct interface *iface, const char *label); */ bool interface_tsinfo_valid(struct interface *iface); +/** + * Tests whether an interface's interface information is valid or not. + * @param iface The interface of interest. + * @return True if the interface information is valid, false otherwise. + */ +bool interface_ifinfo_valid(struct interface *iface); + /** * Tests whether an interface supports a set of given time stamping modes. * @param iface The interface of interest. diff --git a/port.c b/port.c index d9dac38..b93225b 100644 --- a/port.c +++ b/port.c @@ -2690,6 +2690,11 @@ void port_link_status(void *ctx, int linkup, int ts_index) p->link_status = link_state; } else { p->link_status = link_state | LINK_STATE_CHANGED; + /* Update Interface speed information on Link up*/ + if (linkup) { + interface_get_ifinfo(p->iface); + } + pr_notice("%s: link %s", p->log_name, linkup ? "up" : "down"); } -- 2.17.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel