pmc_common: easy way to set port and broadcast target
Implement pmc_target_port to set a port number, leaving clock identity unchanged, and pmc_target_all to set clock identity and port number to all 1's. Signed-off-by: Jiri Benc <jbenc@redhat.com>master
parent
506271acac
commit
48f6a31cc3
12
pmc_common.c
12
pmc_common.c
|
@ -78,7 +78,7 @@ struct pmc *pmc_create(enum transport_type transport_type, const char *iface_nam
|
|||
goto failed;
|
||||
}
|
||||
pmc->port_identity.portNumber = 1;
|
||||
memset(&pmc->target, 0xff, sizeof(pmc->target));
|
||||
pmc_target_all(pmc);
|
||||
|
||||
pmc->boundary_hops = boundary_hops;
|
||||
pmc->domain_number = domain_number;
|
||||
|
@ -325,3 +325,13 @@ int pmc_target(struct pmc *pmc, struct PortIdentity *pid)
|
|||
pmc->target = *pid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pmc_target_port(struct pmc *pmc, UInteger16 portNumber)
|
||||
{
|
||||
pmc->target.portNumber = portNumber;
|
||||
}
|
||||
|
||||
void pmc_target_all(struct pmc *pmc)
|
||||
{
|
||||
memset(&pmc->target, 0xff, sizeof(pmc->target));
|
||||
}
|
||||
|
|
|
@ -41,5 +41,7 @@ int pmc_send_set_action(struct pmc *pmc, int id, void *data, int datasize);
|
|||
struct ptp_message *pmc_recv(struct pmc *pmc);
|
||||
|
||||
int pmc_target(struct pmc *pmc, struct PortIdentity *pid);
|
||||
void pmc_target_port(struct pmc *pmc, UInteger16 portNumber);
|
||||
void pmc_target_all(struct pmc *pmc);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue