Commit 5e0e5a62 authored by Alessandro Rubini's avatar Alessandro Rubini

general: make delay mechanism configurable and fix defaults

Now this is the behaviour for the choice:

    arch-bare-*

         if you select P2P, it's built and selected. Default is E2E_ONLY.

    arch-sim
    arch-unix
    arch-wrs

         The P2P is built by default configuration, and the mechanism
         is selected at configuration time. Default is E2E. If you
         choose E2E_ONLY and configure pdelay, it will ignore the config.
         (Suboptimal but I'm lazy: do *not* use E2E_ONLY for those archs.

    arch-wrpc

        The default is e2e until changed at run time.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 8699f7d5
......@@ -87,7 +87,7 @@ menu "PTP Protocol Options"
config E2E_ONLY
boolean "Avoid building P2P code"
default n
default y if E2E && (ARCH_BARE_I386 || ARCH_BARE_X86_64)
help
If you choose E2E above, P2P is built anyways,
and you can choose at runtime what to run.
......
......@@ -143,7 +143,7 @@ int main(int argc, char **argv)
sim_set_global_DS(ppi);
ppi->iface_name = ppi->cfg.iface_name;
ppi->port_name = ppi->cfg.port_name;
ppi->mech = CONFIG_HAS_P2P ? PP_P2P_MECH : PP_E2E_MECH;
ppi->mech = ppi->cfg.mech;
if (ppi->proto == PPSI_PROTO_RAW)
pp_printf("Warning: simulator doesn't support raw "
"ethernet. Using UDP\n");
......
......@@ -66,7 +66,7 @@ int main(int argc, char **argv)
ppi = INST(ppg, i);
ppi->proto = PP_DEFAULT_PROTO;
ppi->role = PP_DEFAULT_ROLE;
ppi->mech = CONFIG_HAS_P2P ? PP_P2P_MECH : PP_E2E_MECH;
ppi->mech = PP_E2E_MECH;
}
/* Set offset here, so config parsing can override it */
......@@ -92,6 +92,7 @@ int main(int argc, char **argv)
ppi->vlans_array_len = CONFIG_VLAN_ARRAY_SIZE,
ppi->iface_name = ppi->cfg.iface_name;
ppi->port_name = ppi->cfg.port_name;
ppi->mech = ppi->cfg.mech;
/* The following default names depend on TIME= at build time */
ppi->n_ops = &DEFAULT_NET_OPS;
......
......@@ -79,7 +79,7 @@ struct pp_instance ppi_static = {
.t_ops = &wrpc_time_ops,
.vlans_array_len = CONFIG_VLAN_ARRAY_SIZE,
.proto = PP_DEFAULT_PROTO,
.mech = CONFIG_HAS_P2P ? PP_P2P_MECH : PP_E2E_MECH,
.mech = PP_E2E_MECH, /* until changed by cfg */
.iface_name = "wr1",
.port_name = "wr1",
.__tx_buffer = __tx_buffer,
......
......@@ -207,7 +207,7 @@ int main(int argc, char **argv)
ppi->vlans_array_len = CONFIG_VLAN_ARRAY_SIZE;
ppi->iface_name = ppi->cfg.iface_name;
ppi->port_name = ppi->cfg.port_name;
ppi->mech = CONFIG_HAS_P2P ? PP_P2P_MECH : PP_E2E_MECH;
ppi->mech = ppi->cfg.mech;
ppi->portDS = calloc(1, sizeof(*ppi->portDS));
if (ppi->portDS)
ppi->portDS->ext_dsport =
......
......@@ -112,7 +112,8 @@ enum { /* The two sockets. They are called "net path" for historical reasons */
struct pp_instance_cfg {
char port_name[16];
char iface_name[16];
int ext; /* 0: none, 1: whiterabbit */
int ext; /* 0: none, 1: whiterabbit. 2: HA */
int mech; /* 0: E2E, 1: P2P */
};
/*
......
......@@ -228,6 +228,15 @@ static struct pp_argname arg_ext[] = {
{"whiterabbit", PPSI_EXT_WR},
{},
};
static struct pp_argname arg_mech[] = {
{"request-response", PP_E2E_MECH},
{"delay", PP_E2E_MECH},
{"e2e", PP_E2E_MECH},
{"peer-delay", PP_P2P_MECH},
{"pdelay", PP_P2P_MECH},
{"p2p", PP_P2P_MECH},
{},
};
static struct pp_argline pp_global_arglines[] = {
LEGACY_OPTION(f_port, "port", ARG_STR),
......@@ -236,6 +245,7 @@ static struct pp_argline pp_global_arglines[] = {
INST_OPTION_INT("proto", ARG_NAMES, arg_proto, proto),
INST_OPTION_INT("role", ARG_NAMES, arg_role, role),
INST_OPTION_INT("extension", ARG_NAMES, arg_ext, cfg.ext),
INST_OPTION_INT("mechanism", ARG_NAMES, arg_mech, cfg.mech),
LEGACY_OPTION(f_vlan, "vlan", ARG_STR),
LEGACY_OPTION(f_diag, "diagnostic", ARG_STR),
RT_OPTION_INT("clock-class", ARG_INT, NULL, clock_quality.clockClass),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment