2 * Copyright (c) 2012 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef SRC_VPPINFRA_FLOWHASH_8_8_H_
17 #define SRC_VPPINFRA_FLOWHASH_8_8_H_
19 #ifdef __included_flowhash_template_h__
20 #undef __included_flowhash_template_h__
23 #include <vppinfra/clib.h>
24 #include <vppinfra/xxhash.h>
25 #include <vppinfra/crc32.h>
29 } flowhash_skey_8_8_t;
33 } flowhash_lkey_8_8_t;
37 } flowhash_value_8_8_t;
39 #define FLOWHASH_TYPE _8_8
40 #include <vppinfra/flowhash_template.h>
44 u32 flowhash_hash_8_8(flowhash_lkey_8_8_t *k)
46 #ifdef clib_crc32c_uses_intrinsics
47 return clib_crc32c ((u8 *) &k->as_u64[0], 8);
49 return clib_xxhash (k->as_u64[0]);
54 u8 flowhash_cmp_key_8_8(flowhash_skey_8_8_t *a,
55 flowhash_lkey_8_8_t *b)
57 return a->as_u64[0] != b->as_u64[0];
61 void flowhash_cpy_key_8_8(flowhash_skey_8_8_t *dst,
62 flowhash_lkey_8_8_t *src)
64 dst->as_u64[0] = src->as_u64[0];
67 #endif /* SRC_VPPINFRA_FLOWHASH_8_8_H_ */