]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.bak/.git/commitdiff
patch bnx2-cnic-over-bridge
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Thu, 28 May 2009 10:54:19 +0000 (11:54 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Thu, 28 May 2009 10:54:19 +0000 (11:54 +0100)
drivers/net/cnic.c

index eacc4358d9772bbc6c0f1b7a03812d6713ba064e..b2f6bf0580528f5e5ccc3149271f9bf3b3699adb 100644 (file)
@@ -2558,6 +2558,14 @@ static inline u16 cnic_get_vlan(struct net_device *dev,
        return 0;
 }
 
+static inline struct net_device *cnic_get_physical(struct net_device *dev)
+{
+       extern struct net_device *br_locate_physical_device(struct net_device *dev);
+       if (dev->priv_flags & IFF_EBRIDGE)
+               dev = br_locate_physical_device(dev);
+       return dev;
+}
+
 #ifndef __VMKLNX__
 static int cnic_get_v4_route(struct sockaddr_in *dst_addr,
                             struct sockaddr_in *src_addr,
@@ -2663,7 +2671,7 @@ static struct cnic_dev *cnic_cm_select_dev(struct sockaddr_in *dst_addr,
 {
        struct cnic_dev *dev = NULL;
        struct dst_entry *dst;
-       struct net_device *netdev = NULL;
+       struct net_device *dstdev, *netdev = NULL;
        int err = -ENETUNREACH, found = 0;
 
        if (dst_addr->sin_family == AF_INET)
@@ -2682,7 +2690,8 @@ static struct cnic_dev *cnic_cm_select_dev(struct sockaddr_in *dst_addr,
        if (!dst->dev)
                goto done;
 
-       cnic_get_vlan(dst->dev, &netdev);
+       dstdev = cnic_get_physical(dst->dev);
+       cnic_get_vlan(dstdev, &netdev);
 
        read_lock(&cnic_dev_lock);
        list_for_each_entry(dev, &cnic_dev_list, list) {
@@ -2742,7 +2751,7 @@ static int cnic_get_route(struct cnic_sock *csk, struct cnic_sockaddr *saddr)
        struct cnic_dev *dev = csk->dev;
        int is_v6, err;
        struct dst_entry *dst;
-       struct net_device *realdev;
+       struct net_device *dstdev, *realdev;
 
        if (saddr->local.v6.sin6_family == AF_INET6 &&
            saddr->remote.v6.sin6_family == AF_INET6)
@@ -2809,7 +2818,9 @@ static int cnic_get_route(struct cnic_sock *csk, struct cnic_sockaddr *saddr)
                }
        }
 
-       csk->vlan_id = cnic_get_vlan(dst->dev, &realdev);
+       dstdev = cnic_get_physical(dst->dev);
+       csk->vlan_id = cnic_get_vlan(dstdev, &realdev);
+
        if (realdev != dev->netdev)
                goto err_out;