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.
......
This diff is collapsed.
......@@ -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