Increase VLIB_MAX_CPUS to 256 38/238/3
authorDamjan Marion <damarion@cisco.com>
Sat, 6 Feb 2016 18:16:21 +0000 (19:16 +0100)
committerGerrit Code Review <gerrit@fd.io>
Sun, 14 Feb 2016 00:02:31 +0000 (00:02 +0000)
Change-Id: Iac68b38dda1a0f9e2242f9eab5b03e44bbcac269
Signed-off-by: Damjan Marion <damarion@cisco.com>
vlib/vlib/main.c
vlib/vlib/node.h
vlib/vlib/threads.h

index f541ed3..2ea91a9 100644 (file)
@@ -135,7 +135,7 @@ vlib_frame_alloc_to_node (vlib_main_t * vm, u32 to_node_index, u32 frame_flags)
     }
   else
     {
-      f = clib_mem_alloc_aligned_no_fail (n, CLIB_CACHE_LINE_BYTES);
+      f = clib_mem_alloc_aligned_no_fail (n, VLIB_FRAME_ALIGN);
       f->cpu_index = vm->cpu_index;
       fi = vlib_frame_index_no_check (vm, f);
     }
index 806a9da..348ad1f 100644 (file)
@@ -290,6 +290,7 @@ typedef struct vlib_node_t {
 
 /* Max number of vector elements to process at once per node. */
 #define VLIB_FRAME_SIZE 256
+#define VLIB_FRAME_ALIGN VLIB_MAX_CPUS
 
 /* Calling frame (think stack frame) for a node. */
 typedef struct vlib_frame_t {
index 07fc1d3..98f19c4 100644 (file)
@@ -43,15 +43,12 @@ typedef struct vlib_thread_registration_ {
   uword * coremask;
 } vlib_thread_registration_t;
 
-#define VLIB_MAX_CPUS 32
-
-/* 
- * Objects passed around by "index" are cache-line aligned.
- * We can stick the owner CPU into the low 6 bits.
+/*
+ * Frames have their cpu / vlib_main_t index in the low-order N bits
+ * Make VLIB_MAX_CPUS a power-of-two, please...
  */
-#if VLIB_MAX_CPUS > 64
-#error VLIB_MAX_CPUS must be <= 64
-#endif
+
+#define VLIB_MAX_CPUS 256
 
 #define VLIB_CPU_MASK (VLIB_MAX_CPUS - 1) /* 0x3f, max */
 #define VLIB_OFFSET_MASK (~VLIB_CPU_MASK)