Add storage fields for the path trace list.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-08-07 09:20:55 +02:00
parent 269f9873f1
commit edfb5fac84
3 changed files with 21 additions and 0 deletions

View File

@ -49,6 +49,7 @@ struct clock {
struct currentDS cur; struct currentDS cur;
struct parentDS dad; struct parentDS dad;
struct timePropertiesDS tds; struct timePropertiesDS tds;
struct ClockIdentity ptl[PATH_TRACE_MAX];
struct foreign_clock *best; struct foreign_clock *best;
struct port *port[MAX_PORTS]; struct port *port[MAX_PORTS];
struct pollfd pollfd[MAX_PORTS*N_CLOCK_PFD]; struct pollfd pollfd[MAX_PORTS*N_CLOCK_PFD];
@ -148,12 +149,14 @@ static void clock_step(clockid_t clkid, int64_t ns)
static void clock_update_grandmaster(struct clock *c) static void clock_update_grandmaster(struct clock *c)
{ {
memset(&c->cur, 0, sizeof(c->cur)); memset(&c->cur, 0, sizeof(c->cur));
memset(c->ptl, 0, sizeof(c->ptl));
c->dad.parentPortIdentity.clockIdentity = c->dds.clockIdentity; c->dad.parentPortIdentity.clockIdentity = c->dds.clockIdentity;
c->dad.parentPortIdentity.portNumber = 0; c->dad.parentPortIdentity.portNumber = 0;
c->dad.grandmasterIdentity = c->dds.clockIdentity; c->dad.grandmasterIdentity = c->dds.clockIdentity;
c->dad.grandmasterClockQuality = c->dds.clockQuality; c->dad.grandmasterClockQuality = c->dds.clockQuality;
c->dad.grandmasterPriority1 = c->dds.priority1; c->dad.grandmasterPriority1 = c->dds.priority1;
c->dad.grandmasterPriority2 = c->dds.priority2; c->dad.grandmasterPriority2 = c->dds.priority2;
c->dad.path_length = 0;
c->tds.currentUtcOffset = CURRENT_UTC_OFFSET; c->tds.currentUtcOffset = CURRENT_UTC_OFFSET;
c->tds.currentUtcOffsetValid = FALSE; c->tds.currentUtcOffsetValid = FALSE;
c->tds.leap61 = FALSE; c->tds.leap61 = FALSE;
@ -260,6 +263,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count,
c->dad.parentStats = 0; c->dad.parentStats = 0;
c->dad.observedParentOffsetScaledLogVariance = 0xffff; c->dad.observedParentOffsetScaledLogVariance = 0xffff;
c->dad.observedParentClockPhaseChangeRate = 0x7fffffff; c->dad.observedParentClockPhaseChangeRate = 0x7fffffff;
c->dad.ptl = c->ptl;
for (i = 0; i < ARRAY_SIZE(c->pollfd); i++) { for (i = 0; i < ARRAY_SIZE(c->pollfd); i++) {
c->pollfd[i].fd = -1; c->pollfd[i].fd = -1;

2
ds.h
View File

@ -60,6 +60,8 @@ struct parentDS {
struct ClockQuality grandmasterClockQuality; struct ClockQuality grandmasterClockQuality;
UInteger8 grandmasterPriority2; UInteger8 grandmasterPriority2;
struct ClockIdentity grandmasterIdentity; struct ClockIdentity grandmasterIdentity;
struct ClockIdentity *ptl;
unsigned int path_length;
}; };
#define CURRENT_UTC_OFFSET 33 #define CURRENT_UTC_OFFSET 33

15
tlv.h
View File

@ -123,6 +123,21 @@ struct management_error_status {
Octet data[0]; Octet data[0];
} PACKED; } PACKED;
#define PATH_TRACE_MAX \
((sizeof(struct message_data) - sizeof(struct announce_msg) - sizeof(struct TLV)) / \
sizeof(struct ClockIdentity))
struct path_trace_tlv {
Enumeration16 type;
UInteger16 length;
struct ClockIdentity cid[0];
} PACKED;
static inline unsigned int path_length(struct path_trace_tlv *p)
{
return p->length / sizeof(struct ClockIdentity);
}
/** /**
* Converts recognized value sub-fields into host byte order. * Converts recognized value sub-fields into host byte order.
* @param tlv Pointer to a Type Length Value field. * @param tlv Pointer to a Type Length Value field.