FD.io VPP  v18.01.2-1-g9b554f3
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 
65 #define foreach_classify_add_del_table_field \
66 _(table_index) \
67 _(nbuckets) \
68 _(memory_size) \
69 _(skip_n_vectors) \
70 _(match_n_vectors) \
71 _(next_table_index) \
72 _(miss_next_index) \
73 _(current_data_flag) \
74 _(current_data_offset)
75 
78 {
82  int rv;
83 
84 #define _(a) u32 a;
86 #undef _
87 
88 #define _(a) a = ntohl(mp->a);
90 #undef _
91 
92  /* The underlying API fails silently, on purpose, so check here */
93  if (mp->is_add == 0) /* delete */
94  {
95  if (pool_is_free_index (cm->tables, table_index))
96  {
97  rv = VNET_API_ERROR_NO_SUCH_TABLE;
98  goto out;
99  }
100  }
101  else /* add or update */
102  {
103  if (table_index != ~0 && pool_is_free_index (cm->tables, table_index))
104  table_index = ~0;
105  }
106 
108  (cm, mp->mask, nbuckets, memory_size,
109  skip_n_vectors, match_n_vectors,
110  next_table_index, miss_next_index, &table_index,
111  current_data_flag, current_data_offset, mp->is_add, mp->del_chain);
112 
113 out:
114  /* *INDENT-OFF* */
115  REPLY_MACRO2(VL_API_CLASSIFY_ADD_DEL_TABLE_REPLY,
116  ({
117  if (rv == 0 && mp->is_add)
118  {
119  t = pool_elt_at_index (cm->tables, table_index);
120  rmp->skip_n_vectors = ntohl(t->skip_n_vectors);
121  rmp->match_n_vectors = ntohl(t->match_n_vectors);
122  rmp->new_table_index = ntohl(table_index);
123  }
124  else
125  {
126  rmp->skip_n_vectors = ~0;
127  rmp->match_n_vectors = ~0;
128  rmp->new_table_index = ~0;
129  }
130  }));
131  /* *INDENT-ON* */
132 }
133 
136 {
138  vl_api_classify_add_del_session_reply_t *rmp;
139  int rv;
140  u32 table_index, hit_next_index, opaque_index, metadata;
141  i32 advance;
142  u8 action;
143 
144  table_index = ntohl (mp->table_index);
145  hit_next_index = ntohl (mp->hit_next_index);
146  opaque_index = ntohl (mp->opaque_index);
147  advance = ntohl (mp->advance);
148  action = mp->action;
149  metadata = ntohl (mp->metadata);
150 
152  (cm, table_index, mp->match, hit_next_index, opaque_index,
153  advance, action, metadata, mp->is_add);
154 
155  REPLY_MACRO (VL_API_CLASSIFY_ADD_DEL_SESSION_REPLY);
156 }
157 
158 static void
161 {
163  vl_api_policer_classify_set_interface_reply_t *rmp;
164  int rv;
165  u32 sw_if_index, ip4_table_index, ip6_table_index, l2_table_index;
166 
167  ip4_table_index = ntohl (mp->ip4_table_index);
168  ip6_table_index = ntohl (mp->ip6_table_index);
169  l2_table_index = ntohl (mp->l2_table_index);
170  sw_if_index = ntohl (mp->sw_if_index);
171 
173 
174  rv = vnet_set_policer_classify_intfc (vm, sw_if_index, ip4_table_index,
175  ip6_table_index, l2_table_index,
176  mp->is_add);
177 
179 
180  REPLY_MACRO (VL_API_POLICER_CLASSIFY_SET_INTERFACE_REPLY);
181 }
182 
183 static void
185  u32 table_index,
186  unix_shared_memory_queue_t * q, u32 context)
187 {
189 
190  mp = vl_msg_api_alloc (sizeof (*mp));
191  memset (mp, 0, sizeof (*mp));
192  mp->_vl_msg_id = ntohs (VL_API_POLICER_CLASSIFY_DETAILS);
193  mp->context = context;
194  mp->sw_if_index = htonl (sw_if_index);
195  mp->table_index = htonl (table_index);
196 
197  vl_msg_api_send_shmem (q, (u8 *) & mp);
198 }
199 
200 static void
202 {
205  u32 *vec_tbl;
206  int i;
207 
209  if (q == 0)
210  return;
211 
212  vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type];
213 
214  if (vec_len (vec_tbl))
215  {
216  for (i = 0; i < vec_len (vec_tbl); i++)
217  {
218  if (vec_elt (vec_tbl, i) == ~0)
219  continue;
220 
221  send_policer_classify_details (i, vec_elt (vec_tbl, i), q,
222  mp->context);
223  }
224  }
225 }
226 
227 static void
229 {
231 
233  if (q == 0)
234  return;
235 
238  u32 *table_ids = 0;
239  u32 count;
240 
241  /* *INDENT-OFF* */
242  pool_foreach (t, cm->tables,
243  ({
244  vec_add1 (table_ids, ntohl(t - cm->tables));
245  }));
246  /* *INDENT-ON* */
247  count = vec_len (table_ids);
248 
250  rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
251  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_IDS_REPLY);
252  rmp->context = mp->context;
253  rmp->count = ntohl (count);
254  clib_memcpy (rmp->ids, table_ids, count * sizeof (u32));
255  rmp->retval = 0;
256 
257  vl_msg_api_send_shmem (q, (u8 *) & rmp);
258 
259  vec_free (table_ids);
260 }
261 
262 static void
265 {
267  int rv = 0;
268 
269  u32 sw_if_index = ntohl (mp->sw_if_index);
270  u32 *acl = 0;
271 
272  vec_validate (acl, INPUT_ACL_N_TABLES - 1);
273  vec_set (acl, ~0);
274 
276 
278 
279  int if_idx;
280  u32 type;
281 
282  for (type = 0; type < INPUT_ACL_N_TABLES; type++)
283  {
284  u32 *vec_tbl = am->classify_table_index_by_sw_if_index[type];
285  if (vec_len (vec_tbl))
286  {
287  for (if_idx = 0; if_idx < vec_len (vec_tbl); if_idx++)
288  {
289  if (vec_elt (vec_tbl, if_idx) == ~0 || sw_if_index != if_idx)
290  {
291  continue;
292  }
293  acl[type] = vec_elt (vec_tbl, if_idx);
294  }
295  }
296  }
297 
299 
300  /* *INDENT-OFF* */
301  REPLY_MACRO2(VL_API_CLASSIFY_TABLE_BY_INTERFACE_REPLY,
302  ({
303  rmp->sw_if_index = ntohl(sw_if_index);
304  rmp->l2_table_id = ntohl(acl[INPUT_ACL_TABLE_L2]);
305  rmp->ip4_table_id = ntohl(acl[INPUT_ACL_TABLE_IP4]);
306  rmp->ip6_table_id = ntohl(acl[INPUT_ACL_TABLE_IP6]);
307  }));
308  /* *INDENT-ON* */
309  vec_free (acl);
310 }
311 
312 static void
314 {
316 
318  if (q == 0)
319  return;
320 
322 
324  u32 table_id = ntohl (mp->table_id);
326 
327  /* *INDENT-OFF* */
328  pool_foreach (t, cm->tables,
329  ({
330  if (table_id == t - cm->tables)
331  {
332  rmp = vl_msg_api_alloc_as_if_client
333  (sizeof (*rmp) + t->match_n_vectors * sizeof (u32x4));
334  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_INFO_REPLY);
335  rmp->context = mp->context;
336  rmp->table_id = ntohl(table_id);
337  rmp->nbuckets = ntohl(t->nbuckets);
338  rmp->match_n_vectors = ntohl(t->match_n_vectors);
339  rmp->skip_n_vectors = ntohl(t->skip_n_vectors);
340  rmp->active_sessions = ntohl(t->active_elements);
341  rmp->next_table_index = ntohl(t->next_table_index);
342  rmp->miss_next_index = ntohl(t->miss_next_index);
343  rmp->mask_length = ntohl(t->match_n_vectors * sizeof (u32x4));
344  clib_memcpy(rmp->mask, t->mask, t->match_n_vectors * sizeof(u32x4));
345  rmp->retval = 0;
346  break;
347  }
348  }));
349  /* *INDENT-ON* */
350 
351  if (rmp == 0)
352  {
353  rmp = vl_msg_api_alloc (sizeof (*rmp));
354  rmp->_vl_msg_id = ntohs ((VL_API_CLASSIFY_TABLE_INFO_REPLY));
355  rmp->context = mp->context;
356  rmp->retval = ntohl (VNET_API_ERROR_CLASSIFY_TABLE_NOT_FOUND);
357  }
358 
359  vl_msg_api_send_shmem (q, (u8 *) & rmp);
360 }
361 
362 static void
364  u32 table_id,
365  u32 match_length,
366  vnet_classify_entry_t * e, u32 context)
367 {
369 
370  rmp = vl_msg_api_alloc (sizeof (*rmp));
371  memset (rmp, 0, sizeof (*rmp));
372  rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_SESSION_DETAILS);
373  rmp->context = context;
374  rmp->table_id = ntohl (table_id);
375  rmp->hit_next_index = ntohl (e->next_index);
376  rmp->advance = ntohl (e->advance);
377  rmp->opaque_index = ntohl (e->opaque_index);
378  rmp->match_length = ntohl (match_length);
379  clib_memcpy (rmp->match, e->key, match_length);
380 
381  vl_msg_api_send_shmem (q, (u8 *) & rmp);
382 }
383 
384 static void
386 {
389 
390  u32 table_id = ntohl (mp->table_id);
392 
394  if (!q)
395  return;
396 
397  /* *INDENT-OFF* */
398  pool_foreach (t, cm->tables,
399  ({
400  if (table_id == t - cm->tables)
401  {
402  vnet_classify_bucket_t * b;
403  vnet_classify_entry_t * v, * save_v;
404  int i, j, k;
405 
406  for (i = 0; i < t->nbuckets; i++)
407  {
408  b = &t->buckets [i];
409  if (b->offset == 0)
410  continue;
411 
412  save_v = vnet_classify_get_entry (t, b->offset);
413  for (j = 0; j < (1<<b->log2_pages); j++)
414  {
415  for (k = 0; k < t->entries_per_page; k++)
416  {
417  v = vnet_classify_entry_at_index
418  (t, save_v, j*t->entries_per_page + k);
419  if (vnet_classify_entry_is_free (v))
420  continue;
421 
422  send_classify_session_details
423  (q, table_id, t->match_n_vectors * sizeof (u32x4),
424  v, mp->context);
425  }
426  }
427  }
428  break;
429  }
430  }));
431  /* *INDENT-ON* */
432 }
433 
434 static void
437 {
439  vl_api_flow_classify_set_interface_reply_t *rmp;
440  int rv;
441  u32 sw_if_index, ip4_table_index, ip6_table_index;
442 
443  ip4_table_index = ntohl (mp->ip4_table_index);
444  ip6_table_index = ntohl (mp->ip6_table_index);
445  sw_if_index = ntohl (mp->sw_if_index);
446 
448 
449  rv = vnet_set_flow_classify_intfc (vm, sw_if_index, ip4_table_index,
450  ip6_table_index, mp->is_add);
451 
453 
454  REPLY_MACRO (VL_API_FLOW_CLASSIFY_SET_INTERFACE_REPLY);
455 }
456 
457 static void
459  u32 table_index,
460  unix_shared_memory_queue_t * q, u32 context)
461 {
463 
464  mp = vl_msg_api_alloc (sizeof (*mp));
465  memset (mp, 0, sizeof (*mp));
466  mp->_vl_msg_id = ntohs (VL_API_FLOW_CLASSIFY_DETAILS);
467  mp->context = context;
468  mp->sw_if_index = htonl (sw_if_index);
469  mp->table_index = htonl (table_index);
470 
471  vl_msg_api_send_shmem (q, (u8 *) & mp);
472 }
473 
474 static void
476 {
479  u32 *vec_tbl;
480  int i;
481 
483  if (q == 0)
484  return;
485 
486  vec_tbl = pcm->classify_table_index_by_sw_if_index[mp->type];
487 
488  if (vec_len (vec_tbl))
489  {
490  for (i = 0; i < vec_len (vec_tbl); i++)
491  {
492  if (vec_elt (vec_tbl, i) == ~0)
493  continue;
494 
495  send_flow_classify_details (i, vec_elt (vec_tbl, i), q,
496  mp->context);
497  }
498  }
499 }
500 
503 {
505  vl_api_classify_set_interface_ip_table_reply_t *rmp;
506  int rv;
507 
509 
510  u32 table_index = ntohl (mp->table_index);
511  u32 sw_if_index = ntohl (mp->sw_if_index);
512 
513  if (mp->is_ipv6)
514  rv = vnet_set_ip6_classify_intfc (vm, sw_if_index, table_index);
515  else
516  rv = vnet_set_ip4_classify_intfc (vm, sw_if_index, table_index);
517 
519 
520  REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_IP_TABLE_REPLY);
521 }
522 
525 {
526  vl_api_classify_set_interface_l2_tables_reply_t *rmp;
527  int rv;
528  u32 sw_if_index, ip4_table_index, ip6_table_index, other_table_index;
529  int enable;
530 
531  ip4_table_index = ntohl (mp->ip4_table_index);
532  ip6_table_index = ntohl (mp->ip6_table_index);
533  other_table_index = ntohl (mp->other_table_index);
534  sw_if_index = ntohl (mp->sw_if_index);
535 
537 
538  if (mp->is_input)
539  rv = vnet_l2_input_classify_set_tables (sw_if_index, ip4_table_index,
540  ip6_table_index,
541  other_table_index);
542  else
543  rv = vnet_l2_output_classify_set_tables (sw_if_index, ip4_table_index,
544  ip6_table_index,
545  other_table_index);
546 
547  if (rv == 0)
548  {
549  if (ip4_table_index != ~0 || ip6_table_index != ~0
550  || other_table_index != ~0)
551  enable = 1;
552  else
553  enable = 0;
554 
555  if (mp->is_input)
556  vnet_l2_input_classify_enable_disable (sw_if_index, enable);
557  else
558  vnet_l2_output_classify_enable_disable (sw_if_index, enable);
559  }
560 
562 
563  REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_L2_TABLES_REPLY);
564 }
565 
568 {
570  vl_api_input_acl_set_interface_reply_t *rmp;
571  int rv;
572 
574 
575  u32 ip4_table_index = ntohl (mp->ip4_table_index);
576  u32 ip6_table_index = ntohl (mp->ip6_table_index);
577  u32 l2_table_index = ntohl (mp->l2_table_index);
578  u32 sw_if_index = ntohl (mp->sw_if_index);
579 
580  rv = vnet_set_input_acl_intfc (vm, sw_if_index, ip4_table_index,
581  ip6_table_index, l2_table_index, mp->is_add);
582 
584 
585  REPLY_MACRO (VL_API_INPUT_ACL_SET_INTERFACE_REPLY);
586 }
587 
588 /*
589  * classify_api_hookup
590  * Add vpe's API message handlers to the table.
591  * vlib has alread mapped shared memory and
592  * added the client registration handlers.
593  * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
594  */
595 #define vl_msg_name_crc_list
596 #include <vnet/vnet_all_api_h.h>
597 #undef vl_msg_name_crc_list
598 
599 static void
601 {
602 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
603  foreach_vl_msg_name_crc_classify;
604 #undef _
605 }
606 
607 static clib_error_t *
609 {
610  api_main_t *am = &api_main;
611 
612 #define _(N,n) \
613  vl_msg_api_set_handlers(VL_API_##N, #n, \
614  vl_api_##n##_t_handler, \
615  vl_noop_handler, \
616  vl_api_##n##_t_endian, \
617  vl_api_##n##_t_print, \
618  sizeof(vl_api_##n##_t), 1);
620 #undef _
621 
622  /*
623  * Set up the (msg_name, crc, message-id) table
624  */
626 
627  return 0;
628 }
629 
631 
632 /*
633  * fd.io coding-style-patch-verification: ON
634  *
635  * Local Variables:
636  * eval: (c-set-style "gnu")
637  * End:
638  */
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:432
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:313
void * vl_msg_api_alloc_as_if_client(int nbytes)
Classify get table IDs request.
Definition: classify.api:166
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
#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:77
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:3363
u32 * classify_table_index_by_sw_if_index[INPUT_ACL_N_TABLES]
Definition: input_acl.h:41
#define REPLY_MACRO2(t, body)
Classify add / del session request.
Definition: classify.api:102
void vnet_l2_input_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
Add/Delete classification table request.
Definition: classify.api:42
Reply for classify get table IDs request.
Definition: classify.api:177
static void vl_api_input_acl_set_interface_t_handler(vl_api_input_acl_set_interface_t *mp)
Definition: classify_api.c:567
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:438
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
int i32
Definition: types.h:81
static void send_classify_session_details(unix_shared_memory_queue_t *q, u32 table_id, u32 match_length, vnet_classify_entry_t *e, u32 context)
Definition: classify_api.c:363
static void setup_message_id_table(api_main_t *am)
Definition: classify_api.c:600
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.
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:3070
u32 * classify_table_index_by_sw_if_index[POLICER_CLASSIFY_N_TABLES]
void * vl_msg_api_alloc(int nbytes)
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:65
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:608
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:436
Classify table info.
Definition: classify.api:220
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:198
#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:524
api_main_t api_main
Definition: api_shared.c:35
vlib_main_t * vm
Definition: buffer.c:283
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:502
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
Set/unset the classification table for an interface request.
Definition: classify.api:336
u64 memory_size
Definition: vhost-user.h:77
#define clib_memcpy(a, b, c)
Definition: string.h:75
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
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:268
static void vl_api_classify_session_dump_t_handler(vl_api_classify_session_dump_t *mp)
Definition: classify_api.c:385
static void send_policer_classify_details(u32 sw_if_index, u32 table_index, unix_shared_memory_queue_t *q, u32 context)
Definition: classify_api.c:184
struct _vnet_classify_main vnet_classify_main_t
Definition: vnet_classify.h:73
input_acl_main_t input_acl_main
Definition: input_acl.c:19
Policer iclassify operational state response.
Definition: classify.api:155
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
unsigned int u32
Definition: types.h:88
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:475
static void vl_api_policer_classify_dump_t_handler(vl_api_policer_classify_dump_t *mp)
Definition: classify_api.c:201
vnet_classify_main_t vnet_classify_main
Definition: vnet_classify.c:22
size_t count
Definition: vapi.c:42
#define vec_set(v, val)
Set all vector elements to given value.
Definition: vec.h:888
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:160
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)
unsigned char u8
Definition: types.h:56
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:264
static void vl_api_classify_table_ids_t_handler(vl_api_classify_table_ids_t *mp)
Definition: classify_api.c:228
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: input_acl.c:59
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)
static void vl_api_classify_add_del_session_t_handler(vl_api_classify_add_del_session_t *mp)
Definition: classify_api.c:135
Reply for classify table info request.
Definition: classify.api:239
VLIB_API_INIT_FUNCTION(classify_api_hookup)
static void send_flow_classify_details(u32 sw_if_index, u32 table_index, unix_shared_memory_queue_t *q, u32 context)
Definition: classify_api.c:458
#define VALIDATE_SW_IF_INDEX(mp)
struct _unix_shared_memory_queue unix_shared_memory_queue_t