net/hsr: Switch from dev_add_pack() to netdev_rx_handler_register()

Also move the frame receive handler to hsr_slave.c.

Signed-off-by: Arvid Brodin <arvid.brodin@alten.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Arvid Brodin
2014-07-04 23:35:24 +02:00
committed by David S. Miller
parent 70ebe4a471
commit 81ba6afd6e
6 changed files with 283 additions and 247 deletions
+12 -1
View File
@@ -19,6 +19,7 @@
#include <linux/rtnetlink.h>
#include <linux/pkt_sched.h>
#include "hsr_device.h"
#include "hsr_slave.h"
#include "hsr_framereg.h"
#include "hsr_main.h"
@@ -393,7 +394,6 @@ static void restore_slaves(struct net_device *hsr_dev)
rtnl_lock();
/* Restore promiscuity */
for (i = 0; i < HSR_MAX_SLAVE; i++) {
if (!hsr->slave[i])
continue;
@@ -402,8 +402,12 @@ static void restore_slaves(struct net_device *hsr_dev)
netdev_info(hsr_dev,
"Cannot restore slave promiscuity (%s, %d)\n",
hsr->slave[i]->name, res);
if (hsr->slave[i]->rx_handler == hsr_handle_frame)
netdev_rx_handler_unregister(hsr->slave[i]);
}
rtnl_unlock();
}
@@ -575,6 +579,13 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
}
}
for (i = 0; i < HSR_MAX_SLAVE; i++) {
res = netdev_rx_handler_register(slave[i], hsr_handle_frame,
hsr);
if (res)
goto fail;
}
/* Make sure we recognize frames from ourselves in hsr_rcv() */
res = hsr_create_self_node(&hsr->self_node_db, hsr_dev->dev_addr,
hsr->slave[1]->dev_addr);