PTP
PTP stack configuration
- PTP
Configure the PTP (IEEE 1588) stack that runs as firmware on the switch’s embedded cores: stacks, clocks, ports, time sources, time-of-day input and output, servo, unicast masters and slaves, telecom profiles and debugging.
The first word selects the area and can be abbreviated to its capital letters.
PTP <area> HELPprints the help of that area only (for examplePTP Port HELP). An unknown word prints the usage. Most forms end by printingPASSED,FAILEDorINVALID SYNTAX. Many forms takeStack=<id>,Clock=<num>orPort=<num>selectors, which default to 0.The built-in help is incomplete. The shell also has the areas
TsFifoandTsOffset,PTP Stack Destroy, and further keys in several areas; they are listed below.SONiC does not use the SDK PTP stack, and on SONiC Trident 3 switches the embedded cores that would run the PTP firmware are held in reset (see MCSStatus). Every form that talks to a PTP stack or clock fails there:
ptp clock show,ptp port show,ptp todoffset getand similar print<function>() Error... (FCN RETURN= -16); -16 is the SDK’s “Feature unavailable”.ptp servo show,ptp master show,ptp slave show,ptp peerdataset,ptp countersandptp telecom slave showprint nothing of their own.ptp time getprintsTime: 0.000000000andptp channels statusprintsChannel configuration NOT supported for the servo type.
Each of these is followed by the SAI shell’s
Failed to execute the diagnostic command. Error: Operation failed.The forms that only touch the shell’s own settings still work: theHELPforms,ptp debug,ptp log,ptp modular get,ptp ctdev options,ptp registerandptp diagshell options.Safety:
Show,Get,PeerDatasetandHELPforms are read-only; every other form changes the PTP firmware state.PTP Stack CreateandDestroystart and stop the firmware stack.Hardware-validated — Print the help of one sub-command
drivshell> ptp clock help PTP Clock <SubCommand> [...] PTP Clock Create NumPorts=<num_ports> ID=<clock_id> P1=<priority1> SlaveOnly=<y/N> OneWay=<y/N> TELecom=<y/N> DELayREQuestALT=<y/N> TRaceability=<y/N> PROFile=<0=8265.1, 1=8275.1, 2=8275.2> OffsetScaledLogVar=<> P2=<> HoldoverInspecTime=<sec> TargetedDelReqRespTxEn=<0/1> UntaggedDelReqRespTxEn=<0/1> NtpTodDisable=<0/1> PtpTodDisable=<0/1> PTP Clock Set TRACEability=<NONE|FREQ|TIME|FREQ-TIME|NO-OVERRIDE> PTP Clock Set PKTflags=<SYNC-UNCERTAIN> PTP Clock Show
- PTP Stack <Create [TS0TS1CombinedModeEn=<0|1>] | Destroy | Performance>
Create or destroy the PTP stack, or print the firmware’s CPU and memory use.
Destroyis not in the built-in help.Unvalidated
drivshell> ptp stack performance
- PTP Clock <Create … | Set TRACEability=<…> | Set PKTflags=<…> | Show>
Create a PTP clock or show/modify it. The shell also accepts these
Createkeys, which the built-in help does not list:SYNCOAM,DOMain,MaxUnicastMasters,MaxAcceptableMasters,MaxUnicastSlaves,MaxMulticastSlaveStats,LocalPriority,MaxStepsRemoved,SyncReceiptTo,DelayRespReceiptTo.Hardware-validated
drivshell> ptp clock show 0:bcm_common_ptp_clock_get: _bcm_ptp_clock_cache_info_get failed bcm_ptp_clock_get() Error... (FCN RETURN= -16) Failed to execute the diagnostic command. Error: Operation failed.
- PTP Port <Configure | Show | Dropcounter> [<port_num>] …
Configure or show a PTP port. The shell also accepts these
Configurekeys, which the built-in help does not list:InVlan,TpidOUT,TpidIN,PortType,LocalPriority,FormatType,CustomFormatStr,CustomMaskStr,EtherType,OffsetSec,OffsetNSand a group ofVirtualPort…keys.Hardware-validated
drivshell> ptp port show 1 bcm_ptp_clock_port_info_get() Error... (FCN RETURN= -16) Failed to execute the diagnostic command. Error: Operation failed.
- PTP Time <Get | Set TimeSec=<s> [TimeNS=<ns>]>
Get or set the PTP time.
Hardware-validated
drivshell> ptp time get Time: 0.000000000 Failed to execute the diagnostic command. Error: Operation failed.
- PTP CHannels <Set … | Get | STatus>
Configure the clock’s time sources.
Setalso accepts a third source (ThirdType,ThirdSource,ThirdFrequency…,ThirdTime…), which the built-in help does not list.Hardware-validated
drivshell> ptp channels status Channel configuration NOT supported for the servo type Failed to execute the diagnostic command. Error: Operation failed.
- PTP SIGnals <Set Pin=<pin> Frequency=<hz> [PhaseLock=<y/n>] [Width=<ns>] [Offset=<ns>] [OutputSynce=<n>] | Get>
Configure output signals such as 1PPS on a GPIO pin.
Without a running PTP stack,
ptp signals getreportsConfigured signals : 0and then still prints sixSignal[n]lines whose values (pin=2072035040,frequency=32744…) are uninitialised memory, not configuration. Ignore them; the command fails at the end.Hardware-validated
drivshell> ptp signals get Configured signals : 0 Signal[0]: pin=2072035040, frequency=32744, phaselock=y, width=32744, offset=1427836144, outputsynce=32744 Signal[1]: pin=-2022264699, frequency=32744, phaselock=y, width=32744, offset=-1923805696, outputsynce=32744 Signal[2]: pin=0, frequency=1879080936, phaselock=y, width=32744, offset=-1923844835, outputsynce=32744 Signal[3]: pin=-2022264575, frequency=32744, phaselock=y, width=32744, offset=0, outputsynce=0 Signal[4]: pin=0, frequency=1728085992, phaselock=n, width=0, offset=-1921315719, outputsynce=32744 Signal[5]: pin=-1728022912, frequency=32744, phaselock=y, width=32744, offset=1342252296, outputsynce=32744 Failed to execute the diagnostic command. Error: Operation failed.
- PTP SyncPhy PBM=<pbmp> [FrameSyncPin=<pin>] [SyncPin=<pin>] [UsePHYSYNCcb=<0|1>]
Synchronise 1588-aware PHYs on the ports of
PBM(see Ports and port bitmaps).Unvalidated
drivshell> ptp syncphy pbm=xe0
- PTP ToDOut [EtherNet] <setting> …
Configure time-of-day output (UART or Ethernet). The shell also accepts
UartNum, which the built-in help does not list.Unvalidated
drivshell> ptp todout off
- PTP ToDIn [EtherNet] <setting> …
Configure time-of-day input. The shell also accepts
BaudRateandUartNum; the built-in help lists neither, although its example usesBaudRate.Unvalidated
drivshell> ptp todin off
- PTP SerVO <SHow [IPDV | PERFormance | PhaseHoldover | Frequency] | CONFig … | CLeaR PERFormance | SET … | IPDVCONFig … | TESTmode <n>>
Show or configure the servo.
Stack_id/Clock_numkeys select the clock.Hardware-validated
drivshell> ptp servo show Failed to execute the diagnostic command. Error: Operation failed.
- PTP MaSTer <ADD … | ReMove … | SHow [DetaiL]>
Manage unicast master entries.
Hardware-validated
drivshell> ptp master show Failed to execute the diagnostic command. Error: Operation failed.
- PTP SLaVe <ADD … | ReMove … | SHow [STATic[=y/n]]>
Manage unicast slave entries.
Hardware-validated
drivshell> ptp slave show Failed to execute the diagnostic command. Error: Operation failed.
- PTP PeerDataset [Port=<port_num>]
Get the PTP peer dataset. Read-only.
Hardware-validated
drivshell> ptp peerdataset Failed to execute the diagnostic command. Error: Operation failed.
- PTP CounTeRs [CLeaR] [Port=<port_num>] [CounterBitMaP=<bitmap>]
Show, or with
CLeaRclear, PTP packet counters.Hardware-validated
drivshell> ptp counters Failed to execute the diagnostic command. Error: Operation failed.
- PTP DeBug [[+|-]<option> …]
Set or clear firmware debug options. The shell also accepts
DMAC,SMAC,TPid,Vlan,DstIP,SrcIP,TTL,PORTnumandSHOWparam(destination of the debug stream), which the built-in help does not list.Hardware-validated
drivshell> ptp debug Debugging is enabled for: Debugging is disabled for: SYs_Info SYs_Warning SYs_Error SYs_Critical STack_Info STack_Warning STack_Error STack_Critical Servo_Timestamps Servo_Diagnostics Servo_Output Servo_Channels Other permissible options: SYs_All, STack_All
- PTP Log [[+|-]<option> …]
Set or clear UDP logging options.
Hardware-validated
drivshell> ptp log Logging is enabled for: Debugging is disabled for: Log_Debug Log_PDV Log_Timestamps Log_PKT_In Log_PKT_Out Log_Gpio_DPLL Log_Synth_DPLL Log_SyncE_DPLL Log_CTDEV Log_FreqPhase Log_Scratch Other permissible options: Log_All
- PTP REGister [Signal] [Management] [Events] [ARP]
Register diag-shell callbacks for PTP messages and events. The shell also accepts
SignalDenyandTags.Hardware-validated
drivshell> ptp register events
- PTP TELecom <CLOCK CREATE … | PORT CONFig … | SLaVe … | MaSTer … | OPTions [VERBose=y/n]>
Telecom-profile (G.8265.1) clock, port, slave and master configuration.
Hardware-validated
drivshell> ptp telecom slave show Failed to execute the diagnostic command. Error: Operation failed.
- PTP CTDEV OPTions [ENable=y/n] [VERBose=y/n] [ALPHA_Numerator=<n>] [ALPHA_Denominator=<n>]
Set the CTDEV algorithm options: enable, verbosity and the alpha filter coefficient. Even without options it applies the settings and prints the alpha it set,
bcm_common_ptp_ctdev_alpha_set(): ALPHA = 63/64by default; this works without a PTP stack.Hardware-validated
drivshell> ptp ctdev options bcm_common_ptp_ctdev_alpha_set(): ALPHA = 63/64
- PTP MODULAR <GET | SET [ENable=y/n] [VERBose=y/n] [PHYTS=y/n] [FrameSyncPIN=<pin>] [PBM=<pbmp>]>
Get or set modular-system (PHY timestamping) options.
Hardware-validated
drivshell> ptp modular get Modular System (Control Parameters and Options). Unit: 0 Stack: 0 Clock: 0 -------------------------------------------------------------------------------- Enable : N Verbose: N PHY TS : N
- PTP DIAGshell <OPTions [VERBose=y/n] [VerboseEvents=y/n] | SYNC>
Diag-shell PTP options;
VerboseEventsis not in the built-in help.Hardware-validated
drivshell> ptp diagshell options
- PTP TsFifo <TimeInit | CaptureSTART | CaptureSTOP>
Not in the built-in help. Initialise time or start/stop timestamp-FIFO capture; prints
ts_fifo capture start. rv:<n>/stop.Unvalidated
drivshell> ptp tsfifo capturestart
- PTP TsOffset SET [Offset=<n>] [Interval=<n>] [TsCounter=<n>]
Not in the built-in help. Set a timestamp offset (defaults
Offset=1,Interval=1,TsCounter=0).Unvalidated
drivshell> ptp tsoffset set offset=1
- PTP PacKeTDump [[+|-]<option> …] [Count=<n>]
Set or clear packet-dump options.
Unvalidated
drivshell> ptp packetdump
- PTP ToDOffSet <Set [NtpSec=<s>] [NtpNSec=<ns>] [PtpSec=<s>] [PtpNSec=<ns>] | Get>
Set or get the PTP and NTP ToD offsets.
Hardware-validated
drivshell> ptp todoffset get cmd_ptp_tod_offset() Error... (FCN RETURN= -16) Failed to execute the diagnostic command. Error: Operation failed.
- PTP HELP [LIST | <subcommand>]
PTP HELP LISTprints the table names in two columns (PTP HELP <subcommand> with <subcommand> from:);PTP HELP <subcommand>prints that entry’s usage. Read-only.Hardware-validated
drivshell> ptp help list PTP HELP <subcommand> with <subcommand> from: Stack Clock Port Time CHannels SIGnals SyncPhy ToDOut ToDIn SerVO MaSTer SLaVe PeerDataset CounTeRs DeBug Log REGister TELecom CTDEV MODULAR DIAGshell TsFifo TsOffset PacKeTDump ToDOffSet HELP
Built-in help
PTP Stack <subcommand> PTP Stack Create TS0TS1CombinedModeEn=<0/1> Creates a PTP Stack PTP Stack Performance Prints ToP CPU and Memory Info to debug PTP Clock <SubCommand> [...] PTP Clock Create NumPorts=<num_ports> ID=<clock_id> P1=<priority1> SlaveOnly=<y/N> OneWay=<y/N> TELecom=<y/N> DELayREQuestALT=<y/N> TRaceability=<y/N> PROFile=<0=8265.1, 1=8275.1, 2=8275.2> OffsetScaledLogVar=<> P2=<> HoldoverInspecTime=<sec> TargetedDelReqRespTxEn=<0/1> UntaggedDelReqRespTxEn=<0/1> NtpTodDisable=<0/1> PtpTodDisable=<0/1> PTP Clock Set TRACEability=<NONE|FREQ|TIME|FREQ-TIME|NO-OVERRIDE> PTP Clock Set PKTflags=<SYNC-UNCERTAIN> PTP Clock Show PTP Port <SubCommand> [port_num] [...] PTP Port Configure [port_num] MAC=<macaddr> IP=<ipaddr> IPv6=<ip6addr> MultiCast=<Y/n> WILDcard=<y/N> Prio=<prio> logAnnounceInterval=<intv> logSyncInterval=<intv> Vlan=<tag> logDelayrequestInterval=<intv> TimestampMechanism=<ToP|RCPU|PHY|Unimac32|Unimac48> TTL=<ttl> DSCP=<ip_dscp> rxMapCriteria=<rx_match_criteria_mask> RxPortMaskL=<match_rx_pbmp_1-31> RxPortMaskH=<match_rx_pbmp_32-63> PTP Port Show [port_num] PTP Port Dropcounter [port_num] Config ENable=<y/N> PTP Port Dropcounter [port_num] Show PTP Time Set or get the PTP time PTP Time Set TimeSec=<timeSec> [TimeNS=<timeNS>] PTP Time Get PTP CHannels Configure sources of time PTP CHannels Set Num=<num_channels> PrimaryType=<ch1_type> PrimarySource=<ch1_source> PrimaryFrequency=<ch1_freq> PrimaryFrequencyEnabled=<ch1_freq_en> PrimaryFrequencyPriority=<ch1_freqprio> PrimaryTimeEnabled=<ch1_timeenabled> PrimaryTimePriority=<ch1_timeprio> BackupTimeInputSynce=<ch1_input_synce> [BackupType=<ch2_type>] [BackupSource=<ch2_source>] [BackupFrequency=<ch2_freq>] [BackupFrequencyEnabled=<ch2_freq_en> [BackupFrequencyPriority=<ch2_freqprio>] [BackupTimeEnabled=<ch2_time_en> [BackupTimePriority=<ch2_timeprio>] [BackupSynceInputType=<0/1> [NoL1MuxSel=<0/1> PTP CHannels Get PTP CHannels STatus PTP SIGnals Configure output signals PTP SIGnals Set Pin=<pin#> Frequency=<Hz> PhaseLock[=y/n] Width=<ns> Offset=<ns> OutputSynce=<output_synce> ex. "ptp signals set p=1 freq=1 pl=y width=100000000" for 1PPS on GPIO pin=1 PTP SIGnals Get PTP SyncPhy Synchronize 1588-aware PHYs PTP SyncPhy PBM=<port bitmap> [FrameSyncPin=<pin#>] [SyncPin=<pin#>] [UsePHYSYNCcb=<1/0>] defaults are FrameSyncPin=3, SyncPin=-1 (-1 corresponds to BroadSync Heartbeat),UsePHYSYNCcb=0 PTP ToDOut [EtherNet] <setting> [OffsetNS=<offsetNS>] [OffsetSec=<offsetSec>] [Delay=<delayNS>] [CustomFormat=<format_string>] [PPSJitter=<nsec>] [DestMac=<dmac>] [SrcMac=<smac>] [VLAN=<vid>] [EtherType=<etype>] [BaudRate=<baudrate>] [ToDOutPin=<pin>] EnableTimestamperSync=[0/1] [UartParity=<parity>] where <setting> = | Off | NMEAzda | ISO8601 | NTP | UBlox | | ChinaMobile | ChinaTelecom | BCM | BCMTS | CUSTom | G8271 G8271 supports Serail and Ethernet. Diag shell sample code for ToD over Ethernet only supported baudrates are 300|600|1200|1800|2400|4800|9600|19200|38400|57600|115200|230400 supported uart parity NONE|ODD|EVEN Examples: PTP ToDOut ISO8601 Delay=50000000 OffsetSec=1 BaudRate=9600 UartParity=NONE Configure UART output with ISO format, delayed from 1PPS edge by 50ms, and outputting the time associated with the following 1PPS edge PTP ToDOut EtherNet BCM DestMac=00:00:01:00:00:01 SrcMac=00:00:02:00:00:02 VLAN=1 EtherType=0x5006 Configure Ethernet output with Broadcom binary format, with specified L2 information PTP ToDOut EtherNet off Disable Ethernet TOD output PTP ToDIn [EtherNet] <setting> [OffsetNS=<offsetNS>] [OffsetSec=<offsetSec>] [CustomFormat=<format_string>] [CustomMask=<mask_string>] [DestMac=<dmac>] [SrcMac=<smac>] [VLAN=<vid>] [EtherType=<etype>] [EnableTimestamperSync=<0/1>] [UartParity=<parity>] where <setting> = | Off | NMEAzda | ISO8601 | NTP | UBlox | | ChinaMobile | ChinaTelecom | BCM | BCMTS | CUSTom | G8271 G8271 supports Serail and Ethernet. Diag shell sample code for ToD over Ethernet only Examples: PTP ToDIn ISO8601 OffsetSec=1 OffsetNS=0 BaudRate=9600 UartParity=NONE Configure ToD input via UART with ISO format, PTP ToDIn EtherNet BCM DestMac=00:00:01:00:00:01 SrcMac=00:00:02:00:00:02 VLAN=1 EtherType=0x5006 Configure ToD input via Ethernet with Broadcom binary format, with specified L2 information PTP ToDIn off Disable ToD input PTP SerVO <subcommand> [<stack_id>] [<clock_num>] [...] PTP SerVO SHOW Basic servo status PTP SerVO SHOW IPDV Shows IPDV metrics PTP SerVO SHOW PERFormance Shows performance metrics PTP SerVO SHOW PhaseHoldover PTP SerVO SHOW Frequency PTP SerVO CONFig OSCillator_type="OCXO"/"MINIocxo" [SERVo="EXTernal"/"BroadCoM"] [TRANSport_mode=<transport>] [FreqCorr=<offset_ppt>] [FreqCorrTS=<offset_sec>] [PhaseOnly=N/y] [FreeRun=N/y] Set/show servo configuration. <transport>: ETHernet, SLOWethernet, HIGHJITter PTP SerVO CLEAR PERFormance Clears performance metrics PTP SerVO SET Frequency Correction=<corr_ppt> Offset=<offset_ppt> PTP SerVO SET PhaseHoldover [UseFixed=<y/n>] [DeltaOffset=<offset>] [FixedOffset=<offset>] [SLEWrate=<slew>] [SYNCoffset=<offset>] PTP SerVO IPDVCONFig [ObservationInterval=<intv>] [Threshold=<thresh>] [PacingFactor=<pf>] Set/show IPDV configuration PTP SerVO TESTmode <n> Configures servo for test. PTP MaSTer <subcommand> [STATic[=y/n]] [Port=<port_num>] [...] PTP MaSTer ADD [IP|IPv6=<ip>] [MAC=<mac>] [logAnnounceInterval=<value>] [logSyncInterval=<value>] [logDelayreqInterval=<value>] [AnnounceSERVice=y/n] [SyncSERVice=y/n] [DelaySERVice=y/n] [SIGnalingDURation=<sec>] PTP MaSTer ReMove [IP|IPv6=<ip>] PTP MaSTer SHow PTP MaSTer SHow DetaiL PTP SLaVe <subcommand> [Port=<port_num>] [...] PTP SLaVe ADD [IP|IPv6=<ip>] [MAC=<mac>] [announceReceiptTimeout=<value>] [logAnnounceInterval=<value>] [logSyncInterval=<value>] [logminDelayreqInterval=<value>] PTP SLaVe ReMove [IP|IPv6=<ip>] PTP SLaVe SHow [STATic[=y/n]] PTP PeerDataset [Port=<port_num>] Get PTP peer dataset. PTP CounTeRs CLeaR [Port=<port_num>] [CounterBitMaP=<counter_bitmap>] Get or Clear PTP packet counters. PTP DeBug [[+/-]<option> ...] Set or clear debug options, +option adds to list of output, -option removes from list, no +/- toggles current state. If no options given, a current list is printed out. Note: Debug output is disabled until the first use of this command PTP Log [[+/-]<option> ...] Set or clear UDP logging options, +option adds to list of output, -option removes from list, no +/- toggles current state. If no options given, a current list is printed out. PTP REGister [Signal] [Management] [Events] [ARP] Register a diag-shell handler for callbacks on signaling messages, management messages, clock events, or ARPing. PTP TELecom <subcommand> [...] PTP TELecom CLOCK CREATE [ID=<xx:xx:xx:xx:xx:xx:xx:xx>] [QL=<ITU-T G.781 QL>] [DOMain=<value>] [SlaveOnly=y/n] [OneWay=y/n] [NtpTodDisable=<0/1>] [PtpTodDisable=<0/1>] PTP TELecom PORT CONFig [IP=<ip>] [MAC=<mac>] [VLAN=<value>] [PRIO=<value>] [TimeStamp=<|ToP|RCPU|PHY|Unimac32|Unimac48|>] PTP TELecom SLaVe CONFig [ENable=<|DISable|OPTionI|OPTionII|OPTionIII|>] [SyncReceiptTimeout=<msec>] [DelayReceiptTimeout=<msec>] [VARianceTHRESHold=<nsec_sq>] PTP TELecom SLaVe SHow PTP TELecom SLaVe ClkClass Add [Class=<value>] [Enable=y/n] PTP TELecom SLaVe ClkClass Remove [Class=<value>] PTP TELecom SLaVe ClkClass SHow PTP TELecom MaSTer CONFig [IP=<ip>] [PRIOrity=<value>] [OVeRride=y/n] [LoCKout=y/n] [NONREVersion=y/n] [WAIT_to_restore=<sec>] PTP TELecom MaSTer SHow [DeTaiLs=y/n] PTP TELecom MaSTer BeST [DeTaiLs=y/n] PTP TELecom OPTions [VERBose=y/n] PTP CTDEV <subcommand> [...] PTP CTDEV OPTions [ENable=y/n] [VERBose=y/n] [ALPHA_Numerator=<value>] [ALPHA_Denominator=<value>] PTP MODULAR <subcommand> [...] PTP MODULAR GET PTP MODULAR SET [ENable=y/n] [VERBose=y/n] [PHYTS=y/n] [FrameSyncPIN=<pin>] [PBM=<port bitmap>] PTP DIAGshell <subcommand> [...] PTP DIAGshell OPTions [VERBose=y/n] PTP DIAGshell SYNC PTP PacKeTDump [[+/-]<option> ...] [Count=<value>] Set or clear debug options, +option adds to list of output, -option removes from list, no +/- toggles current state. If no options given, a current list is printed out. If no count given, default or previous set is value is used. PTP ToDOffSet Set/Get PTP and NTP offset PTP ToDOffSet Set [NtpSec=<seconds>] [NtpNSec=<nanoseconds>] [PtpSec=<seconds>] [PtpNSec=<nanoseconds>] PTP ToDOffSet Get PTP HELP <subcommand> "PTP HELP LIST" prints list of subcommandsFurther reading