FD.io VPP  v18.07.1-19-g511ce25
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 
32 #include <vnet/vnet_msg_enum.h>
33 
34 #define vl_typedefs /* define message structures */
35 #include <vnet/vnet_all_api_h.h>
36 #undef vl_typedefs
37 
38 #define vl_endianfun /* define message structures */
39 #include <vnet/vnet_all_api_h.h>
40 #undef vl_endianfun
41 
42 /* instantiate all the print functions we know about */
43 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
44 #define vl_printfun
45 #include <vnet/vnet_all_api_h.h>
46 #undef vl_printfun
47 
49 
50 #define foreach_vpe_api_msg \
51 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \
52 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session) \
53 _(CLASSIFY_TABLE_IDS,classify_table_ids) \
54 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
55 _(CLASSIFY_TABLE_INFO,classify_table_info) \
56 _(CLASSIFY_SESSION_DUMP,classify_session_dump) \
57 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
58 _(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
59 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface) \
60 _(FLOW_CLASSIFY_DUMP, flow_classify_dump) \
61 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
62 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
63 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
64 _(OUTPUT_ACL_SET_INTERFACE, output_acl_set_interface)
65 
66 #define foreach_classify_add_del_table_field \
67 _(table_index) \
68 _(nbuckets) \
69 _(memory_size) \
70 _(skip_n_vectors) \
71 _(match_n_vectors) \
72 _(next_table_index) \
73 _(miss_next_index) \
74 _(current_data_flag) \
75 _(current_data_offset)
76 
79 {
83  int rv;
84 
85 #define _(a) u32 a;
87 #undef _
88 
89 #define _(a) a = ntohl(mp->a);
91 #undef _
92 
93  /* The underlying API fails silently, on purpose, so check here */
94  if (mp->is_add == 0) /* delete */
95  {
96  if (pool_is_free_index (cm->tables, table_index))
97  {
98  rv = VNET_API_ERROR_NO_SUCH_TABLE;
99  goto out;
100  }
101  }
102  else /* add or update */
103  {
104  if (table_index != ~0 && pool_is_free_index (cm->tables, table_index))
105  table_index = ~0;
106  }
107 
109  (cm, mp->mask, nbuckets, memory_size,
110  skip_n_vectors, match_n_vectors,
111  next_table_index, miss_next_index, &table_index,
112  current_data_flag, current_data_offset, mp->is_add, mp->del_chain);
113 
114 out:
115  /* *INDENT-OFF* */
116  REPLY_MACRO2(VL_API_CLASSIFY_ADD_DEL_TABLE_REPLY,
117  ({
118  if (rv == 0 && mp->is_add)
119  {
120  t = pool_elt_at_index (cm->tables, table_index);
121  rmp->skip_n_vectors = ntohl(t->skip_n_vectors);
122  rmp->match_n_vectors = ntohl(t->match_n_vectors);
123  rmp->new_table_index = ntohl(table_index);
124  }
125  else
126  {
127  rmp->skip_n_vectors = ~0;
128  rmp->match_n_vectors = ~0;
129  rmp->new_table_index = ~0;
130  }
131  }));
132  /* *INDENT-ON* */
133 }
134 
137 {
139  vl_api_classify_add_del_session_reply_t *rmp;
140  int rv;
141  u32 table_index, hit_next_index, opaque_index, metadata;
142  i32 advance;
143  u8 action;
144 
145  table_index = ntohl (mp->table_index);
146  hit_next_index = ntohl (mp->hit_next_index);
147  opaque_index = ntohl (mp->opaque_index);
148  advance = ntohl (mp->advance);
149  action = mp->action;
150  metadata = ntohl (mp->metadata);
151 
153  (cm, table_index, mp->match, hit_next_index, opaque_index,
154  advance, action, metadata, mp->is_add);
155 
156  REPLY_MACRO (VL_API_CLASSIFY_ADD_DEL_SESSION_REPLY);
157 }
158 
159 static void
162 {
164  vl_api_policer_classify_set_interface_reply_t *rmp;
165  int rv;
166  u32 sw_if_index, ip4_table_index, ip6_table_index, l2_table_index;
167 
168  ip4_table_index = ntohl (mp->ip4_table_index);
169  ip6_table_index = ntohl (mp->ip6_table_index);
170  l2_table_index = ntohl (mp->l2_table_index);
171  sw_if_index = ntohl (mp->sw_if_index);
172 
174 
175  rv = vnet_set_policer_classify_intfc (vm, sw_if_index, ip4_table_index,
176  ip6_table_index, l2_table_index,
177  mp->is_add);
178 
180 
181  REPLY_MACRO (VL_API_POLICER_CLASSIFY_SET_INTERFACE_REPLY);
182 }
183 
184 static void
186  u32 table_index, vl_api_registration_t * reg,
187  u32 context)
188 {
190 
191  mp = vl_msg_api_alloc (sizeof (*mp));
192  memset (mp, 0, sizeof (*mp));
193  mp->_vl_msg_id = ntohs (VL_API_POLICER_CLASSIFY_DETAILS);
194  mp->context = context;
195  mp->sw_if_index = htonl (sw_if_index);
196  mp->table_index = htonl (table_index);
197 
198  vl_api_send_msg (reg, (u8 *) mp);
199 }
200 
201 static void
203 {
206  u32 *vec_tbl;
207  int i;
208 
210  if (!reg)
211  return;
212 
213  vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type];
214 
215  if (vec_len (vec_tbl))
216  {
217  for (i = 0; i < vec_len (vec_tbl); i++)
218  {
219  if (vec_elt (vec_tbl, i) == ~0)
220  continue;
221 
222  send_policer_classify_details (i, vec_elt (vec_tbl, i), reg,
223  mp->context);
224  }
225  }
226 }
227 
228 static void
230 {
232 
234  if (!reg)
235  return;
236 
239  u32 *table_ids = 0;
240  u32 count;
241 
242  /* *INDENT-OFF* */
243  pool_foreach (t, cm->tables,
244  ({
245  vec_add1 (table_ids, ntohl(t - cm->tables));
246  }));
247  /* *INDENT-ON* */
248  count = vec_len (table_ids);
249 
251  rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
252  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_IDS_REPLY);
253  rmp->context = mp->context;
254  rmp->count = ntohl (count);
255  clib_memcpy (rmp->ids, table_ids, count * sizeof (u32));
256  rmp->retval = 0;
257 
258  vl_api_send_msg (reg, (u8 *) rmp);
259 
260  vec_free (table_ids);
261 }
262 
263 static void
266 {
268  int rv = 0;
269 
270  u32 sw_if_index = ntohl (mp->sw_if_index);
271  u32 *acl = 0;
272 
274  vec_set (acl, ~0);
275 
277 
279 
280  int if_idx;
281  u32 type;
282 
283  for (type = 0; type < IN_OUT_ACL_N_TABLES; type++)
284  {
285  u32 *vec_tbl =
287  [type];
288  if (vec_len (vec_tbl))
289  {
290  for (if_idx = 0; if_idx < vec_len (vec_tbl); if_idx++)
291  {
292  if (vec_elt (vec_tbl, if_idx) == ~0 || sw_if_index != if_idx)
293  {
294  continue;
295  }
296  acl[type] = vec_elt (vec_tbl, if_idx);
297  }
298  }
299  }
300 
302 
303  /* *INDENT-OFF* */
304  REPLY_MACRO2(VL_API_CLASSIFY_TABLE_BY_INTERFACE_REPLY,
305  ({
306  rmp->sw_if_index = ntohl(sw_if_index);
307  rmp->l2_table_id = ntohl(acl[IN_OUT_ACL_TABLE_L2]);
308  rmp->ip4_table_id = ntohl(acl[IN_OUT_ACL_TABLE_IP4]);
309  rmp->ip6_table_id = ntohl(acl[IN_OUT_ACL_TABLE_IP6]);
310  }));
311  /* *INDENT-ON* */
312  vec_free (acl);
313 }
314 
315 static void
317 {
319 
321  if (!reg)
322  return;
323 
325 
327  u32 table_id = ntohl (mp->table_id);
329 
330  /* *INDENT-OFF* */
331  pool_foreach (t, cm->tables,
332  ({
333  if (table_id == t - cm->tables)
334  {
335  rmp = vl_msg_api_alloc_as_if_client
336  (sizeof (*rmp) + t->match_n_vectors * sizeof (u32x4));
337  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_INFO_REPLY);
338  rmp->context = mp->context;
339  rmp->table_id = ntohl(table_id);
340  rmp->nbuckets = ntohl(t->nbuckets);
341  rmp->match_n_vectors = ntohl(t->match_n_vectors);
342  rmp->skip_n_vectors = ntohl(t->skip_n_vectors);
343  rmp->active_sessions = ntohl(t->active_elements);
344  rmp->next_table_index = ntohl(t->next_table_index);
345  rmp->miss_next_index = ntohl(t->miss_next_index);
346  rmp->mask_length = ntohl(t->match_n_vectors * sizeof (u32x4));
347  clib_memcpy(rmp->mask, t->mask, t->match_n_vectors * sizeof(u32x4));
348  rmp->retval = 0;
349  break;
350  }
351  }));
352  /* *INDENT-ON* */
353 
354  if (rmp == 0)
355  {
356  rmp = vl_msg_api_alloc (sizeof (*rmp));
357  rmp->_vl_msg_id = ntohs ((VL_API_CLASSIFY_TABLE_INFO_REPLY));
358  rmp->context = mp->context;
359  rmp->retval = ntohl (VNET_API_ERROR_CLASSIFY_TABLE_NOT_FOUND);
360  }
361 
362  vl_api_send_msg (reg, (u8 *) rmp);
363 }
364 
365 static void
367  u32 table_id,
368  u32 match_length,
369  vnet_classify_entry_t * e, u32 context)
370 {
372 
373  rmp = vl_msg_api_alloc (sizeof (*rmp));
374  memset (rmp, 0, sizeof (*rmp));
375  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_SESSION_DETAILS);
376  rmp->context = context;
377  rmp->table_id = ntohl (table_id);
378  rmp->hit_next_index = ntohl (e->next_index);
379  rmp->advance = ntohl (e->advance);
380  rmp->opaque_index = ntohl (e->opaque_index);
381  rmp->match_length = ntohl (match_length);
382  clib_memcpy (rmp->match, e->key, match_length);
383 
384  vl_api_send_msg (reg, (u8 *) rmp);
385 }
386 
387 static void
389 {
392 
393  u32 table_id = ntohl (mp->table_id);
395 
397  if (!reg)
398  return;
399 
400  /* *INDENT-OFF* */
401  pool_foreach (t, cm->tables,
402  ({
403  if (table_id == t - cm->tables)
404  {
405  vnet_classify_bucket_t * b;
406  vnet_classify_entry_t * v, * save_v;
407  int i, j, k;
408 
409  for (i = 0; i < t->nbuckets; i++)
410  {
411  b = &t->buckets [i];
412  if (b->offset == 0)
413  continue;
414 
415  save_v = vnet_classify_get_entry (t, b->offset);
416  for (j = 0; j < (1<<b->log2_pages); j++)
417  {
418  for (k = 0; k < t->entries_per_page; k++)
419  {
420  v = vnet_classify_entry_at_index
421  (t, save_v, j*t->entries_per_page + k);
422  if (vnet_classify_entry_is_free (v))
423  continue;
424 
425  send_classify_session_details
426  (reg, table_id, t->match_n_vectors * sizeof (u32x4),
427  v, mp->context);
428  }
429  }
430  }
431  break;
432  }
433  }));
434  /* *INDENT-ON* */
435 }
436 
437 static void
440 {
442  vl_api_flow_classify_set_interface_reply_t *rmp;
443  int rv;
444  u32 sw_if_index, ip4_table_index, ip6_table_index;
445 
446  ip4_table_index = ntohl (mp->ip4_table_index);
447  ip6_table_index = ntohl (mp->ip6_table_index);
448  sw_if_index = ntohl (mp->sw_if_index);
449 
451 
452  rv = vnet_set_flow_classify_intfc (vm, sw_if_index, ip4_table_index,
453  ip6_table_index, mp->is_add);
454 
456 
457  REPLY_MACRO (VL_API_FLOW_CLASSIFY_SET_INTERFACE_REPLY);
458 }
459 
460 static void
462  u32 table_index, vl_api_registration_t * reg,
463  u32 context)
464 {
466 
467  mp = vl_msg_api_alloc (sizeof (*mp));
468  memset (mp, 0, sizeof (*mp));
469  mp->_vl_msg_id = ntohs (VL_API_FLOW_CLASSIFY_DETAILS);
470  mp->context = context;
471  mp->sw_if_index = htonl (sw_if_index);
472  mp->table_index = htonl (table_index);
473 
474  vl_api_send_msg (reg, (u8 *) mp);
475 }
476 
477 static void
479 {
482  u32 *vec_tbl;
483  int i;
484 
486  if (!reg)
487  return;
488 
489  vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type];
490 
491  if (vec_len (vec_tbl))
492  {
493  for (i = 0; i < vec_len (vec_tbl); i++)
494  {
495  if (vec_elt (vec_tbl, i) == ~0)
496  continue;
497 
498  send_flow_classify_details (i, vec_elt (vec_tbl, i), reg,
499  mp->context);
500  }
501  }
502 }
503 
506 {
508  vl_api_classify_set_interface_ip_table_reply_t *rmp;
509  int rv;
510 
512 
513  u32 table_index = ntohl (mp->table_index);
514  u32 sw_if_index = ntohl (mp->sw_if_index);
515 
516  if (mp->is_ipv6)
517  rv = vnet_set_ip6_classify_intfc (vm, sw_if_index, table_index);
518  else
519  rv = vnet_set_ip4_classify_intfc (vm, sw_if_index, table_index);
520 
522 
523  REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_IP_TABLE_REPLY);
524 }
525 
528 {
529  vl_api_classify_set_interface_l2_tables_reply_t *rmp;
530  int rv;
531  u32 sw_if_index, ip4_table_index, ip6_table_index, other_table_index;
532  int enable;
533 
534  ip4_table_index = ntohl (mp->ip4_table_index);
535  ip6_table_index = ntohl (mp->ip6_table_index);
536  other_table_index = ntohl (mp->other_table_index);
537  sw_if_index = ntohl (mp->sw_if_index);
538 
540 
541  if (mp->is_input)
542  rv = vnet_l2_input_classify_set_tables (sw_if_index, ip4_table_index,
543  ip6_table_index,
544  other_table_index);
545  else
546  rv = vnet_l2_output_classify_set_tables (sw_if_index, ip4_table_index,
547  ip6_table_index,
548  other_table_index);
549 
550  if (rv == 0)
551  {
552  if (ip4_table_index != ~0 || ip6_table_index != ~0
553  || other_table_index != ~0)
554  enable = 1;
555  else
556  enable = 0;
557 
558  if (mp->is_input)
559  vnet_l2_input_classify_enable_disable (sw_if_index, enable);
560  else
561  vnet_l2_output_classify_enable_disable (sw_if_index, enable);
562  }
563 
565 
566  REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_L2_TABLES_REPLY);
567 }
568 
571 {
573  vl_api_input_acl_set_interface_reply_t *rmp;
574  int rv;
575 
577 
578  u32 ip4_table_index = ntohl (mp->ip4_table_index);
579  u32 ip6_table_index = ntohl (mp->ip6_table_index);
580  u32 l2_table_index = ntohl (mp->l2_table_index);
581  u32 sw_if_index = ntohl (mp->sw_if_index);
582 
583  rv = vnet_set_input_acl_intfc (vm, sw_if_index, ip4_table_index,
584  ip6_table_index, l2_table_index, mp->is_add);
585 
587 
588  REPLY_MACRO (VL_API_INPUT_ACL_SET_INTERFACE_REPLY);
589 }
590 
593 {
595  vl_api_output_acl_set_interface_reply_t *rmp;
596  int rv;
597 
599 
600  u32 ip4_table_index = ntohl (mp->ip4_table_index);
601  u32 ip6_table_index = ntohl (mp->ip6_table_index);
602  u32 l2_table_index = ntohl (mp->l2_table_index);
603  u32 sw_if_index = ntohl (mp->sw_if_index);
604 
605  rv = vnet_set_output_acl_intfc (vm, sw_if_index, ip4_table_index,
606  ip6_table_index, l2_table_index,
607  mp->is_add);
608 
610 
611  REPLY_MACRO (VL_API_OUTPUT_ACL_SET_INTERFACE_REPLY);
612 }
613 
614 /*
615  * classify_api_hookup
616  * Add vpe's API message handlers to the table.
617  * vlib has alread mapped shared memory and
618  * added the client registration handlers.
619  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
620  */
621 #define vl_msg_name_crc_list
622 #include <vnet/vnet_all_api_h.h>
623 #undef vl_msg_name_crc_list
624 
625 static void
627 {
628 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
629  foreach_vl_msg_name_crc_classify;
630 #undef _
631 }
632 
633 static clib_error_t *
635 {
636  api_main_t *am = &api_main;
637 
638 #define _(N,n) \
639  vl_msg_api_set_handlers(VL_API_##N, #n, \
640  vl_api_##n##_t_handler, \
641  vl_noop_handler, \
642  vl_api_##n##_t_endian, \
643  vl_api_##n##_t_print, \
644  sizeof(vl_api_##n##_t), 1);
646 #undef _
647 
648  /*
649  * Set up the (msg_name, crc, message-id) table
650  */
652 
653  return 0;
654 }
655 
657 
658 /*
659  * fd.io coding-style-patch-verification: ON
660  *
661  * Local Variables:
662  * eval: (c-set-style "gnu")
663  * End:
664  */
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:437
Reply for classify table session dump request.
Definition: classify.api:275
policer_classify_main_t policer_classify_main
static void vl_api_classify_table_info_t_handler(vl_api_classify_table_info_t *mp)
Definition: classify_api.c:316
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:366
Classify get table IDs request.
Definition: classify.api:166
#define foreach_vpe_api_msg
Definition: classify_api.c:50
static void vl_api_classify_add_del_table_t_handler(vl_api_classify_add_del_table_t *mp)
Definition: classify_api.c:78
Set/unset policer classify interface.
Definition: classify.api:127
int vnet_set_ip6_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
Definition: ip6_forward.c:2928
#define REPLY_MACRO2(t, body)
u32 * classify_table_index_by_sw_if_index[IN_OUT_ACL_N_TABLE_GROUPS][IN_OUT_ACL_N_TABLES]
Definition: in_out_acl.h:50
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:34
Classify add / del session request.
Definition: classify.api:102
static void vl_api_output_acl_set_interface_t_handler(vl_api_output_acl_set_interface_t *mp)
Definition: classify_api.c:592
void vnet_l2_input_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
int i
Add/Delete classification table request.
Definition: classify.api:42
Reply for classify get table IDs request.
Definition: classify.api:177
void * vl_msg_api_alloc(int nbytes)
unsigned char u8
Definition: types.h:56
static void send_policer_classify_details(u32 sw_if_index, u32 table_index, vl_api_registration_t *reg, u32 context)
Definition: classify_api.c:185
static void vl_api_input_acl_set_interface_t_handler(vl_api_input_acl_set_interface_t *mp)
Definition: classify_api.c:570
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:443
Classify sessions dump request.
Definition: classify.api:259
u32 * classify_table_index_by_sw_if_index[FLOW_CLASSIFY_N_TABLES]
Definition: flow_classify.h:39
static void send_flow_classify_details(u32 sw_if_index, u32 table_index, vl_api_registration_t *reg, u32 context)
Definition: classify_api.c:461
Set/unset output ACL interface.
Definition: classify.api:398
static void setup_message_id_table(api_main_t *am)
Definition: classify_api.c:626
Set/unset input ACL interface.
Definition: classify.api:376
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.
unsigned int u32
Definition: types.h:88
Reply for classify table id by interface index request.
Definition: classify.api:205
int vnet_set_ip4_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
Definition: ip4_forward.c:2851
u32 * classify_table_index_by_sw_if_index[POLICER_CLASSIFY_N_TABLES]
int vnet_classify_add_del_session(vnet_classify_main_t *cm, u32 table_index, u8 *match, u32 hit_next_index, u32 opaque_index, i32 advance, u8 action, u32 metadata, int is_add)
Flow classify operational state response.
Definition: classify.api:323
#define foreach_classify_add_del_table_field
Definition: classify_api.c:66
u64 memory_size
Definition: vhost_user.h:110
Set/unset l2 classification tables for an interface request.
Definition: classify.api:353
Add/Delete classification table response.
Definition: classify.api:67
#define REPLY_MACRO(t)
static clib_error_t * classify_api_hookup(vlib_main_t *vm)
Definition: classify_api.c:634
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:127
Get list of flow classify interfaces and tables.
Definition: classify.api:312
flow_classify_main_t flow_classify_main
Definition: flow_classify.c:17
static void vl_api_flow_classify_set_interface_t_handler(vl_api_flow_classify_set_interface_t *mp)
Definition: classify_api.c:439
Classify table info.
Definition: classify.api:220
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:201
An API client registration, only in vpp/vlib.
Definition: api_common.h:44
#define BAD_SW_IF_INDEX_LABEL
static void vl_api_classify_set_interface_l2_tables_t_handler(vl_api_classify_set_interface_l2_tables_t *mp)
Definition: classify_api.c:527
vlib_main_t * vm
Definition: buffer.c:294
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:47
static void vl_api_classify_set_interface_ip_table_t_handler(vl_api_classify_set_interface_ip_table_t *mp)
Definition: classify_api.c:505
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:339
Set/unset the classification table for an interface request.
Definition: classify.api:336
#define clib_memcpy(a, b, c)
Definition: string.h:75
Set/unset flow classify interface.
Definition: classify.api:298
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.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:271
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:56
static void vl_api_classify_session_dump_t_handler(vl_api_classify_session_dump_t *mp)
Definition: classify_api.c:388
struct _vnet_classify_main vnet_classify_main_t
Definition: vnet_classify.h:70
Policer iclassify operational state response.
Definition: classify.api:155
signed int i32
Definition: types.h:81
Get list of policer classify interfaces and tables.
Definition: classify.api:143
static void vl_api_flow_classify_dump_t_handler(vl_api_flow_classify_dump_t *mp)
Definition: classify_api.c:478
static void vl_api_policer_classify_dump_t_handler(vl_api_policer_classify_dump_t *mp)
Definition: classify_api.c:202
vnet_classify_main_t vnet_classify_main
Definition: vnet_classify.c:22
size_t count
Definition: vapi.c:46
#define vec_set(v, val)
Set all vector elements to given value.
Definition: vec.h:893
Classify table ids by interface index request.
Definition: classify.api:190
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
static void vl_api_policer_classify_set_interface_t_handler(vl_api_policer_classify_set_interface_t *mp)
Definition: classify_api.c:161
int vnet_classify_add_del_table(vnet_classify_main_t *cm, 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)
#define vec_elt(v, i)
Get vector value at index i.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void vnet_l2_output_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
static void vl_api_classify_table_by_interface_t_handler(vl_api_classify_table_by_interface_t *mp)
Definition: classify_api.c:265
static void vl_api_classify_table_ids_t_handler(vl_api_classify_table_ids_t *mp)
Definition: classify_api.c:229
in_out_acl_main_t in_out_acl_main
Definition: in_out_acl.c:19
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)
void * vl_msg_api_alloc_as_if_client(int nbytes)
static void vl_api_classify_add_del_session_t_handler(vl_api_classify_add_del_session_t *mp)
Definition: classify_api.c:136
Reply for classify table info request.
Definition: classify.api:239
api_main_t api_main
Definition: api_shared.c:35
VLIB_API_INIT_FUNCTION(classify_api_hookup)
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:137
#define VALIDATE_SW_IF_INDEX(mp)