Discussion:
[Linuxptp-devel] [PATCH RFC 0/7] Prepare for TC, Batch II
Richard Cochran
2016-04-09 19:31:31 UTC
Permalink
This is the second (and last) series in preparation for a Transparent
Clock implementation.

Patches 1-3 and 5 make minor changes in the clock interface.

Patches 4 and 7 move blocks of clock initialization logic out of
ptp4l.c:main() and into clock.c:clock_create().

Patch 6 follows up on patch 2 and lets the caller of clock_create
specify the desired type of clock. Currently we have only OC and BC,
but later on, we will add TC support.

Review and comments are welcome.

Thanks,
Richard


Richard Cochran (7):
Move the clock type enumeration into the clock header.
clock: offer a method to get the type rather than the number of ports.
clock: offer a method to get the first port in the list.
Perform the time stamping mode check in the clock module.
config: count the interfaces as they are added.
clock: specify type at creation time.
Let the clock code figure the PHC index.

clock.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
clock.h | 29 ++++++++++++++++++-----
config.c | 2 ++
config.h | 1 +
port.c | 7 +-----
ptp4l.c | 64 +++-----------------------------------------------
tlv.h | 8 -------
7 files changed, 106 insertions(+), 86 deletions(-)
--
2.1.4
Richard Cochran
2016-04-09 19:31:34 UTC
Permalink
This function will allow the TC code to iterate over the ports without
calling into the clock logic.

Signed-off-by: Richard Cochran <***@gmail.com>
---
clock.c | 5 +++++
clock.h | 7 +++++++
2 files changed, 12 insertions(+)

diff --git a/clock.c b/clock.c
index d8a2616..ab238fb 100644
--- a/clock.c
+++ b/clock.c
@@ -1066,6 +1066,11 @@ UInteger8 clock_domain_number(struct clock *c)
return c->dds.domainNumber;
}

+struct port *clock_first_port(struct clock *c)
+{
+ return LIST_FIRST(&c->ports);
+}
+
void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f)
{
c->status.cumulativeScaledRateOffset = f->cumulativeScaledRateOffset;
diff --git a/clock.h b/clock.h
index 47863dc..ec38146 100644
--- a/clock.h
+++ b/clock.h
@@ -104,6 +104,13 @@ void clock_destroy(struct clock *c);
UInteger8 clock_domain_number(struct clock *c);

/**
+ * Obtains a reference to the first port in the clock's list.
+ * @param c The clock instance.
+ * @return A pointer to a port, or NULL if no ports are present.
+ */
+struct port *clock_first_port(struct clock *c);
+
+/**
* Provide the follow_up info TLV from a slave port.
* @param c The clock instance.
* @param f Pointer to the TLV.
--
2.1.4
Richard Cochran
2016-04-09 19:31:35 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
clock.c | 31 +++++++++++++++++++++++++++++++
ptp4l.c | 34 +---------------------------------
2 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/clock.c b/clock.c
index ab238fb..d18cab0 100644
--- a/clock.c
+++ b/clock.c
@@ -17,6 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <errno.h>
+#include <linux/net_tstamp.h>
#include <poll.h>
#include <stdlib.h>
#include <string.h>
@@ -805,6 +806,7 @@ struct clock *clock_create(struct config *config, int phc_index)
int fadj = 0, max_adj = 0, sw_ts = timestamping == TS_SOFTWARE ? 1 : 0;
enum servo_type servo = config_get_int(config, NULL, "clock_servo");
struct clock *c = &the_clock;
+ int required_modes = 0;
struct port *p;
unsigned char oui[OUI_LEN];
char phc[32], *tmp;
@@ -892,6 +894,35 @@ struct clock *clock_create(struct config *config, int phc_index)
}
}

+ /* Check the time stamping mode on each interface. */
+ switch (config_get_int(config, NULL, "time_stamping")) {
+ case TS_SOFTWARE:
+ required_modes |= SOF_TIMESTAMPING_TX_SOFTWARE |
+ SOF_TIMESTAMPING_RX_SOFTWARE |
+ SOF_TIMESTAMPING_SOFTWARE;
+ break;
+ case TS_LEGACY_HW:
+ required_modes |= SOF_TIMESTAMPING_TX_HARDWARE |
+ SOF_TIMESTAMPING_RX_HARDWARE |
+ SOF_TIMESTAMPING_SYS_HARDWARE;
+ break;
+ case TS_HARDWARE:
+ case TS_ONESTEP:
+ required_modes |= SOF_TIMESTAMPING_TX_HARDWARE |
+ SOF_TIMESTAMPING_RX_HARDWARE |
+ SOF_TIMESTAMPING_RAW_HARDWARE;
+ break;
+ }
+ STAILQ_FOREACH(iface, &config->interfaces, list) {
+ if (iface->ts_info.valid &&
+ ((iface->ts_info.so_timestamping & required_modes) != required_modes)) {
+ pr_err("interface '%s' does not support "
+ "requested timestamping mode", iface->name);
+ return NULL;
+ }
+ }
+
+ iface = STAILQ_FIRST(&config->interfaces);
if (generate_clock_identity(&c->dds.clockIdentity, iface->name)) {
pr_err("failed to generate a clock identity");
return NULL;
diff --git a/ptp4l.c b/ptp4l.c
index 0eb2490..d48324b 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -22,7 +22,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <linux/net_tstamp.h>

#include "clock.h"
#include "config.h"
@@ -78,7 +77,7 @@ int main(int argc, char *argv[])
struct interface *iface;
struct clock *clock = NULL;
struct config *cfg;
- int phc_index = -1, print_level, required_modes = 0;
+ int phc_index = -1, print_level;

if (handle_term_signals())
return -1;
@@ -198,37 +197,6 @@ int main(int argc, char *argv[])
goto out;
}

- switch (config_get_int(cfg, NULL, "time_stamping")) {
- case TS_SOFTWARE:
- required_modes |= SOF_TIMESTAMPING_TX_SOFTWARE |
- SOF_TIMESTAMPING_RX_SOFTWARE |
- SOF_TIMESTAMPING_SOFTWARE;
- break;
- case TS_LEGACY_HW:
- required_modes |= SOF_TIMESTAMPING_TX_HARDWARE |
- SOF_TIMESTAMPING_RX_HARDWARE |
- SOF_TIMESTAMPING_SYS_HARDWARE;
- break;
- case TS_HARDWARE:
- case TS_ONESTEP:
- required_modes |= SOF_TIMESTAMPING_TX_HARDWARE |
- SOF_TIMESTAMPING_RX_HARDWARE |
- SOF_TIMESTAMPING_RAW_HARDWARE;
- break;
- }
-
- /* Init interface configs and check whether timestamping mode is
- * supported. */
- STAILQ_FOREACH(iface, &cfg->interfaces, list) {
- if (iface->ts_info.valid &&
- ((iface->ts_info.so_timestamping & required_modes) != required_modes)) {
- fprintf(stderr, "interface '%s' does not support "
- "requested timestamping mode.\n",
- iface->name);
- goto out;
- }
- }
-
/* determine PHC Clock index */
iface = STAILQ_FIRST(&cfg->interfaces);
if (config_get_int(cfg, NULL, "free_running")) {
--
2.1.4
Richard Cochran
2016-04-09 19:31:32 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
clock.h | 8 ++++++++
tlv.h | 8 --------
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/clock.h b/clock.h
index e096dfa..d866762 100644
--- a/clock.h
+++ b/clock.h
@@ -34,6 +34,14 @@ struct ptp_message; /*forward declaration*/
/** Opaque type. */
struct clock;

+enum clock_type {
+ CLOCK_TYPE_ORDINARY = 0x8000,
+ CLOCK_TYPE_BOUNDARY = 0x4000,
+ CLOCK_TYPE_P2P = 0x2000,
+ CLOCK_TYPE_E2E = 0x1000,
+ CLOCK_TYPE_MANAGEMENT = 0x0800,
+};
+
/**
* Obtains a reference to the best foreign master of a clock.
* @param c The clock instance.
diff --git a/tlv.h b/tlv.h
index 504e269..c345afe 100644
--- a/tlv.h
+++ b/tlv.h
@@ -213,14 +213,6 @@ struct port_properties_np {
struct PTPText interface;
} PACKED;

-enum clock_type {
- CLOCK_TYPE_ORDINARY = 0x8000,
- CLOCK_TYPE_BOUNDARY = 0x4000,
- CLOCK_TYPE_P2P = 0x2000,
- CLOCK_TYPE_E2E = 0x1000,
- CLOCK_TYPE_MANAGEMENT = 0x0800,
-};
-
#define PROFILE_ID_LEN 6

struct mgmt_clock_description {
--
2.1.4
Richard Cochran
2016-04-09 19:31:33 UTC
Permalink
The port code is not interested in the number of ports but rather the
clock type. Since the polymorphic clock object will be able to report
its own type, this patch changes the clock interface accordingly.

Signed-off-by: Richard Cochran <***@gmail.com>
---
clock.c | 7 +++++--
clock.h | 6 +++---
port.c | 7 +------
3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/clock.c b/clock.c
index 8154087..d8a2616 100644
--- a/clock.c
+++ b/clock.c
@@ -1628,9 +1628,12 @@ struct clock_description *clock_description(struct clock *c)
return &c->desc;
}

-int clock_num_ports(struct clock *c)
+enum clock_type clock_type(struct clock *c)
{
- return c->nports;
+ if (c->nports > 1) {
+ return CLOCK_TYPE_BOUNDARY;
+ }
+ return CLOCK_TYPE_ORDINARY;
}

void clock_check_ts(struct clock *c, struct timespec ts)
diff --git a/clock.h b/clock.h
index d866762..47863dc 100644
--- a/clock.h
+++ b/clock.h
@@ -267,11 +267,11 @@ void clock_update_time_properties(struct clock *c, struct timePropertiesDS tds);
struct clock_description *clock_description(struct clock *c);

/**
- * Obtain the number of ports a clock has, excluding the UDS port.
+ * Obtain the type of a clock.
* @param c The clock instance.
- * @return The number of ports.
+ * @return One of the @ref clock_type enumeration values.
*/
-int clock_num_ports(struct clock *c);
+enum clock_type clock_type(struct clock *c);

/**
* Perform a sanity check on a time stamp made by a clock.
diff --git a/port.c b/port.c
index 93a79b1..161157c 100644
--- a/port.c
+++ b/port.c
@@ -706,12 +706,7 @@ static int port_management_fill_response(struct port *target,
buf = tlv->data;
cd->clockType = (UInteger16 *) buf;
buf += sizeof(*cd->clockType);
- if (clock_num_ports(target->clock) > 1) {
- *cd->clockType = CLOCK_TYPE_BOUNDARY;
- } else {
- *cd->clockType = CLOCK_TYPE_ORDINARY;
- }
-
+ *cd->clockType = clock_type(target->clock);
cd->physicalLayerProtocol = (struct PTPText *) buf;
switch(transport_type(target->trp)) {
case TRANS_UDP_IPV4:
--
2.1.4
Richard Cochran
2016-04-09 19:31:36 UTC
Permalink
This information is useful to the various clock types.

Signed-off-by: Richard Cochran <***@gmail.com>
---
config.c | 2 ++
config.h | 1 +
2 files changed, 3 insertions(+)

diff --git a/config.c b/config.c
index 7bb3b05..80fa255 100644
--- a/config.c
+++ b/config.c
@@ -607,6 +607,8 @@ struct interface *config_create_interface(char *name, struct config *cfg)
strncpy(iface->name, name, MAX_IFNAME_SIZE);
sk_get_ts_info(iface->name, &iface->ts_info);
STAILQ_INSERT_TAIL(&cfg->interfaces, iface, list);
+ cfg->n_interfaces++;
+
return iface;
}

diff --git a/config.h b/config.h
index ad057e9..b02bde6 100644
--- a/config.h
+++ b/config.h
@@ -41,6 +41,7 @@ struct interface {
struct config {
/* configured interfaces */
STAILQ_HEAD(interfaces_head, interface) interfaces;
+ int n_interfaces;

/* hash of all non-legacy items */
struct hash *htab;
--
2.1.4
Richard Cochran
2016-04-09 19:31:37 UTC
Permalink
Store the type in the clock object explicitly.

Signed-off-by: Richard Cochran <***@gmail.com>
---
clock.c | 20 +++++++++++++++-----
clock.h | 4 +++-
ptp4l.c | 3 ++-
3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/clock.c b/clock.c
index d18cab0..17c9687 100644
--- a/clock.c
+++ b/clock.c
@@ -74,6 +74,7 @@ struct clock_subscriber {
};

struct clock {
+ enum clock_type type;
struct config *config;
clockid_t clkid;
struct servo *servo;
@@ -799,7 +800,8 @@ static void clock_remove_port(struct clock *c, struct port *p)
port_close(p);
}

-struct clock *clock_create(struct config *config, int phc_index)
+struct clock *clock_create(enum clock_type type, struct config *config,
+ int phc_index)
{
enum timestamp_type timestamping =
config_get_int(config, NULL, "time_stamping");
@@ -821,6 +823,17 @@ struct clock *clock_create(struct config *config, int phc_index)
if (c->nports)
clock_destroy(c);

+ switch (type) {
+ case CLOCK_TYPE_ORDINARY:
+ case CLOCK_TYPE_BOUNDARY:
+ c->type = type;
+ break;
+ case CLOCK_TYPE_P2P:
+ case CLOCK_TYPE_E2E:
+ case CLOCK_TYPE_MANAGEMENT:
+ return NULL;
+ }
+
/* Initialize the defaultDS. */
c->dds.clockQuality.clockClass =
config_get_int(config, NULL, "clockClass");
@@ -1666,10 +1679,7 @@ struct clock_description *clock_description(struct clock *c)

enum clock_type clock_type(struct clock *c)
{
- if (c->nports > 1) {
- return CLOCK_TYPE_BOUNDARY;
- }
- return CLOCK_TYPE_ORDINARY;
+ return c->type;
}

void clock_check_ts(struct clock *c, struct timespec ts)
diff --git a/clock.h b/clock.h
index ec38146..d4a57e9 100644
--- a/clock.h
+++ b/clock.h
@@ -76,12 +76,14 @@ struct config *clock_config(struct clock *c);
* Create a clock instance. There can only be one clock in any system,
* so subsequent calls will destroy the previous clock instance.
*
+ * @param type Specifies which type of clock to create.
* @param config Pointer to the configuration database.
* @param phc_index PTP hardware clock device to use.
* Pass -1 to select CLOCK_REALTIME.
* @return A pointer to the single global clock instance.
*/
-struct clock *clock_create(struct config *config, int phc_index);
+struct clock *clock_create(enum clock_type type, struct config *config,
+ int phc_index);

/**
* Obtains a clock's default data set.
diff --git a/ptp4l.c b/ptp4l.c
index d48324b..c3694b0 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -222,7 +222,8 @@ int main(int argc, char *argv[])
pr_info("selected /dev/ptp%d as PTP clock", phc_index);
}

- clock = clock_create(cfg, phc_index);
+ clock = clock_create(cfg->n_interfaces > 1 ? CLOCK_TYPE_BOUNDARY :
+ CLOCK_TYPE_ORDINARY, cfg, phc_index);
if (!clock) {
fprintf(stderr, "failed to create a clock\n");
goto out;
--
2.1.4
Richard Cochran
2016-04-09 19:31:38 UTC
Permalink
The code that determines the index of the PHC device is useful to all
kinds of clock devices.

Signed-off-by: Richard Cochran <***@gmail.com>
---
clock.c | 30 ++++++++++++++++++++++++++----
clock.h | 6 +++---
ptp4l.c | 31 ++-----------------------------
3 files changed, 31 insertions(+), 36 deletions(-)

diff --git a/clock.c b/clock.c
index 17c9687..c59046a 100644
--- a/clock.c
+++ b/clock.c
@@ -801,19 +801,18 @@ static void clock_remove_port(struct clock *c, struct port *p)
}

struct clock *clock_create(enum clock_type type, struct config *config,
- int phc_index)
+ const char *phc_device)
{
enum timestamp_type timestamping =
config_get_int(config, NULL, "time_stamping");
int fadj = 0, max_adj = 0, sw_ts = timestamping == TS_SOFTWARE ? 1 : 0;
enum servo_type servo = config_get_int(config, NULL, "clock_servo");
+ int phc_index, required_modes = 0;
struct clock *c = &the_clock;
- int required_modes = 0;
struct port *p;
unsigned char oui[OUI_LEN];
char phc[32], *tmp;
- struct interface *udsif = &c->uds_interface;
- struct interface *iface = STAILQ_FIRST(&config->interfaces);
+ struct interface *iface, *udsif = &c->uds_interface;
struct timespec ts;
int sfl;

@@ -936,6 +935,29 @@ struct clock *clock_create(enum clock_type type, struct config *config,
}

iface = STAILQ_FIRST(&config->interfaces);
+
+ /* determine PHC Clock index */
+ if (config_get_int(config, NULL, "free_running")) {
+ phc_index = -1;
+ } else if (config_get_int(config, NULL, "time_stamping") == TS_SOFTWARE ||
+ config_get_int(config, NULL, "time_stamping") == TS_LEGACY_HW) {
+ phc_index = -1;
+ } else if (phc_device) {
+ if (1 != sscanf(phc_device, "/dev/ptp%d", &phc_index)) {
+ pr_err("bad ptp device string");
+ return NULL;
+ }
+ } else if (iface->ts_info.valid) {
+ phc_index = iface->ts_info.phc_index;
+ } else {
+ pr_err("PTP device not specified and automatic determination"
+ " is not supported. Please specify PTP device.");
+ return NULL;
+ }
+ if (phc_index >= 0) {
+ pr_info("selected /dev/ptp%d as PTP clock", phc_index);
+ }
+
if (generate_clock_identity(&c->dds.clockIdentity, iface->name)) {
pr_err("failed to generate a clock identity");
return NULL;
diff --git a/clock.h b/clock.h
index d4a57e9..fcd9328 100644
--- a/clock.h
+++ b/clock.h
@@ -78,12 +78,12 @@ struct config *clock_config(struct clock *c);
*
* @param type Specifies which type of clock to create.
* @param config Pointer to the configuration database.
- * @param phc_index PTP hardware clock device to use.
- * Pass -1 to select CLOCK_REALTIME.
+ * @param phc_device PTP hardware clock device to use. Pass NULL for automatic
+ * selection based on the network interface.
* @return A pointer to the single global clock instance.
*/
struct clock *clock_create(enum clock_type type, struct config *config,
- int phc_index);
+ const char *phc_device);

/**
* Obtains a clock's default data set.
diff --git a/ptp4l.c b/ptp4l.c
index c3694b0..a87e7e6 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -73,11 +73,9 @@ static void usage(char *progname)
int main(int argc, char *argv[])
{
char *config = NULL, *req_phc = NULL, *progname;
- int c, err = -1;
- struct interface *iface;
+ int c, err = -1, print_level;
struct clock *clock = NULL;
struct config *cfg;
- int phc_index = -1, print_level;

if (handle_term_signals())
return -1;
@@ -197,33 +195,8 @@ int main(int argc, char *argv[])
goto out;
}

- /* determine PHC Clock index */
- iface = STAILQ_FIRST(&cfg->interfaces);
- if (config_get_int(cfg, NULL, "free_running")) {
- phc_index = -1;
- } else if (config_get_int(cfg, NULL, "time_stamping") == TS_SOFTWARE ||
- config_get_int(cfg, NULL, "time_stamping") == TS_LEGACY_HW) {
- phc_index = -1;
- } else if (req_phc) {
- if (1 != sscanf(req_phc, "/dev/ptp%d", &phc_index)) {
- fprintf(stderr, "bad ptp device string\n");
- goto out;
- }
- } else if (iface->ts_info.valid) {
- phc_index = iface->ts_info.phc_index;
- } else {
- fprintf(stderr, "ptp device not specified and\n"
- "automatic determination is not\n"
- "supported. please specify ptp device\n");
- goto out;
- }
-
- if (phc_index >= 0) {
- pr_info("selected /dev/ptp%d as PTP clock", phc_index);
- }
-
clock = clock_create(cfg->n_interfaces > 1 ? CLOCK_TYPE_BOUNDARY :
- CLOCK_TYPE_ORDINARY, cfg, phc_index);
+ CLOCK_TYPE_ORDINARY, cfg, req_phc);
if (!clock) {
fprintf(stderr, "failed to create a clock\n");
goto out;
--
2.1.4
Keller, Jacob E
2016-04-11 17:31:49 UTC
Permalink
Hi,
-----Original Message-----
Sent: Saturday, April 09, 2016 12:32 PM
Subject: [Linuxptp-devel] [PATCH RFC 7/7] Let the clock code figure the PHC
index.
The code that determines the index of the PHC device is useful to all
kinds of clock devices.
---
clock.c | 30 ++++++++++++++++++++++++++----
clock.h | 6 +++---
ptp4l.c | 31 ++-----------------------------
3 files changed, 31 insertions(+), 36 deletions(-)
diff --git a/clock.c b/clock.c
index 17c9687..c59046a 100644
--- a/clock.c
+++ b/clock.c
@@ -801,19 +801,18 @@ static void clock_remove_port(struct clock *c, struct port *p)
}
struct clock *clock_create(enum clock_type type, struct config *config,
- int phc_index)
+ const char *phc_device)
{
enum timestamp_type timestamping =
config_get_int(config, NULL, "time_stamping");
int fadj = 0, max_adj = 0, sw_ts = timestamping == TS_SOFTWARE ? 1 : 0;
enum servo_type servo = config_get_int(config, NULL,
"clock_servo");
+ int phc_index, required_modes = 0;
struct clock *c = &the_clock;
- int required_modes = 0;
struct port *p;
unsigned char oui[OUI_LEN];
char phc[32], *tmp;
- struct interface *udsif = &c->uds_interface;
- struct interface *iface = STAILQ_FIRST(&config->interfaces);
+ struct interface *iface, *udsif = &c->uds_interface;
struct timespec ts;
int sfl;
@@ -936,6 +935,29 @@ struct clock *clock_create(enum clock_type type,
struct config *config,
}
iface = STAILQ_FIRST(&config->interfaces);
+
+ /* determine PHC Clock index */
+ if (config_get_int(config, NULL, "free_running")) {
+ phc_index = -1;
+ } else if (config_get_int(config, NULL, "time_stamping") ==
TS_SOFTWARE ||
+ config_get_int(config, NULL, "time_stamping") ==
TS_LEGACY_HW) {
+ phc_index = -1;
+ } else if (phc_device) {
+ if (1 != sscanf(phc_device, "/dev/ptp%d", &phc_index)) {
+ pr_err("bad ptp device string");
+ return NULL;
+ }
+ } else if (iface->ts_info.valid) {
+ phc_index = iface->ts_info.phc_index;
+ } else {
+ pr_err("PTP device not specified and automatic
determination"
+ " is not supported. Please specify PTP device.");
+ return NULL;
+ }
+ if (phc_index >= 0) {
+ pr_info("selected /dev/ptp%d as PTP clock", phc_index);
+ }
+
Would this make more logical sense as a separate function here?

Thanks,
Jake
Richard Cochran
2016-04-15 16:50:02 UTC
Permalink
Post by Keller, Jacob E
Would this make more logical sense as a separate function here?
Yes, it might look cleaner in a helper function, but that would be a
follow on patch. I prefer not to change blocks of code when moving
them, since it makes harder to figure out the history later on.

Thanks,
Richard
Keller, Jacob E
2016-04-15 22:43:20 UTC
Permalink
Post by Richard Cochran
Post by Keller, Jacob E
Would this make more logical sense as a separate function here?
Yes, it might look cleaner in a helper function, but that would be a
follow on patch.  I prefer not to change blocks of code when moving
them, since it makes harder to figure out the history later on.
Thanks,
Richard
Yes, I agree. Was just something I noticed.

Thanks,
Jake

Keller, Jacob E
2016-04-11 17:36:57 UTC
Permalink
Looks reasonable to me, besides the one comment. I think it would make reading the code a bit easier of the PHC index was a separate function.

Thanks,
Jake
-----Original Message-----
Sent: Saturday, April 09, 2016 12:32 PM
Subject: [Linuxptp-devel] [PATCH RFC 0/7] Prepare for TC, Batch II
This is the second (and last) series in preparation for a Transparent
Clock implementation.
Patches 1-3 and 5 make minor changes in the clock interface.
Patches 4 and 7 move blocks of clock initialization logic out of
ptp4l.c:main() and into clock.c:clock_create().
Patch 6 follows up on patch 2 and lets the caller of clock_create
specify the desired type of clock. Currently we have only OC and BC,
but later on, we will add TC support.
Review and comments are welcome.
Thanks,
Richard
Move the clock type enumeration into the clock header.
clock: offer a method to get the type rather than the number of ports.
clock: offer a method to get the first port in the list.
Perform the time stamping mode check in the clock module.
config: count the interfaces as they are added.
clock: specify type at creation time.
Let the clock code figure the PHC index.
clock.c | 81
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
--
clock.h | 29 ++++++++++++++++++-----
config.c | 2 ++
config.h | 1 +
port.c | 7 +-----
ptp4l.c | 64 +++-----------------------------------------------
tlv.h | 8 -------
7 files changed, 106 insertions(+), 86 deletions(-)
--
2.1.4
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple tiers
of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
Linuxptp-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Loading...