Discussion:
[Linuxptp-devel] [PATCH RFC 0/6] Single field port management requests
Richard Cochran
2013-03-04 19:31:52 UTC
Permalink
This series builds on the previous one and adds support for the
various single field GET requests that apply to a port.

Warning: compile tested only.

Richard Cochran (6):
Add support for the log announce interval management request.
Add support for the announce receipt timeout management request.
Add support for the log sync interval management request.
Add support for the version number management request.
Add support for the delay mechanism management request.
Add support for the log peer delay interval management request.

pmc.c | 40 +++++++++++++++++++++++++++++++++++-----
port.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 5 deletions(-)
--
1.7.2.5
Richard Cochran
2013-03-04 19:31:53 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
pmc.c | 7 ++++++-
port.c | 7 +++++++
2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/pmc.c b/pmc.c
index e8e0510..e163c3a 100644
--- a/pmc.c
+++ b/pmc.c
@@ -89,7 +89,7 @@ struct management_id idtab[] = {
{ "NULL_MANAGEMENT", NULL_MANAGEMENT, null_management },
{ "CLOCK_DESCRIPTION", CLOCK_DESCRIPTION, do_get_action },
{ "PORT_DATA_SET", PORT_DATA_SET, do_get_action },
- { "LOG_ANNOUNCE_INTERVAL", LOG_ANNOUNCE_INTERVAL, not_supported },
+ { "LOG_ANNOUNCE_INTERVAL", LOG_ANNOUNCE_INTERVAL, do_get_action },
{ "ANNOUNCE_RECEIPT_TIMEOUT", ANNOUNCE_RECEIPT_TIMEOUT, not_supported },
{ "LOG_SYNC_INTERVAL", LOG_SYNC_INTERVAL, not_supported },
{ "VERSION_NUMBER", VERSION_NUMBER, not_supported },
@@ -395,6 +395,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
p->logSyncInterval, p->delayMechanism,
p->logMinPdelayReqInterval, p->versionNumber);
break;
+ case LOG_ANNOUNCE_INTERVAL:
+ mtd = (struct management_tlv_datum *) mgt->data;
+ fprintf(fp, "LOG_ANNOUNCE_INTERVAL "
+ IFMT "logAnnounceInterval %hhd", mtd->val);
+ break;
}
out:
fprintf(fp, "\n");
diff --git a/port.c b/port.c
index 1770706..f6e6a9b 100644
--- a/port.c
+++ b/port.c
@@ -447,6 +447,7 @@ static int port_management_get_response(struct port *target,
{
int datalen = 0, err, pdulen, respond = 0;
struct management_tlv *tlv;
+ struct management_tlv_datum *mtd;
struct ptp_message *rsp;
struct portDS *pds;
struct PortIdentity pid = port_identity(target);
@@ -557,6 +558,12 @@ static int port_management_get_response(struct port *target,
datalen = sizeof(*pds);
respond = 1;
break;
+ case LOG_ANNOUNCE_INTERVAL:
+ mtd = (struct management_tlv_datum *) tlv->data;
+ mtd->val = target->logAnnounceInterval;
+ datalen = sizeof(*mtd);
+ respond = 1;
+ break;
}
if (respond) {
if (datalen % 2) {
--
1.7.2.5
Richard Cochran
2013-03-04 19:31:54 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
pmc.c | 7 ++++++-
port.c | 6 ++++++
2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/pmc.c b/pmc.c
index e163c3a..641b507 100644
--- a/pmc.c
+++ b/pmc.c
@@ -90,7 +90,7 @@ struct management_id idtab[] = {
{ "CLOCK_DESCRIPTION", CLOCK_DESCRIPTION, do_get_action },
{ "PORT_DATA_SET", PORT_DATA_SET, do_get_action },
{ "LOG_ANNOUNCE_INTERVAL", LOG_ANNOUNCE_INTERVAL, do_get_action },
- { "ANNOUNCE_RECEIPT_TIMEOUT", ANNOUNCE_RECEIPT_TIMEOUT, not_supported },
+ { "ANNOUNCE_RECEIPT_TIMEOUT", ANNOUNCE_RECEIPT_TIMEOUT, do_get_action },
{ "LOG_SYNC_INTERVAL", LOG_SYNC_INTERVAL, not_supported },
{ "VERSION_NUMBER", VERSION_NUMBER, not_supported },
{ "ENABLE_PORT", ENABLE_PORT, not_supported },
@@ -400,6 +400,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
fprintf(fp, "LOG_ANNOUNCE_INTERVAL "
IFMT "logAnnounceInterval %hhd", mtd->val);
break;
+ case ANNOUNCE_RECEIPT_TIMEOUT:
+ mtd = (struct management_tlv_datum *) mgt->data;
+ fprintf(fp, "ANNOUNCE_RECEIPT_TIMEOUT "
+ IFMT "announceReceiptTimeout %hhu", mtd->val);
+ break;
}
out:
fprintf(fp, "\n");
diff --git a/port.c b/port.c
index f6e6a9b..63b5ebd 100644
--- a/port.c
+++ b/port.c
@@ -564,6 +564,12 @@ static int port_management_get_response(struct port *target,
datalen = sizeof(*mtd);
respond = 1;
break;
+ case ANNOUNCE_RECEIPT_TIMEOUT:
+ mtd = (struct management_tlv_datum *) tlv->data;
+ mtd->val = target->announceReceiptTimeout;
+ datalen = sizeof(*mtd);
+ respond = 1;
+ break;
}
if (respond) {
if (datalen % 2) {
--
1.7.2.5
Richard Cochran
2013-03-04 19:31:55 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
pmc.c | 7 ++++++-
port.c | 6 ++++++
2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/pmc.c b/pmc.c
index 641b507..36876dc 100644
--- a/pmc.c
+++ b/pmc.c
@@ -91,7 +91,7 @@ struct management_id idtab[] = {
{ "PORT_DATA_SET", PORT_DATA_SET, do_get_action },
{ "LOG_ANNOUNCE_INTERVAL", LOG_ANNOUNCE_INTERVAL, do_get_action },
{ "ANNOUNCE_RECEIPT_TIMEOUT", ANNOUNCE_RECEIPT_TIMEOUT, do_get_action },
- { "LOG_SYNC_INTERVAL", LOG_SYNC_INTERVAL, not_supported },
+ { "LOG_SYNC_INTERVAL", LOG_SYNC_INTERVAL, do_get_action },
{ "VERSION_NUMBER", VERSION_NUMBER, not_supported },
{ "ENABLE_PORT", ENABLE_PORT, not_supported },
{ "DISABLE_PORT", DISABLE_PORT, not_supported },
@@ -405,6 +405,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
fprintf(fp, "ANNOUNCE_RECEIPT_TIMEOUT "
IFMT "announceReceiptTimeout %hhu", mtd->val);
break;
+ case LOG_SYNC_INTERVAL:
+ mtd = (struct management_tlv_datum *) mgt->data;
+ fprintf(fp, "ANNOUNCE_RECEIPT_TIMEOUT "
+ IFMT "logSyncInterval %hhd", mtd->val);
+ break;
}
out:
fprintf(fp, "\n");
diff --git a/port.c b/port.c
index 63b5ebd..7699fb7 100644
--- a/port.c
+++ b/port.c
@@ -570,6 +570,12 @@ static int port_management_get_response(struct port *target,
datalen = sizeof(*mtd);
respond = 1;
break;
+ case LOG_SYNC_INTERVAL:
+ mtd = (struct management_tlv_datum *) tlv->data;
+ mtd->val = target->logSyncInterval;
+ datalen = sizeof(*mtd);
+ respond = 1;
+ break;
}
if (respond) {
if (datalen % 2) {
--
1.7.2.5
Richard Cochran
2013-03-04 19:31:56 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
pmc.c | 7 ++++++-
port.c | 6 ++++++
2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/pmc.c b/pmc.c
index 36876dc..a5633b5 100644
--- a/pmc.c
+++ b/pmc.c
@@ -92,7 +92,7 @@ struct management_id idtab[] = {
{ "LOG_ANNOUNCE_INTERVAL", LOG_ANNOUNCE_INTERVAL, do_get_action },
{ "ANNOUNCE_RECEIPT_TIMEOUT", ANNOUNCE_RECEIPT_TIMEOUT, do_get_action },
{ "LOG_SYNC_INTERVAL", LOG_SYNC_INTERVAL, do_get_action },
- { "VERSION_NUMBER", VERSION_NUMBER, not_supported },
+ { "VERSION_NUMBER", VERSION_NUMBER, do_get_action },
{ "ENABLE_PORT", ENABLE_PORT, not_supported },
{ "DISABLE_PORT", DISABLE_PORT, not_supported },
{ "UNICAST_NEGOTIATION_ENABLE", UNICAST_NEGOTIATION_ENABLE, not_supported },
@@ -410,6 +410,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
fprintf(fp, "ANNOUNCE_RECEIPT_TIMEOUT "
IFMT "logSyncInterval %hhd", mtd->val);
break;
+ case VERSION_NUMBER:
+ mtd = (struct management_tlv_datum *) mgt->data;
+ fprintf(fp, "VERSION_NUMBER "
+ IFMT "versionNumber %hhu", mtd->val);
+ break;
}
out:
fprintf(fp, "\n");
diff --git a/port.c b/port.c
index 7699fb7..f6b11db 100644
--- a/port.c
+++ b/port.c
@@ -576,6 +576,12 @@ static int port_management_get_response(struct port *target,
datalen = sizeof(*mtd);
respond = 1;
break;
+ case VERSION_NUMBER:
+ mtd = (struct management_tlv_datum *) tlv->data;
+ mtd->val = target->versionNumber;
+ datalen = sizeof(*mtd);
+ respond = 1;
+ break;
}
if (respond) {
if (datalen % 2) {
--
1.7.2.5
Richard Cochran
2013-03-04 19:31:57 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
pmc.c | 7 ++++++-
port.c | 9 +++++++++
2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/pmc.c b/pmc.c
index a5633b5..eebb92d 100644
--- a/pmc.c
+++ b/pmc.c
@@ -101,7 +101,7 @@ struct management_id idtab[] = {
{ "ACCEPTABLE_MASTER_TABLE_ENABLED", ACCEPTABLE_MASTER_TABLE_ENABLED, not_supported },
{ "ALTERNATE_MASTER", ALTERNATE_MASTER, not_supported },
{ "TRANSPARENT_CLOCK_PORT_DATA_SET", TRANSPARENT_CLOCK_PORT_DATA_SET, not_supported },
- { "DELAY_MECHANISM", DELAY_MECHANISM, not_supported },
+ { "DELAY_MECHANISM", DELAY_MECHANISM, do_get_action },
{ "LOG_MIN_PDELAY_REQ_INTERVAL", LOG_MIN_PDELAY_REQ_INTERVAL, not_supported },
};

@@ -415,6 +415,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
fprintf(fp, "VERSION_NUMBER "
IFMT "versionNumber %hhu", mtd->val);
break;
+ case DELAY_MECHANISM:
+ mtd = (struct management_tlv_datum *) mgt->data;
+ fprintf(fp, "DELAY_MECHANISM "
+ IFMT "delayMechanism %hhu", mtd->val);
+ break;
}
out:
fprintf(fp, "\n");
diff --git a/port.c b/port.c
index f6b11db..7d1165a 100644
--- a/port.c
+++ b/port.c
@@ -582,6 +582,15 @@ static int port_management_get_response(struct port *target,
datalen = sizeof(*mtd);
respond = 1;
break;
+ case DELAY_MECHANISM:
+ mtd = (struct management_tlv_datum *) tlv->data;
+ if (target->delayMechanism)
+ mtd->val = target->delayMechanism;
+ else
+ mtd->val = DM_E2E;
+ datalen = sizeof(*mtd);
+ respond = 1;
+ break;
}
if (respond) {
if (datalen % 2) {
--
1.7.2.5
Richard Cochran
2013-03-04 19:31:58 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
pmc.c | 5 +++++
port.c | 6 ++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/pmc.c b/pmc.c
index eebb92d..8f16463 100644
--- a/pmc.c
+++ b/pmc.c
@@ -420,6 +420,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
fprintf(fp, "DELAY_MECHANISM "
IFMT "delayMechanism %hhu", mtd->val);
break;
+ case LOG_MIN_PDELAY_REQ_INTERVAL:
+ mtd = (struct management_tlv_datum *) mgt->data;
+ fprintf(fp, "LOG_MIN_PDELAY_REQ_INTERVAL "
+ IFMT "logMinPdelayReqInterval %hhd", mtd->val);
+ break;
}
out:
fprintf(fp, "\n");
diff --git a/port.c b/port.c
index 7d1165a..1331388 100644
--- a/port.c
+++ b/port.c
@@ -591,6 +591,12 @@ static int port_management_get_response(struct port *target,
datalen = sizeof(*mtd);
respond = 1;
break;
+ case LOG_MIN_PDELAY_REQ_INTERVAL:
+ mtd = (struct management_tlv_datum *) tlv->data;
+ mtd->val = target->logMinPdelayReqInterval;
+ datalen = sizeof(*mtd);
+ respond = 1;
+ break;
}
if (respond) {
if (datalen % 2) {
--
1.7.2.5
Ken ICHIKAWA
2013-03-21 06:56:43 UTC
Permalink
Why don't you enable LOG_MIN_PDELAY_REQ_INTERVAL management request?
---
pmc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pmc.c b/pmc.c
index ad239e0..732297a 100644
--- a/pmc.c
+++ b/pmc.c
@@ -102,7 +102,7 @@ struct management_id idtab[] = {
{ "ALTERNATE_MASTER", ALTERNATE_MASTER, not_supported },
{ "TRANSPARENT_CLOCK_PORT_DATA_SET", TRANSPARENT_CLOCK_PORT_DATA_SET, not_supported },
{ "DELAY_MECHANISM", DELAY_MECHANISM, do_get_action },
- { "LOG_MIN_PDELAY_REQ_INTERVAL", LOG_MIN_PDELAY_REQ_INTERVAL, not_supported },
+ { "LOG_MIN_PDELAY_REQ_INTERVAL", LOG_MIN_PDELAY_REQ_INTERVAL, do_get_action },
};

static char *action_string[] = {
--
1.7.1
Richard Cochran
2013-03-28 06:20:22 UTC
Permalink
Post by Ken ICHIKAWA
Why don't you enable LOG_MIN_PDELAY_REQ_INTERVAL management request?
Applied.

BTW, this patch has been corrupted by extra leading spaces on the
lines marked below. I fixed it up for you, but please be more careful
next time.
Post by Ken ICHIKAWA
---
pmc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pmc.c b/pmc.c
index ad239e0..732297a 100644
--- a/pmc.c
+++ b/pmc.c
@@ -102,7 +102,7 @@ struct management_id idtab[] = {
+--- There is an extra column of spaces ...
|
v
Post by Ken ICHIKAWA
{ "ALTERNATE_MASTER", ALTERNATE_MASTER, not_supported },
{ "TRANSPARENT_CLOCK_PORT_DATA_SET", TRANSPARENT_CLOCK_PORT_DATA_SET, not_supported },
{ "DELAY_MECHANISM", DELAY_MECHANISM, do_get_action },
- { "LOG_MIN_PDELAY_REQ_INTERVAL", LOG_MIN_PDELAY_REQ_INTERVAL, not_supported },
+ { "LOG_MIN_PDELAY_REQ_INTERVAL", LOG_MIN_PDELAY_REQ_INTERVAL, do_get_action },
};
static char *action_string[] = {
^
|
+--- all the way until here.
Post by Ken ICHIKAWA
--
1.7.1
Thanks,
Richard
Ken ICHIKAWA
2013-03-28 07:08:47 UTC
Permalink
Post by Richard Cochran
Post by Ken ICHIKAWA
Why don't you enable LOG_MIN_PDELAY_REQ_INTERVAL management request?
Applied.
BTW, this patch has been corrupted by extra leading spaces on the
lines marked below. I fixed it up for you, but please be more careful
next time.
I'm sorry for that.
At the moment, I don't know why that occurred,
but anyway I'll pay attention to that next time.
And thank you for the fix.

Ken Ichikawa

Richard Cochran
2013-03-05 19:30:49 UTC
Permalink
Post by Richard Cochran
Warning: compile tested only.
So I got around to testing this, too, and it appears to work fine.

Thanks,
Richard
Loading...