net/vmxnet3: add Tx preparation
[dpdk.git] / drivers / net / vmxnet3 / vmxnet3_ethdev.c
index 2edf2e9..54533ca 100644 (file)
@@ -69,6 +69,8 @@
 
 #define PROCESS_SYS_EVENTS 0
 
+#define        VMXNET3_TX_MAX_SEG      UINT8_MAX
+
 static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
 static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
@@ -81,14 +83,18 @@ static void vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int vmxnet3_dev_link_update(struct rte_eth_dev *dev,
-                               int wait_to_complete);
+                                  int wait_to_complete);
 static void vmxnet3_dev_stats_get(struct rte_eth_dev *dev,
-                               struct rte_eth_stats *stats);
+                                 struct rte_eth_stats *stats);
 static void vmxnet3_dev_info_get(struct rte_eth_dev *dev,
-                               struct rte_eth_dev_info *dev_info);
+                                struct rte_eth_dev_info *dev_info);
+static const uint32_t *
+vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev,
                                       uint16_t vid, int on);
 static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
+                                struct ether_addr *mac_addr);
 
 #if PROCESS_SYS_EVENTS == 1
 static void vmxnet3_process_events(struct vmxnet3_hw *);
@@ -96,12 +102,11 @@ static void vmxnet3_process_events(struct vmxnet3_hw *);
 /*
  * The set of PCI devices this driver supports
  */
+#define VMWARE_PCI_VENDOR_ID 0x15AD
+#define VMWARE_DEV_ID_VMXNET3 0x07B0
 static const struct rte_pci_id pci_id_vmxnet3_map[] = {
-
-#define RTE_PCI_DEV_ID_DECL_VMXNET3(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
-#include "rte_pci_dev_ids.h"
-
-{ .vendor_id = 0, /* sentinel */ },
+       { RTE_PCI_DEVICE(VMWARE_PCI_VENDOR_ID, VMWARE_DEV_ID_VMXNET3) },
+       { .vendor_id = 0, /* sentinel */ },
 };
 
 static const struct eth_dev_ops vmxnet3_eth_dev_ops = {
@@ -115,7 +120,9 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = {
        .allmulticast_disable = vmxnet3_dev_allmulticast_disable,
        .link_update          = vmxnet3_dev_link_update,
        .stats_get            = vmxnet3_dev_stats_get,
+       .mac_addr_set         = vmxnet3_mac_addr_set,
        .dev_infos_get        = vmxnet3_dev_info_get,
+       .dev_supported_ptypes_get = vmxnet3_dev_supported_ptypes_get,
        .vlan_filter_set      = vmxnet3_dev_vlan_filter_set,
        .vlan_offload_set     = vmxnet3_dev_vlan_offload_set,
        .rx_queue_setup       = vmxnet3_dev_rx_queue_setup,
@@ -126,20 +133,27 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = {
 
 static const struct rte_memzone *
 gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size,
-               const char *post_string, int socket_id, uint16_t align)
+                const char *post_string, int socket_id,
+                uint16_t align, bool reuse)
 {
        char z_name[RTE_MEMZONE_NAMESIZE];
        const struct rte_memzone *mz;
 
        snprintf(z_name, sizeof(z_name), "%s_%d_%s",
-                                       dev->driver->pci_drv.name, dev->data->port_id, post_string);
+                dev->data->drv_name, dev->data->port_id, post_string);
 
        mz = rte_memzone_lookup(z_name);
+       if (!reuse) {
+               if (mz)
+                       rte_memzone_free(mz);
+               return rte_memzone_reserve_aligned(z_name, size, socket_id,
+                                                  0, align);
+       }
+
        if (mz)
                return mz;
 
-       return rte_memzone_reserve_aligned(z_name, size,
-                       socket_id, 0, align);
+       return rte_memzone_reserve_aligned(z_name, size, socket_id, 0, align);
 }
 
 /**
@@ -189,7 +203,7 @@ vmxnet3_dev_atomic_write_link_status(struct rte_eth_dev *dev,
        struct rte_eth_link *src = link;
 
        if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
-                                       *(uint64_t *)src) == 0)
+                               *(uint64_t *)src) == 0)
                return -1;
 
        return 0;
@@ -207,7 +221,7 @@ vmxnet3_disable_intr(struct vmxnet3_hw *hw)
 
        hw->shared->devRead.intrConf.intrCtrl |= VMXNET3_IC_DISABLE_ALL;
        for (i = 0; i < VMXNET3_MAX_INTRS; i++)
-                       VMXNET3_WRITE_BAR0_REG(hw, VMXNET3_REG_IMR + i * 8, 1);
+               VMXNET3_WRITE_BAR0_REG(hw, VMXNET3_REG_IMR + i * 8, 1);
 }
 
 /*
@@ -225,7 +239,8 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
        eth_dev->dev_ops = &vmxnet3_eth_dev_ops;
        eth_dev->rx_pkt_burst = &vmxnet3_recv_pkts;
        eth_dev->tx_pkt_burst = &vmxnet3_xmit_pkts;
-       pci_dev = eth_dev->pci_dev;
+       eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
+       pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
 
        /*
         * for secondary processes, we don't initialize any further as primary
@@ -269,8 +284,8 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
        /* Getting MAC Address */
        mac_lo = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_MACL);
        mac_hi = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_MACH);
-       memcpy(hw->perm_addr  , &mac_lo, 4);
-       memcpy(hw->perm_addr+4, &mac_hi, 2);
+       memcpy(hw->perm_addr, &mac_lo, 4);
+       memcpy(hw->perm_addr + 4, &mac_hi, 2);
 
        /* Allocate memory for storing MAC addresses */
        eth_dev->data->mac_addrs = rte_zmalloc("vmxnet3", ETHER_ADDR_LEN *
@@ -314,6 +329,7 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
        eth_dev->dev_ops = NULL;
        eth_dev->rx_pkt_burst = NULL;
        eth_dev->tx_pkt_burst = NULL;
+       eth_dev->tx_pkt_prepare = NULL;
 
        rte_free(eth_dev->data->mac_addrs);
        eth_dev->data->mac_addrs = NULL;
@@ -323,29 +339,16 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
 
 static struct eth_driver rte_vmxnet3_pmd = {
        .pci_drv = {
-               .name = "rte_vmxnet3_pmd",
                .id_table = pci_id_vmxnet3_map,
                .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+               .probe = rte_eth_dev_pci_probe,
+               .remove = rte_eth_dev_pci_remove,
        },
        .eth_dev_init = eth_vmxnet3_dev_init,
        .eth_dev_uninit = eth_vmxnet3_dev_uninit,
        .dev_private_size = sizeof(struct vmxnet3_hw),
 };
 
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
-       PMD_INIT_FUNC_TRACE();
-
-       rte_eth_driver_register(&rte_vmxnet3_pmd);
-       return 0;
-}
-
 static int
 vmxnet3_dev_configure(struct rte_eth_dev *dev)
 {
@@ -355,9 +358,16 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev)
 
        PMD_INIT_FUNC_TRACE();
 
-       if (dev->data->nb_rx_queues > UINT8_MAX ||
-           dev->data->nb_tx_queues > UINT8_MAX)
+       if (dev->data->nb_tx_queues > VMXNET3_MAX_TX_QUEUES ||
+           dev->data->nb_rx_queues > VMXNET3_MAX_RX_QUEUES) {
+               PMD_INIT_LOG(ERR, "ERROR: Number of queues not supported");
                return -EINVAL;
+       }
+
+       if (!rte_is_power_of_2(dev->data->nb_rx_queues)) {
+               PMD_INIT_LOG(ERR, "ERROR: Number of rx queues not power of 2");
+               return -EINVAL;
+       }
 
        size = dev->data->nb_rx_queues * sizeof(struct Vmxnet3_TxQueueDesc) +
                dev->data->nb_tx_queues * sizeof(struct Vmxnet3_RxQueueDesc);
@@ -373,7 +383,7 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev)
         * on current socket
         */
        mz = gpa_zone_reserve(dev, sizeof(struct Vmxnet3_DriverShared),
-                             "shared", rte_socket_id(), 8);
+                             "shared", rte_socket_id(), 8, 1);
 
        if (mz == NULL) {
                PMD_INIT_LOG(ERR, "ERROR: Creating shared zone");
@@ -386,10 +396,14 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev)
 
        /*
         * Allocate a memzone for Vmxnet3_RxQueueDesc - Vmxnet3_TxQueueDesc
-        * on current socket
+        * on current socket.
+        *
+        * We cannot reuse this memzone from previous allocation as its size
+        * depends on the number of tx and rx queues, which could be different
+        * from one config to another.
         */
-       mz = gpa_zone_reserve(dev, size, "queuedesc",
-                             rte_socket_id(), VMXNET3_QUEUE_DESC_ALIGN);
+       mz = gpa_zone_reserve(dev, size, "queuedesc", rte_socket_id(),
+                             VMXNET3_QUEUE_DESC_ALIGN, 0);
        if (mz == NULL) {
                PMD_INIT_LOG(ERR, "ERROR: Creating queue descriptors zone");
                return -ENOMEM;
@@ -403,10 +417,10 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev)
        hw->queue_desc_len = (uint16_t)size;
 
        if (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_RSS) {
-
                /* Allocate memory structure for UPT1_RSSConf and configure */
-               mz = gpa_zone_reserve(dev, sizeof(struct VMXNET3_RSSConf), "rss_conf",
-                                     rte_socket_id(), RTE_CACHE_LINE_SIZE);
+               mz = gpa_zone_reserve(dev, sizeof(struct VMXNET3_RSSConf),
+                                     "rss_conf", rte_socket_id(),
+                                     RTE_CACHE_LINE_SIZE, 1);
                if (mz == NULL) {
                        PMD_INIT_LOG(ERR,
                                     "ERROR: Creating rss_conf structure zone");
@@ -421,6 +435,23 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev)
        return 0;
 }
 
+static void
+vmxnet3_write_mac(struct vmxnet3_hw *hw, const uint8_t *addr)
+{
+       uint32_t val;
+
+       PMD_INIT_LOG(DEBUG,
+                    "Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x",
+                    addr[0], addr[1], addr[2],
+                    addr[3], addr[4], addr[5]);
+
+       val = *(const uint32_t *)addr;
+       VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, val);
+
+       val = (addr[5] << 8) | addr[4];
+       VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, val);
+}
+
 static int
 vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
 {
@@ -429,8 +460,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
        uint32_t mtu = dev->data->mtu;
        Vmxnet3_DriverShared *shared = hw->shared;
        Vmxnet3_DSDevRead *devRead = &shared->devRead;
-       uint32_t *mac_ptr;
-       uint32_t val, i;
+       uint32_t i;
        int ret;
 
        shared->magic = VMXNET3_REV1_MAGIC;
@@ -438,8 +468,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
 
        /* Setting up Guest OS information */
        devRead->misc.driverInfo.gos.gosBits   = sizeof(void *) == 4 ?
-               VMXNET3_GOS_BITS_32 :
-               VMXNET3_GOS_BITS_64;
+               VMXNET3_GOS_BITS_32 : VMXNET3_GOS_BITS_64;
        devRead->misc.driverInfo.gos.gosType   = VMXNET3_GOS_TYPE_LINUX;
        devRead->misc.driverInfo.vmxnet3RevSpt = 1;
        devRead->misc.driverInfo.uptVerSpt     = 1;
@@ -502,6 +531,11 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
        if (dev->data->dev_conf.rxmode.hw_ip_checksum)
                devRead->misc.uptFeatures |= VMXNET3_F_RXCSUM;
 
+       if (dev->data->dev_conf.rxmode.enable_lro) {
+               devRead->misc.uptFeatures |= VMXNET3_F_LRO;
+               devRead->misc.maxNumRxSG = 0;
+       }
+
        if (port_conf.rxmode.mq_mode == ETH_MQ_RX_RSS) {
                ret = vmxnet3_rss_configure(dev);
                if (ret != VMXNET3_SUCCESS)
@@ -514,20 +548,9 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
        }
 
        vmxnet3_dev_vlan_offload_set(dev,
-                            ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK);
+                                    ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK);
 
-       PMD_INIT_LOG(DEBUG,
-                    "Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x",
-                    hw->perm_addr[0], hw->perm_addr[1], hw->perm_addr[2],
-                    hw->perm_addr[3], hw->perm_addr[4], hw->perm_addr[5]);
-
-       /* Write MAC Address back to device */
-       mac_ptr = (uint32_t *)hw->perm_addr;
-       val = *mac_ptr;
-       VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, val);
-
-       val = (hw->perm_addr[5] << 8) | hw->perm_addr[4];
-       VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, val);
+       vmxnet3_write_mac(hw, hw->perm_addr);
 
        return VMXNET3_SUCCESS;
 }
@@ -540,7 +563,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
 static int
 vmxnet3_dev_start(struct rte_eth_dev *dev)
 {
-       int status, ret;
+       int ret;
        struct vmxnet3_hw *hw = dev->data->dev_private;
 
        PMD_INIT_FUNC_TRACE();
@@ -557,11 +580,11 @@ vmxnet3_dev_start(struct rte_eth_dev *dev)
 
        /* Activate device by register write */
        VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_ACTIVATE_DEV);
-       status = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
+       ret = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
 
-       if (status != 0) {
+       if (ret != 0) {
                PMD_INIT_LOG(ERR, "Device activation: UNSUCCESSFUL");
-               return -1;
+               return -EINVAL;
        }
 
        /* Disable interrupts */
@@ -573,7 +596,7 @@ vmxnet3_dev_start(struct rte_eth_dev *dev)
         */
        ret = vmxnet3_dev_rxtx_init(dev);
        if (ret != VMXNET3_SUCCESS) {
-               PMD_INIT_LOG(ERR, "Device receive init: UNSUCCESSFUL");
+               PMD_INIT_LOG(ERR, "Device queue init: UNSUCCESSFUL");
                return ret;
        }
 
@@ -588,7 +611,7 @@ vmxnet3_dev_start(struct rte_eth_dev *dev)
        PMD_INIT_LOG(DEBUG, "Reading events: 0x%X", events);
        vmxnet3_process_events(hw);
 #endif
-       return status;
+       return VMXNET3_SUCCESS;
 }
 
 /*
@@ -654,16 +677,15 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
                struct UPT1_TxStats *txStats = &hw->tqd_start[i].stats;
 
                stats->q_opackets[i] = txStats->ucastPktsTxOK +
-                       txStats->mcastPktsTxOK +
-                       txStats->bcastPktsTxOK;
+                                       txStats->mcastPktsTxOK +
+                                       txStats->bcastPktsTxOK;
                stats->q_obytes[i] = txStats->ucastBytesTxOK +
-                       txStats->mcastBytesTxOK +
-                       txStats->bcastBytesTxOK;
+                                       txStats->mcastBytesTxOK +
+                                       txStats->bcastBytesTxOK;
 
                stats->opackets += stats->q_opackets[i];
                stats->obytes += stats->q_obytes[i];
-               stats->oerrors += txStats->pktsTxError +
-                       txStats->pktsTxDiscard;
+               stats->oerrors += txStats->pktsTxError + txStats->pktsTxDiscard;
        }
 
        RTE_BUILD_BUG_ON(RTE_ETHDEV_QUEUE_STAT_CNTRS < VMXNET3_MAX_RX_QUEUES);
@@ -671,35 +693,35 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
                struct UPT1_RxStats *rxStats = &hw->rqd_start[i].stats;
 
                stats->q_ipackets[i] = rxStats->ucastPktsRxOK +
-                       rxStats->mcastPktsRxOK +
-                       rxStats->bcastPktsRxOK;
+                                       rxStats->mcastPktsRxOK +
+                                       rxStats->bcastPktsRxOK;
 
                stats->q_ibytes[i] = rxStats->ucastBytesRxOK +
-                       rxStats->mcastBytesRxOK +
-                       rxStats->bcastBytesRxOK;
+                                       rxStats->mcastBytesRxOK +
+                                       rxStats->bcastBytesRxOK;
 
                stats->ipackets += stats->q_ipackets[i];
                stats->ibytes += stats->q_ibytes[i];
 
                stats->q_errors[i] = rxStats->pktsRxError;
                stats->ierrors += rxStats->pktsRxError;
-               stats->imcasts += rxStats->mcastPktsRxOK;
                stats->rx_nombuf += rxStats->pktsRxOutOfBuf;
        }
 }
 
 static void
-vmxnet3_dev_info_get(__attribute__((unused))struct rte_eth_dev *dev,
+vmxnet3_dev_info_get(struct rte_eth_dev *dev,
                     struct rte_eth_dev_info *dev_info)
 {
+       dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
+
        dev_info->max_rx_queues = VMXNET3_MAX_RX_QUEUES;
        dev_info->max_tx_queues = VMXNET3_MAX_TX_QUEUES;
        dev_info->min_rx_bufsize = 1518 + RTE_PKTMBUF_HEADROOM;
        dev_info->max_rx_pktlen = 16384; /* includes CRC, cf MAXFRS register */
        dev_info->max_mac_addrs = VMXNET3_MAX_MAC_ADDRS;
 
-       dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-                                               ETH_TXQ_FLAGS_NOOFFLOADS;
+       dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOXSUMSCTP;
        dev_info->flow_type_rss_offloads = VMXNET3_RSS_OFFLOAD_ALL;
 
        dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
@@ -712,12 +734,15 @@ vmxnet3_dev_info_get(__attribute__((unused))struct rte_eth_dev *dev,
                .nb_max = VMXNET3_TX_RING_MAX_SIZE,
                .nb_min = VMXNET3_DEF_TX_RING_SIZE,
                .nb_align = 1,
+               .nb_seg_max = VMXNET3_TX_MAX_SEG,
+               .nb_mtu_seg_max = VMXNET3_MAX_TXD_PER_PKT,
        };
 
        dev_info->rx_offload_capa =
                DEV_RX_OFFLOAD_VLAN_STRIP |
                DEV_RX_OFFLOAD_UDP_CKSUM |
-               DEV_RX_OFFLOAD_TCP_CKSUM;
+               DEV_RX_OFFLOAD_TCP_CKSUM |
+               DEV_RX_OFFLOAD_TCP_LRO;
 
        dev_info->tx_offload_capa =
                DEV_TX_OFFLOAD_VLAN_INSERT |
@@ -726,16 +751,40 @@ vmxnet3_dev_info_get(__attribute__((unused))struct rte_eth_dev *dev,
                DEV_TX_OFFLOAD_TCP_TSO;
 }
 
+static const uint32_t *
+vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev)
+{
+       static const uint32_t ptypes[] = {
+               RTE_PTYPE_L3_IPV4_EXT,
+               RTE_PTYPE_L3_IPV4,
+               RTE_PTYPE_UNKNOWN
+       };
+
+       if (dev->rx_pkt_burst == vmxnet3_recv_pkts)
+               return ptypes;
+       return NULL;
+}
+
+static void
+vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
+{
+       struct vmxnet3_hw *hw = dev->data->dev_private;
+
+       vmxnet3_write_mac(hw, mac_addr->addr_bytes);
+}
+
 /* return 0 means link status changed, -1 means not changed */
 static int
-vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int wait_to_complete)
+vmxnet3_dev_link_update(struct rte_eth_dev *dev,
+                       __rte_unused int wait_to_complete)
 {
        struct vmxnet3_hw *hw = dev->data->dev_private;
        struct rte_eth_link old, link;
        uint32_t ret;
 
+       /* Link status doesn't change for stopped dev */
        if (dev->data->dev_started == 0)
-               return -1; /* Link status doesn't change for stopped dev */
+               return -1;
 
        memset(&link, 0, sizeof(link));
        vmxnet3_dev_atomic_read_link_status(dev, &old);
@@ -744,9 +793,10 @@ vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int wai
        ret = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
 
        if (ret & 0x1) {
-               link.link_status = 1;
+               link.link_status = ETH_LINK_UP;
                link.link_duplex = ETH_LINK_FULL_DUPLEX;
-               link.link_speed = ETH_LINK_SPEED_10000;
+               link.link_speed = ETH_SPEED_NUM_10G;
+               link.link_autoneg = ETH_LINK_SPEED_FIXED;
        }
 
        vmxnet3_dev_atomic_write_link_status(dev, &link);
@@ -756,8 +806,8 @@ vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int wai
 
 /* Updating rxmode through Vmxnet3_DriverShared structure in adapter */
 static void
-vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set) {
-
+vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set)
+{
        struct Vmxnet3_RxFilterConf *rxConf = &hw->shared->devRead.rxFilterConf;
 
        if (set)
@@ -890,11 +940,13 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
        /* Check if link state has changed */
        if (events & VMXNET3_ECR_LINK)
                PMD_INIT_LOG(ERR,
-                            "Process events in %s(): VMXNET3_ECR_LINK event", __func__);
+                            "Process events in %s(): VMXNET3_ECR_LINK event",
+                            __func__);
 
        /* Check if there is an error on xmit/recv queues */
        if (events & (VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR)) {
-               VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_QUEUE_STATUS);
+               VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
+                                      VMXNET3_CMD_GET_QUEUE_STATUS);
 
                if (hw->tqd_start->status.stopped)
                        PMD_INIT_LOG(ERR, "tq error 0x%x",
@@ -913,13 +965,9 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
 
        if (events & VMXNET3_ECR_DEBUG)
                PMD_INIT_LOG(ERR, "Debug event generated by device.");
-
 }
 #endif
 
-static struct rte_driver rte_vmxnet3_driver = {
-       .type = PMD_PDEV,
-       .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver);
+RTE_PMD_REGISTER_PCI(net_vmxnet3, rte_vmxnet3_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI_TABLE(net_vmxnet3, pci_id_vmxnet3_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_vmxnet3, "* igb_uio | uio_pci_generic | vfio");