Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
to set host time as a first step, if @t{/wr/etc/wr_date.conf}
exists and includes a line of the form @t{ntpserver 192.168.16.1}.
With ``@t{wr_date get}'' you can read White Rabbit time, and
by using @t{wr_date get tohost}'' you can set host time from
White Rabbit time. This can be useful in slave switches that
are not synced to NTP at boot.
@item wrs_version
Print information about the SW & HW version of the WRS. Please
check the help message.
@item shw_ver
A symbolic link to @t{wrs_version}, to be compatible with
older versions that used this tool name. The name is
inconsistent with anything else in the switch, so it is being
replaced.
@item wrs_vlans
The tool allows to configure and unconfigure the VLAN settings
for each port and for the RTU daemon. The @t{--help} option
lists all configuration items of the tool.
@item apply_dot-config
The script is used to apply @t{dot-config} settings to the
current configuration files. It is run at boot time before
any service is started. The @t{dot-config} mechanism is
documented in @ref{Configuration of the Device}.
@item assembly_ppsi_conf.sh
The script is used to assembly ppsi configuration file based on
information stored in @t{PORTxx_PARAMS}.
This script is called by @i{apply_dot-config}.
@item change_dot-config
This script changes the current @t{dot-config} file. It is
designed to be the back-end of the web interface, when changing
configuration items. The script does nothing to @i{apply}
the changes, and it only performs editing.
It is the responsibility of the caller to ensure the proper
service is restarted with the new configuration.
@item sdb-read
The tool, copied from the @t{fpga-config-space} project,
is documented in the next section,
@item wrs_auxclk
The tool allows to setup the parameters of a clock generated on the @i{clk2}
SMC.
@c FIXME: document lm32-vuart rtu_stat spll_dbg_proxy
@c FIXME: document wrs_pstats
@end table
@c --------------------------------------------------------------------------
@node sdb-read
Grzegorz Daniluk
committed
@section sdb-read
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
[Note: this documentation section comes from the @t{ohwr} project
called @t{fpga-config-space}.]
The @i{sdb-read} program can be used to access an @i{sdbfs} image
stored in a disk file or an FPGA area in physical memory.
It works both as @i{ls} (to list the files
included in the image) and as @i{cat} (to print to its own @i{stdout}
one of the files that live in the binary image).
The program can be used in three ways:
@table @code
@item sdb-read [options] <image-file>
This invocation lists the contents of the image. With @code{-l}
the listing is @i{long}, including more information than the
file name.
@item sdb-read [options] <image-file> <filename>
When called with two arguments, the program prints to @i{stdout}
the content of the named file, extracted from the image. Please
note that if the file has been over-sized at creation time,
the whole allocated data area is printed to standard output.
@item sdb-read [options] <image-file> <hex-vendor>:<hex-device>
If the second argument is built as two hex numbers separated
by a colon, then the program uses them as vendor-id and device-id
to find the file. If more than one file have the same identifiers,
the @i{first} of them is printed.
@end table
The following option flags are supported:
@table @code
@item -l
For listing, use @i{long} format. A @i{verbose} format will
be added later.
@item -e <entrypoint>
Specify the offset of the magic number in the image file.
@item -m <size>@@<addr>
@itemx -m <addr>+<size>
Either form is used to specify a memory range. This is the
preferred way to read from a memory-mapped area, like an FPGA
memory space. Please note that in general you should not
read a ``file'' in FPGA space, because this would mean read
all device registers. The form ``@t{<image-file> <filename>}''
is thus discouraged for in-memory SDB trees (i.e. where
@t{<image-file>} is @t{/dev/mem}).
@item -r
Register the device with a @i{read} method instead of the @i{data}
pointer. In this way the
tool can be used to test the library with either access method.
If @i{mmap} fails on the file (e.g., it is a non-mappable device),
@i{read} is used automatically, irrespective of @t{-r}.
@end table
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
@c --------------------------------------------------------------------------
@node wrs_vlans
@section wrs_vlans
The @i{wrs_vlans} shell tool can be used to setup VLANs in the switch. The
configuration is divided into two parts:
@table @code
@item wrs_vlans --ep <port number or range> [options]
Per-port Endpoint VLAN configuration. Used to set VID and priority for ingress
frames tagging, egress untagging and port mode to:
@itemize @bullet
@item ACCESS - tags untagged frames with configured VID and priority, drops
tagged frames not belonging to the configured VLAN
@item TRUNK - passes only tagged frames, drops all untagged frames
@item Disabled - VLANs disabled
@item Unqualified port - passess all frames regardless of VLAN configuration
@end itemize
@item wrs_vlans --rvid <vid> [options]
Per-VLAN configuration of the Routing Table Unit, used to configure port mask
describing which port belong to a given VLAN. RTU uses this information to be
able to forward incoming frames only to ports inside the VLAN.
@end table
Both per-port Endpoint and per-VLAN RTU configuration has to be performed in
order to have a full VLAN setup on a WR Switch.
For per-port configuration, multiple ways of specifying ports are supported:
@table @code
@item wrs_vlans --ep 1 [options]
Selected configuration will be applied only to port 1.
@item wrs_vlans --ep 1,3,4 [options]
Selected configuration will be applied to ports 1,3 and 4.
@item wrs_vlans --ep 5-8 [options]
Selected configuration will be applied to port range 5 to 8.
@item wrs_vlans --ep 5-8,15 [options]
Selected configuration will be applied to port range 5 to 8 and port 15.
@end table
To configure each Endpoint the following options may be used:
@table @code
@item --emode <mode No.>
Sets qmode for a port (0 - ACCESS, 1 - TRUNK, 2 - disabled, 3 - unqualified)
@item --evid <vid>
Sets VLAN id for tagging ingress frames.
@item --eprio <priority>
Sets priority for tagging ingress frames.
@item --eumask <hex mask>
Sets mask for egress untagging. By default, if you configure ingress tagging,
all VIDs are untagged on egress.
@end table
To configure VLANs in RTU the tool has to be used with parameter specifying
VLAN id to be set up and then the list of configuration options:
@table @code
@item wrs_vlans --rvid <vid> [options]
@end table
Possible RTU VLAN configuration options:
@table @code
@item --rmask <hex mask>
Mask defines which physical ports of the WRS belong to a configured VLAN.
@item --rfid <fid>
Assigns filtering ID @i{fid} to the configured VLAN. Multiple VLANs can be
configured to have the same @i{fid}. This way they create a group where
learning a new MAC address in one VLAN implies learning this MAC in the rest
of VLANs in the group as well.
@item --rprio <prio>
Forces 802.1q priority override for VLAN. Setting @i{prio} to -1, cancels the
override.
@item --rdrop <1/0>
Forces (if set to 1) or disables (if set to 0) frames drop for the configured
VLAN.
@item --del
Deletes selected VLAN from the RTU configuration.
@end table
In addition to that @i{wrs_vlans} can be also used to display and clear current
VLAN configuration of the switch:
@table @code
@item wrs_vlans --elist
Current Endpoints VLAN configuration
@item wrs_vlans --list
Current RTU VLAN configuration.
@item wrs_vlans --clear
@end table
@i{wrs_vlans} tool can be called multiple times to make a set of per-port and
per-VLAN configurations. However, it is also possible to configure multiple
ports/VLANs in one go. For example to configure ports 0,1,2,5 to VLAN 5 and
ports 3,4 to VLAN 6 with tagging ingress frames one could call @i{wrs_vlans}
with these parameters:
@example
wrs_vlans --ep 0-2,5 --emode 0 --evid 5 --ep 3,4 --emode 0 --evid 6 \
--rvid 5 --rmask 0x27 --rvid 6 --rmask 0x18
@end example
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
@c --------------------------------------------------------------------------
@node wrs_auxclk
@section wrs_auxclk
The @i{wrs_auxclk} shell tool can be used to configure parameters of a clock
signal generated on the @i{clk2} SMC connector.
@b{Note:} you need to have WRS hardware at least in version 3.4 to have @i{clk2}
output.
By default @i{wrs_auxclk} is called by init scripts to generate 10MHz clock
signal with 50% duty cycle. This configuration can be modified by using various
options:
@table @code
@item --freq <f>
Desired frequency of the generated clock signal in MHz. Available range from
4kHz to 250MHz.
@item --duty <frac>
Desired duty cycle given as a fraction (e.g. 0.5, 0.4).
@item --cshift <csh>
Coarse shift (granularity 2ns) of the generated clock signal. This parameter
can be used to get desired delay relation between generated 1-PPS and
@i{clk2}. The delay between 1-PPS and @i{clk2} is constant for a given
bitstream but may be different for various hardware versions and
re-synthesized gateware. Therefore it should be measured and adjusted only
once for given hardware and gateware version.
@item --sigdel <steps>
Clock signal generated from the FPGA is cleaned by a discrete flip-flop.
It may happen that generated aux clock is in phase with the flip-flop clock.
In that case it is visible on the oscilloscope that @i{clk2} clock is
jittering by 4ns. The @code{--sigdel} parameter allows to add a precise delay
to the FPGA-generated clock to avoid such jitter. This delay is specified in
steps, where each step is around 150ps. This value, same as the
@code{--cshift} parameter, is constant for a given bitstream so should be
verified only once.
@item --ppshift <steps>
If one needs to precisely align 1-PPS output with the @i{clk2} aux clock using
@code{--cshift} parameter is not enough as it has 4ns granularity. In that
case @code{--ppshift} lets you shift 1-PPS output by a configured number
of 150ps steps. However, please have in mind that 1-PPS output is used as a
reference for WR calibration procedure. Therefore, once this parameter is
modified, the device should be re-calibrated. Otherwise, 1-PPS output
will be shifted from the WR timescale by <steps>*150ps.
@end table
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
@c ##########################################################################
@node SNMP Support
@chapter SNMP Support
The White Rabbit Switch supports SNMP, although some more work is needed
in this respect. The default read-only ``community'' name is @t{private},
but you can change it from the @t{Kconfig} interface before building.
The default read-write community is @t{private}.
The switch supports all the standard information through the @i{net-snmp}
installation. We'll remove some of the items in a later release, because
nobody wants to check running processes or disk space usage.
The additional, switch-specific information are in the
``enterprise.96.100 subtree, where @t{96} is CERN and @t{100} is White
Rabbit. The associated MIB is in the directory @t{userspace/snmpd},
where related source files live as well.
@c ==========================================================================
@node The WRS MIB
@section The WRS MIB
This a summary of the available tables and scalars:
@table @code
@item 96.100.1
This is a simple scalar as a test. It is an integer value
that is incremented each time you access it. It can be used to
test basic functionality.
@item 96.100.2
Port statistics, as an SNMP table. The first column is the
name of each counter, and further columns represent interfaces
@t{wr0} through @t{wr17}. Each counters is shown in a table line,
as the number and names of the counters may change in the future.
@item 96.100.3
White Rabbit specific information. Subid @t{.1} is the global
items, and subid @t{.2} is a table with per-port items.
@item 96.100.4
Hardware, gateware and software versions, plus serial
number and other hardware information.
@item 96.100.5
The internal White Rabbit time, as a number and a string.
@end table
@c @b{Note:} due to a bug in management of 64-bit values in @i{net-snmp},
@c we are using a bad work-around in the code, that may cause wrong values
@c to be returned by other versions of the agent, where this bug is fixed.
the easiest way to retrieve the values is using @i{snmpwalk}, telling
it to access our MIB file in order to use symbolic names. Assuming
@t{wrs} is the DNS name for your White Rabbit Switch and @t{WR_SWITCH_SW}
is an environment variable pointing to this package:
@smallexample
snmpwalk -c public -v 2c wrs \
-m +${WR_SWITCH_SW}/userspace/snmpd/WR-SWITCH-MIB.txt \
1.3.6.1.4.1.96.100
@end smallexample
Using SNMP version 1 instead of 2c is fine as well, but you won't receive
the 64-bit values for slave/tracking information.
The output you will get back is something like the following. Clearly
the software commit in this example is my own development version while writing
this section:
@smallexample
WR-SWITCH-MIB::wrsScalar.0 = INTEGER: 2
WR-SWITCH-MIB::pstatsDescr.1 = STRING: TX Underrun
WR-SWITCH-MIB::pstatsDescr.2 = STRING: RX Overrun
WR-SWITCH-MIB::pstatsDescr.3 = STRING: RX Invalid Code
[...]
WR-SWITCH-MIB::pstatsDescr.38 = STRING: Forwarded
WR-SWITCH-MIB::pstatsDescr.39 = STRING: TRU Resp Valid
WR-SWITCH-MIB::pstatsWR0.1 = Counter32: 0
[...]
WR-SWITCH-MIB::pstatsWR17.38 = Counter32: 50819
WR-SWITCH-MIB::pstatsWR17.39 = Counter32: 0
WR-SWITCH-MIB::pstatsEntry.20 = Counter32: 0
WR-SWITCH-MIB::ppsiGrandmaterID.0 = Hex-STRING: 00 00 00 00 00 00 00 00
WR-SWITCH-MIB::ppsiOwnID.0 = Hex-STRING: 00 00 00 00 00 00 00 00
WR-SWITCH-MIB::ppsiMode.0 = INTEGER: unknown(0)
WR-SWITCH-MIB::ppsiServoState.0 = STRING:
WR-SWITCH-MIB::ppsiPhaseTracking.0 = INTEGER: not-tracking(0)
[...]
WR-SWITCH-MIB::portLink.14 = INTEGER: down(0)
WR-SWITCH-MIB::portLink.15 = INTEGER: up(1)
WR-SWITCH-MIB::portLink.16 = INTEGER: down(0)
[...]
WR-SWITCH-MIB::portPeer.18 = Hex-STRING: FF FF FF FF FF FF FF FF
WR-SWITCH-MIB::ppsiPort.5 = Hex-STRING: FF FF FF FF FF FF FF FF
WR-SWITCH-MIB::wrsVersionSw.0 = STRING: v4.0-rc1-42-gcec7805+
WR-SWITCH-MIB::wrsVersionGw1.0 = STRING: 7cce708
WR-SWITCH-MIB::wrsVersionGw2.0 = STRING: 5118070
WR-SWITCH-MIB::wrsVersionGw3.0 = STRING: 7efeb16
WR-SWITCH-MIB::wrsVersionHw1.0 = STRING: 3.30
WR-SWITCH-MIB::wrsVersionHw2.0 = STRING: LX240T
WR-SWITCH-MIB::wrsManufacturer.0 = STRING: Seven Solutions
WR-SWITCH-MIB::wrsSerialNumber.0 = STRING: 12345
WR-SWITCH-MIB::wrsScbVersion.0 = STRING: 3.3
WR-SWITCH-MIB::wrsDateTAI.0 = Counter64: 1406623390
WR-SWITCH-MIB::wrsDateString.0 = STRING: 2014-07-29-08:43:10
@end smallexample
Another example is to print all objects exported by switch.
@smallexample
snmpwalk -c public -v 2c wrs -m all \
-M ${WRS_OUTPUT_DIR}/build/buildroot-2011.11/output/build/netsnmp-5.6.1.1/mibs/\
:${WR_SWITCH_SW}/userspace/snmpd/ \
1
@end smallexample
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
@c ==========================================================================
@node show-pstats
@section show-pstats
To visualize all port statistics in a single window, this package
includes the simple tool @t{userspace/snmpd/show-pstats}. It is
a Tk script, so you need to install @t{tk8.5} or any other version.
The script receives one or more host names (or IP addresses) on the command
line. They must refer to a switch (or switches) or the program fails like this:
@smallexample
laptopo% ./show-pstats morgana
Error in snmpwalk for host morgana
No log handling enabled - using stderr logging
.1.3.6.1.4.1.96.100.2.1.: Unknown Object Identifier (Sub-id not found: enterprises -> )
@end smallexample
If everything goes well, you'll get a window like the following one:
@center @image{show-pstats, 10cm,, show-pstats}
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
Command @t{snmptable} can also be used to get simillar results:
@smallexample
snmptable -Cw 80 -c public -v 2c 192.168.1.10 -m all \
-M $WRS_OUTPUT_DIR/build/buildroot-2011.11/output/build/netsnmp-5.6.1.1/mibs/\
:userspace/snmpd/ WR-SWITCH-MIB::wrsPstatsTable
@end smallexample
Output is in text form and looks like:
@smallexample
SNMP table: WR-SWITCH-MIB::wrsPstatsTable
wrsPstatsPortName wrsPstatsTXUnderrun wrsPstatsRXOverrun wrsPstatsRXInvalidCode
wr0 0 0 0
wr1 0 0 0
wr2 0 0 0
wr3 0 0 0
wr4 0 0 0
wr5 0 0 0
wr6 0 0 0
wr7 0 0 0
wr8 0 0 0
wr9 0 0 0
wr10 0 0 0
wr11 0 0 0
wr12 0 0 0
wr13 0 0 0
wr14 0 0 0
wr15 0 0 0
wr16 0 0 0
wr17 0 0 0
SNMP table WR-SWITCH-MIB::wrsPstatsTable, part 2
wrsPstatsRXSyncLost wrsPstatsRXPauseFrames wrsPstatsRXPfilterDropped
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
(...)
@end smallexample
Unfortunately output due to the number of counters is very wide. Number of
characters per line can be limited by switch @t{Cw}, in example was set to 80.
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
@c ##########################################################################
@node Bugs and Troubleshooting
@appendix Bugs and Troubleshooting
Even if the package is already released and used in production,
some details can be
suboptimal, while some procedures may be tricky and need more explanation.
We are collecting all those issues in the @i{wiki} page of the
project, to avoid frequent updates to this manual to just collect
those details. So please visit
@url{www.ohwr.org/projects/wr-switch-sw/wiki/Bugs} and
@url{www.ohwr.org/projects/wr-switch-sw/wiki/Troubleshooting}
if you have any problem with this package, but feel free to reach us
on the mailing list if you don't find help there.
@c ##########################################################################
@bye
@c LocalWords: gnudd titlepage iftex texinfo CERN timestamping smallexample
@c LocalWords: LocalWords ietf timestamp misc timestamps ttstamp onestamp
@c LocalWords: Tomasz Wlostowski buildroot distclean defconfig wrswitch REPO
@c LocalWords: menuconfig config dataflash whiterabbit stdout stderr svnsync
@c LocalWords: filesystem diff ohwr http mkdir linux rubini itemize PTPd VHDL
Adam Wujek
committed
@c LocalWords: noposix ptpd userspace libwr DataFlash NAND barebox FPGA
@c LocalWords: Atmel Kconfig minicom tinyserial ttyUSB bootloader logfile
@c LocalWords: nandflash gateware TFTP init wrboot wiki