X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetdev.c;h=1921ac0da0df5328769dc9889420df0295e2c42f;hb=refs%2Fheads%2Fmanual;hp=1b76785ae37d4a80dc31326deec50eaf9fce0a4e;hpb=79f1cbe9f86ddfb1b5d92b80d85e09cd44768d6c;p=openvswitch diff --git a/lib/netdev.c b/lib/netdev.c index 1b76785a..1921ac0d 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -75,11 +75,15 @@ 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_vport_register(); +#endif +#ifdef __FreeBSD__ + netdev_register_provider(&netdev_tap_class); + netdev_register_provider(&netdev_bsd_class); #endif } } @@ -616,9 +620,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, @@ -637,7 +642,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 @@ -843,7 +848,7 @@ do_update_flags(struct netdev *netdev, enum netdev_flags off, int netdev_get_flags(const struct netdev *netdev_, enum netdev_flags *flagsp) { - struct netdev *netdev = (struct netdev *) netdev_; + struct netdev *netdev = CONST_CAST(struct netdev *, netdev_); return do_update_flags(netdev, 0, 0, flagsp, false); }