misc: move to new pool_foreach macros
[vpp.git] / src / plugins / dpdk / device / init.c
index d07acd6..bd8d435 100644 (file)
@@ -862,7 +862,8 @@ dpdk_bind_devices_to_uio (dpdk_config_main_t * conf)
     d = vlib_pci_get_device_info (vm, addr, &error);
     if (error)
     {
-      clib_error_report (error);
+      vlib_log_warn (dpdk_main.log_default, "%U", format_clib_error, error);
+      clib_error_free (error);
       continue;
     }
 
@@ -1176,6 +1177,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
   u8 *s, *tmp = 0;
   int ret, i;
   int num_whitelisted = 0;
+  int eal_no_hugetlb = 0;
   u8 no_pci = 0;
   u8 no_vmbus = 0;
   u8 file_prefix = 0;
@@ -1194,7 +1196,10 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
       if (unformat (input, "no-hugetlb"))
        {
          vec_add1 (conf->eal_init_args, (u8 *) "--no-huge");
+         eal_no_hugetlb = 1;
        }
+      else if (unformat (input, "telemetry"))
+       conf->enable_telemetry = 1;
 
       else if (unformat (input, "enable-tcp-udp-checksum"))
        conf->enable_tcp_udp_checksum = 1;
@@ -1258,9 +1263,10 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
        if (unformat
            (input, "blacklist %x:%x:%x.%x", &domain, &bus, &device, &func))
        {
+         tmp = format (0, "-b%c", 0);
+         vec_add1 (conf->eal_init_args, tmp);
          tmp =
-           format (0, "-b %04x:%02x:%02x.%x%c", domain, bus, device, func,
-                   0);
+           format (0, "%04x:%02x:%02x.%x%c", domain, bus, device, func, 0);
          vec_add1 (conf->eal_init_args, tmp);
        }
       else if (unformat (input, "blacklist %x:%x", &vendor, &device))
@@ -1341,22 +1347,33 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
   if (!conf->uio_driver_name)
     conf->uio_driver_name = format (0, "auto%c", 0);
 
-  default_hugepage_sz = clib_mem_get_default_hugepage_size ();
+  if (eal_no_hugetlb == 0)
+    {
+      vec_add1 (conf->eal_init_args, (u8 *) "--in-memory");
 
-  /* *INDENT-OFF* */
-  clib_bitmap_foreach (x, tm->cpu_socket_bitmap, (
+      default_hugepage_sz = clib_mem_get_default_hugepage_size ();
+
+      /* *INDENT-OFF* */
+      clib_bitmap_foreach (x, tm->cpu_socket_bitmap, (
+       {
+         clib_error_t *e;
+         uword n_pages;
+         /* preallocate at least 16MB of hugepages per socket,
+           if more is needed it is up to consumer to preallocate more */
+         n_pages = round_pow2 ((uword) 16 << 20, default_hugepage_sz);
+         n_pages /= default_hugepage_sz;
+
+         if ((e = clib_sysfs_prealloc_hugepages(x, 0, n_pages)))
+           clib_error_report (e);
+      }));
+      /* *INDENT-ON* */
+    }
+
+  /* on/off dpdk's telemetry thread */
+  if (conf->enable_telemetry == 0)
     {
-      clib_error_t *e;
-      uword n_pages;
-      /* preallocate at least 16MB of hugepages per socket,
-        if more is needed it is up to consumer to preallocate more */
-      n_pages = round_pow2 ((uword) 16 << 20, default_hugepage_sz);
-      n_pages /= default_hugepage_sz;
-
-      if ((e = clib_sysfs_prealloc_hugepages(x, 0, n_pages)))
-       clib_error_report (e);
-  }));
-  /* *INDENT-ON* */
+      vec_add1 (conf->eal_init_args, (u8 *) "--no-telemetry");
+    }
 
   if (!file_prefix)
     {
@@ -1412,7 +1429,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
       devconf->x = conf->default_devconf.x ;
 
   /* *INDENT-OFF* */
-  pool_foreach (devconf, conf->dev_confs, ({
+  pool_foreach (devconf, conf->dev_confs)  {
 
     /* default per-device config items */
     foreach_dpdk_device_config_item
@@ -1435,7 +1452,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
     /* add DPDK EAL whitelist/blacklist entry */
     if (num_whitelisted > 0 && devconf->is_blacklisted == 0)
     {
-         tmp = format (0, "-w%c", 0);
+         tmp = format (0, "-a%c", 0);
          vec_add1 (conf->eal_init_args, tmp);
          if (devconf->devargs)
          {
@@ -1454,13 +1471,13 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
          tmp = format (0, "%U%c", format_vlib_pci_addr, &devconf->pci_addr, 0);
          vec_add1 (conf->eal_init_args, tmp);
     }
-  }));
+  }
   /* *INDENT-ON* */
 
 #undef _
 
   /* set master-lcore */
-  tmp = format (0, "--master-lcore%c", 0);
+  tmp = format (0, "--main-lcore%c", 0);
   vec_add1 (conf->eal_init_args, tmp);
   tmp = format (0, "%u%c", tm->main_lcore, 0);
   vec_add1 (conf->eal_init_args, tmp);
@@ -1506,7 +1523,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
 
   vec_terminate_c_string (conf->eal_init_args_str);
 
-  dpdk_log_warn ("EAL init args: %s", conf->eal_init_args_str);
+  dpdk_log_notice ("EAL init args: %s", conf->eal_init_args_str);
   ret = rte_eal_init (vec_len (conf->eal_init_args),
                      (char **) conf->eal_init_args);
 
@@ -1635,7 +1652,10 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
 
   error = dpdk_cryptodev_init (vm);
   if (error)
-    clib_error_report (error);
+    {
+      vlib_log_warn (dpdk_main.log_cryptodev, "%U", format_clib_error, error);
+      clib_error_free (error);
+    }
 
   tm->worker_thread_release = 1;
 
@@ -1707,7 +1727,6 @@ dpdk_init (vlib_main_t * vm)
 
   dm->conf->nchannels = 4;
   vec_add1 (dm->conf->eal_init_args, (u8 *) "vnet");
-  vec_add1 (dm->conf->eal_init_args, (u8 *) "--in-memory");
 
   /* Default vlib_buffer_t flags, DISABLES tcp/udp checksumming... */
   dm->buffer_flags_template = (VLIB_BUFFER_TOTAL_LENGTH_VALID |
@@ -1719,6 +1738,8 @@ dpdk_init (vlib_main_t * vm)
   dm->link_state_poll_interval = DPDK_LINK_POLL_INTERVAL;
 
   dm->log_default = vlib_log_register_class ("dpdk", 0);
+  dm->log_cryptodev = vlib_log_register_class ("dpdk", "cryptodev");
+  dm->log_ipsec = vlib_log_register_class ("dpdk", "ipsec");
 
   return error;
 }