mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Merge pull request #476 from bloqaudio/fix/eee-port-argument
eee: accept a port again, and stop the web UI discarding other ports
This commit is contained in:
3 files changed
+12
-7
No files matched your search
+1
-1
@@ -1427,7 +1427,7 @@ void parse_eee(void)
|
||||
speed_word = 2;
|
||||
} else if (cmd_is_space_or_nul(idx)) {
|
||||
// Word 2 is a port number
|
||||
if (cmd_parse_port_separator(idx) == 0) {
|
||||
if (cmd_parse_port_separator(cmd_words_b[2]) == 0) {
|
||||
cmd_error("Speed word invalid, use: [100m|1g|2g5]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
+8
-3
@@ -434,7 +434,7 @@ var CONF_CMDS=[
|
||||
/^ingress(\s+\d{1,2}[tua])+$/,/^ingress\s+[tua]$/,
|
||||
/^port\s+\d{1,2}\s+(10m|100m|1g|2g5|5g|10g|auto|on|off)(\s+(half|full))?$/,
|
||||
/^port\s+\d{1,2}\s+name\s+\S+$/,
|
||||
/^eee(\s+\d{1,2})?\s+(on|off)$/,
|
||||
/^eee\s+(on|off)(\s+\d{1,2})?(\s+(100m|1g|2g5))?$/,
|
||||
/^mirror(\s+\d{1,2})(\s+\d{1,2}[tr]?)+$/,/^mirror\s+off$/,
|
||||
/^lag\s+[1-4](\s+\d{1,2})+$/,/^lag\s+[1-4]\s+d$/,/^laghash\s+[1-4](\s+\w+)+$/,
|
||||
/^isolate\s+\d{1,2}(\s+(off|\d{1,2}))+$/,
|
||||
@@ -1432,7 +1432,7 @@ function eeeLoad(){
|
||||
var on=parseInt(p.eee,2)!==0;
|
||||
var sw=h("label",{class:"switch"},[
|
||||
h("input",{type:"checkbox",onchange:function(){
|
||||
postCmd("eee "+p.portNum+" "+(this.checked?"on":"off"))
|
||||
postCmd("eee "+(this.checked?"on":"off")+" "+p.portNum)
|
||||
.then(function(){setTimeout(eeeLoad,300)}).catch(function(){});
|
||||
}}),h("i")]);
|
||||
sw.firstChild.checked=on;
|
||||
@@ -1624,7 +1624,7 @@ var CONF_OVERWRITE=[
|
||||
/^vlan\s+\d{1,4}\s+mgmt$/,/^vlan\s+\d{1,4}(?!\s+mgmt\b)/,
|
||||
/^pvid\s+\d{1,2}\b/,/^ingress\b/,
|
||||
/^port\s+\d{1,2}(?!\s+name\b)/,/^port\s+\d{1,2}\s+name\b/,
|
||||
/^eee\s+\d{1,2}\b/,/^eee\b/,/^mirror\b/,
|
||||
/^mirror\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+(port\s+\d{1,2}|lag\s+[1-4])\s+(edge|cost|prio|guard|filter|p2p)\b/,
|
||||
@@ -1641,6 +1641,11 @@ function mergeConf(base,texts){
|
||||
var m;
|
||||
if((m=line.match(/^vlan (\d{1,4}) d$/))){drop(new RegExp("^vlan "+m[1]+"( |$)"));return;}
|
||||
if((m=line.match(/^lag (\d) d$/))){drop(new RegExp("^lag(hash)? "+m[1]+"( |$)"));return;}
|
||||
if((m=line.match(/^eee (on|off)(?: (\d{1,2}))?(?: (?:100m|1g|2g5))?$/))){
|
||||
if(m[2])drop(new RegExp("^eee (on|off) "+m[2]+"\\b"));
|
||||
else drop(/^eee /);
|
||||
conf.push(line);return;
|
||||
}
|
||||
if(line==="mirror off"){drop(/^mirror /);return;}
|
||||
if(!isConfCmd(line))return;
|
||||
if((m=line.match(/^bw (in|out) (\d{1,2}) (\S+)$/))){
|
||||
|
||||
+3
-3
@@ -590,12 +590,12 @@ void port_eee_enable(__xdata uint8_t port,__xdata uint8_t speed) __banked
|
||||
|
||||
if (machine.is_sfp[port])
|
||||
{
|
||||
print_string("EEE can't be enabled for SFP port "); print_byte(port); print_string("\n");
|
||||
print_string("EEE can't be enabled for SFP port "); print_phys_port(port); print_string("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
REG_SET(RTL837X_EEE_CTRL_BASE + (port << 8), EEE_RX_ENABLE | EEE_TX_ENABLE);
|
||||
print_string("EEE on for "); print_byte(port); print_string(" speed ");
|
||||
print_string("EEE on for "); print_phys_port(port); print_string(" speed ");
|
||||
// Enable all speeds up to the specified speed
|
||||
if (speed & EEE_100) {
|
||||
print_string("100m\n");
|
||||
@@ -654,7 +654,7 @@ void port_eee_disable(uint8_t port) __banked
|
||||
if (machine.is_sfp[port])
|
||||
return;
|
||||
|
||||
print_string("EEE off for "); print_byte(port); write_char('\n');
|
||||
print_string("EEE off for "); print_phys_port(port); write_char('\n');
|
||||
REG_SET(RTL837X_EEE_CTRL_BASE + (port << 8), 0);
|
||||
// Disable EEE advertisement for 100/1000BASE-T via EEE Advertisement Reg
|
||||
phy_write(port, PHY_MMD_AN, PHY_EEE_ADV, 0);
|
||||
|
||||
Reference in new issue
Block a user