dpdk: rework cryptodev ipsec build and setup
[vpp.git] / src / vnet / devices / dpdk / init.c
index 6068946..01ef48c 100755 (executable)
@@ -64,8 +64,6 @@ static struct rte_eth_conf port_conf_template = {
 clib_error_t *
 dpdk_port_setup (dpdk_main_t * dm, dpdk_device_t * xd)
 {
-  vlib_main_t *vm = vlib_get_main ();
-  vlib_buffer_main_t *bm = vm->buffer_main;
   int rv;
   int j;
 
@@ -107,7 +105,7 @@ dpdk_port_setup (dpdk_main_t * dm, dpdk_device_t * xd)
 
       rv = rte_eth_rx_queue_setup (xd->device_index, j, xd->nb_rx_desc,
                                   xd->cpu_socket, 0,
-                                  bm->
+                                  dm->
                                   pktmbuf_pools[xd->cpu_socket_id_by_queue
                                                 [j]]);
 
@@ -115,7 +113,7 @@ dpdk_port_setup (dpdk_main_t * dm, dpdk_device_t * xd)
       if (rv < 0)
        rv = rte_eth_rx_queue_setup (xd->device_index, j, xd->nb_rx_desc,
                                     SOCKET_ID_ANY, 0,
-                                    bm->
+                                    dm->
                                     pktmbuf_pools[xd->cpu_socket_id_by_queue
                                                   [j]]);
       if (rv < 0)
@@ -127,6 +125,10 @@ dpdk_port_setup (dpdk_main_t * dm, dpdk_device_t * xd)
     {
       int rv;
       rv = rte_eth_dev_start (xd->device_index);
+      if (!rv && xd->default_mac_address)
+       rv = rte_eth_dev_default_mac_addr_set (xd->device_index,
+                                              (struct ether_addr *)
+                                              xd->default_mac_address);
       if (rv < 0)
        clib_warning ("rte_eth_dev_start %d returned %d",
                      xd->device_index, rv);
@@ -201,6 +203,10 @@ dpdk_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi, u32 flags)
          if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
            {
              int rv = rte_eth_dev_start (xd->device_index);
+             if (!rv && xd->default_mac_address)
+               rv = rte_eth_dev_default_mac_addr_set (xd->device_index,
+                                                      (struct ether_addr *)
+                                                      xd->default_mac_address);
              if (rv < 0)
                clib_warning ("rte_eth_dev_start %d returned %d",
                              xd->device_index, rv);
@@ -1048,6 +1054,9 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
       else if (unformat (input, "no-multi-seg"))
        conf->no_multi_seg = 1;
 
+      else if (unformat (input, "enable-cryptodev"))
+       conf->cryptodev = 1;
+
       else if (unformat (input, "dev default %U", unformat_vlib_cli_sub_input,
                         &sub_input))
        {