VPP-450 Fix adding LISP adjacencies via CLI
[vpp.git] / vpp-api-test / vat / api_format.c
index 27c80d9..0a15ed7 100644 (file)
@@ -3390,6 +3390,9 @@ _(sw_interface_add_del_address_reply)                   \
 _(sw_interface_set_table_reply)                         \
 _(sw_interface_set_vpath_reply)                         \
 _(sw_interface_set_l2_bridge_reply)                     \
+_(sw_interface_set_dpdk_hqos_pipe_reply)                \
+_(sw_interface_set_dpdk_hqos_subport_reply)             \
+_(sw_interface_set_dpdk_hqos_tctbl_reply)               \
 _(bridge_domain_add_del_reply)                          \
 _(sw_interface_set_l2_xconnect_reply)                   \
 _(l2fib_add_del_reply)                                  \
@@ -3532,6 +3535,12 @@ _(SW_INTERFACE_SET_L2_XCONNECT_REPLY,                                   \
   sw_interface_set_l2_xconnect_reply)                                   \
 _(SW_INTERFACE_SET_L2_BRIDGE_REPLY,                                     \
   sw_interface_set_l2_bridge_reply)                                     \
+_(SW_INTERFACE_SET_DPDK_HQOS_PIPE_REPLY,                                \
+  sw_interface_set_dpdk_hqos_pipe_reply)                                \
+_(SW_INTERFACE_SET_DPDK_HQOS_SUBPORT_REPLY,                             \
+  sw_interface_set_dpdk_hqos_subport_reply)                             \
+_(SW_INTERFACE_SET_DPDK_HQOS_TCTBL_REPLY,                               \
+  sw_interface_set_dpdk_hqos_tctbl_reply)                               \
 _(BRIDGE_DOMAIN_ADD_DEL_REPLY, bridge_domain_add_del_reply)             \
 _(BRIDGE_DOMAIN_DETAILS, bridge_domain_details)                         \
 _(BRIDGE_DOMAIN_SW_IF_DETAILS, bridge_domain_sw_if_details)             \
@@ -4500,6 +4509,225 @@ api_sw_interface_clear_stats (vat_main_t * vam)
   W;
 }
 
+static int
+api_sw_interface_set_dpdk_hqos_pipe (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_sw_interface_set_dpdk_hqos_pipe_t *mp;
+  f64 timeout;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
+  u32 subport;
+  u8 subport_set = 0;
+  u32 pipe;
+  u8 pipe_set = 0;
+  u32 profile;
+  u8 profile_set = 0;
+
+  /* Parse args required to build the message */
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "rx %U", unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %u", &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "subport %u", &subport))
+       subport_set = 1;
+      else if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "pipe %u", &pipe))
+       pipe_set = 1;
+      else if (unformat (i, "profile %u", &profile))
+       profile_set = 1;
+      else
+       break;
+    }
+
+  if (sw_if_index_set == 0)
+    {
+      errmsg ("missing interface name or sw_if_index\n");
+      return -99;
+    }
+
+  if (subport_set == 0)
+    {
+      errmsg ("missing subport \n");
+      return -99;
+    }
+
+  if (pipe_set == 0)
+    {
+      errmsg ("missing pipe\n");
+      return -99;
+    }
+
+  if (profile_set == 0)
+    {
+      errmsg ("missing profile\n");
+      return -99;
+    }
+
+  M (SW_INTERFACE_SET_DPDK_HQOS_PIPE, sw_interface_set_dpdk_hqos_pipe);
+
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->subport = ntohl (subport);
+  mp->pipe = ntohl (pipe);
+  mp->profile = ntohl (profile);
+
+
+  S;
+  W;
+  /* NOTREACHED */
+  return 0;
+}
+
+static int
+api_sw_interface_set_dpdk_hqos_subport (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_sw_interface_set_dpdk_hqos_subport_t *mp;
+  f64 timeout;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
+  u32 subport;
+  u8 subport_set = 0;
+  u32 tb_rate = 1250000000;    /* 10GbE */
+  u32 tb_size = 1000000;
+  u32 tc_rate[] = { 1250000000, 1250000000, 1250000000, 1250000000 };
+  u32 tc_period = 10;
+
+  /* Parse args required to build the message */
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "rx %U", unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %u", &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "subport %u", &subport))
+       subport_set = 1;
+      else if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "rate %u", &tb_rate))
+       {
+         u32 tc_id;
+
+         for (tc_id = 0; tc_id < (sizeof (tc_rate) / sizeof (tc_rate[0]));
+              tc_id++)
+           tc_rate[tc_id] = tb_rate;
+       }
+      else if (unformat (i, "bktsize %u", &tb_size))
+       ;
+      else if (unformat (i, "tc0 %u", &tc_rate[0]))
+       ;
+      else if (unformat (i, "tc1 %u", &tc_rate[1]))
+       ;
+      else if (unformat (i, "tc2 %u", &tc_rate[2]))
+       ;
+      else if (unformat (i, "tc3 %u", &tc_rate[3]))
+       ;
+      else if (unformat (i, "period %u", &tc_period))
+       ;
+      else
+       break;
+    }
+
+  if (sw_if_index_set == 0)
+    {
+      errmsg ("missing interface name or sw_if_index\n");
+      return -99;
+    }
+
+  if (subport_set == 0)
+    {
+      errmsg ("missing subport \n");
+      return -99;
+    }
+
+  M (SW_INTERFACE_SET_DPDK_HQOS_SUBPORT, sw_interface_set_dpdk_hqos_subport);
+
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->subport = ntohl (subport);
+  mp->tb_rate = ntohl (tb_rate);
+  mp->tb_size = ntohl (tb_size);
+  mp->tc_rate[0] = ntohl (tc_rate[0]);
+  mp->tc_rate[1] = ntohl (tc_rate[1]);
+  mp->tc_rate[2] = ntohl (tc_rate[2]);
+  mp->tc_rate[3] = ntohl (tc_rate[3]);
+  mp->tc_period = ntohl (tc_period);
+
+  S;
+  W;
+  /* NOTREACHED */
+  return 0;
+}
+
+static int
+api_sw_interface_set_dpdk_hqos_tctbl (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_sw_interface_set_dpdk_hqos_tctbl_t *mp;
+  f64 timeout;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
+  u8 entry_set = 0;
+  u8 tc_set = 0;
+  u8 queue_set = 0;
+  u32 entry, tc, queue;
+
+  /* Parse args required to build the message */
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "rx %U", unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %u", &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "entry %d", &entry))
+       entry_set = 1;
+      else if (unformat (i, "tc %d", &tc))
+       tc_set = 1;
+      else if (unformat (i, "queue %d", &queue))
+       queue_set = 1;
+      else
+       break;
+    }
+
+  if (sw_if_index_set == 0)
+    {
+      errmsg ("missing interface name or sw_if_index\n");
+      return -99;
+    }
+
+  if (entry_set == 0)
+    {
+      errmsg ("missing entry \n");
+      return -99;
+    }
+
+  if (tc_set == 0)
+    {
+      errmsg ("missing traffic class \n");
+      return -99;
+    }
+
+  if (queue_set == 0)
+    {
+      errmsg ("missing queue \n");
+      return -99;
+    }
+
+  M (SW_INTERFACE_SET_DPDK_HQOS_TCTBL, sw_interface_set_dpdk_hqos_tctbl);
+
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->entry = ntohl (entry);
+  mp->tc = ntohl (tc);
+  mp->queue = ntohl (queue);
+
+  S;
+  W;
+  /* NOTREACHED */
+  return 0;
+}
+
 static int
 api_sw_interface_add_del_address (vat_main_t * vam)
 {
@@ -11870,6 +12098,7 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
   u8 locator_set_name_set = 0;
   ls_locator_t locator, *locators = 0;
   u32 sw_if_index, priority, weight;
+  u32 data_len = 0;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -11918,8 +12147,10 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
     }
   vec_add1 (locator_set_name, 0);
 
+  data_len = sizeof (ls_locator_t) * vec_len (locators);
+
   /* Construct the API message */
-  M (LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set);
+  M2 (LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set, data_len);
 
   mp->is_add = is_add;
   clib_memcpy (mp->locator_set_name, locator_set_name,
@@ -11928,8 +12159,7 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
 
   mp->locator_num = clib_host_to_net_u32 (vec_len (locators));
   if (locators)
-    clib_memcpy (mp->locators, locators,
-                (sizeof (ls_locator_t) * vec_len (locators)));
+    clib_memcpy (mp->locators, locators, data_len);
   vec_free (locators);
 
   /* send it... */
@@ -12667,7 +12897,7 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
   lisp_eid_vat_t _eid, *eid = &_eid;
   lisp_eid_vat_t _seid, *seid = &_seid;
   u8 is_add = 1, del_all = 0, eid_set = 0, seid_set = 0;
-  u32 action = ~0, p, w;
+  u32 action = ~0, p, w, data_len;
   ip4_address_t rloc4;
   ip6_address_t rloc6;
   rloc_t *rlocs = 0, rloc, *curr_rloc = 0;
@@ -12749,7 +12979,9 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
       return -99;
     }
 
-  M (LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping);
+  data_len = vec_len (rlocs) * sizeof (rloc_t);
+
+  M2 (LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping, data_len);
   mp->is_add = is_add;
   mp->vni = htonl (vni);
   mp->action = (u8) action;
@@ -12762,7 +12994,7 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
   lisp_eid_put_vat (mp->seid, seid->addr, seid->type);
 
   mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs));
-  clib_memcpy (mp->rlocs, rlocs, (sizeof (rloc_t) * vec_len (rlocs)));
+  clib_memcpy (mp->rlocs, rlocs, data_len);
   vec_free (rlocs);
 
   /* send it... */
@@ -12789,15 +13021,15 @@ api_lisp_add_del_adjacency (vat_main_t * vam)
   vl_api_lisp_add_del_adjacency_t *mp;
   f64 timeout = ~0;
   u32 vni = 0;
-  ip4_address_t seid4, deid4;
-  ip6_address_t seid6, deid6;
-  u8 deid_mac[6] = { 0 };
-  u8 seid_mac[6] = { 0 };
-  u8 deid_type, seid_type;
-  u32 seid_len = 0, deid_len = 0, len;
+  ip4_address_t leid4, reid4;
+  ip6_address_t leid6, reid6;
+  u8 reid_mac[6] = { 0 };
+  u8 leid_mac[6] = { 0 };
+  u8 reid_type, leid_type;
+  u32 leid_len = 0, reid_len = 0, len;
   u8 is_add = 1;
 
-  seid_type = deid_type = (u8) ~ 0;
+  leid_type = reid_type = (u8) ~ 0;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -12810,39 +13042,39 @@ api_lisp_add_del_adjacency (vat_main_t * vam)
        {
          is_add = 1;
        }
-      else if (unformat (input, "deid %U/%d", unformat_ip4_address,
-                        &deid4, &len))
+      else if (unformat (input, "reid %U/%d", unformat_ip4_address,
+                        &reid4, &len))
        {
-         deid_type = 0;        /* ipv4 */
-         deid_len = len;
+         reid_type = 0;        /* ipv4 */
+         reid_len = len;
        }
-      else if (unformat (input, "deid %U/%d", unformat_ip6_address,
-                        &deid6, &len))
+      else if (unformat (input, "reid %U/%d", unformat_ip6_address,
+                        &reid6, &len))
        {
-         deid_type = 1;        /* ipv6 */
-         deid_len = len;
+         reid_type = 1;        /* ipv6 */
+         reid_len = len;
        }
-      else if (unformat (input, "deid %U", unformat_ethernet_address,
-                        deid_mac))
+      else if (unformat (input, "reid %U", unformat_ethernet_address,
+                        reid_mac))
        {
-         deid_type = 2;        /* mac */
+         reid_type = 2;        /* mac */
        }
-      else if (unformat (input, "seid %U/%d", unformat_ip4_address,
-                        &seid4, &len))
+      else if (unformat (input, "leid %U/%d", unformat_ip4_address,
+                        &leid4, &len))
        {
-         seid_type = 0;        /* ipv4 */
-         seid_len = len;
+         leid_type = 0;        /* ipv4 */
+         leid_len = len;
        }
-      else if (unformat (input, "seid %U/%d", unformat_ip6_address,
-                        &seid6, &len))
+      else if (unformat (input, "leid %U/%d", unformat_ip6_address,
+                        &leid6, &len))
        {
-         seid_type = 1;        /* ipv6 */
-         seid_len = len;
+         leid_type = 1;        /* ipv6 */
+         leid_len = len;
        }
-      else if (unformat (input, "seid %U", unformat_ethernet_address,
-                        seid_mac))
+      else if (unformat (input, "leid %U", unformat_ethernet_address,
+                        leid_mac))
        {
-         seid_type = 2;        /* mac */
+         leid_type = 2;        /* mac */
        }
       else if (unformat (input, "vni %d", &vni))
        {
@@ -12855,38 +13087,38 @@ api_lisp_add_del_adjacency (vat_main_t * vam)
        }
     }
 
-  if ((u8) ~ 0 == deid_type)
+  if ((u8) ~ 0 == reid_type)
     {
       errmsg ("missing params!");
       return -99;
     }
 
-  if (seid_type != deid_type)
+  if (leid_type != reid_type)
     {
-      errmsg ("source and destination EIDs are of different types!");
+      errmsg ("remote and local EIDs are of different types!");
       return -99;
     }
 
   M (LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency);
   mp->is_add = is_add;
   mp->vni = htonl (vni);
-  mp->seid_len = seid_len;
-  mp->deid_len = deid_len;
-  mp->eid_type = deid_type;
+  mp->leid_len = leid_len;
+  mp->reid_len = reid_len;
+  mp->eid_type = reid_type;
 
   switch (mp->eid_type)
     {
     case 0:
-      clib_memcpy (mp->seid, &seid4, sizeof (seid4));
-      clib_memcpy (mp->deid, &deid4, sizeof (deid4));
+      clib_memcpy (mp->leid, &leid4, sizeof (leid4));
+      clib_memcpy (mp->reid, &reid4, sizeof (reid4));
       break;
     case 1:
-      clib_memcpy (mp->seid, &seid6, sizeof (seid6));
-      clib_memcpy (mp->deid, &deid6, sizeof (deid6));
+      clib_memcpy (mp->leid, &leid6, sizeof (leid6));
+      clib_memcpy (mp->reid, &reid6, sizeof (reid6));
       break;
     case 2:
-      clib_memcpy (mp->seid, seid_mac, 6);
-      clib_memcpy (mp->deid, deid_mac, 6);
+      clib_memcpy (mp->leid, leid_mac, 6);
+      clib_memcpy (mp->reid, reid_mac, 6);
       break;
     default:
       errmsg ("unknown EID type %d!", mp->eid_type);
@@ -15294,6 +15526,14 @@ _(sw_interface_set_l2_bridge,                                           \
   "<intfc> | sw_if_index <id> bd_id <bridge-domain-id>\n"         \
   "[shg <split-horizon-group>] [bvi]\n"                                 \
   "enable | disable")                                                   \
+_(sw_interface_set_dpdk_hqos_pipe,                                      \
+  "rx <intfc> | sw_if_index <id> subport <subport-id> pipe <pipe-id>\n" \
+  "profile <profile-id>\n")                                             \
+_(sw_interface_set_dpdk_hqos_subport,                                   \
+  "rx <intfc> | sw_if_index <id> subport <subport-id> [rate <n>]\n"     \
+  "[bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] [period <n>]\n") \
+_(sw_interface_set_dpdk_hqos_tctbl,                                     \
+  "rx <intfc> | sw_if_index <id> entry <n> tc <n> queue <n>\n")         \
 _(bridge_domain_add_del,                                                \
   "bd_id <bridge-domain-id> [flood 1|0] [uu-flood 1|0] [forward 1|0] [learn 1|0] [arp-term 1|0] [del]\n")\
 _(bridge_domain_dump, "[bd_id <bridge-domain-id>]\n")     \
@@ -15506,9 +15746,8 @@ _(lisp_add_del_remote_mapping, "add|del vni <vni> eid <dest-eid> "      \
                                "rloc <locator> p <prio> "               \
                                "w <weight> [rloc <loc> ... ] "          \
                                "action <action> [del-all]")             \
-_(lisp_add_del_adjacency, "add|del vni <vni> deid <dest-eid> seid "     \
-                          "<src-eid> rloc <locator> p <prio> w <weight>"\
-                          "[rloc <loc> ... ] action <action>")          \
+_(lisp_add_del_adjacency, "add|del vni <vni> reid <remote-eid> leid "   \
+                          "<local-eid>")                                \
 _(lisp_pitr_set_locator_set, "locator-set <loc-set-name> | del")        \
 _(lisp_map_request_mode, "src-dst|dst-only")                            \
 _(lisp_add_del_map_request_itr_rlocs, "<loc-set-name> [del]")           \