Split the monolithic struct netdev_dpdk into three structures:
- netdev_dpdk_common: fields shared between eth and vhost
- netdev_dpdk_eth: ethernet specific fields
- netdev_dpdk_vhost: vhost specific fields

Each type specific struct embeds netdev_dpdk_common. The mutex and
list_node move to the per-type structs since they are only relevant
to one type.

Signed-off-by: David Marchand <[email protected]>
---
 lib/netdev-dpdk-common.h | 136 ++-------
 lib/netdev-dpdk.c        | 621 +++++++++++++++++++--------------------
 2 files changed, 329 insertions(+), 428 deletions(-)

diff --git a/lib/netdev-dpdk-common.h b/lib/netdev-dpdk-common.h
index bd3cc63b58..a9bba274a9 100644
--- a/lib/netdev-dpdk-common.h
+++ b/lib/netdev-dpdk-common.h
@@ -33,6 +33,7 @@
 #include "openvswitch/vlog.h"
 #include "ovs-thread.h"
 #include "packets.h"
+#include "util.h"
 
 struct dpdk_tx_queue;
 struct dpdk_qos_ingress_policer;
@@ -94,69 +95,17 @@ struct netdev_dpdk_sw_stats {
 };
 
 struct netdev_dpdk_common {
-    PADDED_MEMBERS_CACHELINE_MARKER(CACHE_LINE_SIZE, cacheline0,
-        uint16_t port_id;
-
-        /* If true, device was attached by rte_eth_dev_attach(). */
-        bool attached;
-        /* If true, rte_eth_dev_start() was successfully called. */
-        bool started;
-        /* If true, this is a port representor. */
-        bool is_representor;
-        struct eth_addr hwaddr;
-        /* 1 pad bytes here. */
-        int mtu;
-        int socket_id;
-        int buf_size;
+    PADDED_MEMBERS(CACHE_LINE_SIZE,
         int max_packet_len;
         enum netdev_flags flags;
-        int link_reset_cnt;
-        union {
-            /* Device arguments for dpdk ports. */
-            char *devargs;
-            /* Identifier used to distinguish vhost devices from each other. */
-            char *vhost_id;
-        };
         struct dpdk_tx_queue *tx_q;
-        struct rte_eth_link link;
-    );
-
-    PADDED_MEMBERS_CACHELINE_MARKER(CACHE_LINE_SIZE, cacheline1,
-        struct ovs_mutex mutex;
         struct dpdk_mp *dpdk_mp;
 
-        /* virtio identifier for vhost devices */
-        ovsrcu_index vid;
-
-        /* True if vHost device is 'up' and has been reconfigured at least
-         * once */
-        bool vhost_reconfigured;
-
-        atomic_uint8_t vhost_tx_retries_max;
-
-        /* Flags for virtio features recovery mechanism. */
-        uint8_t virtio_features_state;
-
-        /* 1 pad byte here. */
-    );
-
-    PADDED_MEMBERS(CACHE_LINE_SIZE,
-        struct netdev up;
-        struct ovs_list list_node;
-
         /* QoS configuration and lock for the device */
         OVSRCU_TYPE(struct dpdk_qos_conf *) qos_conf;
 
         /* Ingress Policer */
         OVSRCU_TYPE(struct dpdk_qos_ingress_policer *) ingress_policer;
-        uint32_t policer_rate;
-        uint32_t policer_burst;
-
-        /* Array of vhost rxq states, see vring_state_changed. */
-        bool *vhost_rxq_enabled;
-
-        /* Ensures that Rx metadata delivery is configured only once. */
-        bool rx_metadata_delivery_configured;
     );
 
     PADDED_MEMBERS(CACHE_LINE_SIZE,
@@ -164,69 +113,34 @@ struct netdev_dpdk_common {
         struct netdev_dpdk_sw_stats *sw_stats;
         /* Protects stats */
         rte_spinlock_t stats_lock;
-        /* 36 pad bytes here. */
     );
 
     PADDED_MEMBERS(CACHE_LINE_SIZE,
-        /* The following properties cannot be changed when a device is running,
-         * so we remember the request and update them next time
-         * netdev_dpdk*_reconfigure() is called */
-        int requested_mtu;
-        int requested_n_txq;
-        /* User input for n_rxq (see dpdk_set_rxq_config). */
-        int user_n_rxq;
-        /* user_n_rxq + an optional rx steering queue (see
-         * netdev_dpdk_reconfigure). This field is different from the other
-         * requested_* fields as it may contain a different value than the user
-         * input. */
-        int requested_n_rxq;
-        int requested_rxq_size;
-        int requested_txq_size;
-
-        /* Number of rx/tx descriptors for physical devices */
-        int rxq_size;
-        int txq_size;
-
-        /* Socket ID detected when vHost device is brought up */
-        int requested_socket_id;
-
-        /* Ignored by DPDK for vhost-user backends, only for VDUSE. */
-        uint8_t vhost_max_queue_pairs;
-
-        /* Denotes whether vHost port is client/server mode */
-        uint64_t vhost_driver_flags;
-
-        /* DPDK-ETH Flow control */
-        struct rte_eth_fc_conf fc_conf;
-
-        /* DPDK-ETH hardware offload features,
-         * from the enum set 'dpdk_hw_ol_features' */
-        uint32_t hw_ol_features;
-
-        /* Properties for link state change detection mode.
-         * If lsc_interrupt_mode is set to false, poll mode is used,
-         * otherwise interrupt mode is used. */
-        bool requested_lsc_interrupt_mode;
-        bool lsc_interrupt_mode;
-
-        /* VF configuration. */
-        struct eth_addr requested_hwaddr;
-
-        /* Requested rx queue steering flags,
-         * from the enum set 'dpdk_rx_steer_flags'. */
-        uint64_t requested_rx_steer_flags;
-        uint64_t rx_steer_flags;
-        size_t rx_steer_flows_num;
-        struct rte_flow **rx_steer_flows;
+        struct netdev up;
     );
 
-    PADDED_MEMBERS(CACHE_LINE_SIZE,
-        /* Names of all XSTATS counters */
-        struct rte_eth_xstat_name *rte_xstats_names;
-        int rte_xstats_names_size;
-        int rte_xstats_ids_size;
-        uint64_t *rte_xstats_ids;
-    );
+    int mtu;
+    int socket_id;
+    int buf_size;
+
+    /* The following properties cannot be changed when a device is running,
+     * so we remember the request and update them next time
+     * netdev_dpdk*_reconfigure() is called */
+    int requested_mtu;
+    int requested_n_txq;
+    int requested_n_rxq;
+
+    /* Socket ID detected when vHost device is brought up */
+    int requested_socket_id;
+
+    /* DPDK-ETH hardware offload features,
+     * from the enum set 'dpdk_hw_ol_features' */
+    uint32_t hw_ol_features;
+
+    struct eth_addr hwaddr;
+
+    uint32_t policer_rate;
+    uint32_t policer_burst;
 };
 
 static inline struct netdev_dpdk_common *
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 625fd079d9..f4f807d02b 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -187,7 +187,7 @@ enum dpdk_rx_steer_flags {
     DPDK_RX_STEER_LACP = 1 << 0,
 };
 
-/* Flags for the netdev_dpdk virtio_features_state field.
+/* Flags for the netdev_dpdk_vhost virtio_features_state field.
  * This is used for the virtio features recovery mechanism linked to TSO
  * support. */
 #define OVS_VIRTIO_F_CLEAN (UINT8_C(1) << 0)
@@ -212,148 +212,129 @@ enum dpdk_rx_steer_flags {
  *
  * Example:
  *     struct netdev *netdev = netdev_from_name(name);
- *     struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+ *     struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
  *
- *  Also, 'netdev' should be used instead of 'common->up', where 'netdev' was
- *  already defined.
+ *  'netdev' should be used instead of 'dev->common.up', where 'netdev'
+ *  was already defined.
+ *  'common' should be used instead of 'dev->common', where 'common'
+ *  was already defined.
  */
 
-struct netdev_dpdk {
-    PADDED_MEMBERS_CACHELINE_MARKER(CACHE_LINE_SIZE, cacheline0,
+struct netdev_dpdk_eth {
+    PADDED_MEMBERS(CACHE_LINE_SIZE,
         dpdk_port_t port_id;
+    );
 
-        /* If true, device was attached by rte_eth_dev_attach(). */
-        bool attached;
-        /* If true, rte_eth_dev_start() was successfully called. */
-        bool started;
-        /* If true, this is a port representor. */
-        bool is_representor;
-        struct eth_addr hwaddr;
-        /* 1 pad bytes here. */
-        int mtu;
-        int socket_id;
-        int buf_size;
-        int max_packet_len;
-        enum netdev_flags flags;
-        int link_reset_cnt;
-        union {
-            /* Device arguments for dpdk ports. */
-            char *devargs;
-            /* Identifier used to distinguish vhost devices from each other. */
-            char *vhost_id;
-        };
-        struct dpdk_tx_queue *tx_q;
-        struct rte_eth_link link;
+    struct netdev_dpdk_common common;
+
+    PADDED_MEMBERS(CACHE_LINE_SIZE,
+        struct ovs_mutex mutex OVS_ACQ_AFTER(dpdk_eth_mutex);
+        /* In dpdk_eth_list. */
+        struct ovs_list list_node OVS_GUARDED_BY(dpdk_eth_mutex);
     );
 
-    PADDED_MEMBERS_CACHELINE_MARKER(CACHE_LINE_SIZE, cacheline1,
-        struct ovs_mutex mutex OVS_ACQ_AFTER(dpdk_eth_mutex, dpdk_vhost_mutex);
-        struct dpdk_mp *dpdk_mp;
+    /* Device arguments for dpdk ports. */
+    char *devargs;
 
-        /* virtio identifier for vhost devices */
-        ovsrcu_index vid;
+    struct rte_eth_link link;
 
-        /* True if vHost device is 'up' and has been reconfigured at least 
once */
-        bool vhost_reconfigured;
+    /* Requested rx queue steering flags,
+     * from the enum set 'dpdk_rx_steer_flags'. */
+    uint64_t requested_rx_steer_flags;
+    uint64_t rx_steer_flags;
+    size_t rx_steer_flows_num;
+    struct rte_flow **rx_steer_flows;
 
-        atomic_uint8_t vhost_tx_retries_max;
+    /* Names of all XSTATS counters */
+    struct rte_eth_xstat_name *rte_xstats_names;
+    uint64_t *rte_xstats_ids;
 
-        /* Flags for virtio features recovery mechanism. */
-        uint8_t virtio_features_state;
+    /* DPDK-ETH Flow control */
+    struct rte_eth_fc_conf fc_conf;
 
-        /* 1 pad byte here. */
-    );
+    int link_reset_cnt;
 
-    PADDED_MEMBERS(CACHE_LINE_SIZE,
-        struct netdev up;
-        /* In dpdk_eth_list or dpdk_vhost_list. */
-        struct ovs_list list_node;
+    /* User input for n_rxq (see dpdk_set_rxq_config). */
+    int user_n_rxq;
 
-        /* QoS configuration and lock for the device */
-        OVSRCU_TYPE(struct dpdk_qos_conf *) qos_conf;
+    int requested_rxq_size;
+    int requested_txq_size;
 
-        /* Ingress Policer */
-        OVSRCU_TYPE(struct dpdk_qos_ingress_policer *) ingress_policer;
-        uint32_t policer_rate;
-        uint32_t policer_burst;
+    /* Number of rx/tx descriptors for physical devices */
+    int rxq_size;
+    int txq_size;
 
-        /* Array of vhost rxq states, see vring_state_changed. */
-        bool *vhost_rxq_enabled;
+    int rte_xstats_names_size;
+    int rte_xstats_ids_size;
+
+    /* If true, device was attached by rte_eth_dev_attach(). */
+    bool attached;
+    /* If true, rte_eth_dev_start() was successfully called. */
+    bool started;
+    /* If true, this is a port representor. */
+    bool is_representor;
+
+    /* Ensures that Rx metadata delivery is configured only once. */
+    bool rx_metadata_delivery_configured;
+
+    /* Properties for link state change detection mode.
+     * If lsc_interrupt_mode is set to false, poll mode is used,
+     * otherwise interrupt mode is used. */
+    bool requested_lsc_interrupt_mode;
+    bool lsc_interrupt_mode;
+
+    /* VF configuration. */
+    struct eth_addr requested_hwaddr;
+};
 
-        /* Ensures that Rx metadata delivery is configured only once. */
-        bool rx_metadata_delivery_configured;
-    );
+static struct netdev_dpdk_eth *
+netdev_dpdk_eth_cast(const struct netdev *netdev)
+{
+    return CONTAINER_OF(netdev, struct netdev_dpdk_eth, common.up);
+}
 
+struct netdev_dpdk_vhost {
     PADDED_MEMBERS(CACHE_LINE_SIZE,
-        struct netdev_stats stats;
-        struct netdev_dpdk_sw_stats *sw_stats;
-        /* Protects stats */
-        rte_spinlock_t stats_lock;
-        /* 36 pad bytes here. */
-    );
+        /* virtio identifier for vhost devices */
+        ovsrcu_index vid;
 
-    PADDED_MEMBERS(CACHE_LINE_SIZE,
-        /* The following properties cannot be changed when a device is running,
-         * so we remember the request and update them next time
-         * netdev_dpdk*_reconfigure() is called */
-        int requested_mtu;
-        int requested_n_txq;
-        /* User input for n_rxq (see dpdk_set_rxq_config). */
-        int user_n_rxq;
-        /* user_n_rxq + an optional rx steering queue (see
-         * netdev_dpdk_eth_reconfigure). This field is different from the other
-         * requested_* fields as it may contain a different value than the user
-         * input. */
-        int requested_n_rxq;
-        int requested_rxq_size;
-        int requested_txq_size;
-
-        /* Number of rx/tx descriptors for physical devices */
-        int rxq_size;
-        int txq_size;
-
-        /* Socket ID detected when vHost device is brought up */
-        int requested_socket_id;
-
-        /* Ignored by DPDK for vhost-user backends, only for VDUSE. */
-        uint8_t vhost_max_queue_pairs;
-
-        /* Denotes whether vHost port is client/server mode */
-        uint64_t vhost_driver_flags;
-
-        /* DPDK-ETH Flow control */
-        struct rte_eth_fc_conf fc_conf;
-
-        /* DPDK-ETH hardware offload features,
-         * from the enum set 'dpdk_hw_ol_features' */
-        uint32_t hw_ol_features;
-
-        /* Properties for link state change detection mode.
-         * If lsc_interrupt_mode is set to false, poll mode is used,
-         * otherwise interrupt mode is used. */
-        bool requested_lsc_interrupt_mode;
-        bool lsc_interrupt_mode;
-
-        /* VF configuration. */
-        struct eth_addr requested_hwaddr;
-
-        /* Requested rx queue steering flags,
-         * from the enum set 'dpdk_rx_steer_flags'. */
-        uint64_t requested_rx_steer_flags;
-        uint64_t rx_steer_flags;
-        size_t rx_steer_flows_num;
-        struct rte_flow **rx_steer_flows;
+        /* True if vHost device is 'up' and has been reconfigured at least
+         * once. */
+        bool vhost_reconfigured;
+
+        atomic_uint8_t vhost_tx_retries_max;
     );
 
+    struct netdev_dpdk_common common;
+
     PADDED_MEMBERS(CACHE_LINE_SIZE,
-        /* Names of all XSTATS counters */
-        struct rte_eth_xstat_name *rte_xstats_names;
-        int rte_xstats_names_size;
-        int rte_xstats_ids_size;
-        uint64_t *rte_xstats_ids;
+        struct ovs_mutex mutex OVS_ACQ_AFTER(dpdk_vhost_mutex);
+        /* In dpdk_vhost_list. */
+        struct ovs_list list_node OVS_GUARDED_BY(dpdk_vhost_mutex);
     );
+
+    /* Identifier used to distinguish vhost devices from each other. */
+    char *vhost_id;
+
+    /* Array of vhost rxq states, see vring_state_changed. */
+    bool *vhost_rxq_enabled;
+
+    /* Denotes whether vHost port is client/server mode */
+    uint64_t vhost_driver_flags;
+
+    /* Flags for virtio features recovery mechanism. */
+    uint8_t virtio_features_state;
+
+    /* Ignored by DPDK for vhost-user backends, only for VDUSE. */
+    uint8_t vhost_max_queue_pairs;
 };
 
+static struct netdev_dpdk_vhost *
+netdev_dpdk_vhost_cast(const struct netdev *netdev)
+{
+    return CONTAINER_OF(netdev, struct netdev_dpdk_vhost, common.up);
+}
+
 struct netdev_rxq_dpdk {
     struct netdev_rxq up;
     dpdk_port_t port_id;
@@ -363,10 +344,10 @@ static const struct netdev_class netdev_dpdk_class;
 static const struct netdev_class netdev_dpdk_vhost_class;
 static const struct netdev_class netdev_dpdk_vhost_client_class;
 
-static void netdev_dpdk_configure_xstats(struct netdev_dpdk *dev);
-static void netdev_dpdk_clear_xstats(struct netdev_dpdk *dev);
+static void netdev_dpdk_configure_xstats(struct netdev_dpdk_eth *dev);
+static void netdev_dpdk_clear_xstats(struct netdev_dpdk_eth *dev);
 
-int netdev_dpdk_get_vid(const struct netdev_dpdk *dev);
+int netdev_dpdk_get_vid(const struct netdev_dpdk_vhost *dev);
 
 static bool
 is_eth_class(const struct netdev_class *class)
@@ -446,7 +427,7 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk_common 
*common,
 }
 
 static void
-check_link_status(struct netdev_dpdk *dev)
+check_link_status(struct netdev_dpdk_eth *dev)
 {
     struct rte_eth_link link;
 
@@ -458,7 +439,7 @@ check_link_status(struct netdev_dpdk *dev)
     }
 
     if (dev->link.link_status != link.link_status) {
-        netdev_change_seq_changed(&dev->up);
+        netdev_change_seq_changed(&dev->common.up);
 
         dev->link_reset_cnt++;
         dev->link = link;
@@ -478,7 +459,7 @@ check_link_status(struct netdev_dpdk *dev)
 static void *
 dpdk_watchdog(void *dummy OVS_UNUSED)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_eth *dev;
 
     pthread_detach(pthread_self());
 
@@ -497,11 +478,11 @@ dpdk_watchdog(void *dummy OVS_UNUSED)
 }
 
 static int
-dpdk_eth_dev_port_config(struct netdev_dpdk *dev,
+dpdk_eth_dev_port_config(struct netdev_dpdk_eth *dev,
                          const struct rte_eth_dev_info *info,
                          int n_rxq, int n_txq)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+    struct netdev_dpdk_common *common = &dev->common;
     struct rte_eth_conf conf = port_conf;
     struct netdev *netdev = &common->up;
     uint16_t conf_mtu;
@@ -655,7 +636,7 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev,
 }
 
 static void
-dpdk_eth_flow_ctrl_setup(struct netdev_dpdk *dev) OVS_REQUIRES(dev->mutex)
+dpdk_eth_flow_ctrl_setup(struct netdev_dpdk_eth *dev) OVS_REQUIRES(dev->mutex)
 {
     if (rte_eth_dev_flow_ctrl_set(dev->port_id, &dev->fc_conf)) {
         VLOG_WARN("Failed to enable flow control on device "DPDK_PORT_ID_FMT,
@@ -664,9 +645,9 @@ dpdk_eth_flow_ctrl_setup(struct netdev_dpdk *dev) 
OVS_REQUIRES(dev->mutex)
 }
 
 static void
-dpdk_eth_dev_init_rx_metadata(struct netdev_dpdk *dev)
+dpdk_eth_dev_init_rx_metadata(struct netdev_dpdk_eth *dev)
 {
-    struct netdev *netdev = &dev->up;
+    struct netdev *netdev = &dev->common.up;
     uint64_t rx_metadata = 0;
     int ret;
 
@@ -693,10 +674,10 @@ dpdk_eth_dev_init_rx_metadata(struct netdev_dpdk *dev)
 }
 
 static int
-dpdk_eth_dev_init(struct netdev_dpdk *dev)
+dpdk_eth_dev_init(struct netdev_dpdk_eth *dev)
     OVS_REQUIRES(dev->mutex)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+    struct netdev_dpdk_common *common = &dev->common;
     struct rte_pktmbuf_pool_private *mbp_priv;
     struct netdev *netdev = &common->up;
     struct rte_eth_dev_info info;
@@ -859,20 +840,14 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev)
     return 0;
 }
 
-static struct netdev_dpdk *
-netdev_dpdk_cast(const struct netdev *netdev)
-{
-    return CONTAINER_OF(netdev, struct netdev_dpdk, up);
-}
-
 static struct netdev *
 netdev_dpdk_eth_alloc(void)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_eth *dev;
 
     dev = dpdk_zmalloc(sizeof *dev);
     if (dev) {
-        return &dev->up;
+        return &dev->common.up;
     }
 
     return NULL;
@@ -897,11 +872,11 @@ netdev_dpdk_alloc_txq(unsigned int n_txqs)
 static struct netdev *
 netdev_dpdk_vhost_alloc(void)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_vhost *dev;
 
     dev = dpdk_zmalloc(sizeof *dev);
     if (dev) {
-        return &dev->up;
+        return &dev->common.up;
     }
 
     return NULL;
@@ -912,8 +887,6 @@ common_construct(struct netdev_dpdk_common *common, int 
socket_id)
 {
     struct netdev *netdev = &common->up;
 
-    ovs_mutex_init(&common->mutex);
-
     rte_spinlock_init(&common->stats_lock);
 
     /* If the 'sid' is negative, it means that the kernel fails
@@ -949,9 +922,9 @@ static int
 vhost_common_construct(struct netdev *netdev)
     OVS_REQUIRES(dpdk_vhost_mutex)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int socket_id = rte_lcore_to_socket_id(rte_get_main_lcore());
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
 
     dev->vhost_rxq_enabled = dpdk_zmalloc(OVS_VHOST_MAX_QUEUE_NUM *
                                           sizeof *dev->vhost_rxq_enabled);
@@ -976,6 +949,7 @@ vhost_common_construct(struct netdev *netdev)
 
     common_construct(common, socket_id);
 
+    ovs_mutex_init(&dev->mutex);
     ovs_list_push_back(&dpdk_vhost_list, &dev->list_node);
 
     return 0;
@@ -984,7 +958,7 @@ vhost_common_construct(struct netdev *netdev)
 static int
 netdev_dpdk_vhost_construct(struct netdev *netdev)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
     const char *name = netdev->name;
     int err;
 
@@ -1082,12 +1056,13 @@ netdev_dpdk_vhost_client_construct(struct netdev 
*netdev)
 static int
 netdev_dpdk_eth_construct(struct netdev *netdev)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
 
     ovs_mutex_lock(&dpdk_eth_mutex);
     common_construct(common, SOCKET0);
 
+    ovs_mutex_init(&dev->mutex);
     dev->port_id = DPDK_ETH_PORT_ID_INVALID;
     dev->attached = false;
     dev->started = false;
@@ -1115,7 +1090,6 @@ netdev_dpdk_eth_construct(struct netdev *netdev)
 
 static void
 common_destruct(struct netdev_dpdk_common *common)
-    OVS_EXCLUDED(common->mutex)
 {
     rte_free(common->tx_q);
     dpdk_mp_put(common->dpdk_mp);
@@ -1123,16 +1097,15 @@ common_destruct(struct netdev_dpdk_common *common)
     free(ovsrcu_get_protected(struct dpdk_qos_ingress_policer *,
                               &common->ingress_policer));
     free(common->sw_stats);
-    ovs_mutex_destroy(&common->mutex);
 }
 
-static void dpdk_rx_steer_unconfigure(struct netdev_dpdk *);
+static void dpdk_rx_steer_unconfigure(struct netdev_dpdk_eth *);
 
 static void
 netdev_dpdk_eth_destruct(struct netdev *netdev)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
 
     ovs_mutex_lock(&dpdk_eth_mutex);
 
@@ -1151,7 +1124,7 @@ netdev_dpdk_eth_destruct(struct netdev *netdev)
         /* Check if this netdev has siblings (i.e. shares DPDK resources) among
          * other OVS netdevs. */
         RTE_ETH_FOREACH_DEV_SIBLING (sibling_port_id, dev->port_id) {
-            struct netdev_dpdk *sibling;
+            struct netdev_dpdk_eth *sibling;
 
             /* RTE_ETH_FOREACH_DEV_SIBLING lists dev->port_id as part of the
              * loop. */
@@ -1203,13 +1176,14 @@ netdev_dpdk_eth_destruct(struct netdev *netdev)
     common_destruct(common);
 
     ovs_list_remove(&dev->list_node);
+    ovs_mutex_destroy(&dev->mutex);
     ovs_mutex_unlock(&dpdk_eth_mutex);
 }
 
 static void
 netdev_dpdk_eth_dealloc(struct netdev *netdev)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
 
     rte_free(dev);
 }
@@ -1218,7 +1192,7 @@ netdev_dpdk_eth_dealloc(struct netdev *netdev)
  * try to acquire 'dpdk_vhost_mutex' and possibly 'dev->mutex'.  To avoid a
  * deadlock, none of the mutexes must be held while calling this function. */
 static int
-dpdk_vhost_driver_unregister(struct netdev_dpdk *dev OVS_UNUSED,
+dpdk_vhost_driver_unregister(struct netdev_dpdk_vhost *dev OVS_UNUSED,
                              char *vhost_id)
     OVS_EXCLUDED(dpdk_vhost_mutex)
     OVS_EXCLUDED(dev->mutex)
@@ -1229,8 +1203,8 @@ dpdk_vhost_driver_unregister(struct netdev_dpdk *dev 
OVS_UNUSED,
 static void
 netdev_dpdk_vhost_destruct(struct netdev *netdev)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     bool is_client_mode;
     char *vhost_id;
 
@@ -1253,6 +1227,7 @@ netdev_dpdk_vhost_destruct(struct netdev *netdev)
     common_destruct(common);
 
     ovs_list_remove(&dev->list_node);
+    ovs_mutex_destroy(&dev->mutex);
     ovs_mutex_unlock(&dpdk_vhost_mutex);
 
     if (!vhost_id) {
@@ -1273,13 +1248,13 @@ out:
 static void
 netdev_dpdk_vhost_dealloc(struct netdev *netdev)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
 
     rte_free(dev);
 }
 
 static void
-netdev_dpdk_clear_xstats(struct netdev_dpdk *dev)
+netdev_dpdk_clear_xstats(struct netdev_dpdk_eth *dev)
     OVS_REQUIRES(dev->mutex)
 {
     free(dev->rte_xstats_names);
@@ -1291,7 +1266,7 @@ netdev_dpdk_clear_xstats(struct netdev_dpdk *dev)
 }
 
 static const char *
-netdev_dpdk_get_xstat_name(struct netdev_dpdk *dev, uint64_t id)
+netdev_dpdk_get_xstat_name(struct netdev_dpdk_eth *dev, uint64_t id)
     OVS_REQUIRES(dev->mutex)
 {
     if (id >= dev->rte_xstats_names_size) {
@@ -1311,7 +1286,7 @@ is_queue_stat(const char *s)
 }
 
 static void
-netdev_dpdk_configure_xstats(struct netdev_dpdk *dev)
+netdev_dpdk_configure_xstats(struct netdev_dpdk_eth *dev)
     OVS_REQUIRES(dev->mutex)
 {
     struct rte_eth_xstat_name *rte_xstats_names = NULL;
@@ -1380,7 +1355,7 @@ out:
 static int
 netdev_dpdk_eth_get_config(const struct netdev *netdev, struct smap *args)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
 
     ovs_mutex_lock(&dev->mutex);
 
@@ -1424,11 +1399,11 @@ netdev_dpdk_eth_get_config(const struct netdev *netdev, 
struct smap *args)
     return 0;
 }
 
-static struct netdev_dpdk *
+static struct netdev_dpdk_eth *
 netdev_dpdk_lookup_by_port_id(dpdk_port_t port_id)
     OVS_REQUIRES(dpdk_eth_mutex)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_eth *dev;
 
     LIST_FOR_EACH (dev, list_node, &dpdk_eth_list) {
         if (dev->port_id == port_id) {
@@ -1494,7 +1469,7 @@ static dpdk_port_t netdev_dpdk_get_port_by_devargs(const 
char *devargs)
  * PCI id for adding ports (when it's enough for them).
  */
 static dpdk_port_t
-netdev_dpdk_process_devargs(struct netdev_dpdk *dev,
+netdev_dpdk_process_devargs(struct netdev_dpdk_eth *dev,
                             const char *devargs, char **errp)
     OVS_REQUIRES(dpdk_eth_mutex)
 {
@@ -1563,7 +1538,7 @@ netdev_dpdk_eth_run(const struct netdev_class 
*netdev_class OVS_UNUSED)
         netdev_dpdk_last_reset_seq = reset_seq;
 
         for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++) {
-            struct netdev_dpdk *dev;
+            struct netdev_dpdk_eth *dev;
             bool pending_reset;
 
             atomic_read_relaxed(&netdev_dpdk_pending_reset[port_id],
@@ -1575,7 +1550,7 @@ netdev_dpdk_eth_run(const struct netdev_class 
*netdev_class OVS_UNUSED)
             ovs_mutex_lock(&dpdk_eth_mutex);
             dev = netdev_dpdk_lookup_by_port_id(port_id);
             if (dev) {
-                struct netdev *netdev = &dev->up;
+                struct netdev *netdev = &dev->common.up;
 
                 ovs_mutex_lock(&dev->mutex);
                 netdev_request_reconfigure(netdev);
@@ -1606,7 +1581,7 @@ dpdk_eth_event_callback(dpdk_port_t port_id, enum 
rte_eth_event_type type,
 }
 
 static void
-dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args)
+dpdk_set_rxq_config(struct netdev_dpdk_eth *dev, const struct smap *args)
     OVS_REQUIRES(dev->mutex)
 {
     int new_n_rxq;
@@ -1614,7 +1589,7 @@ dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct 
smap *args)
     new_n_rxq = MAX(smap_get_int(args, "n_rxq", NR_QUEUE), 1);
     if (new_n_rxq != dev->user_n_rxq) {
         dev->user_n_rxq = new_n_rxq;
-        netdev_request_reconfigure(&dev->up);
+        netdev_request_reconfigure(&dev->common.up);
     }
 }
 
@@ -1622,7 +1597,7 @@ static void
 dpdk_process_queue_size(struct netdev *netdev, const struct smap *args,
                         struct rte_eth_dev_info *info, bool is_rx)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
     struct rte_eth_desc_lim *lim;
     int default_size, queue_size, cur_size, new_requested_size;
     int *cur_requested_size;
@@ -1672,7 +1647,7 @@ dpdk_process_queue_size(struct netdev *netdev, const 
struct smap *args,
 }
 
 static void
-dpdk_set_rx_steer_config(struct netdev *netdev, struct netdev_dpdk *dev,
+dpdk_set_rx_steer_config(struct netdev *netdev, struct netdev_dpdk_eth *dev,
                          const struct smap *args)
 {
     const char *arg = smap_get_def(args, "rx-steering", "rss");
@@ -1701,9 +1676,9 @@ static int
 netdev_dpdk_eth_set_config(struct netdev *netdev, const struct smap *args,
                            char **errp)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
     bool rx_fc_en, tx_fc_en, autoneg, lsc_interrupt_mode;
+    struct netdev_dpdk_common *common = &dev->common;
     bool flow_control_requested = true;
     enum rte_eth_fc_mode fc_mode;
     static const enum rte_eth_fc_mode fc_mode_set[2][2] = {
@@ -1746,14 +1721,14 @@ netdev_dpdk_eth_set_config(struct netdev *netdev, const 
struct smap *args,
                 /* Already configured, do not reconfigure again */
                 err = 0;
             } else {
-                struct netdev_dpdk *dup_dev;
+                struct netdev_dpdk_eth *dup_dev;
 
                 dup_dev = netdev_dpdk_lookup_by_port_id(new_port_id);
                 if (dup_dev) {
                     VLOG_WARN_BUF(errp, "'%s' is trying to use device '%s' "
                                   "which is already in use by '%s'",
                                   netdev_get_name(netdev), new_devargs,
-                                  netdev_get_name(&dup_dev->up));
+                                  netdev_get_name(&dup_dev->common.up));
                     err = EADDRINUSE;
                 } else {
                     int sid = rte_eth_dev_socket_id(new_port_id);
@@ -1872,7 +1847,7 @@ static int
 netdev_dpdk_vhost_client_get_config(const struct netdev *netdev,
                                     struct smap *args)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
     int tx_retries_max;
 
     ovs_mutex_lock(&dev->mutex);
@@ -1896,7 +1871,7 @@ netdev_dpdk_vhost_client_set_config(struct netdev *netdev,
                                     const struct smap *args,
                                     char **errp OVS_UNUSED)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
     const char *path;
     int max_tx_retries, cur_max_tx_retries;
     uint32_t max_queue_pairs;
@@ -1941,8 +1916,8 @@ netdev_dpdk_vhost_client_set_config(struct netdev *netdev,
 static int
 netdev_dpdk_eth_set_tx_multiq(struct netdev *netdev, unsigned int n_txq)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
 
     ovs_mutex_lock(&dev->mutex);
 
@@ -1979,8 +1954,8 @@ netdev_rxq_dpdk_cast(const struct netdev_rxq *rxq)
 static int
 netdev_dpdk_eth_rxq_construct(struct netdev_rxq *rxq)
 {
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(rxq->netdev);
     struct netdev_rxq_dpdk *rx = netdev_rxq_dpdk_cast(rxq);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(rxq->netdev);
 
     ovs_mutex_lock(&dev->mutex);
     rx->port_id = dev->port_id;
@@ -2046,10 +2021,10 @@ netdev_dpdk_batch_init_packet_fields(struct 
dp_packet_batch *batch)
  *
  * Returns the number of packets that weren't transmitted. */
 static inline int
-netdev_dpdk_eth_tx_burst(struct netdev_dpdk *dev, int qid,
+netdev_dpdk_eth_tx_burst(struct netdev_dpdk_eth *dev, int qid,
                          struct rte_mbuf **pkts, int cnt)
 {
-    struct netdev *netdev = &dev->up;
+    struct netdev *netdev = &dev->common.up;
     uint32_t nb_tx = 0;
     uint16_t nb_tx_prep = cnt;
 
@@ -2083,7 +2058,7 @@ netdev_dpdk_eth_tx_burst(struct netdev_dpdk *dev, int qid,
 }
 
 static bool
-is_vhost_running(struct netdev_dpdk *dev)
+is_vhost_running(struct netdev_dpdk_vhost *dev)
 {
     return (netdev_dpdk_get_vid(dev) >= 0 && dev->vhost_reconfigured);
 }
@@ -2095,8 +2070,8 @@ static int
 netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,
                            struct dp_packet_batch *batch, int *qfill)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(rxq->netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(rxq->netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(rxq->netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     struct dpdk_qos_ingress_policer *policer;
     uint16_t nb_rx = 0;
     uint16_t qos_drops = 0;
@@ -2151,7 +2126,7 @@ netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,
 static bool
 netdev_dpdk_vhost_rxq_enabled(struct netdev_rxq *rxq)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(rxq->netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(rxq->netdev);
 
     return dev->vhost_rxq_enabled[rxq->queue_id];
 }
@@ -2214,8 +2189,8 @@ netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
                        struct dp_packet_batch *batch,
                        bool concurrent_txq OVS_UNUSED)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int max_retries = VHOST_ENQ_RETRY_MIN;
     int cnt, batch_cnt, vhost_batch_cnt;
     int vid = netdev_dpdk_get_vid(dev);
@@ -2305,9 +2280,9 @@ static int
 netdev_dpdk_eth_send(struct netdev *netdev, int qid,
                      struct dp_packet_batch *batch, bool concurrent_txq)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
     struct rte_mbuf **pkts = (struct rte_mbuf **) batch->packets;
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int batch_cnt = dp_packet_batch_size(batch);
     struct netdev_dpdk_sw_stats stats;
     int cnt, dropped;
@@ -2350,11 +2325,11 @@ netdev_dpdk_eth_send(struct netdev *netdev, int qid,
 }
 
 static int
-netdev_dpdk_eth_set_etheraddr__(struct netdev_dpdk *dev,
+netdev_dpdk_eth_set_etheraddr__(struct netdev_dpdk_eth *dev,
                                 const struct eth_addr mac)
     OVS_REQUIRES(dev->mutex)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+    struct netdev_dpdk_common *common = &dev->common;
     struct rte_ether_addr ea;
     int err;
 
@@ -2374,8 +2349,8 @@ netdev_dpdk_eth_set_etheraddr__(struct netdev_dpdk *dev,
 static int
 netdev_dpdk_eth_set_etheraddr(struct netdev *netdev, const struct eth_addr mac)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int err = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -2395,7 +2370,7 @@ netdev_dpdk_vhost_set_etheraddr(struct netdev *netdev,
                                 const struct eth_addr mac)
 {
     struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
 
     ovs_mutex_lock(&dev->mutex);
     if (!eth_addr_equals(common->hwaddr, mac)) {
@@ -2411,8 +2386,8 @@ static int
 netdev_dpdk_eth_get_etheraddr(const struct netdev *netdev,
                               struct eth_addr *mac)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
 
     ovs_mutex_lock(&dev->mutex);
     netdev_dpdk_common_get_etheraddr(common, mac);
@@ -2425,8 +2400,8 @@ static int
 netdev_dpdk_vhost_get_etheraddr(const struct netdev *netdev,
                                 struct eth_addr *mac)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
 
     ovs_mutex_lock(&dev->mutex);
     netdev_dpdk_common_get_etheraddr(common, mac);
@@ -2438,8 +2413,8 @@ netdev_dpdk_vhost_get_etheraddr(const struct netdev 
*netdev,
 static int
 netdev_dpdk_eth_get_mtu(const struct netdev *netdev, int *mtup)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
 
     ovs_mutex_lock(&dev->mutex);
     netdev_dpdk_common_get_mtu(common, mtup);
@@ -2451,8 +2426,8 @@ netdev_dpdk_eth_get_mtu(const struct netdev *netdev, int 
*mtup)
 static int
 netdev_dpdk_vhost_get_mtu(const struct netdev *netdev, int *mtup)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
 
     ovs_mutex_lock(&dev->mutex);
     netdev_dpdk_common_get_mtu(common, mtup);
@@ -2464,8 +2439,8 @@ netdev_dpdk_vhost_get_mtu(const struct netdev *netdev, 
int *mtup)
 static int
 netdev_dpdk_eth_set_mtu(struct netdev *netdev, int mtu)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int ret;
 
     ovs_mutex_lock(&dev->mutex);
@@ -2478,8 +2453,8 @@ netdev_dpdk_eth_set_mtu(struct netdev *netdev, int mtu)
 static int
 netdev_dpdk_vhost_set_mtu(struct netdev *netdev, int mtu)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int ret;
 
     ovs_mutex_lock(&dev->mutex);
@@ -2493,9 +2468,9 @@ static int
 netdev_dpdk_vhost_get_stats(const struct netdev *netdev,
                             struct netdev_stats *stats)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
     struct rte_vhost_stat_name *vhost_stats_names = NULL;
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     struct rte_vhost_stat *vhost_stats = NULL;
     int vhost_stats_count;
     int err;
@@ -2674,9 +2649,9 @@ static int
 netdev_dpdk_vhost_get_custom_stats(const struct netdev *netdev,
                                    struct netdev_custom_stats *custom_stats)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     struct rte_vhost_stat_name *vhost_stats_names = NULL;
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
     struct rte_vhost_stat *vhost_stats = NULL;
     int vhost_rxq_stats_count;
     int vhost_txq_stats_count;
@@ -2840,8 +2815,8 @@ static int
 netdev_dpdk_eth_get_stats(const struct netdev *netdev,
                           struct netdev_stats *stats)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     struct rte_eth_stats rte_stats;
     bool gg;
 
@@ -2922,8 +2897,8 @@ netdev_dpdk_eth_get_custom_stats(const struct netdev 
*netdev,
                                  struct netdev_custom_stats *custom_stats)
 {
 
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int rte_xstats_ret, sw_stats_size;
     uint32_t i;
 
@@ -2975,7 +2950,7 @@ netdev_dpdk_eth_get_features(const struct netdev *netdev,
                              enum netdev_features *supported,
                              enum netdev_features *peer)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
     struct rte_eth_link link;
     uint32_t feature = 0;
 
@@ -3037,7 +3012,7 @@ static int
 netdev_dpdk_eth_get_speed(const struct netdev *netdev, uint32_t *current,
                           uint32_t *max)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
     struct rte_eth_dev_info dev_info;
     struct rte_eth_link link;
     int diag;
@@ -3094,7 +3069,7 @@ out:
 static int
 netdev_dpdk_eth_get_duplex(const struct netdev *netdev, bool *full_duplex)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
     int err = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -3114,8 +3089,8 @@ netdev_dpdk_eth_set_policing(struct netdev *netdev, 
uint32_t policer_rate,
                              uint32_t policer_kpkts_rate OVS_UNUSED,
                              uint32_t policer_kpkts_burst OVS_UNUSED)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int ret;
 
     ovs_mutex_lock(&dev->mutex);
@@ -3132,7 +3107,7 @@ netdev_dpdk_vhost_set_policing(struct netdev *netdev, 
uint32_t policer_rate,
                                uint32_t policer_kpkts_burst OVS_UNUSED)
 {
     struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
     int ret;
 
     ovs_mutex_lock(&dev->mutex);
@@ -3145,8 +3120,8 @@ netdev_dpdk_vhost_set_policing(struct netdev *netdev, 
uint32_t policer_rate,
 static int
 netdev_dpdk_eth_get_ifindex(const struct netdev *netdev)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int ifindex;
 
     ovs_mutex_lock(&dev->mutex);
@@ -3159,8 +3134,8 @@ netdev_dpdk_eth_get_ifindex(const struct netdev *netdev)
 static int
 netdev_dpdk_vhost_get_ifindex(const struct netdev *netdev)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int ifindex;
 
     ovs_mutex_lock(&dev->mutex);
@@ -3173,7 +3148,7 @@ netdev_dpdk_vhost_get_ifindex(const struct netdev *netdev)
 static int
 netdev_dpdk_eth_get_carrier(const struct netdev *netdev, bool *carrier)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
 
     ovs_mutex_lock(&dev->mutex);
     check_link_status(dev);
@@ -3187,7 +3162,7 @@ netdev_dpdk_eth_get_carrier(const struct netdev *netdev, 
bool *carrier)
 static int
 netdev_dpdk_vhost_get_carrier(const struct netdev *netdev, bool *carrier)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
 
     ovs_mutex_lock(&dev->mutex);
 
@@ -3205,7 +3180,7 @@ netdev_dpdk_vhost_get_carrier(const struct netdev 
*netdev, bool *carrier)
 static long long int
 netdev_dpdk_eth_get_carrier_resets(const struct netdev *netdev)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
     long long int carrier_resets;
 
     ovs_mutex_lock(&dev->mutex);
@@ -3216,12 +3191,12 @@ netdev_dpdk_eth_get_carrier_resets(const struct netdev 
*netdev)
 }
 
 static int
-netdev_dpdk_eth_update_flags__(struct netdev_dpdk *dev,
+netdev_dpdk_eth_update_flags__(struct netdev_dpdk_eth *dev,
                                enum netdev_flags off, enum netdev_flags on,
                                enum netdev_flags *old_flagsp)
     OVS_REQUIRES(dev->mutex)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+    struct netdev_dpdk_common *common = &dev->common;
     struct netdev *netdev = &common->up;
 
     if ((off | on) & ~(NETDEV_UP | NETDEV_PROMISC)) {
@@ -3269,7 +3244,7 @@ netdev_dpdk_eth_update_flags(struct netdev *netdev,
                          enum netdev_flags off, enum netdev_flags on,
                          enum netdev_flags *old_flagsp)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
     int error;
 
     ovs_mutex_lock(&dev->mutex);
@@ -3280,12 +3255,12 @@ netdev_dpdk_eth_update_flags(struct netdev *netdev,
 }
 
 static int
-netdev_dpdk_vhost_update_flags__(struct netdev_dpdk *dev,
+netdev_dpdk_vhost_update_flags__(struct netdev_dpdk_vhost *dev,
                                  enum netdev_flags off, enum netdev_flags on,
                                  enum netdev_flags *old_flagsp)
     OVS_REQUIRES(dev->mutex)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+    struct netdev_dpdk_common *common = &dev->common;
     struct netdev *netdev = &common->up;
 
     if ((off | on) & ~(NETDEV_UP | NETDEV_PROMISC)) {
@@ -3325,7 +3300,7 @@ netdev_dpdk_vhost_update_flags(struct netdev *netdev,
                                enum netdev_flags off, enum netdev_flags on,
                                enum netdev_flags *old_flagsp)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
     int error;
 
     ovs_mutex_lock(&dev->mutex);
@@ -3339,7 +3314,7 @@ static int
 netdev_dpdk_vhost_user_get_status(const struct netdev *netdev,
                                   struct smap *args)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
 
     ovs_mutex_lock(&dev->mutex);
 
@@ -3428,8 +3403,8 @@ netdev_dpdk_link_speed_to_str__(uint32_t link_speed)
 static int
 netdev_dpdk_eth_get_status(const struct netdev *netdev, struct smap *args)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     struct rte_eth_dev_info dev_info;
     size_t rx_steer_flows_num;
     uint64_t rx_steer_flags;
@@ -3526,7 +3501,8 @@ netdev_dpdk_eth_get_status(const struct netdev *netdev, 
struct smap *args)
 }
 
 static void
-netdev_dpdk_eth_set_admin_state__(struct netdev_dpdk *dev, bool admin_state)
+netdev_dpdk_eth_set_admin_state__(struct netdev_dpdk_eth *dev,
+                                  bool admin_state)
     OVS_REQUIRES(dev->mutex)
 {
     enum netdev_flags old_flags;
@@ -3539,7 +3515,8 @@ netdev_dpdk_eth_set_admin_state__(struct netdev_dpdk 
*dev, bool admin_state)
 }
 
 static void
-netdev_dpdk_vhost_set_admin_state__(struct netdev_dpdk *dev, bool admin_state)
+netdev_dpdk_vhost_set_admin_state__(struct netdev_dpdk_vhost *dev,
+                                    bool admin_state)
     OVS_REQUIRES(dev->mutex)
 {
     enum netdev_flags old_flags;
@@ -3570,15 +3547,19 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, 
int argc,
         struct netdev *netdev = netdev_from_name(argv[1]);
 
         if (netdev && is_dpdk_class(netdev->netdev_class)) {
-            struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
-
-            ovs_mutex_lock(&dev->mutex);
             if (is_eth_class(netdev->netdev_class)) {
+                struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+
+                ovs_mutex_lock(&dev->mutex);
                 netdev_dpdk_eth_set_admin_state__(dev, up);
+                ovs_mutex_unlock(&dev->mutex);
             } else {
+                struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+
+                ovs_mutex_lock(&dev->mutex);
                 netdev_dpdk_vhost_set_admin_state__(dev, up);
+                ovs_mutex_unlock(&dev->mutex);
             }
-            ovs_mutex_unlock(&dev->mutex);
 
             netdev_close(netdev);
         } else {
@@ -3587,8 +3568,8 @@ netdev_dpdk_set_admin_state(struct unixctl_conn *conn, 
int argc,
             return;
         }
     } else {
-        struct netdev_dpdk *vhost_dev;
-        struct netdev_dpdk *dev;
+        struct netdev_dpdk_vhost *vhost_dev;
+        struct netdev_dpdk_eth *dev;
 
         ovs_mutex_lock(&dpdk_eth_mutex);
         LIST_FOR_EACH (dev, list_node, &dpdk_eth_list) {
@@ -3634,7 +3615,7 @@ netdev_dpdk_detach(struct unixctl_conn *conn, int argc 
OVS_UNUSED,
                   argv[1]);
 
     RTE_ETH_FOREACH_DEV_SIBLING (sibling_port_id, port_id) {
-        struct netdev_dpdk *dev;
+        struct netdev_dpdk_eth *dev;
 
         LIST_FOR_EACH (dev, list_node, &dpdk_eth_list) {
             if (dev->port_id != sibling_port_id) {
@@ -3642,7 +3623,7 @@ netdev_dpdk_detach(struct unixctl_conn *conn, int argc 
OVS_UNUSED,
             }
             used = true;
             ds_put_format(&used_interfaces, " %s",
-                          netdev_get_name(&dev->up));
+                          netdev_get_name(&dev->common.up));
             break;
         }
     }
@@ -3705,15 +3686,21 @@ netdev_dpdk_get_mempool_info(struct unixctl_conn *conn,
 
     if (netdev) {
         struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-        struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+        struct ovs_mutex *dev_mutex;
 
-        ovs_mutex_lock(&dev->mutex);
+        if (is_eth_class(netdev->netdev_class)) {
+            dev_mutex = &netdev_dpdk_eth_cast(netdev)->mutex;
+        } else {
+            dev_mutex = &netdev_dpdk_vhost_cast(netdev)->mutex;
+        }
+
+        ovs_mutex_lock(dev_mutex);
         if (common->dpdk_mp) {
             dpdk_mp_dump(stream, common->dpdk_mp);
         } else {
             error = "Not allocated";
         }
-        ovs_mutex_unlock(&dev->mutex);
+        ovs_mutex_unlock(dev_mutex);
     } else {
         dpdk_mp_dump(stream, NULL);
     }
@@ -3748,10 +3735,10 @@ set_irq_status(int vid)
  * enabling/disabling of queues and n_txq modifications.
  */
 static void
-netdev_dpdk_remap_txqs(struct netdev_dpdk *dev)
+netdev_dpdk_remap_txqs(struct netdev_dpdk_vhost *dev)
     OVS_REQUIRES(dev->mutex)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+    struct netdev_dpdk_common *common = &dev->common;
     struct netdev *netdev = &common->up;
     int *enabled_queues, n_enabled = 0;
     int i, k, total_txqs = netdev->n_txq;
@@ -3800,7 +3787,7 @@ netdev_dpdk_remap_txqs(struct netdev_dpdk *dev)
 static int
 new_device(int vid)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_vhost *dev;
     bool exists = false;
     int newnode = 0;
     char ifname[IF_NAME_SZ];
@@ -3810,7 +3797,7 @@ new_device(int vid)
     ovs_mutex_lock(&dpdk_vhost_mutex);
     /* Add device to the vhost port with the same name as that passed down. */
     LIST_FOR_EACH (dev, list_node, &dpdk_vhost_list) {
-        struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+        struct netdev_dpdk_common *common = &dev->common;
         struct netdev *netdev = &common->up;
 
         ovs_mutex_lock(&dev->mutex);
@@ -3902,10 +3889,10 @@ new_device(int vid)
 
 /* Clears mapping for all available queues of vhost interface. */
 static void
-netdev_dpdk_txq_map_clear(struct netdev_dpdk *dev)
+netdev_dpdk_txq_map_clear(struct netdev_dpdk_vhost *dev)
     OVS_REQUIRES(dev->mutex)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+    struct netdev_dpdk_common *common = &dev->common;
     int i;
 
     for (i = 0; i < common->up.n_txq; i++) {
@@ -3922,7 +3909,7 @@ netdev_dpdk_txq_map_clear(struct netdev_dpdk *dev)
 static void
 destroy_device(int vid)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_vhost *dev;
     bool exists = false;
     char ifname[IF_NAME_SZ];
 
@@ -3930,7 +3917,7 @@ destroy_device(int vid)
 
     ovs_mutex_lock(&dpdk_vhost_mutex);
     LIST_FOR_EACH (dev, list_node, &dpdk_vhost_list) {
-        struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+        struct netdev_dpdk_common *common = &dev->common;
         struct netdev *netdev = &common->up;
 
         if (netdev_dpdk_get_vid(dev) == vid) {
@@ -3986,14 +3973,14 @@ struct vhost_state_change {
 static void
 vring_state_changed__(struct vhost_state_change *sc)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_vhost *dev;
     bool exists = false;
     int qid = sc->queue_id / VIRTIO_QNUM;
     bool is_rx = (sc->queue_id % VIRTIO_QNUM) == VIRTIO_TXQ;
 
     ovs_mutex_lock(&dpdk_vhost_mutex);
     LIST_FOR_EACH (dev, list_node, &dpdk_vhost_list) {
-        struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+        struct netdev_dpdk_common *common = &dev->common;
 
         ovs_mutex_lock(&dev->mutex);
         if (nullable_string_is_equal(sc->ifname, dev->vhost_id)) {
@@ -4093,7 +4080,7 @@ vring_state_changed(int vid, uint16_t queue_id, int 
enable)
 static void
 destroy_connection(int vid)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_vhost *dev;
     char ifname[IF_NAME_SZ];
     bool exists = false;
 
@@ -4101,7 +4088,7 @@ destroy_connection(int vid)
 
     ovs_mutex_lock(&dpdk_vhost_mutex);
     LIST_FOR_EACH (dev, list_node, &dpdk_vhost_list) {
-        struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+        struct netdev_dpdk_common *common = &dev->common;
         struct netdev *netdev = &common->up;
 
         ovs_mutex_lock(&dev->mutex);
@@ -4188,7 +4175,7 @@ destroy_connection(int vid)
  */
 
 int
-netdev_dpdk_get_vid(const struct netdev_dpdk *dev)
+netdev_dpdk_get_vid(const struct netdev_dpdk_vhost *dev)
 {
     return ovsrcu_index_get(&dev->vid);
 }
@@ -4251,8 +4238,8 @@ static int
 netdev_dpdk_eth_get_qos(const struct netdev *netdev,
                         const char **typep, struct smap *details)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4266,8 +4253,8 @@ static int
 netdev_dpdk_vhost_get_qos(const struct netdev *netdev,
                           const char **typep, struct smap *details)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4281,8 +4268,8 @@ static int
 netdev_dpdk_eth_set_qos(struct netdev *netdev, const char *type,
                         const struct smap *details)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4296,8 +4283,8 @@ static int
 netdev_dpdk_vhost_set_qos(struct netdev *netdev, const char *type,
                           const struct smap *details)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4311,8 +4298,8 @@ static int
 netdev_dpdk_eth_get_queue(const struct netdev *netdev, uint32_t queue_id,
                           struct smap *details)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4326,8 +4313,8 @@ static int
 netdev_dpdk_vhost_get_queue(const struct netdev *netdev, uint32_t queue_id,
                             struct smap *details)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4341,8 +4328,8 @@ static int
 netdev_dpdk_eth_set_queue(struct netdev *netdev, uint32_t queue_id,
                           const struct smap *details)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4356,8 +4343,8 @@ static int
 netdev_dpdk_vhost_set_queue(struct netdev *netdev, uint32_t queue_id,
                             const struct smap *details)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4370,8 +4357,8 @@ netdev_dpdk_vhost_set_queue(struct netdev *netdev, 
uint32_t queue_id,
 static int
 netdev_dpdk_eth_delete_queue(struct netdev *netdev, uint32_t queue_id)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4384,8 +4371,8 @@ netdev_dpdk_eth_delete_queue(struct netdev *netdev, 
uint32_t queue_id)
 static int
 netdev_dpdk_vhost_delete_queue(struct netdev *netdev, uint32_t queue_id)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4399,8 +4386,8 @@ static int
 netdev_dpdk_eth_get_queue_stats(const struct netdev *netdev, uint32_t queue_id,
                                 struct netdev_queue_stats *stats)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4415,8 +4402,8 @@ netdev_dpdk_vhost_get_queue_stats(const struct netdev 
*netdev,
                                   uint32_t queue_id,
                                   struct netdev_queue_stats *stats)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4429,8 +4416,8 @@ netdev_dpdk_vhost_get_queue_stats(const struct netdev 
*netdev,
 static int
 netdev_dpdk_eth_queue_dump_start(const struct netdev *netdev, void **statep)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4443,8 +4430,8 @@ netdev_dpdk_eth_queue_dump_start(const struct netdev 
*netdev, void **statep)
 static int
 netdev_dpdk_vhost_queue_dump_start(const struct netdev *netdev, void **statep)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int error = 0;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4458,8 +4445,8 @@ static int
 netdev_dpdk_eth_queue_dump_next(const struct netdev *netdev, void *state_,
                                 uint32_t *queue_idp, struct smap *details)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int ret;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4474,8 +4461,8 @@ static int
 netdev_dpdk_vhost_queue_dump_next(const struct netdev *netdev, void *state_,
                                   uint32_t *queue_idp, struct smap *details)
 {
-    const struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
+    const struct netdev_dpdk_common *common = &dev->common;
     int ret;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4498,11 +4485,11 @@ set_error(struct rte_flow_error *error, enum 
rte_flow_error_type type)
 }
 
 static int
-dpdk_rx_steer_add_flow(struct netdev_dpdk *dev,
+dpdk_rx_steer_add_flow(struct netdev_dpdk_eth *dev,
                       const struct rte_flow_item items[],
                       const char *desc)
 {
-    struct netdev *netdev = &dev->up;
+    struct netdev *netdev = &dev->common.up;
     const struct rte_flow_attr attr = { .ingress = 1 };
     const struct rte_flow_action actions[] = {
         {
@@ -4551,10 +4538,10 @@ out:
 #define RETA_CONF_SIZE (RTE_ETH_RSS_RETA_SIZE_512 / RTE_ETH_RETA_GROUP_SIZE)
 
 static int
-dpdk_rx_steer_rss_configure(struct netdev_dpdk *dev, int rss_n_rxq)
+dpdk_rx_steer_rss_configure(struct netdev_dpdk_eth *dev, int rss_n_rxq)
 {
     struct rte_eth_rss_reta_entry64 reta_conf[RETA_CONF_SIZE];
-    struct netdev *netdev = &dev->up;
+    struct netdev *netdev = &dev->common.up;
     struct rte_eth_dev_info info;
     int err;
 
@@ -4614,9 +4601,9 @@ error:
 }
 
 static int
-dpdk_rx_steer_configure(struct netdev_dpdk *dev)
+dpdk_rx_steer_configure(struct netdev_dpdk_eth *dev)
 {
-    struct netdev *netdev = &dev->up;
+    struct netdev *netdev = &dev->common.up;
     int err = 0;
 
     if (netdev->n_rxq < 2) {
@@ -4665,9 +4652,9 @@ out:
 }
 
 static void
-dpdk_rx_steer_unconfigure(struct netdev_dpdk *dev)
+dpdk_rx_steer_unconfigure(struct netdev_dpdk_eth *dev)
 {
-    struct netdev *netdev = &dev->up;
+    struct netdev *netdev = &dev->common.up;
     struct rte_flow_error error;
 
     if (!dev->rx_steer_flows_num) {
@@ -4697,8 +4684,8 @@ dpdk_rx_steer_unconfigure(struct netdev_dpdk *dev)
 static int
 netdev_dpdk_eth_reconfigure(struct netdev *netdev)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(netdev);
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
+    struct netdev_dpdk_common *common = &dev->common;
     struct dpdk_mp_config mp_cfg;
     bool pending_reset;
     bool try_rx_steer;
@@ -4827,10 +4814,10 @@ out:
 }
 
 static int
-dpdk_vhost_reconfigure_helper(struct netdev_dpdk *dev)
+dpdk_vhost_reconfigure_helper(struct netdev_dpdk_vhost *dev)
     OVS_REQUIRES(dev->mutex)
 {
-    struct netdev_dpdk_common *common = netdev_dpdk_common_cast(&dev->up);
+    struct netdev_dpdk_common *common = &dev->common;
     struct netdev *netdev = &common->up;
 
     netdev->n_txq = common->requested_n_txq;
@@ -4887,7 +4874,7 @@ dpdk_vhost_reconfigure_helper(struct netdev_dpdk *dev)
 static int
 netdev_dpdk_vhost_reconfigure(struct netdev *netdev)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
     int err;
 
     ovs_mutex_lock(&dev->mutex);
@@ -4900,7 +4887,7 @@ netdev_dpdk_vhost_reconfigure(struct netdev *netdev)
 static int
 netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_vhost *dev = netdev_dpdk_vhost_cast(netdev);
     bool unregister = false;
     char *vhost_id;
     int err;
@@ -5043,14 +5030,14 @@ unlock:
 int
 netdev_dpdk_get_port_id(struct netdev *netdev)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_eth *dev;
     int ret = -1;
 
     if (!is_eth_class(netdev->netdev_class)) {
         goto out;
     }
 
-    dev = netdev_dpdk_cast(netdev);
+    dev = netdev_dpdk_eth_cast(netdev);
     ovs_mutex_lock(&dev->mutex);
     ret = dev->port_id;
     ovs_mutex_unlock(&dev->mutex);
@@ -5061,14 +5048,14 @@ out:
 bool
 netdev_dpdk_flow_api_supported(struct netdev *netdev, bool check_only)
 {
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_eth *dev;
     bool ret = false;
 
     if (!is_eth_class(netdev->netdev_class)) {
         goto out;
     }
 
-    dev = netdev_dpdk_cast(netdev);
+    dev = netdev_dpdk_eth_cast(netdev);
     ovs_mutex_lock(&dev->mutex);
     if (dev->requested_rx_steer_flags && !check_only) {
         VLOG_WARN("%s: rx-steering is mutually exclusive with hw-offload,"
@@ -5089,7 +5076,7 @@ netdev_dpdk_rte_flow_destroy(struct netdev *netdev,
                              struct rte_flow *rte_flow,
                              struct rte_flow_error *error)
 {
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
     int ret;
 
     ret = rte_flow_destroy(dev->port_id, rte_flow, error);
@@ -5104,7 +5091,7 @@ netdev_dpdk_rte_flow_create(struct netdev *netdev,
                             struct rte_flow_error *error)
 {
     struct rte_flow *flow;
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    struct netdev_dpdk_eth *dev = netdev_dpdk_eth_cast(netdev);
 
     flow = rte_flow_create(dev->port_id, attr, items, actions, error);
     return flow;
@@ -5126,14 +5113,14 @@ netdev_dpdk_rte_flow_query_count(struct netdev *netdev,
             .type = RTE_FLOW_ACTION_TYPE_END,
         },
     };
-    struct netdev_dpdk *dev;
+    struct netdev_dpdk_eth *dev;
     int ret;
 
     if (!is_eth_class(netdev->netdev_class)) {
         return -1;
     }
 
-    dev = netdev_dpdk_cast(netdev);
+    dev = netdev_dpdk_eth_cast(netdev);
     ret = rte_flow_query(dev->port_id, rte_flow, actions, query, error);
     return ret;
 }
-- 
2.54.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to