The Atheros AR8327 and AR8337 have (according to their datasheet) a
VLAN table with a maximum of 4096 entries.
Currently, there's a hard limit of 128 VLANs, which is the same as
for most other Atheros switches. Increase this limit only for the
AR83x7 series and modify some shared functions to allow them to work
with a variable max VLAN count.
Signed-off-by: David Bauer <mail@david-bauer.net>
{
struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev);
{
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;
return -EINVAL;
priv->vlan_id[val->port_vlan] = val->value.i;
- if (val->port_vlan >= AR8X16_MAX_VLANS)
+ if (val->port_vlan >= dev->vlans)
return -EINVAL;
ports = priv->vlan_table[val->port_vlan];
return -EINVAL;
ports = priv->vlan_table[val->port_vlan];
/* make sure that an untagged port does not
* appear in other vlans */
/* 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);
if (j == val->port_vlan)
continue;
priv->vlan_table[j] &= ~(1 << p->id);
if (!priv->init) {
/* calculate the port destination masks and load vlans
* into the vlan translation unit */
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)
u8 vp = priv->vlan_table[j];
if (!vp)
memset(&priv->vlan, 0, sizeof(struct ar8xxx_priv) -
offsetof(struct ar8xxx_priv, vlan));
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 */
priv->vlan_id[i] = i;
/* Configure all ports */
/* size of the vlan table */
#define AR8X16_MAX_VLANS 128
/* 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
#define AR8X16_PROBE_RETRIES 10
#define AR8X16_MAX_PORTS 8
/* all fields below are cleared on reset */
bool vlan;
/* 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;
u8 vlan_tagged;
u16 pvid[AR8X16_MAX_PORTS];
int arl_age_time;
.name = "Atheros AR8327",
.ports = AR8327_NUM_PORTS,
.name = "Atheros AR8327",
.ports = AR8327_NUM_PORTS,
- .vlans = AR8X16_MAX_VLANS,
+ .vlans = AR83X7_MAX_VLANS,
.swops = &ar8327_sw_ops,
.reg_port_stats_start = 0x1000,
.swops = &ar8327_sw_ops,
.reg_port_stats_start = 0x1000,
.name = "Atheros AR8337",
.ports = AR8327_NUM_PORTS,
.name = "Atheros AR8337",
.ports = AR8327_NUM_PORTS,
- .vlans = AR8X16_MAX_VLANS,
+ .vlans = AR83X7_MAX_VLANS,
.swops = &ar8327_sw_ops,
.reg_port_stats_start = 0x1000,
.swops = &ar8327_sw_ops,
.reg_port_stats_start = 0x1000,