mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net: dsa: integrate with SWITCHDEV for HW bridging
In order to support bridging offloads in DSA switch drivers, select NET_SWITCHDEV to get access to the port_stp_update and parent_get_id NDOs that we are required to implement. To facilitate the integratation at the DSA driver level, we implement 3 types of operations: - port_join_bridge - port_leave_bridge - port_stp_update DSA will resolve which switch ports that are currently bridge port members as some Switch hardware/drivers need to know about that to limit the register programming to just the relevant registers (especially for slow MDIO buses). We also take care of setting the correct STP state when slave network devices are brought up/down while being bridge members. Finally, when a port is leaving the bridge, we make sure we set in BR_STATE_FORWARDING state, otherwise the bridge layer would leave it disabled as a result of having left the bridge. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d87d6f44d7
commit
b73adef677
5 changed files with 171 additions and 0 deletions
|
@ -826,6 +826,10 @@ static struct packet_type dsa_pack_type __read_mostly = {
|
|||
.func = dsa_switch_rcv,
|
||||
};
|
||||
|
||||
static struct notifier_block dsa_netdevice_nb __read_mostly = {
|
||||
.notifier_call = dsa_slave_netdevice_event,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int dsa_suspend(struct device *d)
|
||||
{
|
||||
|
@ -884,6 +888,8 @@ static int __init dsa_init_module(void)
|
|||
{
|
||||
int rc;
|
||||
|
||||
register_netdevice_notifier(&dsa_netdevice_nb);
|
||||
|
||||
rc = platform_driver_register(&dsa_driver);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
@ -896,6 +902,7 @@ module_init(dsa_init_module);
|
|||
|
||||
static void __exit dsa_cleanup_module(void)
|
||||
{
|
||||
unregister_netdevice_notifier(&dsa_netdevice_nb);
|
||||
dev_remove_pack(&dsa_pack_type);
|
||||
platform_driver_unregister(&dsa_driver);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue