Add possibility to register rx_handler data pointer along with a rx_handler.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
INIT_HLIST_HEAD(&port->vlan_hash[i]);
rcu_assign_pointer(dev->macvlan_port, port);
- err = netdev_rx_handler_register(dev, macvlan_handle_frame);
+ err = netdev_rx_handler_register(dev, macvlan_handle_frame, NULL);
if (err) {
rcu_assign_pointer(dev->macvlan_port, NULL);
kfree(port);
struct netdev_queue rx_queue;
rx_handler_func_t *rx_handler;
+ void *rx_handler_data;
struct netdev_queue *_tx ____cacheline_aligned_in_smp;
}
extern int netdev_rx_handler_register(struct net_device *dev,
- rx_handler_func_t *rx_handler);
+ rx_handler_func_t *rx_handler,
+ void *rx_handler_data);
extern void netdev_rx_handler_unregister(struct net_device *dev);
extern void netif_nit_deliver(struct sk_buff *skb);
rcu_assign_pointer(dev->br_port, p);
- err = netdev_rx_handler_register(dev, br_handle_frame);
+ err = netdev_rx_handler_register(dev, br_handle_frame, NULL);
if (err)
goto err4;
* netdev_rx_handler_register - register receive handler
* @dev: device to register a handler for
* @rx_handler: receive handler to register
+ * @rx_handler_data: data pointer that is used by rx handler
*
* Register a receive hander for a device. This handler will then be
* called from __netif_receive_skb. A negative errno code is returned
* The caller must hold the rtnl_mutex.
*/
int netdev_rx_handler_register(struct net_device *dev,
- rx_handler_func_t *rx_handler)
+ rx_handler_func_t *rx_handler,
+ void *rx_handler_data)
{
ASSERT_RTNL();
if (dev->rx_handler)
return -EBUSY;
+ rcu_assign_pointer(dev->rx_handler_data, rx_handler_data);
rcu_assign_pointer(dev->rx_handler, rx_handler);
return 0;
ASSERT_RTNL();
rcu_assign_pointer(dev->rx_handler, NULL);
+ rcu_assign_pointer(dev->rx_handler_data, NULL);
}
EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister);