Skip to content

Commit

Permalink
generic ar8xxx: increase VLAN table for AR83x7
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Dec 5, 2019
1 parent ce2db4d commit 7a5b477
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 5 additions & 5 deletions target/linux/generic/files/drivers/net/phy/ar8216.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ ar8xxx_sw_set_vid(struct switch_dev *dev, const struct switch_attr *attr,
{
struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev);

if (val->port_vlan >= AR8X16_MAX_VLANS)
if (val->port_vlan >= dev->vlans)
return -EINVAL;

priv->vlan_id[val->port_vlan] = val->value.i;
Expand Down Expand Up @@ -1018,7 +1018,7 @@ ar8xxx_sw_get_ports(struct switch_dev *dev, struct switch_val *val)
u8 ports;
int i;

if (val->port_vlan >= AR8X16_MAX_VLANS)
if (val->port_vlan >= dev->vlans)
return -EINVAL;

ports = priv->vlan_table[val->port_vlan];
Expand Down Expand Up @@ -1058,7 +1058,7 @@ ar8xxx_sw_set_ports(struct switch_dev *dev, struct switch_val *val)

/* make sure that an untagged port does not
* appear in other vlans */
for (j = 0; j < AR8X16_MAX_VLANS; j++) {
for (j = 0; j < dev->vlans; j++) {
if (j == val->port_vlan)
continue;
priv->vlan_table[j] &= ~(1 << p->id);
Expand Down Expand Up @@ -1137,7 +1137,7 @@ ar8xxx_sw_hw_apply(struct switch_dev *dev)
if (!priv->init) {
/* calculate the port destination masks and load vlans
* into the vlan translation unit */
for (j = 0; j < AR8X16_MAX_VLANS; j++) {
for (j = 0; j < dev->vlans; j++) {
u8 vp = priv->vlan_table[j];

if (!vp)
Expand Down Expand Up @@ -1190,7 +1190,7 @@ ar8xxx_sw_reset_switch(struct switch_dev *dev)
memset(&priv->vlan, 0, sizeof(struct ar8xxx_priv) -
offsetof(struct ar8xxx_priv, vlan));

for (i = 0; i < AR8X16_MAX_VLANS; i++)
for (i = 0; i < dev->vlans; i++)
priv->vlan_id[i] = i;

/* Configure all ports */
Expand Down
8 changes: 6 additions & 2 deletions target/linux/generic/files/drivers/net/phy/ar8216.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

/* size of the vlan table */
#define AR8X16_MAX_VLANS 128
#define AR83X7_MAX_VLANS 4096
#define AR8XXX_MAX_VLANS AR83X7_MAX_VLANS

#define AR8X16_PROBE_RETRIES 10
#define AR8X16_MAX_PORTS 8

Expand Down Expand Up @@ -453,8 +456,9 @@ struct ar8xxx_priv {

/* all fields below are cleared on reset */
bool vlan;
u16 vlan_id[AR8X16_MAX_VLANS];
u8 vlan_table[AR8X16_MAX_VLANS];

u16 vlan_id[AR8XXX_MAX_VLANS];
u8 vlan_table[AR8XXX_MAX_VLANS];
u8 vlan_tagged;
u16 pvid[AR8X16_MAX_PORTS];
int arl_age_time;
Expand Down
4 changes: 2 additions & 2 deletions target/linux/generic/files/drivers/net/phy/ar8327.c
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ const struct ar8xxx_chip ar8327_chip = {

.name = "Atheros AR8327",
.ports = AR8327_NUM_PORTS,
.vlans = AR8X16_MAX_VLANS,
.vlans = AR83X7_MAX_VLANS,
.swops = &ar8327_sw_ops,

.reg_port_stats_start = 0x1000,
Expand Down Expand Up @@ -1511,7 +1511,7 @@ const struct ar8xxx_chip ar8337_chip = {

.name = "Atheros AR8337",
.ports = AR8327_NUM_PORTS,
.vlans = AR8X16_MAX_VLANS,
.vlans = AR83X7_MAX_VLANS,
.swops = &ar8327_sw_ops,

.reg_port_stats_start = 0x1000,
Expand Down

0 comments on commit 7a5b477

Please sign in to comment.