Commit cdf09697 authored by David S. Miller's avatar David S. Miller

Revert "Merge branch 'mv88e6xxx-switchdev-fdb'"

This reverts commit f1d5ca43, reversing
changes made to 4933d85c.

I applied v2 instead of v3.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2c9c3bbb
...@@ -116,9 +116,9 @@ struct dsa_switch_driver mv88e6171_switch_driver = { ...@@ -116,9 +116,9 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
.port_join_bridge = mv88e6xxx_join_bridge, .port_join_bridge = mv88e6xxx_join_bridge,
.port_leave_bridge = mv88e6xxx_leave_bridge, .port_leave_bridge = mv88e6xxx_leave_bridge,
.port_stp_update = mv88e6xxx_port_stp_update, .port_stp_update = mv88e6xxx_port_stp_update,
.port_fdb_add = mv88e6xxx_port_fdb_add, .fdb_add = mv88e6xxx_port_fdb_add,
.port_fdb_del = mv88e6xxx_port_fdb_del, .fdb_del = mv88e6xxx_port_fdb_del,
.port_fdb_getnext = mv88e6xxx_port_fdb_getnext, .fdb_getnext = mv88e6xxx_port_fdb_getnext,
}; };
MODULE_ALIAS("platform:mv88e6171"); MODULE_ALIAS("platform:mv88e6171");
......
...@@ -343,9 +343,9 @@ struct dsa_switch_driver mv88e6352_switch_driver = { ...@@ -343,9 +343,9 @@ struct dsa_switch_driver mv88e6352_switch_driver = {
.port_join_bridge = mv88e6xxx_join_bridge, .port_join_bridge = mv88e6xxx_join_bridge,
.port_leave_bridge = mv88e6xxx_leave_bridge, .port_leave_bridge = mv88e6xxx_leave_bridge,
.port_stp_update = mv88e6xxx_port_stp_update, .port_stp_update = mv88e6xxx_port_stp_update,
.port_fdb_add = mv88e6xxx_port_fdb_add, .fdb_add = mv88e6xxx_port_fdb_add,
.port_fdb_del = mv88e6xxx_port_fdb_del, .fdb_del = mv88e6xxx_port_fdb_del,
.port_fdb_getnext = mv88e6xxx_port_fdb_getnext, .fdb_getnext = mv88e6xxx_port_fdb_getnext,
}; };
MODULE_ALIAS("platform:mv88e6172"); MODULE_ALIAS("platform:mv88e6172");
......
...@@ -964,7 +964,7 @@ static int _mv88e6xxx_atu_cmd(struct dsa_switch *ds, int fid, u16 cmd) ...@@ -964,7 +964,7 @@ static int _mv88e6xxx_atu_cmd(struct dsa_switch *ds, int fid, u16 cmd)
{ {
int ret; int ret;
ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_ATU_FID, fid); ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, 0x01, fid);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1091,7 +1091,7 @@ int mv88e6xxx_join_bridge(struct dsa_switch *ds, int port, u32 br_port_mask) ...@@ -1091,7 +1091,7 @@ int mv88e6xxx_join_bridge(struct dsa_switch *ds, int port, u32 br_port_mask)
ps->bridge_mask[fid] = br_port_mask; ps->bridge_mask[fid] = br_port_mask;
if (fid != ps->fid[port]) { if (fid != ps->fid[port]) {
clear_bit(ps->fid[port], ps->fid_bitmap); ps->fid_mask |= 1 << ps->fid[port];
ps->fid[port] = fid; ps->fid[port] = fid;
ret = _mv88e6xxx_update_bridge_config(ds, fid); ret = _mv88e6xxx_update_bridge_config(ds, fid);
} }
...@@ -1125,16 +1125,9 @@ int mv88e6xxx_leave_bridge(struct dsa_switch *ds, int port, u32 br_port_mask) ...@@ -1125,16 +1125,9 @@ int mv88e6xxx_leave_bridge(struct dsa_switch *ds, int port, u32 br_port_mask)
mutex_lock(&ps->smi_mutex); mutex_lock(&ps->smi_mutex);
newfid = find_next_zero_bit(ps->fid_bitmap, VLAN_N_VID, 1); newfid = __ffs(ps->fid_mask);
if (unlikely(newfid > ps->num_ports)) {
netdev_err(ds->ports[port], "all first %d FIDs are used\n",
ps->num_ports);
ret = -ENOSPC;
goto unlock;
}
ps->fid[port] = newfid; ps->fid[port] = newfid;
set_bit(newfid, ps->fid_bitmap); ps->fid_mask &= ~(1 << newfid);
ps->bridge_mask[fid] &= ~(1 << port); ps->bridge_mask[fid] &= ~(1 << port);
ps->bridge_mask[newfid] = 1 << port; ps->bridge_mask[newfid] = 1 << port;
...@@ -1142,7 +1135,6 @@ int mv88e6xxx_leave_bridge(struct dsa_switch *ds, int port, u32 br_port_mask) ...@@ -1142,7 +1135,6 @@ int mv88e6xxx_leave_bridge(struct dsa_switch *ds, int port, u32 br_port_mask)
if (!ret) if (!ret)
ret = _mv88e6xxx_update_bridge_config(ds, newfid); ret = _mv88e6xxx_update_bridge_config(ds, newfid);
unlock:
mutex_unlock(&ps->smi_mutex); mutex_unlock(&ps->smi_mutex);
return ret; return ret;
...@@ -1182,8 +1174,8 @@ int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state) ...@@ -1182,8 +1174,8 @@ int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state)
return 0; return 0;
} }
static int _mv88e6xxx_atu_mac_write(struct dsa_switch *ds, static int __mv88e6xxx_write_addr(struct dsa_switch *ds,
const u8 addr[ETH_ALEN]) const unsigned char *addr)
{ {
int i, ret; int i, ret;
...@@ -1198,7 +1190,7 @@ static int _mv88e6xxx_atu_mac_write(struct dsa_switch *ds, ...@@ -1198,7 +1190,7 @@ static int _mv88e6xxx_atu_mac_write(struct dsa_switch *ds,
return 0; return 0;
} }
static int _mv88e6xxx_atu_mac_read(struct dsa_switch *ds, u8 addr[ETH_ALEN]) static int __mv88e6xxx_read_addr(struct dsa_switch *ds, unsigned char *addr)
{ {
int i, ret; int i, ret;
...@@ -1214,190 +1206,109 @@ static int _mv88e6xxx_atu_mac_read(struct dsa_switch *ds, u8 addr[ETH_ALEN]) ...@@ -1214,190 +1206,109 @@ static int _mv88e6xxx_atu_mac_read(struct dsa_switch *ds, u8 addr[ETH_ALEN])
return 0; return 0;
} }
static int _mv88e6xxx_atu_load(struct dsa_switch *ds, static int __mv88e6xxx_port_fdb_cmd(struct dsa_switch *ds, int port,
struct mv88e6xxx_atu_entry *entry) const unsigned char *addr, int state)
{
u16 reg = 0;
int ret;
ret = _mv88e6xxx_atu_wait(ds);
if (ret < 0)
return ret;
ret = _mv88e6xxx_atu_mac_write(ds, entry->mac);
if (ret < 0)
return ret;
if (entry->state != GLOBAL_ATU_DATA_STATE_UNUSED) {
unsigned int mask, shift;
if (entry->trunk) {
reg |= GLOBAL_ATU_DATA_TRUNK;
mask = GLOBAL_ATU_DATA_TRUNK_ID_MASK;
shift = GLOBAL_ATU_DATA_TRUNK_ID_SHIFT;
} else {
mask = GLOBAL_ATU_DATA_PORT_VECTOR_MASK;
shift = GLOBAL_ATU_DATA_PORT_VECTOR_SHIFT;
}
reg |= (entry->portv_trunkid << shift) & mask;
}
reg |= entry->state & GLOBAL_ATU_DATA_STATE_MASK;
ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_ATU_DATA, reg);
if (ret < 0)
return ret;
return _mv88e6xxx_atu_cmd(ds, entry->fid, GLOBAL_ATU_OP_LOAD_DB);
}
static int _mv88e6xxx_atu_getnext(struct dsa_switch *ds, u16 fid,
const u8 addr[ETH_ALEN],
struct mv88e6xxx_atu_entry *entry)
{ {
struct mv88e6xxx_atu_entry next = { 0 }; struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
u8 fid = ps->fid[port];
int ret; int ret;
next.fid = fid;
ret = _mv88e6xxx_atu_wait(ds); ret = _mv88e6xxx_atu_wait(ds);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = _mv88e6xxx_atu_mac_write(ds, addr); ret = __mv88e6xxx_write_addr(ds, addr);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = _mv88e6xxx_atu_cmd(ds, fid, GLOBAL_ATU_OP_GET_NEXT_DB); ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_ATU_DATA,
if (ret < 0) (0x10 << port) | state);
return ret; if (ret)
ret = _mv88e6xxx_atu_mac_read(ds, next.mac);
if (ret < 0)
return ret;
ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_ATU_DATA);
if (ret < 0)
return ret;
next.state = ret & GLOBAL_ATU_DATA_STATE_MASK;
if (next.state != GLOBAL_ATU_DATA_STATE_UNUSED) {
unsigned int mask, shift;
if (ret & GLOBAL_ATU_DATA_TRUNK) {
next.trunk = true;
mask = GLOBAL_ATU_DATA_TRUNK_ID_MASK;
shift = GLOBAL_ATU_DATA_TRUNK_ID_SHIFT;
} else {
next.trunk = false;
mask = GLOBAL_ATU_DATA_PORT_VECTOR_MASK;
shift = GLOBAL_ATU_DATA_PORT_VECTOR_SHIFT;
}
next.portv_trunkid = (ret & mask) >> shift;
}
*entry = next;
return 0;
}
static int _mv88e6xxx_port_vid_to_fid(struct dsa_switch *ds, int port, u16 vid)
{
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
if (vid == 0)
return ps->fid[port];
return -ENOENT;
}
static int _mv88e6xxx_port_fdb_load(struct dsa_switch *ds, int port, u16 vid,
const u8 addr[ETH_ALEN], u8 state)
{
struct mv88e6xxx_atu_entry entry = { 0 };
int ret;
ret = _mv88e6xxx_port_vid_to_fid(ds, port, vid);
if (ret < 0)
return ret; return ret;
entry.fid = ret; ret = _mv88e6xxx_atu_cmd(ds, fid, GLOBAL_ATU_OP_LOAD_DB);
entry.state = state;
ether_addr_copy(entry.mac, addr);
if (state != GLOBAL_ATU_DATA_STATE_UNUSED) {
entry.trunk = false;
entry.portv_trunkid = BIT(port);
}
return _mv88e6xxx_atu_load(ds, &entry); return ret;
} }
int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, u16 vid, int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
const u8 addr[ETH_ALEN]) const unsigned char *addr, u16 vid)
{ {
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); int state = is_multicast_ether_addr(addr) ?
u8 state = is_multicast_ether_addr(addr) ?
GLOBAL_ATU_DATA_STATE_MC_STATIC : GLOBAL_ATU_DATA_STATE_MC_STATIC :
GLOBAL_ATU_DATA_STATE_UC_STATIC; GLOBAL_ATU_DATA_STATE_UC_STATIC;
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
int ret; int ret;
mutex_lock(&ps->smi_mutex); mutex_lock(&ps->smi_mutex);
ret = _mv88e6xxx_port_fdb_load(ds, port, vid, addr, state); ret = __mv88e6xxx_port_fdb_cmd(ds, port, addr, state);
mutex_unlock(&ps->smi_mutex); mutex_unlock(&ps->smi_mutex);
return ret; return ret;
} }
int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, u16 vid, int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port,
const u8 addr[ETH_ALEN]) const unsigned char *addr, u16 vid)
{ {
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
u8 state = GLOBAL_ATU_DATA_STATE_UNUSED;
int ret; int ret;
mutex_lock(&ps->smi_mutex); mutex_lock(&ps->smi_mutex);
ret = _mv88e6xxx_port_fdb_load(ds, port, vid, addr, state); ret = __mv88e6xxx_port_fdb_cmd(ds, port, addr,
GLOBAL_ATU_DATA_STATE_UNUSED);
mutex_unlock(&ps->smi_mutex); mutex_unlock(&ps->smi_mutex);
return ret; return ret;
} }
int mv88e6xxx_port_fdb_getnext(struct dsa_switch *ds, int port, u16 *vid, static int __mv88e6xxx_port_getnext(struct dsa_switch *ds, int port,
u8 addr[ETH_ALEN], bool *is_static) unsigned char *addr, bool *is_static)
{ {
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
struct mv88e6xxx_atu_entry next; u8 fid = ps->fid[port];
u16 fid; int ret, state;
int ret;
mutex_lock(&ps->smi_mutex); ret = _mv88e6xxx_atu_wait(ds);
if (ret < 0)
return ret;
ret = _mv88e6xxx_port_vid_to_fid(ds, port, *vid); ret = __mv88e6xxx_write_addr(ds, addr);
if (ret < 0) if (ret < 0)
goto unlock; return ret;
fid = ret;
do { do {
if (is_broadcast_ether_addr(addr)) { ret = _mv88e6xxx_atu_cmd(ds, fid, GLOBAL_ATU_OP_GET_NEXT_DB);
ret = -ENOENT; if (ret < 0)
goto unlock; return ret;
}
ret = _mv88e6xxx_atu_getnext(ds, fid, addr, &next); ret = _mv88e6xxx_reg_read(ds, REG_GLOBAL, GLOBAL_ATU_DATA);
if (ret < 0) if (ret < 0)
goto unlock; return ret;
state = ret & GLOBAL_ATU_DATA_STATE_MASK;
if (state == GLOBAL_ATU_DATA_STATE_UNUSED)
return -ENOENT;
} while (!(((ret >> 4) & 0xff) & (1 << port)));
ether_addr_copy(addr, next.mac); ret = __mv88e6xxx_read_addr(ds, addr);
if (ret < 0)
return ret;
if (next.state == GLOBAL_ATU_DATA_STATE_UNUSED) *is_static = state == (is_multicast_ether_addr(addr) ?
continue; GLOBAL_ATU_DATA_STATE_MC_STATIC :
} while (next.trunk || (next.portv_trunkid & BIT(port)) == 0); GLOBAL_ATU_DATA_STATE_UC_STATIC);
return 0;
}
/* get next entry for port */
int mv88e6xxx_port_fdb_getnext(struct dsa_switch *ds, int port,
unsigned char *addr, bool *is_static)
{
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
int ret;
*is_static = next.state == (is_multicast_ether_addr(addr) ? mutex_lock(&ps->smi_mutex);
GLOBAL_ATU_DATA_STATE_MC_STATIC : ret = __mv88e6xxx_port_getnext(ds, port, addr, is_static);
GLOBAL_ATU_DATA_STATE_UC_STATIC);
unlock:
mutex_unlock(&ps->smi_mutex); mutex_unlock(&ps->smi_mutex);
return ret; return ret;
...@@ -1641,9 +1552,9 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port) ...@@ -1641,9 +1552,9 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
* ports, and allow each of the 'real' ports to only talk to * ports, and allow each of the 'real' ports to only talk to
* the upstream port. * the upstream port.
*/ */
fid = port + 1; fid = __ffs(ps->fid_mask);
ps->fid[port] = fid; ps->fid[port] = fid;
set_bit(fid, ps->fid_bitmap); ps->fid_mask &= ~(1 << fid);
if (!dsa_is_cpu_port(ds, port)) if (!dsa_is_cpu_port(ds, port))
ps->bridge_mask[fid] = 1 << port; ps->bridge_mask[fid] = 1 << port;
...@@ -1740,7 +1651,7 @@ static int mv88e6xxx_atu_show_db(struct seq_file *s, struct dsa_switch *ds, ...@@ -1740,7 +1651,7 @@ static int mv88e6xxx_atu_show_db(struct seq_file *s, struct dsa_switch *ds,
unsigned char addr[6]; unsigned char addr[6];
int ret, data, state; int ret, data, state;
ret = _mv88e6xxx_atu_mac_write(ds, bcast); ret = __mv88e6xxx_write_addr(ds, bcast);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1755,7 +1666,7 @@ static int mv88e6xxx_atu_show_db(struct seq_file *s, struct dsa_switch *ds, ...@@ -1755,7 +1666,7 @@ static int mv88e6xxx_atu_show_db(struct seq_file *s, struct dsa_switch *ds,
state = data & GLOBAL_ATU_DATA_STATE_MASK; state = data & GLOBAL_ATU_DATA_STATE_MASK;
if (state == GLOBAL_ATU_DATA_STATE_UNUSED) if (state == GLOBAL_ATU_DATA_STATE_UNUSED)
break; break;
ret = _mv88e6xxx_atu_mac_read(ds, addr); ret = __mv88e6xxx_read_addr(ds, addr);
if (ret < 0) if (ret < 0)
return ret; return ret;
mv88e6xxx_atu_show_entry(s, dbnum, addr, data); mv88e6xxx_atu_show_entry(s, dbnum, addr, data);
...@@ -1942,6 +1853,8 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds) ...@@ -1942,6 +1853,8 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds)
ps->id = REG_READ(REG_PORT(0), PORT_SWITCH_ID) & 0xfff0; ps->id = REG_READ(REG_PORT(0), PORT_SWITCH_ID) & 0xfff0;
ps->fid_mask = (1 << DSA_MAX_PORTS) - 1;
INIT_WORK(&ps->bridge_work, mv88e6xxx_bridge_work); INIT_WORK(&ps->bridge_work, mv88e6xxx_bridge_work);
name = kasprintf(GFP_KERNEL, "dsa%d", ds->index); name = kasprintf(GFP_KERNEL, "dsa%d", ds->index);
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#ifndef __MV88E6XXX_H #ifndef __MV88E6XXX_H
#define __MV88E6XXX_H #define __MV88E6XXX_H
#include <linux/if_vlan.h>
#ifndef UINT64_MAX #ifndef UINT64_MAX
#define UINT64_MAX (u64)(~((u64)0)) #define UINT64_MAX (u64)(~((u64)0))
#endif #endif
...@@ -171,7 +169,6 @@ ...@@ -171,7 +169,6 @@
#define GLOBAL_MAC_01 0x01 #define GLOBAL_MAC_01 0x01
#define GLOBAL_MAC_23 0x02 #define GLOBAL_MAC_23 0x02
#define GLOBAL_MAC_45 0x03 #define GLOBAL_MAC_45 0x03
#define GLOBAL_ATU_FID 0x01 /* 6097 6165 6351 6352 */
#define GLOBAL_CONTROL 0x04 #define GLOBAL_CONTROL 0x04
#define GLOBAL_CONTROL_SW_RESET BIT(15) #define GLOBAL_CONTROL_SW_RESET BIT(15)
#define GLOBAL_CONTROL_PPU_ENABLE BIT(14) #define GLOBAL_CONTROL_PPU_ENABLE BIT(14)
...@@ -206,8 +203,6 @@ ...@@ -206,8 +203,6 @@
#define GLOBAL_ATU_OP_GET_CLR_VIOLATION ((7 << 12) | GLOBAL_ATU_OP_BUSY) #define GLOBAL_ATU_OP_GET_CLR_VIOLATION ((7 << 12) | GLOBAL_ATU_OP_BUSY)
#define GLOBAL_ATU_DATA 0x0c #define GLOBAL_ATU_DATA 0x0c
#define GLOBAL_ATU_DATA_TRUNK BIT(15) #define GLOBAL_ATU_DATA_TRUNK BIT(15)
#define GLOBAL_ATU_DATA_TRUNK_ID_MASK 0x00f0
#define GLOBAL_ATU_DATA_TRUNK_ID_SHIFT 4
#define GLOBAL_ATU_DATA_PORT_VECTOR_MASK 0x3ff0 #define GLOBAL_ATU_DATA_PORT_VECTOR_MASK 0x3ff0
#define GLOBAL_ATU_DATA_PORT_VECTOR_SHIFT 4 #define GLOBAL_ATU_DATA_PORT_VECTOR_SHIFT 4
#define GLOBAL_ATU_DATA_STATE_MASK 0x0f #define GLOBAL_ATU_DATA_STATE_MASK 0x0f
...@@ -318,14 +313,6 @@ ...@@ -318,14 +313,6 @@
#define GLOBAL2_QOS_WEIGHT 0x1c #define GLOBAL2_QOS_WEIGHT 0x1c
#define GLOBAL2_MISC 0x1d #define GLOBAL2_MISC 0x1d
struct mv88e6xxx_atu_entry {
u16 fid;
u8 state;
bool trunk;
u16 portv_trunkid;
u8 mac[ETH_ALEN];
};
struct mv88e6xxx_priv_state { struct mv88e6xxx_priv_state {
/* When using multi-chip addressing, this mutex protects /* When using multi-chip addressing, this mutex protects
* access to the indirect access registers. (In single-chip * access to the indirect access registers. (In single-chip
...@@ -364,9 +351,9 @@ struct mv88e6xxx_priv_state { ...@@ -364,9 +351,9 @@ struct mv88e6xxx_priv_state {
/* hw bridging */ /* hw bridging */
DECLARE_BITMAP(fid_bitmap, VLAN_N_VID); /* FIDs 1 to 4095 available */ u32 fid_mask;
u16 fid[DSA_MAX_PORTS]; /* per (non-bridged) port FID */ u8 fid[DSA_MAX_PORTS];
u16 bridge_mask[DSA_MAX_PORTS]; /* br groups (indexed by FID) */ u16 bridge_mask[DSA_MAX_PORTS];
unsigned long port_state_update_mask; unsigned long port_state_update_mask;
u8 port_state[DSA_MAX_PORTS]; u8 port_state[DSA_MAX_PORTS];
...@@ -426,15 +413,15 @@ int mv88e6xxx_set_eee(struct dsa_switch *ds, int port, ...@@ -426,15 +413,15 @@ int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
int mv88e6xxx_join_bridge(struct dsa_switch *ds, int port, u32 br_port_mask); int mv88e6xxx_join_bridge(struct dsa_switch *ds, int port, u32 br_port_mask);
int mv88e6xxx_leave_bridge(struct dsa_switch *ds, int port, u32 br_port_mask); int mv88e6xxx_leave_bridge(struct dsa_switch *ds, int port, u32 br_port_mask);
int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state); int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state);
int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid);
int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid);
int mv88e6xxx_port_fdb_getnext(struct dsa_switch *ds, int port,
unsigned char *addr, bool *is_static);
int mv88e6xxx_phy_page_read(struct dsa_switch *ds, int port, int page, int reg); int mv88e6xxx_phy_page_read(struct dsa_switch *ds, int port, int page, int reg);
int mv88e6xxx_phy_page_write(struct dsa_switch *ds, int port, int page, int mv88e6xxx_phy_page_write(struct dsa_switch *ds, int port, int page,
int reg, int val); int reg, int val);
int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, u16 vid,
const u8 addr[ETH_ALEN]);
int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, u16 vid,
const u8 addr[ETH_ALEN]);
int mv88e6xxx_port_fdb_getnext(struct dsa_switch *ds, int port, u16 *vid,
u8 addr[ETH_ALEN], bool *is_static);
extern struct dsa_switch_driver mv88e6131_switch_driver; extern struct dsa_switch_driver mv88e6131_switch_driver;
extern struct dsa_switch_driver mv88e6123_61_65_switch_driver; extern struct dsa_switch_driver mv88e6123_61_65_switch_driver;
......
...@@ -4543,7 +4543,7 @@ static int rocker_port_fdb_dump(const struct rocker_port *rocker_port, ...@@ -4543,7 +4543,7 @@ static int rocker_port_fdb_dump(const struct rocker_port *rocker_port,
hash_for_each_safe(rocker->fdb_tbl, bkt, tmp, found, entry) { hash_for_each_safe(rocker->fdb_tbl, bkt, tmp, found, entry) {
if (found->key.pport != rocker_port->pport) if (found->key.pport != rocker_port->pport)
continue; continue;
ether_addr_copy(fdb->addr, found->key.addr); fdb->addr = found->key.addr;
fdb->vid = rocker_port_vlan_to_vid(rocker_port, fdb->vid = rocker_port_vlan_to_vid(rocker_port,
found->key.vlan_id); found->key.vlan_id);
err = obj->cb(rocker_port->dev, obj); err = obj->cb(rocker_port->dev, obj);
......
...@@ -296,16 +296,12 @@ struct dsa_switch_driver { ...@@ -296,16 +296,12 @@ struct dsa_switch_driver {
u32 br_port_mask); u32 br_port_mask);
int (*port_stp_update)(struct dsa_switch *ds, int port, int (*port_stp_update)(struct dsa_switch *ds, int port,
u8 state); u8 state);
int (*fdb_add)(struct dsa_switch *ds, int port,
/* const unsigned char *addr, u16 vid);
* Forwarding database int (*fdb_del)(struct dsa_switch *ds, int port,
*/ const unsigned char *addr, u16 vid);
int (*port_fdb_add)(struct dsa_switch *ds, int port, u16 vid, int (*fdb_getnext)(struct dsa_switch *ds, int port,
const u8 addr[ETH_ALEN]); unsigned char *addr, bool *is_static);
int (*port_fdb_del)(struct dsa_switch *ds, int port, u16 vid,
const u8 addr[ETH_ALEN]);
int (*port_fdb_getnext)(struct dsa_switch *ds, int port, u16 *vid,
u8 addr[ETH_ALEN], bool *is_static);
}; };
void register_switch_driver(struct dsa_switch_driver *type); void register_switch_driver(struct dsa_switch_driver *type);
......
...@@ -70,9 +70,8 @@ struct switchdev_obj { ...@@ -70,9 +70,8 @@ struct switchdev_obj {
u32 tb_id; u32 tb_id;
} ipv4_fib; } ipv4_fib;
struct switchdev_obj_fdb { /* PORT_FDB */ struct switchdev_obj_fdb { /* PORT_FDB */
u8 addr[ETH_ALEN]; const unsigned char *addr;
u16 vid; u16 vid;
bool is_static;
} fdb; } fdb;