From: Simon Horman Date: Mon, 23 Aug 2010 06:30:07 +0000 (+0900) Subject: datapath: Handle duplicate netdev in netdev_rx_handler_register() X-Git-Tag: v1.1.0pre1~68 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=33ef7695b71a71f2d0bb0e00aab46855afb8c2a6;p=sliver-openvswitch.git datapath: Handle duplicate netdev in netdev_rx_handler_register() For kernels that have netdev_rx_handler_register() (>=2.6.35), duplicate netdevs are detected by netdev_rx_handler_register(). So by adding duplicate detection to the netdev_rx_handler_register() compatibility code the explicit check in netdev_create() can be removed. Signed-off-by: Simon Horman Signed-off-by: Jesse Gross --- diff --git a/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h b/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h index 379c1a9c7..29a7cccf9 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h @@ -94,6 +94,8 @@ static inline int netdev_rx_handler_register(struct net_device *dev, void *rx_handler, void *rx_handler_data) { + if (dev->br_port) + return -EBUSY; return 0; } static inline void netdev_rx_handler_unregister(struct net_device *dev) { } diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index a85a9b5fa..39e963e01 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -115,11 +115,6 @@ static struct vport *netdev_create(const char *name, const void __user *config) goto error_put; } - if (netdev_vport->dev->br_port) { - err = -EBUSY; - goto error_put; - } - /* If we are using the vport stats layer initialize it to the current * values so we are roughly consistent with the device stats. */ if (USE_VPORT_STATS) {