aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2016-09-29 12:21:58 -0400
committerDavid S. Miller <davem@davemloft.net>2016-09-30 01:25:59 -0400
commitb4e47c0fb94923781addbb4616fa82fd825ac7ec (patch)
tree5a317b78a0223a09e9be9d02080d4775b1b887fe
parent370b4ffbd8dda2b1a61dc63a5ac3088d8e715d53 (diff)
net: dsa: mv88e6xxx: rename mv88e6xxx_vtu_stu_entry
The STU (if the switch has one) is abstracted and accessed through the VTU operations and data registers. Thus rename the mv88e6xxx_vtu_stu_entry struct to mv88e6xxx_vtu_entry. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c46
-rw-r--r--drivers/net/dsa/mv88e6xxx/mv88e6xxx.h5
2 files changed, 24 insertions, 27 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 9056d9eb3c13..d805661af3cc 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1265,7 +1265,7 @@ static int _mv88e6xxx_vtu_stu_flush(struct mv88e6xxx_chip *chip)
1265} 1265}
1266 1266
1267static int _mv88e6xxx_vtu_stu_data_read(struct mv88e6xxx_chip *chip, 1267static int _mv88e6xxx_vtu_stu_data_read(struct mv88e6xxx_chip *chip,
1268 struct mv88e6xxx_vtu_stu_entry *entry, 1268 struct mv88e6xxx_vtu_entry *entry,
1269 unsigned int nibble_offset) 1269 unsigned int nibble_offset)
1270{ 1270{
1271 u16 regs[3]; 1271 u16 regs[3];
@@ -1290,19 +1290,19 @@ static int _mv88e6xxx_vtu_stu_data_read(struct mv88e6xxx_chip *chip,
1290} 1290}
1291 1291
1292static int mv88e6xxx_vtu_data_read(struct mv88e6xxx_chip *chip, 1292static int mv88e6xxx_vtu_data_read(struct mv88e6xxx_chip *chip,
1293 struct mv88e6xxx_vtu_stu_entry *entry) 1293 struct mv88e6xxx_vtu_entry *entry)
1294{ 1294{
1295 return _mv88e6xxx_vtu_stu_data_read(chip, entry, 0); 1295 return _mv88e6xxx_vtu_stu_data_read(chip, entry, 0);
1296} 1296}
1297 1297
1298static int mv88e6xxx_stu_data_read(struct mv88e6xxx_chip *chip, 1298static int mv88e6xxx_stu_data_read(struct mv88e6xxx_chip *chip,
1299 struct mv88e6xxx_vtu_stu_entry *entry) 1299 struct mv88e6xxx_vtu_entry *entry)
1300{ 1300{
1301 return _mv88e6xxx_vtu_stu_data_read(chip, entry, 2); 1301 return _mv88e6xxx_vtu_stu_data_read(chip, entry, 2);
1302} 1302}
1303 1303
1304static int _mv88e6xxx_vtu_stu_data_write(struct mv88e6xxx_chip *chip, 1304static int _mv88e6xxx_vtu_stu_data_write(struct mv88e6xxx_chip *chip,
1305 struct mv88e6xxx_vtu_stu_entry *entry, 1305 struct mv88e6xxx_vtu_entry *entry,
1306 unsigned int nibble_offset) 1306 unsigned int nibble_offset)
1307{ 1307{
1308 u16 regs[3] = { 0 }; 1308 u16 regs[3] = { 0 };
@@ -1327,13 +1327,13 @@ static int _mv88e6xxx_vtu_stu_data_write(struct mv88e6xxx_chip *chip,
1327} 1327}
1328 1328
1329static int mv88e6xxx_vtu_data_write(struct mv88e6xxx_chip *chip, 1329static int mv88e6xxx_vtu_data_write(struct mv88e6xxx_chip *chip,
1330 struct mv88e6xxx_vtu_stu_entry *entry) 1330 struct mv88e6xxx_vtu_entry *entry)
1331{ 1331{
1332 return _mv88e6xxx_vtu_stu_data_write(chip, entry, 0); 1332 return _mv88e6xxx_vtu_stu_data_write(chip, entry, 0);
1333} 1333}
1334 1334
1335static int mv88e6xxx_stu_data_write(struct mv88e6xxx_chip *chip, 1335static int mv88e6xxx_stu_data_write(struct mv88e6xxx_chip *chip,
1336 struct mv88e6xxx_vtu_stu_entry *entry) 1336 struct mv88e6xxx_vtu_entry *entry)
1337{ 1337{
1338 return _mv88e6xxx_vtu_stu_data_write(chip, entry, 2); 1338 return _mv88e6xxx_vtu_stu_data_write(chip, entry, 2);
1339} 1339}
@@ -1345,9 +1345,9 @@ static int _mv88e6xxx_vtu_vid_write(struct mv88e6xxx_chip *chip, u16 vid)
1345} 1345}
1346 1346
1347static int _mv88e6xxx_vtu_getnext(struct mv88e6xxx_chip *chip, 1347static int _mv88e6xxx_vtu_getnext(struct mv88e6xxx_chip *chip,
1348 struct mv88e6xxx_vtu_stu_entry *entry) 1348 struct mv88e6xxx_vtu_entry *entry)
1349{ 1349{
1350 struct mv88e6xxx_vtu_stu_entry next = { 0 }; 1350 struct mv88e6xxx_vtu_entry next = { 0 };
1351 u16 val; 1351 u16 val;
1352 int err; 1352 int err;
1353 1353
@@ -1407,7 +1407,7 @@ static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port,
1407 int (*cb)(struct switchdev_obj *obj)) 1407 int (*cb)(struct switchdev_obj *obj))
1408{ 1408{
1409 struct mv88e6xxx_chip *chip = ds->priv; 1409 struct mv88e6xxx_chip *chip = ds->priv;
1410 struct mv88e6xxx_vtu_stu_entry next; 1410 struct mv88e6xxx_vtu_entry next;
1411 u16 pvid; 1411 u16 pvid;
1412 int err; 1412 int err;
1413 1413
@@ -1458,7 +1458,7 @@ unlock:
1458} 1458}
1459 1459
1460static int _mv88e6xxx_vtu_loadpurge(struct mv88e6xxx_chip *chip, 1460static int _mv88e6xxx_vtu_loadpurge(struct mv88e6xxx_chip *chip,
1461 struct mv88e6xxx_vtu_stu_entry *entry) 1461 struct mv88e6xxx_vtu_entry *entry)
1462{ 1462{
1463 u16 op = GLOBAL_VTU_OP_VTU_LOAD_PURGE; 1463 u16 op = GLOBAL_VTU_OP_VTU_LOAD_PURGE;
1464 u16 reg = 0; 1464 u16 reg = 0;
@@ -1507,9 +1507,9 @@ loadpurge:
1507} 1507}
1508 1508
1509static int _mv88e6xxx_stu_getnext(struct mv88e6xxx_chip *chip, u8 sid, 1509static int _mv88e6xxx_stu_getnext(struct mv88e6xxx_chip *chip, u8 sid,
1510 struct mv88e6xxx_vtu_stu_entry *entry) 1510 struct mv88e6xxx_vtu_entry *entry)
1511{ 1511{
1512 struct mv88e6xxx_vtu_stu_entry next = { 0 }; 1512 struct mv88e6xxx_vtu_entry next = { 0 };
1513 u16 val; 1513 u16 val;
1514 int err; 1514 int err;
1515 1515
@@ -1549,7 +1549,7 @@ static int _mv88e6xxx_stu_getnext(struct mv88e6xxx_chip *chip, u8 sid,
1549} 1549}
1550 1550
1551static int _mv88e6xxx_stu_loadpurge(struct mv88e6xxx_chip *chip, 1551static int _mv88e6xxx_stu_loadpurge(struct mv88e6xxx_chip *chip,
1552 struct mv88e6xxx_vtu_stu_entry *entry) 1552 struct mv88e6xxx_vtu_entry *entry)
1553{ 1553{
1554 u16 reg = 0; 1554 u16 reg = 0;
1555 int err; 1555 int err;
@@ -1652,7 +1652,7 @@ static int _mv88e6xxx_port_fid_set(struct mv88e6xxx_chip *chip,
1652static int _mv88e6xxx_fid_new(struct mv88e6xxx_chip *chip, u16 *fid) 1652static int _mv88e6xxx_fid_new(struct mv88e6xxx_chip *chip, u16 *fid)
1653{ 1653{
1654 DECLARE_BITMAP(fid_bitmap, MV88E6XXX_N_FID); 1654 DECLARE_BITMAP(fid_bitmap, MV88E6XXX_N_FID);
1655 struct mv88e6xxx_vtu_stu_entry vlan; 1655 struct mv88e6xxx_vtu_entry vlan;
1656 int i, err; 1656 int i, err;
1657 1657
1658 bitmap_zero(fid_bitmap, MV88E6XXX_N_FID); 1658 bitmap_zero(fid_bitmap, MV88E6XXX_N_FID);
@@ -1694,10 +1694,10 @@ static int _mv88e6xxx_fid_new(struct mv88e6xxx_chip *chip, u16 *fid)
1694} 1694}
1695 1695
1696static int _mv88e6xxx_vtu_new(struct mv88e6xxx_chip *chip, u16 vid, 1696static int _mv88e6xxx_vtu_new(struct mv88e6xxx_chip *chip, u16 vid,
1697 struct mv88e6xxx_vtu_stu_entry *entry) 1697 struct mv88e6xxx_vtu_entry *entry)
1698{ 1698{
1699 struct dsa_switch *ds = chip->ds; 1699 struct dsa_switch *ds = chip->ds;
1700 struct mv88e6xxx_vtu_stu_entry vlan = { 1700 struct mv88e6xxx_vtu_entry vlan = {
1701 .valid = true, 1701 .valid = true,
1702 .vid = vid, 1702 .vid = vid,
1703 }; 1703 };
@@ -1715,7 +1715,7 @@ static int _mv88e6xxx_vtu_new(struct mv88e6xxx_chip *chip, u16 vid,
1715 1715
1716 if (mv88e6xxx_6097_family(chip) || mv88e6xxx_6165_family(chip) || 1716 if (mv88e6xxx_6097_family(chip) || mv88e6xxx_6165_family(chip) ||
1717 mv88e6xxx_6351_family(chip) || mv88e6xxx_6352_family(chip)) { 1717 mv88e6xxx_6351_family(chip) || mv88e6xxx_6352_family(chip)) {
1718 struct mv88e6xxx_vtu_stu_entry vstp; 1718 struct mv88e6xxx_vtu_entry vstp;
1719 1719
1720 /* Adding a VTU entry requires a valid STU entry. As VSTP is not 1720 /* Adding a VTU entry requires a valid STU entry. As VSTP is not
1721 * implemented, only one STU entry is needed to cover all VTU 1721 * implemented, only one STU entry is needed to cover all VTU
@@ -1742,7 +1742,7 @@ static int _mv88e6xxx_vtu_new(struct mv88e6xxx_chip *chip, u16 vid,
1742} 1742}
1743 1743
1744static int _mv88e6xxx_vtu_get(struct mv88e6xxx_chip *chip, u16 vid, 1744static int _mv88e6xxx_vtu_get(struct mv88e6xxx_chip *chip, u16 vid,
1745 struct mv88e6xxx_vtu_stu_entry *entry, bool creat) 1745 struct mv88e6xxx_vtu_entry *entry, bool creat)
1746{ 1746{
1747 int err; 1747 int err;
1748 1748
@@ -1774,7 +1774,7 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
1774 u16 vid_begin, u16 vid_end) 1774 u16 vid_begin, u16 vid_end)
1775{ 1775{
1776 struct mv88e6xxx_chip *chip = ds->priv; 1776 struct mv88e6xxx_chip *chip = ds->priv;
1777 struct mv88e6xxx_vtu_stu_entry vlan; 1777 struct mv88e6xxx_vtu_entry vlan;
1778 int i, err; 1778 int i, err;
1779 1779
1780 if (!vid_begin) 1780 if (!vid_begin)
@@ -1899,7 +1899,7 @@ mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port,
1899static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port, 1899static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port,
1900 u16 vid, bool untagged) 1900 u16 vid, bool untagged)
1901{ 1901{
1902 struct mv88e6xxx_vtu_stu_entry vlan; 1902 struct mv88e6xxx_vtu_entry vlan;
1903 int err; 1903 int err;
1904 1904
1905 err = _mv88e6xxx_vtu_get(chip, vid, &vlan, true); 1905 err = _mv88e6xxx_vtu_get(chip, vid, &vlan, true);
@@ -1944,7 +1944,7 @@ static int _mv88e6xxx_port_vlan_del(struct mv88e6xxx_chip *chip,
1944 int port, u16 vid) 1944 int port, u16 vid)
1945{ 1945{
1946 struct dsa_switch *ds = chip->ds; 1946 struct dsa_switch *ds = chip->ds;
1947 struct mv88e6xxx_vtu_stu_entry vlan; 1947 struct mv88e6xxx_vtu_entry vlan;
1948 int i, err; 1948 int i, err;
1949 1949
1950 err = _mv88e6xxx_vtu_get(chip, vid, &vlan, false); 1950 err = _mv88e6xxx_vtu_get(chip, vid, &vlan, false);
@@ -2103,7 +2103,7 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
2103 const unsigned char *addr, u16 vid, 2103 const unsigned char *addr, u16 vid,
2104 u8 state) 2104 u8 state)
2105{ 2105{
2106 struct mv88e6xxx_vtu_stu_entry vlan; 2106 struct mv88e6xxx_vtu_entry vlan;
2107 struct mv88e6xxx_atu_entry entry; 2107 struct mv88e6xxx_atu_entry entry;
2108 int err; 2108 int err;
2109 2109
@@ -2278,7 +2278,7 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port,
2278 struct switchdev_obj *obj, 2278 struct switchdev_obj *obj,
2279 int (*cb)(struct switchdev_obj *obj)) 2279 int (*cb)(struct switchdev_obj *obj))
2280{ 2280{
2281 struct mv88e6xxx_vtu_stu_entry vlan = { 2281 struct mv88e6xxx_vtu_entry vlan = {
2282 .vid = GLOBAL_VTU_VID_MASK, /* all ones */ 2282 .vid = GLOBAL_VTU_VID_MASK, /* all ones */
2283 }; 2283 };
2284 u16 fid; 2284 u16 fid;
diff --git a/drivers/net/dsa/mv88e6xxx/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx/mv88e6xxx.h
index cf639ed91d03..ee7873aaf127 100644
--- a/drivers/net/dsa/mv88e6xxx/mv88e6xxx.h
+++ b/drivers/net/dsa/mv88e6xxx/mv88e6xxx.h
@@ -640,12 +640,9 @@ struct mv88e6xxx_atu_entry {
640 u8 mac[ETH_ALEN]; 640 u8 mac[ETH_ALEN];
641}; 641};
642 642
643struct mv88e6xxx_vtu_stu_entry { 643struct mv88e6xxx_vtu_entry {
644 /* VTU only */
645 u16 vid; 644 u16 vid;
646 u16 fid; 645 u16 fid;
647
648 /* VTU and STU */
649 u8 sid; 646 u8 sid;
650 bool valid; 647 bool valid;
651 u8 data[DSA_MAX_PORTS]; 648 u8 data[DSA_MAX_PORTS];