Skip to content
Snippets Groups Projects
Commit 4d2c1841 authored by Adam Wujek's avatar Adam Wujek
Browse files

[FEATURE: #59] arch-wrs: add runtime reconfiguration of constantAsymmetry


Signed-off-by: default avatarAdam Wujek <dev_public@wujek.eu>
parent fa69e314
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@
#define PPSIEXP_PARAM64_INST_DELAY_COEFFICIENT_CMD 1
#define PPSIEXP_PARAM64_INST_EGRESS_LATENCY_CMD 2
#define PPSIEXP_PARAM64_INST_INGRESS_LATENCY_CMD 3
#define PPSIEXP_PARAM64_INST_CONSTANT_ASYMMETRY_CMD 4
/* Commands for ppsiexp_update_param_str_instance_cmd */
#define PPSIEXP_PARAM_INST_STR_DIAG_CMD 1
......
......@@ -337,6 +337,19 @@ static int update_param64_instance(struct pp_instance *ppi, int ppi_i,
int rval = PPSIEXP_RET_OK;
switch (param_type) {
case PPSIEXP_PARAM64_INST_CONSTANT_ASYMMETRY_CMD:
pp_diag(ppi, config, 2,
"%s cmd %d "
"(PPSIEXP_PARAM64_INST_CONSTANT_ASYMMETRY_CMD) "
"instance %d, port %s, value %d%d\n",
__func__, param_type, ppi_i,
ppi->iface_name, (int)(param64_val/1000000000),
(int)(param64_val % 1000000000));
set_param_constant_asymmetry64(ppi, param64_val);
break;
case PPSIEXP_PARAM64_INST_DELAY_COEFFICIENT_CMD:
pp_diag(ppi, config, 2,
"%s: cmd %d "
......
......@@ -80,6 +80,10 @@ Parameters specific for PPSi instance:
sets logarithm to the base 2 of the mean interval of announce message
transmission used by PTP
@item --constant-asymmetry=<num64>
change constant-asymmetry; if instance/port is not selected apply
the new value to all ports/instances;
64bit value in ps is kept over link down/up
@item --delay-coefficient=<alpha64bit>
change the currently used @i{delayCoefficient} (alpha);
......
......@@ -17,5 +17,7 @@ int set_param_delta_txm64(struct pp_globals *ppg, int delta_txm);
int set_param_egress_latency64(struct pp_instance *ppi, int64_t egress_latency);
int set_param_ingress_latency64(struct pp_instance *ppi,
int64_t ingress_latency);
int set_param_constant_asymmetry64(struct pp_instance *ppi,
int64_t constantAsymmetry);
#endif /* _PPSI_SET_PARAM_H_ */
......@@ -274,3 +274,13 @@ int set_param_ingress_latency64(struct pp_instance *ppi,
return 0;
}
int set_param_constant_asymmetry64(struct pp_instance *ppi,
int64_t constantAsymmetry)
{
ppi->asymmetryCorrectionPortDS.constantAsymmetry =
picos_to_interval(constantAsymmetry);
ppi->cfg.constantAsymmetry_ps = constantAsymmetry;
return 0;
}
......@@ -26,6 +26,7 @@ static struct minipc_ch *ptp_ch;
enum input_arg {
arg_help = 'z' + 1, /* avoid conflicts with short options */
arg_autoneg,
arg_constant_asymmetry,
arg_delay_coefficient,
arg_delay_req_interval,
arg_delta_rxm,
......@@ -49,6 +50,7 @@ static struct option long_opts[] = {
{"help", no_argument, NULL, arg_help},
{"alpha", required_argument, NULL, arg_delay_coefficient},
{"autonegotiation", required_argument, NULL, arg_autoneg},
{"constant-asymmetry", required_argument, NULL, arg_constant_asymmetry},
{"delay-coefficient", required_argument, NULL, arg_delay_coefficient},
{"delay-req-interval", required_argument, NULL, arg_delay_req_interval},
{"delta-rxm", required_argument, NULL, arg_delta_rxm},
......@@ -110,6 +112,9 @@ void help(char *prgname)
" same as --delay-coefficient\n"
" --autonegotiation=<on|off|enable|disable|1|0>\n"
" enable or disable extension autonegotiation\n"
" --constant-asymmetry=<num64>\n"
" - change constant-asymmetry; if instance/port is not selected apply the new\n"
" value to all ports/instances; 64bit value in ps is kept over link down/up\n"
" --delay-coefficient=<alpha64bit>\n"
" - change currently used delayCoefficient (alpha)\n"
" the value is in \"fpa\" format, like displayed in wr_mon; if no port/instance is\n"
......@@ -384,6 +389,39 @@ int main(int argc, char *argv[])
}
break;
case arg_constant_asymmetry:
/* Check if an instance is set. If not use all
* instances/ports. */
restore_inst_selection = ppsi_instance;
if (ppsi_instance == -1) {
ppsi_port = 0;
ppsi_instance = PPSIEXP_PPSI_INSTANCE_USE_PORT;
}
tmp64 = atoll(optarg);
if (verbose)
printf("Setting constant asymmetry for "
"%s %d to %lld\n",
ppsi_port == -1 ? "instance" : "port",
ppsi_instance & ~PPSIEXP_PPSI_INSTANCE_USE_PORT,
tmp64);
ret = ppsi_set_param64_instance(
PPSIEXP_PARAM64_INST_CONSTANT_ASYMMETRY_CMD,
ppsi_instance,
tmp64);
if (ret) {
fprintf(stderr, "Error setting constant "
"asymmetry for %s %d to %lld, ret %d\n",
ppsi_port == -1 ? "instance" : "port",
ppsi_instance & ~PPSIEXP_PPSI_INSTANCE_USE_PORT,
tmp64, ret);
exit (1);
}
ppsi_instance = restore_inst_selection;
break;
case arg_delay_req_interval:
/* Check if an instance is set. If not exit. */
check_instance(ppsi_instance);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment