On Wed, Sep 21, 2011 at 12:48:54PM -0700, Jesse Gross wrote:
> Some versions of Centos 5.6 backport the flag IFF_BRIDGE_PORT
> without the associated rx_handler changes, so this changes to
> use a version check since we really don't care about the actual
> symbol.
> 
> Reported-by: Srinivasan Ramasubramanian <vrsr...@gmail.com>
> Signed-off-by: Jesse Gross <je...@nicira.com>

The code in this function is unreadable.

But your change looks correct.

Acked-by: Ben Pfaff <b...@nicira.com>

----------------------------------------------------------------------

Something like this might be marginally more readable:

static bool netdev_is_vport(struct net_device *dev)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
#  if IFF_BRIDGE_PORT != IFF_OVS_DATAPATH
        return (dev->priv_flags & IFF_OVS_DATAPATH) != 0;
#  else
        return rcu_access_pointer(dev->rx_handler) == netdev_frame_hook;
#  endif
#else
        return rcu_dereference_rtnl(dev->br_port) != NULL;
#endif
}

/* Returns null if this device is not attached to a datapath. */
struct vport *netdev_get_vport(struct net_device *dev)
{
        if (!netdev_is_vport(dev))
                return NULL;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
        return (struct vport *)rcu_dereference_rtnl(dev->rx_handler_data);
#else
        return rcu_dereference_rtnl(dev->br_port);
#endif
}
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to