diff --git a/src/vnet/cop/FEATURE.yaml b/src/vnet/cop/FEATURE.yaml
deleted file mode 100644
index c6fbdb8..0000000
--- a/src/vnet/cop/FEATURE.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
----
-name: COP
-maintainer: Dave Barach <dbarach@cisco.com>
-features:
-  - v4, v6 non-default FIB src-address lookup
-  - Drop packets which don't hit a receive adjacency
-  - Not widely used
-
-description: "A very simple / fast source-address whitelist feature"
-state: experimental
-properties: [API, CLI, MULTITHREAD]
diff --git a/src/vnet/cop/cop.api b/src/vnet/cop/cop.api
index f0f267c..39677a2 100644
--- a/src/vnet/cop/cop.api
+++ b/src/vnet/cop/cop.api
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Cisco and/or its affiliates.
+ * Copyright (c) 2015-2020 Cisco and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
@@ -26,6 +26,7 @@
 
 autoreply define cop_interface_enable_disable
 {
+  option deprecated="v21.01";
   u32 client_index;
   u32 context;
   vl_api_interface_index_t sw_if_index;
@@ -46,6 +47,7 @@
 
 autoreply define cop_whitelist_enable_disable
 {
+  option deprecated="v21.01";
   u32 client_index;
   u32 context;
   vl_api_interface_index_t sw_if_index;
diff --git a/src/vnet/cop/cop.c b/src/vnet/cop/cop.c
deleted file mode 100644
index edd0985..0000000
--- a/src/vnet/cop/cop.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <vnet/cop/cop.h>
-
-cop_main_t cop_main;
-
-static clib_error_t *
-cop_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
-{
-  cop_main_t * cm = &cop_main;
-  cop_config_data_t _data, *data = &_data;
-  vlib_main_t * vm = cm->vlib_main;
-  vnet_hw_interface_t * hi = vnet_get_sup_hw_interface (vnm, sw_if_index);;
-  cop_config_main_t * ccm;
-  int address_family;
-  u32 ci, default_next;
-
-  clib_memset (data, 0, sizeof(*data));
-
-  /*
-   * Ignore local interface, pg interfaces. $$$ need a #define for the
-   * first "real" interface. The answer is 5 at the moment.
-   */
-  if (hi->dev_class_index == vnet_local_interface_device_class.index)
-    return 0;
-
-   for (address_family = VNET_COP_IP4; address_family < VNET_N_COPS;
-       address_family++)
-    {
-      ccm = &cm->cop_config_mains[address_family];
-
-      /*
-       * Once-only code to initialize the per-address-family
-       * cop feature subgraphs.
-       * Since the (single) start-node, cop-input, must be able
-       * to push pkts into three separate subgraphs, we
-       * use a unified cop_feature_type_t enumeration.
-       */
-
-      if (!(ccm->config_main.node_index_by_feature_index))
-        {
-          switch (address_family)
-            {
-            case VNET_COP_IP4:
-              {
-                static char * start_nodes[] = { "cop-input" };
-                static char * feature_nodes[] = {
-                  [IP4_RX_COP_WHITELIST] = "ip4-cop-whitelist",
-                  [IP4_RX_COP_INPUT] = "ip4-input",
-                };
-
-                vnet_config_init (vm, &ccm->config_main,
-                                  start_nodes, ARRAY_LEN(start_nodes),
-                                  feature_nodes, ARRAY_LEN(feature_nodes));
-              }
-              break;
-            case VNET_COP_IP6:
-              {
-                static char * start_nodes[] = { "cop-input" };
-                static char * feature_nodes[] = {
-                  [IP6_RX_COP_WHITELIST] = "ip6-cop-whitelist",
-                  [IP6_RX_COP_INPUT] = "ip6-input",
-                };
-                vnet_config_init (vm, &ccm->config_main,
-                                  start_nodes, ARRAY_LEN(start_nodes),
-                                  feature_nodes, ARRAY_LEN(feature_nodes));
-              }
-              break;
-
-            case VNET_COP_DEFAULT:
-              {
-                static char * start_nodes[] = { "cop-input" };
-                static char * feature_nodes[] = {
-                  [DEFAULT_RX_COP_WHITELIST] = "default-cop-whitelist",
-                  [DEFAULT_RX_COP_INPUT] = "ethernet-input",
-                };
-                vnet_config_init (vm, &ccm->config_main,
-                                  start_nodes, ARRAY_LEN(start_nodes),
-                                  feature_nodes, ARRAY_LEN(feature_nodes));
-              }
-              break;
-
-            default:
-              clib_warning ("bug");
-              break;
-            }
-        }
-      vec_validate_init_empty (ccm->config_index_by_sw_if_index, sw_if_index,
-                               ~0);
-
-      ci = ccm->config_index_by_sw_if_index[sw_if_index];
-
-      /* Create a sensible initial config: send pkts to xxx-input */
-      if (address_family == VNET_COP_IP4)
-        default_next = IP4_RX_COP_INPUT;
-      else if (address_family == VNET_COP_IP6)
-        default_next = IP6_RX_COP_INPUT;
-      else
-        default_next = DEFAULT_RX_COP_INPUT;
-
-      if (is_add)
-        ci = vnet_config_add_feature (vm, &ccm->config_main,
-                                      ci,
-                                      default_next,
-                                      data, sizeof(*data));
-      else
-        ci = vnet_config_del_feature (vm, &ccm->config_main,
-                                      ci,
-                                      default_next,
-                                      data, sizeof(*data));
-
-      ccm->config_index_by_sw_if_index[sw_if_index] = ci;
-    }
-  return 0;
-}
-
-VNET_SW_INTERFACE_ADD_DEL_FUNCTION (cop_sw_interface_add_del);
-
-static clib_error_t *
-cop_init (vlib_main_t *vm)
-{
-  cop_main_t * cm = &cop_main;
-
-  cm->vlib_main = vm;
-  cm->vnet_main = vnet_get_main();
-
-  return 0;
-}
-
-/* *INDENT-OFF* */
-VLIB_INIT_FUNCTION (cop_init) =
-{
-  .runs_after = VLIB_INITS ("ip4_whitelist_init", "ip6_whitelist_init"),
-};
-/* *INDENT-ON* */
-
-int cop_interface_enable_disable (u32 sw_if_index, int enable_disable)
-{
-  cop_main_t * cm = &cop_main;
-  vnet_sw_interface_t * sw;
-  int rv;
-  u32 node_index = enable_disable ? cop_input_node.index : ~0;
-
-  /* Not a physical port? */
-  sw = vnet_get_sw_interface (cm->vnet_main, sw_if_index);
-  if (sw->type != VNET_SW_INTERFACE_TYPE_HARDWARE)
-    return VNET_API_ERROR_INVALID_SW_IF_INDEX;
-
-  /*
-   * Redirect pkts from the driver to the cop node.
-   * Returns VNET_API_ERROR_UNIMPLEMENTED if the h/w driver
-   * doesn't implement the API.
-   *
-   * Node_index = ~0 => shut off redirection
-   */
-  rv = vnet_hw_interface_rx_redirect_to_node (cm->vnet_main, sw_if_index,
-                                              node_index);
-  return rv;
-}
-
-static clib_error_t *
-cop_enable_disable_command_fn (vlib_main_t * vm,
-                                unformat_input_t * input,
-                                vlib_cli_command_t * cmd)
-{
-  cop_main_t * cm = &cop_main;
-  u32 sw_if_index = ~0;
-  int enable_disable = 1;
-
-  int rv;
-
-  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
-    if (unformat (input, "disable"))
-      enable_disable = 0;
-    else if (unformat (input, "%U", unformat_vnet_sw_interface,
-                       cm->vnet_main, &sw_if_index))
-      ;
-    else
-      break;
-  }
-
-  if (sw_if_index == ~0)
-    return clib_error_return (0, "Please specify an interface...");
-
-  rv = cop_interface_enable_disable (sw_if_index, enable_disable);
-
-  switch(rv) {
-  case 0:
-    break;
-
-  case VNET_API_ERROR_INVALID_SW_IF_INDEX:
-    return clib_error_return
-      (0, "Invalid interface, only works on physical ports");
-    break;
-
-  case VNET_API_ERROR_UNIMPLEMENTED:
-    return clib_error_return (0, "Device driver doesn't support redirection");
-    break;
-
-  default:
-    return clib_error_return (0, "cop_interface_enable_disable returned %d",
-                              rv);
-  }
-  return 0;
-}
-
-VLIB_CLI_COMMAND (cop_interface_command, static) = {
-    .path = "cop interface",
-    .short_help =
-    "cop interface <interface-name> [disable]",
-    .function = cop_enable_disable_command_fn,
-};
-
-
-int cop_whitelist_enable_disable (cop_whitelist_enable_disable_args_t *a)
-{
-  cop_main_t * cm = &cop_main;
-  vlib_main_t * vm = cm->vlib_main;
-  ip4_main_t * im4 = &ip4_main;
-  ip6_main_t * im6 = &ip6_main;
-  int address_family;
-  int is_add;
-  cop_config_main_t * ccm;
-  u32 next_to_add_del = 0;
-  uword * p;
-  u32 fib_index = 0;
-  u32 ci;
-  cop_config_data_t _data, *data=&_data;
-
-  /*
-   * Enable / disable whitelist processing on the specified interface
-   */
-
-  for (address_family = VNET_COP_IP4; address_family < VNET_N_COPS;
-       address_family++)
-    {
-      ccm = &cm->cop_config_mains[address_family];
-
-      switch(address_family)
-        {
-        case VNET_COP_IP4:
-          is_add = (a->ip4 != 0);
-          next_to_add_del = IP4_RX_COP_WHITELIST;
-          /* configured opaque data must match, or no supper */
-          p = hash_get (im4->fib_index_by_table_id, a->fib_id);
-          if (p)
-            fib_index = p[0];
-          else
-            {
-              if (is_add)
-                return VNET_API_ERROR_NO_SUCH_FIB;
-              else
-                continue;
-            }
-          break;
-
-        case VNET_COP_IP6:
-          is_add = (a->ip6 != 0);
-          next_to_add_del = IP6_RX_COP_WHITELIST;
-          p = hash_get (im6->fib_index_by_table_id, a->fib_id);
-          if (p)
-            fib_index = p[0];
-          else
-            {
-              if (is_add)
-                return VNET_API_ERROR_NO_SUCH_FIB;
-              else
-                continue;
-            }
-          break;
-
-        case VNET_COP_DEFAULT:
-          is_add = (a->default_cop != 0);
-          next_to_add_del = DEFAULT_RX_COP_WHITELIST;
-          break;
-
-        default:
-          clib_warning ("BUG");
-        }
-
-      ci = ccm->config_index_by_sw_if_index[a->sw_if_index];
-      data->fib_index = fib_index;
-
-      if (is_add)
-	ci = vnet_config_add_feature (vm, &ccm->config_main,
-				      ci,
-                                      next_to_add_del,
-                                      data, sizeof (*data));
-      else
-	ci = vnet_config_del_feature (vm, &ccm->config_main,
-				      ci,
-                                      next_to_add_del,
-                                      data, sizeof (*data));
-
-      ccm->config_index_by_sw_if_index[a->sw_if_index] = ci;
-    }
-  return 0;
-}
-
-static clib_error_t *
-cop_whitelist_enable_disable_command_fn (vlib_main_t * vm,
-                                         unformat_input_t * input,
-                                         vlib_cli_command_t * cmd)
-{
-  cop_main_t * cm = &cop_main;
-  u32 sw_if_index = ~0;
-  u8 ip4 = 0;
-  u8 ip6 = 0;
-  u8 default_cop = 0;
-  u32 fib_id = 0;
-  int rv;
-  cop_whitelist_enable_disable_args_t _a, * a = &_a;
-
-  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
-    if (unformat (input, "ip4"))
-      ip4 = 1;
-    else if (unformat (input, "ip6"))
-      ip6 = 1;
-    else if (unformat (input, "default"))
-      default_cop = 1;
-    else if (unformat (input, "%U", unformat_vnet_sw_interface,
-                       cm->vnet_main, &sw_if_index))
-      ;
-    else if (unformat (input, "fib-id %d", &fib_id))
-      ;
-    else
-      break;
-  }
-
-  if (sw_if_index == ~0)
-    return clib_error_return (0, "Please specify an interface...");
-
-  a->sw_if_index = sw_if_index;
-  a->ip4 = ip4;
-  a->ip6 = ip6;
-  a->default_cop = default_cop;
-  a->fib_id = fib_id;
-
-  rv = cop_whitelist_enable_disable (a);
-
-  switch(rv) {
-  case 0:
-    break;
-
-  case VNET_API_ERROR_INVALID_SW_IF_INDEX:
-    return clib_error_return
-      (0, "Invalid interface, only works on physical ports");
-    break;
-
-  case VNET_API_ERROR_NO_SUCH_FIB:
-    return clib_error_return
-      (0, "Invalid fib");
-    break;
-
-  case VNET_API_ERROR_UNIMPLEMENTED:
-    return clib_error_return (0, "Device driver doesn't support redirection");
-    break;
-
-  default:
-    return clib_error_return (0, "cop_whitelist_enable_disable returned %d",
-                              rv);
-  }
-
-  return 0;
-}
-
-VLIB_CLI_COMMAND (cop_whitelist_command, static) = {
-    .path = "cop whitelist",
-    .short_help =
-    "cop whitelist <interface-name> [ip4][ip6][default][fib-id <NN>][disable]",
-    .function = cop_whitelist_enable_disable_command_fn,
-};
diff --git a/src/vnet/cop/cop.h b/src/vnet/cop/cop.h
deleted file mode 100644
index ee848ce..0000000
--- a/src/vnet/cop/cop.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __vnet_cop_h__
-#define __vnet_cop_h__
-
-#include <vlib/vlib.h>
-#include <vnet/vnet.h>
-#include <vnet/pg/pg.h>
-
-#include <vppinfra/error.h>
-#include <vppinfra/hash.h>
-#include <vnet/vnet.h>
-#include <vnet/ip/ip.h>
-#include <vnet/l2/l2_input.h>
-#include <vnet/ethernet/ethernet.h>
-#include <vnet/ip/ip4_packet.h>
-#include <vnet/ip/ip6_packet.h>
-
-typedef enum {
-  VNET_COP_IP4,
-  VNET_COP_IP6,
-  VNET_COP_DEFAULT,
-  VNET_N_COPS,
-} vnet_cop_t;
-
-typedef enum {
-  /* First check src address against whitelist */
-  IP4_RX_COP_WHITELIST,
-  IP6_RX_COP_WHITELIST,
-  DEFAULT_RX_COP_WHITELIST,
-
-  /* Pkts not otherwise dropped go to xxx-input */
-  IP4_RX_COP_INPUT,
-  IP6_RX_COP_INPUT,
-  DEFAULT_RX_COP_INPUT,
-
-  /* Going, going, gone... */
-  RX_COP_DROP,
-
-  COP_RX_N_FEATURES,
-} cop_feature_type_t;
-
-typedef struct {
-  vnet_config_main_t config_main;
-  u32 * config_index_by_sw_if_index;
-} cop_config_main_t;
-
-typedef struct {
-  u32 fib_index;
-} cop_config_data_t;
-
-typedef struct {
-  cop_config_main_t cop_config_mains[VNET_N_COPS];
-
-  /* convenience */
-  vlib_main_t * vlib_main;
-  vnet_main_t * vnet_main;
-} cop_main_t;
-
-extern cop_main_t cop_main;
-
-extern vlib_node_registration_t cop_input_node;
-
-int cop_interface_enable_disable (u32 sw_if_index, int enable_disable);
-
-typedef struct {
-  u32 sw_if_index;
-  u8 ip4;
-  u8 ip6;
-  u8 default_cop;
-  u32 fib_id;
-} cop_whitelist_enable_disable_args_t;
-
-int cop_whitelist_enable_disable (cop_whitelist_enable_disable_args_t *a);
-
-#endif /* __vnet_cop_h__ */
diff --git a/src/vnet/cop/cop_api.c b/src/vnet/cop/cop_api.c
index 1415bf0..6ebcebc 100644
--- a/src/vnet/cop/cop_api.c
+++ b/src/vnet/cop/cop_api.c
@@ -2,7 +2,7 @@
  *------------------------------------------------------------------
  * cop_api.c - cop api
  *
- * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Copyright (c) 2016,2020 Cisco and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
@@ -22,7 +22,6 @@
 
 #include <vnet/interface.h>
 #include <vnet/api_errno.h>
-#include <vnet/cop/cop.h>
 
 #include <vnet/vnet_msg_enum.h>
 
@@ -46,6 +45,36 @@
 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable)   \
 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable)
 
+typedef struct
+{
+  u32 sw_if_index;
+  u8 ip4;
+  u8 ip6;
+  u8 default_cop;
+  u32 fib_id;
+} cop_whitelist_enable_disable_args_t;
+
+/*
+ * This API will be deprecated in vpp 20.12.
+ *
+ * Continue to support it for the moment if the "adl" plugin
+ * is loaded...
+ */
+static int default_interface_enable_disable_callback
+  (u32 sw_if_index, int enable_disable)
+{
+  return VNET_API_ERROR_UNIMPLEMENTED;
+}
+
+static int (*interface_enable_disable_callback) (u32, int) =
+  default_interface_enable_disable_callback;
+
+void
+register_vl_api_cop_interface_enable_disable_callback (void *cb)
+{
+  interface_enable_disable_callback = cb;
+}
+
 static void vl_api_cop_interface_enable_disable_t_handler
   (vl_api_cop_interface_enable_disable_t * mp)
 {
@@ -58,13 +87,36 @@
 
   enable_disable = (int) mp->enable_disable;
 
-  rv = cop_interface_enable_disable (sw_if_index, enable_disable);
+  rv = (*interface_enable_disable_callback) (sw_if_index, enable_disable);
 
   BAD_SW_IF_INDEX_LABEL;
 
   REPLY_MACRO (VL_API_COP_INTERFACE_ENABLE_DISABLE_REPLY);
 }
 
+/*
+ * This API will be deprecated in vpp 20.12.
+ *
+ * Continue to support it for the moment if the "adl" plugin
+ * is loaded...
+ */
+
+static int default_whitelist_enable_disable_callback
+  (cop_whitelist_enable_disable_args_t * a)
+{
+  return VNET_API_ERROR_UNIMPLEMENTED;
+}
+
+static int (*whitelist_enable_disable_callback)
+  (cop_whitelist_enable_disable_args_t * a) =
+  default_whitelist_enable_disable_callback;
+
+void
+register_vl_api_cop_whitelist_enable_disable_callback (void *cb)
+{
+  whitelist_enable_disable_callback = cb;
+}
+
 static void vl_api_cop_whitelist_enable_disable_t_handler
   (vl_api_cop_whitelist_enable_disable_t * mp)
 {
@@ -81,7 +133,7 @@
   a->default_cop = mp->default_cop;
   a->fib_id = ntohl (mp->fib_id);
 
-  rv = cop_whitelist_enable_disable (a);
+  rv = (*whitelist_enable_disable_callback) (a);
 
   BAD_SW_IF_INDEX_LABEL;
 
diff --git a/src/vnet/cop/ip4_whitelist.c b/src/vnet/cop/ip4_whitelist.c
deleted file mode 100644
index 484ad36..0000000
--- a/src/vnet/cop/ip4_whitelist.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <vnet/cop/cop.h>
-#include <vnet/fib/ip4_fib.h>
-#include <vnet/dpo/load_balance.h>
-
-typedef struct {
-  u32 next_index;
-  u32 sw_if_index;
-} ip4_cop_whitelist_trace_t;
-
-/* packet trace format function */
-static u8 * format_ip4_cop_whitelist_trace (u8 * s, va_list * args)
-{
-  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
-  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
-  ip4_cop_whitelist_trace_t * t = va_arg (*args, ip4_cop_whitelist_trace_t *);
-  
-  s = format (s, "IP4_COP_WHITELIST: sw_if_index %d, next index %d",
-              t->sw_if_index, t->next_index);
-  return s;
-}
-
-#define foreach_ip4_cop_whitelist_error                         \
-_(DROPPED, "ip4 cop whitelist packets dropped")
-
-typedef enum {
-#define _(sym,str) IP4_COP_WHITELIST_ERROR_##sym,
-  foreach_ip4_cop_whitelist_error
-#undef _
-  IP4_COP_WHITELIST_N_ERROR,
-} ip4_cop_whitelist_error_t;
-
-static char * ip4_cop_whitelist_error_strings[] = {
-#define _(sym,string) string,
-  foreach_ip4_cop_whitelist_error
-#undef _
-};
-
-VLIB_NODE_FN (ip4_cop_whitelist_node) (vlib_main_t * vm,
-		  vlib_node_runtime_t * node,
-		  vlib_frame_t * frame)
-{
-  u32 n_left_from, * from, * to_next;
-  cop_feature_type_t next_index;
-  cop_main_t *cm = &cop_main;
-  vlib_combined_counter_main_t * vcm = &load_balance_main.lbm_via_counters;
-  u32 thread_index = vm->thread_index;
-
-  from = vlib_frame_vector_args (frame);
-  n_left_from = frame->n_vectors;
-  next_index = node->cached_next_index;
-
-  while (n_left_from > 0)
-    {
-      u32 n_left_to_next;
-
-      vlib_get_next_frame (vm, node, next_index,
-			   to_next, n_left_to_next);
-
-      while (n_left_from >= 4 && n_left_to_next >= 2)
-      	{
-          u32 bi0, bi1;
-          vlib_buffer_t * b0, * b1;
-          u32 next0, next1;
-          u32 sw_if_index0, sw_if_index1;
-          ip4_header_t * ip0, * ip1;
-          cop_config_main_t * ccm0, * ccm1;
-          cop_config_data_t * c0, * c1;
-      	  ip4_fib_mtrie_t * mtrie0, * mtrie1;
-      	  ip4_fib_mtrie_leaf_t leaf0, leaf1;
-          u32 lb_index0, lb_index1;
-          const load_balance_t * lb0, *lb1;
-          const dpo_id_t *dpo0, *dpo1;
-
-      	  /* Prefetch next iteration. */
-      	  {
-      	    vlib_buffer_t * p2, * p3;
-            
-      	    p2 = vlib_get_buffer (vm, from[2]);
-      	    p3 = vlib_get_buffer (vm, from[3]);
-            
-      	    vlib_prefetch_buffer_header (p2, LOAD);
-      	    vlib_prefetch_buffer_header (p3, LOAD);
-
-      	    CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
-      	    CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
-      	  }
-
-          /* speculatively enqueue b0 and b1 to the current next frame */
-      	  to_next[0] = bi0 = from[0];
-      	  to_next[1] = bi1 = from[1];
-      	  from += 2;
-      	  to_next += 2;
-      	  n_left_from -= 2;
-      	  n_left_to_next -= 2;
-
-      	  b0 = vlib_get_buffer (vm, bi0);
-          sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
-
-      	  ip0 = vlib_buffer_get_current (b0);
-
-      	  ccm0 = cm->cop_config_mains + VNET_COP_IP4;
-
-      	  c0 = vnet_get_config_data
-              (&ccm0->config_main,
-               &vnet_buffer (b0)->cop.current_config_index,
-               &next0,
-               sizeof (c0[0]));
-
-	  mtrie0 = &ip4_fib_get (c0->fib_index)->mtrie;
-
-          leaf0 = ip4_fib_mtrie_lookup_step_one (mtrie0, &ip0->src_address);
-
-      	  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0,
-                                             &ip0->src_address, 2);
-
-      	  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0,
-                                             &ip0->src_address, 3);
-
-      	  lb_index0 = ip4_fib_mtrie_leaf_get_adj_index (leaf0);
-
-	  ASSERT (lb_index0
-                  == ip4_fib_table_lookup_lb (ip4_fib_get(c0->fib_index),
-	  				       &ip0->src_address));
-	  lb0 = load_balance_get (lb_index0);
-          dpo0 = load_balance_get_bucket_i(lb0, 0);
-
-          if (PREDICT_FALSE(dpo0->dpoi_type != DPO_RECEIVE))
-            {
-              b0->error = node->errors[IP4_COP_WHITELIST_ERROR_DROPPED];
-              next0 = RX_COP_DROP;
-            }
-
-      	  b1 = vlib_get_buffer (vm, bi1);
-          sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
-
-      	  ip1 = vlib_buffer_get_current (b1);
-
-      	  ccm1 = cm->cop_config_mains + VNET_COP_IP4;
-
-      	  c1 = vnet_get_config_data
-              (&ccm1->config_main,
-               &vnet_buffer (b1)->cop.current_config_index,
-               &next1,
-               sizeof (c1[0]));
-	  mtrie1 = &ip4_fib_get (c1->fib_index)->mtrie;
-
-          leaf1 = ip4_fib_mtrie_lookup_step_one (mtrie1, &ip1->src_address);
-
-      	  leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1,
-                                             &ip1->src_address, 2);
-
-      	  leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1,
-                                             &ip1->src_address, 3);
-
-      	  lb_index1 = ip4_fib_mtrie_leaf_get_adj_index (leaf1);
-	  ASSERT (lb_index1
-                  == ip4_fib_table_lookup_lb (ip4_fib_get(c1->fib_index),
-	  				       &ip1->src_address));
-	  lb1 = load_balance_get (lb_index1);
-          dpo1 = load_balance_get_bucket_i(lb1, 0);
-
-          vlib_increment_combined_counter
-              (vcm, thread_index, lb_index0, 1,
-               vlib_buffer_length_in_chain (vm, b0)
-               + sizeof(ethernet_header_t));
-
-          vlib_increment_combined_counter
-              (vcm, thread_index, lb_index1, 1,
-               vlib_buffer_length_in_chain (vm, b1)
-               + sizeof(ethernet_header_t));
-
-
-          if (PREDICT_FALSE(dpo1->dpoi_type != DPO_RECEIVE))
-            {
-              b1->error = node->errors[IP4_COP_WHITELIST_ERROR_DROPPED];
-              next1 = RX_COP_DROP;
-            }
-
-          if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
-                            && (b0->flags & VLIB_BUFFER_IS_TRACED)))
-            {
-              ip4_cop_whitelist_trace_t *t =
-                 vlib_add_trace (vm, node, b0, sizeof (*t));
-              t->sw_if_index = sw_if_index0;
-              t->next_index = next0;
-            }
-
-          if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
-                            && (b1->flags & VLIB_BUFFER_IS_TRACED)))
-            {
-              ip4_cop_whitelist_trace_t *t =
-                 vlib_add_trace (vm, node, b1, sizeof (*t));
-              t->sw_if_index = sw_if_index1;
-              t->next_index = next1;
-            }
-
-          /* verify speculative enqueues, maybe switch current next frame */
-          vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
-                                           to_next, n_left_to_next,
-                                           bi0, bi1, next0, next1);
-        }
-
-      while (n_left_from > 0 && n_left_to_next > 0)
-	{
-          u32 bi0;
-	  vlib_buffer_t * b0;
-          u32 next0;
-          u32 sw_if_index0;
-          ip4_header_t * ip0;
-          cop_config_main_t *ccm0;
-          cop_config_data_t *c0;
-	  ip4_fib_mtrie_t * mtrie0;
-	  ip4_fib_mtrie_leaf_t leaf0;
-          u32 lb_index0;
-          const load_balance_t * lb0;
-          const dpo_id_t *dpo0;
-
-          /* speculatively enqueue b0 to the current next frame */
-	  bi0 = from[0];
-	  to_next[0] = bi0;
-	  from += 1;
-	  to_next += 1;
-	  n_left_from -= 1;
-	  n_left_to_next -= 1;
-
-	  b0 = vlib_get_buffer (vm, bi0);
-          sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
-
-	  ip0 = vlib_buffer_get_current (b0);
-
-	  ccm0 = cm->cop_config_mains + VNET_COP_IP4;
-
-	  c0 = vnet_get_config_data 
-              (&ccm0->config_main,
-               &vnet_buffer (b0)->cop.current_config_index,
-               &next0,
-               sizeof (c0[0]));
-
-	  mtrie0 = &ip4_fib_get (c0->fib_index)->mtrie;
-
-          leaf0 = ip4_fib_mtrie_lookup_step_one (mtrie0, &ip0->src_address);
-
-	  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, 
-                                             &ip0->src_address, 2);
-
-	  leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, 
-                                             &ip0->src_address, 3);
-
-	  lb_index0 = ip4_fib_mtrie_leaf_get_adj_index (leaf0);
-
-	  ASSERT (lb_index0 
-                  == ip4_fib_table_lookup_lb (ip4_fib_get(c0->fib_index),
-					      &ip0->src_address));
-
-	  lb0 = load_balance_get (lb_index0);
-          dpo0 = load_balance_get_bucket_i(lb0, 0);
-
-          vlib_increment_combined_counter 
-              (vcm, thread_index, lb_index0, 1,
-               vlib_buffer_length_in_chain (vm, b0) 
-               + sizeof(ethernet_header_t));
-
-          if (PREDICT_FALSE(dpo0->dpoi_type != DPO_RECEIVE))
-            {
-              b0->error = node->errors[IP4_COP_WHITELIST_ERROR_DROPPED];
-              next0 = RX_COP_DROP;
-            }
-
-          if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) 
-                            && (b0->flags & VLIB_BUFFER_IS_TRACED))) 
-            {
-              ip4_cop_whitelist_trace_t *t = 
-                 vlib_add_trace (vm, node, b0, sizeof (*t));
-              t->sw_if_index = sw_if_index0;
-              t->next_index = next0;
-            }
-            
-          /* verify speculative enqueue, maybe switch current next frame */
-	  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
-					   to_next, n_left_to_next,
-					   bi0, next0);
-	}
-
-      vlib_put_next_frame (vm, node, next_index, n_left_to_next);
-    }
-  return frame->n_vectors;
-}
-
-VLIB_REGISTER_NODE (ip4_cop_whitelist_node) = {
-  .name = "ip4-cop-whitelist",
-  .vector_size = sizeof (u32),
-  .format_trace = format_ip4_cop_whitelist_trace,
-  .type = VLIB_NODE_TYPE_INTERNAL,
-  
-  .n_errors = ARRAY_LEN(ip4_cop_whitelist_error_strings),
-  .error_strings = ip4_cop_whitelist_error_strings,
-
-  .n_next_nodes = COP_RX_N_FEATURES,
-
-  /* edit / add dispositions here */
-  .next_nodes = {
-    [IP4_RX_COP_WHITELIST] = "ip4-cop-whitelist",
-    [IP6_RX_COP_WHITELIST] = "ip6-cop-whitelist",
-    [DEFAULT_RX_COP_WHITELIST] = "default-cop-whitelist",
-    [IP4_RX_COP_INPUT] = "ip4-input",
-    [IP6_RX_COP_INPUT] = "ip6-input",
-    [DEFAULT_RX_COP_INPUT] = "ethernet-input",
-    [RX_COP_DROP] = "error-drop",
-  },
-};
-
-static clib_error_t *
-ip4_whitelist_init (vlib_main_t * vm)
-{
-  return 0;
-}
-
-VLIB_INIT_FUNCTION (ip4_whitelist_init);
diff --git a/src/vnet/cop/ip6_whitelist.c b/src/vnet/cop/ip6_whitelist.c
deleted file mode 100644
index 3342ed6..0000000
--- a/src/vnet/cop/ip6_whitelist.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <vnet/cop/cop.h>
-#include <vnet/fib/ip6_fib.h>
-#include <vnet/dpo/load_balance.h>
-
-typedef struct {
-  u32 next_index;
-  u32 sw_if_index;
-} ip6_cop_whitelist_trace_t;
-
-/* packet trace format function */
-static u8 * format_ip6_cop_whitelist_trace (u8 * s, va_list * args)
-{
-  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
-  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
-  ip6_cop_whitelist_trace_t * t = va_arg (*args, ip6_cop_whitelist_trace_t *);
-  
-  s = format (s, "IP6_COP_WHITELIST: sw_if_index %d, next index %d",
-              t->sw_if_index, t->next_index);
-  return s;
-}
-
-#define foreach_ip6_cop_whitelist_error                         \
-_(DROPPED, "ip6 cop whitelist packets dropped")
-
-typedef enum {
-#define _(sym,str) IP6_COP_WHITELIST_ERROR_##sym,
-  foreach_ip6_cop_whitelist_error
-#undef _
-  IP6_COP_WHITELIST_N_ERROR,
-} ip6_cop_whitelist_error_t;
-
-static char * ip6_cop_whitelist_error_strings[] = {
-#define _(sym,string) string,
-  foreach_ip6_cop_whitelist_error
-#undef _
-};
-
-VLIB_NODE_FN (ip6_cop_whitelist_node) (vlib_main_t * vm,
-		  vlib_node_runtime_t * node,
-		  vlib_frame_t * frame)
-{
-  u32 n_left_from, * from, * to_next;
-  cop_feature_type_t next_index;
-  cop_main_t *cm = &cop_main;
-  vlib_combined_counter_main_t * vcm = &load_balance_main.lbm_via_counters;
-  u32 thread_index = vm->thread_index;
-
-  from = vlib_frame_vector_args (frame);
-  n_left_from = frame->n_vectors;
-  next_index = node->cached_next_index;
-
-  while (n_left_from > 0)
-    {
-      u32 n_left_to_next;
-
-      vlib_get_next_frame (vm, node, next_index,
-			   to_next, n_left_to_next);
-
-      while (n_left_from >= 4 && n_left_to_next >= 2)
-	{
-          u32 bi0, bi1;
-          vlib_buffer_t * b0, * b1;
-          u32 next0, next1;
-          u32 sw_if_index0, sw_if_index1;
-          ip6_header_t * ip0, * ip1;
-          cop_config_main_t * ccm0, * ccm1;
-          cop_config_data_t * c0, * c1;
-          u32 lb_index0, lb_index1;
-          const load_balance_t * lb0, *lb1;
-          const dpo_id_t *dpo0, *dpo1;
-         
-	  /* Prefetch next iteration. */
-	  {
-	    vlib_buffer_t * p2, * p3;
-            
-	    p2 = vlib_get_buffer (vm, from[2]);
-	    p3 = vlib_get_buffer (vm, from[3]);
-            
-	    vlib_prefetch_buffer_header (p2, LOAD);
-	    vlib_prefetch_buffer_header (p3, LOAD);
-
-	    CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
-	    CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
-	  }
-
-          /* speculatively enqueue b0 and b1 to the current next frame */
-	  to_next[0] = bi0 = from[0];
-	  to_next[1] = bi1 = from[1];
-	  from += 2;
-	  to_next += 2;
-	  n_left_from -= 2;
-	  n_left_to_next -= 2;
-
-	  b0 = vlib_get_buffer (vm, bi0);
-          sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
-
-	  ip0 = vlib_buffer_get_current (b0);
-
-	  ccm0 = cm->cop_config_mains + VNET_COP_IP6;
-
-	  c0 = vnet_get_config_data 
-              (&ccm0->config_main,
-               &vnet_buffer (b0)->cop.current_config_index,
-               &next0,
-               sizeof (c0[0]));
-
-          lb_index0 = ip6_fib_table_fwding_lookup (c0->fib_index, 
-						    &ip0->src_address);
-	  lb0 = load_balance_get (lb_index0);
-          dpo0 = load_balance_get_bucket_i(lb0, 0);
-
-          if (PREDICT_FALSE(dpo0->dpoi_type != DPO_RECEIVE))
-            {
-              b0->error = node->errors[IP6_COP_WHITELIST_ERROR_DROPPED];
-              next0 = RX_COP_DROP;
-            }
-
-	  b1 = vlib_get_buffer (vm, bi1);
-          sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
-
-	  ip1 = vlib_buffer_get_current (b1);
-
-	  ccm1 = cm->cop_config_mains + VNET_COP_IP6;
-
-	  c1 = vnet_get_config_data 
-              (&ccm1->config_main,
-               &vnet_buffer (b1)->cop.current_config_index,
-               &next1,
-               sizeof (c1[0]));
-
-          lb_index1 = ip6_fib_table_fwding_lookup (c1->fib_index, 
-						    &ip1->src_address);
-
-	  lb1 = load_balance_get (lb_index1);
-          dpo1 = load_balance_get_bucket_i(lb1, 0);
-
-          vlib_increment_combined_counter 
-              (vcm, thread_index, lb_index0, 1,
-               vlib_buffer_length_in_chain (vm, b0) 
-               + sizeof(ethernet_header_t));
-
-          vlib_increment_combined_counter 
-              (vcm, thread_index, lb_index1, 1,
-               vlib_buffer_length_in_chain (vm, b1)
-               + sizeof(ethernet_header_t));
-
-          if (PREDICT_FALSE(dpo1->dpoi_type != DPO_RECEIVE))
-            {
-              b1->error = node->errors[IP6_COP_WHITELIST_ERROR_DROPPED];
-              next1 = RX_COP_DROP;
-            }
-
-          if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) 
-                            && (b0->flags & VLIB_BUFFER_IS_TRACED))) 
-            {
-              ip6_cop_whitelist_trace_t *t = 
-                 vlib_add_trace (vm, node, b0, sizeof (*t));
-              t->sw_if_index = sw_if_index0;
-              t->next_index = next0;
-            }
-
-          if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) 
-                            && (b1->flags & VLIB_BUFFER_IS_TRACED))) 
-            {
-              ip6_cop_whitelist_trace_t *t = 
-                 vlib_add_trace (vm, node, b1, sizeof (*t));
-              t->sw_if_index = sw_if_index1;
-              t->next_index = next1;
-            }
-
-          /* verify speculative enqueues, maybe switch current next frame */
-          vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
-                                           to_next, n_left_to_next,
-                                           bi0, bi1, next0, next1);
-        }
-
-      while (n_left_from > 0 && n_left_to_next > 0)
-	{
-          u32 bi0;
-	  vlib_buffer_t * b0;
-          u32 next0;
-          u32 sw_if_index0;
-          ip6_header_t * ip0;
-          cop_config_main_t *ccm0;
-          cop_config_data_t *c0;
-          u32 lb_index0;
-          const load_balance_t * lb0;
-          const dpo_id_t *dpo0;
-
-          /* speculatively enqueue b0 to the current next frame */
-	  bi0 = from[0];
-	  to_next[0] = bi0;
-	  from += 1;
-	  to_next += 1;
-	  n_left_from -= 1;
-	  n_left_to_next -= 1;
-
-	  b0 = vlib_get_buffer (vm, bi0);
-          sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
-
-	  ip0 = vlib_buffer_get_current (b0);
-
-	  ccm0 = cm->cop_config_mains + VNET_COP_IP6;
-
-	  c0 = vnet_get_config_data 
-              (&ccm0->config_main,
-               &vnet_buffer (b0)->cop.current_config_index,
-               &next0,
-               sizeof (c0[0]));
-
-          lb_index0 = ip6_fib_table_fwding_lookup (c0->fib_index, 
-						    &ip0->src_address);
-
-	  lb0 = load_balance_get (lb_index0);
-          dpo0 = load_balance_get_bucket_i(lb0, 0);
-
-          vlib_increment_combined_counter 
-              (vcm, thread_index, lb_index0, 1,
-               vlib_buffer_length_in_chain (vm, b0) 
-               + sizeof(ethernet_header_t));
-
-          if (PREDICT_FALSE(dpo0->dpoi_type != DPO_RECEIVE))
-            {
-              b0->error = node->errors[IP6_COP_WHITELIST_ERROR_DROPPED];
-              next0 = RX_COP_DROP;
-            }
-
-          if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) 
-                            && (b0->flags & VLIB_BUFFER_IS_TRACED))) 
-            {
-              ip6_cop_whitelist_trace_t *t = 
-                 vlib_add_trace (vm, node, b0, sizeof (*t));
-              t->sw_if_index = sw_if_index0;
-              t->next_index = next0;
-            }
-            
-          /* verify speculative enqueue, maybe switch current next frame */
-	  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
-					   to_next, n_left_to_next,
-					   bi0, next0);
-	}
-
-      vlib_put_next_frame (vm, node, next_index, n_left_to_next);
-    }
-  return frame->n_vectors;
-}
-
-VLIB_REGISTER_NODE (ip6_cop_whitelist_node) = {
-  .name = "ip6-cop-whitelist",
-  .vector_size = sizeof (u32),
-  .format_trace = format_ip6_cop_whitelist_trace,
-  .type = VLIB_NODE_TYPE_INTERNAL,
-  
-  .n_errors = ARRAY_LEN(ip6_cop_whitelist_error_strings),
-  .error_strings = ip6_cop_whitelist_error_strings,
-
-  .n_next_nodes = COP_RX_N_FEATURES,
-
-  /* edit / add dispositions here */
-  .next_nodes = {
-    [IP4_RX_COP_WHITELIST] = "ip4-cop-whitelist",
-    [IP6_RX_COP_WHITELIST] = "ip6-cop-whitelist",
-    [DEFAULT_RX_COP_WHITELIST] = "default-cop-whitelist",
-    [IP4_RX_COP_INPUT] = "ip4-input",
-    [IP6_RX_COP_INPUT] = "ip6-input",
-    [DEFAULT_RX_COP_INPUT] = "ethernet-input",
-    [RX_COP_DROP] = "error-drop",
-  },
-};
-
-static clib_error_t *
-ip6_whitelist_init (vlib_main_t * vm)
-{
-  return 0;
-}
-
-VLIB_INIT_FUNCTION (ip6_whitelist_init);
diff --git a/src/vnet/cop/node1.c b/src/vnet/cop/node1.c
deleted file mode 100644
index 172c13d..0000000
--- a/src/vnet/cop/node1.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <vnet/cop/cop.h>
-
-typedef struct {
-  u32 next_index;
-  u32 sw_if_index;
-} cop_input_trace_t;
-
-/* packet trace format function */
-static u8 * format_cop_input_trace (u8 * s, va_list * args)
-{
-  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
-  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
-  cop_input_trace_t * t = va_arg (*args, cop_input_trace_t *);
-  
-  s = format (s, "COP_INPUT: sw_if_index %d, next index %d",
-              t->sw_if_index, t->next_index);
-  return s;
-}
-
-#define foreach_cop_input_error \
-_(PROCESSED, "COP input packets processed")
-
-typedef enum {
-#define _(sym,str) COP_INPUT_ERROR_##sym,
-  foreach_cop_input_error
-#undef _
-  COP_INPUT_N_ERROR,
-} cop_input_error_t;
-
-static char * cop_input_error_strings[] = {
-#define _(sym,string) string,
-  foreach_cop_input_error
-#undef _
-};
-
-VLIB_NODE_FN (cop_input_node) (vlib_main_t * vm,
-		  vlib_node_runtime_t * node,
-		  vlib_frame_t * frame)
-{
-  u32 n_left_from, * from, * to_next;
-  cop_feature_type_t next_index;
-  cop_main_t *cm = &cop_main;
-
-  from = vlib_frame_vector_args (frame);
-  n_left_from = frame->n_vectors;
-  next_index = node->cached_next_index;
-
-  while (n_left_from > 0)
-    {
-      u32 n_left_to_next;
-
-      vlib_get_next_frame (vm, node, next_index,
-			   to_next, n_left_to_next);
-
-      while (n_left_from >= 4 && n_left_to_next >= 2)
-	{
-          u32 bi0, bi1;
-	  vlib_buffer_t * b0, * b1;
-          u32 next0, next1;
-          u32 sw_if_index0, sw_if_index1;
-          ethernet_header_t * en0, * en1;
-          cop_config_main_t * ccm0, * ccm1;
-          u32 advance0, advance1;
-          int proto0, proto1;
-          
-	  /* Prefetch next iteration. */
-	  {
-	    vlib_buffer_t * p2, * p3;
-            
-	    p2 = vlib_get_buffer (vm, from[2]);
-	    p3 = vlib_get_buffer (vm, from[3]);
-            
-	    vlib_prefetch_buffer_header (p2, LOAD);
-	    vlib_prefetch_buffer_header (p3, LOAD);
-
-	    CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
-	    CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
-	  }
-
-          /* speculatively enqueue b0 and b1 to the current next frame */
-	  to_next[0] = bi0 = from[0];
-	  to_next[1] = bi1 = from[1];
-	  from += 2;
-	  to_next += 2;
-	  n_left_from -= 2;
-	  n_left_to_next -= 2;
-
-	  b0 = vlib_get_buffer (vm, bi0);
-	  b1 = vlib_get_buffer (vm, bi1);
-
-          en0 = vlib_buffer_get_current (b0);
-          en1 = vlib_buffer_get_current (b1);
-
-          sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
-          sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
-
-          proto0 = VNET_COP_DEFAULT;
-          proto1 = VNET_COP_DEFAULT;
-          advance0 = 0;
-          advance1 = 0;
-
-          if (en0->type == clib_host_to_net_u16(ETHERNET_TYPE_IP4))
-            {
-              proto0 = VNET_COP_IP4;
-              advance0 = sizeof(ethernet_header_t);
-            }
-          else if (en0->type == clib_host_to_net_u16(ETHERNET_TYPE_IP6))
-            {
-              proto0 = VNET_COP_IP6;
-              advance0 = sizeof(ethernet_header_t);
-            }
-
-          if (en1->type == clib_host_to_net_u16(ETHERNET_TYPE_IP4))
-            {
-              proto1 = VNET_COP_IP4;
-              advance1 = sizeof(ethernet_header_t);
-            }
-          else if (en1->type == clib_host_to_net_u16(ETHERNET_TYPE_IP6))
-            {
-              proto1 = VNET_COP_IP6;
-              advance1 = sizeof(ethernet_header_t);
-            }
-
-	  ccm0 = cm->cop_config_mains + proto0;
-	  ccm1 = cm->cop_config_mains + proto1;
-          vnet_buffer(b0)->cop.current_config_index = 
-            ccm0->config_index_by_sw_if_index [sw_if_index0];
-
-          vnet_buffer(b1)->cop.current_config_index = 
-            ccm1->config_index_by_sw_if_index [sw_if_index1];
-
-          vlib_buffer_advance (b0, advance0);
-          vlib_buffer_advance (b1, advance1);
-
-          vnet_get_config_data (&ccm0->config_main,
-                                &vnet_buffer(b0)->cop.current_config_index,
-                                &next0, 0 /* bytes of config data */);
-
-          vnet_get_config_data (&ccm1->config_main,
-                                &vnet_buffer(b1)->cop.current_config_index,
-                                &next1, 0 /* bytes of config data */);
-
-          if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) 
-                            && (b0->flags & VLIB_BUFFER_IS_TRACED))) 
-            {
-              cop_input_trace_t *t = 
-                 vlib_add_trace (vm, node, b0, sizeof (*t));
-              t->sw_if_index = sw_if_index0;
-              t->next_index = next0;
-            }
-
-          if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) 
-                            && (b1->flags & VLIB_BUFFER_IS_TRACED))) 
-            {
-              cop_input_trace_t *t = 
-                 vlib_add_trace (vm, node, b1, sizeof (*t));
-              t->sw_if_index = sw_if_index1;
-              t->next_index = next1;
-            }
-          /* verify speculative enqueues, maybe switch current next frame */
-          vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
-                                           to_next, n_left_to_next,
-                                           bi0, bi1, next0, next1);
-        }
-
-      while (n_left_from > 0 && n_left_to_next > 0)
-	{
-          u32 bi0;
-	  vlib_buffer_t * b0;
-          u32 next0;
-          u32 sw_if_index0;
-          ethernet_header_t *en0;
-          cop_config_main_t *ccm0;
-          u32 advance0;
-          int proto0;
-
-          /* speculatively enqueue b0 to the current next frame */
-	  bi0 = from[0];
-	  to_next[0] = bi0;
-	  from += 1;
-	  to_next += 1;
-	  n_left_from -= 1;
-	  n_left_to_next -= 1;
-
-	  b0 = vlib_get_buffer (vm, bi0);
-
-          /* 
-           * Direct from the driver, we should be at offset 0
-           * aka at &b0->data[0]
-           */
-          ASSERT (b0->current_data == 0);
-
-          en0 = vlib_buffer_get_current (b0);
-
-          sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
-
-          proto0 = VNET_COP_DEFAULT;
-          advance0 = 0;
-
-          if (en0->type == clib_host_to_net_u16(ETHERNET_TYPE_IP4))
-            {
-              proto0 = VNET_COP_IP4;
-              advance0 = sizeof(ethernet_header_t);
-            }
-          else if (en0->type == clib_host_to_net_u16(ETHERNET_TYPE_IP6))
-            {
-              proto0 = VNET_COP_IP6;
-              advance0 = sizeof(ethernet_header_t);
-            }
-
-	  ccm0 = cm->cop_config_mains + proto0;
-          vnet_buffer(b0)->cop.current_config_index = 
-            ccm0->config_index_by_sw_if_index [sw_if_index0];
-
-          vlib_buffer_advance (b0, advance0);
-
-          vnet_get_config_data (&ccm0->config_main,
-                                &vnet_buffer(b0)->cop.current_config_index,
-                                &next0, 0 /* bytes of config data */);
-
-          if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) 
-                            && (b0->flags & VLIB_BUFFER_IS_TRACED))) 
-            {
-              cop_input_trace_t *t = 
-                 vlib_add_trace (vm, node, b0, sizeof (*t));
-              t->sw_if_index = sw_if_index0;
-              t->next_index = next0;
-            }
-            
-          /* verify speculative enqueue, maybe switch current next frame */
-	  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
-					   to_next, n_left_to_next,
-					   bi0, next0);
-	}
-
-      vlib_put_next_frame (vm, node, next_index, n_left_to_next);
-    }
-  vlib_node_increment_counter (vm, cop_input_node.index, 
-                               COP_INPUT_ERROR_PROCESSED, frame->n_vectors);
-  return frame->n_vectors;
-}
-
-VLIB_REGISTER_NODE (cop_input_node) = {
-  .name = "cop-input",
-  .vector_size = sizeof (u32),
-  .format_trace = format_cop_input_trace,
-  .type = VLIB_NODE_TYPE_INTERNAL,
-  
-  .n_errors = ARRAY_LEN(cop_input_error_strings),
-  .error_strings = cop_input_error_strings,
-
-  .n_next_nodes = COP_RX_N_FEATURES,
-
-  /* edit / add dispositions here */
-  .next_nodes = {
-    [IP4_RX_COP_WHITELIST] = "ip4-cop-whitelist",
-    [IP6_RX_COP_WHITELIST] = "ip6-cop-whitelist",
-    [DEFAULT_RX_COP_WHITELIST] = "default-cop-whitelist",
-    [IP4_RX_COP_INPUT] = "ip4-input",
-    [IP6_RX_COP_INPUT] = "ip6-input",
-    [DEFAULT_RX_COP_INPUT] = "ethernet-input",
-    [RX_COP_DROP] = "error-drop",
-  },
-};
-
-#define foreach_cop_stub                        \
-_(default-cop-whitelist, default_cop_whitelist)
-
-#define _(n,f)                                  \
-                                                \
-static uword                                    \
-f##_node_fn (vlib_main_t * vm,                  \
-             vlib_node_runtime_t * node,        \
-             vlib_frame_t * frame)              \
-{                                               \
-  clib_warning ("BUG: stub function called");   \
-  return 0;                                     \
-}                                               \
-                                                \
-VLIB_REGISTER_NODE (f##_input_node) = {         \
-  .function = f##_node_fn,                      \
-  .name = #n,                                   \
-  .vector_size = sizeof (u32),                  \
-  .type = VLIB_NODE_TYPE_INTERNAL,              \
-                                                \
-  .n_errors = 0,                                \
-  .error_strings = 0,                           \
-                                                \
-  .n_next_nodes = 0,                            \
-};
-
-foreach_cop_stub;
-
-
-
-
-
-
