version: 17.11-rc3
[dpdk.git] / examples / tep_termination / vxlan_setup.c
index 87de74d..1ad4ca3 100644 (file)
@@ -102,7 +102,7 @@ static const struct rte_eth_conf port_conf = {
                .hw_ip_checksum = 0, /**< IP checksum offload disabled */
                .hw_vlan_filter = 0, /**< VLAN filtering disabled */
                .jumbo_frame    = 0, /**< Jumbo Frame Support disabled */
-               .hw_strip_crc   = 0, /**< CRC stripped by hardware */
+               .hw_strip_crc   = 1, /**< CRC stripped by hardware */
        },
        .txmode = {
                .mq_mode = ETH_MQ_TX_NONE,
@@ -129,14 +129,14 @@ const uint16_t tenant_id_conf[] = {
  * coming from the mbuf_pool passed as parameter
  */
 int
-vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool)
+vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 {
        int retval;
        uint16_t q;
        struct rte_eth_dev_info dev_info;
        uint16_t rx_rings, tx_rings = (uint16_t)rte_lcore_count();
-       const uint16_t rx_ring_size = RTE_TEST_RX_DESC_DEFAULT;
-       const uint16_t 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;
        struct rte_eth_udp_tunnel tunnel_udp;
        struct rte_eth_rxconf *rxconf;
        struct rte_eth_txconf *txconf;
@@ -166,6 +166,11 @@ vxlan_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;
+
        /* Setup the queues. */
        for (q = 0; q < rx_rings; q++) {
                retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
@@ -197,7 +202,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool)
        rte_eth_macaddr_get(port, &ports_eth_addr[port]);
        RTE_LOG(INFO, PORT, "Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
                        " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
-                       (unsigned)port,
+                       port,
                        ports_eth_addr[port].addr_bytes[0],
                        ports_eth_addr[port].addr_bytes[1],
                        ports_eth_addr[port].addr_bytes[2],
@@ -409,7 +414,7 @@ vxlan_unlink(struct vhost_dev *vdev)
 
 /* Transmit packets after encapsulating */
 int
-vxlan_tx_pkts(uint8_t port_id, uint16_t queue_id,
+vxlan_tx_pkts(uint16_t port_id, uint16_t queue_id,
                struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {
        int ret = 0;
        uint16_t i;