@@ -1151,19 +1151,6 @@ static int _mv88e6xxx_port_pvid_get(struct dsa_switch *ds, int port, u16 *pvid)
11511151 return 0 ;
11521152}
11531153
1154- int mv88e6xxx_port_pvid_get (struct dsa_switch * ds , int port , u16 * pvid )
1155- {
1156- int ret ;
1157-
1158- ret = mv88e6xxx_reg_read (ds , REG_PORT (port ), PORT_DEFAULT_VLAN );
1159- if (ret < 0 )
1160- return ret ;
1161-
1162- * pvid = ret & PORT_DEFAULT_VLAN_MASK ;
1163-
1164- return 0 ;
1165- }
1166-
11671154static int _mv88e6xxx_port_pvid_set (struct dsa_switch * ds , int port , u16 pvid )
11681155{
11691156 return _mv88e6xxx_reg_write (ds , REG_PORT (port ), PORT_DEFAULT_VLAN ,
@@ -1306,6 +1293,57 @@ static int _mv88e6xxx_vtu_getnext(struct dsa_switch *ds,
13061293 return 0 ;
13071294}
13081295
1296+ int mv88e6xxx_port_vlan_dump (struct dsa_switch * ds , int port ,
1297+ struct switchdev_obj_port_vlan * vlan ,
1298+ int (* cb )(struct switchdev_obj * obj ))
1299+ {
1300+ struct mv88e6xxx_priv_state * ps = ds_to_priv (ds );
1301+ struct mv88e6xxx_vtu_stu_entry next ;
1302+ u16 pvid ;
1303+ int err ;
1304+
1305+ mutex_lock (& ps -> smi_mutex );
1306+
1307+ err = _mv88e6xxx_port_pvid_get (ds , port , & pvid );
1308+ if (err )
1309+ goto unlock ;
1310+
1311+ err = _mv88e6xxx_vtu_vid_write (ds , GLOBAL_VTU_VID_MASK );
1312+ if (err )
1313+ goto unlock ;
1314+
1315+ do {
1316+ err = _mv88e6xxx_vtu_getnext (ds , & next );
1317+ if (err )
1318+ break ;
1319+
1320+ if (!next .valid )
1321+ break ;
1322+
1323+ if (next .data [port ] == GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER )
1324+ continue ;
1325+
1326+ /* reinit and dump this VLAN obj */
1327+ vlan -> vid_begin = vlan -> vid_end = next .vid ;
1328+ vlan -> flags = 0 ;
1329+
1330+ if (next .data [port ] == GLOBAL_VTU_DATA_MEMBER_TAG_UNTAGGED )
1331+ vlan -> flags |= BRIDGE_VLAN_INFO_UNTAGGED ;
1332+
1333+ if (next .vid == pvid )
1334+ vlan -> flags |= BRIDGE_VLAN_INFO_PVID ;
1335+
1336+ err = cb (& vlan -> obj );
1337+ if (err )
1338+ break ;
1339+ } while (next .vid < GLOBAL_VTU_VID_MASK );
1340+
1341+ unlock :
1342+ mutex_unlock (& ps -> smi_mutex );
1343+
1344+ return err ;
1345+ }
1346+
13091347static int _mv88e6xxx_vtu_loadpurge (struct dsa_switch * ds ,
13101348 struct mv88e6xxx_vtu_stu_entry * entry )
13111349{
@@ -1675,52 +1713,6 @@ int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port,
16751713 return err ;
16761714}
16771715
1678- int mv88e6xxx_vlan_getnext (struct dsa_switch * ds , u16 * vid ,
1679- unsigned long * ports , unsigned long * untagged )
1680- {
1681- struct mv88e6xxx_priv_state * ps = ds_to_priv (ds );
1682- struct mv88e6xxx_vtu_stu_entry next ;
1683- int port ;
1684- int err ;
1685-
1686- if (* vid == 4095 )
1687- return - ENOENT ;
1688-
1689- mutex_lock (& ps -> smi_mutex );
1690- err = _mv88e6xxx_vtu_vid_write (ds , * vid );
1691- if (err )
1692- goto unlock ;
1693-
1694- err = _mv88e6xxx_vtu_getnext (ds , & next );
1695- unlock :
1696- mutex_unlock (& ps -> smi_mutex );
1697-
1698- if (err )
1699- return err ;
1700-
1701- if (!next .valid )
1702- return - ENOENT ;
1703-
1704- * vid = next .vid ;
1705-
1706- for (port = 0 ; port < ps -> num_ports ; ++ port ) {
1707- clear_bit (port , ports );
1708- clear_bit (port , untagged );
1709-
1710- if (dsa_is_cpu_port (ds , port ) || dsa_is_dsa_port (ds , port ))
1711- continue ;
1712-
1713- if (next .data [port ] == GLOBAL_VTU_DATA_MEMBER_TAG_TAGGED ||
1714- next .data [port ] == GLOBAL_VTU_DATA_MEMBER_TAG_UNTAGGED )
1715- set_bit (port , ports );
1716-
1717- if (next .data [port ] == GLOBAL_VTU_DATA_MEMBER_TAG_UNTAGGED )
1718- set_bit (port , untagged );
1719- }
1720-
1721- return 0 ;
1722- }
1723-
17241716static int _mv88e6xxx_atu_mac_write (struct dsa_switch * ds ,
17251717 const unsigned char * addr )
17261718{
0 commit comments