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

Configuration enhancement (follow up)

        - Add new config parameters (l1SyncRxCoherencyIsRequired,...)
        - Add new profile: CUSTOM. It will be mostly used for testing
        - Fix issue on state name: "pre_master" instead of "pre-master"
parent e4b95a9e
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -44,17 +44,24 @@ function print_port_header() { ...@@ -44,17 +44,24 @@ function print_port_header() {
echo -e "\nmenu \"PORT ${portIdx}\"" >>$OUTPUT_FILE echo -e "\nmenu \"PORT ${portIdx}\"" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_PARAMS" >>$OUTPUT_FILE echo -e "\nconfig PORT${1}_IFACE" >>$OUTPUT_FILE
echo -e "\tstring \"Port parameters\"" >>$OUTPUT_FILE echo -e "\tstring \"Network interface\"" >>$OUTPUT_FILE
echo -e "\tdefault \"iface=wri${portIdx},fiber=0,asym=0\"" >>$OUTPUT_FILE echo -e "\tdefault \"wri${portIdx}\"" >>$OUTPUT_FILE
echo -e "\thelp" >>$OUTPUT_FILE echo -e "\thelp" >>$OUTPUT_FILE
echo -e "\t This item, and the following ones, are used to define physical ports." >>$OUTPUT_FILE echo -e "\t Used to set the physivcal port interface name: \"wri[1-18]\"" >>$OUTPUT_FILE
echo -e "\t An empty string means no instance declaration." >>$OUTPUT_FILE
echo -e "\t Please refer to the user manual for more information." >>$OUTPUT_FILE echo -e "\nconfig PORT${1}_FIBER" >>$OUTPUT_FILE
echo -e "\t \"iface\" - the interface name" >>$OUTPUT_FILE echo -e "\tint \"Fiber type\"" >>$OUTPUT_FILE
echo -e "\t \"fiber\" - the type of fiber (number referring to the corresponding " >>$OUTPUT_FILE echo -e "\tdefault 0" >>$OUTPUT_FILE
echo -e "\t FIBERXX_PARAMS)" >>$OUTPUT_FILE echo -e "\thelp" >>$OUTPUT_FILE
echo -e "\t \"asym\" - the constant delay asymmetry" >>$OUTPUT_FILE echo -e "\t Used to set the type of fiber (number referring to the corresponding " >>$OUTPUT_FILE
echo -e "\t FIBERXX_PARAMS)" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_CONSTANT_ASYMMETRY" >>$OUTPUT_FILE
echo -e "\tint \"asymmetryCorrectionPortDS.constantAsymmetry\"" >>$OUTPUT_FILE
echo -e "\tdefault 0" >>$OUTPUT_FILE
echo -e "\thelp" >>$OUTPUT_FILE
echo -e "\t Used to set the constant delay asymmetry." >>$OUTPUT_FILE
echo -e "\nchoice" >>$OUTPUT_FILE echo -e "\nchoice" >>$OUTPUT_FILE
echo -e "\tprompt \"Number of port instances\"" >>$OUTPUT_FILE echo -e "\tprompt \"Number of port instances\"" >>$OUTPUT_FILE
...@@ -90,28 +97,44 @@ function print_instance_header() { ...@@ -90,28 +97,44 @@ function print_instance_header() {
else else
echo -e " depends on PORT${1}_INSTANCE_COUNT_2 " >>$OUTPUT_FILE echo -e " depends on PORT${1}_INSTANCE_COUNT_2 " >>$OUTPUT_FILE
fi fi
echo -e "\nconfig PORT${1}_INST${2}" >>$OUTPUT_FILE
echo -e " string \"Port instance 1\"" >>$OUTPUT_FILE
echo -e " default \"tx=${tx},rx=${rx},proto=raw,prof=${prof},dm=e2e,monitor=y\"" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " This item, and the following ones, are used to define PPSI instances." >>$OUTPUT_FILE
echo -e " An empty string means no instance declaration." >>$OUTPUT_FILE
echo -e " Please refer to the user manual for more information." >>$OUTPUT_FILE
echo -e " \"proto\" can be one of the following:" >>$OUTPUT_FILE
echo -e " - raw - raw ethernet protocol" >>$OUTPUT_FILE
echo -e " - udp - UDP protocol" >>$OUTPUT_FILE
echo -e " \"tx\" defines the transmission constant delay (ps)" >>$OUTPUT_FILE
echo -e " \"rx\" defines the reception constant delay (ps) " >>$OUTPUT_FILE
echo -e " \"prof\" (profile) can be one of the following:" >>$OUTPUT_FILE
echo -e " - WR - use White Rabbit (default)" >>$OUTPUT_FILE
echo -e " - HA - use High accuracy profile" >>$OUTPUT_FILE
echo -e " - none - no extension on this port" >>$OUTPUT_FILE
echo -e " \"dm\" (delay mechanism) can be one of the following:" >>$OUTPUT_FILE
echo -e " - e2e - end to end (default)" >>$OUTPUT_FILE
echo -e " - p2p - peer to peer" >>$OUTPUT_FILE
echo -e " \"monitor\" option to disable (\"n\") or enable (\"y\") triggering errors in SNMP on a port; \"y\" by default" >>$OUTPUT_FILE
echo -e "\nchoice" >>$OUTPUT_FILE
echo -e " prompt \"Network protocol\"" >>$OUTPUT_FILE
echo -e " default PORT${1}_INST${2}_PROTOCOL_RAW" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_PROTOCOL_RAW" >>$OUTPUT_FILE
echo -e " bool \"IEEE 802.3\"" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_PROTOCOL_UDP_IPV4" >>$OUTPUT_FILE
echo -e " bool \"UDP/Ipv4\"" >>$OUTPUT_FILE
echo -e "endchoice" >>$OUTPUT_FILE
echo -e "\nchoice" >>$OUTPUT_FILE
echo -e " prompt \"Delay mechanism\"" >>$OUTPUT_FILE
echo -e " default PORT${1}_INST${2}_MECHANISM_E2E" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_MECHANISM_E2E" >>$OUTPUT_FILE
echo -e " bool \"End-to-end\"" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_MECHANISM_P2P" >>$OUTPUT_FILE
echo -e " bool \"Peer-to-peer\"" >>$OUTPUT_FILE
echo -e "endchoice" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_MONITOR" >>$OUTPUT_FILE
echo -e " bool \"SNMP monitoring\"" >>$OUTPUT_FILE
echo -e " default y" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " Option to disable or enable triggering errors in SNMP on a port" >>$OUTPUT_FILE
echo -e "\nchoice" >>$OUTPUT_FILE
echo -e " prompt \"Profile\"" >>$OUTPUT_FILE
echo -e " default PORT${1}_INST${2}_PROFILE_HA" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_PROFILE_PTP" >>$OUTPUT_FILE
echo -e " bool \"PTP\"" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_PROFILE_WR" >>$OUTPUT_FILE
echo -e " bool \"WhiteRabbit\"" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_PROFILE_HA" >>$OUTPUT_FILE
echo -e " bool \"HighAccuracy\"" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_PROFILE_CUSTOM" >>$OUTPUT_FILE
echo -e " bool \"Custom\"" >>$OUTPUT_FILE
echo -e "endchoice" >>$OUTPUT_FILE
echo -e "\nchoice" >>$OUTPUT_FILE echo -e "\nchoice" >>$OUTPUT_FILE
echo -e " prompt \"Desired state\"" >>$OUTPUT_FILE echo -e " prompt \"Desired state\"" >>$OUTPUT_FILE
echo -e " depends on PTP_OPT_EXT_PORT_CONFIG_ENABLED" >>$OUTPUT_FILE echo -e " depends on PTP_OPT_EXT_PORT_CONFIG_ENABLED" >>$OUTPUT_FILE
...@@ -125,6 +148,14 @@ function print_instance_header() { ...@@ -125,6 +148,14 @@ function print_instance_header() {
echo -e " bool \"Passive\"" >>$OUTPUT_FILE echo -e " bool \"Passive\"" >>$OUTPUT_FILE
echo -e "endchoice" >>$OUTPUT_FILE echo -e "endchoice" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_ASYMMETRY_CORRECTION_ENABLE" >>$OUTPUT_FILE
echo -e " depends on PORT${1}_INST${2}_PROFILE_HA=\"n\" " >>$OUTPUT_FILE
echo -e " bool \"asymmetryCorrectionPortDS.enable\"" >>$OUTPUT_FILE
echo -e " default true" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " When supported, the value TRUE shall indicate that the mechanism of for the calculation" >>$OUTPUT_FILE
echo -e " of the <delayAsymmetry> for certain media is enabled on the PTP port." >>$OUTPUT_FILE
echo -e "\nchoice" >>$OUTPUT_FILE echo -e "\nchoice" >>$OUTPUT_FILE
echo -e " prompt \"BMCA mode\"" >>$OUTPUT_FILE echo -e " prompt \"BMCA mode\"" >>$OUTPUT_FILE
echo -e " depends on PTP_OPT_EXT_PORT_CONFIG_ENABLED!=y" >>$OUTPUT_FILE echo -e " depends on PTP_OPT_EXT_PORT_CONFIG_ENABLED!=y" >>$OUTPUT_FILE
...@@ -136,8 +167,22 @@ function print_instance_header() { ...@@ -136,8 +167,22 @@ function print_instance_header() {
echo -e " bool \"Auto\"" >>$OUTPUT_FILE echo -e " bool \"Auto\"" >>$OUTPUT_FILE
echo -e "endchoice" >>$OUTPUT_FILE echo -e "endchoice" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_EGRESS_LATENCY" >>$OUTPUT_FILE
echo -e " depends on PORT${1}_INST${2}_PROFILE_WR!=y" >>$OUTPUT_FILE
echo -e " int \"timestampCorrectionPortDS.egressLatency (ps)\"" >>$OUTPUT_FILE
echo -e " default ${tx}" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " Defines the transmission constant delay (ps)" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_INGRESS_LATENCY" >>$OUTPUT_FILE
echo -e " depends on PORT${1}_INST${2}_PROFILE_WR!=y" >>$OUTPUT_FILE
echo -e " int \"timestampCorrectionPortDS.ingressLatency (ps)\"" >>$OUTPUT_FILE
echo -e " default ${rx}" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " Defines the reception constant delay (ps)" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_ANNOUNCE_INTERVAL" >>$OUTPUT_FILE echo -e "\nconfig PORT${1}_INST${2}_ANNOUNCE_INTERVAL" >>$OUTPUT_FILE
echo -e " int \"announce-interval\" " >>$OUTPUT_FILE echo -e " int \"logAnnounceInterval\" " >>$OUTPUT_FILE
echo -e " default 1" >>$OUTPUT_FILE echo -e " default 1" >>$OUTPUT_FILE
echo -e " range 0 4" >>$OUTPUT_FILE echo -e " range 0 4" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE echo -e " help" >>$OUTPUT_FILE
...@@ -146,18 +191,18 @@ function print_instance_header() { ...@@ -146,18 +191,18 @@ function print_instance_header() {
echo -e " The configurable range shall be 0 to 4." >>$OUTPUT_FILE echo -e " The configurable range shall be 0 to 4." >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_ANNOUNCE_RECEIPT_TIMEOUT" >>$OUTPUT_FILE echo -e "\nconfig PORT${1}_INST${2}_ANNOUNCE_RECEIPT_TIMEOUT" >>$OUTPUT_FILE
echo -e " int \"announce-receipt-timeout\"" >>$OUTPUT_FILE echo -e " int \"announceReceiptTimeout\"" >>$OUTPUT_FILE
echo -e " default 3" >>$OUTPUT_FILE echo -e " default 3" >>$OUTPUT_FILE
echo -e " range 2 255" >>$OUTPUT_FILE echo -e " range 2 255" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE echo -e " help" >>$OUTPUT_FILE
echo -e " The announe receipt timeout specifies the number of announceIntervals " >>$OUTPUT_FILE echo -e " The announceReceiptTimeout specifies the number of announceIntervals " >>$OUTPUT_FILE
echo -e " that must pass without receipt of an Announce message before the " >>$OUTPUT_FILE echo -e " that must pass without receipt of an Announce message before the " >>$OUTPUT_FILE
echo -e " occurrence of the event ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES." >>$OUTPUT_FILE echo -e " occurrence of the event ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES." >>$OUTPUT_FILE
echo -e " The value is the logarithm to the base 2." >>$OUTPUT_FILE echo -e " The value is the logarithm to the base 2." >>$OUTPUT_FILE
echo -e " The configurable range shall be 2 to 255" >>$OUTPUT_FILE echo -e " The configurable range shall be 2 to 255" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_SYNC_INTERVAL" >>$OUTPUT_FILE echo -e "\nconfig PORT${1}_INST${2}_SYNC_INTERVAL" >>$OUTPUT_FILE
echo -e " int \"sync-interval\"" >>$OUTPUT_FILE echo -e " int \"logSyncInterval\"" >>$OUTPUT_FILE
echo -e " default 0" >>$OUTPUT_FILE echo -e " default 0" >>$OUTPUT_FILE
echo -e " range -1 1" >>$OUTPUT_FILE echo -e " range -1 1" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE echo -e " help" >>$OUTPUT_FILE
...@@ -167,27 +212,38 @@ function print_instance_header() { ...@@ -167,27 +212,38 @@ function print_instance_header() {
echo -e " The configurable range shall be -1 to +1" >>$OUTPUT_FILE echo -e " The configurable range shall be -1 to +1" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_MIN_DELAY_REQ_INTERVAL" >>$OUTPUT_FILE echo -e "\nconfig PORT${1}_INST${2}_MIN_DELAY_REQ_INTERVAL" >>$OUTPUT_FILE
echo -e " int \"min-delay-req-interval\"" >>$OUTPUT_FILE echo -e " depends on PORT${1}_INST${2}_MECHANISM_E2E " >>$OUTPUT_FILE
echo -e " int \"minDelayRequestInterval\"" >>$OUTPUT_FILE
echo -e " default 0" >>$OUTPUT_FILE echo -e " default 0" >>$OUTPUT_FILE
echo -e " range 0 5" >>$OUTPUT_FILE echo -e " range 0 5" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE echo -e " help" >>$OUTPUT_FILE
echo -e " The min delay request interval specifies the minimum permitted" >>$OUTPUT_FILE echo -e " The minDelayRequestInterval specifies the minimum permitted" >>$OUTPUT_FILE
echo -e " mean time interval between successive Delay_Req messages." >>$OUTPUT_FILE echo -e " mean time interval between successive Delay_Req messages." >>$OUTPUT_FILE
echo -e " The value is the logarithm to the base 2." >>$OUTPUT_FILE echo -e " The value is the logarithm to the base 2." >>$OUTPUT_FILE
echo -e " The configurable range shall be 0 to 5" >>$OUTPUT_FILE echo -e " The configurable range shall be 0 to 5" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_MIN_PDELAY_REQ_INTERVAL" >>$OUTPUT_FILE echo -e "\nconfig PORT${1}_INST${2}_MIN_PDELAY_REQ_INTERVAL" >>$OUTPUT_FILE
echo -e " int \"min-pdelay-req-interval\"" >>$OUTPUT_FILE echo -e " depends on PORT${1}_INST${2}_MECHANISM_P2P " >>$OUTPUT_FILE
echo -e " int \"minPDelayRequestInterval\"" >>$OUTPUT_FILE
echo -e " default 0" >>$OUTPUT_FILE echo -e " default 0" >>$OUTPUT_FILE
echo -e " range 0 5" >>$OUTPUT_FILE echo -e " range 0 5" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE echo -e " help" >>$OUTPUT_FILE
echo -e " The min delay request interval specifies the minimum permitted" >>$OUTPUT_FILE echo -e " The minPDelayRequestInterval specifies the minimum permitted" >>$OUTPUT_FILE
echo -e " mean time interval between successive Pdelay_Req messages." >>$OUTPUT_FILE echo -e " mean time interval between successive Pdelay_Req messages." >>$OUTPUT_FILE
echo -e " The value is the logarithm to the base 2." >>$OUTPUT_FILE echo -e " The value is the logarithm to the base 2." >>$OUTPUT_FILE
echo -e " The configurable range shall be 0 to 5" >>$OUTPUT_FILE echo -e " The configurable range shall be 0 to 5" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_L1SYNC_ENABLED" >>$OUTPUT_FILE
echo -e " depends on PORT${1}_INST${2}_PROFILE_CUSTOM " >>$OUTPUT_FILE
echo -e " bool \"L1SyncBasicPortDS.L1SyncEnabled\"" >>$OUTPUT_FILE
echo -e " default y" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " This parameter specifies whether the L1Sync option is enabled on the PTP Port. If" >>$OUTPUT_FILE
echo -e " L1SyncEnabled is TRUE, then the L1Sync message exchange is supported and enabled" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_L1SYNC_INTERVAL" >>$OUTPUT_FILE echo -e "\nconfig PORT${1}_INST${2}_L1SYNC_INTERVAL" >>$OUTPUT_FILE
echo -e " int \"l1sync-interval\"" >>$OUTPUT_FILE echo -e " depends on PORT${1}_INST${2}_PROFILE_HA || (PORT${1}_INST${2}_PROFILE_CUSTOM && PORT${1}_INST${2}_L1SYNC_ENABLED=\"y\") " >>$OUTPUT_FILE
echo -e " int \"L1SyncBasicPortDS.logL1SyncInterval\"" >>$OUTPUT_FILE
echo -e " default 0" >>$OUTPUT_FILE echo -e " default 0" >>$OUTPUT_FILE
echo -e " range -4 4" >>$OUTPUT_FILE echo -e " range -4 4" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE echo -e " help" >>$OUTPUT_FILE
...@@ -197,7 +253,8 @@ function print_instance_header() { ...@@ -197,7 +253,8 @@ function print_instance_header() {
echo -e " The configurable range shall be -4 to 4" >>$OUTPUT_FILE echo -e " The configurable range shall be -4 to 4" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_L1SYNC_RECEIPT_TIMEOUT" >>$OUTPUT_FILE echo -e "\nconfig PORT${1}_INST${2}_L1SYNC_RECEIPT_TIMEOUT" >>$OUTPUT_FILE
echo -e " int \"l1sync-receipt-timeout\"" >>$OUTPUT_FILE echo -e " depends on PORT${1}_INST${2}_PROFILE_HA || (PORT${1}_INST${2}_PROFILE_CUSTOM && PORT${1}_INST${2}_L1SYNC_ENABLED=\"y\") " >>$OUTPUT_FILE
echo -e " int \"L1SyncBasicPortDS.L1SyncReceiptTimeout\"" >>$OUTPUT_FILE
echo -e " default 3" >>$OUTPUT_FILE echo -e " default 3" >>$OUTPUT_FILE
echo -e " range 2 10" >>$OUTPUT_FILE echo -e " range 2 10" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE echo -e " help" >>$OUTPUT_FILE
...@@ -206,7 +263,41 @@ function print_instance_header() { ...@@ -206,7 +263,41 @@ function print_instance_header() {
echo -e " before the L1_SYNC TLV reception timeout occurs." >>$OUTPUT_FILE echo -e " before the L1_SYNC TLV reception timeout occurs." >>$OUTPUT_FILE
echo -e " The value is the logarithm to the base 2." >>$OUTPUT_FILE echo -e " The value is the logarithm to the base 2." >>$OUTPUT_FILE
echo -e " The configurable range shall be 2 to 10" >>$OUTPUT_FILE echo -e " The configurable range shall be 2 to 10" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_L1SYNC_TX_COHERENCY_IS_REQUIRED" >>$OUTPUT_FILE
echo -e " depends on PORT${1}_INST${2}_PROFILE_CUSTOM && PORT${1}_INST${2}_L1SYNC_ENABLED=\"y\" " >>$OUTPUT_FILE
echo -e " bool \"L1SyncBasicPortDS.txCoherencyIsRequired\"" >>$OUTPUT_FILE
echo -e " default y" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " The Boolean attribute txCoherentIsRequired specifies the configuration of the L1Sync port and the" >>$OUTPUT_FILE
echo -e " expected configuration of its peer L1Sync port. This configuration indicates whether the L1Sync port is" >>$OUTPUT_FILE
echo -e " required to be a transmit coherent port." >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_L1SYNC_RX_COHERENCY_IS_REQUIRED" >>$OUTPUT_FILE
echo -e " depends on PORT${1}_INST${2}_PROFILE_CUSTOM && PORT${1}_INST${2}_L1SYNC_ENABLED=\"y\" " >>$OUTPUT_FILE
echo -e " bool \"L1SyncBasicPortDS.rxCoherencyIsRequired\"" >>$OUTPUT_FILE
echo -e " default y" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " The Boolean attribute rxCoherentIsRequired specifies the configuration of the L1Sync port and the" >>$OUTPUT_FILE
echo -e " expected configuration of its peer L1Sync port. This configuration indicates whether the L1Sync port is" >>$OUTPUT_FILE
echo -e " required to be a receive coherent port." >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_L1SYNC_CONGRUENCY_IS_REQUIRED" >>$OUTPUT_FILE
echo -e " depends on PORT${1}_INST${2}_PROFILE_CUSTOM && PORT${1}_INST${2}_L1SYNC_ENABLED=\"y\" " >>$OUTPUT_FILE
echo -e " bool \"L1SyncBasicPortDS.congruencyIsRequired\"" >>$OUTPUT_FILE
echo -e " default y" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " The Boolean attribute congruentIsRequired specifies configuration of the L1Sync port and the expected" >>$OUTPUT_FILE
echo -e " configuration of its peer L1Sync port. This configuration indicates whether the L1Sync port is required to" >>$OUTPUT_FILE
echo -e " be a congruent port" >>$OUTPUT_FILE
echo -e "\nconfig PORT${1}_INST${2}_L1SYNC_OPT_PARAMS_ENABLED" >>$OUTPUT_FILE
echo -e " depends on PORT${1}_INST${2}_PROFILE_CUSTOM && PORT${1}_INST${2}_L1SYNC_ENABLED=\"y\" " >>$OUTPUT_FILE
echo -e " bool \"L1SyncBasicPortDS.optParamsEnabled\"" >>$OUTPUT_FILE
echo -e " default n" >>$OUTPUT_FILE
echo -e " help" >>$OUTPUT_FILE
echo -e " The Boolean attribute optParamsEnabled specifies whether the L1Sync port transmitting the L1_SYNC" >>$OUTPUT_FILE
echo -e " TLV extends this TLV with the information about the optional parameters." >>$OUTPUT_FILE
} }
function print_instance_footer() { function print_instance_footer() {
......
Subproject commit ce55ff3d4cd2eaec31d2d8a439df19fe863850e1 Subproject commit 443c6dfc6754f0e9e998e3cf04765dc4a04a8ab6
#!/bin/bash #!/bin/bash
# Adam Wujek & Jean-Claude BAU @CERN # Adam Wujek & Jean-Claude BAU @CERN
# script to assembly ppsi.conf based on dot-config configuration # script to assembly ppsi.conf based on dot-config configuration
...@@ -54,10 +54,10 @@ function get_fiber_delay_coeff() { ...@@ -54,10 +54,10 @@ function get_fiber_delay_coeff() {
IFS='=' read -a fpa <<< "$fiber_param" IFS='=' read -a fpa <<< "$fiber_param"
dc=${fpa[1]} dc=${fpa[1]}
else else
echo "$script_name: Unknown fiber=\"$fb\" in CONFIG_PORT"$i_port"_PARAMS" echo "$script_name: Unknown fiber=\"$fb\" in CONFIG_PORT"$i_port"_FIBER"
fi fi
else else
echo "$script_name: Invalid parameter fiber=\"$fb\" in CONFIG_PORT"$i_port"_PARAMS" echo "$script_name: Invalid parameter fiber=\"$fb\" in CONFIG_PORT"$i_port"_FIBER"
fi fi
fi fi
echo "$dc" echo "$dc"
...@@ -130,22 +130,17 @@ function gen_ppsi_conf() { ...@@ -130,22 +130,17 @@ function gen_ppsi_conf() {
if [ "${size}" == "0" ] ; then if [ "${size}" == "0" ] ; then
continue continue
fi fi
v="$inst_vn[name]" ; echo "port ${!v}" >>$output hpKeys="port proto iface profile"
v="$inst_vn[proto]"; echo "proto ${!v}" >>$output for k in $hpKeys; do
v="$port_vn[iface]"; echo "iface ${!v}" >>$output v="$port_vn[$k]";[[ -n "${!v}" ]] && echo "$k ${!v}" >>$output
v="$inst_vn[masteronly]"; [[ -n "${!v}" ]] && echo "masterOnly ${!v}" >>$output v="$inst_vn[$k]";[[ -n "${!v}" ]] && echo "$k ${!v}" >>$output
v="$inst_vn[vlan]" ; [[ -n "${!v}" ]] && echo "vlan ${!v}" >>$output done
v="$inst_vn[dm]" ; [[ "${!v}" != "e2e" ]] && echo "mechanism ${!v}" >>$output # print remaining keys
v="$inst_vn[prof]" ; echo "profile ${!v}" >>$output for k in $port_ppsi_keys ; do
v="$inst_vn[dstate]"; [[ -n "${!v}" ]] && echo "desiredState ${!v}" >>$output [[ "$hpKeys" != *"$k"* ]] && (v="$port_vn[$k]";[[ -n "${!v}" ]] && echo "$k ${!v}" >>$output)
v="$inst_vn[rx]"; echo "ingressLatency ${!v}" >>$output done
v="$inst_vn[tx]"; echo "egressLatency ${!v}" >>$output for k in $inst_ppsi_keys ; do
v="$port_vn[dcoeff]"; echo "delayCoefficient ${!v}" >>$output [[ "$hpKeys" != *"$k"* ]] && (v="$inst_vn[$k]";[[ -n "${!v}" ]] && echo "$k ${!v}" >>$output)
v="$port_vn[asym]"; echo "constantAsymmetry ${!v}" >>$output
for p in $inst_opt_parameters ; do
plc=$(inst_opt_parameter_to_instance_index ${p})
v="$inst_vn[$plc]"
[[ -n "${!v}" ]] && echo "$plc ${!v}" >>$output
done done
echo -n -e "\n\n" >>$output echo -n -e "\n\n" >>$output
done done
...@@ -215,9 +210,14 @@ function gen_ppsi_conf_json() { ...@@ -215,9 +210,14 @@ function gen_ppsi_conf_json() {
else else
echo -e ",\n {" >>$output echo -e ",\n {" >>$output
fi fi
v="$port_vn[iface]"; echo -e " \"iface\": \"${!v}\"," >>$output hpKeys="iface"
v="$port_vn[dcoeff]"; echo -e " \"delayCoefficient\": \"${!v}\"," >>$output for k in $hpKeys; do
v="$port_vn[asym]"; echo -e " \"constantAsymmetry\": \"${!v}\"," >>$output v="$port_vn[$k]";[[ -n "${!v}" ]] && echo -e " \"$k\": \"${!v}\"," >>$output
done
# print remaining keys
for k in $port_ppsi_keys; do
[[ "$hpKeys" != *"$k"* ]] && (v="$port_vn[$k]"; [[ -n "${!v}" ]] && echo -e " \"$k\": \"${!v}\"," >>$output)
done
# start instances # start instances
echo -e " \"instances\": [" >>$output echo -e " \"instances\": [" >>$output
...@@ -240,20 +240,13 @@ function gen_ppsi_conf_json() { ...@@ -240,20 +240,13 @@ function gen_ppsi_conf_json() {
echo -e ",\n {" >>$output echo -e ",\n {" >>$output
fi fi
v="$inst_vn[name]" ; echo -e " \"port\": \"${!v}\"," >>$output hpKeys="port proto iface profile"
v="$inst_vn[rx]"; echo -e " \"ingressLatency\": \"${!v}\"," >>$output for k in $hpKeys; do
v="$inst_vn[tx]"; echo -e " \"egressLatency\": \"${!v}\"," >>$output v="$inst_vn[$k]";[[ -n "${!v}" ]] && echo -e " \"$k\": \"${!v}\"," >>$output
v="$inst_vn[proto]"; echo -e " \"proto\": \"${!v}\"," >>$output done
v="$inst_vn[masteronly]"; [[ -n "${!v}" ]] && echo -e " \"masterOnly\": \"${!v}\"," >>$output # print remaining keys
v="$inst_vn[vlan]" ; [[ -n "${!v}" ]] && echo -e " \"vlan\": \"${!v}\"," >>$output for k in $inst_ppsi_keys ; do
v="$inst_vn[dm]" ; [[ "${!v}" != "e2e" ]] && echo -e " \"mechanism\": \"${!v}\"," >>$output [[ "$hpKeys" != *"$k"* ]] && (v="$inst_vn[$k]";[[ -n "${!v}" ]] && echo -e " \"$k\": \"${!v}\"," >>$output)
v="$inst_vn[prof]" ; echo -e -n " \"profile\": \"${!v}\"" >>$output
v="$inst_vn[dstate]"; [[ -n "${!v}" ]] && echo -e -n ",\n \"desiredState\": \"${!v}\"" >>$output
for p in $inst_opt_parameters ; do
plc=$(inst_opt_parameter_to_instance_index ${p})
v="$inst_vn[$plc]"
[[ -n "${!v}" ]] && echo -e -n ",\n \"$plc\": \"${!v}\"" >>$output
done done
# end instance # end instance
...@@ -275,18 +268,130 @@ function gen_ppsi_conf_json() { ...@@ -275,18 +268,130 @@ function gen_ppsi_conf_json() {
echo "}" >>$output echo "}" >>$output
} }
function inst_opt_parameter_to_instance_index() { function disable_L1sync() {
echo `echo $1 | tr '[:upper:]_' '[:lower:]-'` local inst=$1
local lv
for k in l1SyncEnabled l1SyncTxCoherencyIsRequired l1SyncRxCoherencyIsRequired \
l1SyncCongruencyIsRequired logL1SyncInterval l1SyncReceiptTimeout l1SyncOptParamsEnabled; do
lv="$inst[$k]"; unset ${lv}
done
}
function set_profile_for_PTP() {
local inst=$1
local lv
disable_L1sync $inst
}
function set_profile_for_WR() {
local inst=$1
local lv
disable_L1sync $inst
# Egress and ingress latencies already integrated in WR calculation
for k in egressLatency ingressLatency ; do
lv="$inst[$k]"; unset ${lv}
done
}
function set_profile_for_HA() {
local inst=$1
local lv
# L1SYNC mandatory values
for k in l1SyncEnabled l1SyncTxCoherencyIsRequired l1SyncRxCoherencyIsRequired l1SyncCongruencyIsRequired ; do
lv="$inst[$k]"; eval ${lv}="y"
done
lv="$inst[l1SyncOptParamsEnabled]"; eval ${lv}="n"
# Free parameters
test ! ${inst_vn[logL1SyncInterval]+_} && (lv="$inst_vn[logL1SyncInterval]"; eval ${lv}="0") # Set default value
test ! ${inst_vn[l1SyncReceiptTimeout]+_} && (lv="$inst_vn[l1SyncReceiptTimeout]"; eval ${lv}="3") # Set default value
# Force asymmetry correction
lv="$inst[asymmetryCorrectionEnable]"; eval ${lv}="y"
}
function set_instance_profile() {
local inst=$1
local lv="$inst[profile]"
local value=${!lv}
if [ "${value}" == "wr" ]; then
eval ${lv}="wr"
set_profile_for_WR $inst
elif [ "${value}" == "ha" ]; then
eval ${lv}="ha"
elif [ "${value}" == "custom" ]; then
eval ${lv}="custom"
elif [ "${value}" == "none" ] || [ "${value}" == "ptp" ]; then
# do nothing
eval ${lv}="ptp"
set_profile_for_PTP $inst
elif [ -n "$p" ]; then
echo "$script_name: Invalid parameter profile=\"$p\" in ${inst}"
eval ${lv}="ha"
else
# default
eval ${lv}="ha"
fi
value=${!lv}
if [ "${value}" == "ha" ]; then
set_profile_for_HA $inst
fi
}
function build_port_ppsi_keys() {
local s=""
for i in "${!port_dotc_ppsi_key_mapping[@]}"
do
value=`echo ${port_dotc_ppsi_key_mapping[$i]} | head -n1 | cut -d " " -f1`;
[[ "$s" != *"$value"* ]] && s="$s $value"
done
echo `echo $s | xargs -n1 | sort -u | xargs`
}
function build_inst_ppsi_keys() {
local s=""
for i in "${!inst_dotc_ppsi_key_mapping[@]}"
do
value=`echo ${inst_dotc_ppsi_key_mapping[$i]} | head -n1 | cut -d " " -f1`;
[[ "$s" != *"$value"* ]] && s="$s $value"
done
echo `echo $s | xargs -n1 | sort -u | xargs`
} }
globals_indexes='clock-class clock-accuracy clock-allan-variance domain-number priority1 priority2 time-source externalPortConfigurationEnabled' globals_indexes='clock-class clock-accuracy clock-allan-variance domain-number priority1 priority2 time-source externalPortConfigurationEnabled'
globals_not_yet_supported='time-source' globals_not_yet_supported='time-source'
port_indexes='fiber asym dcoeff iface'
instance_indexes='rx tx proto prof dm monitor dstate masteronly' # PHYSICAL PORT PARAMETERS
inst_opt_parameters='ANNOUNCE_INTERVAL ANNOUNCE_RECEIPT_TIMEOUT SYNC_INTERVAL MIN_DELAY_REQ_INTERVAL MIN_PDELAY_REQ_INTERVAL L1SYNC_INTERVAL L1SYNC_RECEIPT_TIMEOUT' declare -A port_dotc_ppsi_key_mapping='(\
echo "${x}" | tr '_' '-' | sed -e "s/\b\(.\)/\u\1/g" [FIBER]="delayCoefficient" \
# update instance_indexes with inst_opt_parameters [IFACE]="iface" \
instance_indexes="$instance_indexes `echo ${inst_opt_parameters} | tr '[:upper:]' '[:lower:]'`" [CONSTANT_ASYMMETRY]="constantAsymmetry" \
)'
port_dotc_keys="${!port_dotc_ppsi_key_mapping[@]}"
port_ppsi_keys=$(build_port_ppsi_keys)
# PPSI INSTANCE PARAMETERS
declare -A inst_dotc_ppsi_key_mapping='(\
[PROTOCOL_RAW]="proto raw" [PROTOCOL_UDP_IPV4]="proto udp" \
[MECHANISM_E2E]="mechanism e2e" [MECHANISM_P2P]="mechanism p2p" \
[PROFILE_PTP]="profile ptp" [PROFILE_WR]="profile wr" [PROFILE_HA]="profile ha" [PROFILE_CUSTOM]="profile custom" \
[DESIRADE_STATE_MASTER]="desiredState master" [DESIRADE_STATE_SLAVE]="desiredState slave" [DESIRADE_STATE_PASSIVE]="desiredState passive" \
[ANNOUNCE_INTERVAL]="logAnnounceInterval" [ANNOUNCE_RECEIPT_TIMEOUT]="announceReceiptTimeout" \
[MIN_DELAY_REQ_INTERVAL]="logMinDelayReqInterval" [MIN_PDELAY_REQ_INTERVAL]="logMinPDelayReqInterval" \
[ASYMMETRY_CORRECTION_ENABLE]="asymmetryCorrectionEnable" \
[BMODE_MASTER_ONLY]="masterOnly" \
[EGRESS_LATENCY]="egressLatency" [INGRESS_LATENCY]="ingressLatency" \
[L1SYNC_ENABLED]="l1SyncEnabled" [L1SYNC_INTERVAL]="logL1SyncInterval" \
[L1SYNC_RECEIPT_TIMEOUT]="l1SyncReceiptTimeout" [L1SYNC_OPT_PARAMS_ENABLED]="l1SyncOptParamsEnabled" \
[L1SYNC_TX_COHERENCY_IS_REQUIRED]="l1SyncTxCoherencyIsRequired" \
[L1SYNC_RX_COHERENCY_IS_REQUIRED]="l1SyncRxCoherencyIsRequired" [L1SYNC_CONGRUENCY_IS_REQUIRED]="l1SyncCongruencyIsRequired" \
)'
inst_dotc_keys="${!inst_dotc_ppsi_key_mapping[@]}"
inst_ppsi_keys=$(build_inst_ppsi_keys)
declare -A globals declare -A globals
...@@ -364,35 +469,23 @@ for i_port in {01..18}; do # scan all the physical ports ...@@ -364,35 +469,23 @@ for i_port in {01..18}; do # scan all the physical ports
i_port_int=$(expr $i_port + 0) i_port_int=$(expr $i_port + 0)
# parse parameters # parse parameters
port_key="CONFIG_PORT${i_port}_PARAMS" port_key="CONFIG_PORT${i_port}"
port_key_value=${!port_key}
# save pairs into array
IFS=',' read -a pair_array <<< "${port_key_value}"
for pair in ${pair_array[@]}
do
# split pairs
IFS='=' read param value <<< "$pair"
case "$param" in
"fiber")
v="$port_vn[fiber]"
eval ${v}="$value"
v="$port_vn[dcoeff]"
eval ${v}=$(get_fiber_delay_coeff $value)
;;
"asym")
v="$port_vn[asym]"
eval ${v}="$value"
;;
"iface")
v="$port_vn[iface]"
eval ${v}="$value"
;;
*)
echo "$script_name: Invalid parameter $param in ${port_key}" ;;
esac
done
for p in $port_dotc_keys; do
k="${port_key}_$p"
plc="${port_dotc_ppsi_key_mapping[$p]}"
if [ -n "${!k}" ] && [ "$plc" != "" ]; then
v="$port_vn[${plc}]";
if [ "$p" == "FIBER" ] ; then
# Special treatment for FIBER : Retreive the delay coefficient from the DB
fiber_num="${!k}"
eval ${v}=$(get_fiber_delay_coeff $fiber_num)
else
eval ${v}="${!k}"
fi
fi
done
for j_inst in {01..02}; do # scan all the ppsi instances for a given port for j_inst in {01..02}; do # scan all the ppsi instances for a given port
#remove leading zero from i_port (params has numbers with leading zero, #remove leading zero from i_port (params has numbers with leading zero,
...@@ -404,111 +497,50 @@ for i_port in {01..18}; do # scan all the physical ports ...@@ -404,111 +497,50 @@ for i_port in {01..18}; do # scan all the physical ports
if [ -n "${inst_count_value}" ]; then if [ -n "${inst_count_value}" ]; then
break # number of defined instances reached break # number of defined instances reached
fi fi
# Set default values
tx=0
rx=0
inst_vn="${port_vn}inst${j_inst}" inst_vn="${port_vn}inst${j_inst}"
declare -A $inst_vn declare -A $inst_vn
inst_key="CONFIG_PORT${i_port}_INST${j_inst}" inst_key="CONFIG_PORT${i_port}_INST${j_inst}"
inst_key_value=${!inst_key}
IFS=',' read -a inst_pair_array <<< "${inst_key_value}" for p in $inst_dotc_keys; do
for pair in ${inst_pair_array[@]}
do
# split pairs
IFS='=' read param value <<< "$pair"
case "$param" in
"tx")
v="$inst_vn[tx]"
eval ${v}="$value"
;;
"rx")
v="$inst_vn[rx]"
eval ${v}="$value"
;;
"proto")
v="$inst_vn[proto]"
eval ${v}="${value,,}"
;;
"ext" | "prof")
v="$inst_vn[prof]"
eval ${v}="${value,,}"
;;
"dm")
v="$inst_vn[dm]"
eval ${v}="${value,,}"
;;
"monitor")
continue;; # read by SNMP directly from the config
*)
echo "$script_name: Invalid parameter $param in ${inst_key}" ;;
esac
done
for p in $inst_opt_parameters; do
k="${inst_key}_$p" k="${inst_key}_$p"
plc=$(inst_opt_parameter_to_instance_index ${p}) plc="${inst_dotc_ppsi_key_mapping[$p]}"
if [ -n "$k" ]; then if [ -n "${!k}" ] && [ "$plc" != "" ]; then
v="$inst_vn[${plc}]"; eval ${v}="${!k}" # Check if the string contains 2 elements separated by a space
OIFS=${IFS}; IFS=' ' read -a tokens <<< "${plc}"; IFS=${OIFS}
plc=${tokens[0]};
v="$inst_vn[${plc}]"
if [ "${#tokens[@]}" -gt "1" ] ; then
eval ${v}="${tokens[1]}";
else
eval ${v}="${!k}"
fi
fi fi
done done
v="$inst_vn[proto]" v="$inst_vn[proto]"
if [ ! -n "${!v}" ]; then if [ ! -n "${!v}" ]; then
eval ${v}="raw" # proto not defined. Set it to raw by default eval ${v}="raw" # proto not defined. Set it to raw by default
fi fi
# set the profile # set the profile
v="$inst_vn[prof]" set_instance_profile $inst_vn
p_prof=${!v} v="$inst_vn[profile]"; p_profile=${!v}
if [ "${p_prof}" == "wr" ]; then
eval ${v}="whiterabbit"
t="$inst_vn[tx]"; eval ${t}="0"
t="$inst_vn[rx]"; eval ${t}="0"
elif [ "${p_prof}" == "ha" ]; then
eval ${v}="highaccuracy"
elif [ "${p_prof}" == "none" ] || [ "${p_prof}" == "ptp" ]; then
# do nothing
eval ${v}="ptp" >> $OUTPUT_FILE
p_prof="ptp"
elif [ -n "$p" ]; then
echo "$script_name: Invalid parameter prof=\"$p\" in ${inst_key}"
eval ${v}="highaccuracy"
p_prof="ha"
else
# default
eval ${v}="highaccuracy"
p_prof="ha"
fi
# define instance name # define instance name
v="$port_vn[iface]"; p_iface=${!v} v="$port_vn[iface]"; p_iface=${!v}
v="$inst_vn[proto]"; p_proto=${!v} v="$inst_vn[proto]"; p_proto=${!v}
v="$inst_vn[name]"; eval ${v}="${p_iface}-${j_inst_int}-${p_prof}-${p_proto}" v="$inst_vn[port]"; eval ${v}="${p_iface}-${j_inst_int}-${p_profile}-${p_proto}"
# if extPortConfiguration enabled, get the desired state # if extPortConfiguration enabled, get the desired state
if [ "$CONFIG_PTP_OPT_EXT_PORT_CONFIG_ENABLED" == 'y' ] ; then if [ "$CONFIG_PTP_OPT_EXT_PORT_CONFIG_ENABLED" == 'y' ] ; then
v="$inst_vn[dstate]"; v="$inst_vn[desiredState]";
eval ${v}="passive" # default value if [ -z "{!v}" ] ; then
k="${inst_key}_DESIRADE_STATE_SLAVE"; [ "${!k}" == 'y' ] && eval ${v}="slave" eval ${v}="passive" # default value
k="${inst_key}_DESIRADE_STATE_MASTER"; [ "${!k}" == 'y' ] && eval ${v}="master" fi
else v="$inst_vn[masteronly]"; unset ${v} # remove master only
v="$inst_vn[masteronly]";
k="${inst_key}_BMODE_MASTER_ONLY"; [ "$k" == 'y' ] && eval ${v}="y"
fi fi
# set delay mechanism
v="$inst_vn[dm]"
p=${!v}
if [ "${p}" = "p2p" -o "${p}" = "e2e" ]; then
# do nothing
true
elif [ -n "${p}" ]; then
echo "$script_name: Invalid parameter dm=\"${p}\" in ${inst_key}"
fi
# add vlans # add vlans
if [ "$CONFIG_VLANS_ENABLE" = "y" ]; then if [ "$CONFIG_VLANS_ENABLE" = "y" ]; then
unset ppsi_vlans; unset ppsi_vlans;
......
...@@ -107,7 +107,7 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix) ...@@ -107,7 +107,7 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix)
struct PortIdentity *pi = p; struct PortIdentity *pi = p;
struct ClockQuality *cq = p; struct ClockQuality *cq = p;
char format[16]; char format[16];
uint64_t sec, nano, pico; uint64_t sec, nano, pico, femto;
int i; int i;
char pname[128]; char pname[128];
...@@ -187,18 +187,26 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix) ...@@ -187,18 +187,26 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix)
#define TIME_FRACBITS 16 #define TIME_FRACBITS 16
#define TIME_FRACMASK 0xFFFF #define TIME_FRACMASK 0xFFFF
#define TIME_SIGNMASK 0x8000000000000000
case dump_type_time: case dump_type_time:
{ {
char sign='+'; char sign='+';
int64_t scaled_nsecs=t->scaled_nsecs; uint64_t scaled_nsecs=t->scaled_nsecs;
int64_t secs=t->secs;
if ( scaled_nsecs < 0) { if ( (scaled_nsecs & TIME_SIGNMASK) || secs<0) {
sign='-'; sign='-';
scaled_nsecs= ~scaled_nsecs+1;
secs=-secs;
} }
nano = scaled_nsecs >> TIME_FRACBITS; nano = scaled_nsecs >> TIME_FRACBITS;
pico = scaled_nsecs & TIME_FRACMASK; femto = scaled_nsecs & TIME_FRACMASK;
pico = (pico * 1000) >> TIME_FRACBITS; femto = (femto * 1000 * 1000 ) >> TIME_FRACBITS;
pico= (femto/1000);
if ((femto % 1000)>500) {
pico++; // rounding
}
printf("correct=%i, value=%10c%lli.%09"PRIu64".%03"PRIu64"\n", printf("correct=%i, value=%10c%lli.%09"PRIu64".%03"PRIu64"\n",
!is_incorrect(t),sign, t->secs, nano,pico); !is_incorrect(t),sign, t->secs, nano,pico);
} }
...@@ -212,15 +220,25 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix) ...@@ -212,15 +220,25 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix)
#define TIME_INTERVAL_FRACBITS 16 #define TIME_INTERVAL_FRACBITS 16
#define TIME_INTERVAL_FRACMASK 0xFFFF #define TIME_INTERVAL_FRACMASK 0xFFFF
#define TIME_INTERVAL_SIGNMASK 0x8000000000000000
case dump_type_TimeInterval: case dump_type_TimeInterval:
{ {
int64_t scaled_nsecs=*ti; char sign='+';
uint64_t scaled_nsecs=*ti;
if ( scaled_nsecs & TIME_INTERVAL_SIGNMASK) {
sign='-';
scaled_nsecs= ~scaled_nsecs+1;
}
nano = scaled_nsecs >> TIME_INTERVAL_FRACBITS; nano = scaled_nsecs >> TIME_INTERVAL_FRACBITS;
pico = scaled_nsecs & TIME_INTERVAL_FRACMASK; femto = scaled_nsecs & TIME_INTERVAL_FRACMASK;
pico = (pico * 1000) >> TIME_INTERVAL_FRACBITS; femto = (femto * 1000 * 1000 ) >> TIME_INTERVAL_FRACBITS;
printf("%10"PRId64".%03"PRIu64"\n", nano,pico); pico= (femto/1000);
if ((femto % 1000)>500) {
pico++; // rounding
}
printf("%10c%"PRId64".%03"PRIu64"\n", sign,nano,pico);
} }
break; break;
......
...@@ -118,9 +118,11 @@ static int hal_port_init(int index) ...@@ -118,9 +118,11 @@ static int hal_port_init(int index)
{ {
struct hal_port_state *p = &ports[index]; struct hal_port_state *p = &ports[index];
int i; int i;
char name[128]; char key[128];
int val, error; int val;
int wrInstanceFound=0;
int port_i; int port_i;
char *retValue;
/* index is 0..17, port_i 1..18 */ /* index is 0..17, port_i 1..18 */
port_i = index + 1; port_i = index + 1;
...@@ -128,15 +130,14 @@ static int hal_port_init(int index) ...@@ -128,15 +130,14 @@ static int hal_port_init(int index)
/* make sure the states and other variables are in their init state */ /* make sure the states and other variables are in their init state */
hal_port_reset_state(p); hal_port_reset_state(p);
/* read dot-config values for this index, starting from name */ /* read dot-config values to get the interface name */
error = libwr_cfg_convert2("PORT%02i_PARAMS", "iface", LIBWR_STRING, sprintf(key,"PORT%02i_IFACE",port_i);
name, port_i); if( (retValue=libwr_cfg_get(key))==NULL)
if (error)
return -1; return -1;
strncpy(p->name, name, 16); strncpy(p->name, retValue, 16);
/* check if the port is built into the firmware, if not, we are done */ /* check if the port is built into the firmware, if not, we are done */
if (!hal_port_check_presence(name, p->hw_addr)) if (!hal_port_check_presence(p->name, p->hw_addr))
return -1; return -1;
p->state = HAL_PORT_STATE_DISABLED; p->state = HAL_PORT_STATE_DISABLED;
...@@ -144,34 +145,36 @@ static int hal_port_init(int index) ...@@ -144,34 +145,36 @@ static int hal_port_init(int index)
/* Search an instance using the WR profile */ /* Search an instance using the WR profile */
for (i=1; i<=2; i++) { for (i=1; i<=2; i++) {
char str[32]; sprintf(key,"PORT%02i_INST%02i_PROFILE_WR",port_i,i);
if ( !(error = libwr_cfg_convert2("PORT%02i_INST%02i", "prof", LIBWR_STRING, if( ((retValue=libwr_cfg_get(key))!=NULL) && (*retValue=='y') ) {
str, port_i,i))) { wrInstanceFound++;
if ( strcasecmp("WR",str)==0 ) break; // Found
break; // Found
} }
} }
val = 18 * 800; /* magic default from previous code */ val = 18 * 800; /* magic default from previous code */
if ( !error ) { if ( wrInstanceFound ) {
// WR instance found // WR instance found
val = 18 * 800; /* magic default from previous code */ val = 18 * 800; /* magic default from previous code */
error = libwr_cfg_convert2("PORT%02i_INST%02i", "tx", LIBWR_INT, for ( i=0; i<2; i++ ) {
&val, port_i,i); char *latency=i==0 ? "EGRESS": "INGRESS";
if (error) uint32_t *phy_min=i==0 ? &p->calib.phy_tx_min: &p->calib.phy_rx_min;
pr_error("port %i (%s): no \"tx=\" specified\n",
port_i, name); sprintf(key,"PORT%02i_INST%02i_%s_LATENCY",port_i,i,latency);
p->calib.phy_tx_min = val; if( (retValue=libwr_cfg_get(key))==NULL ) {
pr_error("port %i (%s): no key \"%s\" specified\n",
error = libwr_cfg_convert2("PORT%02i_INST%02i", "rx", LIBWR_INT, port_i, p->name,key);
&val, port_i,i); } else {
if (error) if (sscanf(retValue, "%i", &val) != 1) {
pr_error("port %i (%s): no \"rx=\" specified\n", pr_error("port %i (%s): Invalid key \"%s\" value (%d)\n",
port_i, name); port_i, p->name, key,*retValue);
p->calib.phy_rx_min = val; }
}
*phy_min = val;
}
} else { } else {
pr_error("port %i (%s): no WhiteRabbit instance defined\n", pr_error("port %i (%s): no WhiteRabbit instance defined\n",
port_i, name); port_i, p->name);
p->calib.phy_tx_min = p->calib.phy_rx_min = val; p->calib.phy_tx_min = p->calib.phy_rx_min = val;
} }
...@@ -187,21 +190,24 @@ static int hal_port_init(int index) ...@@ -187,21 +190,24 @@ static int hal_port_init(int index)
p->clock_period = REF_CLOCK_PERIOD_PS; p->clock_period = REF_CLOCK_PERIOD_PS;
/* Get fiber type */ /* Get fiber type */
error = libwr_cfg_convert2("PORT%02i_PARAMS", "fiber", p->fiber_index = 0; /* Default fiber value */
LIBWR_INT, &p->fiber_index, port_i); sprintf(key,"PORT%02i_INST%02i_FIBER",port_i,i);
if( (retValue=libwr_cfg_get(key))==NULL ) {
if (error) { pr_error("port %i (%s): no key \"%s\" specified. Default fiber 0\n",
pr_error("port %i (%s): " port_i, p->name,key);
"no \"fiber=\" specified, default fiber to 0\n", } else {
port_i, name); if (sscanf(retValue, "%i", &p->fiber_index) != 1) {
p->fiber_index = 0; pr_error("port %i (%s): Invalid key \"%s\" value (%d). Default fiber 0\n",
port_i, p->name, key,*retValue);
} }
}
if (p->fiber_index > 3) { if (p->fiber_index > 3) {
pr_error("port %i (%s): " pr_error("port %i (%s): "
"not supported \"fiber=\" value, default to 0\n", "not supported fiber value (%d), default to 0\n",
port_i, name); port_i, p->name,p->fiber_index);
p->fiber_index = 0; p->fiber_index = 0;
} }
/* Used to pre-calibrate the TX path for each port. No more in V3 */ /* Used to pre-calibrate the TX path for each port. No more in V3 */
......
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