Multiversioning: Device (tx) function constructor
[vpp.git] / src / plugins / dpdk / device / init.c
index 6105777..69a8081 100644 (file)
@@ -436,6 +436,7 @@ dpdk_lib_init (dpdk_main_t * dm)
            case VNET_DPDK_PMD_CXGBE:
            case VNET_DPDK_PMD_MLX4:
            case VNET_DPDK_PMD_MLX5:
+           case VNET_DPDK_PMD_QEDE:
              xd->port_type = port_type_from_speed_capa (&dev_info);
              break;
 
@@ -700,7 +701,7 @@ dpdk_lib_init (dpdk_main_t * dm)
        }
 
       if (dm->conf->no_tx_checksum_offload == 0)
-       if (xd->flags & DPDK_DEVICE_FLAG_TX_OFFLOAD)
+       if (xd->flags & DPDK_DEVICE_FLAG_TX_OFFLOAD && hi != NULL)
          hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
 
       dpdk_device_setup (xd);
@@ -834,14 +835,19 @@ dpdk_bind_devices_to_uio (dpdk_config_main_t * conf)
     /* Cavium Network Adapter */
     else if (d->vendor_id == 0x177d && d->device_id == 0x9712)
       ;
-    /* Mellanox  */
+    /* Cavium FastlinQ QL41000 Series */
+    else if (d->vendor_id == 0x1077 && d->device_id >= 0x8070 && d->device_id <= 0x8090)
+      ;
+    /* Mellanox mlx4 */
+    else if (d->vendor_id == 0x15b3 && d->device_id >= 0x1003 && d->device_id <= 0x1004)
+      {
+        continue;
+      }
+    /* Mellanox mlx5 */
     else if (d->vendor_id == 0x15b3 && d->device_id >= 0x1013 && d->device_id <= 0x101a)
       {
         continue;
       }
-    /* Cavium FastlinQ QL41000 Series */
-    else if (d->vendor_id == 0x1077 && d->device_id >= 0x8070 && d->device_id <= 0x8090)
-      ;
     else
       {
         dpdk_log_warn ("Unsupported PCI device 0x%04x:0x%04x found "
@@ -1005,7 +1011,6 @@ static clib_error_t *
 dpdk_config (vlib_main_t * vm, unformat_input_t * input)
 {
   clib_error_t *error = 0;
-  dpdk_main_t *dm = &dpdk_main;
   dpdk_config_main_t *conf = &dpdk_config_main;
   vlib_thread_main_t *tm = vlib_get_thread_main ();
   dpdk_device_config_t *devconf;
@@ -1013,7 +1018,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
   unformat_input_t sub_input;
   uword x;
   u8 *s, *tmp = 0;
-  u8 *rte_cmd = 0, *ethname = 0;
   u32 log_level;
   int ret, i;
   int num_whitelisted = 0;
@@ -1035,7 +1039,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
       /* Prime the pump */
       if (unformat (input, "no-hugetlb"))
        {
-         vec_add1 (conf->eal_init_args, (u8 *) "no-huge");
+         vec_add1 (conf->eal_init_args, (u8 *) "--no-huge");
          no_huge = 1;
        }
 
@@ -1097,8 +1101,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
          tmp = format (0, "--no-pci%c", 0);
          vec_add1 (conf->eal_init_args, tmp);
        }
-      else if (unformat (input, "poll-sleep %d", &dm->poll_sleep_usec))
-       ;
 
 #define _(a)                                    \
       else if (unformat(input, #a))             \
@@ -1262,9 +1264,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
        }
     }
 
-  vec_free (rte_cmd);
-  vec_free (ethname);
-
   if (error)
     return error;
 
@@ -1339,10 +1338,13 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
   vec_add1 (conf->eal_init_args, tmp);
 
   /* set socket-mem */
-  tmp = format (0, "--socket-mem%c", 0);
-  vec_add1 (conf->eal_init_args, tmp);
-  tmp = format (0, "%s%c", socket_mem, 0);
-  vec_add1 (conf->eal_init_args, tmp);
+  if (!no_huge)
+    {
+      tmp = format (0, "--socket-mem%c", 0);
+      vec_add1 (conf->eal_init_args, tmp);
+      tmp = format (0, "%s%c", socket_mem, 0);
+      vec_add1 (conf->eal_init_args, tmp);
+    }
 
   /* NULL terminate the "argv" vector, in case of stupidity */
   vec_add1 (conf->eal_init_args, 0);
@@ -1354,14 +1356,22 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
   int log_fds[2] = { 0 };
   if (pipe (log_fds) == 0)
     {
-      FILE *f = fdopen (log_fds[1], "a");
-      if (f && rte_openlog_stream (f) == 0)
+      if (fcntl (log_fds[1], F_SETFL, O_NONBLOCK) == 0)
        {
-         clib_file_t t = { 0 };
-         t.read_function = dpdk_log_read_ready;
-         t.file_descriptor = log_fds[0];
-         t.description = format (0, "DPDK logging pipe");
-         clib_file_add (&file_main, &t);
+         FILE *f = fdopen (log_fds[1], "a");
+         if (f && rte_openlog_stream (f) == 0)
+           {
+             clib_file_t t = { 0 };
+             t.read_function = dpdk_log_read_ready;
+             t.file_descriptor = log_fds[0];
+             t.description = format (0, "DPDK logging pipe");
+             clib_file_add (&file_main, &t);
+           }
+       }
+      else
+       {
+         close (log_fds[0]);
+         close (log_fds[1]);
        }
     }
 
@@ -1608,9 +1618,7 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
                    xd = &dm->devices[j];
                  }
              }
-           ASSERT (xd != NULL);
-
-           if (xd->pmd == VNET_DPDK_PMD_BOND)
+           if (xd != NULL && xd->pmd == VNET_DPDK_PMD_BOND)
              {
                u8 addr[6];
                dpdk_portid_t slink[16];