Merge upstream main into CPU VLAN fix

This commit is contained in:
avicarmeli committed 2026-10-24 23:38:25 +03:00
commit ca2f1d101d
145 files changed
+1236 -436

No files matched your search

+25 -5
View File
@@ -5,6 +5,11 @@ on:
branches: ['**'] branches: ['**']
pull_request: pull_request:
permissions:
contents: read
pull-requests: write
issues: write
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -13,18 +18,33 @@ jobs:
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
with:
path: branch
- uses: actions/checkout@v6
with:
path: main
ref: main
- name: Install dependencies - name: Install dependencies
run: | run: |
apt update apt update
apt install make gcc sdcc xxd python-is-python3 libjson-c-dev zlib1g-dev -y apt install make gcc sdcc xxd python-is-python3 libjson-c-dev zlib1g-dev -y
- name: Run the host-side unit tests - name: Run the host-side unit tests
run: make -C test run: cd branch && make -C test
- name: Check that every machine definition can be compiled - name: Check that every machine definition can be compiled
run: make machine_check run: cd branch && make machine_check
- name: Make project (4x2/RTL8372) - name: Make project (4x2/RTL8372)
run: make CI=1 MACHINE="KP_9000_6XHML_X2" run: cd branch && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp output/KP_9000_6XHML_X2/rtlplayground.map /tmp/branch.map
- name: Make project (8x1/RTL8373) - name: Make project (8x1/RTL8373)
run: make CI=1 MACHINE="KP_9000_9XHML_X_V3_1" run: cd branch && make CI=1 MACHINE="KP_9000_9XHML_X_V3_1"
- name: Make project with the health instrumentation - name: Make project with the health instrumentation
run: make clean && make CI=1 MACHINE="KP_9000_6XHML_X2" HEALTH=1 run: cd branch && make clean && make CI=1 MACHINE="KP_9000_6XHML_X2" HEALTH=1
- name: Make main
run: cd main && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp output/KP_9000_6XHML_X2/rtlplayground.map /tmp/main.map
- name: Calculate bank growth
run: |
sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/MAIN_\1=\3/p' /tmp/main.map | sort -u >> "$GITHUB_ENV"
sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/BRANCH_\1=\3/p' /tmp/branch.map | sort -u >> "$GITHUB_ENV"
du -sb main/output/KP_9000_6XHML_X2/html_min | awk '{print "MAIN_WEB="$1}' >> "$GITHUB_ENV"
du -sb branch/output/KP_9000_6XHML_X2/html_min | awk '{print "BRANCH_WEB="$1}' >>"$GITHUB_ENV"
+3
View File
@@ -1,13 +1,16 @@
.gitignore .gitignore
.idea/ .idea/
output/ output/
output-main/
html_data.c html_data.c
html_data.h html_data.h
version.h version.h
tools/httpd_sim tools/httpd_sim
tools/injector tools/injector
tools/fileadder tools/fileadder
build/
# host-test stand-ins for the two generated headers # host-test stand-ins for the two generated headers
!test/stub/html_data.h !test/stub/html_data.h
!test/stub/version.h !test/stub/version.h
.vscode
+16
View File
@@ -25,6 +25,22 @@
## Fixed ## Fixed
- Time
- `rtl8372_init()` sets SDS 0 to SGMII as the stock firmware does. The masks were 0, so on RTL8372
boards without 10G ports both SerDes stayed off, and with SDS 0 off `RTL837X_REG_SEC_COUNTER`
does not hold a written value: NTP never retried after a failed first attempt at boot and
froze the clock after a sync.
- Web UI
- Firefox no longer fills a saved login into the new admin password fields. It also put the
user name into the NTP poll interval, which marked the Time card as edited, so it kept its
defaults (NTP off, no server, UTC-12:00) instead of the switch's settings.
- Accept firmware uploads regardless of the file part's MIME type, including
`application/macbinary` sent by Chrome on macOS for `.bin` files.
- Health
- `HEALTH=1` builds no longer write past the phase timing arrays at the LLDP checkpoint, which
corrupted the `link` slow counter and the DHCP client state. #658
- Config - Config
- A startup configuration line longer than the command buffer no longer stops the replay: - A startup configuration line longer than the command buffer no longer stops the replay:
the offending line is skipped and the following lines are still applied. the offending line is skipped and the following lines are still applied.
+35 -20
View File
@@ -15,11 +15,10 @@ SUBDIRS := tools
SUBDIRSCLEAN=$(addsuffix clean,$(SUBDIRS)) SUBDIRSCLEAN=$(addsuffix clean,$(SUBDIRS))
# $MACHINE selects machine/$(MACHINE).c as the board definition and is passed # $MACHINE selects machine/$(MACHINE).c as the board definition and is passed
# on as -DMACHINE_$(MACHINE), which the rest of the firmware tests with # on as -DMACHINE_NAME, which machine.h uses to include machine/$(MACHINE).h.
# #if defined(MACHINE_...), and as -DMACHINE_NAME, which machine.h uses to # Board selection itself needs no MACHINE_* symbol for #if chains, so the
# include machine/$(MACHINE).h. Both take the same value, so they cannot drift. # definition is all the compiler has to know.
ifneq ($(MACHINE),) ifneq ($(MACHINE),)
CC_FLAGS += -DMACHINE_$(MACHINE)
CC_FLAGS += -DMACHINE_NAME=$(MACHINE) CC_FLAGS += -DMACHINE_NAME=$(MACHINE)
endif endif
# Health instrumentation and the "health" console command: HEALTH=1 gmake ... # Health instrumentation and the "health" console command: HEALTH=1 gmake ...
@@ -34,7 +33,16 @@ endif
# The board definition being built: one file per MACHINE_* symbol in machine.h. # The board definition being built: one file per MACHINE_* symbol in machine.h.
MACHINE_SRC = machine/$(MACHINE).c MACHINE_SRC = machine/$(MACHINE).c
BUILDDIR = output/$(MACHINE) MACHINE_INIT_DEFAULT := machine/default_machine_init.c
MACHINE_INIT_SRC := $(wildcard machine/$(MACHINE)_init.c)
ifeq ($(MACHINE_INIT_SRC),)
MACHINE_INIT_SRC := $(MACHINE_INIT_DEFAULT)
endif
ifndef BUILDDIR
BUILDDIR = output/$(MACHINE)
endif
VERSION_HEADER := version.h VERSION_HEADER := version.h
GIT_VERSION := $(shell git rev-parse --short HEAD) GIT_VERSION := $(shell git rev-parse --short HEAD)
@@ -61,6 +69,9 @@ endif
# is built, including the tools/ subdirectory. # is built, including the tools/ subdirectory.
all: create_build_dir $(VERSION_HEADER) $(MACHINE_SRC) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin all: create_build_dir $(VERSION_HEADER) $(MACHINE_SRC) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin
bank_size:
tools/bank_occupancy.sh "$(MACHINE)"
create_build_dir: create_build_dir:
mkdir -p "$(BUILDDIR)" mkdir -p "$(BUILDDIR)"
mkdir -p "$(BUILDDIR)/uip" mkdir -p "$(BUILDDIR)/uip"
@@ -81,7 +92,7 @@ $(MACHINE_SRC):
# invalid $MACHINE value # invalid $MACHINE value
SRCS = \ SRCS = \
$(MACHINE_SRC) \ $(MACHINE_SRC) \
machine_init.c \ $(MACHINE_INIT_SRC) \
cmd_editor.c \ cmd_editor.c \
cmd_parser.c \ cmd_parser.c \
dhcp.c \ dhcp.c \
@@ -133,7 +144,7 @@ HTML := $(shell find html -name '*.js' -or -name '*.html' -or -name '*.svg' -or
# Minified copy of the web UI sources, used as the fileadder input. # Minified copy of the web UI sources, used as the fileadder input.
# The raw html/ sources stay untouched for development; the minified # The raw html/ sources stay untouched for development; the minified
# copy is a build artifact under output/. # copy is a build artifact under output/.
HTML_MIN := output/html_min HTML_MIN := $(BUILDDIR)/html_min
.PHONY: html_min .PHONY: html_min
html_min: $(HTML) html_min: $(HTML)
rm -rf $(HTML_MIN) rm -rf $(HTML_MIN)
@@ -141,7 +152,7 @@ html_min: $(HTML)
@for f in $(HTML); do python3 tools/minify.py $$f $(HTML_MIN)/$$(basename $$f) || exit 1; done @for f in $(HTML); do python3 tools/minify.py $$f $(HTML_MIN)/$$(basename $$f) || exit 1; done
html_data.c html_data.h &: $(HTML) | tools html_min html_data.c html_data.h &: $(HTML) | tools html_min
tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -z -d $(HTML_MIN) -p html_data tools/$(BUILDDIR)/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -z -d $(HTML_MIN) -p html_data
$(VERSION_HEADER): FORCE $(VERSION_HEADER): FORCE
@printf '%s\n' "#ifndef VERSION_H" "#define VERSION_H" \ @printf '%s\n' "#ifndef VERSION_H" "#define VERSION_H" \
@@ -155,7 +166,7 @@ $(VERSION_HEADER): FORCE
httpd: html_data.h httpd: html_data.h
$(SUBDIRS): $(SUBDIRS):
$(MAKE) -C $@ $(MAKE) -C $@ BUILDDIR=$(BUILDDIR)
clean: $(SUBDIRSCLEAN) clean: $(SUBDIRSCLEAN)
-rm -f html_data.c html_data.h $(VERSION_HEADER) -rm -f html_data.c html_data.h $(VERSION_HEADER)
@@ -193,31 +204,35 @@ $(BUILDDIR)/rtlplayground.img: $(BUILDDIR)/rtlplayground.ihx
$(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.img | tools $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.img | tools
if [ -e $@ ]; then rm $@; fi if [ -e $@ ]; then rm $@; fi
tools/output/imagebuilder -i $^ $@ tools/$(BUILDDIR)/imagebuilder -i $^ $@
tools/output/fileadder -a $(DEFAULT_CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@ tools/$(BUILDDIR)/fileadder -a $(DEFAULT_CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
tools/output/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@ tools/$(BUILDDIR)/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -z -d $(HTML_MIN) -b BANK1 $@ tools/$(BUILDDIR)/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -z -d $(HTML_MIN) -b BANK1 $@
tools/output/crc_calculator -u $@ tools/$(BUILDDIR)/crc_calculator -u $@
ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin output/rtlplayground.bin ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin $(BUILDDIR)/../rtlplayground.bin
.PHONY: clean distclean all $(SUBDIRS) $(SUBDIRSCLEAN) create_build_dir .PHONY: clean distclean all $(SUBDIRS) $(SUBDIRSCLEAN) create_build_dir
# Every machine/ definition is compiled, so a machine added to machine/ is # Every machine/ definition is compiled, so a machine added to machine/ is
# covered without registering it anywhere. The machine-specific defines are # covered without registering it anywhere. The _init.c files are excluded here:
# they are the boot hooks, compiled separately below (the board's own if it
# exists, otherwise default_machine_init.c). The machine-specific defines are
# filtered out of $(CC_FLAGS) and supplied per iteration instead, so this also # filtered out of $(CC_FLAGS) and supplied per iteration instead, so this also
# works as "make machine_check MACHINE=...". # works as "make machine_check MACHINE=...".
MACHINE_DEFS := $(sort $(patsubst machine/%.c,%,$(wildcard machine/*.c))) MACHINE_DEFS := $(sort $(patsubst machine/%.c,%,$(filter-out machine/%_init.c,$(wildcard machine/*.c))))
MACHINE_LESS_CC_FLAGS = $(filter-out -DMACHINE_%,$(CC_FLAGS)) MACHINE_LESS_CC_FLAGS = $(filter-out -DMACHINE_%,$(CC_FLAGS))
.PHONY: .PHONY: machine_check
machine_check: machine_check:
@mkdir -p $(BUILDDIR)/tmp @mkdir -p $(BUILDDIR)/tmp
@set -eo pipefail; \ @set -eo pipefail; \
for MACHINE in $(MACHINE_DEFS); \ for MACHINE in $(MACHINE_DEFS); \
do \ do \
echo "Checking $${MACHINE}"; \ echo "Checking $${MACHINE}"; \
$(CC) $(MACHINE_LESS_CC_FLAGS) -DMACHINE_$${MACHINE} -DMACHINE_NAME=$${MACHINE} -MMD -o $(BUILDDIR)/tmp/machine_check -c machine/$${MACHINE}.c; \ $(CC) $(MACHINE_LESS_CC_FLAGS) -DMACHINE_NAME=$${MACHINE} -MMD -o $(BUILDDIR)/tmp/machine_check -c machine/$${MACHINE}.c; \
$(CC) $(MACHINE_LESS_CC_FLAGS) -DMACHINE_$${MACHINE} -DMACHINE_NAME=$${MACHINE} -MMD -o $(BUILDDIR)/tmp/machine_check -c machine_init.c; \ INIT=machine/$${MACHINE}_init.c; \
if [ ! -e $$INIT ] && [ ! -L $$INIT ]; then INIT=$(MACHINE_INIT_DEFAULT); fi; \
$(CC) $(MACHINE_LESS_CC_FLAGS) -DMACHINE_NAME=$${MACHINE} -MMD -o $(BUILDDIR)/tmp/machine_check -c $$INIT; \
done done
@rm -rf $(BUILDDIR)/tmp @rm -rf $(BUILDDIR)/tmp
+15 -12
View File
@@ -125,18 +125,6 @@ void early_boot_handle_button(void) __banked
void sds_config(uint8_t sds, uint8_t mode) __banked void sds_config(uint8_t sds, uint8_t mode) __banked
{ {
print_string("sds_config sds: "); print_byte(sds); print_string(", mode: "); print_byte(mode); write_char('\n'); print_string("sds_config sds: "); print_byte(sds); print_string(", mode: "); print_byte(mode); write_char('\n');
sds_config_mac(sds, mode);
if (mode == SDS_10GR || mode == SDS_QXGMII)
sds_write_v(sds, 0x21, 0x10, 0x4480); // Q002110:6480
else
sds_write_v(sds, 0x21, 0x10, 0x6480); // Q002110:6480
sds_write_v(sds, 0x21, 0x13, 0x0400); // Q002113:0400
sds_write_v(sds, 0x21, 0x18, 0x6d02); // Q002118:6d02
sds_write_v(sds, 0x21, 0x1b, 0x424e); // Q00211b:424e
sds_write_v(sds, 0x21, 0x1d, 0x0002); // Q00211d:0002
sds_write_v(sds, 0x36, 0x1c, 0x1390); // Q00361c:1390
sds_write_v(sds, 0x36, 0x14, 0x003f); // Q003614:003f
uint8_t page = 0; uint8_t page = 0;
uint16_t v = 0; uint16_t v = 0;
@@ -165,6 +153,21 @@ void sds_config(uint8_t sds, uint8_t mode) __banked
print_string("Error in SDS Mode\n"); print_string("Error in SDS Mode\n");
return; return;
} }
sds_config_mac(sds, mode);
if (mode == SDS_10GR || mode == SDS_QXGMII)
sds_write_v(sds, 0x21, 0x10, 0x4480); // Q002110:6480
else
sds_write_v(sds, 0x21, 0x10, 0x6480); // Q002110:6480
sds_write_v(sds, 0x21, 0x13, 0x0400); // Q002113:0400
sds_write_v(sds, 0x21, 0x18, 0x6d02); // Q002118:6d02
sds_write_v(sds, 0x21, 0x1b, 0x424e); // Q00211b:424e
sds_write_v(sds, 0x21, 0x1d, 0x0002); // Q00211d:0002
sds_write_v(sds, 0x36, 0x1c, 0x1390); // Q00361c:1390
sds_write_v(sds, 0x36, 0x14, 0x003f); // Q003614:003f
sds_write_v(sds, 0x36, 0x10, v); // Q003610:0200 sds_write_v(sds, 0x36, 0x10, v); // Q003610:0200
if (page == 0x2e) { // 10G Fiber / SDS_QXGMII if (page == 0x2e) { // 10G Fiber / SDS_QXGMII
+6 -5
View File
@@ -266,7 +266,7 @@ uint8_t cmd_parse_port(uint8_t idx) {
return 0; return 0;
port = machine.phys_to_log_port[port]; port = machine.phys_to_log_port[port];
if (port < machine.min_port || port > machine.max_port) if (!MACHINE_PORT_VALID(port))
return 0; return 0;
atoi_results_u8 = port; atoi_results_u8 = port;
@@ -743,7 +743,7 @@ void parse_isolate(void)
} }
if (cmd_compare(2, "off")) { if (cmd_compare(2, "off")) {
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) for (uint8_t i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++)
members |= ((uint16_t)1) << i; members |= ((uint16_t)1) << i;
members |= PMASK_CPU; // CPU-port members |= PMASK_CPU; // CPU-port
port_isolate(port_configured, members); port_isolate(port_configured, members);
@@ -797,7 +797,7 @@ void parse_ingress(void)
if (!cmd_is_space_or_nul(idx)) if (!cmd_is_space_or_nul(idx))
goto err; goto err;
// Setting mode for all ports at once // Setting mode for all ports at once
for (log_port = machine.min_port; log_port <= machine.max_port; log_port++) { for (log_port = MACHINE_MIN_PORT; log_port <= MACHINE_MAX_PORT; log_port++) {
if (!port_ingress_filter(log_port, mode)) { if (!port_ingress_filter(log_port, mode)) {
cmd_error("cannot set the ingress filter for port "); print_phys_port(log_port); write_char('\n'); cmd_error("cannot set the ingress filter for port "); print_phys_port(log_port); write_char('\n');
return; return;
@@ -849,7 +849,7 @@ void parse_mirror(void)
print_string("NOT Enabled: "); print_string("NOT Enabled: ");
} }
print_string("Mirroring port: "); print_string("Mirroring port: ");
print_phys_port(mirroring_port); print_phys_port(mPort >> 1);
reg_read_m(RTL837x_MIRROR_CONF); reg_read_m(RTL837x_MIRROR_CONF);
uint16_t m = sfr_data[0]; uint16_t m = sfr_data[0];
m = (m << 8) | sfr_data[1]; m = (m << 8) | sfr_data[1];
@@ -1019,7 +1019,7 @@ void parse_mtu(void)
uint8_t p; uint8_t p;
if (cmd_compare(1, "show")) { if (cmd_compare(1, "show")) {
for (p = machine.min_port; p <= machine.max_port; p++) { for (p = MACHINE_MIN_PORT; p <= MACHINE_MAX_PORT; p++) {
reg_read_m(RTL8373_REG_MAC_L2_PORT_MAX_LEN + ((uint16_t) p << 8)); reg_read_m(RTL8373_REG_MAC_L2_PORT_MAX_LEN + ((uint16_t) p << 8));
uint16_t mtu = SFR_DATA_U16 & 0x3fff; uint16_t mtu = SFR_DATA_U16 & 0x3fff;
print_string("Port "); print_phys_port(p); print_string("Port "); print_phys_port(p);
@@ -2329,6 +2329,7 @@ void health_show(void) __banked
ph_line("tx ", HEALTH_PH_TX); ph_line("tx ", HEALTH_PH_TX);
ph_line("stp ", HEALTH_PH_STP); ph_line("stp ", HEALTH_PH_STP);
ph_line("cmd ", HEALTH_PH_CMD); ph_line("cmd ", HEALTH_PH_CMD);
ph_line("lldp", HEALTH_PH_LLDP);
/* Stack: current depth plus how much of the painted area is untouched */ /* Stack: current depth plus how much of the painted area is untouched */
print_string("sp "); print_string("sp ");
+2 -2
View File
@@ -19,8 +19,8 @@ extern __xdata uint8_t err_status;
#define HEALTH_PH_TX 3 #define HEALTH_PH_TX 3
#define HEALTH_PH_STP 4 #define HEALTH_PH_STP 4
#define HEALTH_PH_CMD 5 #define HEALTH_PH_CMD 5
#define HEALTH_PHASES 6 #define HEALTH_PH_LLDP 6
#define HEALTH_LLDP 7 #define HEALTH_PHASES (HEALTH_PH_LLDP + 1) /* last id + 1: sizes the arrays in cmd_parser.c */
extern __xdata uint16_t health_rx_frames; extern __xdata uint16_t health_rx_frames;
#define health_rx_frame() health_rx_frames++ #define health_rx_frame() health_rx_frames++
+39 -15
View File
@@ -1,6 +1,6 @@
# Adding a new device # Adding a new device
A device is supported by adding one board definition `.h` and board configuration `.c` file A device is supported by adding one board header `.h` and board definition `.c` file
under `machine/`. under `machine/`.
the build selects the definition by name, and CI compiles every file it finds. the build selects the definition by name, and CI compiles every file it finds.
@@ -14,27 +14,35 @@ make MACHINE=<NAME>
| File | Purpose | | File | Purpose |
|------|---------| |------|---------|
| `machine/<NAME>.c` | the `struct machine machine` board definition | | `machine/<NAME>.c` | the `struct machine machine` board definition |
| `machine/<NAME>.h` | `MACHINE_MODEL`, the model string shown in the UI and the CLI | | `machine/<NAME>.h` | `MACHINE_MODEL` (the model string shown in the UI and the CLI) and `MACHINE_CHIPSET` (`RTL8372` or `RTL8373`) |
| `machine/<NAME>_init.c` | optional `machine_custom_init()` boot hook, for registers the machine definition cannot express |
| `doc/devices/<name>.md` + `doc/supported_devices.md` | (only if the board is verified and you want to support it publicly) user-facing documentation | | `doc/devices/<name>.md` + `doc/supported_devices.md` | (only if the board is verified and you want to support it publicly) user-facing documentation |
`<NAME>` is the machine symbol without its `MACHINE_` prefix, so `MACHINE` is `<NAME>` is the machine symbol without its `MACHINE_` prefix, so `MACHINE` is
passed exactly as spelled on the command line: `make MACHINE=MY_BOARD_1_0` passed exactly as spelled on the command line: `make MACHINE=MY_BOARD_1_0`
needs `machine/MY_BOARD_1_0.c` and `machine/MY_BOARD_1_0.h`. needs `machine/MY_BOARD_1_0.c` and `machine/MY_BOARD_1_0.h`.
## Step 1: the model header ## Step 1: the board header
`machine/<NAME>.h` only carries the product string. Use the existing files as `machine/<NAME>.h` carries the product string and the SoC family. Use the
the template: existing files as the template:
```c ```c
#ifndef _MACHINE_MY_BOARD_1_0_H_ #ifndef _MACHINE_MY_BOARD_1_0_H_
#define _MACHINE_MY_BOARD_1_0_H_ #define _MACHINE_MY_BOARD_1_0_H_
#define MACHINE_MODEL "Brand Model V1.0" #define MACHINE_MODEL "Brand Model V1.0"
#define MACHINE_CHIPSET RTL8373
#endif #endif
``` ```
`MACHINE_CHIPSET` is `RTL8373` or `RTL8372`; a build without it will fail. It selects the default
logical port range: `MACHINE_MIN_PORT` is `0` for RTL8373 and `3` for RTL8372, while
`MACHINE_MAX_PORT` is `8`, the highest logical port index. A board with a different range defines
`MACHINE_MIN_PORT` and/or `MACHINE_MAX_PORT` in its header to override the
defaults.
The device product string is what the CLI or the Web-Interface will print to identify the device; `machine.h` includes it by name. The device product string is what the CLI or the Web-Interface will print to identify the device; `machine.h` includes it by name.
> [!NOTE] > [!NOTE]
@@ -55,10 +63,7 @@ ports and the same number of SFP+ cages.
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
@@ -89,13 +94,16 @@ __code const struct machine machine = {
}; };
``` ```
`MACHINE_COMMON_SETTING` (from `machine_defs.h`) initializes `machine_name` and
`isRTL8373` from the header's `MACHINE_MODEL` and `MACHINE_CHIPSET`. The logical
port range comes from `MACHINE_MIN_PORT` and `MACHINE_MAX_PORT` in `machine.h`.
Keep it as the first initializer and list the board-specific fields after it.
### Fields ### Fields
| Field | Meaning | | Field | Meaning |
|-------|---------| |-------|---------|
| `machine_name` | always `MACHINE_MODEL` | | `MACHINE_COMMON_SETTING` | expands to `machine_name` (`MACHINE_MODEL`) and `isRTL8373` (`1` for `RTL8373`, `0` for `RTL8372`); both are derived from the header's `MACHINE_CHIPSET` (see Step 1) |
| `isRTL8373` | `1` for an RTL8373 SoC, `0` for RTL8372 |
| `min_port` / `max_port` | range of logical port numbers the device has; `min_port` is `0` for RTL8373 boards and `3` for RTL8372 boards (logical ports 1–2 are the SoC's internal ports on the 8372), `max_port` is usually 8. |
| `n_sfp` | number of SFP+ cages | | `n_sfp` | number of SFP+ cages |
| `n_10g` | SerDes 10G capability used by the RTL837xN init: `0` none, `1` one, `2` two 10G-capable SerDes | | `n_10g` | SerDes 10G capability used by the RTL837xN init: `0` none, `1` one, `2` two 10G-capable SerDes |
| `log_to_phys_port[9]` | logical port (0-based index) → physical front-panel port number | | `log_to_phys_port[9]` | logical port (0-based index) → physical front-panel port number |
@@ -130,14 +138,30 @@ apart:
ln -s KP_9000_6XHML_X2.c machine/MY_BOARD_1_0.c ln -s KP_9000_6XHML_X2.c machine/MY_BOARD_1_0.c
``` ```
The new board still needs `machine/MY_BOARD_1_0.h` (pick the version number on the PCB) with its own The new board still needs `machine/MY_BOARD_1_0.h` (pick the version number on
`MACHINE_MODEL`, because `MACHINE_MODEL` is what distinguishes the products. the PCB) with its own `MACHINE_MODEL` and `MACHINE_CHIPSET`: `MACHINE_MODEL` is
what distinguishes the products, and `MACHINE_CHIPSET` must match the SoC of
the board definition being reused.
Existing examples: `machine/PCB_K0402WS_V3.c`, `machine/KP_9000_9XHML_X_V3_2.c` Existing examples: `machine/PCB_K0402WS_V3.c`, `machine/KP_9000_9XHML_X_V3_2.c`
and the six `KP_9000_*` revision variants. and the six `KP_9000_*` revision variants.
Two files that differ only in whitespace or comments are duplicates and should Two files that differ only in whitespace or comments are duplicates and should
be collapsed this way. be collapsed this way.
### Optional custom init hook
If the board needs custom initialization, add
`machine/<NAME>_init.c` defining `machine_custom_init()`. The Makefile picks the
file up by name and compiles it.
Boards that need the same hook share one file: keep the code in a single
`machine/<NAME>_init.c` whose `machine/<NAME>.c` is a real file (not a symlink),
and make the other boards' `_init.c` symlinks to it, for example:
```
ln -s KP_9000_6XH_X2_init.c machine/MY_BOARD_1_0_init.c
```
## Step 3: build and verify ## Step 3: build and verify
``` ```
@@ -151,7 +175,7 @@ file, before anything is compiled.
Then run the checks CI runs: Then run the checks CI runs:
``` ```
make machine_check # compiles machine/<NAME>.c and machine_init.c for every machine make machine_check # compiles machine/<NAME>.c and its optional _init.c for every machine
make -C test # host-side unit tests make -C test # host-side unit tests
``` ```
+2
View File
@@ -1,11 +1,13 @@
# MokerLink POE-2G080110GS # MokerLink POE-2G080110GS
The `POE-2G080110GS` is an unmanaged 8x2.5G RJ45 and 1xSFP+ PoE switch sold by Mokerlink. There is also a `POE-2G080110GSM` managed version of the switch which may be similar but this has not been verified on actual hardware. The `POE-2G080110GS` is an unmanaged 8x2.5G RJ45 and 1xSFP+ PoE switch sold by Mokerlink. There is also a `POE-2G080110GSM` managed version of the switch which may be similar but this has not been verified on actual hardware.
The`KP-9000-9XHP-X` is the KeepLink rebrand for same product.
## Brands ## Brands
| Brand | Type |Managed| PCB | Flash | Chip RTL | | Brand | Type |Managed| PCB | Flash | Chip RTL |
|--------|------------------|-------|------------------|-----------------|---------------| |--------|------------------|-------|------------------|-----------------|---------------|
| Mokerlink | POE-2G080110GS | No | 2M-PCB51-ML-V1.1 | 4MB (W25Q32JV) | 8373N + 8224N | | Mokerlink | POE-2G080110GS | No | 2M-PCB51-ML-V1.1 | 4MB (W25Q32JV) | 8373N + 8224N |
| KeepLink | KP-9000-9XHP-X | No | 2M-PCB51-ML-V1.1 | 4MB (W25Q32JV) | 8373N + 8224N |
## Hardware overview ## Hardware overview
Front Front
+2 -1
View File
@@ -14,6 +14,7 @@ rx max 00 slow 0x0000
tx max 00 slow 0x0000 tx max 00 slow 0x0000
stp max 04 slow 0x0001 stp max 04 slow 0x0001
cmd max 02 slow 0x0001 cmd max 02 slow 0x0001
lldp max 00 slow 0x0000
sp 80 untouched 62 sp 80 untouched 62
tcp st 00 tmr 00 rtx 00 rto 00 len 0x0000 mss 0x05b4 tcp st 00 tmr 00 rtx 00 rto 00 len 0x0000 mss 0x05b4
lport 0x0000 rport 0x0000 rip 0x0000 0x0000 lport 0x0000 rport 0x0000 rip 0x0000 0x0000
@@ -46,7 +47,7 @@ a flooded CPU port from a stalled loop, which look identical from outside.
## Phases ## Phases
Each line is one section of the main loop: the link poll, SFP handling, Each line is one section of the main loop: the link poll, SFP handling,
frame reception, TCP transmission, the STP timers and the command dispatch. frame reception, TCP transmission, the STP timers, the LLDP timer and the command dispatch.
`max` is the worst time that section has taken, in ticks of 5 ms; `slow` `max` is the worst time that section has taken, in ticks of 5 ms; `slow`
counts the passes that took two ticks or more. A misbehaving subsystem counts the passes that took two ticks or more. A misbehaving subsystem
names itself here, which is the difference between knowing that the loop is names itself here, which is the difference between knowing that the loop is
+1
View File
@@ -29,6 +29,7 @@ The following devices have been tested and are fully working:
| keepLINK | KP-9000-9XHML-X | Yes | [2M-PCB23-V2.2](devices/2M-PCB23-V2_2.md) | 2M | 8 + 1 | | keepLINK | KP-9000-9XHML-X | Yes | [2M-PCB23-V2.2](devices/2M-PCB23-V2_2.md) | 2M | 8 + 1 |
| keepLINK | KP-9000-9XHML-X | Yes | [2M-PCB23-V3.1](devices/2M-PCB23-V3_1.md) | 2M | 8 + 1 | | keepLINK | KP-9000-9XHML-X | Yes | [2M-PCB23-V3.1](devices/2M-PCB23-V3_1.md) | 2M | 8 + 1 |
| keepLINK | KP-9000-9XHML-X | Yes | [2M-PCB23-V3.2](devices/2M-PCB23-V3_2.md) | 2M | 8 + 1 | | keepLINK | KP-9000-9XHML-X | Yes | [2M-PCB23-V3.2](devices/2M-PCB23-V3_2.md) | 2M | 8 + 1 |
| keepLINK | KP-9000-9XHP-X | No | [2M-PCB51-ML-V1.1](devices/2M-PCB51-ML-V1_1.md) | 4M | 8 + 1 |
| LIANGUO | HYWS-SGT0108S | No | [2G5F_20G_V1.01](devices/HYWS-SGT0108S.md) | 0.5M | 8 + 1 | | LIANGUO | HYWS-SGT0108S | No | [2G5F_20G_V1.01](devices/HYWS-SGT0108S.md) | 0.5M | 8 + 1 |
| LIANGUO | SWTG024AS | No | [SWTG024AS-v2.0-17452](devices/SWTG024AS.md) | 0.5M | 4 + 2 | | LIANGUO | SWTG024AS | No | [SWTG024AS-v2.0-17452](devices/SWTG024AS.md) | 0.5M | 4 + 2 |
| LIANGUO | ZX-SWTGW215AS | Yes | [PCB-SWTG115AS-V2.0 / PCB-SWTG115AS-V2.1](devices/SWTGW215AS.md) | 2M | 5 + 1 | | LIANGUO | ZX-SWTGW215AS | Yes | [PCB-SWTG115AS-V2.0 / PCB-SWTG115AS-V2.1](devices/SWTGW215AS.md) | 2M | 5 + 1 |
+15 -11
View File
@@ -16,7 +16,7 @@ d_system:"System",d_traffic:"Traffic",
d_traffic_h:"packets/s, live",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX bad",d_rxbad:"RX bad", d_traffic_h:"packets/s, live",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX bad",d_rxbad:"RX bad",
i_host:"Hostname",i_ip:"IP address",i_mask:"Netmask",i_gw:"Gateway",i_mac:"MAC",i_fw:"Firmware", i_host:"Hostname",i_ip:"IP address",i_mask:"Netmask",i_gw:"Gateway",i_mac:"MAC",i_fw:"Firmware",
i_built:"Built",i_hw:"Hardware",i_temp:"Temperature",i_flash:"Flash",i_syslog:"Syslog", i_built:"Built",i_hw:"Hardware",i_temp:"Temperature",i_flash:"Flash",i_syslog:"Syslog",
p_state:"State",p_disabled:"disabled",p_up:"up",p_txgb:"TX good / bad",p_rxgb:"RX good / bad", p_state:"State",p_disabled:"disabled",p_up:"up",
p_pkts:"pkts",p_module:"Module",p_temp:"Temperature",p_vcc:"Vcc",p_txbias:"TX bias",p_txpower:"TX power", p_pkts:"pkts",p_module:"Module",p_temp:"Temperature",p_vcc:"Vcc",p_txbias:"TX bias",p_txpower:"TX power",
p_rxpower:"RX power",p_txfault:"TX fault",p_txdis:"TX disabled",p_rxlos:"RX LOS",p_adv:"Advertising", p_rxpower:"RX power",p_txfault:"TX fault",p_txdis:"TX disabled",p_rxlos:"RX LOS",p_adv:"Advertising",
pt_title:"Port configuration",pt_conn:"Devices learned",pt_speed:"Speed",pt_mtu:"MTU", pt_title:"Port configuration",pt_conn:"Devices learned",pt_speed:"Speed",pt_mtu:"MTU",
@@ -147,7 +147,7 @@ d_system:"システム",d_traffic:"トラフィック",
d_traffic_h:"パケット/秒、リアルタイム",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX 異常",d_rxbad:"RX 異常", d_traffic_h:"パケット/秒、リアルタイム",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX 異常",d_rxbad:"RX 異常",
i_host:"ホスト名",i_ip:"IP アドレス",i_mask:"ネットマスク",i_gw:"ゲートウェイ",i_mac:"MAC",i_fw:"ファームウェア", i_host:"ホスト名",i_ip:"IP アドレス",i_mask:"ネットマスク",i_gw:"ゲートウェイ",i_mac:"MAC",i_fw:"ファームウェア",
i_built:"ビルド日",i_hw:"ハードウェア",i_temp:"温度",i_flash:"フラッシュ",i_syslog:"Syslog", i_built:"ビルド日",i_hw:"ハードウェア",i_temp:"温度",i_flash:"フラッシュ",i_syslog:"Syslog",
p_state:"状態",p_disabled:"無効",p_up:"アップ",p_txgb:"TX 正常 / 異常",p_rxgb:"RX 正常 / 異常", p_state:"状態",p_disabled:"無効",p_up:"アップ",
p_pkts:"pkts",p_module:"モジュール",p_temp:"温度",p_vcc:"電圧",p_txbias:"TX バイアス",p_txpower:"TX 電力", p_pkts:"pkts",p_module:"モジュール",p_temp:"温度",p_vcc:"電圧",p_txbias:"TX バイアス",p_txpower:"TX 電力",
p_rxpower:"RX 電力",p_txfault:"TX 障害",p_txdis:"TX 無効",p_rxlos:"RX 信号ロス",p_adv:"アドバタイズ", p_rxpower:"RX 電力",p_txfault:"TX 障害",p_txdis:"TX 無効",p_rxlos:"RX 信号ロス",p_adv:"アドバタイズ",
pt_title:"ポート設定",pt_conn:"学習済みデバイス",pt_speed:"速度",pt_mtu:"MTU", pt_title:"ポート設定",pt_conn:"学習済みデバイス",pt_speed:"速度",pt_mtu:"MTU",
@@ -260,7 +260,7 @@ d_system:"系统",d_traffic:"流量",
d_traffic_h:"包/秒,实时",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX 错误",d_rxbad:"RX 错误", d_traffic_h:"包/秒,实时",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX 错误",d_rxbad:"RX 错误",
i_host:"主机名",i_ip:"IP 地址",i_mask:"子网掩码",i_gw:"网关",i_mac:"MAC",i_fw:"固件", i_host:"主机名",i_ip:"IP 地址",i_mask:"子网掩码",i_gw:"网关",i_mac:"MAC",i_fw:"固件",
i_built:"构建日期",i_hw:"硬件",i_temp:"温度",i_flash:"Flash",i_syslog:"Syslog", i_built:"构建日期",i_hw:"硬件",i_temp:"温度",i_flash:"Flash",i_syslog:"Syslog",
p_state:"状态",p_disabled:"已禁用",p_up:"已连接",p_txgb:"TX 正常 / 错误",p_rxgb:"RX 正常 / 错误", p_state:"状态",p_disabled:"已禁用",p_up:"已连接",
p_pkts:"个包",p_module:"模块",p_temp:"温度",p_vcc:"供电电压",p_txbias:"TX 偏置电流",p_txpower:"TX 光功率", p_pkts:"个包",p_module:"模块",p_temp:"温度",p_vcc:"供电电压",p_txbias:"TX 偏置电流",p_txpower:"TX 光功率",
p_rxpower:"RX 光功率",p_txfault:"TX 故障",p_txdis:"TX 禁用",p_rxlos:"RX 信号丢失",p_adv:"通告能力", p_rxpower:"RX 光功率",p_txfault:"TX 故障",p_txdis:"TX 禁用",p_rxlos:"RX 信号丢失",p_adv:"通告能力",
pt_title:"端口配置",pt_conn:"已学习设备",pt_speed:"速率",pt_mtu:"MTU", pt_title:"端口配置",pt_conn:"已学习设备",pt_speed:"速率",pt_mtu:"MTU",
@@ -373,7 +373,7 @@ d_system:"Sistema",d_traffic:"Tráfico",
d_traffic_h:"paquetes/s, en vivo",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX erróneos",d_rxbad:"RX erróneos", d_traffic_h:"paquetes/s, en vivo",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX erróneos",d_rxbad:"RX erróneos",
i_host:"Nombre de host",i_ip:"Dirección IP",i_mask:"Máscara de red",i_gw:"Puerta de enlace",i_mac:"MAC",i_fw:"Firmware", i_host:"Nombre de host",i_ip:"Dirección IP",i_mask:"Máscara de red",i_gw:"Puerta de enlace",i_mac:"MAC",i_fw:"Firmware",
i_built:"Compilado",i_hw:"Hardware",i_flash:"Flash",i_syslog:"Syslog", i_built:"Compilado",i_hw:"Hardware",i_flash:"Flash",i_syslog:"Syslog",
p_state:"Estado",p_disabled:"deshabilitado",p_up:"activo",p_txgb:"TX correctos / erróneos",p_rxgb:"RX correctos / erróneos", p_state:"Estado",p_disabled:"deshabilitado",p_up:"activo",
p_pkts:"paquetes",p_module:"Módulo",p_temp:"Temperatura",p_vcc:"Vcc",p_txbias:"Polarización TX",p_txpower:"Potencia TX", p_pkts:"paquetes",p_module:"Módulo",p_temp:"Temperatura",p_vcc:"Vcc",p_txbias:"Polarización TX",p_txpower:"Potencia TX",
p_rxpower:"Potencia RX",p_txfault:"Fallo TX",p_txdis:"TX deshabilitado",p_rxlos:"Pérdida RX (LOS)",p_adv:"Anunciado", p_rxpower:"Potencia RX",p_txfault:"Fallo TX",p_txdis:"TX deshabilitado",p_rxlos:"Pérdida RX (LOS)",p_adv:"Anunciado",
pt_title:"Configuración de puerto",pt_conn:"Dispositivos aprendidos",pt_speed:"Velocidad",pt_mtu:"MTU", pt_title:"Configuración de puerto",pt_conn:"Dispositivos aprendidos",pt_speed:"Velocidad",pt_mtu:"MTU",
@@ -485,7 +485,7 @@ d_system:"Système",d_traffic:"Trafic",
d_traffic_h:"paquets/s (en direct)",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX KO",d_rxbad:"RX KO", d_traffic_h:"paquets/s (en direct)",d_txpps:"TX pps",d_rxpps:"RX pps",d_txbad:"TX KO",d_rxbad:"RX KO",
i_host:"Nom d'hote",i_ip:"Adresse IP",i_mask:"Masque réseau",i_gw:"Passerelle",i_mac:"Adresse MAC",i_fw:"Micro logiciel", i_host:"Nom d'hote",i_ip:"Adresse IP",i_mask:"Masque réseau",i_gw:"Passerelle",i_mac:"Adresse MAC",i_fw:"Micro logiciel",
i_built:"Compilé le",i_hw:"Matériel",i_temp:"Température",i_flash:"Taille Flash",i_syslog:"Journal système", i_built:"Compilé le",i_hw:"Matériel",i_temp:"Température",i_flash:"Taille Flash",i_syslog:"Journal système",
p_state:"Etat",p_disabled:"Inactif",p_up:"Actif",p_txgb:"TX bon / mauvais",p_rxgb:"RX bon / mauvais", p_state:"Etat",p_disabled:"Inactif",p_up:"Actif",
p_pkts:"paquets",p_module:"Module",p_temp:"Température",p_vcc:"Vcc",p_txbias:"TX biais",p_txpower:"TX puissance", p_pkts:"paquets",p_module:"Module",p_temp:"Température",p_vcc:"Vcc",p_txbias:"TX biais",p_txpower:"TX puissance",
p_rxpower:"RX puissance",p_txfault:"TX erreur",p_txdis:"TX désactivé",p_rxlos:"RX pertes de signaux",p_adv:"Capacités", p_rxpower:"RX puissance",p_txfault:"TX erreur",p_txdis:"TX désactivé",p_rxlos:"RX pertes de signaux",p_adv:"Capacités",
pt_title:"Configuration du port",pt_conn:"Appareils appris",pt_speed:"Vitesse",pt_mtu:"MTU", pt_title:"Configuration du port",pt_conn:"Appareils appris",pt_speed:"Vitesse",pt_mtu:"MTU",
@@ -602,7 +602,7 @@ d_system:"System",d_traffic:"Datenverkehr",
d_traffic_h:"Pakete/s, live",d_txpps:"TX Pakete/s",d_rxpps:"RX Pakete/s",d_txbad:"TX fehlerhaft",d_rxbad:"RX fehlerhaft", d_traffic_h:"Pakete/s, live",d_txpps:"TX Pakete/s",d_rxpps:"RX Pakete/s",d_txbad:"TX fehlerhaft",d_rxbad:"RX fehlerhaft",
i_host:"Hostname",i_ip:"IP-Adresse",i_mask:"Netzmaske",i_gw:"Gateway",i_mac:"MAC",i_fw:"Firmware", i_host:"Hostname",i_ip:"IP-Adresse",i_mask:"Netzmaske",i_gw:"Gateway",i_mac:"MAC",i_fw:"Firmware",
i_built:"Erstellt",i_hw:"Hardware",i_temp:"Temperatur",i_flash:"Flash",i_syslog:"Syslog", i_built:"Erstellt",i_hw:"Hardware",i_temp:"Temperatur",i_flash:"Flash",i_syslog:"Syslog",
p_state:"Zustand",p_disabled:"deaktiviert",p_up:"verbunden",p_txgb:"TX gut / fehlerhaft",p_rxgb:"RX gut / fehlerhaft", p_state:"Zustand",p_disabled:"deaktiviert",p_up:"verbunden",
p_pkts:"Pakete",p_module:"Modul",p_temp:"Temperatur",p_vcc:"Vcc",p_txbias:"TX-Bias",p_txpower:"Sendeleistung", p_pkts:"Pakete",p_module:"Modul",p_temp:"Temperatur",p_vcc:"Vcc",p_txbias:"TX-Bias",p_txpower:"Sendeleistung",
p_rxpower:"Empfangsleistung",p_txfault:"TX-Fehler",p_txdis:"TX deaktiviert",p_rxlos:"RX LOS",p_adv:"Angeboten", p_rxpower:"Empfangsleistung",p_txfault:"TX-Fehler",p_txdis:"TX deaktiviert",p_rxlos:"RX LOS",p_adv:"Angeboten",
pt_title:"Port-Konfiguration",pt_conn:"Gelernte Geräte",pt_speed:"Geschwindigkeit",pt_mtu:"MTU", pt_title:"Port-Konfiguration",pt_conn:"Gelernte Geräte",pt_speed:"Geschwindigkeit",pt_mtu:"MTU",
@@ -836,6 +836,7 @@ function isConfCmd(line){
function setDirty(d){ function setDirty(d){
S.dirty=d; S.dirty=d;
$("dirty").classList.toggle("show",d); $("dirty").classList.toggle("show",d);
$("saveBtn").classList.toggle("pri",d);
} }
function postCmd(cmd,quiet){ function postCmd(cmd,quiet){
return api("/cmd",{method:"POST",body:cmd}).then(function(r){ return api("/cmd",{method:"POST",body:cmd}).then(function(r){
@@ -1024,8 +1025,10 @@ function portRows(p){
var rows=[[t("c_port"),String(p.portNum)],[t("c_type"),p.isSFP?"SFP":"RJ45"]]; var rows=[[t("c_port"),String(p.portNum)],[t("c_type"),p.isSFP?"SFP":"RJ45"]];
if(p.name)rows.push([t("c_name"),p.name]); if(p.name)rows.push([t("c_name"),p.name]);
rows.push([t("p_state"),!p.enabled?t("p_disabled"):(p.link>0?t("p_up")+" "+LINKS[p.link]:t("c_down"))]); rows.push([t("p_state"),!p.enabled?t("p_disabled"):(p.link>0?t("p_up")+" "+LINKS[p.link]:t("c_down"))]);
rows.push([t("p_txgb"),BigInt(p.txG)+" / "+BigInt(p.txB)+" "+t("p_pkts")]); rows.push([t("st_txg"),BigInt(p.txG)+" "+t("p_pkts")]);
rows.push([t("p_rxgb"),BigInt(p.rxG)+" / "+BigInt(p.rxB)+" "+t("p_pkts")]); rows.push([t("st_txb"),BigInt(p.txB)+" "+t("p_pkts")]);
rows.push([t("st_rxg"),BigInt(p.rxG)+" "+t("p_pkts")]);
rows.push([t("st_rxb"),BigInt(p.rxB)+" "+t("p_pkts")]);
if(p.isSFP){ if(p.isSFP){
if(p.sfp_vendor)rows.push([t("p_module"),[p.sfp_vendor,p.sfp_model,p.sfp_serial].filter(Boolean).join(" / ")]); if(p.sfp_vendor)rows.push([t("p_module"),[p.sfp_vendor,p.sfp_model,p.sfp_serial].filter(Boolean).join(" / ")]);
var ext=p.sfp_options&0x40; var ext=p.sfp_options&0x40;
@@ -2243,14 +2246,14 @@ var CONF_OVERWRITE=[
/^ntp\s+server\b/,/^ntp\s+interval\b/,/^ntp\s+timezone\b/,/^ntp\s+dst\b/, /^ntp\s+server\b/,/^ntp\s+interval\b/,/^ntp\s+timezone\b/,/^ntp\s+dst\b/,
/^vlan\s+\d{1,4}\s+mgmt$/,/^vlan\s+\d{1,4}(?!\s+mgmt\b)/, /^vlan\s+\d{1,4}\s+mgmt$/,/^vlan\s+\d{1,4}(?!\s+mgmt\b)/,
/^pvid\s+\d{1,2}\b/, /^pvid\s+\d{1,2}\b/,
/^port\s+\d{1,2}(?!\s+name\b)/,/^port\s+\d{1,2}\s+name\b/, /^port\s+\d{1,2}(?!\s+(name|lldp)\b)/,/^port\s+\d{1,2}\s+name\b/,
/^mirror\b/, /^mirror\b/,
/^lag\s+\d\b/,/^laghash\s+\d\b/,/^isolate\s+\d{1,2}\b/, /^lag\s+\d\b/,/^laghash\s+\d\b/,/^isolate\s+\d{1,2}\b/,
/^stp\s+(prio|hello|maxage|fwd|txhold|version)\b/, /^stp\s+(prio|hello|maxage|fwd|txhold|version)\b/,
/^stp\s+(port\s+\d{1,2}|lag\s+[1-4])\s+(edge|cost|prio|guard|filter|p2p)\b/, /^stp\s+(port\s+\d{1,2}|lag\s+[1-4])\s+(edge|cost|prio|guard|filter|p2p)\b/,
/^igmp\b/,/^mtu\s+\d{1,2}\b/,/^storm\s+\d{1,2}\s+(bcast|mcast|ucast|umcast)\b/, /^igmp\b/,/^mtu\s+\d{1,2}\b/,/^storm\s+\d{1,2}\s+(bcast|mcast|ucast|umcast)\b/,
]; ];
var CONF_TOGGLE=[/^(syslog)\s+(on|off)$/,/^(ntp)\s+(on|off)$/,/^(stp)\s+(on|off)$/,/^(stp\s+(port\s+\d{1,2}|lag\s+[1-4]))\s+(on|off)$/]; var CONF_TOGGLE=[/^(syslog)\s+(on|off)$/,/^(ntp)\s+(on|off)$/,/^(stp)\s+(on|off)$/,/^(lldp)\s+(on|off)$/,/^(stp\s+(port\s+\d{1,2}|lag\s+[1-4]))\s+(on|off)$/];
function mergeConf(base,texts){ function mergeConf(base,texts){
var conf=base.slice(); var conf=base.slice();
function drop(rx){conf=conf.filter(function(c){return!rx.test(c)})} function drop(rx){conf=conf.filter(function(c){return!rx.test(c)})}
@@ -2268,6 +2271,7 @@ function mergeConf(base,texts){
} }
if((m=line.match(/^lag (\d) lacp off$/))){drop(new RegExp("^lag "+m[1]+" lacp( |$)"));return;} if((m=line.match(/^lag (\d) lacp off$/))){drop(new RegExp("^lag "+m[1]+" lacp( |$)"));return;}
if(line==="mirror off"){drop(/^mirror /);return;} if(line==="mirror off"){drop(/^mirror /);return;}
if((m=line.match(/^(port \d{1,2} lldp) (permit|block)$/))){drop(new RegExp("^"+m[1]+" (permit|block)$"));conf.push(line);return;}
if(!isConfCmd(line))return; if(!isConfCmd(line))return;
if((m=line.match(/^ingress (.+)$/))){ if((m=line.match(/^ingress (.+)$/))){
if(/^[tua]$/.test(m[1])){drop(/^ingress /);conf.push(line);return;} if(/^[tua]$/.test(m[1])){drop(/^ingress /);conf.push(line);return;}
@@ -2300,7 +2304,7 @@ function mergeConf(base,texts){
var key=line.match(rx)[0]; var key=line.match(rx)[0];
conf=conf.filter(function(item){ conf=conf.filter(function(item){
return!(item===key||(item.indexOf(key+" ")===0 return!(item===key||(item.indexOf(key+" ")===0
&&!/\smgmt$/.test(item)&&item.indexOf(key+" name ")!==0)); &&!/\smgmt$/.test(item)&&item.indexOf(key+" name ")!==0&&item.indexOf(key+" lldp ")!==0));
}); });
break; break;
} }
+4 -3
View File
@@ -89,6 +89,7 @@ table.t th{
padding:6px 8px;border-bottom:1px solid var(--bd);white-space:nowrap; padding:6px 8px;border-bottom:1px solid var(--bd);white-space:nowrap;
} }
table.t th[data-sort]{cursor:pointer;user-select:none} table.t th[data-sort]{cursor:pointer;user-select:none}
table.t th.num{text-align:right}
table.t td{padding:6px 8px;border-bottom:1px solid var(--bd);vertical-align:middle} table.t td{padding:6px 8px;border-bottom:1px solid var(--bd);vertical-align:middle}
table.t tr:last-child td{border-bottom:0} table.t tr:last-child td{border-bottom:0}
table.t tr:hover td{background:var(--sel)} table.t tr:hover td{background:var(--sel)}
@@ -223,7 +224,7 @@ button.danger{background:var(--bad);color:#fff;border-color:transparent}
<span id="ttitle"></span> <span id="ttitle"></span>
<div id="strip"></div> <div id="strip"></div>
<span id="dirty" data-i18n="hdr_dirty" data-i18n-t="hdr_dirty_t">unsaved changes</span> <span id="dirty" data-i18n="hdr_dirty" data-i18n-t="hdr_dirty_t">unsaved changes</span>
<button class="ctl pri" id="saveBtn" data-i18n="hdr_save" data-i18n-t="hdr_save_t">Save to flash</button> <button class="ctl" id="saveBtn" data-i18n="hdr_save" data-i18n-t="hdr_save_t">Save to flash</button>
</header> </header>
<main> <main>
@@ -437,8 +438,8 @@ button.danger{background:var(--bad);color:#fff;border-color:transparent}
<p class="small mut" style="margin-top:8px" data-i18n="sy_time_note">The switch has no battery backed clock.</p> <p class="small mut" style="margin-top:8px" data-i18n="sy_time_note">The switch has no battery backed clock.</p>
</div> </div>
<div class="card"><h2 data-i18n="sy_password">Admin password</h2> <div class="card"><h2 data-i18n="sy_password">Admin password</h2>
<label class="row"><span class="lb" data-i18n="sy_newpw">New password</span><input class="in" id="sy-pw1" type="password" maxlength="20"></label> <label class="row"><span class="lb" data-i18n="sy_newpw">New password</span><input class="in" id="sy-pw1" type="password" autocomplete="new-password" maxlength="20"></label>
<label class="row"><span class="lb" data-i18n="sy_repeat">Repeat</span><input class="in" id="sy-pw2" type="password" maxlength="20"></label> <label class="row"><span class="lb" data-i18n="sy_repeat">Repeat</span><input class="in" id="sy-pw2" type="password" autocomplete="new-password" maxlength="20"></label>
<button class="ctl pri" id="sy-pwapply" style="margin-top:8px" data-i18n="sy_pwapply">Change password</button> <button class="ctl pri" id="sy-pwapply" style="margin-top:8px" data-i18n="sy_pwapply">Change password</button>
<p class="small mut" style="margin-top:8px" data-i18n="sy_pw_note">Takes effect immediately; save to flash to keep it after reboot.</p> <p class="small mut" style="margin-top:8px" data-i18n="sy_pw_note">Takes effect immediately; save to flash to keep it after reboot.</p>
</div> </div>
+77 -30
View File
@@ -55,8 +55,8 @@ __xdata uint8_t boundary[72];
#define CONFIG_UPLOAD_BUF (CONFIG_LEN + 384) #define CONFIG_UPLOAD_BUF (CONFIG_LEN + 384)
__xdata uint8_t config_upload; __xdata uint8_t config_upload;
__xdata uint8_t config_buf[CONFIG_UPLOAD_BUF]; __xdata uint8_t config_buf[CONFIG_UPLOAD_BUF];
// bytes buffered in config_buf so far (config body, or a firmware part // bytes buffered in config_buf so far (HTTP header, POST body, or a firmware
// header); accumulates across TCP segments // part header); accumulates across TCP segments
__xdata uint16_t pre_acc; __xdata uint16_t pre_acc;
__xdata uint8_t * __xdata content_type = 0; __xdata uint8_t * __xdata content_type = 0;
__xdata uint8_t * __xdata session = 0; __xdata uint8_t * __xdata session = 0;
@@ -75,9 +75,6 @@ __xdata uint8_t postbody_endpoint;
__xdata uint16_t postbody_start; __xdata uint16_t postbody_start;
__xdata char passwd[21]; __xdata char passwd[21];
// Set when a verified firmware upload awaits its response ACK, after
// which the chip resets to apply the staged image
__xdata uint8_t fw_reset_pending;
__xdata char session_id[SESSION_ID_LENGTH + 1]; __xdata char session_id[SESSION_ID_LENGTH + 1];
__xdata uint8_t authenticated; __xdata uint8_t authenticated;
__xdata uint32_t now; __xdata uint32_t now;
@@ -90,6 +87,7 @@ __xdata uint32_t last_session_use;
#define TSTATE_POST 4 #define TSTATE_POST 4
#define TSTATE_MULTIPART 5 #define TSTATE_MULTIPART 5
#define TSTATE_POSTBODY 6 #define TSTATE_POSTBODY 6
#define TSTATE_HEADER 7
extern __xdata uint16_t crc_value; extern __xdata uint16_t crc_value;
__xdata uint16_t crc_final; __xdata uint16_t crc_final;
@@ -109,8 +107,8 @@ void httpd_init(void) __banked
uip_listen(HTONS(80)); uip_listen(HTONS(80));
// Not through uip_conn: it only points at a connection while uIP is // Not through uip_conn: it only points at a connection while uIP is
// handling one, and nothing has set it yet at init time. // handling one, and nothing has set it yet at init time.
uip_conns[0].appstate.tstate = TSTATE_CLOSED; for (uint8_t i = 0; i < UIP_CONNS; i++)
fw_reset_pending = 0; // xdata is not zeroed by the startup code uip_conns[i].appstate.tstate = TSTATE_CLOSED;
} }
@@ -450,15 +448,9 @@ static uint8_t config_take(void)
// unlike scan_header(), keeps no auth state, so it may run on every buffered segment // unlike scan_header(), keeps no auth state, so it may run on every buffered segment
static uint16_t preamble_payload_start(uint16_t n) static uint16_t preamble_payload_start(uint16_t n)
{ {
uint16_t pos; // Skip the HTTP header separator retained by handle_post().
uint16_t pos = 4;
for (pos = 0; pos + 24 <= n; pos++) {
if (strstart(&config_buf[pos], "application/octet-stream"))
break;
}
if (pos + 24 > n)
return 0;
pos += 24;
while (pos + 3 < n && !strstart(&config_buf[pos], "\r\n\r\n")) while (pos + 3 < n && !strstart(&config_buf[pos], "\r\n\r\n"))
pos++; pos++;
if (pos + 3 >= n) if (pos + 3 >= n)
@@ -511,7 +503,7 @@ uint8_t stream_upload(void)
"Content-Type: text/plain\r\n\r\n" "Content-Type: text/plain\r\n\r\n"
"OK: checksum verified, rebooting\n"); "OK: checksum verified, rebooting\n");
// Reset once the response is fully ACKed // Reset once the response is fully ACKed
fw_reset_pending = 1; s->fw_reset_pending = 1;
} else { } else {
print_string("Checksum incorrect! Aborting.\n"); print_string("Checksum incorrect! Aborting.\n");
slen = strtox(outbuf, "HTTP/1.1 400 Bad Request\r\nContent-Length: 33\r\n" slen = strtox(outbuf, "HTTP/1.1 400 Bad Request\r\nContent-Length: 33\r\n"
@@ -746,7 +738,42 @@ static void post_body_continue(void)
} }
void handle_post(void)
/*
* Buffer an HTTP request header across TCP receive events. Stop copying at
* CRLFCRLF so any body bytes in the final segment stay in uip_appdata.
*
* Return the body offset in the current receive buffer, 0 while incomplete,
* or 0xffff after sending an error response.
*/
static uint16_t request_header_take(void)
{
uint16_t i;
for (i = 0; i < uip_len; i++) {
if (pre_acc + 1 >= CONFIG_UPLOAD_BUF) {
uip_conn->appstate.tstate = TSTATE_NONE;
send_bad_request();
return 0xffff;
}
config_buf[pre_acc++] = ((__xdata uint8_t *)uip_appdata)[i];
config_buf[pre_acc] = NUL;
if (pre_acc >= 4
&& config_buf[pre_acc - 4] == '\r'
&& config_buf[pre_acc - 3] == '\n'
&& config_buf[pre_acc - 2] == '\r'
&& config_buf[pre_acc - 1] == '\n') {
uip_conn->appstate.tstate = TSTATE_NONE;
return i + 1;
}
}
postbody_start = ticks;
uip_conn->appstate.tstate = TSTATE_HEADER;
return 0;
}
void handle_post(uint16_t body_off)
{ {
__xdata struct httpd_state * __xdata s = &(uip_conn->appstate); __xdata struct httpd_state * __xdata s = &(uip_conn->appstate);
__xdata uint8_t *p = uip_appdata; __xdata uint8_t *p = uip_appdata;
@@ -759,6 +786,9 @@ void handle_post(void)
// Was the multipart header sent in multiple packets? // Was the multipart header sent in multiple packets?
if (s->tstate != TSTATE_MULTIPART) { if (s->tstate != TSTATE_MULTIPART) {
p = config_buf;
request_path = p + 6;
dbg_string("Is POST\n"); dbg_string("Is POST\n");
p += 5; // Skip post p += 5; // Skip post
// Find end of request path // Find end of request path
@@ -772,9 +802,12 @@ void handle_post(void)
dbg_string("Boundary: >"); dbg_string_x(boundary); dbg_string("<\n"); dbg_string("Boundary: >"); dbg_string_x(boundary); dbg_string("<\n");
if (!*p || !content_type) { if (!*p || !content_type) {
dbg_string("Bad Request!\n"); dbg_string("Bad Request!\n");
send_not_found(); send_bad_request();
return; return;
} }
pre_acc = 0;
p = (__xdata uint8_t *)uip_appdata + body_off;
if (is_word(request_path, "upload")) { if (is_word(request_path, "upload")) {
if (!authenticated) { if (!authenticated) {
send_unauthorized(); send_unauthorized();
@@ -800,7 +833,10 @@ void handle_post(void)
dbg_string("Configuration upload\n"); dbg_string("Configuration upload\n");
verify_crc = 0; verify_crc = 0;
config_upload = 1; config_upload = 1;
pre_acc = 0; // config_take() matches CRLF-prefixed delimiters, including the first.
config_buf[0] = '\r';
config_buf[1] = '\n';
pre_acc = 2;
} }
// Check for other POST requests, which are not multipart, below // Check for other POST requests, which are not multipart, below
} else { } else {
@@ -824,7 +860,6 @@ void handle_post(void)
handle_firmware_fragment(p); handle_firmware_fragment(p);
return; return;
} else if (is_word(request_path, "cmd")) { } else if (is_word(request_path, "cmd")) {
p += 4;
if (!authenticated) { if (!authenticated) {
send_unauthorized(); send_unauthorized();
return; return;
@@ -843,7 +878,6 @@ void handle_post(void)
return; return;
} }
p += 4;
postbody_endpoint = POSTBODY_LOGIN; postbody_endpoint = POSTBODY_LOGIN;
if (!post_body_take(p)) if (!post_body_take(p))
return; return;
@@ -874,9 +908,10 @@ void httpd_appcall(void)
print_byte(s->tstate); print_byte(s->tstate);
write_char(' '); write_char(' ');
#endif #endif
if(uip_connected() && s->tstate == TSTATE_CLOSED) { if(uip_connected()) {
dbg_string("Connected...\n"); dbg_string("Connected...\n");
s->tstate = TSTATE_NONE; s->tstate = TSTATE_NONE;
s->fw_reset_pending = 0; // explicitly initialize reused XDATA appstate
} else if (uip_closed()) { } else if (uip_closed()) {
dbg_string("Connection closed\n"); dbg_string("Connection closed\n");
s->tstate = TSTATE_CLOSED; s->tstate = TSTATE_CLOSED;
@@ -890,9 +925,9 @@ void httpd_appcall(void)
dbg_string("Closing because everything has been transmitted\n"); dbg_string("Closing because everything has been transmitted\n");
uip_close(); uip_close();
s->tstate = TSTATE_CLOSED; s->tstate = TSTATE_CLOSED;
} else if (s->tstate == TSTATE_POSTBODY } else if ((s->tstate == TSTATE_POSTBODY || s->tstate == TSTATE_HEADER)
&& (uint16_t)ticks - postbody_start > POSTBODY_TIMEOUT) { && (uint16_t)ticks - postbody_start > POSTBODY_TIMEOUT) {
dbg_string("Body never arrived\n"); dbg_string("HTTP request never completed\n");
uip_abort(); uip_abort();
s->tstate = TSTATE_CLOSED; s->tstate = TSTATE_CLOSED;
} }
@@ -928,7 +963,7 @@ void httpd_appcall(void)
cont_len -= slen; cont_len -= slen;
cont_addr += slen; cont_addr += slen;
s->tstate = TSTATE_TX; s->tstate = TSTATE_TX;
} else if (fw_reset_pending) { } else if (s->fw_reset_pending) {
// The upload verdict has been fully ACKed by the client; // The upload verdict has been fully ACKed by the client;
// now it is safe to reset and apply the staged image // now it is safe to reset and apply the staged image
print_string("Resetting to apply update\n"); print_string("Resetting to apply update\n");
@@ -955,6 +990,7 @@ void httpd_appcall(void)
cont_len = 0; cont_len = 0;
dbg_char('<'); dbg_short(uip_len); dbg_char('\n'); dbg_char('<'); dbg_short(uip_len); dbg_char('\n');
__xdata uint8_t *p = uip_appdata; __xdata uint8_t *p = uip_appdata;
uint16_t body_off = 0;
// Mark end of request header with \0 // Mark end of request header with \0
p[uip_len] = 0; p[uip_len] = 0;
#ifdef DEBUG #ifdef DEBUG
@@ -963,9 +999,21 @@ void httpd_appcall(void)
dbg_char('\n'); dbg_char('\n');
#endif #endif
p = uip_appdata; p = uip_appdata;
if (is_word(p, "POST") || s->tstate == TSTATE_MULTIPART if (s->tstate != TSTATE_MULTIPART && s->tstate != TSTATE_POSTBODY) {
|| s->tstate == TSTATE_POSTBODY) { if (s->tstate != TSTATE_HEADER)
handle_post(); pre_acc = 0;
body_off = request_header_take();
if (!body_off) {
uip_len = 0;
return;
}
if (body_off == 0xffff)
goto do_send;
}
if (s->tstate == TSTATE_MULTIPART || s->tstate == TSTATE_POSTBODY
|| is_word(config_buf, "POST")) {
handle_post(body_off);
// If this is an ongoing post stream, then wait for the next packet // If this is an ongoing post stream, then wait for the next packet
if (s->tstate == TSTATE_POST || s->tstate == TSTATE_MULTIPART if (s->tstate == TSTATE_POST || s->tstate == TSTATE_MULTIPART
|| s->tstate == TSTATE_POSTBODY) { || s->tstate == TSTATE_POSTBODY) {
@@ -975,12 +1023,11 @@ void httpd_appcall(void)
goto do_send; goto do_send;
} }
// We only expect a GET request here. p = config_buf;
if (!is_word(p, "GET")) { if (!is_word(p, "GET")) {
send_bad_request(); send_bad_request();
goto do_send; goto do_send;
} }
dbg_string("GET request "); dbg_string("GET request ");
p += 4; p += 4;
scan_header(p); scan_header(p);
+1
View File
@@ -12,6 +12,7 @@
for each TCP connection. */ for each TCP connection. */
typedef struct httpd_state { typedef struct httpd_state {
uint8_t tstate; uint8_t tstate;
uint8_t fw_reset_pending;
} uip_tcp_appstate_t; } uip_tcp_appstate_t;
/* Finally we define the application function to be called by uIP. */ /* Finally we define the application function to be called by uIP. */
+18 -18
View File
@@ -341,7 +341,7 @@ void send_vlan(uint16_t vlan)
} }
slen += strtox(outbuf + slen, "\",\"pvid\":\"0x"); slen += strtox(outbuf + slen, "\",\"pvid\":\"0x");
uint16_t pvid_mask = 0; uint16_t pvid_mask = 0;
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) { for (uint8_t i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++) {
if (port_pvid_get(i) == vlan) if (port_pvid_get(i) == vlan)
pvid_mask |= (1 << i); pvid_mask |= (1 << i);
} }
@@ -357,7 +357,7 @@ void send_vlan(uint16_t vlan)
bool send_counters(uint8_t phys_port) bool send_counters(uint8_t phys_port)
{ {
uint8_t phys_port_idx = phys_port - 1; uint8_t phys_port_idx = phys_port - 1;
if (phys_port_idx > (machine.max_port - machine.min_port)) if (phys_port_idx > (MACHINE_MAX_PORT - MACHINE_MIN_PORT))
goto err; goto err;
uint8_t log_port = machine.phys_to_log_port[phys_port_idx]; uint8_t log_port = machine.phys_to_log_port[phys_port_idx];
@@ -676,7 +676,7 @@ void send_stp(void)
slen += strtox(outbuf + slen, "\",\"ports\":["); slen += strtox(outbuf + slen, "\",\"ports\":[");
reg_read_m(RTL837X_MSTP_STATES); reg_read_m(RTL837X_MSTP_STATES);
for (i = 0; i < STP_ENTITIES; i++) { for (i = 0; i < STP_ENTITIES; i++) {
if (i < STP_LAG_BASE && (i < machine.min_port || i > machine.max_port)) if (i < STP_LAG_BASE && !MACHINE_PORT_VALID(i))
continue; continue;
if (i < STP_LAG_BASE && stp_ent_of[i] != i) if (i < STP_LAG_BASE && stp_ent_of[i] != i)
continue; continue;
@@ -761,7 +761,7 @@ void send_lacp(void)
} }
slen -= 1; // remove comma slen -= 1; // remove comma
slen += strtox(outbuf + slen, "],\"ports\":["); slen += strtox(outbuf + slen, "],\"ports\":[");
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) { for (uint8_t i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++) {
slen += strtox(outbuf + slen, "{\"p\":"); slen += strtox(outbuf + slen, "{\"p\":");
itoa_html(machine.log_to_phys_port[i]); itoa_html(machine.log_to_phys_port[i]);
slen += strtox(outbuf + slen, ",\"lag\":"); slen += strtox(outbuf + slen, ",\"lag\":");
@@ -793,7 +793,7 @@ void send_lldp(void)
bool_to_html(lldp_enabled); bool_to_html(lldp_enabled);
slen += strtox(outbuf + slen, ",\"portStatus\":["); slen += strtox(outbuf + slen, ",\"portStatus\":[");
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) { for (uint8_t i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++) {
slen += strtox(outbuf + slen, "{\"portNum\":"); slen += strtox(outbuf + slen, "{\"portNum\":");
itoa_html(machine.log_to_phys_port[i]); itoa_html(machine.log_to_phys_port[i]);
@@ -808,7 +808,7 @@ void send_lldp(void)
bool_to_html(1 & (lldp_logical_port_status >> i)); bool_to_html(1 & (lldp_logical_port_status >> i));
slen += strtox(outbuf + slen, "}"); slen += strtox(outbuf + slen, "}");
if (i < machine.max_port) if (i < MACHINE_MAX_PORT)
char_to_html(','); char_to_html(',');
else else
char_to_html(']'); char_to_html(']');
@@ -825,7 +825,7 @@ void send_eee(void)
uint8_t eee_ablty = sfr_data[3]; uint8_t eee_ablty = sfr_data[3];
char_to_html('['); char_to_html('[');
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) { for (uint8_t i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++) {
slen += strtox(outbuf + slen, "{\"portNum\":"); slen += strtox(outbuf + slen, "{\"portNum\":");
itoa_html(machine.log_to_phys_port[i]); itoa_html(machine.log_to_phys_port[i]);
@@ -857,7 +857,7 @@ void send_eee(void)
bool_to_html(eee_ablty & (1 << i)); bool_to_html(eee_ablty & (1 << i));
} }
char_to_html('}'); char_to_html('}');
if (i < machine.max_port) if (i < MACHINE_MAX_PORT)
char_to_html(','); char_to_html(',');
else else
char_to_html(']'); char_to_html(']');
@@ -870,7 +870,7 @@ void send_bandwidth(void)
dbg_string("send_bandwidth called\n"); dbg_string("send_bandwidth called\n");
slen = strtox(outbuf, HTTP_RESPONCE_JSON); slen = strtox(outbuf, HTTP_RESPONCE_JSON);
char_to_html('['); char_to_html('[');
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) { for (uint8_t i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++) {
slen += strtox(outbuf + slen, "{\"portNum\":"); slen += strtox(outbuf + slen, "{\"portNum\":");
itoa_html(machine.log_to_phys_port[i]); itoa_html(machine.log_to_phys_port[i]);
slen += strtox(outbuf + slen, ",\"iLimited\":"); slen += strtox(outbuf + slen, ",\"iLimited\":");
@@ -900,7 +900,7 @@ void send_bandwidth(void)
byte_to_html(sfr_data[3]); byte_to_html(sfr_data[3]);
char_to_html('"'); char_to_html('"');
char_to_html('}'); char_to_html('}');
if (i < machine.max_port) if (i < MACHINE_MAX_PORT)
char_to_html(','); char_to_html(',');
else else
char_to_html(']'); char_to_html(']');
@@ -914,7 +914,7 @@ void send_storm(void)
slen = strtox(outbuf, HTTP_RESPONCE_JSON); slen = strtox(outbuf, HTTP_RESPONCE_JSON);
char_to_html('['); char_to_html('[');
for (i = machine.min_port; i <= machine.max_port; i++) { for (i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++) {
slen += strtox(outbuf + slen, "{\"portNum\":"); slen += strtox(outbuf + slen, "{\"portNum\":");
itoa_html(machine.log_to_phys_port[i]); itoa_html(machine.log_to_phys_port[i]);
slen += strtox(outbuf + slen, ",\"en\":\""); slen += strtox(outbuf + slen, ",\"en\":\"");
@@ -934,7 +934,7 @@ void send_storm(void)
} }
char_to_html('"'); char_to_html('"');
char_to_html('}'); char_to_html('}');
if (i < machine.max_port) if (i < MACHINE_MAX_PORT)
char_to_html(','); char_to_html(',');
else else
char_to_html(']'); char_to_html(']');
@@ -949,7 +949,7 @@ void send_isolation(void)
dbg_string("send_isolation called\n"); dbg_string("send_isolation called\n");
slen = strtox(outbuf, HTTP_RESPONCE_JSON); slen = strtox(outbuf, HTTP_RESPONCE_JSON);
char_to_html('['); char_to_html('[');
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) { for (uint8_t i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++) {
slen += strtox(outbuf + slen, "{\"portNum\":"); slen += strtox(outbuf + slen, "{\"portNum\":");
itoa_html(machine.log_to_phys_port[i]); itoa_html(machine.log_to_phys_port[i]);
slen += strtox(outbuf + slen, ",\"allow\":\""); slen += strtox(outbuf + slen, ",\"allow\":\"");
@@ -958,7 +958,7 @@ void send_isolation(void)
byte_to_html(allow & 0xff); byte_to_html(allow & 0xff);
char_to_html('"'); char_to_html('"');
char_to_html('}'); char_to_html('}');
if (i < machine.max_port) if (i < MACHINE_MAX_PORT)
char_to_html(','); char_to_html(',');
} }
char_to_html(']'); char_to_html(']');
@@ -970,7 +970,7 @@ void send_mtu(void)
dbg_string("send_mtu called\n"); dbg_string("send_mtu called\n");
slen = strtox(outbuf, HTTP_RESPONCE_JSON); slen = strtox(outbuf, HTTP_RESPONCE_JSON);
char_to_html('['); char_to_html('[');
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) { for (uint8_t i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++) {
slen += strtox(outbuf + slen, "{\"portNum\":"); slen += strtox(outbuf + slen, "{\"portNum\":");
itoa_html(machine.log_to_phys_port[i]); itoa_html(machine.log_to_phys_port[i]);
slen += strtox(outbuf + slen, ",\"mtu\":\"0x"); slen += strtox(outbuf + slen, ",\"mtu\":\"0x");
@@ -980,7 +980,7 @@ void send_mtu(void)
byte_to_html(mtu & 0xff); byte_to_html(mtu & 0xff);
char_to_html('"'); char_to_html('"');
char_to_html('}'); char_to_html('}');
if (i < machine.max_port) if (i < MACHINE_MAX_PORT)
char_to_html(','); char_to_html(',');
else else
char_to_html(']'); char_to_html(']');
@@ -994,7 +994,7 @@ void send_status(void)
dbg_string("sending status\n"); dbg_string("sending status\n");
char_to_html('['); char_to_html('[');
for (uint8_t i = machine.min_port; i <= machine.max_port; i++) { for (uint8_t i = MACHINE_MIN_PORT; i <= MACHINE_MAX_PORT; i++) {
slen += strtox(outbuf + slen, "{\"portNum\":"); slen += strtox(outbuf + slen, "{\"portNum\":");
itoa_html(machine.log_to_phys_port[i]); itoa_html(machine.log_to_phys_port[i]);
slen += strtox(outbuf + slen, ",\"logPort\":"); slen += strtox(outbuf + slen, ",\"logPort\":");
@@ -1115,7 +1115,7 @@ void send_status(void)
slen += strtox(outbuf + slen, "\",\"macs\":\"0x"); slen += strtox(outbuf + slen, "\",\"macs\":\"0x");
reg_to_html(RTL837X_L2_LRN_PORT_CONSTRT_CNT + (i << 2)); reg_to_html(RTL837X_L2_LRN_PORT_CONSTRT_CNT + (i << 2));
slen += strtox(outbuf + slen, "\"}"); slen += strtox(outbuf + slen, "\"}");
if (i < machine.max_port) if (i < MACHINE_MAX_PORT)
char_to_html(','); char_to_html(',');
else else
char_to_html(']'); char_to_html(']');
+43 -4
View File
@@ -15,8 +15,51 @@
#define MACHINE_INC(dir,file) MACHINE_STR(dir/file) #define MACHINE_INC(dir,file) MACHINE_STR(dir/file)
#define RTL8370 0x70
#define RTL8372 0x72
#define RTL8373 0x73
#include MACHINE_INC(MACHINE_DEF_DIR,MACHINE_NAME.h) #include MACHINE_INC(MACHINE_DEF_DIR,MACHINE_NAME.h)
#ifndef MACHINE_CHIPSET
#error "MACHINE_CHIPSET shall be defined in <machine>.h file"
#endif
#ifndef MACHINE_MIN_PORT
#if MACHINE_CHIPSET == RTL8372
#define MACHINE_MIN_PORT 3
#else
#define MACHINE_MIN_PORT 0
#endif
#endif
#ifndef MACHINE_MAX_PORT
#if MACHINE_CHIPSET == RTL8370
#define MACHINE_MAX_PORT 7
#else
#define MACHINE_MAX_PORT 8
#endif
#endif
#define MACHINE_PORT_VALID(p) \
((uint8_t)((p) - MACHINE_MIN_PORT) <= (MACHINE_MAX_PORT - MACHINE_MIN_PORT))
// auto derive SOC_FAMILY
#define RTL836X 6
#define RTL837X 7
#ifdef SOC_FAMILY
#error "SOC_FAMILY can not be manually defined, shall be auto derived"
#endif
#if (MACHINE_CHIPSET == RTL8372) || (MACHINE_CHIPSET == RTL8373)
#define SOC_FAMILY RTL837X
#elif (MACHINE_CHIPSET == RTL8370 )
#define SOC_FAMILY RTL836X
#else
#error "Unsupported MACHINE_CHIPSET is specified!"
#endif
#define LED_27 1 #define LED_27 1
// SYSTEM LED // SYSTEM LED
#define LED_28_SYS 2 #define LED_28_SYS 2
@@ -41,10 +84,6 @@ struct sfp_port
struct machine { struct machine {
char machine_name[30]; char machine_name[30];
uint8_t isRTL8373; uint8_t isRTL8373;
// Lowest logical port number
uint8_t min_port;
// Highest logical port number
uint8_t max_port;
uint8_t n_sfp; uint8_t n_sfp;
uint8_t n_10g; uint8_t n_10g;
uint8_t log_to_phys_port[9]; uint8_t log_to_phys_port[9];
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_2G08110GSN_H_ #define _MACHINE_2G08110GSN_H_
#define MACHINE_MODEL "MokerLink 2G08110GSN" #define MACHINE_MODEL "MokerLink 2G08110GSN"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+3 -6
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
/* Same 2M-PCB43-V1.1 board family as the KP-9000-6XH-X2 (see /* Same 2M-PCB43-V1.1 board family as the KP-9000-6XH-X2 (see
* machine/KP_9000_6XHML_X2.c), but the two SFP+ cages (physical ports 5 and * machine/KP_9000_6XHML_X2.c), but the two SFP+ cages (physical ports 5 and
@@ -44,8 +41,8 @@ __code const struct machine machine = {
* at 2.5G only) and LED-ID2 carries the SFP single LED. The "solid" * at 2.5G only) and LED-ID2 carries the SFP single LED. The "solid"
* conditions (LINK/speed) barely drive the LEDs here and ACT is what * conditions (LINK/speed) barely drive the LEDs here and ACT is what
* actually lights them, which is why the white LED used to glow faintly at * actually lights them, which is why the white LED used to glow faintly at
* non-2.5G speeds; the fix for that is LED_GLB_IO_EN bit 6, set in * non-2.5G speeds; the fix for that is LED_GLB_IO_EN bit 6, set in the
* machine_init.c. */ * shared machine_custom_init() hook (machine/2G5F4_10G2_V1_01_init.c). */
.led_sets = { { LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, .led_sets = { { LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G,
LEDS_2G5 | LEDS_LINK | LEDS_10G, LEDS_2G5 | LEDS_LINK | LEDS_10G,
LEDS_1G | LEDS_LINK, LEDS_1G | LEDS_LINK,
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_2G5F4_10G2_V1_01_H_ #define _MACHINE_2G5F4_10G2_V1_01_H_
#define MACHINE_MODEL "2G5F4_10G2_V1.01 / SGT0204S" #define MACHINE_MODEL "2G5F4_10G2_V1.01 / SGT0204S"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -0,0 +1 @@
KP_9000_6XH_X2_init.c
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_DEFAULT_8C_1SFP_H_ #define _MACHINE_DEFAULT_8C_1SFP_H_
#define MACHINE_MODEL "8+1 SFP Port Switch" #define MACHINE_MODEL "8+1 SFP Port Switch"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_F7008_2_5_H_ #define _MACHINE_F7008_2_5_H_
#define MACHINE_MODEL "F7008-2.5 8+1 SFP Port Switch" #define MACHINE_MODEL "F7008-2.5 8+1 SFP Port Switch"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5},
.phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_FG_4GT_2SX_V2_0_H_ #define _MACHINE_FG_4GT_2SX_V2_0_H_
#define MACHINE_MODEL "FG-4GT-2SX_V2.0" #define MACHINE_MODEL "FG-4GT-2SX_V2.0"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+6
View File
@@ -0,0 +1,6 @@
#include "machine_init_defs.h"
void machine_custom_init(void) __banked
{
REG_SET(RTL837X_REG_LED_GLB_IO_EN, 0x7624155b);
}
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_FG_8GT_1SX_H_ #define _MACHINE_FG_8GT_1SX_H_
#define MACHINE_MODEL "FG-8GT-1SX" #define MACHINE_MODEL "FG-8GT-1SX"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_FNS1200P_H_ #define _MACHINE_FNS1200P_H_
#define MACHINE_MODEL "FNS-1200P" #define MACHINE_MODEL "FNS-1200P"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -0,0 +1 @@
KP_9000_6XH_X2_init.c
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_GT_ST018M_H_ #define _MACHINE_GT_ST018M_H_
#define MACHINE_MODEL "GoodTop GT-ST018M" #define MACHINE_MODEL "GoodTop GT-ST018M"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_GT_ST024M_H_ #define _MACHINE_GT_ST024M_H_
#define MACHINE_MODEL "GoodTop GT-ST024M" #define MACHINE_MODEL "GoodTop GT-ST024M"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1 -4
View File
@@ -1,11 +1,8 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.mac_flash_offset = 0x1FC000, .mac_flash_offset = 0x1FC000,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_HASIVO_S1100P_8GT_1SX_S_H_ #define _MACHINE_HASIVO_S1100P_8GT_1SX_S_H_
#define MACHINE_MODEL "Hasivo S1100P-8GT-1SX-S" #define MACHINE_MODEL "Hasivo S1100P-8GT-1SX-S"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_HASIVO_S1100WP_8GT_1SX_SE_H_ #define _MACHINE_HASIVO_S1100WP_8GT_1SX_SE_H_
#define MACHINE_MODEL "Hasivo S1100WP-8GT-1SX-SE" #define MACHINE_MODEL "Hasivo S1100WP-8GT-1SX-SE"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 0, .n_sfp = 0,
.n_10g = 2, .n_10g = 2,
.log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_HASIVO_S600W_4GT_2XGT_SE_H_ #define _MACHINE_HASIVO_S600W_4GT_2XGT_SE_H_
#define MACHINE_MODEL "Hasivo S600W-4GT-2XGT-SE" #define MACHINE_MODEL "Hasivo S600W-4GT-2XGT-SE"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_HC_SWTG124AS_H_ #define _MACHINE_HC_SWTG124AS_H_
#define MACHINE_MODEL "Horaco HC-SWTG124AS" #define MACHINE_MODEL "Horaco HC-SWTG124AS"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6},
.phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_HG0402XG_V1_1_H_ #define _MACHINE_HG0402XG_V1_1_H_
#define MACHINE_MODEL "HG0402XG V1.1" #define MACHINE_MODEL "HG0402XG V1.1"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5},
.phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_HI_K0402WS_H_ #define _MACHINE_HI_K0402WS_H_
#define MACHINE_MODEL "PCB-K0402WS-V3.0" #define MACHINE_MODEL "PCB-K0402WS-V3.0"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -0,0 +1 @@
KP_9000_6XH_X2_init.c
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_HI_K0801WS_H_ #define _MACHINE_HI_K0801WS_H_
#define MACHINE_MODEL "Hi-Source HI-k0801WS" #define MACHINE_MODEL "Hi-Source HI-k0801WS"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6},
.phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_K0501W_V2_0_H_ #define _MACHINE_K0501W_V2_0_H_
#define MACHINE_MODEL "K0501W V2.0" #define MACHINE_MODEL "K0501W V2.0"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6},
.phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_6XHML_X2_H_ #define _MACHINE_KP_9000_6XHML_X2_H_
#define MACHINE_MODEL "keepLink KP-9000-6XHML-X2" #define MACHINE_MODEL "keepLink KP-9000-6XHML-X2"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_6XHML_X2_V1_1_H_ #define _MACHINE_KP_9000_6XHML_X2_V1_1_H_
#define MACHINE_MODEL "keepLink KP-9000-6XHML V1.1" #define MACHINE_MODEL "keepLink KP-9000-6XHML V1.1"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_6XHML_X2_V1_2_H_ #define _MACHINE_KP_9000_6XHML_X2_V1_2_H_
#define MACHINE_MODEL "keepLink KP-9000-6XHML V1.2" #define MACHINE_MODEL "keepLink KP-9000-6XHML V1.2"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_6XHML_X2_V2_1_H_ #define _MACHINE_KP_9000_6XHML_X2_V2_1_H_
#define MACHINE_MODEL "keepLink KP-9000-6XHML V2.1" #define MACHINE_MODEL "keepLink KP-9000-6XHML V2.1"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -0,0 +1 @@
KP_9000_6XH_X2_init.c
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6},
.phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_6XH_X_H_ #define _MACHINE_KP_9000_6XH_X_H_
#define MACHINE_MODEL "keepLink KP-9000-6XH-X" #define MACHINE_MODEL "keepLink KP-9000-6XH-X"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5},
.phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_6XH_X2_H_ #define _MACHINE_KP_9000_6XH_X2_H_
#define MACHINE_MODEL "keepLink KP-9000-6XH-X2" #define MACHINE_MODEL "keepLink KP-9000-6XH-X2"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_6XH_X2_V1_1_H_ #define _MACHINE_KP_9000_6XH_X2_V1_1_H_
#define MACHINE_MODEL "keepLink KP-9000-6XH V1.1" #define MACHINE_MODEL "keepLink KP-9000-6XH V1.1"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_6XH_X2_V1_2_H_ #define _MACHINE_KP_9000_6XH_X2_V1_2_H_
#define MACHINE_MODEL "keepLink KP-9000-6XH V1.2" #define MACHINE_MODEL "keepLink KP-9000-6XH V1.2"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_6XH_X2_V2_1_H_ #define _MACHINE_KP_9000_6XH_X2_V2_1_H_
#define MACHINE_MODEL "keepLink KP-9000-6XH-X2 V2.1" #define MACHINE_MODEL "keepLink KP-9000-6XH-X2 V2.1"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -0,0 +1 @@
KP_9000_6XH_X2_init.c
+6
View File
@@ -0,0 +1,6 @@
#include "machine_init_defs.h"
void machine_custom_init(void) __banked
{
reg_bit_set(RTL837X_REG_LED_GLB_IO_EN, 6);
}
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, .log_to_phys_port = { 1, 2, 3, 4, 5, 6, 7, 8, 9 },
.phys_to_log_port = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, .phys_to_log_port = { 0, 1, 2, 3, 4, 5, 6, 7, 8 },
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_9XHML_X_V2_2_H_ #define _MACHINE_KP_9000_9XHML_X_V2_2_H_
#define MACHINE_MODEL "keepLink KP-9000-9XHML-X V2.2" #define MACHINE_MODEL "keepLink KP-9000-9XHML-X V2.2"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -2,10 +2,7 @@
// 2M-PCB23-V3.2 is wired like V3.1 (SFP detection, LEDs, factory MAC location) // 2M-PCB23-V3.2 is wired like V3.1 (SFP detection, LEDs, factory MAC location)
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_9XHML_X_V3_1_H_ #define _MACHINE_KP_9000_9XHML_X_V3_1_H_
#define MACHINE_MODEL "keepLink KP-9000-9XHML-X V3.1" #define MACHINE_MODEL "keepLink KP-9000-9XHML-X V3.1"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_9XHML_X_V3_2_H_ #define _MACHINE_KP_9000_9XHML_X_V3_2_H_
#define MACHINE_MODEL "keepLink KP-9000-9XHML-X V3.2" #define MACHINE_MODEL "keepLink KP-9000-9XHML-X V3.2"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_KP_9000_9XH_X_EU_H_ #define _MACHINE_KP_9000_9XH_X_EU_H_
#define MACHINE_MODEL "keepLink KP-9000-9XH-X-EU" #define MACHINE_MODEL "keepLink KP-9000-9XH-X-EU"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {2, 1, 4, 3, 5, 6, 7, 8, 9}, .log_to_phys_port = {2, 1, 4, 3, 5, 6, 7, 8, 9},
.phys_to_log_port = {1, 0, 3, 2, 4, 5, 6, 7, 8}, .phys_to_log_port = {1, 0, 3, 2, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_LIANGUO_HYWS_SGT0108S_H_ #define _MACHINE_LIANGUO_HYWS_SGT0108S_H_
#define MACHINE_MODEL "Lianguo HYWS-SGT0108S" #define MACHINE_MODEL "Lianguo HYWS-SGT0108S"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,11 +1,8 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.mac_flash_offset = 0x1FC000, .mac_flash_offset = 0x1FC000,
.min_port = 3,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6},
.phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_LIANGUO_ZX_SWTGW215AS_H_ #define _MACHINE_LIANGUO_ZX_SWTGW215AS_H_
#define MACHINE_MODEL "Lianguo ZX-SWTGW215AS" #define MACHINE_MODEL "Lianguo ZX-SWTGW215AS"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 5, 4, 3, 2, 1, 6}, .log_to_phys_port = {0, 0, 0, 5, 4, 3, 2, 1, 6},
.phys_to_log_port = {7, 6, 5, 4, 3, 8, 0, 0, 0}, .phys_to_log_port = {7, 6, 5, 4, 3, 8, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_ONT_S207CW_62TS_SE_H_ #define _MACHINE_ONT_S207CW_62TS_SE_H_
#define MACHINE_MODEL "ONT-S207CW-62TS-SE / Binardat 2G06-04210GSM / Binardat 2G06-04210GS" #define MACHINE_MODEL "ONT-S207CW-62TS-SE / Binardat 2G06-04210GSM / Binardat 2G06-04210GS"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_PB_2132_H_ #define _MACHINE_PB_2132_H_
#define MACHINE_MODEL "PB-2132" #define MACHINE_MODEL "PB-2132"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5},
.phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_PCB_K0402WS_V1_H_ #define _MACHINE_PCB_K0402WS_V1_H_
#define MACHINE_MODEL "PCB-K0402WS-V1.0" #define MACHINE_MODEL "PCB-K0402WS-V1.0"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5},
.phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_PCB_K0402WS_V2_H_ #define _MACHINE_PCB_K0402WS_V2_H_
#define MACHINE_MODEL "PCB-K0402WS-V2.0" #define MACHINE_MODEL "PCB-K0402WS-V2.0"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -0,0 +1 @@
KP_9000_6XH_X2_init.c
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_PCB_K0402WS_V3_H_ #define _MACHINE_PCB_K0402WS_V3_H_
#define MACHINE_MODEL "PCB-K0402WS-V3.0" #define MACHINE_MODEL "PCB-K0402WS-V3.0"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -0,0 +1 @@
KP_9000_6XH_X2_init.c
+1 -4
View File
@@ -2,11 +2,8 @@
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.mac_flash_offset = 0x1FC000, .mac_flash_offset = 0x1FC000,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_PCB_SWTG018AS_V2_1_0_H_ #define _MACHINE_PCB_SWTG018AS_V2_1_0_H_
#define MACHINE_MODEL "SWTGW218AS (SWTG018AS-V2.1.0)" #define MACHINE_MODEL "SWTGW218AS (SWTG018AS-V2.1.0)"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+18
View File
@@ -0,0 +1,18 @@
#include "machine_init_defs.h"
static __code const struct { uint16_t reg; uint32_t val; } custom_init_regs[] = {
{ RTL837X_REG_LED3_0_SET1, 0x00100000UL },
{ RTL837X_REG_LED1_0_SET1, 0x01400155UL },
{ RTL837X_REG_LED1_0_SET0, 0x01740141UL },
{ RTL837X_REG_LED_GLB_IO_EN, 0x7f24977fUL },
{ RTL837X_PIN_MUX_0, 0x20db6880UL },
};
void machine_custom_init(void) __banked
{
uint8_t i;
// REG_SET is a multi-statement macro without a do-while wrapper: braces required
for (i = 0; i < sizeof(custom_init_regs) / sizeof(custom_init_regs[0]); i++) {
REG_SET(custom_init_regs[i].reg, custom_init_regs[i].val);
}
}
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6},
.phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_PCB_SWTG024AS_A_2_0_1_H_ #define _MACHINE_PCB_SWTG024AS_A_2_0_1_H_
#define MACHINE_MODEL "PCB-SWTG024AS-A-2.0.1" #define MACHINE_MODEL "PCB-SWTG024AS-A-2.0.1"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+9
View File
@@ -0,0 +1,9 @@
#include "machine_init_defs.h"
void machine_custom_init(void) __banked
{
reg_bit_set(RTL837X_REG_LED_GLB_IO_EN, 6);
reg_bit_set(RTL837X_REG_LED_MODE, 17);
reg_bit_clear(RTL837X_REG_LED_MODE, 9);
reg_bit_clear(RTL837X_REG_LED_MODE, 7);
}
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 1,
.min_port = 0,
.max_port = 8,
.n_sfp = 1, .n_sfp = 1,
.log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9},
.phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_POE_2G080110GS_H_ #define _MACHINE_POE_2G080110GS_H_
#define MACHINE_MODEL "MokerLink POE-2G080110GS" #define MACHINE_MODEL "MokerLink POE-2G080110GS"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5},
.phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_SIRIVISION_S25G2206FP_V1_1_H_ #define _MACHINE_SIRIVISION_S25G2206FP_V1_1_H_
#define MACHINE_MODEL "SIRIVISION S25G2206FP V1.1" #define MACHINE_MODEL "SIRIVISION S25G2206FP V1.1"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1
View File
@@ -2,6 +2,7 @@
#define _MACHINE_SKS3200_8E1X_H_ #define _MACHINE_SKS3200_8E1X_H_
#define MACHINE_MODEL "XikeStor SKS3200-8E1X" #define MACHINE_MODEL "XikeStor SKS3200-8E1X"
#define MACHINE_CHIPSET RTL8373
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5},
.phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_STEAMEMO_IG204_V1_H_ #define _MACHINE_STEAMEMO_IG204_V1_H_
#define MACHINE_MODEL "Steamemo IG204 V1" #define MACHINE_MODEL "Steamemo IG204 V1"
#define MACHINE_CHIPSET RTL8372
#endif #endif
+1 -4
View File
@@ -1,10 +1,7 @@
#include "machine_defs.h" #include "machine_defs.h"
__code const struct machine machine = { __code const struct machine machine = {
.machine_name = MACHINE_MODEL, MACHINE_COMMON_SETTING,
.isRTL8373 = 0,
.min_port = 3,
.max_port = 8,
.n_sfp = 2, .n_sfp = 2,
.log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5},
.phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0},
+1
View File
@@ -2,5 +2,6 @@
#define _MACHINE_SWGT024_V2_0_MANAGED_H_ #define _MACHINE_SWGT024_V2_0_MANAGED_H_
#define MACHINE_MODEL "SWGT024 V2.0 Managed" #define MACHINE_MODEL "SWGT024 V2.0 Managed"
#define MACHINE_CHIPSET RTL8372
#endif #endif
Loaded 100 of 145 files, more files were not shown because too many files have changed in this diff. Show more