dpdk: remove bonding code 67/19867/4
authorDamjan Marion <damarion@cisco.com>
Wed, 29 May 2019 08:00:46 +0000 (10:00 +0200)
committerFlorin Coras <florin.coras@gmail.com>
Thu, 30 May 2019 10:05:35 +0000 (10:05 +0000)
We have native implementation and we should not maintain both....

Change-Id: Ic09ebffda52cdc733b3cfeff06690e0d3cc08084
Signed-off-by: Damjan Marion <damarion@cisco.com>
build/external/packages/dpdk.mk
src/plugins/dpdk/device/cli.c
src/plugins/dpdk/device/common.c
src/plugins/dpdk/device/dpdk.h
src/plugins/dpdk/device/format.c
src/plugins/dpdk/device/init.c
src/plugins/dpdk/device/node.c

index 286e3eb..17a2638 100644 (file)
@@ -187,7 +187,7 @@ $(B)/custom-config: $(B)/.dpdk-patch.ok Makefile
        $(call set,RTE_PCI_CONFIG,y)
        $(call set,RTE_PCI_EXTENDED_TAG,"on")
        $(call set,RTE_PCI_MAX_READ_REQUEST_SIZE,4096)
-       $(call set,RTE_LIBRTE_PMD_BOND,y)
+       $(call set,RTE_LIBRTE_PMD_BOND,n)
        $(call set,RTE_LIBRTE_IP_FRAG,y)
        $(call set,RTE_LIBRTE_PMD_QAT,y)
        $(call set,RTE_LIBRTE_PMD_QAT_SYM,y)
index 2152354..416d973 100644 (file)
@@ -1008,7 +1008,7 @@ set_dpdk_if_hqos_pktfield (vlib_main_t * vm, unformat_input_t * input,
   pci_dev = dpdk_get_pci_device (&dev_info);
 
   if (pci_dev)
-    {                          /* bonded interface has no pci info */
+    {
       vlib_pci_addr_t pci_addr;
 
       pci_addr.domain = pci_dev->addr.domain;
@@ -1203,7 +1203,7 @@ show_dpdk_if_hqos (vlib_main_t * vm, unformat_input_t * input,
   pci_dev = dpdk_get_pci_device (&dev_info);
 
   if (pci_dev)
-    {                          /* bonded interface has no pci info */
+    {
       vlib_pci_addr_t pci_addr;
 
       pci_addr.domain = pci_dev->addr.domain;
index b239616..11b0538 100644 (file)
@@ -189,17 +189,6 @@ dpdk_device_start (dpdk_device_t * xd)
 
   rte_eth_allmulticast_enable (xd->port_id);
 
-  if (xd->pmd == VNET_DPDK_PMD_BOND)
-    {
-      dpdk_portid_t slink[16];
-      int nlink = rte_eth_bond_slaves_get (xd->port_id, slink, 16);
-      while (nlink >= 1)
-       {
-         dpdk_portid_t dpdk_port = slink[--nlink];
-         rte_eth_allmulticast_enable (dpdk_port);
-       }
-    }
-
   dpdk_log_info ("Interface %U started",
                 format_dpdk_device_name, xd->port_id);
 }
@@ -214,82 +203,17 @@ dpdk_device_stop (dpdk_device_t * xd)
   rte_eth_dev_stop (xd->port_id);
   clib_memset (&xd->link, 0, sizeof (struct rte_eth_link));
 
-  /* For bonded interface, stop slave links */
-  if (xd->pmd == VNET_DPDK_PMD_BOND)
-    {
-      dpdk_portid_t slink[16];
-      int nlink = rte_eth_bond_slaves_get (xd->port_id, slink, 16);
-      while (nlink >= 1)
-       {
-         dpdk_portid_t dpdk_port = slink[--nlink];
-         rte_eth_dev_stop (dpdk_port);
-       }
-    }
   dpdk_log_info ("Interface %U stopped",
                 format_dpdk_device_name, xd->port_id);
 }
 
-/* Even type for send_garp_na_process */
-enum
-{
-  SEND_GARP_NA = 1,
-} dpdk_send_garp_na_process_event_t;
-
-static vlib_node_registration_t send_garp_na_proc_node;
-
-static uword
-send_garp_na_process (vlib_main_t * vm,
-                     vlib_node_runtime_t * rt, vlib_frame_t * f)
-{
-  uword event_type, *event_data = 0;
-
-  while (1)
-    {
-      u32 i;
-      uword dpdk_port;
-      vlib_process_wait_for_event (vm);
-      event_type = vlib_process_get_events (vm, &event_data);
-      ASSERT (event_type == SEND_GARP_NA);
-      for (i = 0; i < vec_len (event_data); i++)
-       {
-         dpdk_port = event_data[i];
-         if (i < 5)            /* wait 0.2 sec for link to settle, max total 1 sec */
-           vlib_process_suspend (vm, 0.2);
-         dpdk_device_t *xd = &dpdk_main.devices[dpdk_port];
-         dpdk_update_link_state (xd, vlib_time_now (vm));
-         send_ip4_garp (vm, xd->sw_if_index);
-         send_ip6_na (vm, xd->sw_if_index);
-       }
-      vec_reset_length (event_data);
-    }
-  return 0;
-}
-
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (send_garp_na_proc_node, static) = {
-    .function = send_garp_na_process,
-    .type = VLIB_NODE_TYPE_PROCESS,
-    .name = "send-garp-na-process",
-};
-/* *INDENT-ON* */
-
 void vl_api_force_rpc_call_main_thread (void *fp, u8 * data, u32 data_length);
 
-static void
-garp_na_proc_callback (uword * dpdk_port)
-{
-  vlib_main_t *vm = vlib_get_main ();
-  ASSERT (vlib_get_thread_index () == 0);
-  vlib_process_signal_event
-    (vm, send_garp_na_proc_node.index, SEND_GARP_NA, *dpdk_port);
-}
-
 always_inline int
 dpdk_port_state_callback_inline (dpdk_portid_t port_id,
                                 enum rte_eth_event_type type, void *param)
 {
   struct rte_eth_link link;
-  dpdk_device_t *xd = &dpdk_main.devices[port_id];
 
   RTE_SET_USED (param);
   if (type != RTE_ETH_EVENT_INTR_LSC)
@@ -300,36 +224,13 @@ dpdk_port_state_callback_inline (dpdk_portid_t port_id,
 
   rte_eth_link_get_nowait (port_id, &link);
   u8 link_up = link.link_status;
-
-  if (xd->flags & DPDK_DEVICE_FLAG_BOND_SLAVE)
-    {
-      uword bd_port = xd->bond_port;
-      int bd_mode = rte_eth_bond_mode_get (bd_port);
-      dpdk_log_info ("Port %d state to %s, "
-                    "slave of port %d BondEthernet%d in mode %d",
-                    port_id, (link_up) ? "UP" : "DOWN",
-                    bd_port, xd->bond_instance_num, bd_mode);
-      if (bd_mode == BONDING_MODE_ACTIVE_BACKUP)
-       {
-         vl_api_force_rpc_call_main_thread
-           (garp_na_proc_callback, (u8 *) & bd_port, sizeof (uword));
-       }
-
-      if (link_up)
-       xd->flags |= DPDK_DEVICE_FLAG_BOND_SLAVE_UP;
-      else
-       xd->flags &= ~DPDK_DEVICE_FLAG_BOND_SLAVE_UP;
-    }
-  else                         /* Should not happen as callback not setup for "normal" links */
-    {
-      if (link_up)
-       dpdk_log_info ("Port %d Link Up - speed %u Mbps - %s",
-                      port_id, (unsigned) link.link_speed,
-                      (link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
-                      "full-duplex" : "half-duplex");
-      else
-       dpdk_log_info ("Port %d Link Down\n\n", port_id);
-    }
+  if (link_up)
+    dpdk_log_info ("Port %d Link Up - speed %u Mbps - %s",
+                  port_id, (unsigned) link.link_speed,
+                  (link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
+                  "full-duplex" : "half-duplex");
+  else
+    dpdk_log_info ("Port %d Link Down\n\n", port_id);
 
   return 0;
 }
index f79465c..eadf35d 100644 (file)
@@ -38,7 +38,6 @@
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_version.h>
-#include <rte_eth_bond.h>
 #include <rte_sched.h>
 #include <rte_net.h>
 #include <rte_bus_pci.h>
@@ -73,7 +72,6 @@ extern vlib_node_registration_t admin_up_down_process_node;
   _ ("net_enic", ENIC)            \
   _ ("net_vmxnet3", VMXNET3)      \
   _ ("AF_PACKET PMD", AF_PACKET)  \
-  _ ("net_bonding", BOND)         \
   _ ("net_fm10k", FM10K)          \
   _ ("net_cxgbe", CXGBE)          \
   _ ("net_mlx4", MLX4)            \
@@ -108,7 +106,6 @@ typedef enum
   VNET_DPDK_PORT_TYPE_ETH_50G,
   VNET_DPDK_PORT_TYPE_ETH_56G,
   VNET_DPDK_PORT_TYPE_ETH_100G,
-  VNET_DPDK_PORT_TYPE_ETH_BOND,
   VNET_DPDK_PORT_TYPE_ETH_SWITCH,
   VNET_DPDK_PORT_TYPE_AF_PACKET,
   VNET_DPDK_PORT_TYPE_ETH_VF,
@@ -163,8 +160,6 @@ typedef struct
   _( 4, MAYBE_MULTISEG, "maybe-multiseg") \
   _( 5, HAVE_SUBIF, "subif") \
   _( 6, HQOS, "hqos") \
-  _( 7, BOND_SLAVE, "bond-slave") \
-  _( 8, BOND_SLAVE_UP, "bond-slave-up") \
   _( 9, TX_OFFLOAD, "tx-offload") \
   _(10, INTEL_PHDR_CKSUM, "intel-phdr-cksum") \
   _(11, RX_FLOW_OFFLOAD, "rx-flow-offload") \
@@ -243,13 +238,8 @@ typedef struct
   dpdk_device_hqos_per_worker_thread_t *hqos_wt;
   dpdk_device_hqos_per_hqos_thread_t *hqos_ht;
 
-  /* af_packet or BondEthernet instance number */
+  /* af_packet instance number */
   u16 af_packet_instance_num;
-  u16 bond_instance_num;
-
-  /* Bonded interface port# of a slave -
-     only valid if DPDK_DEVICE_FLAG_BOND_SLAVE bit is set */
-  dpdk_portid_t bond_port;
 
   struct rte_eth_link link;
   f64 time_last_link_update;
index acc26ab..b7ceda0 100644 (file)
@@ -195,9 +195,6 @@ format_dpdk_device_name (u8 * s, va_list * args)
       device_name = "HundredGigabitEthernet";
       break;
 
-    case VNET_DPDK_PORT_TYPE_ETH_BOND:
-      return format (s, "BondEthernet%d", xd->bond_instance_num);
-
     case VNET_DPDK_PORT_TYPE_ETH_SWITCH:
       device_name = "EthernetSwitch";
       break;
@@ -329,10 +326,6 @@ format_dpdk_device_type (u8 * s, va_list * args)
       dev_type = "af_packet";
       break;
 
-    case VNET_DPDK_PMD_BOND:
-      dev_type = "Ethernet Bonding";
-      break;
-
     case VNET_DPDK_PMD_DPAA2:
       dev_type = "NXP DPAA2 Mac";
       break;
index 7e5cc08..fccefb1 100644 (file)
@@ -219,7 +219,6 @@ dpdk_lib_init (dpdk_main_t * dm)
 
   u32 next_hqos_cpu = 0;
   u8 af_packet_instance_num = 0;
-  u8 bond_ether_instance_num = 0;
   last_pci_addr.as_u32 = ~0;
 
   dm->hqos_cpu_first_index = 0;
@@ -291,7 +290,7 @@ dpdk_lib_init (dpdk_main_t * dm)
 
       pci_dev = dpdk_get_pci_device (&dev_info);
 
-      if (pci_dev)     /* bonded interface has no pci info */
+      if (pci_dev)
        {
          pci_addr.domain = pci_dev->addr.domain;
          pci_addr.bus = pci_dev->addr.bus;
@@ -513,11 +512,6 @@ dpdk_lib_init (dpdk_main_t * dm)
              xd->af_packet_instance_num = af_packet_instance_num++;
              break;
 
-           case VNET_DPDK_PMD_BOND:
-             xd->port_type = VNET_DPDK_PORT_TYPE_ETH_BOND;
-             xd->bond_instance_num = bond_ether_instance_num++;
-             break;
-
            case VNET_DPDK_PMD_VIRTIO_USER:
              xd->port_type = VNET_DPDK_PORT_TYPE_VIRTIO_USER;
              break;
@@ -1505,14 +1499,6 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
       ed->new_link_state = (u8) xd->link.link_status;
     }
 
-  if ((xd->flags & (DPDK_DEVICE_FLAG_ADMIN_UP | DPDK_DEVICE_FLAG_BOND_SLAVE))
-      && ((xd->link.link_status != 0) ^
-         vnet_hw_interface_is_link_up (vnm, xd->hw_if_index)))
-    {
-      hw_flags_chg = 1;
-      hw_flags |= (xd->link.link_status ? VNET_HW_INTERFACE_FLAG_LINK_UP : 0);
-    }
-
   if (hw_flags_chg || (xd->link.link_duplex != prev_link.link_duplex))
     {
       hw_flags_chg = 1;
@@ -1561,13 +1547,9 @@ static uword
 dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
 {
   clib_error_t *error;
-  vnet_main_t *vnm = vnet_get_main ();
   dpdk_main_t *dm = &dpdk_main;
-  ethernet_main_t *em = &ethernet_main;
   dpdk_device_t *xd;
   vlib_thread_main_t *tm = vlib_get_thread_main ();
-  int i;
-  int j;
 
   error = dpdk_lib_init (dm);
 
@@ -1582,110 +1564,6 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
     dpdk_update_link_state (xd, now);
   }
 
-  {
-    /*
-     * Extra set up for bond interfaces:
-     *  1. Setup MACs for bond interfaces and their slave links which was set
-     *     in dpdk_device_setup() but needs to be done again here to take
-     *     effect.
-     *  2. Set up info and register slave link state change callback handling.
-     *  3. Set up info for bond interface related CLI support.
-     */
-    int nports = rte_eth_dev_count_avail ();
-    if (nports > 0)
-      {
-       /* *INDENT-OFF* */
-       RTE_ETH_FOREACH_DEV(i)
-         {
-           xd = NULL;
-           for (j = 0; j < nports; j++)
-             {
-               if (dm->devices[j].port_id == i)
-                 {
-                   xd = &dm->devices[j];
-                 }
-             }
-           if (xd != NULL && xd->pmd == VNET_DPDK_PMD_BOND)
-             {
-               u8 addr[6];
-               dpdk_portid_t slink[16];
-               int nlink = rte_eth_bond_slaves_get (i, slink, 16);
-               if (nlink > 0)
-                 {
-                   vnet_hw_interface_t *bhi;
-                   ethernet_interface_t *bei;
-                   int rv;
-
-                   /* Get MAC of 1st slave link */
-                   rte_eth_macaddr_get
-                     (slink[0], (struct ether_addr *) addr);
-
-                   /* Set MAC of bounded interface to that of 1st slave link */
-                   dpdk_log_info ("Set MAC for bond port %d BondEthernet%d",
-                                  i, xd->bond_instance_num);
-                   rv = rte_eth_bond_mac_address_set
-                     (i, (struct ether_addr *) addr);
-                   if (rv)
-                     dpdk_log_warn ("Set MAC addr failure rv=%d", rv);
-
-                   /* Populate MAC of bonded interface in VPP hw tables */
-                   bhi = vnet_get_hw_interface
-                     (vnm, dm->devices[i].hw_if_index);
-                   bei = pool_elt_at_index
-                     (em->interfaces, bhi->hw_instance);
-                   clib_memcpy (bhi->hw_address, addr, 6);
-                   clib_memcpy (bei->address, addr, 6);
-
-                   /* Init l3 packet size allowed on bonded interface */
-                   bhi->max_packet_bytes = ETHERNET_MAX_PACKET_BYTES;
-                   while (nlink >= 1)
-                     {         /* for all slave links */
-                       int slave = slink[--nlink];
-                       dpdk_device_t *sdev = &dm->devices[slave];
-                       vnet_hw_interface_t *shi;
-                       vnet_sw_interface_t *ssi;
-                       ethernet_interface_t *sei;
-                       /* Add MAC to all slave links except the first one */
-                       if (nlink)
-                         {
-                           dpdk_log_info ("Add MAC for slave port %d",
-                                          slave);
-                           rv = rte_eth_dev_mac_addr_add
-                             (slave, (struct ether_addr *) addr, 0);
-                           if (rv)
-                             dpdk_log_warn ("Add MAC addr failure rv=%d",
-                                            rv);
-                         }
-                       /* Setup slave link state change callback handling */
-                       rte_eth_dev_callback_register
-                         (slave, RTE_ETH_EVENT_INTR_LSC,
-                          dpdk_port_state_callback, NULL);
-                       dpdk_device_t *sxd = &dm->devices[slave];
-                       sxd->flags |= DPDK_DEVICE_FLAG_BOND_SLAVE;
-                       sxd->bond_port = i;
-                       /* Set slaves bitmap for bonded interface */
-                       bhi->bond_info = clib_bitmap_set
-                         (bhi->bond_info, sdev->hw_if_index, 1);
-                       /* Set MACs and slave link flags on slave interface */
-                       shi = vnet_get_hw_interface (vnm, sdev->hw_if_index);
-                       ssi = vnet_get_sw_interface (vnm, sdev->sw_if_index);
-                       sei = pool_elt_at_index
-                         (em->interfaces, shi->hw_instance);
-                       shi->bond_info = VNET_HW_INTERFACE_BOND_INFO_SLAVE;
-                       ssi->flags |= VNET_SW_INTERFACE_FLAG_BOND_SLAVE;
-                       clib_memcpy (shi->hw_address, addr, 6);
-                       clib_memcpy (sei->address, addr, 6);
-                       /* Set l3 packet size allowed as the lowest of slave */
-                       if (bhi->max_packet_bytes > shi->max_packet_bytes)
-                         bhi->max_packet_bytes = shi->max_packet_bytes;
-                     }
-                 }
-             }
-         }
-       /* *INDENT-ON* */
-      }
-  }
-
   while (1)
     {
       /*
index 222201d..e8a11a9 100644 (file)
@@ -466,8 +466,6 @@ VLIB_NODE_FN (dpdk_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
   foreach_device_and_queue (dq, rt->devices_and_queues)
     {
       xd = vec_elt_at_index(dm->devices, dq->dev_instance);
-      if (PREDICT_FALSE (xd->flags & DPDK_DEVICE_FLAG_BOND_SLAVE))
-       continue;       /* Do not poll slave to a bonded interface */
       n_rx_packets += dpdk_device_input (vm, dm, xd, node, thread_index,
                                         dq->queue_id);
     }