Acked-by: Alex Wang <al...@nicira.com> On Sun, Jun 14, 2015 at 12:19 PM, Ben Pfaff <b...@nicira.com> wrote:
> 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 <b...@nicira.com> > --- > lib/dpif-netdev.c | 9 ++++++++- > lib/dpif-netdev.h | 4 +++- > lib/dpif.c | 6 +++--- > 3 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c > index 5b82c8b..d306f77 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); > } > > diff --git a/lib/dpif-netdev.h b/lib/dpif-netdev.h > index 5428b31..9e2dd23 100644 > --- a/lib/dpif-netdev.h > +++ b/lib/dpif-netdev.h > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. > + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2015 Nicira, Inc. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > @@ -40,6 +40,8 @@ static inline void dp_packet_pad(struct dp_packet *p) > } > } > > +bool dpif_is_netdev(const struct dpif *); > + > #define NR_QUEUE 1 > #define NR_PMD_THREADS 1 > > diff --git a/lib/dpif.c b/lib/dpif.c > index 783a715..6e26f30 100644 > --- a/lib/dpif.c > +++ b/lib/dpif.c > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. > + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, > Inc. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > @@ -26,6 +26,7 @@ > #include "coverage.h" > #include "dpctl.h" > #include "dp-packet.h" > +#include "dpif-netdev.h" > #include "dynamic-string.h" > #include "flow.h" > #include "netdev.h" > @@ -1705,6 +1706,5 @@ log_flow_get_message(const struct dpif *dpif, const > struct dpif_flow_get *get, > bool > dpif_supports_tnl_push_pop(const struct dpif *dpif) > { > - return !strcmp(dpif->dpif_class->type, "netdev") || > - !strcmp(dpif->dpif_class->type, "dummy"); > + return dpif_is_netdev(dpif); > } > -- > 2.1.3 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev