interface: Introduce a method to get the time stamping information.

In order to prevent users from open coding this logic, this patch
provides a method that populates the time stamping information from
the interface label.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
master
Richard Cochran 2020-02-09 11:14:42 -08:00
parent e752cac7b1
commit cca19dab99
2 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,11 @@
*/ */
#include "interface.h" #include "interface.h"
int interface_get_tsinfo(struct interface *iface)
{
return sk_get_ts_info(iface->ts_label, &iface->ts_info);
}
const char *interface_label(struct interface *iface) const char *interface_label(struct interface *iface)
{ {
return iface->ts_label; return iface->ts_label;

View File

@ -24,6 +24,13 @@ struct interface {
struct sk_ts_info ts_info; struct sk_ts_info ts_info;
}; };
/**
* 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_tsinfo(struct interface *iface);
/** /**
* Obtain the time stamping label of a network interface. This can be * Obtain the time stamping label of a network interface. This can be
* different from the name of the interface when bonding is in effect. * different from the name of the interface when bonding is in effect.