Commit 6c277a45 authored by Adam Wujek's avatar Adam Wujek 💬

Merge branch 'adam-wriX'

Change the names of interfaces from wr0..wr17 (wrX) to wri1..wri18 (wriX).
Such change was done to avoid confusion that ports on the front panel are
numbered from 1 to 18, while in software they were numbered from 0 to 17.
Inconsistency started to show up especially in messages produced by software
causing confusion.

Be aware that even after these changes some software internally uses indexing
or ports from 0 to 17.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parents d42fdfbe e197bcd4
......@@ -289,83 +289,83 @@ endmenu
menu "Port Timing Configuration"
config PORT00_PARAMS
config PORT01_PARAMS
string "Parameters for the first port"
default "name=wr0,proto=raw,tx=223896,rx=226310,role=slave,fiber=0" if TIME_BC
default "name=wr0,proto=raw,tx=223896,rx=226310,role=master,fiber=0"
default "name=wri1,proto=raw,tx=223896,rx=226310,role=slave,fiber=0" if TIME_BC
default "name=wri1,proto=raw,tx=223896,rx=226310,role=master,fiber=0"
help
This item, and the following ones, are used to assign the
constant delays (likely from calibration), protocol type (raw or udp),
port roles and type of fiber for each of the ports. Please refer to
the user manual for more information.
config PORT01_PARAMS
string "Parameters for the second port"
default "name=wr1,proto=raw,tx=224066,rx=226334,role=master,fiber=0"
config PORT02_PARAMS
string "Parameters for a further port"
default "name=wr2,proto=raw,tx=224170,rx=226620,role=master,fiber=0"
string "Parameters for the second port"
default "name=wri2,proto=raw,tx=224066,rx=226334,role=master,fiber=0"
config PORT03_PARAMS
string "Parameters for a further port"
default "name=wr3,proto=raw,tx=224278,rx=226722,role=master,fiber=0"
default "name=wri3,proto=raw,tx=224170,rx=226620,role=master,fiber=0"
config PORT04_PARAMS
string "Parameters for a further port"
default "name=wr4,proto=raw,tx=224431,rx=227755,role=master,fiber=0"
default "name=wri4,proto=raw,tx=224278,rx=226722,role=master,fiber=0"
config PORT05_PARAMS
string "Parameters for a further port"
default "name=wr5,proto=raw,tx=224607,rx=228005,role=master,fiber=0"
default "name=wri5,proto=raw,tx=224431,rx=227755,role=master,fiber=0"
config PORT06_PARAMS
string "Parameters for a further port"
default "name=wr6,proto=raw,tx=224788,rx=228176,role=master,fiber=0"
default "name=wri6,proto=raw,tx=224607,rx=228005,role=master,fiber=0"
config PORT07_PARAMS
string "Parameters for a further port"
default "name=wr7,proto=raw,tx=224903,rx=228251,role=master,fiber=0"
default "name=wri7,proto=raw,tx=224788,rx=228176,role=master,fiber=0"
config PORT08_PARAMS
string "Parameters for a further port"
default "name=wr8,proto=raw,tx=225040,rx=228274,role=master,fiber=0"
default "name=wri8,proto=raw,tx=224903,rx=228251,role=master,fiber=0"
config PORT09_PARAMS
string "Parameters for a further port"
default "name=wr9,proto=raw,tx=225285,rx=228599,role=master,fiber=0"
default "name=wri9,proto=raw,tx=225040,rx=228274,role=master,fiber=0"
config PORT10_PARAMS
string "Parameters for a further port"
default "name=wr10,proto=raw,tx=225510,rx=229052,role=master,fiber=0"
default "name=wri10,proto=raw,tx=225285,rx=228599,role=master,fiber=0"
config PORT11_PARAMS
string "Parameters for a further port"
default "name=wr11,proto=raw,tx=225625,rx=229111,role=master,fiber=0"
default "name=wri11,proto=raw,tx=225510,rx=229052,role=master,fiber=0"
config PORT12_PARAMS
string "Parameters for a further port"
default "name=wr12,proto=raw,tx=225779,rx=229389,role=master,fiber=0"
default "name=wri12,proto=raw,tx=225625,rx=229111,role=master,fiber=0"
config PORT13_PARAMS
string "Parameters for a further port"
default "name=wr13,proto=raw,tx=226005,rx=229533,role=master,fiber=0"
default "name=wri13,proto=raw,tx=225779,rx=229389,role=master,fiber=0"
config PORT14_PARAMS
string "Parameters for a further port"
default "name=wr14,proto=raw,tx=226228,rx=229984,role=master,fiber=0"
default "name=wri14,proto=raw,tx=226005,rx=229533,role=master,fiber=0"
config PORT15_PARAMS
string "Parameters for a further port"
default "name=wr15,proto=raw,tx=226352,rx=230126,role=master,fiber=0"
default "name=wri15,proto=raw,tx=226228,rx=229984,role=master,fiber=0"
config PORT16_PARAMS
string "Parameters for a further port"
default "name=wr16,proto=raw,tx=226534,rx=230134,role=master,fiber=0"
default "name=wri16,proto=raw,tx=226352,rx=230126,role=master,fiber=0"
config PORT17_PARAMS
string "Parameters for a further port"
default "name=wr17,proto=raw,tx=226733,rx=230371,role=master,fiber=0"
default "name=wri17,proto=raw,tx=226534,rx=230134,role=master,fiber=0"
config PORT18_PARAMS
string "Parameters for a further port"
default "name=wri18,proto=raw,tx=226733,rx=230371,role=master,fiber=0"
endmenu
......@@ -470,13 +470,13 @@ choice
default PTP_PORT_PARAMS
config PTP_PORT_PARAMS
bool "Raw Ethernet, WR on, Slave on wr0, Master on other ports"
bool "Raw Ethernet, WR on, Slave on wri1, Master on other ports"
help
You can choose wether to use parameters defined in PORTXX_PARAMS or
your own custom configuration file defined by
CONFIG_PTP_CUSTOM_FILENAME.
The default setting for boundary clock forces port wr0
The default setting for boundary clock forces port wri1
to be PTP slave and all other ports to be master, in
Ethernet mode and with full WR protocol extensions. The default
for a Grand-Master or Free-Running master has all ports as
......
......@@ -28,7 +28,7 @@ bootargs="$bootargs root=nfs rw ip=$ipinfo"
bootargs="$bootargs nfsroot=/opt/root/wrs,tcp"
# And pass the WR base MAC address, that barebox retrieved from SDB
bootargs="$bootargs wr_nic.macaddr=$wr0_ethaddr"
bootargs="$bootargs wr_nic.macaddr=$wri1_ethaddr"
# Load the kernel using the personal name chosen above, and boot it
tftp $kernelname /dev/mem.kernel; bootz /dev/mem.kernel
......@@ -22,7 +22,7 @@ cp /boot/wrs-initramfs.gz /dev/mem.initramfs
#bootargs="verbose console=ttyS0,115200 panic=10"
bootargs="quiet console=ttyS0,115200 panic=10"
bootargs="$bootargs initrd=0x71800000,0x400000"
bootargs="$bootargs wr_nic.macaddr=$wr0_ethaddr"
bootargs="$bootargs wr_nic.macaddr=$wri1_ethaddr"
bootz /dev/mem.kernel
# Sleep 2 seconds so you can see the message and return to menu
......
......@@ -31,7 +31,7 @@ bootargs="$bootargs root=nfs rw ip=$ipinfo"
bootargs="$bootargs nfsroot=/opt/root/wrs,tcp"
# And pass the WR base MAC address, that barebox retrieved from SDB
bootargs="$bootargs wr_nic.macaddr=$wr0_ethaddr"
bootargs="$bootargs wr_nic.macaddr=$wri1_ethaddr"
# Load the kernel using the personal name chosen above, and boot it
tftp $kernelname /dev/mem.kernel; bootz /dev/mem.kernel
......@@ -59,7 +59,7 @@ while [ $# -ge 1 ]; do
shift; shift
;;
-m2|--mac2|--wr0.ethaddr)
-m2|--mac2|--wri1.ethaddr)
MAC2="$2"
checkMAC $MAC2
if [ $? -eq 1 ];then
......
......@@ -36,24 +36,24 @@ CONFIG_WRS_LOG_WRSWATCHDOG="daemon.info"
#
# Port Timing Configuration
#
CONFIG_PORT00_PARAMS="name=wr0,proto=raw,tx=223896,rx=226310,role=slave,fiber=0"
CONFIG_PORT01_PARAMS="name=wr1,proto=raw,tx=224066,rx=226334,role=master,fiber=0"
CONFIG_PORT02_PARAMS="name=wr2,proto=raw,tx=224170,rx=226620,role=master,fiber=0"
CONFIG_PORT03_PARAMS="name=wr3,proto=raw,tx=224278,rx=226722,role=master,fiber=0"
CONFIG_PORT04_PARAMS="name=wr4,proto=raw,tx=224431,rx=227755,role=master,fiber=0"
CONFIG_PORT05_PARAMS="name=wr5,proto=raw,tx=224607,rx=228005,role=master,fiber=0"
CONFIG_PORT06_PARAMS="name=wr6,proto=raw,tx=224788,rx=228176,role=master,fiber=0"
CONFIG_PORT07_PARAMS="name=wr7,proto=raw,tx=224903,rx=228251,role=master,fiber=0"
CONFIG_PORT08_PARAMS="name=wr8,proto=raw,tx=225040,rx=228274,role=master,fiber=0"
CONFIG_PORT09_PARAMS="name=wr9,proto=raw,tx=225285,rx=228599,role=master,fiber=0"
CONFIG_PORT10_PARAMS="name=wr10,proto=raw,tx=225510,rx=229052,role=master,fiber=0"
CONFIG_PORT11_PARAMS="name=wr11,proto=raw,tx=225625,rx=229111,role=master,fiber=0"
CONFIG_PORT12_PARAMS="name=wr12,proto=raw,tx=225779,rx=229389,role=master,fiber=0"
CONFIG_PORT13_PARAMS="name=wr13,proto=raw,tx=226005,rx=229533,role=master,fiber=0"
CONFIG_PORT14_PARAMS="name=wr14,proto=raw,tx=226228,rx=229984,role=master,fiber=0"
CONFIG_PORT15_PARAMS="name=wr15,proto=raw,tx=226352,rx=230126,role=master,fiber=0"
CONFIG_PORT16_PARAMS="name=wr16,proto=raw,tx=226534,rx=230134,role=master,fiber=0"
CONFIG_PORT17_PARAMS="name=wr17,proto=raw,tx=226733,rx=230371,role=master,fiber=0"
CONFIG_PORT01_PARAMS="name=wri1,proto=raw,tx=223896,rx=226310,role=slave,fiber=0"
CONFIG_PORT02_PARAMS="name=wri2,proto=raw,tx=224066,rx=226334,role=master,fiber=0"
CONFIG_PORT03_PARAMS="name=wri3,proto=raw,tx=224170,rx=226620,role=master,fiber=0"
CONFIG_PORT04_PARAMS="name=wri4,proto=raw,tx=224278,rx=226722,role=master,fiber=0"
CONFIG_PORT05_PARAMS="name=wri5,proto=raw,tx=224431,rx=227755,role=master,fiber=0"
CONFIG_PORT06_PARAMS="name=wri6,proto=raw,tx=224607,rx=228005,role=master,fiber=0"
CONFIG_PORT07_PARAMS="name=wri7,proto=raw,tx=224788,rx=228176,role=master,fiber=0"
CONFIG_PORT08_PARAMS="name=wri8,proto=raw,tx=224903,rx=228251,role=master,fiber=0"
CONFIG_PORT09_PARAMS="name=wri9,proto=raw,tx=225040,rx=228274,role=master,fiber=0"
CONFIG_PORT10_PARAMS="name=wri10,proto=raw,tx=225285,rx=228599,role=master,fiber=0"
CONFIG_PORT11_PARAMS="name=wri11,proto=raw,tx=225510,rx=229052,role=master,fiber=0"
CONFIG_PORT12_PARAMS="name=wri12,proto=raw,tx=225625,rx=229111,role=master,fiber=0"
CONFIG_PORT13_PARAMS="name=wri13,proto=raw,tx=225779,rx=229389,role=master,fiber=0"
CONFIG_PORT14_PARAMS="name=wri14,proto=raw,tx=226005,rx=229533,role=master,fiber=0"
CONFIG_PORT15_PARAMS="name=wri15,proto=raw,tx=226228,rx=229984,role=master,fiber=0"
CONFIG_PORT16_PARAMS="name=wri16,proto=raw,tx=226352,rx=230126,role=master,fiber=0"
CONFIG_PORT17_PARAMS="name=wri17,proto=raw,tx=226534,rx=230134,role=master,fiber=0"
CONFIG_PORT18_PARAMS="name=wri18,proto=raw,tx=226733,rx=230371,role=master,fiber=0"
#
# SFP and Media Timing Configuration
......
......@@ -520,7 +520,7 @@ interface is a line. This approach allows the same MIB to work for
every possible configuration. For WR port statistics we chose a
different approach: the counters themselves are somehow dynamic (they
may change across versions, while the gateware develops) while the
interfaces are restricted to be in the set @t{wr0}--@t{wr17}.
interfaces are restricted to be in the set @t{wri1}--@t{wri18}.
So our pStats table is reversed from the common use of @sc{snmp} tables.
As a side effect this allows the WR switch to return the name of each
......
......@@ -594,9 +594,9 @@ The following list resumes the most interesting commands:
> ***Note:*** More information about the tools are explained in the [wrs-user-manual.pdf] or can be obtain using the embedded help argument: `--help`, `-h` or `help`.
#### Warning:
The SFP ports are labeled from 1 to 18 on the front panel but their corresponding
network interface are named from `wr0` to `wr17`.
#### Note:
The SFP ports are labeled from 1 to 18 on the front panel, their corresponding
network interface are named from `wri1` to `wri18`.
Firmware updates
......
......@@ -1927,7 +1927,7 @@ The binary image includes 4 files, stored as an @sc{sdb} filesystem:
The MAC address for the management Ethernet port (RJ45, 100Mb/s).
@item wr0.ethaddr
@item wri1.ethaddr
The MAC address for the first fiber port (SFP, 1Gb/s). Other ports
are assigned sequential addresses starting from this one.
......@@ -2068,7 +2068,7 @@ in the boot scripts, as we now extract the mac addresses from sdb.
bb> sdb ls /dev/dataflash0.hwinfo
46696c6544617461:2e202020 @ 00000000-0000083f .
46696c6544617461:7363625f @ 00000240-00000243 scb_version
46696c6544617461:7772302e @ 00000220-00000231 wr0.ethaddr
46696c6544617461:7772302e @ 00000220-00000231 wri1.ethaddr
46696c6544617461:6d616e75 @ 00000260-0000026f manufacturer
46696c6544617461:68775f69 @ 00000420-0000083f hw_info
46696c6544617461:65746830 @ 00000200-00000211 eth0.ethaddr
......@@ -2078,7 +2078,7 @@ in the boot scripts, as we now extract the mac addresses from sdb.
bb> sdb cat /dev/dataflash0.hwinfo hw_info
fpga: LX240T
scb_serial: 12345
bb> sdb set /dev/dataflash0.hwinfo wraddr wr0.ethaddr
bb> sdb set /dev/dataflash0.hwinfo wraddr wri1.ethaddr
bb> echo $wraddr
22:33:44:55:66:77
......
......@@ -256,7 +256,7 @@ implementation.
@item WR GrandMaster Switch should be holy provided it has an
external reference. Currently if we have a GrandMaster Switch and we
connect a Free-running Master to it's Slave port (wr0) then it becomes
connect a Free-running Master to it's Slave port (wri1) then it becomes
Slave to the Free-running Master and jumps it's WR time. All the
mechanism is in place, this should be trivial to fix.
......
......@@ -588,10 +588,10 @@ value is changed by the web interface, proper action is taken.
Please note that unknown facility names will generate a runtime error
on the switch.
@item CONFIG_PORT00_PARAMS
@itemx CONFIG_PORT01_PARAMS
@item CONFIG_PORT01_PARAMS
@itemx CONFIG_PORT02_PARAMS
@itemx ...
@itemx CONFIG_PORT17_PARAMS
@itemx CONFIG_PORT18_PARAMS
These configuration items are used to set up port parameters;
this includes the delays, the PTP role, PTP protocol type
......@@ -635,7 +635,7 @@ value is changed by the web interface, proper action is taken.
By default, PPSi configuration file is assembled based on role and
protocol parameters stored in @t{PORTxx_PARAMS}. @t{TIME_BC} selected
by @i{Kconfig} defaults role of port @t{wr0} to slave, other ports
by @i{Kconfig} defaults role of port @t{wri1} to slave, other ports
to master. For @t{TIME_GM} and @t{TIME_FM} all ports are mandated to
master.
Parameters @t{clock-class} and @t{clock-accuracy} can be changed
......@@ -743,12 +743,12 @@ description.
This is, for explanation's sake, an example of such items:
@smallexample
CONFIG_PORT09_PARAMS="name=wr9,proto=raw,tx=226214,rx=226758,role=slave,fiber=2"
CONFIG_PORT09_PARAMS="name=wri9,proto=raw,tx=226214,rx=226758,role=slave,fiber=2"
CONFIG_SFP00_PARAMS="pn=AXGE-1254-0531,tx=0,rx=0,wl_txrx=1310+1490"
CONFIG_FIBER02_PARAMS="alpha_1310_1490=2.6787e-04"
@end smallexample
When making timing calculation for port @t{wr9}, assuming the
When making timing calculation for port @t{wri9}, assuming the
auto-detected @sc{sfp} model is``AXGE-1254-0531'', the software
uses configuration in the following way:
......@@ -1149,9 +1149,7 @@ The following tools and scripts are provided:
A tool to switch the TX (laser) of a port on and off by use of the @t{TX
disable} pin on the SFP. Usage ``@t{wrs_port_tx_control <port_no> on}''
switches the TX on, and ``@t{wrs_port_tx_control <port_no> off}''
switches the TX off. The port number @t{<port_no>} ranges from 0 to the
maximum number of ports on the device minus one, and is currently
limited to 17.
switches the TX off. The port number @t{<port_no>} ranges from 1 to 18.
@item wr_date
......@@ -1189,8 +1187,10 @@ The following tools and scripts are provided:
@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}.
any service is started and by web interface to apply changes in
the local dot-config.
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
......@@ -1306,7 +1306,7 @@ configuration is divided into two parts:
@table @code
@item wrs_vlans --ep <port number or range> [options]
@item wrs_vlans --port <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:
......@@ -1332,19 +1332,19 @@ 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]
@item wrs_vlans --port 1 [options]
Selected configuration will be applied only to port 1.
@item wrs_vlans --ep 1,3,4 [options]
@item wrs_vlans --port 1,3,4 [options]
Selected configuration will be applied to ports 1,3 and 4.
@item wrs_vlans --ep 5-8 [options]
@item wrs_vlans --port 5-8 [options]
Selected configuration will be applied to port range 5 to 8.
@item wrs_vlans --ep 5-8,15 [options]
@item wrs_vlans --port 5-8,15 [options]
Selected configuration will be applied to port range 5 to 8 and port 15.
......@@ -1353,16 +1353,16 @@ For per-port configuration, multiple ways of specifying ports are supported:
To configure each Endpoint the following options may be used:
@table @code
@item --emode <mode No.>
@item --pmode <mode No.>
Sets qmode for a port (0 - ACCESS, 1 - TRUNK, 2 - disabled, 3 - unqualified)
@item --evid <vid>
@item --pvid <vid>
Sets VLAN id for tagging ingress frames.
@item --eprio <priority>
@item --pprio <priority>
Sets priority for tagging ingress frames.
@item --eumask <hex mask>
@item --pumask <hex mask>
Sets mask for egress untagging. By default, if you configure ingress tagging,
all VIDs are untagged on egress.
......@@ -1404,9 +1404,9 @@ VLAN configuration of the switch:
@table @code
@item wrs_vlans --elist
@item wrs_vlans --plist
Current Endpoints VLAN configuration
Current Port VLAN configuration
@item wrs_vlans --list
......@@ -1418,12 +1418,12 @@ VLAN configuration of the switch:
@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}
ports/VLANs in one go. For example to configure ports 1,2,3,6 to VLAN 5 and
ports 4,5 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 \
wrs_vlans --port 1-3,6 --pmode 0 --pvid 5 --port 4,5 --pmode 0 --pvid 6 \
--rvid 5 --rmask 0x27 --rvid 6 --rmask 0x18
@end example
......@@ -1572,8 +1572,8 @@ WR-SWITCH-MIB::wrsPtpRTT.1 = Counter64: 943893
WR-SWITCH-MIB::wrsPtpLinkLength.1 = Gauge32: 91
WR-SWITCH-MIB::wrsPtpServoUpdates.1 = Counter32: 33
[...]
WR-SWITCH-MIB::wrsPortStatusPortName.1 = STRING: wr0
WR-SWITCH-MIB::wrsPortStatusPortName.2 = STRING: wr1
WR-SWITCH-MIB::wrsPortStatusPortName.1 = STRING: wri1
WR-SWITCH-MIB::wrsPortStatusPortName.2 = STRING: wri2
[...]
WR-SWITCH-MIB::wrsPortStatusLink.1 = INTEGER: up(2)
WR-SWITCH-MIB::wrsPortStatusLink.2 = INTEGER: up(2)
......@@ -1587,8 +1587,8 @@ WR-SWITCH-MIB::wrsPortStatusSfpVN.2 = STRING: Axcen Photonics
WR-SWITCH-MIB::wrsPortStatusSfpPN.1 = STRING: AXGE-3454-0531
WR-SWITCH-MIB::wrsPortStatusSfpPN.2 = STRING: AXGE-3454-0531
[...]
WR-SWITCH-MIB::wrsPstatsHCPortName.1 = STRING: wr0
WR-SWITCH-MIB::wrsPstatsHCPortName.2 = STRING: wr1
WR-SWITCH-MIB::wrsPstatsHCPortName.1 = STRING: wri1
WR-SWITCH-MIB::wrsPstatsHCPortName.2 = STRING: wri2
[...]
WR-SWITCH-MIB::wrsPstatsHCTXFrames.1 = Counter64: 232
WR-SWITCH-MIB::wrsPstatsHCTXFrames.2 = Counter64: 543
......@@ -1639,29 +1639,29 @@ Output is in text form and looks like:
@smallexample
SNMP table: WR-SWITCH-MIB::wrsPstatsHCTable
wrsPstatsHCPortName wrsPstatsHCTXUnderrun wrsPstatsHCRXOverrun wrsPstatsHCRXInvalidCode
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
wrsPstatsHCPortName wrsPstatsHCTXUnderrun wrsPstatsHCRXOverrun
wri1 0 0
wri2 0 0
wri3 0 0
wri4 0 0
wri5 0 0
wri6 0 0
wri7 0 0
wri8 0 0
wri9 0 0
wri10 0 0
wri11 0 0
wri12 0 0
wri13 0 0
wri14 0 0
wri15 0 0
wri16 0 0
wri17 0 0
wri18 0 0
SNMP table WR-SWITCH-MIB::wrsPstatsHCTable, part 2
wrsPstatsHCRXSyncLost wrsPstatsHCRXPauseFrames wrsPstatsHCRXPfilterDropped
wrsPstatsHCRXInvalidCode wrsPstatsHCRXSyncLost wrsPstatsHCRXPauseFrames
0 0 0
0 0 0
0 0 0
......
......@@ -273,7 +273,7 @@
messages to determine the WR port on which the problem is reported. In
case of Syslog, you should see a message similar to this one:\\
\texttt{Unknown SFP vn="AVAGO" pn="ABCU-5710RZ" vs="AN1151PD8A" on port
wr1}
wri2}
\item If the reported port is intended to be used to connect a device that
does not require WR synchronization (e.g. using a copper SFP module),
then you should verify whether the role in the timing configuration for
......
# We have 5 files only: eth0.ethaddr, wr0.ethaddr, manufacturer, scb_version
# We have 5 files only: eth0.ethaddr, wri1.ethaddr, manufacturer, scb_version
# and hw_info.
#
# They are at static addresses so to be able to change them from a script
......@@ -14,7 +14,7 @@
eth0.ethaddr
position = 0x200
wr0.ethaddr
wri1.ethaddr
position = 0x220
scb_version
......
......@@ -241,6 +241,7 @@ int wrn_endpoint_probe(struct net_device *dev)
{
struct wrn_ep *ep = netdev_priv(dev);
static u8 wraddr[6];
char wrint_name[16]; /* 6 is enough, but to be super cautious use 16 */
int err;
int prio, prio_map;
u32 val;
......@@ -278,9 +279,12 @@ int wrn_endpoint_probe(struct net_device *dev)
if (ep->ep_number == 0)
pr_info("WR-nic: Using address %pM\n", wraddr);
/* assign wr interfaces numbers from 1 */
snprintf(wrint_name, 16, "wri%d", ep->ep_number + 1);
/* Use wraddr as MAC */
memcpy(dev->dev_addr, wraddr, ETH_ALEN);
pr_debug("wr_nic: assign MAC %pM to wr%d\n", dev->dev_addr, ep->ep_number);
pr_info("wr_nic: assign MAC %pM to %s\n", dev->dev_addr, wrint_name);
/* Check whether the ep has been sinthetized or not */
val = readl(&ep->ep_regs->IDCODE);
......@@ -291,7 +295,7 @@ int wrn_endpoint_probe(struct net_device *dev)
}
/* Errors different from -ENODEV are fatal to insmod */
dev_alloc_name(dev, "wr%d");
dev_alloc_name(dev, wrint_name);
wrn_netops_init(dev); /* function in ./nic-core.c */
wrn_ethtool_init(dev); /* function in ./ethtool.c */
/* Napi is not supported on this device */
......
......@@ -43,9 +43,10 @@ static unsigned int firmware_adr_pp; /* number of words with counters */
static unsigned int firmware_cpw; /* number of counters per word */
module_param(pstats_nports, int, S_IRUGO);
const char *portnames[] = {"port0", "port1", "port2", "port3", "port4",
"port5", "port6", "port7", "port8", "port9", "port10", "port11",
"port12", "port13", "port14", "port15", "port16", "port17"};
const char *portnames[] = {"wrport1", "wrport2", "wrport3", "wrport4",
"wrport5", "wrport6", "wrport7", "wrport8", "wrport9", "wrport10",
"wrport11", "wrport12", "wrport13", "wrport14", "wrport15", "wrport16",
"wrport17", "wrport18"};
static struct pstats_version_description pstats_desc[] = {
[0] = {
......
......@@ -8,7 +8,7 @@ cp /boot/wrs-initramfs.gz /dev/mem.initramfs
#bootargs="verbose console=ttyS0,115200 panic=10"
bootargs="quiet console=ttyS0,115200 panic=10"
bootargs="$bootargs initrd=0x71800000,0x400000"
bootargs="$bootargs wr_nic.macaddr=$wr0_ethaddr"
bootargs="$bootargs wr_nic.macaddr=$wri1_ethaddr"
bootz /dev/mem.kernel
# Sleep 2 seconds so you can see the message and return to menu
......
......@@ -45,12 +45,16 @@ autoboot_select="1"
# Ethernet addresses are taken from sdb in hwinfo partition
addpart /dev/dataflash0 0x840@0x94800(hwinfo)
sdb set /dev/dataflash0.hwinfo eth0.ethaddr
sdb set /dev/dataflash0.hwinfo wr0_ethaddr wr0.ethaddr
export wr0_ethaddr
sdb set /dev/dataflash0.hwinfo wri1_ethaddr wri1.ethaddr
if [ x$wri1_ethaddr = x ]; then
sdb set /dev/dataflash0.hwinfo wri1_ethaddr wr0.ethaddr
echo "Using wr0.ethaddr from sdb (" $wri1_ethaddr ")"
fi
export wri1_ethaddr
### Override default value using /env/config (empty by default)
. /env/config
echo "Starting up barebox [wrs3] (MAC=$eth0.ethaddr WR_MAC=$wr0_ethaddr)"
echo "Starting up barebox [wrs3] (MAC=$eth0.ethaddr WR_MAC=$wri1_ethaddr)"
### Generic setup
......
......@@ -537,13 +537,13 @@ int shw_sfp_read_header(int num, struct shw_sfp_header *head)
int ret;
if (shw_sfp_id(num) < 0) {
pr_error("shw_sfp_read_header: wrong SFP num %d\n", num);
pr_error("shw_sfp_read_header: wrong SFP num %d\n", num + 1);
return -1;
}
ret = shw_sfp_module_scan();
if (!(ret & (1 << num))) {
pr_error("shw_sfp_read_header: SFP not present %d\n", num);
pr_error("shw_sfp_read_header: SFP not present %d\n", num + 1);
return -2;
}
......
......@@ -4,7 +4,7 @@ start() {
echo -n "Enable switching: "
# bring up all interfaces
for i in `ls /sys/class/net | grep wr`
for i in `ls /sys/class/net | grep wri`
do
ifconfig $i up
done
......@@ -16,7 +16,7 @@ stop() {
echo -n "Disable switching: "
# bring down all interfaces
for i in `ls /sys/class/net | grep wr`
for i in `ls /sys/class/net | grep wri`
do
ifconfig $i down
done
......
......@@ -5,7 +5,7 @@
# people upgrading from older wr-switch-sw releases.
#
# This script is run late, because it will have effect at next boot only.
# If we run it too early, we can't get the mac address from wr0 which does
# If we run it too early, we can't get the mac address from wri1 which does
# not exist yet.
# This allows me to pass WRS_VERBOSE=y on the command line...
......@@ -39,9 +39,9 @@ fi
# we need the eth addresses
ethaddr=$(ifconfig eth0 | grep HWaddr | awk '{print $5}')
wraddr=$(ifconfig wr0 | grep HWaddr | awk '{print $5}')
wraddr=$(ifconfig wri1 | grep HWaddr | awk '{print $5}')
# if we run this early (upgrade mess from v4.0) there is no wr0,
# if we run this early (upgrade mess from v4.0) there is no wri1,
# so pick if from the command line:
if [ "x$wraddr" = "x" ]; then
wraddr=$(awk 'BEGIN {FS="="; RS=" "} /wr_nic.macaddr/ {print $2}' \
......
......@@ -24,9 +24,9 @@
echo '<form method=POST>
Select an Endpoint: <select name="endpoint" class="sec">';
for($op = 0; $op < 18; $op++){
for($op = 1; $op <= 18; $op++){
echo '<option value="wr'.$op.'">wr'.$op.'</option>';
echo '<option value="'.$op.'">wri'.$op.'</option>';
}
......@@ -36,7 +36,7 @@
echo '<option value="txcal1">Enable Calibration Transmission</option>';
echo '<option value="txcal0">Disable Calibration Transmission</option>';
echo '<option value="dump">See Registers</option>';
echo '<option value="wr">Modify Registers</option>';
echo '<option value="wri">Modify Registers</option>';
//echo '<option value="rt">Show Flags</option>';
echo '<option value="lock">Lock Endpoint</option>';
//echo '<option value="master">Make Master</option>';
......
......@@ -38,8 +38,7 @@
$header = array ("WR port","Protocol","Tx","Rx","Mode","Fiber");
else
$header = array ("WR port","Tx","Rx","Mode","Fiber");
$matrix = array ("key=CONFIG_PORT00_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT00_PARAMS"],
"key=CONFIG_PORT01_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT01_PARAMS"],
$matrix = array ("key=CONFIG_PORT01_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT01_PARAMS"],
"key=CONFIG_PORT02_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT02_PARAMS"],
"key=CONFIG_PORT03_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT03_PARAMS"],
"key=CONFIG_PORT04_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT04_PARAMS"],
......@@ -56,6 +55,7 @@
"key=CONFIG_PORT15_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT15_PARAMS"],
"key=CONFIG_PORT16_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT16_PARAMS"],
"key=CONFIG_PORT17_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT17_PARAMS"],
"key=CONFIG_PORT18_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT18_PARAMS"],
);
print_multi_form($matrix, $header, $formatID, $class, $infoname, $size);
......
......@@ -28,11 +28,11 @@
echo '<table class="altrowstable" id="alternatecolor" style="width:100%;text-align:center">';
for($i = 0; $i < 9; $i++){
echo '<tr>';
echo '<th>wr'.($i).'</td>';
echo '<td><a href="modifymode.php?wr='.($i).'&mode='.$modes[$i].'">'.$modes[$i].'</a></th>';
echo '<th>wri'.($i+1).'</td>';
echo '<td><a href="modifymode.php?wri='.($i+1).'&mode='.$modes[$i].'">'.$modes[$i].'</a></th>';
echo '<th>wr'.($i+9).'</th>';
echo '<td><a href="modifymode.php?wr='.($i+9).'&mode='.$modes[$i+9].'">'.$modes[$i+9].'</a></td>';
echo '<th>wri'.($i+10).'</th>';
echo '<td><a href="modifymode.php?wri='.($i+10).'&mode='.$modes[$i+9].'">'.$modes[$i+9].'</a></td>';
echo '</tr>';
}
echo '</table>';
......
......@@ -93,7 +93,7 @@ function wrs_header_ports(){
}
else $mode="linkdown";
$desc=sprintf("#%02d: wr%d (%s)",$cont+1,$cont,$mode);
$desc=sprintf("#%02d: wri%d (%s)",$cont+1,$cont+1,$mode);
echo '<th>'."<img class='".$mode."' src='img/".$mode.".png' alt='".$desc."', title='".$desc."'>".'</th>';
$cont++;
......@@ -480,10 +480,10 @@ function wr_endpoint_phytool($option1, $endpoint){
$output=shell_exec("/wr/bin/wr_phytool ".$endpoint." dump");
$ports = explode(" ", $output);
echo 'wri'.$endpoint.'<BR>';
echo "<table border='0' align='center'>";
echo '<tr>';
echo '<th>'.$endpoint.' Register</th>';
echo '<th>Register</th>';
echo '<th>Value</th>';
echo '</tr>';
......@@ -503,20 +503,17 @@ function wr_endpoint_phytool($option1, $endpoint){
//}
// User wants to modify endpoint's registers
} else if(!strcmp($option1, "wr")){
$output=shell_exec("/wr/bin/wr_phytool ".$endpoint." dump");
$ports = explode(" ", $output);
} else if(!strcmp($option1, "wri")){
echo '<br>';
echo '<center></center><form method=POST>';
echo "<table border='0' align='center'>";
echo '<tr>';
echo '<th>'.$endpoint.' Registers</th>';
echo '<th>wri'.$endpoint.' Registers</th>';
echo '<th><center>Value</center></th>';
echo '</tr>';
for($i=0; $i<18; $i++){
/* wr_phytool prints 17 registers */
for($i=0; $i<17; $i++){
echo '<tr>';
echo '<th>R'.$i.'</th>';
echo '<th><input type="text" name="r'.$i.'" value="'.$_POST['r'.$i].'"></th>';
......@@ -526,12 +523,12 @@ function wr_endpoint_phytool($option1, $endpoint){
echo '</tr>';
echo '</table>';
echo '<input type="hidden" name="option1" value="wr">';
echo '<input type="hidden" name="wr" value="yes">';
echo '<input type="hidden" name="option1" value="wri">';
echo '<input type="hidden" name="wri" value="yes">';
echo '<input type="hidden" name="endpoint" value="'.$endpoint.'">';
echo '<center><input type="submit" value="Update" class="btn"></center></form><center>';
if(!empty($_POST['wr'])){
if(!empty($_POST['wri'])){
for($i=0; $i<18 ; $i++){
if (!empty($_POST['r'.$i])){
$cmd = '/wr/bin/wr_phytool '.$_POST['endpoint'].' wr '.dechex($i).' '.$_POST['r'.$i].'';
......@@ -573,8 +570,8 @@ function wr_endpoint_phytool($option1, $endpoint){
function wr_show_endpoint_rt_show(){
$output=shell_exec('/wr/bin/wr_phytool wr0 rt show');
/* use port number between 1 and 18 */
$output=shell_exec('/wr/bin/wr_phytool 1 rt show');
$rts = nl2br($output);
echo $rts;
}
......@@ -1161,7 +1158,7 @@ function parse_endpoint_modes(){
$modes = array();
for($i = 0; $i < 18; $i++){
for($i = 1; $i <= 18; $i++){
$endpoint = intval($i);
$endpoint = sprintf("%02s", $endpoint);
$endpoint = strval($endpoint);
......@@ -1219,12 +1216,7 @@ function parse_mask2ports($vlanmask){
for($i=0; $i<18; $i++){
if($bin[$i]=="1"){
$ports .= "wr".($i+1)." ";
$counter++;
if($counter==4){
$ports .= "<br>";
$counter = 0;
}
$ports .= "wri".($i+1)." ";
}
}
......
......@@ -22,7 +22,7 @@
<?php
$endpoint = intval($_GET["wr"]);
$endpoint = intval($_GET["wri"]);
$endpoint = sprintf("%02s", $endpoint);
$endpoint = strval($endpoint);
......
......@@ -56,7 +56,7 @@
$single_line = explode(" ",$vlans_assignment[$i+1]); //info per endpoint line
echo '<tr>';
echo '<th><center><b>wr'.($i+1).'</b></center></th>';
echo '<th><center><b>'.($single_line[0]).'</b></center></th>';
//Show the Vlan option button
echo '<th>';
......@@ -67,7 +67,7 @@
echo '<option class="btn" value="'.$vlan[0].$vlan[1].'"><center>ID'.$vlan[0].$vlan[1].'</center></option>';
}
}*/
echo '<input STYLE="background-color:'.$vlancolor[$single_line[6]].';text-align:center;" size="5" type="text" value="'.$single_line[6].'" name="vlan'.($i).'">';
echo '<input STYLE="background-color:'.$vlancolor[$single_line[5]].';text-align:center;" size="5" type="text" value="'.$single_line[5].'" name="vlan'.($i).'">';
//echo '<option class="btn" selected="selected" value="disabled"><center>Disabled</center></option>';
//echo '</select>'; // end Vlan ID assignation
......@@ -75,24 +75,24 @@
echo '<th>'; // Mode selection
echo '<select name=mode'.($i).'>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"0")) ? 'selected="selected"' : ''; echo ' value="0"><center>Access</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"1")) ? 'selected="selected"' : ''; echo ' value="1"><center>Trunk</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"2")) ? 'selected="selected"' : ''; echo ' value="2"><center>VLAN Disabled</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"3")) ? 'selected="selected"' : ''; echo ' value="3"><center>Unqualified port</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[1],"0")) ? 'selected="selected"' : ''; echo ' value="0"><center>Access</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[1],"1")) ? 'selected="selected"' : ''; echo ' value="1"><center>Trunk</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[1],"2")) ? 'selected="selected"' : ''; echo ' value="2"><center>VLAN Disabled</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[1],"3")) ? 'selected="selected"' : ''; echo ' value="3"><center>Unqualified port</center></option>';
echo '</select>'; // end mode
echo '</th>';
echo '<th>'; // Priority selection
echo '<select name=prio'.($i).'>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"0")) ? 'selected="selected"' : ''; echo 'value="0"><center>0</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"1")) ? 'selected="selected"' : ''; echo 'value="1"><center>1</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"2")) ? 'selected="selected"' : ''; echo 'value="2"><center>2</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"3")) ? 'selected="selected"' : ''; echo 'value="3"><center>3</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"4")) ? 'selected="selected"' : ''; echo 'value="4"><center>4</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"5")) ? 'selected="selected"' : ''; echo 'value="5"><center>5</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"6")) ? 'selected="selected"' : ''; echo 'value="6"><center>6</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"7")) ? 'selected="selected"' : ''; echo 'value="7"><center>7</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[4],"0")) ? 'selected="selected"' : ''; echo 'value="0"><center>0</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[4],"1")) ? 'selected="selected"' : ''; echo 'value="1"><center>1</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[4],"2")) ? 'selected="selected"' : ''; echo 'value="2"><center>2</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[4],"3")) ? 'selected="selected"' : ''; echo 'value="3"><center>3</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[4],"4")) ? 'selected="selected"' : ''; echo 'value="4"><center>4</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[4],"5")) ? 'selected="selected"' : ''; echo 'value="5"><center>5</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[4],"6")) ? 'selected="selected"' : ''; echo 'value="6"><center>6</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[4],"7")) ? 'selected="selected"' : ''; echo 'value="7"><center>7</center></option>';
echo '</select>'; // end Priority
......@@ -115,27 +115,28 @@
for($i = 0; $i < 18; $i++){
//if(strcmp($_POST['vlan'.$i],"disabled")){ //VLAN selected
$vlan_cmd .= " --ep ".$i;
$vlan_cmd .= " --ep ".($i+1);
$vlan_cmd .= " --emode ".$_POST['mode'.$i];
$vlan_cmd .= " --eprio ".$_POST['prio'.$i];
if(!empty($_POST['vlan'.$i])){$vlan_cmd .= " --evid ".$_POST['vlan'.$i];}
if(!empty($_POST['mask'.$i])){$vlan_cmd .= " --eumask ".$_POST['mask'.$i];}
$output = shell_exec($vlan_cmd);
echo $vlan_cmd;
echo '<br><p><center>Port WR'.($i+1).' added to VLAN'.$_POST['vlan'.$i].'</center></p>';
echo '<br><p><center>Port wri'.($i+1).' added to VLAN'.$_POST['vlan'.$i].'</center></p>';
//}else{
if(!strcmp($_POST['mode'.$i],"2")){ //Disable VLAN for endpoint
$vlan_cmd .= " --ep ".$i;
$vlan_cmd .= " --ep ".($i+1);
$vlan_cmd .= " --emode ".$_POST['mode'.$i];
$output = shell_exec($vlan_cmd);
echo '<br><p><center>VLAN removed for port WR'.($i+1).'</center></p>';
echo '<br><p><center>VLAN removed for port wri'.($i+1).'</center></p>';
}
//}
$vlan_cmd= "/wr/bin/wrs_vlans ";
}
/* redirect to vlan.php */
header('Location: vlan.php');
}
......
......@@ -99,7 +99,7 @@
if($counter>=2 && !empty($line)){
$line = explode(" ", $line);
echo '<tr align=center><td>WR'.($line[1]+1).'</td><td>'.$line[2]." (".$line[3].')</td><td>'.($line[5]).'</td><td bgcolor="'.$vlancolor[$line[6]].'">VLAN '.$line[6].'</td><td>'.$line[7].'</td></td></tr>';
echo '<tr align=center><td>'.($line[0]).'</td><td>'.$line[1]." (".$line[2].')</td><td>'.($line[4]).'</td><td bgcolor="'.$vlancolor[$line[5]].'">VLAN '.$line[5].'</td><td>'.$line[6].'</td></td></tr>';
}
......
......@@ -20,7 +20,7 @@ echo "# This file will be overwritten at next boot." >> $OUTPUT_FILE
#copy top of ppsi.conf
cat $PRE_FILE >> $OUTPUT_FILE
for i_zero in {00..17};do
for i_zero in {01..18};do
# unset parametes
unset p_name
unset p_proto
......@@ -57,12 +57,12 @@ for i_zero in {00..17};do
i=$(expr $i_zero + 0)
if [ -n "$p_proto" ]; then
echo "port wr$i-$p_proto" >> $OUTPUT_FILE
echo "port wri$i-$p_proto" >> $OUTPUT_FILE
echo "proto $p_proto" >> $OUTPUT_FILE
else
echo "port wr$i-raw" >> $OUTPUT_FILE
echo "port wri$i-raw" >> $OUTPUT_FILE
fi
echo "iface wr$i" >> $OUTPUT_FILE
echo "iface wri$i" >> $OUTPUT_FILE
if [ -n "$p_role" ]; then
echo "role $p_role" >> $OUTPUT_FILE
fi
......
......@@ -4,93 +4,93 @@
clock-class 187
clock-accuracy 254
port wr0
iface wr0
port wri1
iface wri1
role auto
extension whiterabbit
port wr1
iface wr1
port wri2
iface wri2
role auto
extension whiterabbit
port wr2
iface wr2
port wri3
iface wri3
role auto
extension whiterabbit
port wr3
iface wr3
port wri4
iface wri4
role auto
extension whiterabbit
port wr4
iface wr4
port wri5
iface wri5
role auto
extension whiterabbit
port wr5
iface wr5
port wri6
iface wri6
role auto
extension whiterabbit
port wr6
iface wr6
port wri7
iface wri7
role auto
extension whiterabbit
port wr7
iface wr7
port wri8
iface wri8
role auto
extension whiterabbit
port wr8
iface wr8
port wri9
iface wri9
role auto
extension whiterabbit
port wr9
iface wr9
port wri10
iface wri10
role auto
extension whiterabbit
port wr10
iface wr10
port wri11
iface wri11
role auto
extension whiterabbit
port wr11
iface wr11
port wri12
iface wri12
role auto
extension whiterabbit
port wr12
iface wr12
port wri13
iface wri13
role auto
extension whiterabbit
port wr13
iface wr13
port wri14
iface wri14
role auto
extension whiterabbit
port wr14
iface wr14
port wri15
iface wri15
role auto
extension whiterabbit
port wr15
iface wr15
port wri16
iface wri16
role auto
extension whiterabbit
port wr16
iface wr16
port wri17
iface wri17
role auto
extension whiterabbit
port wr17
iface wr17
port wri18
iface wri18
role auto
extension whiterabbit
......@@ -5,17 +5,17 @@ set -e
## fill this file with vlans configuration
## Please note:
## wr1 is marked as port 2 on the front panel of the switch
## wri2 is marked as port 2 on the front panel of the switch
## in other words:
## --ep1 == wr1
## but:
## wr1 == port2
## --port 2 == wri2
## and:
## wri2 == port2
## example configuration:
# configure ports 1-4,6,8-18 as evid 1
# /wr/bin/wrs_vlans --ep 0-3,5,7-17 --emode 0 --evid 1
# configure ports 5,7 as evid 2
# /wr/bin/wrs_vlans --ep 4,6 --emode 0 --evid 2
# configure ports 1-4,6,8-18 as pvid 1
# /wr/bin/wrs_vlans --port 1-4,6,8-18 --pmode 0 --pvid 1
# configure ports 5,7 as pvid 2
# /wr/bin/wrs_vlans --port 5,7 --pmode 0 --pvid 2
## set VID=1 on all ports except 4 and 6
## - binary: 11 1111 1111 1010 1111
......@@ -28,6 +28,6 @@ set -e
# /wr/bin/wrs_vlans --rvid 2 --rfid 2 --rmask 0x00050
## when VLANs are defined, comment out the line below
echo -n "no configuration "
echo -n "no vlan configuration "
exit 0
The initial version of wrsScalar.c and wrsScalar.h is generated by running
export BUILD_DIR="$WRS_OUTPUT_DIR/build/buildroot-2011.11/output/build"
export MIBDIRS=$BUILD_DIR/netsnmp-5.6.1.1/mibs
And then this "intuitive" command:
export MIBS=./WR-SWITCH-MIB.txt
$BUILD_DIR/netsnmp-5.6.1.1/local/mib2c \
-I $BUILD_DIR/netsnmp-5.6.1.1/local \
-c mib2c.scalar.conf \
wrsScalar
Clearly, if you rename the item, the code must be completely rewritten
(and I already did it once).
Pstats code, on the other hand, is based on what ifTable does in the
real snmpd. i.e., no autogeneration was used.
This is one option I tried, but the result was too complex:
export MIBS=./WR-SWITCH-MIB.txt
$BUILD_DIR/netsnmp-5.6.1.1/local/mib2c \
-I $BUILD_DIR/netsnmp-5.6.1.1/local \
-I $BUILD_DIR/netsnmp-5.6.1.1/local/mib2c-conf.d \
-c mib2c.mfd.conf \
pstatsTable
This one spits out a single file, but again too complex for me:
export MIBS=./WR-SWITCH-MIB.txt
$BUILD_DIR/netsnmp-5.6.1.1/local/mib2c \
-I $BUILD_DIR/netsnmp-5.6.1.1/local \
-I $BUILD_DIR/netsnmp-5.6.1.1/local/mib2c-conf.d \
-c mib2c.raw-table.conf \
pstatsTable
Using "mib2c.create-dataset.conf" is even worse, becahse the dataset
is static and hidden in some obscure place, I can't change it after
creation.
With the current code base, I properly get the counters:
tornado% snmpwalk -c public -v 2c wrs SNMPv2-SMI::enterprises.96.100 | wc -l
743
The numeric OID for WRS is:
.1.3.6.1.4.1.96.100
The OID for counters is:
.1.3.6.1.4.1.96.100.2.1
Then, column 1 is the counter names, and colomn N+2 is the counters for
port wrN (0..17). Column M+1 is for port M as written on the device (1..18).
Example: get counter 18 (line 19):
snmpwalk -On -c public -v 2c wrs SNMPv2-SMI::enterprises.96.100.2.1 | \
grep '2\.1\..*\.19 ='
.1.3.6.1.4.1.96.100.2.1.1.19 = STRING: "TX Frames"
.1.3.6.1.4.1.96.100.2.1.2.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.3.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.4.19 = Counter32: 0
.1.3.6.1.4.1.96.100.2.1.5.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.6.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.7.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.8.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.9.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.10.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.11.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.12.19 = Counter32: 1057
.1.3.6.1.4.1.96.100.2.1.13.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.14.19 = Counter32: 0
.1.3.6.1.4.1.96.100.2.1.15.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.16.19 = Counter32: 1025
.1.3.6.1.4.1.96.100.2.1.17.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.18.19 = Counter32: 38
.1.3.6.1.4.1.96.100.2.1.19.19 = Counter32: 38
You can get a symbolic readout by forcing the tool to access the
local WR-SWITCH-MIB.txt. So we can get all counters for port WR14 like
this:
snmpwalk -m $WR_SWITCH_SW/userspace/snmpd/WR-SWITCH-MIB.txt \
-c public -v 2c wrs 1.3.6.1.4.1.96.100.2 | \
grep WR14
......@@ -17,8 +17,8 @@ proc updatew {wname} {
set new [expr ![llength [winfo children $wname]]]
if $new {
grid [label $wname.name -text "CTR NAME" -fg blue] -row 0 -column 1
for {set i 0; set c 2} {$i < 18} {incr i; incr c} {
grid [label $wname.wr$i -text "WR$i" -fg blue] -row 0 -column $c
for {set i 1; set c 2} {$i < 19} {incr i; incr c} {
grid [label $wname.wri$i -text "WRI$i" -fg blue] -row 0 -column $c
}
}
set labels {wrsPstatsHCPortName
......
......@@ -73,7 +73,7 @@ static int get_endpoint_status(struct ns_pstats *old,
* logs */
ret = 1;
snmp_log(LOG_ERR, "SNMP: wrsEndpointStatus failed for "
"port %d\n", i);
"port %d (wri %d)\n", i + 1, i + 1);
}
}
return ret;
......@@ -107,7 +107,7 @@ static int get_swcore_status(struct ns_pstats *old,
* logs */
ret = 1;
snmp_log(LOG_ERR, "SNMP: wrsSwcoreStatus failed for "
"port %d\n", i);
"port %d (wri %d)\n", i + 1, i + 1);
}
#endif
/* values from 2.2.5 "Too much HP traffic / Per-priority queue
......@@ -129,7 +129,7 @@ static int get_swcore_status(struct ns_pstats *old,
* logs */
ret = 1;
snmp_log(LOG_ERR, "SNMP: wrsSwcoreStatus failed for "
"port %d\n", i);
"port %d (wri %d)\n", i + 1, i + 1);
}
}
return ret;
......@@ -151,7 +151,7 @@ static int get_rtu_status(struct ns_pstats *old,
* logs */
ret = 1;
snmp_log(LOG_ERR, "SNMP: wrsEndpointStatus failed for "
"port %d\n", i);
"port %d (wri %d)\n", i + 1, i + 1);
}
}
/* TODO: add 2.2.7 "Network loop - two or more identical MACs on two or
......
......@@ -67,7 +67,7 @@ time_t wrsPortStatusTable_data_fill(unsigned int *n_rows)
/* Assume that number of ports does not change between
* reads */
snprintf(wrsPortStatusTable_array[i].port_name, 10,
"wr%d", i);
"wri%d", i + 1);
port_state = hal_lookup_port(hal_ports,
hal_nports_local,
wrsPortStatusTable_array[i].port_name);
......
......@@ -108,8 +108,8 @@ wrsPstatsHCTable_data_fill(unsigned int *n_rows)
/* read pstats for each port */
for (wrport = 0; wrport < WRS_N_PORTS; wrport++) {
snprintf(pstats_array[wrport].port_name, 10,
"wr%d", wrport);
sprintf(fname, PSTATS_SYSCTL_PATH"port%i", wrport);
"wri%d", wrport + 1);
sprintf(fname, PSTATS_SYSCTL_PATH"wrport%i", wrport + 1);
f = fopen(fname, "r");
if (!f) {
snmp_log(LOG_ERR,
......
......@@ -243,7 +243,8 @@ static void get_wrsSlaveLinksStatus(unsigned int port_status_nrows)
wrsTimingStatus_s.wrsSlaveLinksStatus =
WRS_SLAVE_LINK_STATUS_ERROR;
snmp_log(LOG_ERR, "SNMP: wrsSlaveLinksStatus (slave) "
"failed for port %d\n", i);
"failed for port %d (wri%d)\n",
i + 1, i + 1);
}
/* error when slave port is up when switch is in master or
* grandmaster mode */
......@@ -253,7 +254,8 @@ static void get_wrsSlaveLinksStatus(unsigned int port_status_nrows)
wrsTimingStatus_s.wrsSlaveLinksStatus =
WRS_SLAVE_LINK_STATUS_ERROR;
snmp_log(LOG_ERR, "SNMP: wrsSlaveLinksStatus (master) "
"failed for port %d\n", i);
"failed for port %d (wri%d)\n",
i + 1, i + 1);
}
}
}
......@@ -295,7 +297,8 @@ static void get_wrsPTPFramesFlowing(unsigned int port_status_nrows)
wrsTimingStatus_s.wrsPTPFramesFlowing =
WRS_PTP_FRAMES_FLOWING_ERROR;
snmp_log(LOG_ERR, "SNMP: wrsPTPFramesFlowing "
"failed for port %d\n", i);
"failed for port %d (wri%d)\n",
i + 1, i + 1);
/* can't go worse, no need to change other ports */
break;
......
......@@ -102,7 +102,7 @@ char *decode_ports(int dpm, int nports)
for (i = 0; i < nports; i++)
{
sprintf(str2,"%d ", i);
sprintf(str2, "%d ", i + 1);
if(dpm&(1<<i)) strcat(str,str2);
}
......@@ -322,29 +322,57 @@ int main(int argc, char **argv)
isok=0;
if(argc>1)
{
if(strcmp(argv[1], "remove")==0)
{
if (strcmp(argv[1], "remove") == 0) {
i=atoidef(argv[2],-1);
if((0 <= i && i < 18) && (rtudexp_clear_entries(i,atoidef(argv[3],0))==0)) isok=1;
else printf("Could not %s entry for wr%d\n",argv[1],i);
/* interface number 1..18*/
if ((0 < i && i <= 18)
&& (rtudexp_clear_entries(i - 1,
atoidef(argv[3], 0)
) == 0)) {
/* ok */
isok = 1;
} else {
printf("Could not %s entry for wri%d\n",
argv[1], i);
exit(1);
}
else if(strcmp(argv[1], "add")==0)
{
if((argc > 3) && (rtudexp_add_entry(argv[2],atoi(argv[3]),atoidef(argv[4],0))==0)) isok=1;
else printf("Could not %s entry for %s\n",argv[2],argv[3]);
} else if (strcmp(argv[1], "add") == 0) {
/* interface number 1..18*/
if ((argc > 3)
&& (rtudexp_add_entry(argv[2],
atoi(argv[3]) - 1,
atoidef(argv[4], 0)
) == 0)) {
/* ok */
isok = 1;
} else {
printf("Could not %s entry for %s\n", argv[2],
argv[3] - 1);
exit(1);
}
else if(strcmp(argv[1], "vlan")==0)
{
if((argc > 3 ) && (rtudexp_vlan_entry(atoi(argv[2]),atoi(argv[3]),argv[4],
atoidef(argv[5],0),atoidef(argv[6],0),atoidef(argv[7],0),
atoidef(argv[8],0))==0)) isok=1;
else printf("Could not %s entry for %s\n",argv[2],argv[3]);
} else if (strcmp(argv[1], "vlan") == 0) {
if ((argc > 3)
&& (rtudexp_vlan_entry(atoi(argv[2]),
atoi(argv[3]) - 1,
argv[4],
atoidef(argv[5], 0),
atoidef(argv[6], 0),
atoidef(argv[7], 0),
atoidef(argv[8], 0)
) == 0)) {
/* ok */
isok = 1;
} else {
printf("Could not %s entry for %s\n", argv[2],
argv[3]);
exit(1);
}
else if(strcmp(argv[1], "list")==0) isok=1;
} else if (strcmp(argv[1], "list") == 0)
isok = 1;
//Does not continue
if(!isok) show_help(argv[0]);
if (!isok)
show_help(argv[0]);
}
......
......@@ -247,7 +247,7 @@ void show_ports(void)
int print_port = 0;
int print_mode_color = 0;
snprintf(if_name, 10, "wr%d", i);
snprintf(if_name, 10, "wri%d", i + 1);
port_state = hal_lookup_port(hal_ports_local_copy,
hal_nports_local, if_name);
......
......@@ -297,7 +297,7 @@ void calc_trans(int ep, int argc, char *argv[])
if(argc >= 3)
f_log = fopen(argv[3], "wb");
snprintf(sock_addr.if_name, sizeof(sock_addr.if_name), "wr%d", ep);
snprintf(sock_addr.if_name, sizeof(sock_addr.if_name), "wri%d", ep);
sock_addr.family = PTPD_SOCK_RAW_ETHERNET; // socket type
sock_addr.ethertype = 12345;
memset(sock_addr.mac, 0xff, 6);
......@@ -425,7 +425,7 @@ void pps_adjustment_test(int ep, int argc, char *argv[])
signal (SIGINT, sighandler);
snprintf(sock_addr.if_name, sizeof(sock_addr.if_name), "wr%d", ep);
snprintf(sock_addr.if_name, sizeof(sock_addr.if_name), "wri%d", ep);
sock_addr.family = PTPD_SOCK_RAW_ETHERNET; // socket type
sock_addr.ethertype = 12345;
memset(sock_addr.mac, 0xff, 6);
......@@ -468,6 +468,8 @@ void pps_adjustment_test(int ep, int argc, char *argv[])
void rt_command(int ep, int argc, char *argv[])
{
/* ep is 0..17 */
struct rts_pll_state pstate;
int i;
......@@ -476,7 +478,7 @@ void rt_command(int ep, int argc, char *argv[])
if( rts_connect(NULL) < 0)
{
printf("Can't connect to the RT subsys\n");
return;
exit(1);
}
rts_get_state(&pstate);
......@@ -487,7 +489,8 @@ void rt_command(int ep, int argc, char *argv[])
hal_nports_local);
printf("CurrentRef: %d Mode: %d Flags: %x\n", pstate.current_ref, pstate.mode, pstate.flags);
for (i = 0; i < hal_nports_local; i++)
printf("wr%-2d: setpoint: %-8dps current: %-8dps loopback: %-8dps flags: %x\n", i,
printf("wri%-2d: setpoint: %-8dps current: %-8dps "
"loopback: %-8dps flags: %x\n", i + 1,
pstate.channels[i].phase_setpoint,
pstate.channels[i].phase_current,
pstate.channels[i].phase_loopback,
......@@ -514,7 +517,7 @@ void rt_command(int ep, int argc, char *argv[])
}
else if (!strcmp(argv[3], "track"))
{
printf("Enabling ptracker @ port %d\n", ep);
printf("Enabling ptracker @ port %d (wri%d)\n", ep + 1, ep + 1);
rts_enable_ptracker(ep, 1);
}
......@@ -580,6 +583,7 @@ struct {
int main(int argc, char **argv)
{
int i;
int ep;
wrs_msg_init(1, argv); /* only use argv[0]: no cmdline */
......@@ -601,7 +605,14 @@ int main(int argc, char **argv)
for(i=0; commands[i].cmd;i++)
if(!strcmp(commands[i].cmd, argv[2]))
{
commands[i].func(atoi(argv[1]), argc, argv);
/* first parameter is an enpoint number 1..18 */
ep = atoi(argv[1]) - 1;
if (ep < 0) {
printf("Wrong endpoint number %d\n", ep + 1);
exit(1);
}
/* pass endpoint as number 0..17 */
commands[i].func(ep, argc, argv);
return 0;
}
......
......@@ -317,7 +317,7 @@ int dump_hal_mem(struct wrs_shm_head *head)
}
for (i = 0; i < n; i++, p++) {
printf("dump port %i\n", i);
printf("dump port %i\n", i + 1);
dump_many_fields(p, hal_port_info, ARRAY_SIZE(hal_port_info));
}
return 0;
......
......@@ -15,8 +15,9 @@ static struct EP_WB _ep_wb;
/* convert WR switch endpoint register name to an address value */
#define EP_REG(regname) ((uint32_t)((void *)&_ep_wb.regname - (void *)&_ep_wb))
/* convert port number (x) to an endpoint address, x from 0 to 17 on switch */
#define IDX_TO_EP(x) (0x30000 + ((x) * 0x400))
/* convert port number (x) to an endpoint address, x is 1..18 on switch,
* ep is 0..17 */
#define IDX_TO_EP(x) (0x30000 + (((x) - 1) * 0x400))
/* FIXME: if include of endpoint-mdio.h is fixed this define can go:
* #ifndef __WBGEN2_REGDEFS_ENDPOINT-MDIO_WB to
......@@ -39,7 +40,7 @@ void help(char *prgname)
" -h print help\n"
"\n"
" Port numbers:\n"
" <port_nr> = 0 to 17 (on 18 port switch)\n"
" <port_nr> = 1 to 18 (on 18 port switch)\n"
"\n"
" Commands <cmd> are:\n"
" on - switch TX laser on.\n"
......@@ -49,38 +50,40 @@ void help(char *prgname)
/*
* Read a 1000base-X TBI PCS register on a WR switch endpoint
* ep: endpoint number (0 to 17, will be translated to address offset)
* port: endpoint number (1 to 18, will be translated to address offset)
* reg: WR endpoint 1000base-X TBI PCS register address to read from
*/
uint32_t pcs_read(int ep, uint32_t reg)
uint32_t pcs_read(int port, uint32_t reg)
{
/*
* write the PCS register address to read from to the MDIO control
* register on the WR switch endpoint.
*/
_fpga_writel(IDX_TO_EP(ep) + EP_REG(MDIO_CR), EP_MDIO_CR_ADDR_W(reg));
_fpga_writel(IDX_TO_EP(port) + EP_REG(MDIO_CR),
EP_MDIO_CR_ADDR_W(reg));
/*
* wait until the control register has processed the address and copied
* the data from the address into the control register
*/
while (!(_fpga_readl(IDX_TO_EP(ep) + EP_REG(MDIO_ASR)) &
while (!(_fpga_readl(IDX_TO_EP(port) + EP_REG(MDIO_ASR)) &
EP_MDIO_ASR_READY))
;
/* read data copied into the control register */
return EP_MDIO_CR_DATA_R(_fpga_readl(IDX_TO_EP(ep) + EP_REG(MDIO_ASR)));
return EP_MDIO_CR_DATA_R(_fpga_readl(IDX_TO_EP(port) +
EP_REG(MDIO_ASR)));
}
/*
* Write a value to a 1000base-X TBI PCS register on a WR switch endpoint
* ep: endpoint number (0 to 17, will be translated to address offset)
* port: endpoint number (1 to 18, will be translated to address offset)
* reg: WR endpoint 1000base-X TBI PCS register address to write to
* value: PCS register value to write
*/
void pcs_write(int ep, uint32_t reg, uint32_t val)
void pcs_write(int port, uint32_t reg, uint32_t val)
{
_fpga_writel(IDX_TO_EP(ep) + EP_REG(MDIO_CR), EP_MDIO_CR_ADDR_W(reg)
_fpga_writel(IDX_TO_EP(port) + EP_REG(MDIO_CR), EP_MDIO_CR_ADDR_W(reg)
| EP_MDIO_CR_DATA_W(val) | EP_MDIO_CR_RW);
while (!(_fpga_readl(IDX_TO_EP(ep) + EP_REG(MDIO_ASR)) &
while (!(_fpga_readl(IDX_TO_EP(port) + EP_REG(MDIO_ASR)) &
EP_MDIO_ASR_READY))
;
}
......@@ -166,7 +169,7 @@ int main(int argc, char *argv[])
if (argc > 2) {
port_number = atoi(argv[1]);
if (port_number < 0 || port_number > get_nports_from_hal()-1) {
if (port_number < 1 || port_number > get_nports_from_hal()) {
printf("Port number out of range\n");
exit(1);
}
......
......@@ -15,7 +15,7 @@
#include <libwr/switch_hw.h>
#include <libwr/hal_client.h>
static void parse_sysfs(int init);
static void parse_sysfs(void);
#define NPORTS 18
#define CNT_PP 39
......@@ -25,7 +25,13 @@ struct cnt_word {
uint64_t init;
};
struct cnt_word cnt_pp[NPORTS][CNT_PP];
#define IF_SIZE 8
struct p_cnt {
char if_name[IF_SIZE];
struct cnt_word counters[CNT_PP];
};
struct p_cnt cnt_pp[NPORTS];
int use_ports;
char info[][20] = {{"Tu-run|"}, // 0
......@@ -72,62 +78,74 @@ char info[][20] = {{"Tu-run|"}, // 0
int pstats_init(int init)
{
int i, j;
FILE *file;
uint32_t p_index, cntr;
uint32_t tmp1;
uint32_t tmp2;
uint64_t val;
char filename[30];
printf("module initialized\n");
for(i=0; i<use_ports; ++i)
for(j=0; j<CNT_PP; ++j)
{
cnt_pp[i][j].init = 0;
cnt_pp[i][j].cnt = 0;
cnt_pp[i].counters[j].init = 0;
cnt_pp[i].counters[j].cnt = 0;
}
parse_sysfs(init);
return 0;
}
static void parse_sysfs(int init)
{
FILE *file;
uint32_t port, cntr;
uint32_t tmp1;
uint32_t tmp2;
uint64_t val;
char filename[30];
for (p_index = 0; p_index < use_ports; ++p_index) {
/* wrport is numbered from 1 to 18 */
snprintf(cnt_pp[p_index].if_name, IF_SIZE, "wri%u",
p_index + 1);
if (init == 1) {
for(port=0; port<use_ports; ++port) {
sprintf(filename, "/proc/sys/pstats/port%u", port);
sprintf(filename, "/proc/sys/pstats/wrport%u",
p_index + 1);
file = fopen(filename, "r");
for(cntr=0; cntr<CNT_PP; ++cntr) {
for (cntr = 0; cntr < CNT_PP; ++cntr) {
fscanf(file, "%" SCNu32, &tmp1);
fscanf(file, "%" SCNu32, &tmp2);
val = (((uint64_t) tmp2) << 32) | tmp1;
cnt_pp[port][cntr].init = val;
cnt_pp[p_index].counters[cntr].init = val;
}
fclose(file);
}
}
else {
for(port=0; port<use_ports; ++port) {
parse_sysfs();
return 0;
}
static void parse_sysfs(void)
{
FILE *file;
uint32_t p_index, cntr;
uint32_t tmp1;
uint32_t tmp2;
uint64_t val;
char filename[30];
sprintf(filename, "/proc/sys/pstats/port%u", port);
for (p_index = 0; p_index < use_ports; ++p_index) {
/* wrport is numbered from 1 to 18 */
sprintf(filename, "/proc/sys/pstats/wrport%u",
p_index + 1);
file = fopen(filename, "r");
for(cntr=0; cntr<CNT_PP; ++cntr) {
for (cntr = 0; cntr < CNT_PP; ++cntr) {
fscanf(file, "%" SCNu32, &tmp1);
fscanf(file, "%" SCNu32, &tmp2);
val = (((uint64_t) tmp2) << 32) | tmp1;
cnt_pp[port][cntr].cnt = val - cnt_pp[port][cntr].init;
cnt_pp[p_index].counters[cntr].cnt =
val - cnt_pp[p_index].counters[cntr].init;
}
fclose(file);
}
}
}
void print_first_n_cnts(int n_cnts)
{
int cnt = 0;
int port = 0;
int p_index = 0;
printf("P |");
for(cnt=0; cnt<n_cnts; ++cnt)
printf("%2d:%s", cnt,info[cnt]);
......@@ -137,11 +155,11 @@ void print_first_n_cnts(int n_cnts)
printf("----------");
printf("\n");
for(port=0; port<use_ports; ++port)
for (p_index = 0; p_index < use_ports; ++p_index)
{
printf("%2u|", port);
for(cnt=0; cnt<n_cnts;++cnt)
printf("%9llu|", cnt_pp[port][cnt].cnt);
printf("%-5s|", cnt_pp[p_index].if_name);
for (cnt = 0; cnt < n_cnts; ++cnt)
printf("%9llu|", cnt_pp[p_index].counters[cnt].cnt);
printf("\n");
}
}
......@@ -149,7 +167,7 @@ void print_first_n_cnts(int n_cnts)
void print_chosen_cnts( int cnts_list[], int n_cnts)
{
int cnt = 0;
int port = 0;
int p_index = 0;
printf("P |");
for(cnt=0; cnt<n_cnts; ++cnt)
......@@ -159,11 +177,12 @@ void print_chosen_cnts( int cnts_list[], int n_cnts)
for(cnt=0; cnt<n_cnts; ++cnt)
printf("----------");
printf("\n");
for(port=0; port<use_ports; ++port)
for (p_index = 0; p_index < use_ports; ++p_index)
{
printf("%2u|", port);
for(cnt=0; cnt<n_cnts;++cnt)
printf("%9llu|", cnt_pp[port][cnts_list[cnt]].cnt);
printf("%-5s|", cnt_pp[p_index].if_name);
for (cnt = 0; cnt < n_cnts; ++cnt)
printf("%9llu|",
cnt_pp[p_index].counters[cnts_list[cnt]].cnt);
printf("\n");
}
}
......@@ -223,7 +242,7 @@ int main(int argc, char **argv)
while(1)
{
printf("\033[2J\033[1;1H");
parse_sysfs(0);
parse_sysfs();
switch(op) {
case 'p':
print_chosen_cnts(prio_cnts, 8);
......
......@@ -79,14 +79,14 @@ int main(int argc, char **argv)
for (i = dump_port; i <= nports; i++) {
memset(&shdr, 0, sizeof(shdr));
printf("========= port %d =========\n", i - 1);
printf("========= port %d =========\n", i);
err = shw_sfp_read_verify_header(i - 1, &shdr);
if (err == -2) {
pr_error("SFP module not inserted in port %d. Failed "
"to read SFP configuration header\n", i - 1);
"to read SFP configuration header\n", i);
} else if (err < 0) {
pr_error("Failed to read SFP configuration header on "
"port %d\n", i - 1);
"port %d\n", i);
} else {
shw_sfp_print_header(&shdr);
if (dump_hex_header) {
......
......@@ -48,12 +48,12 @@ static struct option ropts[] = {
{"debug", 0, &debug, 1},
{"clear", 0, NULL, OPT_CLEAR},
{"list", 0, NULL, OPT_LIST},
{"ep", 1, NULL, OPT_EP_PORT},
{"emode", 1, NULL, OPT_EP_QMODE},
{"evid", 1, NULL, OPT_EP_VID},
{"eprio", 1, NULL, OPT_EP_PRIO},
{"eumask", 1, NULL, OPT_EP_UMASK},
{"elist", 0, NULL, OPT_EP_LIST},
{"port", 1, NULL, OPT_P_PORT},
{"pmode", 1, NULL, OPT_P_QMODE},
{"pvid", 1, NULL, OPT_P_VID},
{"pprio", 1, NULL, OPT_P_PRIO},
{"pumask", 1, NULL, OPT_P_UMASK},
{"plist", 0, NULL, OPT_P_LIST},
{"rvid", 1, NULL, OPT_RTU_VID},
{"rfid", 1, NULL, OPT_RTU_FID},
{"rmask", 1, NULL, OPT_RTU_PMASK},
......@@ -75,7 +75,7 @@ static int set_rtu_vlan(int vid, int fid, int pmask, int drop, int prio,
int del, int flags);
static void free_rtu_vlans(struct rtu_vlans_t *ptr);
static void list_rtu_vlans(void);
static void list_ep_vlans(void);
static void list_p_vlans(void);
static int rtu_find_vlan(struct rtu_vlan_table_entry *rtu_vlan_entry, int vid,
int fid);
static int config_rtud(void);
......@@ -113,6 +113,10 @@ static int parse_mask(char *arg, unsigned long *pmask)
default:
return -1;
}
/* parameter --port should be from the range 1..18,
* but internally we use 0..17 */
p1--;
p2--;
if ((p1 > p2) || (p1 < 0) || (p2 >= NPORTS))
return -1;
for (; p1 <= p2; p1++) {
......@@ -123,9 +127,9 @@ static int parse_mask(char *arg, unsigned long *pmask)
if (!debug)
return 0;
fprintf(stderr, "%s: working on ports:", prgname);
printf("%s: working on ports:\n", prgname);
iterate_ports(p1, *pmask)
printf(" %i", p1);
printf(" %i", p1 + 1);
printf("\n");
return 0;
}
......@@ -133,7 +137,7 @@ static int parse_mask(char *arg, unsigned long *pmask)
int main(int argc, char *argv[])
{
int c, i, arg;
unsigned long conf_pmask = 0; //current '--ep' port mask
unsigned long conf_pmask = 0; /* current '--port' port mask */
struct rtu_shmem_header *rtu_hdr;
int n_wait = 0;
int ret;
......@@ -208,19 +212,18 @@ int main(int argc, char *argv[])
/*parse parameters*/
while( (c = getopt_long(argc, argv, "h", ropts, NULL)) != -1) {
switch(c) {
case OPT_EP_PORT:
//port number
case OPT_P_PORT:
/* port number */
conf_pmask = 0;
if (parse_mask(optarg, &conf_pmask) < 0) {
fprintf(stderr, "%s: wrong port mask "
"\"%s\"\n", prgname, optarg);
exit(1);
}
break;
case OPT_EP_QMODE:
//qmode for port
case OPT_P_QMODE:
/* qmode for port */
arg = atoi(optarg);
if (arg < 0 || arg > 3) {
fprintf(stderr, "%s: invalid qmode %i (\"%s\")\n",
......@@ -235,22 +238,25 @@ int main(int argc, char *argv[])
vlans[i].untag_mask = (arg == 0);
}
break;
case OPT_EP_PRIO:
//priority value for port, forces fix_prio=1
case OPT_P_PRIO:
/* priority value for port, forces fix_prio=1 */
iterate_ports(i, conf_pmask) {
vlans[i].prio_val = atoi(optarg);
vlans[i].fix_prio = 1;
vlans[i].valid_mask |= VALID_PRIO;
}
break;
case OPT_EP_VID:
//VID for port
case OPT_P_VID:
/* VID for port */
iterate_ports(i, conf_pmask) {
vlans[i].vid = atoi(optarg);
vlans[i].valid_mask |= VALID_VID;
}
break;
case OPT_EP_UMASK:
case OPT_P_UMASK:
//untag mask -- currently 0 or 1. Overrides default set in QMODE above
arg = atoi(optarg);
if (arg < 0 || arg > 1) {
......@@ -263,9 +269,10 @@ int main(int argc, char *argv[])
vlans[i].valid_mask |= VALID_UNTAG;
}
break;
case OPT_EP_LIST:
// list endpoint stuff
list_ep_vlans();
case OPT_P_LIST:
/* list endpoint stuff */
list_p_vlans();
break;
/****************************************************/
......@@ -322,28 +329,29 @@ int main(int argc, char *argv[])
static int print_help(char *prgname)
{
fprintf(stderr, "Use: %s [--ep <port number> <EP options> --ep <port number> "
"<EP options> ...] [--rvid <vid> --rfid <fid> --rmask <mask> --rdrop "
fprintf(stderr, "Use: %s [--port <port number 1..18> <port options> "
"--port <port number> <port options> ...] "
"[--rvid <vid> --rfid <fid> --rmask <mask> --rdrop "
"--rprio <prio> --rvid <vid>...] [--debug]\n", prgname);
fprintf(stderr,
"Endpoint options:\n"
"\t --emode <mode No.> sets qmode for a port, possible values:\n"
"Port options:\n"
"\t --pmode <mode No.> sets qmode for a port, possible values:\n"
"\t \t 0: ACCESS - tags untagged frames, drops tagged frames not belinging to configured VLAN\n"
"\t \t 1: TRUNK - passes only tagged frames, drops all untagged frames\n"
"\t \t 2: VLANs disabled - passess all frames as is\n"
"\t \t 3: Unqualified port - passess all frames regardless VLAN config\n"
"\t --eprio <priority> sets priority for retagging\n"
"\t --evid <vid> sets VLAN Id for port\n"
"\t --eumask <hex mask> sets untag mask for port\n"
"\t --elist lists current EP configuration\n"
"\t --pprio <priority> sets priority for retagging\n"
"\t --pvid <vid> sets VLAN Id for port\n"
"\t --pumask <hex mask> sets untag mask for port\n"
"\t --plist lists current ports configuration\n"
"RTU options:\n"
"\t --rvid <vid> configure VLAN <vid> in rtud\n"
"\t --del delete selected VLAN from rtud\n"
"\t --rfid <fid> assign <fid> to configured VLAN\n"
"\t --rmask <hex mask> ports belonging to configured VLAN\n"
"\t --rdrop <1/0> drop/don't drop frames on VLAN\n"
"\t --rprio <prio> force priority for VLAN (-1 cancels priority override\n"
"\t --rprio <prio> force priority for VLAN (-1 cancels priority override)\n"
"Other options:\n"
"\t --clear clears RTUd VLAN table\n"
"\t --list prints the content of RTUd VLAN table\n"
......@@ -359,10 +367,17 @@ static void print_config(struct s_port_vlans *vlans)
for_each_port(i) {
printf("port: %d, qmode: %d, qmode_valid: %d, fix_prio: %d, prio_val: %d, "
"prio_valid: %d, vid: %d, vid_valid: %d, untag_mask: 0x%X, untag_valid: %d\n",
i, vlans[i].qmode, ((vlans[i].valid_mask & VALID_QMODE) != 0), vlans[i].fix_prio,
vlans[i].prio_val, ((vlans[i].valid_mask & VALID_PRIO) != 0),vlans[i].vid,
((vlans[i].valid_mask & VALID_VID) != 0), vlans[i].untag_mask,
((vlans[i].valid_mask & VALID_UNTAG) != 0) );
i + 1,
vlans[i].qmode,
((vlans[i].valid_mask & VALID_QMODE) != 0),
vlans[i].fix_prio,
vlans[i].prio_val,
((vlans[i].valid_mask & VALID_PRIO) != 0),
vlans[i].vid,
((vlans[i].valid_mask & VALID_VID) != 0),
vlans[i].untag_mask,
((vlans[i].valid_mask & VALID_UNTAG) != 0)
);
}
}
......@@ -501,19 +516,19 @@ static void list_rtu_vlans(void)
}
static void list_ep_vlans(void)
static void list_p_vlans(void)
{
uint32_t v, r;
int ep;
static char *names[] = {"ACCESS", "TRUNK", "disabled", "unqualified"};
printf("# QMODE FIX_PRIO PRIO PVID MAC\n");
printf("#---------------------------------------------\n");
printf("#-----------------------------------------------\n");
for (ep = 0; ep < NPORTS; ep++) {
r = offsetof(struct EP_WB, VCR0);
v = ep_read(ep, r);
printf(" %2i %i %6.6s %i %i %4i %04x%08x\n",
ep, v & 3, names[v & 3],
printf("wri%-2i %i %6.6s %i %i %4i %04x%08x\n",
ep + 1, v & 3, names[v & 3],
v & EP_VCR0_FIX_PRIO ? 1 : 0,
EP_VCR0_PRIO_VAL_R(v),
EP_VCR0_PVID_R(v),
......
......@@ -46,12 +46,12 @@
#define OPT_DEBUG 'd'
#define OPT_CLEAR 3
#define OPT_LIST 4
#define OPT_EP_PORT 10
#define OPT_EP_QMODE 11
#define OPT_EP_VID 12
#define OPT_EP_PRIO 13
#define OPT_EP_UMASK 14
#define OPT_EP_LIST 15
#define OPT_P_PORT 10
#define OPT_P_QMODE 11
#define OPT_P_VID 12
#define OPT_P_PRIO 13
#define OPT_P_UMASK 14
#define OPT_P_LIST 15
#define OPT_RTU_VID 20
#define OPT_RTU_FID 21
#define OPT_RTU_PMASK 22
......
......@@ -39,11 +39,11 @@ int halexp_lock_cmd(const char *port_name, int command, int priority)
of the reference frequency. (priority) parameter
allows to distinguish between various reference
sources and establish a switchover order. For
example when wr0, wr1, wr2 have respectively
example when wri1, wri2, wri3 have respectively
priorities (1, 0, 2), the primary clock source is
wr1. When it dies (e.g. rats ate the fiber), the
PLL will automatically switch to wr1, and if wr1
dies, to wr2. When all the ports are down, the PLL
wri2. When it dies (e.g. rats ate the fiber), the
PLL will automatically switch to wri2, and if wri2
dies, to wri3. When all the ports are down, the PLL
will switch to holdover mode. In V3, calling this
command with negative (priority) removes the port
from the locking list.
......
......@@ -92,13 +92,17 @@ static int hal_port_init(int index)
struct hal_port_state *p = &ports[index];
char name[128], s[128];
int val, error;
int port_i;
/* index is 0..17, port_i 1..18 */
port_i = index + 1;
/* make sure the states and other variables are in their init state */
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,
name, index);
name, port_i);
if (error)
return -1;
strncpy(p->name, name, 16);
......@@ -112,23 +116,26 @@ static int hal_port_init(int index)
val = 18 * 800; /* magic default from previous code */
error = libwr_cfg_convert2("PORT%02i_PARAMS", "tx", LIBWR_INT,
&val, index);
&val, port_i);
if (error)
pr_error("port index %i (%s): no \"tx=\" specified\n",
index, name);
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, index);
&val, port_i);
if (error)
pr_error("port index %i (%s): no \"rx=\" specified\n",
index, name);
pr_error("port %i (%s): no \"rx=\" specified\n",
port_i, name);
p->calib.phy_rx_min = val;
p->calib.delta_tx_board = 0; /* never set */
p->calib.delta_rx_board = 0; /* never set */
sscanf(p->name + 2, "%d", &p->hw_index);
/* get the number of a port from notation wriX */
sscanf(p->name + 3, "%d", &p->hw_index);
/* hw_index is 0..17, p->name wri1..18 */
p->hw_index--;
p->t2_phase_transition = DEFAULT_T2_PHASE_TRANS;
p->t4_phase_transition = DEFAULT_T4_PHASE_TRANS;
......@@ -148,36 +155,36 @@ static int hal_port_init(int index)
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, index);
LIBWR_STRING, s, port_i);
if (error)
pr_error("port index %i (%s): "
"no \"role=\" specified\n", index, name);
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)
pr_error("port index %i (%s): invalid role "
"\"%s\" specified\n", index, name, s);
pr_error("port %i (%s): invalid role "
"\"%s\" specified\n", port_i, name, s);
pr_debug("Port %s: mode %i\n", p->name, val);
}
/* Get fiber type */
error = libwr_cfg_convert2("PORT%02i_PARAMS", "fiber",
LIBWR_INT, &p->fiber_index, index);
LIBWR_INT, &p->fiber_index, port_i);
if (error) {
pr_error("port index %i (%s): "
pr_error("port %i (%s): "
"no \"fiber=\" specified, default fiber to 0\n",
index, name);
port_i, name);
p->fiber_index = 0;
}
if (p->fiber_index > 3) {
pr_error("port index %i (%s): "
pr_error("port %i (%s): "
"not supported \"fiber=\" value, default to 0\n",
index, name);
port_i, name);
p->fiber_index = 0;
}
......@@ -230,6 +237,7 @@ int hal_port_init_all(char *logfilename)
for (index = 0; index < HAL_MAX_PORTS; index++)
if (hal_port_init(index) < 0)
break;
hal_port_nports = index;
pr_info("Number of physical ports supported in HW: %d\n",
......
......@@ -572,8 +572,9 @@ void rtu_fd_clear_entries_for_port(int dest_port)
* including current */
pr_error("cleaning multicast entries "
"not supported yet... "
"mask=0x%x port=%d\n",
ent->port_mask_dst, dest_port);
"mask=0x%x port=%d (wri%d)\n",
ent->port_mask_dst,
dest_port + 1, dest_port + 1);
}
}
}
......
......@@ -155,7 +155,7 @@ static void rtu_update_ports_state(void)
int link_up;
/* update hal_ports_local_copy */
read_ports();
for (i = 0; i <= MAX_PORT; i++) {
for (i = 0; (i <= MAX_PORT) && (i < hal_nports_local); i++) {
if (!hal_ports_local_copy[i].in_use)
continue;
......@@ -222,8 +222,8 @@ static int rtu_daemon_learning_process(void)
err = rtu_read_learning_queue(&req);
if (!err) {
pr_debug(
"ureq: port %d src %s VID %d priority %d\n",
req.port_id,
"ureq: port %d (wri%d) src %s VID %d priority %d\n",
req.port_id + 1, req.port_id + 1,
mac_to_string(req.src),
req.has_vid ? req.vid : 0,
req.has_prio ? req.prio : 0);
......@@ -233,7 +233,7 @@ static int rtu_daemon_learning_process(void)
if (p->in_use && p->hw_index == req.port_id
&& !state_up(p->state)) {
port_down = 1;
pr_debug("port down %d\n", i);
pr_debug("port down %s\n", p->name);
break;
}
}
......
......@@ -53,7 +53,8 @@ int rtudexp_clear_entries(const struct minipc_pd *pd,
int iface_num = (int)args[0];
int *p_ret = (int *)ret; //force pointed to int type
pr_debug("Removing dynamic entries on interface %d\n", iface_num);
pr_debug("Removing dynamic entries on interface %d (wri%d)\n",
iface_num + 1, iface_num + 1);
rtu_fd_clear_entries_for_port(iface_num);
*p_ret = 0;
......@@ -80,8 +81,9 @@ int rtudexp_add_entry(const struct minipc_pd *pd, uint32_t * args, void *ret)
"%s is an invalid MAC format (XX:XX:XX:XX:XX:XX)\n",
strEHA);
pr_info("Create entry for (MAC=%s) port %x, mode:%s\n",
mac_to_string(mac_tmp), 1 << port, (mode) ? "DYNAMIC" : "STATIC");
pr_info("Create entry for (MAC=%s) port %x (wri%d), mode:%s\n",
mac_to_string(mac_tmp), 1 << port, port + 1,
(mode) ? "DYNAMIC" : "STATIC");
*p_ret =
rtu_fd_create_entry(mac_tmp, 0, 1 << port, mode, OVERRIDE_EXISTING);
return *p_ret;
......
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