pmc: Support querying TLV_PORT_PROPERTIES_NP
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 <mykola@mellanox.com> Signed-off-by: Petr Machata <petrm@mellanox.com>master
parent
f9f00d8fe8
commit
7985634179
2
pmc.8
2
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
|
||||
|
|
16
pmc.c
16
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 "
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue