Commit 6e04d45e authored by Jean-Claude BAU's avatar Jean-Claude BAU Committed by Adam Wujek

PPSI configuration enhancement

- Assembly_ppi_conf.sh script is able to generate JSON ppsi.conf format
- New parameters in ppsi.conf. Some parameters moved at ppsi instance
level
- port timing configuration in Kconfig moved in KConfig_port_timing.in
file. A file generator 'gen_kconfig_port_timing.sh'is used to generate
it.
- HAL upgraded to use the new dot-config file format. Mode ( auto,
master,...) removed from HAL.
- ppsi-pre.conf: Set empty because the new generated ppsi.conf always
define clock-class and clock accuracy.
parent df02f683
......@@ -387,139 +387,7 @@ config KEEP_ROOTFS
endmenu
menu "Port Timing Configuration"
config PORT01_PARAMS
string "Parameters for port 1"
default "name=wri1,proto=raw,tx=223897,rx=226273,role=slave,ext=WR,dm=e2e,monitor=y,fiber=0" if TIME_BC
default "name=wri1,proto=raw,tx=223897,rx=226273,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
This item, and the following ones, are used to assign the tx and rx
constant delays (likely from calibration), protocol type (raw or udp),
port roles, type of fiber (number referring to the corresponding
FIBERXX_PARAMS) and vlan configuration of PPSi for each of the ports.
Please refer to the user manual for more information.
"role" can be one of the following:
- master - configure port as a master
- slave - configure port as a slave
- auto - when a port is connected to master behave as a slave,
otherwise behave as master
- non-wr - (obsolete) don't report problems with this port via SNMP
like SFP not in DB, copper SFP connected, non 1GB SFP
etc.
- none - disable White Rabbit and PTP on a port
"ext" (extension) can be one of the following:
- WR - use White Rabbit as an extension on this port (default)
- none - no extension on this port
"dm" (delay mechanism) can be one of the following:
- e2e - end to end (default)
- p2p - peer to peer
"monitor" option to disable ("n") or enable ("y") triggering errors in SNMP on a port; "y" by default
config PORT02_PARAMS
string "Parameters for port 2"
default "name=wri2,proto=raw,tx=224037,rx=226377,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT03_PARAMS
string "Parameters for port 3"
default "name=wri3,proto=raw,tx=224142,rx=226638,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT04_PARAMS
string "Parameters for port 4"
default "name=wri4,proto=raw,tx=224313,rx=226471,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT05_PARAMS
string "Parameters for port 5"
default "name=wri5,proto=raw,tx=224455,rx=227679,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT06_PARAMS
string "Parameters for port 6"
default "name=wri6,proto=raw,tx=224603,rx=227891,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT07_PARAMS
string "Parameters for port 7"
default "name=wri7,proto=raw,tx=224761,rx=228055,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT08_PARAMS
string "Parameters for port 8"
default "name=wri8,proto=raw,tx=224898,rx=228178,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT09_PARAMS
string "Parameters for port 9"
default "name=wri9,proto=raw,tx=225069,rx=228277,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT10_PARAMS
string "Parameters for port 10"
default "name=wri10,proto=raw,tx=225245,rx=228435,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT11_PARAMS
string "Parameters for port 11"
default "name=wri11,proto=raw,tx=225463,rx=228963,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT12_PARAMS
string "Parameters for port 12"
default "name=wri12,proto=raw,tx=225645,rx=229107,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT13_PARAMS
string "Parameters for port 13"
default "name=wri13,proto=raw,tx=225801,rx=229225,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT14_PARAMS
string "Parameters for port 14"
default "name=wri14,proto=raw,tx=225983,rx=229463,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT15_PARAMS
string "Parameters for port 15"
default "name=wri15,proto=raw,tx=226208,rx=229850,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT16_PARAMS
string "Parameters for port 16"
default "name=wri16,proto=raw,tx=226393,rx=229907,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT17_PARAMS
string "Parameters for port 17"
default "name=wri17,proto=raw,tx=226594,rx=230106,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
config PORT18_PARAMS
string "Parameters for port 18"
default "name=wri18,proto=raw,tx=226737,rx=230273,role=master,ext=WR,dm=e2e,monitor=y,fiber=0"
help
Please check the help of PORT01_PARAMS
endmenu
source Kconfig_port_timing.in
menu "SFP and Media Timing Configuration"
......@@ -716,10 +584,19 @@ config PTP_CONF_URL
For example: tftp://morgana/wrs-IPADDR-ppsi.conf
menu "PTP options"
depends on PTP_PORT_PARAMS
config PTP_OPT_OVERWRITE_CLOCK_CLASS
boolean "Overwrite default clock-class"
default FALSE
help
The clock class is automatically set depending of the timing mode.
This option allows to overwrite the default value.
config PTP_OPT_CLOCK_CLASS
string "clock-class"
int "clock-class"
default 248
range 0 255
depends on PTP_OPT_OVERWRITE_CLOCK_CLASS
help
An attribute defining the TAI traceability, synchronization state and
expected performance of the time or frequency distributed by a
......@@ -729,7 +606,9 @@ config PTP_OPT_CLOCK_CLASS
ppsi-pre.conf during generation of ppsi.conf.
config PTP_OPT_CLOCK_ACCURACY
string "clock-accuracy"
int "clock-accuracy"
range 0 255
default "254"
help
An attribute defining the accuracy of the Local Clock (e.g. local
oscillator) of a Boundary Clock or Ordinary Clock.
......@@ -738,7 +617,9 @@ config PTP_OPT_CLOCK_ACCURACY
ppsi-pre.conf during generation of ppsi.conf.
config PTP_OPT_CLOCK_ALLAN_VARIANCE
string "clock-allan-variance/offsetScaledLogVariance"
int "clock-allan-variance/offsetScaledLogVariance"
default "65535"
range 0 65535
help
An attribute defining the stability of the Local Clock of a
Boundary Clock or Ordinary Clock.
......@@ -747,44 +628,29 @@ config PTP_OPT_CLOCK_ALLAN_VARIANCE
ppsi-pre.conf during generation of ppsi.conf.
config PTP_OPT_DOMAIN_NUMBER
string "domain-number"
int "domain-number"
default 0
range 0 255
help
A domain consists of one or more PTP devices communicating with each
other as defined by the PTP protocol. A domain defines the scope of
PTP message communication, state, operations, data sets, and
timescale. PTP devices may participate in multiple domains.
For more details please refer to the IEEE 1588-2008 standard.
If set, this configuration item overwrites the default value from
ppsi-pre.conf during generation of ppsi.conf.
config PTP_OPT_ANNOUNCE_INTERVAL
string "announce-interval"
help
The mean time interval between transmissions of successive
Announce messages.
If set, this configuration item overwrites the default value from
ppsi-pre.conf during generation of ppsi.conf.
config PTP_OPT_SYNC_INTERVAL
string "sync-interval"
help
The mean time interval between transmission of successive
Sync messages, i.e., the sync-interval, when transmitted
as multicast messages. The value is the logarithm to the base 2.
If set, this configuration item overwrites the default value from
ppsi-pre.conf during generation of ppsi.conf.
config PTP_OPT_PRIORITY1
string "priority1"
int "priority1"
default "128"
range 0 255
help
A user configurable designation that a clock belongs to an ordered
set of PTP devices from which a PTP Master is selected.
For more details please refer to the IEEE 1588-2008 standard
If set, this configuration item overwrites the default value from
ppsi-pre.conf during generation of ppsi.conf.
config PTP_OPT_PRIORITY2
string "priority2"
int "priority2"
default "128"
range 0 255
help
A user configurable designation that provides finer grained ordering
among otherwise equivalent PTP devices.
......@@ -792,8 +658,18 @@ config PTP_OPT_PRIORITY2
If set, this configuration item overwrites the default value from
ppsi-pre.conf during generation of ppsi.conf.
config PTP_OPT_OVERWRITE_TIME_SOURCE
boolean "Overwrite default time-source"
default FALSE
help
The clock class is automatically set depending of the timing mode.
This option allows to overwrite the default value.
config PTP_OPT_TIME_SOURCE
string "time-source"
int "time-source"
default 160
range 0 255
depends on PTP_OPT_OVERWRITE_TIME_SOURCE
help
This information-only attribute indicates the source of time used
by the grandmaster (or free-running master).
......
This diff is collapsed.
This diff is collapsed.
......@@ -74,9 +74,6 @@ struct hal_port_state {
int fd;
int hw_addr_auto;
/* port timing mode (HEXP_PORT_MODE_xxxx) */
int mode;
/* port FSM state (HAL_PORT_STATE_xxxx) */
int state;
......
......@@ -7,90 +7,90 @@ clock-accuracy 254
port wri1
iface wri1
role auto
extension whiterabbit
profile whiterabbit
port wri2
iface wri2
role auto
extension whiterabbit
profile whiterabbit
port wri3
iface wri3
role auto
extension whiterabbit
profile whiterabbit
port wri4
iface wri4
role auto
extension whiterabbit
profile whiterabbit
port wri5
iface wri5
role auto
extension whiterabbit
profile whiterabbit
port wri6
iface wri6
role auto
extension whiterabbit
profile whiterabbit
port wri7
iface wri7
role auto
extension whiterabbit
profile whiterabbit
port wri8
iface wri8
role auto
extension whiterabbit
profile whiterabbit
port wri9
iface wri9
role auto
extension whiterabbit
profile whiterabbit
port wri10
iface wri10
role auto
extension whiterabbit
profile whiterabbit
port wri11
iface wri11
role auto
extension whiterabbit
profile whiterabbit
port wri12
iface wri12
role auto
extension whiterabbit
profile whiterabbit
port wri13
iface wri13
role auto
extension whiterabbit
profile whiterabbit
port wri14
iface wri14
role auto
extension whiterabbit
profile whiterabbit
port wri15
iface wri15
role auto
extension whiterabbit
profile whiterabbit
port wri16
iface wri16
role auto
extension whiterabbit
profile whiterabbit
port wri17
iface wri17
role auto
extension whiterabbit
profile whiterabbit
port wri18
iface wri18
role auto
extension whiterabbit
profile whiterabbit
# Global settings
clock-class 187
clock-accuracy 254
# This file is used to declare global settings which are not defined or left empty
# in the dot-config file.
......@@ -93,10 +93,6 @@ time_t wrsPortStatusTable_data_fill(unsigned int *n_rows)
*/
wrsPortStatusTable_array[i].wrsPortStatusLink =
1 + state_up(port_state->state);
/* values defined as
* WRS_PORT_STATUS_CONFIGURED_MODE_* */
wrsPortStatusTable_array[i].wrsPortStatusConfiguredMode =
port_state->mode;
if (port_state->state == HAL_PORT_STATE_DISABLED) {
wrsPortStatusTable_array[i].wrsPortStatusSfpError =
WRS_PORT_STATUS_SFP_ERROR_PORT_DOWN;
......
......@@ -117,7 +117,8 @@ static int hal_port_check_presence(const char *if_name, unsigned char *mac)
static int hal_port_init(int index)
{
struct hal_port_state *p = &ports[index];
char name[128], s[128];
int i;
char name[128];
int val, error;
int port_i;
......@@ -128,7 +129,7 @@ static int hal_port_init(int index)
hal_port_reset_state(p);
/* read dot-config values for this index, starting from name */
error = libwr_cfg_convert2("PORT%02i_PARAMS", "name", LIBWR_STRING,
error = libwr_cfg_convert2("PORT%02i_PARAMS", "iface", LIBWR_STRING,
name, port_i);
if (error)
return -1;
......@@ -141,21 +142,38 @@ static int hal_port_init(int index)
p->state = HAL_PORT_STATE_DISABLED;
p->in_use = 1;
/* Search an instance using the WR profile */
for (i=1; i<=2; i++) {
char str[32];
if ( !(error = libwr_cfg_convert2("PORT%02i_INST%02i", "prof", LIBWR_STRING,
str, port_i,i))) {
if ( strcasecmp("WR",str)==0 )
break; // Found
}
}
val = 18 * 800; /* magic default from previous code */
error = libwr_cfg_convert2("PORT%02i_PARAMS", "tx", LIBWR_INT,
&val, port_i);
if (error)
pr_error("port %i (%s): no \"tx=\" specified\n",
port_i, name);
p->calib.phy_tx_min = val;
if ( !error ) {
// WR instance found
val = 18 * 800; /* magic default from previous code */
error = libwr_cfg_convert2("PORT%02i_INST%02i", "tx", LIBWR_INT,
&val, port_i,i);
if (error)
pr_error("port %i (%s): no \"tx=\" specified\n",
port_i, name);
p->calib.phy_tx_min = val;
val = 18 * 800; /* magic default from previous code */
error = libwr_cfg_convert2("PORT%02i_PARAMS", "rx", LIBWR_INT,
&val, port_i);
if (error)
pr_error("port %i (%s): no \"rx=\" specified\n",
error = libwr_cfg_convert2("PORT%02i_INST%02i", "rx", LIBWR_INT,
&val, port_i,i);
if (error)
pr_error("port %i (%s): no \"rx=\" specified\n",
port_i, name);
p->calib.phy_rx_min = val;
} else {
pr_error("port %i (%s): no WhiteRabbit instance defined\n",
port_i, name);
p->calib.phy_rx_min = val;
p->calib.phy_tx_min = p->calib.phy_rx_min = val;
}
p->calib.delta_tx_board = 0; /* never set */
p->calib.delta_rx_board = 0; /* never set */
......@@ -168,45 +186,6 @@ static int hal_port_init(int index)
p->t4_phase_transition = DEFAULT_T4_PHASE_TRANS;
p->clock_period = REF_CLOCK_PERIOD_PS;
/* enabling of ports is done by startup script */
{
static struct roletab { char *name; int value; } *rp, rt[] = {
{"auto", HEXP_PORT_MODE_WR_M_AND_S},
{"master", HEXP_PORT_MODE_WR_MASTER},
{"slave", HEXP_PORT_MODE_WR_SLAVE},
{"non-wr", HEXP_PORT_MODE_NON_WR},
{"none", HEXP_PORT_MODE_NONE},
{NULL, HEXP_PORT_MODE_NON_WR /* default,
* should exist and be last*/},
};
strcpy(s, "non-wr"); /* default if no string passed */
p->mode = HEXP_PORT_MODE_NON_WR;
error = libwr_cfg_convert2("PORT%02i_PARAMS", "role",
LIBWR_STRING, s, port_i);
if (error)
pr_error("port %i (%s): "
"no \"role=\" specified\n", port_i, name);
for (rp = rt; rp->name; rp++)
if (!strcasecmp(s, rp->name))
break;
p->mode = rp->value;
if (!rp->name) {
for (rp = rt; rp->name; rp++)
if (p->mode == rp->value)
break;
pr_error("port %i (%s): invalid role "
"\"%s\" specified; using mode %s\n", port_i,
name, s, rp->name);
}
pr_debug("Port %s: mode %s (%i)\n", p->name, rp->name,
p->mode);
}
/* Get fiber type */
error = libwr_cfg_convert2("PORT%02i_PARAMS", "fiber",
LIBWR_INT, &p->fiber_index, port_i);
......@@ -941,7 +920,6 @@ static void update_sync_leds(void)
return;
for (i = 0; i < HAL_MAX_PORTS; i++) {
int ledValue;
/* Check:
* --port in use
......@@ -953,6 +931,8 @@ static void update_sync_leds(void)
if (ports[i].in_use
&& state_up(ports[i].state)
&& !strcmp(iface_name, ports[i].name)) {
int ledValue=0; /* default value */
if (update_count == servo.servo_snapshot.update_count) {
if (since_last_servo_update < 7)
since_last_servo_update++;
......@@ -960,15 +940,16 @@ static void update_sync_leds(void)
since_last_servo_update = 0;
update_count = servo.servo_snapshot.update_count;
}
/* Check:
* --port in slave mode
* --ppsi instance in slave state
* --servo is locked
* --not the standard PTP servo
* --WR of HA PTP servo
* --servo is updating
*/
ledValue=(ports[i].mode == HEXP_PORT_MODE_WR_SLAVE
ledValue=(servo.ppi->state == PPS_SLAVE
&& servo.servo_snapshot.servo_locked
&& servo.ppi->protocol_extension != PPSI_EXT_NONE
&& (servo.ppi->protocol_extension == PPSI_EXT_WR || servo.ppi->protocol_extension == PPSI_EXT_L1S)
&& since_last_servo_update < 7
) ? 1 : 0;
set_led_synced(i, ledValue);
......
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