X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fclassify%2Fvnet_classify.c;h=fb9a59c1f016c6ad3212ab1faaa0c617d96ff4fb;hb=52fa5f21b;hp=c9a6fc6ac5b931c9d1ace7478ec23424df2200b3;hpb=8bea589cfe0fca1a6f560e16ca66a4cf199041a2;p=vpp.git diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c index c9a6fc6ac5b..fb9a59c1f01 100644 --- a/src/vnet/classify/vnet_classify.c +++ b/src/vnet/classify/vnet_classify.c @@ -293,7 +293,7 @@ split_and_rehash (vnet_classify_table_t * t, for (i = 0; i < length_in_entries; i++) { - u64 new_hash; + u32 new_hash; v = vnet_classify_entry_at_index (t, old_values, i); @@ -424,7 +424,7 @@ vnet_classify_add_del (vnet_classify_table_t *t, vnet_classify_entry_t *add_v, u32 value_index; int rv = 0; int i; - u64 hash, new_hash; + u32 hash, new_hash; u32 limit; u32 old_log2_pages, new_log2_pages; u32 thread_index = vlib_get_thread_index (); @@ -647,21 +647,21 @@ typedef CLIB_PACKED(struct { }) classify_data_or_mask_t; /* *INDENT-ON* */ -u64 -vnet_classify_hash_packet (vnet_classify_table_t * t, u8 * h) +u32 +vnet_classify_hash_packet (const vnet_classify_table_t *t, u8 *h) { return vnet_classify_hash_packet_inline (t, h); } vnet_classify_entry_t * -vnet_classify_find_entry (vnet_classify_table_t * t, - u8 * h, u64 hash, f64 now) +vnet_classify_find_entry (const vnet_classify_table_t *t, u8 *h, u32 hash, + f64 now) { return vnet_classify_find_entry_inline (t, h, hash, now); } -static u8 * -format_classify_entry (u8 * s, va_list * args) +u8 * +format_classify_entry (u8 *s, va_list *args) { vnet_classify_table_t *t = va_arg (*args, vnet_classify_table_t *); vnet_classify_entry_t *e = va_arg (*args, vnet_classify_entry_t *); @@ -777,8 +777,10 @@ vnet_classify_add_del_table (vnet_classify_main_t *cm, const u8 *mask, else /* update */ { vnet_classify_main_t *cm = &vnet_classify_main; - t = pool_elt_at_index (cm->tables, *table_index); + if (pool_is_free_index (cm->tables, *table_index)) + return VNET_API_ERROR_CLASSIFY_TABLE_NOT_FOUND; + t = pool_elt_at_index (cm->tables, *table_index); t->next_table_index = next_table_index; } return 0; @@ -2052,7 +2054,7 @@ vlib_enable_disable_pkt_trace_filter (int enable) /*? * Construct an arbitrary set of packet classifier tables for use with - * "pcap rx | tx trace," and with the vpp packet tracer + * "pcap trace rx | tx," and with the vpp packet tracer * * Packets which match a rule in the classifier table chain * will be traced. The tables are automatically ordered so that @@ -2095,10 +2097,10 @@ vlib_enable_disable_pkt_trace_filter (int enable) * @cliexpar * Configuring the classify filter * - * Configure a simple classify filter, and configure pcap rx trace to use it: + * Configure a simple classify filter, and configure pcap trace rx to use it: * * @cliexcmd{classify filter rx mask l3 ip4 src match l3 ip4 src 192.168.1.11} - * pcap rx trace on max 100 filter + * pcap trace rx max 100 filter * * Configure another fairly simple filter * @@ -2783,9 +2785,9 @@ unformat_classify_match (unformat_input_t * input, va_list * args) int vnet_classify_add_del_session (vnet_classify_main_t *cm, u32 table_index, - const u8 *match, u32 hit_next_index, + const u8 *match, u16 hit_next_index, u32 opaque_index, i32 advance, u8 action, - u16 metadata, int is_add) + u32 metadata, int is_add) { vnet_classify_table_t *t; vnet_classify_entry_5_t _max_e __attribute__ ((aligned (16))); @@ -3083,7 +3085,12 @@ vnet_is_packet_traced (vlib_buffer_t * b, u32 classify_table_index, int func) { return vnet_is_packet_traced_inline (b, classify_table_index, func); } - +VLIB_REGISTER_TRACE_FILTER_FUNCTION (vnet_is_packet_traced_fn, static) = { + .name = "vnet_is_packet_traced", + .description = "classifier based filter", + .priority = 50, + .function = vnet_is_packet_traced +}; #define TEST_CODE 0 @@ -3235,7 +3242,7 @@ test_classify_churn (test_classify_main_t * tm) for (i = 0; i < tm->sessions; i++) { u8 *key_minus_skip; - u64 hash; + u32 hash; vnet_classify_entry_t *e; ep = tm->entries + i;