FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
flowhash_24_16.h
Go to the documentation of this file.
1
/*
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:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
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.
14
*/
15
16
#ifndef SRC_VPPINFRA_FLOWHASH_24_16_H_
17
#define SRC_VPPINFRA_FLOWHASH_24_16_H_
18
19
#ifdef __included_flowhash_template_h__
20
#undef __included_flowhash_template_h__
21
#endif
22
23
#include <
vppinfra/clib.h
>
24
#include <
vppinfra/xxhash.h
>
25
#include <
vppinfra/crc32.h
>
26
27
typedef
struct
{
28
u64
as_u64
[3];
29
}
flowhash_skey_24_16_t
;
30
31
typedef
struct
{
32
u64
as_u64
[3];
33
}
flowhash_lkey_24_16_t
;
34
35
typedef
struct
{
36
u64
as_u64
[2];
37
}
flowhash_value_24_16_t
;
38
39
#define FLOWHASH_TYPE _24_16
40
#include <
vppinfra/flowhash_template.h
>
41
#undef FLOWHASH_TYPE
42
43
static_always_inline
44
u32
flowhash_hash_24_16
(
flowhash_lkey_24_16_t
*k)
45
{
46
#ifdef clib_crc32c_uses_intrinsics
47
return
clib_crc32c ((
u8
*) &k->
as_u64
[0], 24);
48
#else
49
u64
val = 0;
50
val ^= k->
as_u64
[0];
51
val ^= k->
as_u64
[1];
52
val ^= k->
as_u64
[2];
53
return
(
u32
)
clib_xxhash
(val);
54
#endif
55
}
56
57
static_always_inline
58
u8
flowhash_cmp_key_24_16
(
flowhash_skey_24_16_t
*
a
,
59
flowhash_lkey_24_16_t
*
b
)
60
{
61
u8
val = 0;
62
val |= (
a
->as_u64[0] !=
b
->as_u64[0]);
63
val |= (
a
->as_u64[1] !=
b
->as_u64[1]);
64
val |= (
a
->as_u64[2] !=
b
->as_u64[2]);
65
return
val;
66
}
67
68
static_always_inline
69
void
flowhash_cpy_key_24_16
(
flowhash_skey_24_16_t
*
dst
,
70
flowhash_lkey_24_16_t
*
src
)
71
{
72
dst
->as_u64[0] =
src
->as_u64[0];
73
dst
->as_u64[1] =
src
->as_u64[1];
74
dst
->as_u64[2] =
src
->as_u64[2];
75
}
76
77
#endif
/* SRC_VPPINFRA_FLOWHASH_24_16_H_ */
flowhash_value_24_16_t
Definition:
flowhash_24_16.h:35
clib.h
flowhash_cpy_key_24_16
static_always_inline void flowhash_cpy_key_24_16(flowhash_skey_24_16_t *dst, flowhash_lkey_24_16_t *src)
Definition:
flowhash_24_16.h:69
flowhash_hash_24_16
static_always_inline u32 flowhash_hash_24_16(flowhash_lkey_24_16_t *k)
Definition:
flowhash_24_16.h:44
flowhash_skey_24_16_t
Definition:
flowhash_24_16.h:27
flowhash_template.h
static_always_inline
#define static_always_inline
Definition:
clib.h:112
flowhash_lkey_24_16_t
Definition:
flowhash_24_16.h:31
crc32.h
flowhash_cmp_key_24_16
static_always_inline u8 flowhash_cmp_key_24_16(flowhash_skey_24_16_t *a, flowhash_lkey_24_16_t *b)
Definition:
flowhash_24_16.h:58
clib_xxhash
static u64 clib_xxhash(u64 key)
Definition:
xxhash.h:58
src
vl_api_address_t src
Definition:
gre.api:54
xxhash.h
flowhash_lkey_24_16_t::as_u64
u64 as_u64[3]
Definition:
flowhash_24_16.h:32
u64
unsigned long u64
Definition:
types.h:89
u32
unsigned int u32
Definition:
types.h:88
dst
vl_api_ip4_address_t dst
Definition:
pnat.api:41
as_u64
u64 as_u64
Definition:
bihash_doc.h:63
b
vlib_buffer_t ** b
Definition:
nat44_ei_out2in.c:717
u8
unsigned char u8
Definition:
types.h:56
a
a
Definition:
bitmap.h:525
extras
deprecated
vppinfra
flowhash_24_16.h
Generated on Sat Jan 8 2022 10:34:48 for FD.io VPP by
1.8.17