X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev.c;h=ef1a6b982153ce504caf9e7ebde8f2c52d1ef61d;hb=85b20fd6ee585f462e012fbcc7f966a81edab2ed;hp=2b4dec4cb472677083ed9de076104c23eabd4ffd;hpb=e8d780af73b8571f5998cae8d3fa97069e49c9fe;p=sliver-openvswitch.git diff --git a/lib/netdev.c b/lib/netdev.c index 2b4dec4cb..ef1a6b982 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,11 +75,10 @@ netdev_initialize(void) fatal_signal_add_hook(close_all_netdevs, NULL, NULL, true); -#ifdef HAVE_NETLINK +#ifdef LINUX_DATAPATH netdev_register_provider(&netdev_linux_class); netdev_register_provider(&netdev_internal_class); netdev_register_provider(&netdev_tap_class); - netdev_register_provider(&netdev_tap_pl_class); netdev_vport_register(); #endif #ifdef __FreeBSD__ @@ -87,6 +86,7 @@ netdev_initialize(void) netdev_register_provider(&netdev_bsd_class); #endif netdev_register_provider(&netdev_tunnel_class); + netdev_register_provider(&netdev_pltap_class); } } @@ -292,6 +292,18 @@ netdev_get_config(const struct netdev *netdev, struct smap *args) return error; } +const struct netdev_tunnel_config * +netdev_get_tunnel_config(const struct netdev *netdev) +{ + struct netdev_dev *netdev_dev = netdev_get_dev(netdev); + + if (netdev_dev->netdev_class->get_tunnel_config) { + return netdev_dev->netdev_class->get_tunnel_config(netdev_dev); + } else { + return NULL; + } +} + /* Closes and destroys 'netdev'. */ void netdev_close(struct netdev *netdev) @@ -622,9 +634,10 @@ netdev_get_features(const struct netdev *netdev, /* Returns the maximum speed of a network connection that has the NETDEV_F_* * bits in 'features', in bits per second. If no bits that indicate a speed - * are set in 'features', assumes 100Mbps. */ + * are set in 'features', returns 'default_bps'. */ uint64_t -netdev_features_to_bps(enum netdev_features features) +netdev_features_to_bps(enum netdev_features features, + uint64_t default_bps) { enum { F_1000000MB = NETDEV_F_1TB_FD, @@ -643,7 +656,7 @@ netdev_features_to_bps(enum netdev_features features) : features & F_1000MB ? UINT64_C(1000000000) : features & F_100MB ? UINT64_C(100000000) : features & F_10MB ? UINT64_C(10000000) - : UINT64_C(100000000)); + : default_bps); } /* Returns true if any of the NETDEV_F_* bits that indicate a full-duplex link @@ -772,12 +785,12 @@ netdev_get_next_hop(const struct netdev *netdev, * information may be used to populate the status column of the Interface table * as defined in ovs-vswitchd.conf.db(5). */ int -netdev_get_drv_info(const struct netdev *netdev, struct smap *smap) +netdev_get_status(const struct netdev *netdev, struct smap *smap) { struct netdev_dev *dev = netdev_get_dev(netdev); - return (dev->netdev_class->get_drv_info - ? dev->netdev_class->get_drv_info(netdev, smap) + return (dev->netdev_class->get_status + ? dev->netdev_class->get_status(netdev, smap) : EOPNOTSUPP); }