Return true in dpif-netdev instance.
Signed-off-by: Roi Dayan <[email protected]>
---
lib/dpif-netdev.c | 15 +++++++--------
lib/dpif-netdev.h | 2 --
lib/dpif-netlink.c | 1 +
lib/dpif-provider.h | 2 ++
lib/dpif.c | 6 ++++++
5 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 53bf80e679cf..de6aa49a5feb 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -686,17 +686,9 @@ pmd_thread_ctx_time_update(struct dp_netdev_pmd_thread
*pmd)
pmd->ctx.now = time_usec();
}
-/* 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_is_netdev(dpif));
return CONTAINER_OF(dpif, struct dpif_netdev, dpif);
}
@@ -9996,6 +9988,12 @@ dpif_netdev_bond_stats_get(struct dpif *dpif, uint32_t
bond_id,
return 0;
}
+static bool
+dpif_netdev_is_userspace(void)
+{
+ return true;
+}
+
const struct dpif_class dpif_netdev_class = {
"netdev",
true, /* cleanup_required */
@@ -10085,6 +10083,7 @@ const struct dpif_class dpif_netdev_class = {
NULL, /* cache_get_name */
NULL, /* cache_get_size */
NULL, /* cache_set_size */
+ dpif_netdev_is_userspace,
};
static void
diff --git a/lib/dpif-netdev.h b/lib/dpif-netdev.h
index 6db6ed2e2128..3323eb0204af 100644
--- a/lib/dpif-netdev.h
+++ b/lib/dpif-netdev.h
@@ -33,8 +33,6 @@ extern "C" {
* headers to be aligned on a 4-byte boundary. */
enum { DP_NETDEV_HEADROOM = 2 + VLAN_HEADER_LEN };
-bool dpif_is_netdev(const struct dpif *);
-
#define NR_QUEUE 1
#define NR_PMD_THREADS 1
diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 84e2bd8eaf58..3434796177aa 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -4589,6 +4589,7 @@ const struct dpif_class dpif_netlink_class = {
dpif_netlink_cache_get_name,
dpif_netlink_cache_get_size,
dpif_netlink_cache_set_size,
+ NULL,
};
static int
diff --git a/lib/dpif-provider.h b/lib/dpif-provider.h
index d4ee25888775..6bc4e0c229ad 100644
--- a/lib/dpif-provider.h
+++ b/lib/dpif-provider.h
@@ -686,6 +686,8 @@ struct dpif_class {
/* Set cache size. */
int (*cache_set_size)(struct dpif *dpif, uint32_t level, uint32_t size);
+
+ bool (*is_userspace)(void);
};
extern const struct dpif_class dpif_netlink_class;
diff --git a/lib/dpif.c b/lib/dpif.c
index 06fe530dba64..28683a1ab85c 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1946,6 +1946,12 @@ log_flow_get_message(const struct dpif *dpif,
}
}
+static bool
+dpif_is_netdev(const struct dpif *dpif)
+{
+ return dpif->dpif_class->is_userspace && dpif->dpif_class->is_userspace();
+}
+
bool
dpif_supports_tnl_push_pop(const struct dpif *dpif)
{
--
2.46.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev