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 <jb...@redhat.com>
---
 pmc_common.c |   12 +++++++++++-
 pmc_common.h |    2 ++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/pmc_common.c b/pmc_common.c
index 266462575bd8..061529e25b83 100644
--- a/pmc_common.c
+++ b/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;
@@ -327,3 +327,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));
+}
diff --git a/pmc_common.h b/pmc_common.h
index 850d85fe13e8..d55dfba56e7c 100644
--- a/pmc_common.h
+++ b/pmc_common.h
@@ -40,5 +40,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
-- 
1.7.6.5


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to