datapath: Handle duplicate netdev in netdev_rx_handler_register()
authorSimon Horman <horms@verge.net.au>
Mon, 23 Aug 2010 06:30:07 +0000 (15:30 +0900)
committerJesse Gross <jesse@nicira.com>
Mon, 23 Aug 2010 18:37:44 +0000 (14:37 -0400)
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 <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
datapath/vport-netdev.c

index 379c1a9..29a7ccc 100644 (file)
@@ -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) { }
index a85a9b5..39e963e 100644 (file)
@@ -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) {