doc: fix missing section underline in crypto guide
[dpdk.git] / examples / vhost_xen / main.c
index f837891..eba4d35 100644 (file)
@@ -48,6 +48,7 @@
 #include <rte_ethdev.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+#include <rte_pause.h>
 
 #include "main.h"
 #include "virtio-net.h"
@@ -278,7 +279,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
        struct rte_eth_rxconf *rxconf;
        struct rte_eth_conf port_conf;
        uint16_t rx_rings, tx_rings = (uint16_t)rte_lcore_count();
-       const uint16_t rx_ring_size = RTE_TEST_RX_DESC_DEFAULT, tx_ring_size = RTE_TEST_TX_DESC_DEFAULT;
+       uint16_t rx_ring_size = RTE_TEST_RX_DESC_DEFAULT;
+       uint16_t tx_ring_size = RTE_TEST_TX_DESC_DEFAULT;
        int retval;
        uint16_t q;
 
@@ -306,6 +308,17 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
        if (retval != 0)
                return retval;
 
+       retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &rx_ring_size,
+               &tx_ring_size);
+       if (retval != 0)
+               return retval;
+       if (rx_ring_size > RTE_TEST_RX_DESC_DEFAULT ||
+               tx_ring_size > RTE_TEST_TX_DESC_DEFAULT) {
+               RTE_LOG(ERR, VHOST_PORT, "Mbuf pool has an insufficient size for "
+                       "port %u.\n", port);
+               return -1;
+       }
+
        rte_eth_dev_info_get(port, &dev_info);
        rxconf = &dev_info.default_rxconf;
        rxconf->rx_drop_en = 1;
@@ -534,7 +547,7 @@ gpa_to_vva(struct virtio_net *dev, uint64_t guest_pa)
 /*
  * This function adds buffers to the virtio devices RX virtqueue. Buffers can
  * be received from the physical port or from another virtio device. A packet
- * count is returned to indicate the number of packets that were succesfully
+ * count is returned to indicate the number of packets that were successfully
  * added to the RX queue.
  */
 static __rte_always_inline uint32_t