2 *------------------------------------------------------------------
3 * Copyright (c) 2017 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *------------------------------------------------------------------
18 #ifndef _ACL_HASH_LOOKUP_TYPES_H_
19 #define _ACL_HASH_LOOKUP_TYPES_H_
21 /* The structure representing the single entry with hash representation */
23 /* these two entries refer to the original ACL# and rule# within that ACL */
28 u8 src_portrange_not_powerof2;
29 u8 dst_portrange_not_powerof2;
36 * The structure holding the information necessary for the hash-based ACL operation
39 /* The mask types present in this ACL */
40 uword *mask_type_index_bitmap;
41 hash_ace_info_t *rules;
45 /* original non-compiled ACL */
48 /* the index of the hash_ace_info_t */
49 u32 hash_ace_info_index;
51 * in case of the same key having multiple entries,
52 * this holds the index of the next entry.
54 u32 next_applied_entry_index;
56 * previous entry in the list of the chained ones,
57 * if ~0 then this is entry in the hash.
59 u32 prev_applied_entry_index;
61 * Action of this applied ACE
64 } applied_hash_ace_entry_t;
68 * A logical OR of all the applied_ace_hash_entry_t=>
69 * hash_ace_info_t=>mask_type_index bits set
71 uword *mask_type_index_bitmap;
72 } applied_hash_acl_info_t;
78 u32 applied_entry_index;
81 /* means there is some other entry in front intersecting with this one */
83 u8 need_portrange_check:1;
86 } hash_acl_lookup_value_t;
88 #define CT_ASSERT_EQUAL(name, x,y) typedef int assert_ ## name ## _compile_time_assertion_failed[((x) == (y))-1]
90 CT_ASSERT_EQUAL(hash_acl_lookup_value_t_is_u64, sizeof(hash_acl_lookup_value_t), sizeof(u64));
92 #undef CT_ASSERT_EQUAL