On Fri, Sep 02, 2022 at 12:26:11PM +0530, SyncMonk Technologies wrote:
> diff --git a/clock.c b/clock.c
> index d37bb87..eba0833 100644
> --- a/clock.c
> +++ b/clock.c
> @@ -97,9 +97,10 @@ struct clock {
> LIST_HEAD(ports_head, port) ports;
> struct port *uds_rw_port;
> struct port *uds_ro_port;
> + struct port *vport_port;
> struct pollfd *pollfd;
> int pollfd_valid;
> - int nports; /* does not include the two UDS ports */
> + int nports; /* does not include the two UDS ports + 1 Virtual Port */
Keeping the virtual port separate from the others won't work. Why?
1975 static void handle_state_decision_event(struct clock *c)
1976 {
1977 struct foreign_clock *best = NULL, *fc;
1978 struct ClockIdentity best_id;
1979 struct port *piter;
1980 int fresh_best = 0;
1981
1982 LIST_FOREACH(piter, &c->ports, list) {
1983 fc = port_compute_best(piter);
...
1988 }
...
2022 LIST_FOREACH(piter, &c->ports, list) {
2023 enum port_state ps;
2024 enum fsm_event event;
2025 ps = bmc_state_decision(c, piter, c->dscmp);
...
2050 port_dispatch(piter, event, fresh_best);
2051 }
> @@ -1231,6 +1261,17 @@ struct clock *clock_create(enum clock_type type,
> struct config *config,
> pr_err("failed to open the UDS-RO port");
> return NULL;
> }
> +
> + if (c->vport_if) {
> + c->vport_port = port_open(phc_device, phc_index, timestamping,
> 0,
Can't use zero as port number. Ports that participate in BCMA must
also be reported in management queries, and the port numbers are all
positive integers per 1588.
> + c->vport_if, c);
> + if (!c->vport_port) {
> + pr_err("failed to open the Virtual port");
> + return NULL;
> + }
> + LIST_INSERT_HEAD(&c->ports, c->vport_port, list);
> + c->nports++;
> + }
> clock_fda_changed(c);
>
> c->slave_event_monitor = monitor_create(config, c->uds_rw_port);
> @@ -193,6 +193,7 @@ static struct config_enum nw_trans_enu[] = {
> { "L2", TRANS_IEEE_802_3 },
> { "UDPv4", TRANS_UDP_IPV4 },
> { "UDPv6", TRANS_UDP_IPV6 },
> + { "vPort", TRANS_VPORT },
This is unneeded and wrong. The transport models the network layer
used, and a virtual port uses UNIX Domain Sockets for this.
> @@ -822,6 +823,11 @@ static int port_is_uds(struct port *p)
> return transport_type(p->trp) == TRANS_UDS;
> }
>
> +static int port_is_vport(struct port *p)
> +{
> + return transport_type(p->trp) == TRANS_VPORT;
> +}
> +
Don't need this.
> static void port_management_send_error(struct port *p, struct port *ingress,
> struct ptp_message *msg, int error_id)
> {
> @@ -3266,8 +3272,8 @@ struct port *port_open(const char *phc_device,
> p->state_machine = clock_slave_only(clock) ? ptp_slave_fsm :
> ptp_fsm;
> }
>
> - if (port_is_uds(p)) {
> - ; /* UDS cannot have a PHC. */
> + if (port_is_uds(p) || port_is_vport(p)) {
> + ; /* UDS & VPORT cannot have a PHC. */
or this.
> } else if (!interface_tsinfo_valid(interface)) {
> pr_warning("%s: get_ts_info not supported", p->log_name);
> } else if (p->phc_index >= 0 &&
> diff --git a/transport.h b/transport.h
> index 7a7f87b..a4c73d3 100644
> --- a/transport.h
> +++ b/transport.h
> @@ -39,6 +39,7 @@ enum transport_type {
> TRANS_DEVICENET,
> TRANS_CONTROLNET,
> TRANS_PROFINET,
> + TRANS_VPORT,
Why can't the virtual port function be an option for the UDS port
already in place?
Thanks,
Richard
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel