mirror of https://github.com/hak5/openwrt.git
ip17xx: Fix indentation in get_state() and update_state()
Signed-off-by: Martin Mares <mj@ucw.cz> Signed-off-by: Patrick Horn <patrick.horn@gmail.com> SVN-Revision: 21712lede-17.01
parent
7b5a77fa39
commit
f09e3fb65b
|
@ -440,39 +440,39 @@ static int get_state(struct ip175c_state *state)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (REG_SUPP(state->regs->VLAN_LOOKUP_REG)) {
|
if (REG_SUPP(state->regs->VLAN_LOOKUP_REG)) {
|
||||||
for (j=0; j<MAX_PORTS; j++) {
|
for (j=0; j<MAX_PORTS; j++) {
|
||||||
state->ports[j].shareports = 0; // initialize them in case.
|
state->ports[j].shareports = 0; // initialize them in case.
|
||||||
}
|
}
|
||||||
for (j=0; j<state->regs->NUM_PORTS; j++) {
|
for (j=0; j<state->regs->NUM_PORTS; j++) {
|
||||||
reg addr;
|
reg addr;
|
||||||
const bitnum *bit_lookup = (j%2==0)?
|
const bitnum *bit_lookup = (j%2==0)?
|
||||||
state->regs->VLAN_LOOKUP_EVEN_BIT:
|
state->regs->VLAN_LOOKUP_EVEN_BIT:
|
||||||
state->regs->VLAN_LOOKUP_ODD_BIT;
|
state->regs->VLAN_LOOKUP_ODD_BIT;
|
||||||
addr = state->regs->VLAN_LOOKUP_REG;
|
addr = state->regs->VLAN_LOOKUP_REG;
|
||||||
if (state->regs->SIMPLE_VLAN_REGISTERS) {
|
if (state->regs->SIMPLE_VLAN_REGISTERS) {
|
||||||
addr.m += j;
|
addr.m += j;
|
||||||
} else {
|
} else {
|
||||||
switch (j) {
|
switch (j) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
addr.m+=1;
|
addr.m+=1;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
addr.m+=2;
|
addr.m+=2;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
addr = state->regs->VLAN_LOOKUP_REG_5;
|
addr = state->regs->VLAN_LOOKUP_REG_5;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (REG_SUPP(addr)) {
|
||||||
|
GET_PORT_BITS(state, state->ports[j].shareports, addr, bit_lookup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (REG_SUPP(addr)) {
|
|
||||||
GET_PORT_BITS(state, state->ports[j].shareports, addr, bit_lookup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
for (j=0; j<MAX_PORTS; j++) {
|
for (j=0; j<MAX_PORTS; j++) {
|
||||||
state->ports[j].shareports = 0xff;
|
state->ports[j].shareports = 0xff;
|
||||||
|
@ -568,57 +568,57 @@ static int update_state(struct ip175c_state *state)
|
||||||
state->regs->REMOVE_TAG_REG, state->regs->REMOVE_TAG_BIT);
|
state->regs->REMOVE_TAG_REG, state->regs->REMOVE_TAG_BIT);
|
||||||
|
|
||||||
if (REG_SUPP(state->regs->VLAN_LOOKUP_REG)) {
|
if (REG_SUPP(state->regs->VLAN_LOOKUP_REG)) {
|
||||||
for (j=0; j<state->regs->NUM_PORTS; j++) {
|
for (j=0; j<state->regs->NUM_PORTS; j++) {
|
||||||
reg addr;
|
reg addr;
|
||||||
const bitnum *bit_lookup = (j%2==0)?
|
const bitnum *bit_lookup = (j%2==0)?
|
||||||
state->regs->VLAN_LOOKUP_EVEN_BIT:
|
state->regs->VLAN_LOOKUP_EVEN_BIT:
|
||||||
state->regs->VLAN_LOOKUP_ODD_BIT;
|
state->regs->VLAN_LOOKUP_ODD_BIT;
|
||||||
|
|
||||||
// duplicate code -- sorry
|
// duplicate code -- sorry
|
||||||
addr = state->regs->VLAN_LOOKUP_REG;
|
addr = state->regs->VLAN_LOOKUP_REG;
|
||||||
if (state->regs->SIMPLE_VLAN_REGISTERS) {
|
if (state->regs->SIMPLE_VLAN_REGISTERS) {
|
||||||
addr.m += j;
|
addr.m += j;
|
||||||
} else {
|
} else {
|
||||||
switch (j) {
|
switch (j) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
addr.m+=1;
|
addr.m+=1;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
addr.m+=2;
|
addr.m+=2;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
addr = state->regs->VLAN_LOOKUP_REG_5;
|
addr = state->regs->VLAN_LOOKUP_REG_5;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
addr.m = -1; // shouldn't get here, but...
|
addr.m = -1; // shouldn't get here, but...
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//printf("shareports for %d is %02X\n",j,state->ports[j].shareports);
|
||||||
|
if (REG_SUPP(addr)) {
|
||||||
|
SET_PORT_BITS(state, state->ports[j].shareports, addr, bit_lookup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("shareports for %d is %02X\n",j,state->ports[j].shareports);
|
|
||||||
if (REG_SUPP(addr)) {
|
|
||||||
SET_PORT_BITS(state, state->ports[j].shareports, addr, bit_lookup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (REG_SUPP(state->regs->TAG_VLAN_MASK_REG)) {
|
if (REG_SUPP(state->regs->TAG_VLAN_MASK_REG)) {
|
||||||
for (j=0; j<MAX_VLANS; j++) {
|
for (j=0; j<MAX_VLANS; j++) {
|
||||||
reg addr = state->regs->TAG_VLAN_MASK_REG;
|
reg addr = state->regs->TAG_VLAN_MASK_REG;
|
||||||
const bitnum *bit_lookup = (j%2==0)?
|
const bitnum *bit_lookup = (j%2==0)?
|
||||||
state->regs->TAG_VLAN_MASK_EVEN_BIT:
|
state->regs->TAG_VLAN_MASK_EVEN_BIT:
|
||||||
state->regs->TAG_VLAN_MASK_ODD_BIT;
|
state->regs->TAG_VLAN_MASK_ODD_BIT;
|
||||||
unsigned int vlan_mask;
|
unsigned int vlan_mask;
|
||||||
if (state->regs->SIMPLE_VLAN_REGISTERS) {
|
if (state->regs->SIMPLE_VLAN_REGISTERS) {
|
||||||
addr.m += j;
|
addr.m += j;
|
||||||
} else {
|
} else {
|
||||||
addr.m += j/2;
|
addr.m += j/2;
|
||||||
|
}
|
||||||
|
vlan_mask = state->vlan_ports[j];
|
||||||
|
SET_PORT_BITS(state, vlan_mask, addr, bit_lookup);
|
||||||
}
|
}
|
||||||
vlan_mask = state->vlan_ports[j];
|
|
||||||
SET_PORT_BITS(state, vlan_mask, addr, bit_lookup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<MAX_PORTS; i++) {
|
for (i=0; i<MAX_PORTS; i++) {
|
||||||
|
|
Loading…
Reference in New Issue