FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
classify_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * classify_api.c - classify api
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <vnet/vnet.h>
21 #include <vlibmemory/api.h>
22 
23 #include <vnet/interface.h>
24 #include <vnet/api_errno.h>
25 
30 #include <vnet/l2/l2_classify.h>
31 #include <vnet/ip/ip6.h>
32 #include <vnet/ip/ip4.h>
33 
34 #include <vnet/vnet_msg_enum.h>
35 
36 #define vl_typedefs /* define message structures */
37 #include <vnet/vnet_all_api_h.h>
38 #undef vl_typedefs
39 
40 #define vl_endianfun /* define message structures */
41 #include <vnet/vnet_all_api_h.h>
42 #undef vl_endianfun
43 
44 /* instantiate all the print functions we know about */
45 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
46 #define vl_printfun
47 #include <vnet/vnet_all_api_h.h>
48 #undef vl_printfun
49 
51 
52 #define foreach_vpe_api_msg \
53 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \
54 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session) \
55 _(CLASSIFY_TABLE_IDS, classify_table_ids) \
56 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
57 _(CLASSIFY_TABLE_INFO, classify_table_info) \
58 _(CLASSIFY_SESSION_DUMP, classify_session_dump) \
59 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
60 _(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
61 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface) \
62 _(FLOW_CLASSIFY_DUMP, flow_classify_dump) \
63 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
64 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
65 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
66 _(OUTPUT_ACL_SET_INTERFACE, output_acl_set_interface) \
67 _(CLASSIFY_PCAP_LOOKUP_TABLE, classify_pcap_lookup_table) \
68 _(CLASSIFY_PCAP_SET_TABLE, classify_pcap_set_table) \
69 _(CLASSIFY_PCAP_GET_TABLES, classify_pcap_get_tables) \
70 _(CLASSIFY_TRACE_LOOKUP_TABLE, classify_trace_lookup_table) \
71 _(CLASSIFY_TRACE_SET_TABLE, classify_trace_set_table) \
72 _(CLASSIFY_TRACE_GET_TABLES, classify_trace_get_tables) \
73 
74 
75 #define foreach_classify_add_del_table_field \
76 _(table_index) \
77 _(nbuckets) \
78 _(memory_size) \
79 _(skip_n_vectors) \
80 _(match_n_vectors) \
81 _(next_table_index) \
82 _(miss_next_index) \
83 _(mask_len)
84 
85 
88 {
92  int rv = 0;
93  u32 table_index = ~0;
94 
96  if (!reg)
97  return;
98 
99  u32 n_skip = ntohl (mp->skip_n_vectors);
100  u32 n_match = ntohl (mp->match_n_vectors);
101  u32 mask_len = ntohl (mp->mask_len);
102  u32 sw_if_index = ntohl (mp->sw_if_index);
103 
104  if (n_skip > 5 || n_match == 0 || n_match > 5 ||
105  mask_len != n_match * sizeof (u32x4) || sw_if_index == ~0 ||
106  sw_if_index >= vec_len (cm->classify_table_index_by_sw_if_index))
107  {
108  rv = VNET_API_ERROR_INVALID_VALUE;
109  goto out;
110  }
111 
112  u32 table_chain;
113  table_chain = classify_get_pcap_chain (cm, sw_if_index);
114 
115  u8 *mask_vec = 0;
116  vec_validate (mask_vec, mask_len - 1);
117  clib_memcpy (mask_vec, mp->mask, mask_len);
118 
119  if (table_chain != ~0)
120  table_index = classify_lookup_chain (table_chain,
121  mask_vec, n_skip, n_match);
122 
123  vec_free (mask_vec);
124 
125 out:
126  rmp = vl_msg_api_alloc (sizeof (*rmp));
127  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_PCAP_LOOKUP_TABLE_REPLY);
128  rmp->context = mp->context;
129  rmp->retval = ntohl (rv);
130  rmp->table_index = htonl (table_index);
131 
132  vl_api_send_msg (reg, (u8 *) rmp);
133 }
134 
137 {
141  int rv = 0;
142 
144  if (!reg)
145  return;
146 
147  u32 table_index = ntohl (mp->table_index);
148  u32 sw_if_index = ntohl (mp->sw_if_index);
149 
150  if (sw_if_index == ~0
151  || sw_if_index >= vec_len (cm->classify_table_index_by_sw_if_index)
152  || (table_index != ~0 && pool_is_free_index (cm->tables, table_index)))
153  {
154  rv = VNET_API_ERROR_INVALID_VALUE;
155  goto out;
156  }
157 
158  /*
159  * Maybe reorder tables such that masks are most-specify to least-specific.
160  */
161  if (table_index != ~0 && mp->sort_masks)
162  table_index = classify_sort_table_chain (cm, table_index);
163 
164  classify_set_pcap_chain (cm, sw_if_index, table_index);
165 
166 out:
167  rmp = vl_msg_api_alloc (sizeof (*rmp));
168  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_PCAP_SET_TABLE_REPLY);
169  rmp->context = mp->context;
170  rmp->retval = ntohl (rv);
171  rmp->table_index = htonl (table_index);
172 
173  vl_api_send_msg (reg, (u8 *) rmp);
174 }
175 
178 {
182  int rv = 0;
183  u32 *tables = 0;
184  u32 count;
185 
187  if (!reg)
188  return;
189 
190  u32 sw_if_index = ntohl (mp->sw_if_index);
191  if (sw_if_index == ~0
192  || sw_if_index >= vec_len (cm->classify_table_index_by_sw_if_index))
193  {
194  rv = VNET_API_ERROR_INVALID_VALUE;
195  goto out;
196  }
197 
198  u32 table_index = classify_get_pcap_chain (cm, sw_if_index);
199  if (table_index == ~0)
200  goto out;
201 
202  /*
203  * Form a vector of all classifier tables in this chain.
204  */
206  u32 i;
207 
208  for (i = table_index; i != ~0; i = t->next_table_index)
209  {
210  vec_add1 (tables, i);
211  t = pool_elt_at_index (cm->tables, i);
212  }
213 
214 out:
215  count = vec_len (tables);
216  rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
217  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_PCAP_GET_TABLES_REPLY);
218  rmp->context = mp->context;
219  rmp->retval = ntohl (rv);
220  rmp->count = htonl (count);
221 
222  for (i = 0; i < count; ++i)
223  {
224  rmp->indices[i] = htonl (tables[i]);
225  }
226 
227  vec_free (tables);
228 
229  vl_api_send_msg (reg, (u8 *) rmp);
230 }
231 
232 
235 {
238  int rv = 0;
239  u32 table_index = ~0;
240 
242  if (!reg)
243  return;
244 
245  u32 n_skip = ntohl (mp->skip_n_vectors);
246  u32 n_match = ntohl (mp->match_n_vectors);
247  u32 mask_len = ntohl (mp->mask_len);
248  if (n_skip > 5
249  || n_match == 0 || n_match > 5 || mask_len != n_match * sizeof (u32x4))
250  {
251  rv = VNET_API_ERROR_INVALID_VALUE;
252  goto out;
253  }
254 
255  u32 table_chain;
256  table_chain = classify_get_trace_chain ();
257 
258  u8 *mask_vec = 0;
259  vec_validate (mask_vec, mask_len - 1);
260  clib_memcpy (mask_vec, mp->mask, mask_len);
261 
262  if (table_chain != ~0)
263  table_index = classify_lookup_chain (table_chain,
264  mask_vec, n_skip, n_match);
265  vec_free (mask_vec);
266 
267 out:
268  rmp = vl_msg_api_alloc (sizeof (*rmp));
269  rmp->_vl_msg_id = ntohs ((VL_API_CLASSIFY_TRACE_LOOKUP_TABLE_REPLY));
270  rmp->context = mp->context;
271  rmp->retval = ntohl (rv);
272  rmp->table_index = htonl (table_index);
273 
274  vl_api_send_msg (reg, (u8 *) rmp);
275 }
276 
279 {
283  int rv = 0;
284 
286  if (!reg)
287  return;
288 
289  u32 table_index = ntohl (mp->table_index);
290  if (table_index != ~0 && pool_is_free_index (cm->tables, table_index))
291  {
292  rv = VNET_API_ERROR_INVALID_VALUE;
293  goto out;
294  }
295 
296  /*
297  * Maybe reorder tables such that masks are most-specific to least-specific.
298  */
299  if (table_index != ~0 && mp->sort_masks)
300  table_index = classify_sort_table_chain (cm, table_index);
301 
302  classify_set_trace_chain (cm, table_index);
303 
304 out:
305  rmp = vl_msg_api_alloc (sizeof (*rmp));
306  rmp->_vl_msg_id = ntohs ((VL_API_CLASSIFY_TRACE_SET_TABLE_REPLY));
307  rmp->context = mp->context;
308  rmp->retval = ntohl (rv);
309  rmp->table_index = htonl (table_index);
310 
311  vl_api_send_msg (reg, (u8 *) rmp);
312 }
313 
316 {
320  int rv = 0;
321  u32 *tables = 0;
322  u32 count;
323 
325  if (!reg)
326  return;
327 
328  u32 table_index = classify_get_trace_chain ();
329  if (table_index == ~0)
330  goto out;
331 
332  /*
333  * Form a vector of all classifier tables in this chain.
334  */
336  u32 i;
337 
338  for (i = table_index; i != ~0; i = t->next_table_index)
339  {
340  vec_add1 (tables, i);
341  t = pool_elt_at_index (cm->tables, i);
342  }
343 
344 out:
345  count = vec_len (tables);
346  rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
347  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TRACE_GET_TABLES_REPLY);
348  rmp->context = mp->context;
349  rmp->retval = ntohl (rv);
350  rmp->count = htonl (count);
351 
352  for (i = 0; i < count; ++i)
353  {
354  rmp->indices[i] = htonl (tables[i]);
355  }
356 
357  vec_free (tables);
358 
359  vl_api_send_msg (reg, (u8 *) rmp);
360 }
361 
362 
365 {
369  int rv;
370 
371 #define _(a) u32 a;
373 #undef _
374 
375 #define _(a) a = ntohl(mp->a);
377 #undef _
378 
379  if (mask_len != match_n_vectors * sizeof (u32x4))
380  {
381  rv = VNET_API_ERROR_INVALID_VALUE;
382  goto out;
383  }
384 
385  /* The underlying API fails silently, on purpose, so check here */
386  if (mp->is_add == 0) /* delete */
387  {
388  if (pool_is_free_index (cm->tables, table_index))
389  {
390  rv = VNET_API_ERROR_NO_SUCH_TABLE;
391  goto out;
392  }
393  }
394  else /* add or update */
395  {
396  if (table_index != ~0 && pool_is_free_index (cm->tables, table_index))
397  table_index = ~0;
398  }
399 
400  u8 current_data_flag = mp->current_data_flag;
401  i16 current_data_offset = clib_net_to_host_i16 (mp->current_data_offset);
402 
404  (cm, mp->mask, nbuckets, memory_size,
405  skip_n_vectors, match_n_vectors,
406  next_table_index, miss_next_index, &table_index,
407  current_data_flag, current_data_offset, mp->is_add, mp->del_chain);
408 
409 out:
410  /* *INDENT-OFF* */
411  REPLY_MACRO2(VL_API_CLASSIFY_ADD_DEL_TABLE_REPLY,
412  ({
413  if (rv == 0 && mp->is_add)
414  {
415  t = pool_elt_at_index (cm->tables, table_index);
416  rmp->skip_n_vectors = htonl(t->skip_n_vectors);
417  rmp->match_n_vectors = htonl(t->match_n_vectors);
418  rmp->new_table_index = htonl(table_index);
419  }
420  else
421  {
422  rmp->skip_n_vectors = ~0;
423  rmp->match_n_vectors = ~0;
424  rmp->new_table_index = ~0;
425  }
426  }));
427  /* *INDENT-ON* */
428 }
429 
432 {
434  vl_api_classify_add_del_session_reply_t *rmp;
435  int rv;
436  u32 table_index, hit_next_index, opaque_index, metadata, match_len;
437  i32 advance;
438  u8 action;
440 
441  table_index = ntohl (mp->table_index);
442  hit_next_index = ntohl (mp->hit_next_index);
443  opaque_index = ntohl (mp->opaque_index);
444  advance = ntohl (mp->advance);
445  action = mp->action;
446  metadata = ntohl (mp->metadata);
447  match_len = ntohl (mp->match_len);
448 
449  if (pool_is_free_index (cm->tables, table_index))
450  {
451  rv = VNET_API_ERROR_NO_SUCH_TABLE;
452  goto out;
453  }
454 
455  t = pool_elt_at_index (cm->tables, table_index);
456 
457  if (match_len != (t->skip_n_vectors + t->match_n_vectors) * sizeof (u32x4))
458  {
459  rv = VNET_API_ERROR_INVALID_VALUE;
460  goto out;
461  }
462 
464  (cm, table_index, mp->match, hit_next_index, opaque_index,
465  advance, action, metadata, mp->is_add);
466 
467 out:
468  REPLY_MACRO (VL_API_CLASSIFY_ADD_DEL_SESSION_REPLY);
469 }
470 
471 static void
474 {
476  vl_api_policer_classify_set_interface_reply_t *rmp;
477  int rv;
478  u32 sw_if_index, ip4_table_index, ip6_table_index, l2_table_index;
479 
480  ip4_table_index = ntohl (mp->ip4_table_index);
481  ip6_table_index = ntohl (mp->ip6_table_index);
482  l2_table_index = ntohl (mp->l2_table_index);
483  sw_if_index = ntohl (mp->sw_if_index);
484 
486 
487  rv = vnet_set_policer_classify_intfc (vm, sw_if_index, ip4_table_index,
488  ip6_table_index, l2_table_index,
489  mp->is_add);
490 
492 
493  REPLY_MACRO (VL_API_POLICER_CLASSIFY_SET_INTERFACE_REPLY);
494 }
495 
496 static void
498  u32 table_index, vl_api_registration_t * reg,
499  u32 context)
500 {
502 
503  mp = vl_msg_api_alloc (sizeof (*mp));
504  clib_memset (mp, 0, sizeof (*mp));
505  mp->_vl_msg_id = ntohs (VL_API_POLICER_CLASSIFY_DETAILS);
506  mp->context = context;
507  mp->sw_if_index = htonl (sw_if_index);
508  mp->table_index = htonl (table_index);
509 
510  vl_api_send_msg (reg, (u8 *) mp);
511 }
512 
513 static void
515 {
518  u32 *vec_tbl;
519  int i;
520  u32 filter_sw_if_index;
521 
523  if (!reg)
524  return;
525 
526  filter_sw_if_index = ntohl (mp->sw_if_index);
527  if (filter_sw_if_index
529  return;
530 
531  if (filter_sw_if_index != ~0)
532  vec_tbl =
533  &pcm->classify_table_index_by_sw_if_index[mp->type][filter_sw_if_index];
534  else
535  vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type];
536 
537  if (vec_len (vec_tbl))
538  {
539  for (i = 0; i < vec_len (vec_tbl); i++)
540  {
541  if (vec_elt (vec_tbl, i) == ~0)
542  continue;
543 
544  send_policer_classify_details (i, vec_elt (vec_tbl, i), reg,
545  mp->context);
546  }
547  }
548 }
549 
550 static void
552 {
554 
556  if (!reg)
557  return;
558 
561  u32 *table_ids = 0;
562  u32 count;
563 
564  /* *INDENT-OFF* */
565  pool_foreach (t, cm->tables)
566  {
567  vec_add1 (table_ids, ntohl(t - cm->tables));
568  }
569  /* *INDENT-ON* */
570  count = vec_len (table_ids);
571 
573  rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
574  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_IDS_REPLY);
575  rmp->context = mp->context;
576  rmp->count = ntohl (count);
577  clib_memcpy (rmp->ids, table_ids, count * sizeof (u32));
578  rmp->retval = 0;
579 
580  vl_api_send_msg (reg, (u8 *) rmp);
581 
582  vec_free (table_ids);
583 }
584 
585 static void
588 {
590  int rv = 0;
591 
592  u32 sw_if_index = ntohl (mp->sw_if_index);
593  u32 *acl = 0;
594 
596  vec_set (acl, ~0);
597 
599 
601 
602  int if_idx;
603  u32 type;
604 
605  for (type = 0; type < IN_OUT_ACL_N_TABLES; type++)
606  {
607  u32 *vec_tbl =
608  am->classify_table_index_by_sw_if_index[IN_OUT_ACL_INPUT_TABLE_GROUP]
609  [type];
610  if (vec_len (vec_tbl))
611  {
612  for (if_idx = 0; if_idx < vec_len (vec_tbl); if_idx++)
613  {
614  if (vec_elt (vec_tbl, if_idx) == ~0 || sw_if_index != if_idx)
615  {
616  continue;
617  }
618  acl[type] = vec_elt (vec_tbl, if_idx);
619  }
620  }
621  }
622 
624 
625  /* *INDENT-OFF* */
626  REPLY_MACRO2(VL_API_CLASSIFY_TABLE_BY_INTERFACE_REPLY,
627  ({
628  rmp->sw_if_index = ntohl(sw_if_index);
629  rmp->l2_table_id = ntohl(acl[IN_OUT_ACL_TABLE_L2]);
630  rmp->ip4_table_id = ntohl(acl[IN_OUT_ACL_TABLE_IP4]);
631  rmp->ip6_table_id = ntohl(acl[IN_OUT_ACL_TABLE_IP6]);
632  }));
633  /* *INDENT-ON* */
634  vec_free (acl);
635 }
636 
637 static void
639 {
641 
643  if (!reg)
644  return;
645 
647 
649  u32 table_id = ntohl (mp->table_id);
651 
652  /* *INDENT-OFF* */
653  pool_foreach (t, cm->tables)
654  {
655  if (table_id == t - cm->tables)
656  {
658  (sizeof (*rmp) + t->match_n_vectors * sizeof (u32x4));
659  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_INFO_REPLY);
660  rmp->context = mp->context;
661  rmp->table_id = ntohl(table_id);
662  rmp->nbuckets = ntohl(t->nbuckets);
663  rmp->match_n_vectors = ntohl(t->match_n_vectors);
664  rmp->skip_n_vectors = ntohl(t->skip_n_vectors);
665  rmp->active_sessions = ntohl(t->active_elements);
666  rmp->next_table_index = ntohl(t->next_table_index);
667  rmp->miss_next_index = ntohl(t->miss_next_index);
668  rmp->mask_length = ntohl(t->match_n_vectors * sizeof (u32x4));
669  clib_memcpy(rmp->mask, t->mask, t->match_n_vectors * sizeof(u32x4));
670  rmp->retval = 0;
671  break;
672  }
673  }
674  /* *INDENT-ON* */
675 
676  if (rmp == 0)
677  {
678  rmp = vl_msg_api_alloc (sizeof (*rmp));
679  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_INFO_REPLY);
680  rmp->context = mp->context;
681  rmp->retval = ntohl (VNET_API_ERROR_CLASSIFY_TABLE_NOT_FOUND);
682  }
683 
684  vl_api_send_msg (reg, (u8 *) rmp);
685 }
686 
687 static void
689  u32 table_id,
690  u32 match_length,
692 {
694 
695  rmp = vl_msg_api_alloc (sizeof (*rmp));
696  clib_memset (rmp, 0, sizeof (*rmp));
697  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_SESSION_DETAILS);
698  rmp->context = context;
699  rmp->table_id = ntohl (table_id);
700  rmp->hit_next_index = ntohl (e->next_index);
701  rmp->advance = ntohl (e->advance);
702  rmp->opaque_index = ntohl (e->opaque_index);
703  rmp->match_length = ntohl (match_length);
704  clib_memcpy (rmp->match, e->key, match_length);
705 
706  vl_api_send_msg (reg, (u8 *) rmp);
707 }
708 
709 static void
711 {
714 
715  u32 table_id = ntohl (mp->table_id);
717 
719  if (!reg)
720  return;
721 
722  /* *INDENT-OFF* */
723  pool_foreach (t, cm->tables)
724  {
725  if (table_id == t - cm->tables)
726  {
728  vnet_classify_entry_t * v, * save_v;
729  int i, j, k;
730 
731  for (i = 0; i < t->nbuckets; i++)
732  {
733  b = &t->buckets [i];
734  if (b->offset == 0)
735  continue;
736 
737  save_v = vnet_classify_get_entry (t, b->offset);
738  for (j = 0; j < (1<<b->log2_pages); j++)
739  {
740  for (k = 0; k < t->entries_per_page; k++)
741  {
743  (t, save_v, j*t->entries_per_page + k);
745  continue;
746 
748  (reg, table_id, t->match_n_vectors * sizeof (u32x4),
749  v, mp->context);
750  }
751  }
752  }
753  break;
754  }
755  }
756  /* *INDENT-ON* */
757 }
758 
759 static void
762 {
764  vl_api_flow_classify_set_interface_reply_t *rmp;
765  int rv;
766  u32 sw_if_index, ip4_table_index, ip6_table_index;
767 
768  ip4_table_index = ntohl (mp->ip4_table_index);
769  ip6_table_index = ntohl (mp->ip6_table_index);
770  sw_if_index = ntohl (mp->sw_if_index);
771 
773 
774  rv = vnet_set_flow_classify_intfc (vm, sw_if_index, ip4_table_index,
775  ip6_table_index, mp->is_add);
776 
778 
779  REPLY_MACRO (VL_API_FLOW_CLASSIFY_SET_INTERFACE_REPLY);
780 }
781 
782 static void
784  u32 table_index, vl_api_registration_t * reg,
785  u32 context)
786 {
788 
789  mp = vl_msg_api_alloc (sizeof (*mp));
790  clib_memset (mp, 0, sizeof (*mp));
791  mp->_vl_msg_id = ntohs (VL_API_FLOW_CLASSIFY_DETAILS);
792  mp->context = context;
793  mp->sw_if_index = htonl (sw_if_index);
794  mp->table_index = htonl (table_index);
795 
796  vl_api_send_msg (reg, (u8 *) mp);
797 }
798 
799 static void
801 {
804  u32 *vec_tbl;
805  int i;
806  u32 filter_sw_if_index;
807 
809  if (!reg)
810  return;
811 
812  filter_sw_if_index = ntohl (mp->sw_if_index);
813  if (filter_sw_if_index
815  return;
816 
817  if (filter_sw_if_index != ~0)
818  vec_tbl =
819  &pcm->classify_table_index_by_sw_if_index[mp->type][filter_sw_if_index];
820  else
821  vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type];
822 
823  if (vec_len (vec_tbl))
824  {
825  for (i = 0; i < vec_len (vec_tbl); i++)
826  {
827  if (vec_elt (vec_tbl, i) == ~0)
828  continue;
829 
830  send_flow_classify_details (i, vec_elt (vec_tbl, i), reg,
831  mp->context);
832  }
833  }
834 }
835 
838 {
840  vl_api_classify_set_interface_ip_table_reply_t *rmp;
841  int rv;
842 
844 
845  u32 table_index = ntohl (mp->table_index);
846  u32 sw_if_index = ntohl (mp->sw_if_index);
847 
848  if (mp->is_ipv6)
849  rv = vnet_set_ip6_classify_intfc (vm, sw_if_index, table_index);
850  else
851  rv = vnet_set_ip4_classify_intfc (vm, sw_if_index, table_index);
852 
854 
855  REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_IP_TABLE_REPLY);
856 }
857 
860 {
861  vl_api_classify_set_interface_l2_tables_reply_t *rmp;
862  int rv;
863  u32 sw_if_index, ip4_table_index, ip6_table_index, other_table_index;
864  int enable;
865 
866  ip4_table_index = ntohl (mp->ip4_table_index);
867  ip6_table_index = ntohl (mp->ip6_table_index);
868  other_table_index = ntohl (mp->other_table_index);
869  sw_if_index = ntohl (mp->sw_if_index);
870 
872 
873  if (mp->is_input)
875  ip6_table_index,
876  other_table_index);
877  else
879  ip6_table_index,
880  other_table_index);
881 
882  if (rv == 0)
883  {
884  if (ip4_table_index != ~0 || ip6_table_index != ~0
885  || other_table_index != ~0)
886  enable = 1;
887  else
888  enable = 0;
889 
890  if (mp->is_input)
892  else
894  }
895 
897 
898  REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_L2_TABLES_REPLY);
899 }
900 
903 {
905  vl_api_input_acl_set_interface_reply_t *rmp;
906  int rv;
907 
909 
910  u32 ip4_table_index = ntohl (mp->ip4_table_index);
911  u32 ip6_table_index = ntohl (mp->ip6_table_index);
912  u32 l2_table_index = ntohl (mp->l2_table_index);
913  u32 sw_if_index = ntohl (mp->sw_if_index);
914 
915  rv = vnet_set_input_acl_intfc (vm, sw_if_index, ip4_table_index,
916  ip6_table_index, l2_table_index, mp->is_add);
917 
919 
920  REPLY_MACRO (VL_API_INPUT_ACL_SET_INTERFACE_REPLY);
921 }
922 
925 {
927  vl_api_output_acl_set_interface_reply_t *rmp;
928  int rv;
929 
931 
932  u32 ip4_table_index = ntohl (mp->ip4_table_index);
933  u32 ip6_table_index = ntohl (mp->ip6_table_index);
934  u32 l2_table_index = ntohl (mp->l2_table_index);
935  u32 sw_if_index = ntohl (mp->sw_if_index);
936 
937  rv = vnet_set_output_acl_intfc (vm, sw_if_index, ip4_table_index,
938  ip6_table_index, l2_table_index,
939  mp->is_add);
940 
942 
943  REPLY_MACRO (VL_API_OUTPUT_ACL_SET_INTERFACE_REPLY);
944 }
945 
946 /*
947  * classify_api_hookup
948  * Add vpe's API message handlers to the table.
949  * vlib has already mapped shared memory and
950  * added the client registration handlers.
951  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
952  */
953 #define vl_msg_name_crc_list
954 #include <vnet/vnet_all_api_h.h>
955 #undef vl_msg_name_crc_list
956 
957 static void
959 {
960 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
961  foreach_vl_msg_name_crc_classify;
962 #undef _
963 }
964 
965 static clib_error_t *
967 {
969 
970 #define _(N,n) \
971  vl_msg_api_set_handlers(VL_API_##N, #n, \
972  vl_api_##n##_t_handler, \
973  vl_noop_handler, \
974  vl_api_##n##_t_endian, \
975  vl_api_##n##_t_print, \
976  sizeof(vl_api_##n##_t), 1);
978 #undef _
979 
980  /*
981  * Set up the (msg_name, crc, message-id) table
982  */
984 
985  return 0;
986 }
987 
989 
990 /*
991  * fd.io coding-style-patch-verification: ON
992  *
993  * Local Variables:
994  * eval: (c-set-style "gnu")
995  * End:
996  */
vl_api_classify_table_ids_reply_t::count
u32 count
Definition: classify.api:209
vl_api_classify_table_by_interface_t_handler
static void vl_api_classify_table_by_interface_t_handler(vl_api_classify_table_by_interface_t *mp)
Definition: classify_api.c:587
vl_api_input_acl_set_interface_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:417
vl_api_classify_trace_get_tables_t
Classify get the Trace table indices.
Definition: classify.api:594
vl_api_classify_trace_lookup_table_reply_t::context
u32 context
Definition: classify.api:559
vl_api_classify_pcap_set_table_t
Add a Classify table into a PCAP chain on an interface.
Definition: classify.api:486
classify_get_pcap_chain
u32 classify_get_pcap_chain(vnet_classify_main_t *cm, u32 sw_if_index)
Definition: vnet_classify.c:1749
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
vl_api_classify_trace_get_tables_reply_t::context
u32 context
Definition: classify.api:608
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
vl_api_classify_trace_lookup_table_t::skip_n_vectors
u32 skip_n_vectors[default=0]
Definition: classify.api:546
api.h
vl_api_classify_table_by_interface_t
Classify table ids by interface index request.
Definition: classify.api:218
vl_api_policer_classify_details_t::table_index
u32 table_index
Definition: classify.api:187
vl_api_classify_session_details_t::match
u8 match[match_length]
Definition: classify.api:312
vl_api_classify_pcap_get_tables_t_handler
static void vl_api_classify_pcap_get_tables_t_handler(vl_api_classify_pcap_get_tables_t *mp)
Definition: classify_api.c:177
vnet_classify_entry_t
struct _vnet_classify_entry vnet_classify_entry_t
vl_api_classify_trace_get_tables_reply_t::indices
u32 indices[count]
Definition: classify.api:611
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
vl_api_classify_trace_get_tables_t::client_index
u32 client_index
Definition: classify.api:596
vnet_classify_add_del_session
int vnet_classify_add_del_session(vnet_classify_main_t *cm, u32 table_index, const u8 *match, u32 hit_next_index, u32 opaque_index, i32 advance, u8 action, u16 metadata, int is_add)
Definition: vnet_classify.c:2745
vl_api_classify_set_interface_l2_tables_t::is_input
bool is_input
Definition: classify.api:398
vl_api_classify_table_info_t::table_id
u32 table_id
Definition: classify.api:252
vl_api_policer_classify_dump_t::context
u32 context
Definition: classify.api:173
vl_api_classify_session_details_t::opaque_index
u32 opaque_index
Definition: classify.api:310
vl_api_classify_table_ids_t
Classify get table IDs request.
Definition: classify.api:194
vnet_classify_entry_is_free
static int vnet_classify_entry_is_free(vnet_classify_entry_t *e)
Definition: vnet_classify.h:111
vl_api_classify_add_del_table_t::current_data_offset
i16 current_data_offset[default=0]
Definition: classify.api:59
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
vl_api_policer_classify_set_interface_t
Set/unset policer classify interface.
Definition: classify.api:145
vnet_set_input_acl_intfc
int vnet_set_input_acl_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 l2_table_index, u32 is_add)
Definition: in_out_acl.c:129
vnet_classify_table_t::miss_next_index
u32 miss_next_index
Definition: vnet_classify.h:176
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
vl_api_flow_classify_details_t::context
u32 context
Definition: classify.api:360
vnet_l2_output_classify_enable_disable
void vnet_l2_output_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
Definition: l2_output_classify.c:506
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_policer_classify_details_t::context
u32 context
Definition: classify.api:185
vnet_classify_table_t::mask
u32x4 * mask
Definition: vnet_classify.h:151
vl_api_classify_pcap_get_tables_t::client_index
u32 client_index
Definition: classify.api:513
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
vl_api_classify_session_details_t::match_length
u32 match_length
Definition: classify.api:311
vl_api_classify_set_interface_l2_tables_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:393
classify_lookup_chain
u32 classify_lookup_chain(u32 table_index, u8 *mask, u32 n_skip, u32 n_match)
Definition: vnet_classify.c:1800
vl_api_classify_set_interface_ip_table_t::is_ipv6
bool is_ipv6
Definition: classify.api:376
vl_api_input_acl_set_interface_t::is_add
bool is_add
Definition: classify.api:420
vl_api_classify_table_info_reply_t::context
u32 context
Definition: classify.api:269
vl_api_classify_session_details_t::advance
i32 advance
Definition: classify.api:309
vl_api_classify_table_ids_reply_t
Reply for classify get table IDs request.
Definition: classify.api:205
vl_api_classify_add_del_session_t::match
u8 match[match_len]
Definition: classify.api:131
vnet_classify_main
vnet_classify_main_t vnet_classify_main
Definition: vnet_classify.c:32
vl_api_classify_trace_get_tables_t_handler
static void vl_api_classify_trace_get_tables_t_handler(vl_api_classify_trace_get_tables_t *mp)
Definition: classify_api.c:315
vl_api_flow_classify_set_interface_t::is_add
bool is_add
Definition: classify.api:332
vl_api_classify_pcap_get_tables_reply_t::indices
u32 indices[count]
Definition: classify.api:529
vl_api_classify_add_del_table_t
Add/Delete classification table request.
Definition: classify.api:45
vnet_classify_entry_at_index
static vnet_classify_entry_t * vnet_classify_entry_at_index(vnet_classify_table_t *t, vnet_classify_entry_t *e, u32 index)
Definition: vnet_classify.h:357
IN_OUT_ACL_TABLE_IP4
@ IN_OUT_ACL_TABLE_IP4
Definition: in_out_acl.h:31
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: classify_api.c:958
vl_api_classify_table_info_t::client_index
u32 client_index
Definition: classify.api:250
vnet_classify_get_entry
static vnet_classify_entry_t * vnet_classify_get_entry(vnet_classify_table_t *t, uword offset)
Definition: vnet_classify.h:335
foreach_vpe_api_msg
#define foreach_vpe_api_msg
Definition: classify_api.c:52
vl_api_input_acl_set_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:416
vl_api_classify_add_del_session_t
Classify add / del session request.
Definition: classify.api:119
am
app_main_t * am
Definition: application.c:489
vl_api_input_acl_set_interface_t
Set/unset input ACL interface.
Definition: classify.api:412
flow_classify_main_t::classify_table_index_by_sw_if_index
u32 * classify_table_index_by_sw_if_index[FLOW_CLASSIFY_N_TABLES]
Definition: flow_classify.h:39
vl_api_classify_trace_get_tables_reply_t::retval
i32 retval
Definition: classify.api:609
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vl_api_classify_pcap_lookup_table_t::match_n_vectors
u32 match_n_vectors[default=1]
Definition: classify.api:462
vl_api_output_acl_set_interface_t_handler
static void vl_api_output_acl_set_interface_t_handler(vl_api_output_acl_set_interface_t *mp)
Definition: classify_api.c:924
vnet_classify_table_t::entries_per_page
u32 entries_per_page
Definition: vnet_classify.h:165
vl_api_classify_pcap_set_table_t::client_index
u32 client_index
Definition: classify.api:488
vl_api_classify_table_by_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:222
vl_api_flow_classify_details_t
Flow classify operational state response.
Definition: classify.api:359
vl_api_classify_table_info_reply_t::mask_length
u32 mask_length
Definition: classify.api:278
vl_api_classify_trace_lookup_table_t
Find a mask-compatible Classify table in the Trace chain.
Definition: classify.api:542
vl_api_classify_pcap_set_table_reply_t::retval
i32 retval
Definition: classify.api:503
vl_api_classify_trace_lookup_table_t_handler
static void vl_api_classify_trace_lookup_table_t_handler(vl_api_classify_trace_lookup_table_t *mp)
Definition: classify_api.c:234
vl_api_policer_classify_dump_t
Get list of policer classify interfaces and tables.
Definition: classify.api:170
vl_api_policer_classify_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:175
vl_api_classify_session_dump_t::client_index
u32 client_index
Definition: classify.api:289
memory_size
u64 memory_size
Definition: vhost_user.h:124
vl_api_flow_classify_set_interface_t
Set/unset flow classify interface.
Definition: classify.api:326
vl_api_classify_pcap_get_tables_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:515
IN_OUT_ACL_INPUT_TABLE_GROUP
@ IN_OUT_ACL_INPUT_TABLE_GROUP
Definition: in_out_acl.h:39
vl_msg_api_alloc_as_if_client
void * vl_msg_api_alloc_as_if_client(int nbytes)
Definition: memory_shared.c:236
vl_api_input_acl_set_interface_t::l2_table_index
u32 l2_table_index
Definition: classify.api:419
vl_api_policer_classify_set_interface_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:150
vl_api_classify_trace_get_tables_reply_t::count
u32 count
Definition: classify.api:610
send_policer_classify_details
static void send_policer_classify_details(u32 sw_if_index, u32 table_index, vl_api_registration_t *reg, u32 context)
Definition: classify_api.c:497
i32
signed int i32
Definition: types.h:77
vl_api_classify_pcap_lookup_table_reply_t::table_index
u32 table_index
Definition: classify.api:476
vl_api_classify_pcap_lookup_table_t::sw_if_index
vl_api_interface_index_t sw_if_index[default=0xffffffff]
Definition: classify.api:460
vl_api_classify_trace_set_table_t::sort_masks
bool sort_masks[default=0]
Definition: classify.api:575
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
vec_elt
#define vec_elt(v, i)
Get vector value at index i.
Definition: vec_bootstrap.h:210
vl_api_classify_table_info_reply_t::retval
i32 retval
Definition: classify.api:270
classify_api_hookup
static clib_error_t * classify_api_hookup(vlib_main_t *vm)
Definition: classify_api.c:966
i16
signed short i16
Definition: types.h:46
vl_api_classify_set_interface_l2_tables_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:396
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
vnet_classify_add_del_table
int vnet_classify_add_del_table(vnet_classify_main_t *cm, const u8 *mask, u32 nbuckets, u32 memory_size, u32 skip, u32 match, u32 next_table_index, u32 miss_next_index, u32 *table_index, u8 current_data_flag, i16 current_data_offset, int is_add, int del_chain)
Definition: vnet_classify.c:747
vl_api_classify_table_info_t
Classify table info.
Definition: classify.api:248
vl_api_classify_add_del_session_t::opaque_index
u32 opaque_index[default=0xffffffff]
Definition: classify.api:126
flow_classify.h
vl_api_classify_add_del_table_t::current_data_flag
u8 current_data_flag[default=0]
Definition: classify.api:58
vl_api_classify_table_by_interface_reply_t::ip6_table_id
u32 ip6_table_id
Definition: classify.api:240
count
u8 count
Definition: dhcp.api:208
send_flow_classify_details
static void send_flow_classify_details(u32 sw_if_index, u32 table_index, vl_api_registration_t *reg, u32 context)
Definition: classify_api.c:783
policer_classify_main_t::classify_table_index_by_sw_if_index
u32 * classify_table_index_by_sw_if_index[POLICER_CLASSIFY_N_TABLES]
Definition: policer_classify.h:40
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vl_api_classify_table_info_reply_t::table_id
u32 table_id
Definition: classify.api:271
vl_api_classify_add_del_session_t::metadata
u32 metadata[default=0]
Definition: classify.api:129
vl_api_classify_trace_set_table_t_handler
static void vl_api_classify_trace_set_table_t_handler(vl_api_classify_trace_set_table_t *mp)
Definition: classify_api.c:278
vnet_classify_table_t::skip_n_vectors
u32 skip_n_vectors
Definition: vnet_classify.h:166
vl_api_classify_pcap_get_tables_reply_t::context
u32 context
Definition: classify.api:526
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
foreach_classify_add_del_table_field
#define foreach_classify_add_del_table_field
Definition: classify_api.c:75
vl_api_policer_classify_set_interface_t::is_add
bool is_add
Definition: classify.api:153
vl_api_input_acl_set_interface_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:418
vl_api_classify_session_details_t::context
u32 context
Definition: classify.api:305
vl_api_classify_session_dump_t::table_id
u32 table_id
Definition: classify.api:291
vnet_msg_enum.h
vl_api_input_acl_set_interface_t_handler
static void vl_api_input_acl_set_interface_t_handler(vl_api_input_acl_set_interface_t *mp)
Definition: classify_api.c:902
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
classify_set_pcap_chain
void classify_set_pcap_chain(vnet_classify_main_t *cm, u32 sw_if_index, u32 table_index)
Definition: vnet_classify.c:1761
vl_api_flow_classify_dump_t
Get list of flow classify interfaces and tables.
Definition: classify.api:347
vl_api_classify_pcap_set_table_reply_t::context
u32 context
Definition: classify.api:502
vl_api_classify_trace_lookup_table_reply_t::table_index
u32 table_index
Definition: classify.api:561
vl_api_classify_add_del_session_t::advance
i32 advance[default=0]
Definition: classify.api:127
vl_api_classify_pcap_get_tables_reply_t::retval
i32 retval
Definition: classify.api:527
vl_api_classify_add_del_session_t::action
vl_api_classify_action_t action[default=0]
Definition: classify.api:128
vl_api_classify_pcap_get_tables_reply_t::count
u32 count
Definition: classify.api:528
vl_api_classify_table_info_reply_t::active_sessions
u32 active_sessions
Definition: classify.api:275
vl_api_classify_trace_set_table_reply_t::table_index
u32 table_index
Definition: classify.api:587
vnet_set_policer_classify_intfc
int vnet_set_policer_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 l2_table_index, u32 is_add)
Definition: policer_classify.c:57
vl_api_classify_table_info_reply_t::match_n_vectors
u32 match_n_vectors
Definition: classify.api:273
vl_api_classify_session_dump_t::context
u32 context
Definition: classify.api:290
vl_api_classify_trace_set_table_t::table_index
u32 table_index[default=0xffffffff]
Definition: classify.api:574
vl_api_classify_table_info_reply_t::nbuckets
u32 nbuckets
Definition: classify.api:272
vl_api_flow_classify_set_interface_t_handler
static void vl_api_flow_classify_set_interface_t_handler(vl_api_flow_classify_set_interface_t *mp)
Definition: classify_api.c:761
vl_api_classify_add_del_table_t::mask
u8 mask[mask_len]
Definition: classify.api:61
vl_api_classify_pcap_set_table_reply_t
Classify pcap table lookup response.
Definition: classify.api:500
vl_api_classify_session_dump_t
Classify sessions dump request.
Definition: classify.api:287
vl_api_classify_set_interface_l2_tables_t::other_table_index
u32 other_table_index
Definition: classify.api:397
vlibapi_get_main
static api_main_t * vlibapi_get_main(void)
Definition: api_common.h:390
vnet_classify_table_t::buckets
vnet_classify_bucket_t * buckets
Definition: vnet_classify.h:154
vl_api_classify_pcap_set_table_t_handler
static void vl_api_classify_pcap_set_table_t_handler(vl_api_classify_pcap_set_table_t *mp)
Definition: classify_api.c:136
interface.h
vl_api_policer_classify_details_t
Policer classify operational state response.
Definition: classify.api:183
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
vl_api_classify_trace_lookup_table_t::match_n_vectors
u32 match_n_vectors[default=1]
Definition: classify.api:547
vl_api_classify_table_ids_reply_t::ids
u32 ids[count]
Definition: classify.api:210
cm
vnet_feature_config_main_t * cm
Definition: nat44_ei_hairpinning.c:591
vl_api_flow_classify_set_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:329
vl_api_classify_table_info_reply_t::mask
u8 mask[mask_length]
Definition: classify.api:279
vl_api_classify_set_interface_ip_table_t_handler
static void vl_api_classify_set_interface_ip_table_t_handler(vl_api_classify_set_interface_ip_table_t *mp)
Definition: classify_api.c:837
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
vl_api_flow_classify_set_interface_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:331
IN_OUT_ACL_N_TABLES
@ IN_OUT_ACL_N_TABLES
Definition: in_out_acl.h:34
vl_api_classify_set_interface_l2_tables_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:395
vl_api_classify_session_details_t::hit_next_index
u32 hit_next_index
Definition: classify.api:308
vl_api_classify_table_ids_reply_t::context
u32 context
Definition: classify.api:207
vl_api_classify_table_by_interface_reply_t::ip4_table_id
u32 ip4_table_id
Definition: classify.api:239
vnet_classify_table_t
Definition: vnet_classify.h:147
vl_api_classify_table_ids_t::client_index
u32 client_index
Definition: classify.api:196
policer_classify_main
policer_classify_main_t policer_classify_main
Definition: policer_classify.c:18
vl_api_classify_pcap_lookup_table_t::mask
u8 mask[mask_len]
Definition: classify.api:464
vl_api_classify_trace_set_table_reply_t::retval
i32 retval
Definition: classify.api:586
vnet_classify_table_t::nbuckets
u32 nbuckets
Definition: vnet_classify.h:163
vl_api_classify_pcap_lookup_table_t::skip_n_vectors
u32 skip_n_vectors[default=0]
Definition: classify.api:461
vl_api_flow_classify_set_interface_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:330
vl_api_classify_pcap_lookup_table_t::client_index
u32 client_index
Definition: classify.api:458
vl_api_policer_classify_dump_t::type
vl_api_policer_classify_table_t type
Definition: classify.api:174
vl_api_classify_trace_get_tables_reply_t
Classify get the Trace tables response.
Definition: classify.api:606
vl_api_output_acl_set_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:438
vl_api_classify_pcap_lookup_table_t
Find a compatible Classify table in a PCAP chain.
Definition: classify.api:456
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
policer_classify.h
vl_api_classify_set_interface_l2_tables_t_handler
static void vl_api_classify_set_interface_l2_tables_t_handler(vl_api_classify_set_interface_l2_tables_t *mp)
Definition: classify_api.c:859
api_main_t
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:228
flow_classify_main_t
Definition: flow_classify.h:36
vl_api_classify_set_interface_ip_table_t::table_index
u32 table_index
Definition: classify.api:378
vl_api_classify_pcap_lookup_table_t::mask_len
u32 mask_len
Definition: classify.api:463
vl_api_classify_set_interface_l2_tables_t
Set/unset l2 classification tables for an interface request.
Definition: classify.api:389
vl_api_classify_pcap_lookup_table_reply_t::retval
i32 retval
Definition: classify.api:475
vl_api_classify_add_del_table_reply_t
Add/Delete classification table response.
Definition: classify.api:71
vl_api_policer_classify_set_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:149
vl_api_policer_classify_set_interface_t::l2_table_index
u32 l2_table_index
Definition: classify.api:152
vnet_classify_table_t::next_table_index
u32 next_table_index
Definition: vnet_classify.h:170
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
vnet_set_output_acl_intfc
int vnet_set_output_acl_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 l2_table_index, u32 is_add)
Definition: in_out_acl.c:139
vl_api_classify_pcap_lookup_table_reply_t::context
u32 context
Definition: classify.api:474
vl_api_classify_trace_lookup_table_reply_t::retval
i32 retval
Definition: classify.api:560
vl_api_classify_table_by_interface_reply_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:237
vl_api_classify_add_del_session_t::hit_next_index
u32 hit_next_index[default=0xffffffff]
Definition: classify.api:125
vl_api_classify_table_by_interface_reply_t
Reply for classify table id by interface index request.
Definition: classify.api:233
vl_api_classify_table_info_reply_t
Reply for classify table info request.
Definition: classify.api:267
vl_api_classify_pcap_lookup_table_reply_t
Classify pcap table lookup response.
Definition: classify.api:472
vl_api_classify_table_ids_reply_t::retval
i32 retval
Definition: classify.api:208
vl_api_classify_pcap_get_tables_t::context
u32 context
Definition: classify.api:514
vl_api_classify_pcap_set_table_t::context
u32 context
Definition: classify.api:489
vnet_l2_output_classify_set_tables
int vnet_l2_output_classify_set_tables(u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 other_table_index)
Set l2 per-protocol, per-interface output classification tables.
Definition: l2_output_classify.c:525
policer_classify_main_t
Definition: policer_classify.h:37
vl_api_output_acl_set_interface_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:440
vnet_classify_table_t::match_n_vectors
u32 match_n_vectors
Definition: vnet_classify.h:167
u32
unsigned int u32
Definition: types.h:88
vl_api_classify_table_info_reply_t::skip_n_vectors
u32 skip_n_vectors
Definition: classify.api:274
vl_api_classify_trace_lookup_table_t::client_index
u32 client_index
Definition: classify.api:544
vl_api_policer_classify_set_interface_t_handler
static void vl_api_policer_classify_set_interface_t_handler(vl_api_policer_classify_set_interface_t *mp)
Definition: classify_api.c:473
table_id
u32 table_id
Definition: wireguard.api:102
vl_api_classify_table_ids_t_handler
static void vl_api_classify_table_ids_t_handler(vl_api_classify_table_ids_t *mp)
Definition: classify_api.c:551
vl_api_classify_table_ids_t::context
u32 context
Definition: classify.api:197
vnet_set_flow_classify_intfc
int vnet_set_flow_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 is_add)
Definition: flow_classify.c:49
api_helper_macros.h
classify_get_trace_chain
void classify_get_trace_chain(void)
Definition: pnat_test_stubs.h:30
u32x4
unsigned long long u32x4
Definition: ixge.c:28
l2_classify.h
vnet_classify_main_t
struct _vnet_classify_main vnet_classify_main_t
Definition: vnet_classify.h:61
vl_api_output_acl_set_interface_t::l2_table_index
u32 l2_table_index
Definition: classify.api:441
vl_api_flow_classify_dump_t_handler
static void vl_api_flow_classify_dump_t_handler(vl_api_flow_classify_dump_t *mp)
Definition: classify_api.c:800
vl_api_classify_trace_lookup_table_t::context
u32 context
Definition: classify.api:545
vl_api_policer_classify_dump_t_handler
static void vl_api_policer_classify_dump_t_handler(vl_api_policer_classify_dump_t *mp)
Definition: classify_api.c:514
vnet_classify.h
ip4.h
vl_api_output_acl_set_interface_t::is_add
bool is_add
Definition: classify.api:442
vl_api_classify_pcap_set_table_t::sort_masks
bool sort_masks[default=0]
Definition: classify.api:492
vl_api_policer_classify_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:186
vl_api_classify_table_info_reply_t::miss_next_index
u32 miss_next_index
Definition: classify.api:277
vl_api_classify_session_dump_t_handler
static void vl_api_classify_session_dump_t_handler(vl_api_classify_session_dump_t *mp)
Definition: classify_api.c:710
vl_api_classify_add_del_table_t::is_add
bool is_add
Definition: classify.api:49
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_policer_classify_set_interface_t::ip6_table_index
u32 ip6_table_index
Definition: classify.api:151
in_out_acl.h
vl_api_flow_classify_dump_t::context
u32 context
Definition: classify.api:349
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
vec_set
#define vec_set(v, val)
Set all vector elements to given value.
Definition: vec.h:1005
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
vl_api_classify_add_del_session_t::table_index
u32 table_index
Definition: classify.api:124
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vl_api_classify_pcap_get_tables_t
Classify get the PCAP table indices for an interface.
Definition: classify.api:511
classify_sort_table_chain
u32 classify_sort_table_chain(vnet_classify_main_t *cm, u32 table_index)
Definition: vnet_classify.c:1680
vl_api_classify_pcap_lookup_table_t::context
u32 context
Definition: classify.api:459
vnet_l2_input_classify_set_tables
int vnet_l2_input_classify_set_tables(u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 other_table_index)
Set l2 per-protocol, per-interface input classification tables.
Definition: l2_input_classify.c:535
vnet_all_api_h.h
vnet_set_ip6_classify_intfc
int vnet_set_ip6_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
Definition: ip6_forward.c:3018
vl_api_policer_classify_dump_t::client_index
u32 client_index
Definition: classify.api:172
classify_set_trace_chain
void classify_set_trace_chain(vnet_classify_main_t *cm, u32 table_index)
Definition: vnet_classify.c:1734
vl_api_classify_table_by_interface_reply_t::l2_table_id
u32 l2_table_id
Definition: classify.api:238
vl_api_classify_add_del_session_t::match_len
u32 match_len
Definition: classify.api:130
vl_api_flow_classify_dump_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:351
context
u32 context
Definition: ip.api:780
vl_api_output_acl_set_interface_t::ip4_table_index
u32 ip4_table_index
Definition: classify.api:439
vl_api_classify_session_details_t::table_id
u32 table_id
Definition: classify.api:307
vl_api_classify_trace_set_table_t::context
u32 context
Definition: classify.api:573
vl_api_classify_pcap_lookup_table_t_handler
static void vl_api_classify_pcap_lookup_table_t_handler(vl_api_classify_pcap_lookup_table_t *mp)
Definition: classify_api.c:87
send_classify_session_details
static void send_classify_session_details(vl_api_registration_t *reg, u32 table_id, u32 match_length, vnet_classify_entry_t *e, u32 context)
Definition: classify_api.c:688
rv
int __clib_unused rv
Definition: application.c:491
vl_api_classify_set_interface_ip_table_t
Set/unset the classification table for an interface request.
Definition: classify.api:372
vl_api_classify_pcap_set_table_reply_t::table_index
u32 table_index
Definition: classify.api:504
vl_api_classify_session_details_t
Reply for classify table session dump request.
Definition: classify.api:303
vl_api_classify_pcap_get_tables_reply_t
Classify get a PCAP tables response.
Definition: classify.api:524
vl_api_classify_trace_lookup_table_t::mask
u8 mask[mask_len]
Definition: classify.api:549
vl_api_classify_trace_lookup_table_t::mask_len
u32 mask_len
Definition: classify.api:548
vl_api_classify_trace_set_table_reply_t
Classify Trace table lookup response.
Definition: classify.api:583
vnet.h
api_errno.h
in_out_acl_main
in_out_acl_main_t in_out_acl_main
Definition: in_out_acl.c:21
vnet_set_ip4_classify_intfc
int vnet_set_ip4_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
Definition: ip4_forward.c:2904
IN_OUT_ACL_TABLE_L2
@ IN_OUT_ACL_TABLE_L2
Definition: in_out_acl.h:33
vl_api_flow_classify_dump_t::type
vl_api_flow_classify_table_t type
Definition: classify.api:350
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(classify_api_hookup)
vl_api_classify_add_del_session_t::is_add
bool is_add
Definition: classify.api:123
action
vl_api_mac_event_action_t action
Definition: l2.api:211
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
vl_api_classify_trace_set_table_reply_t::context
u32 context
Definition: classify.api:585
vl_api_flow_classify_details_t::table_index
u32 table_index
Definition: classify.api:362
vl_api_classify_table_info_t::context
u32 context
Definition: classify.api:251
vl_api_classify_pcap_set_table_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:490
vl_api_classify_pcap_set_table_t::table_index
u32 table_index[default=0xffffffff]
Definition: classify.api:491
ip6.h
vnet_classify_bucket_t
Definition: vnet_classify.h:132
vnet_l2_input_classify_enable_disable
void vnet_l2_input_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
Definition: l2_input_classify.c:517
vl_api_classify_add_del_table_t_handler
static void vl_api_classify_add_del_table_t_handler(vl_api_classify_add_del_table_t *mp)
Definition: classify_api.c:364
vl_api_classify_trace_lookup_table_reply_t
Classify trace table lookup response.
Definition: classify.api:557
vl_api_classify_trace_get_tables_t::context
u32 context
Definition: classify.api:597
flow_classify_main
flow_classify_main_t flow_classify_main
Definition: flow_classify.c:19
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vl_api_classify_trace_set_table_t::client_index
u32 client_index
Definition: classify.api:572
vl_api_output_acl_set_interface_t
Set/unset output ACL interface.
Definition: classify.api:434
vl_api_classify_table_info_t_handler
static void vl_api_classify_table_info_t_handler(vl_api_classify_table_info_t *mp)
Definition: classify_api.c:638
vl_api_classify_add_del_session_t_handler
static void vl_api_classify_add_del_session_t_handler(vl_api_classify_add_del_session_t *mp)
Definition: classify_api.c:431
vl_api_classify_trace_set_table_t
Add a Classify table into the Trace chain.
Definition: classify.api:570
vl_api_classify_table_info_reply_t::next_table_index
u32 next_table_index
Definition: classify.api:276
in_out_acl_main_t
Definition: in_out_acl.h:44
IN_OUT_ACL_TABLE_IP6
@ IN_OUT_ACL_TABLE_IP6
Definition: in_out_acl.h:32
vl_api_classify_add_del_table_t::del_chain
bool del_chain
Definition: classify.api:50
vnet_classify_table_t::active_elements
u32 active_elements
Definition: vnet_classify.h:185
vl_api_classify_set_interface_ip_table_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:377
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
vl_api_flow_classify_dump_t::client_index
u32 client_index
Definition: classify.api:348
vl_api_flow_classify_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: classify.api:361