VPP-180 Clean up multi-socket / multi-chunk mempool discovery 96/2196/4
authorDave Barach <[email protected]>
Tue, 2 Aug 2016 17:31:31 +0000 (13:31 -0400)
committerFlorin Coras <[email protected]>
Wed, 3 Aug 2016 15:18:37 +0000 (15:18 +0000)
Change the default DPDK version to 16.07, and rename the indicated
patch directory. Use the native vhost-user driver.

Change-Id: Ie3d17e90e363ce86f0233b58c152de683b5d9456
Signed-off-by: Dave Barach <[email protected]>
dpdk/Makefile
dpdk/dpdk-16.07_patches/0001-i40e-Add-packet_type-metadata-in-the-i40e-vPMD.patch [moved from dpdk/dpdk-16.07-rc3_patches/0001-i40e-Add-packet_type-metadata-in-the-i40e-vPMD.patch with 100% similarity]
dpdk/dpdk-16.07_patches/0002-i40e-Enable-bad-checksum-flags-in-i40e-vPMD.patch [moved from dpdk/dpdk-16.07-rc3_patches/0002-i40e-Enable-bad-checksum-flags-in-i40e-vPMD.patch with 100% similarity]
vlib/vlib/dpdk_buffer.c
vpp/vpp-api/api.c

index 576b1ee..d73ddb6 100644 (file)
@@ -24,11 +24,10 @@ DPDK_DEBUG            ?= n
 
 B := $(DPDK_BUILD_DIR)
 I := $(DPDK_INSTALL_DIR)
-DPDK_VERSION ?= 16.04
+DPDK_VERSION ?= 16.07
 DPDK_BASE_URL ?= http://fast.dpdk.org/rel
 DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz
 DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL)
-DPDK_2.2.0_TARBALL_MD5_CKSUM := bfa10283b49d56264c82519d130458cc
 DPDK_16.04_TARBALL_MD5_CKSUM := d1f82e7d7589b3b2f623c155442b8306
 DPDK_16.07_TARBALL_MD5_CKSUM := 690a2bb570103e58d12f9806e8bf21be
 DPDK_SOURCE := $(B)/dpdk-$(DPDK_VERSION)
index 84bca0f..337fca9 100644 (file)
@@ -964,7 +964,9 @@ vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs,
   vlib_buffer_main_t *bm = vm->buffer_main;
   vlib_physmem_main_t *vpm = &vm->physmem_main;
   struct rte_mempool *rmp;
+#if RTE_VERSION < RTE_VERSION_NUM(16, 7, 0, 0)
   uword new_start, new_size;
+#endif
   int i;
 
   if (!rte_pktmbuf_pool_create)
@@ -985,16 +987,78 @@ vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs,
                                 VLIB_BUFFER_PRE_DATA_SIZE + VLIB_BUFFER_DATA_SIZE,     /* dataroom size */
                                 socket_id);    /* cpu socket */
 
-  vec_free (pool_name);
-
   if (rmp)
     {
-      new_start = pointer_to_uword (rmp);
 #if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0)
-      new_size = (uintptr_t)STAILQ_FIRST(&rmp->mem_list)->addr + STAILQ_FIRST(&rmp->mem_list)->len - new_start;
+      {
+        uword this_pool_end;
+        uword this_pool_start;
+        uword this_pool_size;
+        uword save_vpm_start, save_vpm_end, save_vpm_size;
+       struct rte_mempool_memhdr *memhdr;
+        
+        this_pool_start = ~0ULL;
+        this_pool_end = 0LL;
+
+        STAILQ_FOREACH (memhdr, &rmp->mem_list, next) 
+          {
+            if (((uword)(memhdr->addr + memhdr->len)) > this_pool_end)
+              this_pool_end = (uword)(memhdr->addr + memhdr->len);
+            if (((uword)memhdr->addr) < this_pool_start)
+              this_pool_start = (uword)(memhdr->addr);
+          }
+        ASSERT (this_pool_start < ~0ULL && this_pool_end > 0);
+        this_pool_size = this_pool_end - this_pool_start;
+
+        if (CLIB_DEBUG > 1)
+          {
+            clib_warning ("%s: pool start %llx pool end %llx pool size %lld",
+                          pool_name, this_pool_start, this_pool_end, 
+                          this_pool_size);
+            clib_warning 
+              ("before: virtual.start %llx virtual.end %llx virtual.size %lld",
+               vpm->virtual.start, vpm->virtual.end, vpm->virtual.size);
+          }
+        
+        save_vpm_start = vpm->virtual.start;
+        save_vpm_end = vpm->virtual.end;
+        save_vpm_size = vpm->virtual.size;
+
+        if ((this_pool_start < vpm->virtual.start) || vpm->virtual.start == 0)
+          vpm->virtual.start = this_pool_start;
+        if (this_pool_end > vpm->virtual.end)
+          vpm->virtual.end = this_pool_end;
+
+        vpm->virtual.size = vpm->virtual.end - vpm->virtual.start;
+        
+        if (CLIB_DEBUG > 1)
+          {
+            clib_warning 
+              ("after: virtual.start %llx virtual.end %llx virtual.size %lld",
+               vpm->virtual.start, vpm->virtual.end, vpm->virtual.size);
+          }
+
+        /* check if fits into buffer index range */
+        if ((u64) vpm->virtual.size > 
+            ((u64) 1 << (32 + CLIB_LOG2_CACHE_LINE_BYTES)))
+          {
+            clib_warning ("physmem: virtual size out of range!");
+            vpm->virtual.start = save_vpm_start;
+            vpm->virtual.end = save_vpm_end;
+            vpm->virtual.size = save_vpm_size;
+            rmp = 0;
+          }
+      }
+      if (rmp)
+        {
+          bm->pktmbuf_pools[socket_id] = rmp;
+          vec_free(pool_name);
+          return 0;
+        }
+    }
 #else
+      new_start = pointer_to_uword (rmp);
       new_size = rmp->elt_va_end - new_start;
-#endif
 
       if (vpm->virtual.size > 0)
        {
@@ -1021,8 +1085,12 @@ vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs,
       vpm->virtual.start = new_start;
       vpm->virtual.size = new_size;
       vpm->virtual.end = new_start + new_size;
+      vec_free(pool_name);
       return 0;
     }
+#endif
+
+  vec_free (pool_name);
 
   /* no usable pool for this socket, try to use pool from another one */
   for (i = 0; i < vec_len (bm->pktmbuf_pools); i++)
index 2f076c0..73ecbd7 100644 (file)
@@ -3814,13 +3814,13 @@ vl_api_create_vhost_user_if_t_handler (vl_api_create_vhost_user_if_t *mp)
 {
     int rv = 0;
     vl_api_create_vhost_user_if_reply_t * rmp;
-#if DPDK > 0 && DPDK_VHOST_USER
+#if DPDK > 0 
     u32 sw_if_index = (u32)~0;
 
     vnet_main_t * vnm = vnet_get_main();
     vlib_main_t * vm = vlib_get_main();
 
-    rv = dpdk_vhost_user_create_if(vnm, vm, (char *)mp->sock_filename,
+    rv = vhost_user_create_if(vnm, vm, (char *)mp->sock_filename,
                               mp->is_server, &sw_if_index, (u64)~0,
                               mp->renumber, ntohl(mp->custom_dev_instance),
                               (mp->use_custom_mac)?mp->mac_address:NULL);