diff options
-rw-r--r-- | drivers/net/macvlan.c | 2 | ||||
-rw-r--r-- | include/linux/netdevice.h | 4 | ||||
-rw-r--r-- | net/bridge/br_if.c | 2 | ||||
-rw-r--r-- | net/core/dev.c | 6 |
4 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 59c315556a30..87a3bf69c4a3 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -532,7 +532,7 @@ static int macvlan_port_create(struct net_device *dev) | |||
532 | INIT_HLIST_HEAD(&port->vlan_hash[i]); | 532 | INIT_HLIST_HEAD(&port->vlan_hash[i]); |
533 | rcu_assign_pointer(dev->macvlan_port, port); | 533 | rcu_assign_pointer(dev->macvlan_port, port); |
534 | 534 | ||
535 | err = netdev_rx_handler_register(dev, macvlan_handle_frame); | 535 | err = netdev_rx_handler_register(dev, macvlan_handle_frame, NULL); |
536 | if (err) { | 536 | if (err) { |
537 | rcu_assign_pointer(dev->macvlan_port, NULL); | 537 | rcu_assign_pointer(dev->macvlan_port, NULL); |
538 | kfree(port); | 538 | kfree(port); |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index fb20cc55ba52..361ff1145cf1 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -979,6 +979,7 @@ struct net_device { | |||
979 | 979 | ||
980 | struct netdev_queue rx_queue; | 980 | struct netdev_queue rx_queue; |
981 | rx_handler_func_t *rx_handler; | 981 | rx_handler_func_t *rx_handler; |
982 | void *rx_handler_data; | ||
982 | 983 | ||
983 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; | 984 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; |
984 | 985 | ||
@@ -1712,7 +1713,8 @@ static inline void napi_free_frags(struct napi_struct *napi) | |||
1712 | } | 1713 | } |
1713 | 1714 | ||
1714 | extern int netdev_rx_handler_register(struct net_device *dev, | 1715 | extern int netdev_rx_handler_register(struct net_device *dev, |
1715 | rx_handler_func_t *rx_handler); | 1716 | rx_handler_func_t *rx_handler, |
1717 | void *rx_handler_data); | ||
1716 | extern void netdev_rx_handler_unregister(struct net_device *dev); | 1718 | extern void netdev_rx_handler_unregister(struct net_device *dev); |
1717 | 1719 | ||
1718 | extern void netif_nit_deliver(struct sk_buff *skb); | 1720 | extern void netif_nit_deliver(struct sk_buff *skb); |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 97ac9da4d76c..0d142ed0bbe3 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -433,7 +433,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) | |||
433 | 433 | ||
434 | rcu_assign_pointer(dev->br_port, p); | 434 | rcu_assign_pointer(dev->br_port, p); |
435 | 435 | ||
436 | err = netdev_rx_handler_register(dev, br_handle_frame); | 436 | err = netdev_rx_handler_register(dev, br_handle_frame, NULL); |
437 | if (err) | 437 | if (err) |
438 | goto err4; | 438 | goto err4; |
439 | 439 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index a1abc10db08a..abdb19e547a7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2703,6 +2703,7 @@ void netif_nit_deliver(struct sk_buff *skb) | |||
2703 | * netdev_rx_handler_register - register receive handler | 2703 | * netdev_rx_handler_register - register receive handler |
2704 | * @dev: device to register a handler for | 2704 | * @dev: device to register a handler for |
2705 | * @rx_handler: receive handler to register | 2705 | * @rx_handler: receive handler to register |
2706 | * @rx_handler_data: data pointer that is used by rx handler | ||
2706 | * | 2707 | * |
2707 | * Register a receive hander for a device. This handler will then be | 2708 | * Register a receive hander for a device. This handler will then be |
2708 | * called from __netif_receive_skb. A negative errno code is returned | 2709 | * called from __netif_receive_skb. A negative errno code is returned |
@@ -2711,13 +2712,15 @@ void netif_nit_deliver(struct sk_buff *skb) | |||
2711 | * The caller must hold the rtnl_mutex. | 2712 | * The caller must hold the rtnl_mutex. |
2712 | */ | 2713 | */ |
2713 | int netdev_rx_handler_register(struct net_device *dev, | 2714 | int netdev_rx_handler_register(struct net_device *dev, |
2714 | rx_handler_func_t *rx_handler) | 2715 | rx_handler_func_t *rx_handler, |
2716 | void *rx_handler_data) | ||
2715 | { | 2717 | { |
2716 | ASSERT_RTNL(); | 2718 | ASSERT_RTNL(); |
2717 | 2719 | ||
2718 | if (dev->rx_handler) | 2720 | if (dev->rx_handler) |
2719 | return -EBUSY; | 2721 | return -EBUSY; |
2720 | 2722 | ||
2723 | rcu_assign_pointer(dev->rx_handler_data, rx_handler_data); | ||
2721 | rcu_assign_pointer(dev->rx_handler, rx_handler); | 2724 | rcu_assign_pointer(dev->rx_handler, rx_handler); |
2722 | 2725 | ||
2723 | return 0; | 2726 | return 0; |
@@ -2737,6 +2740,7 @@ void netdev_rx_handler_unregister(struct net_device *dev) | |||
2737 | 2740 | ||
2738 | ASSERT_RTNL(); | 2741 | ASSERT_RTNL(); |
2739 | rcu_assign_pointer(dev->rx_handler, NULL); | 2742 | rcu_assign_pointer(dev->rx_handler, NULL); |
2743 | rcu_assign_pointer(dev->rx_handler_data, NULL); | ||
2740 | } | 2744 | } |
2741 | EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); | 2745 | EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); |
2742 | 2746 | ||