diff options
author | Ben Pfaff <blp@nicira.com> | 2015-06-13 15:08:31 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2015-06-16 08:21:28 -0700 |
commit | c4ea752900e12053ca65d0868d47901d251b29eb (patch) | |
tree | b41fd6ef522650930c210394c49b07aef6036810 /lib/dpif-netdev.c | |
parent | 81de18ecd45395d1dbeec6407765a7b34b81e49f (diff) | |
download | openvswitch-c4ea752900e12053ca65d0868d47901d251b29eb.tar.gz |
dpif: Generalize test for dummy dpifs beyond the name.
When --enable-dummy=system or --enable-dummy=override is in use, dpifs
other than "dummy" are actually dummy dpifs, so use a more reliable test.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Diffstat (limited to 'lib/dpif-netdev.c')
-rw-r--r-- | lib/dpif-netdev.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 5b82c8b63..d306f776a 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -519,10 +519,17 @@ emc_cache_slow_sweep(struct emc_cache *flow_cache) flow_cache->sweep_idx = (flow_cache->sweep_idx + 1) & EM_FLOW_HASH_MASK; } +/* Returns true if 'dpif' is a netdev or dummy dpif, false otherwise. */ +bool +dpif_is_netdev(const struct dpif *dpif) +{ + return dpif->dpif_class->open == dpif_netdev_open; +} + static struct dpif_netdev * dpif_netdev_cast(const struct dpif *dpif) { - ovs_assert(dpif->dpif_class->open == dpif_netdev_open); + ovs_assert(dpif_is_netdev(dpif)); return CONTAINER_OF(dpif, struct dpif_netdev, dpif); } |