TLV_PORT_PROPERTIES_NP messages serve for querying of port properties, such as timestamp type and, prominently, netdevice name associated with the port. pmc however does not support this query, which makes it difficult to access this information e.g. from scripts. Add this support to pmc.
Signed-off-by: Mykola Zhuravel <myk...@mellanox.com> Signed-off-by: Petr Machata <pe...@mellanox.com> --- pmc.8 | 2 ++ pmc.c | 16 ++++++++++++++++ pmc_common.c | 1 + 3 files changed, 19 insertions(+) diff --git a/pmc.8 b/pmc.8 index acf2d90..e0ab5ac 100644 --- a/pmc.8 +++ b/pmc.8 @@ -193,6 +193,8 @@ The MAC address to which PTP management messages should be sent. Relevant only w .TP .B PORT_DATA_SET_NP .TP +.B PORT_PROPERTIES_NP +.TP .B PORT_STATS_NP .TP .B PRIORITY1 diff --git a/pmc.c b/pmc.c index 868fc2a..4e6043b 100644 --- a/pmc.c +++ b/pmc.c @@ -69,6 +69,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp) struct tlv_extra *extra; struct portDS *p; struct port_ds_np *pnp; + struct port_properties_np *ppn; struct port_stats_np *pcp; if (msg_type(msg) != MANAGEMENT) { @@ -323,6 +324,21 @@ static void pmc_show(struct ptp_message *msg, FILE *fp) pnp->neighborPropDelayThresh, pnp->asCapable ? 1 : 0); break; + case TLV_PORT_PROPERTIES_NP: + ppn = (struct port_properties_np *) mgt->data; + if (ppn->port_state > PS_SLAVE) { + ppn->port_state = 0; + } + fprintf(fp, "PORT_PROPERTIES_NP " + IFMT "portIdentity %s" + IFMT "portState %s" + IFMT "timestamping %s" + IFMT "interface %s", + pid2str(&ppn->portIdentity), + ps_str[ppn->port_state], + ts_str(ppn->timestamping), + text2str(&ppn->interface)); + break; case TLV_PORT_STATS_NP: pcp = (struct port_stats_np *) mgt->data; fprintf(fp, "PORT_STATS_NP " diff --git a/pmc_common.c b/pmc_common.c index 592cc93..46aac30 100644 --- a/pmc_common.c +++ b/pmc_common.c @@ -121,6 +121,7 @@ struct management_id idtab[] = { { "LOG_MIN_PDELAY_REQ_INTERVAL", TLV_LOG_MIN_PDELAY_REQ_INTERVAL, do_get_action }, { "PORT_DATA_SET_NP", TLV_PORT_DATA_SET_NP, do_set_action }, { "PORT_STATS_NP", TLV_PORT_STATS_NP, do_get_action }, + { "PORT_PROPERTIES_NP", TLV_PORT_PROPERTIES_NP, do_get_action }, }; static void do_get_action(struct pmc *pmc, int action, int index, char *str) -- 2.20.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel