diff options
| author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2017-05-01 14:05:10 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-05-01 15:03:09 -0400 |
| commit | 3cf3c8469f70d18f8bbcdf8361e62812ebc571cd (patch) | |
| tree | cfbd12bbb9d50526dc301df669e48a1d01ea3cbb | |
| parent | 152afb9b45a8af4a93699a15925c392a28182a26 (diff) | |
net: dsa: mv88e6xxx: add max VID to info
Some chips don't have a VLAN Table Unit, most of them do have a 4K
table, some others as the 88E6390 family has a 13th bit for the VID.
Add a new max_vid member to the info structure, used to check the
presence of a VTU as well as the value used to iterate from in VTU
GetNext operations.
This makes the MV88E6XXX_FLAG_VTU obsolete, thus remove it.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.c | 38 | ||||
| -rw-r--r-- | drivers/net/dsa/mv88e6xxx/mv88e6xxx.h | 13 |
2 files changed, 31 insertions, 20 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 44ba8cff5631..e45ddf3e90e8 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c | |||
| @@ -1440,7 +1440,7 @@ static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port, | |||
| 1440 | u16 pvid; | 1440 | u16 pvid; |
| 1441 | int err; | 1441 | int err; |
| 1442 | 1442 | ||
| 1443 | if (!mv88e6xxx_has(chip, MV88E6XXX_FLAG_VTU)) | 1443 | if (!chip->info->max_vid) |
| 1444 | return -EOPNOTSUPP; | 1444 | return -EOPNOTSUPP; |
| 1445 | 1445 | ||
| 1446 | mutex_lock(&chip->reg_lock); | 1446 | mutex_lock(&chip->reg_lock); |
| @@ -1478,7 +1478,7 @@ static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port, | |||
| 1478 | err = cb(&vlan->obj); | 1478 | err = cb(&vlan->obj); |
| 1479 | if (err) | 1479 | if (err) |
| 1480 | break; | 1480 | break; |
| 1481 | } while (next.vid < GLOBAL_VTU_VID_MASK); | 1481 | } while (next.vid < chip->info->max_vid); |
| 1482 | 1482 | ||
| 1483 | unlock: | 1483 | unlock: |
| 1484 | mutex_unlock(&chip->reg_lock); | 1484 | mutex_unlock(&chip->reg_lock); |
| @@ -1640,7 +1640,7 @@ static int mv88e6xxx_atu_new(struct mv88e6xxx_chip *chip, u16 *fid) | |||
| 1640 | break; | 1640 | break; |
| 1641 | 1641 | ||
| 1642 | set_bit(vlan.fid, fid_bitmap); | 1642 | set_bit(vlan.fid, fid_bitmap); |
| 1643 | } while (vlan.vid < GLOBAL_VTU_VID_MASK); | 1643 | } while (vlan.vid < chip->info->max_vid); |
| 1644 | 1644 | ||
| 1645 | /* The reset value 0x000 is used to indicate that multiple address | 1645 | /* The reset value 0x000 is used to indicate that multiple address |
| 1646 | * databases are not needed. Return the next positive available. | 1646 | * databases are not needed. Return the next positive available. |
| @@ -1799,7 +1799,7 @@ static int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port, | |||
| 1799 | PORT_CONTROL_2_8021Q_DISABLED; | 1799 | PORT_CONTROL_2_8021Q_DISABLED; |
| 1800 | int err; | 1800 | int err; |
| 1801 | 1801 | ||
| 1802 | if (!mv88e6xxx_has(chip, MV88E6XXX_FLAG_VTU)) | 1802 | if (!chip->info->max_vid) |
| 1803 | return -EOPNOTSUPP; | 1803 | return -EOPNOTSUPP; |
| 1804 | 1804 | ||
| 1805 | mutex_lock(&chip->reg_lock); | 1805 | mutex_lock(&chip->reg_lock); |
| @@ -1817,7 +1817,7 @@ mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, | |||
| 1817 | struct mv88e6xxx_chip *chip = ds->priv; | 1817 | struct mv88e6xxx_chip *chip = ds->priv; |
| 1818 | int err; | 1818 | int err; |
| 1819 | 1819 | ||
| 1820 | if (!mv88e6xxx_has(chip, MV88E6XXX_FLAG_VTU)) | 1820 | if (!chip->info->max_vid) |
| 1821 | return -EOPNOTSUPP; | 1821 | return -EOPNOTSUPP; |
| 1822 | 1822 | ||
| 1823 | /* If the requested port doesn't belong to the same bridge as the VLAN | 1823 | /* If the requested port doesn't belong to the same bridge as the VLAN |
| @@ -1860,7 +1860,7 @@ static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, | |||
| 1860 | bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID; | 1860 | bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID; |
| 1861 | u16 vid; | 1861 | u16 vid; |
| 1862 | 1862 | ||
| 1863 | if (!mv88e6xxx_has(chip, MV88E6XXX_FLAG_VTU)) | 1863 | if (!chip->info->max_vid) |
| 1864 | return; | 1864 | return; |
| 1865 | 1865 | ||
| 1866 | mutex_lock(&chip->reg_lock); | 1866 | mutex_lock(&chip->reg_lock); |
| @@ -1921,7 +1921,7 @@ static int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, | |||
| 1921 | u16 pvid, vid; | 1921 | u16 pvid, vid; |
| 1922 | int err = 0; | 1922 | int err = 0; |
| 1923 | 1923 | ||
| 1924 | if (!mv88e6xxx_has(chip, MV88E6XXX_FLAG_VTU)) | 1924 | if (!chip->info->max_vid) |
| 1925 | return -EOPNOTSUPP; | 1925 | return -EOPNOTSUPP; |
| 1926 | 1926 | ||
| 1927 | mutex_lock(&chip->reg_lock); | 1927 | mutex_lock(&chip->reg_lock); |
| @@ -2090,7 +2090,7 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port, | |||
| 2090 | int (*cb)(struct switchdev_obj *obj)) | 2090 | int (*cb)(struct switchdev_obj *obj)) |
| 2091 | { | 2091 | { |
| 2092 | struct mv88e6xxx_vtu_entry vlan = { | 2092 | struct mv88e6xxx_vtu_entry vlan = { |
| 2093 | .vid = GLOBAL_VTU_VID_MASK, /* all ones */ | 2093 | .vid = chip->info->max_vid, |
| 2094 | }; | 2094 | }; |
| 2095 | u16 fid; | 2095 | u16 fid; |
| 2096 | int err; | 2096 | int err; |
| @@ -2121,7 +2121,7 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port, | |||
| 2121 | obj, cb); | 2121 | obj, cb); |
| 2122 | if (err) | 2122 | if (err) |
| 2123 | return err; | 2123 | return err; |
| 2124 | } while (vlan.vid < GLOBAL_VTU_VID_MASK); | 2124 | } while (vlan.vid < chip->info->max_vid); |
| 2125 | 2125 | ||
| 2126 | return err; | 2126 | return err; |
| 2127 | } | 2127 | } |
| @@ -3685,6 +3685,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 3685 | .name = "Marvell 88E6085", | 3685 | .name = "Marvell 88E6085", |
| 3686 | .num_databases = 4096, | 3686 | .num_databases = 4096, |
| 3687 | .num_ports = 10, | 3687 | .num_ports = 10, |
| 3688 | .max_vid = 4095, | ||
| 3688 | .port_base_addr = 0x10, | 3689 | .port_base_addr = 0x10, |
| 3689 | .global1_addr = 0x1b, | 3690 | .global1_addr = 0x1b, |
| 3690 | .age_time_coeff = 15000, | 3691 | .age_time_coeff = 15000, |
| @@ -3702,6 +3703,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 3702 | .name = "Marvell 88E6095/88E6095F", | 3703 | .name = "Marvell 88E6095/88E6095F", |
| 3703 | .num_databases = 256, | 3704 | .num_databases = 256, |
| 3704 | .num_ports = 11, | 3705 | .num_ports = 11, |
| 3706 | .max_vid = 4095, | ||
| 3705 | .port_base_addr = 0x10, | 3707 | .port_base_addr = 0x10, |
| 3706 | .global1_addr = 0x1b, | 3708 | .global1_addr = 0x1b, |
| 3707 | .age_time_coeff = 15000, | 3709 | .age_time_coeff = 15000, |
| @@ -3718,6 +3720,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 3718 | .name = "Marvell 88E6097/88E6097F", | 3720 | .name = "Marvell 88E6097/88E6097F", |
| 3719 | .num_databases = 4096, | 3721 | .num_databases = 4096, |
| 3720 | .num_ports = 11, | 3722 | .num_ports = 11, |
| 3723 | .max_vid = 4095, | ||
| 3721 | .port_base_addr = 0x10, | 3724 | .port_base_addr = 0x10, |
| 3722 | .global1_addr = 0x1b, | 3725 | .global1_addr = 0x1b, |
| 3723 | .age_time_coeff = 15000, | 3726 | .age_time_coeff = 15000, |
| @@ -3735,6 +3738,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 3735 | .name = "Marvell 88E6123", | 3738 | .name = "Marvell 88E6123", |
| 3736 | .num_databases = 4096, | 3739 | .num_databases = 4096, |
| 3737 | .num_ports = 3, | 3740 | .num_ports = 3, |
| 3741 | .max_vid = 4095, | ||
| 3738 | .port_base_addr = 0x10, | 3742 | .port_base_addr = 0x10, |
| 3739 | .global1_addr = 0x1b, | 3743 | .global1_addr = 0x1b, |
| 3740 | .age_time_coeff = 15000, | 3744 | .age_time_coeff = 15000, |
| @@ -3752,6 +3756,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 3752 | .name = "Marvell 88E6131", | 3756 | .name = "Marvell 88E6131", |
| 3753 | .num_databases = 256, | 3757 | .num_databases = 256, |
| 3754 | .num_ports = 8, | 3758 | .num_ports = 8, |
| 3759 | .max_vid = 4095, | ||
| 3755 | .port_base_addr = 0x10, | 3760 | .port_base_addr = 0x10, |
| 3756 | .global1_addr = 0x1b, | 3761 | .global1_addr = 0x1b, |
| 3757 | .age_time_coeff = 15000, | 3762 | .age_time_coeff = 15000, |
| @@ -3768,6 +3773,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 3768 | .name = "Marvell 88E6341", | 3773 | .name = "Marvell 88E6341", |
| 3769 | .num_databases = 4096, | 3774 | .num_databases = 4096, |
| 3770 | .num_ports = 6, | 3775 | .num_ports = 6, |
| 3776 | .max_vid = 4095, | ||
| 3771 | .port_base_addr = 0x10, | 3777 | .port_base_addr = 0x10, |
| 3772 | .global1_addr = 0x1b, | 3778 | .global1_addr = 0x1b, |
| 3773 | .age_time_coeff = 3750, | 3779 | .age_time_coeff = 3750, |
| @@ -3784,6 +3790,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 3784 | .name = "Marvell 88E6161", | 3790 | .name = "Marvell 88E6161", |
| 3785 | .num_databases = 4096, | 3791 | .num_databases = 4096, |
| 3786 | .num_ports = 6, | 3792 | .num_ports = 6, |
| 3793 | .max_vid = 4095, | ||
| 3787 | .port_base_addr = 0x10, | 3794 | .port_base_addr = 0x10, |
| 3788 | .global1_addr = 0x1b, | 3795 | .global1_addr = 0x1b, |
| 3789 | .age_time_coeff = 15000, | 3796 | .age_time_coeff = 15000, |
| @@ -3801,6 +3808,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 3801 | .name = "Marvell 88E6165", | 3808 | .name = "Marvell 88E6165", |
| 3802 | .num_databases = 4096, | 3809 | .num_databases = 4096, |
| 3803 | .num_ports = 6, | 3810 | .num_ports = 6, |
| 3811 | .max_vid = 4095, | ||
| 3804 | .port_base_addr = 0x10, | 3812 | .port_base_addr = 0x10, |
| 3805 | .global1_addr = 0x1b, | 3813 | .global1_addr = 0x1b, |
| 3806 | .age_time_coeff = 15000, | 3814 | .age_time_coeff = 15000, |
| @@ -3818,6 +3826,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 3818 | .name = "Marvell 88E6171", | 3826 | .name = "Marvell 88E6171", |
| 3819 | .num_databases = 4096, | 3827 | .num_databases = 4096, |
| 3820 | .num_ports = 7, | ||
