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 379c1a9c70b16fe65c7668d511acb05e1ec443b9..29a7cccf90225a4e322f9c23f6ed4dd22815fae4 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 a85a9b5fa557c092427af27493b627ee5e3079f0..39e963e019a2f77e5a35336971002784b8a08a66 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) {