]> git.proxmox.com Git - mirror_ovs.git/blob - lib/dpif-netdev-lookup.h
dpctl: Fix dpctl process command parameter error.
[mirror_ovs.git] / lib / dpif-netdev-lookup.h
1 /*
2 * Copyright (c) 2020 Intel Corporation.
3 *
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:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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 */
16
17 #ifndef DPIF_NETDEV_LOOKUP_H
18 #define DPIF_NETDEV_LOOKUP_H 1
19
20 #include <config.h>
21 #include "dpif-netdev.h"
22 #include "dpif-netdev-private.h"
23
24 /* Function to perform a probe for the subtable bit fingerprint.
25 * Returns NULL if not valid, or a valid function pointer to call for this
26 * subtable on success.
27 */
28 typedef
29 dpcls_subtable_lookup_func (*dpcls_subtable_probe_func)(uint32_t u0_bit_count,
30 uint32_t u1_bit_count);
31
32 /* Prototypes for subtable implementations */
33 dpcls_subtable_lookup_func
34 dpcls_subtable_autovalidator_probe(uint32_t u0_bit_count,
35 uint32_t u1_bit_count);
36
37 /* Probe function to select a specialized version of the generic lookup
38 * implementation. This provides performance benefit due to compile-time
39 * optimizations such as loop-unrolling. These are enabled by the compile-time
40 * constants in the specific function implementations.
41 */
42 dpcls_subtable_lookup_func
43 dpcls_subtable_generic_probe(uint32_t u0_bit_count, uint32_t u1_bit_count);
44
45 /* Probe function for AVX-512 gather implementation */
46 dpcls_subtable_lookup_func
47 dpcls_subtable_avx512_gather_probe(uint32_t u0_bit_cnt, uint32_t u1_bit_cnt);
48
49
50 /* Subtable registration and iteration helpers */
51 struct dpcls_subtable_lookup_info_t {
52 /* higher priority gets used over lower values. This allows deployments
53 * to select the best implementation for the use-case.
54 */
55 uint8_t prio;
56
57 /* Probe function: tests if the (u0,u1) combo is supported. If not
58 * supported, this function returns NULL. If supported, a function pointer
59 * is returned which when called will perform the lookup on the subtable.
60 */
61 dpcls_subtable_probe_func probe;
62
63 /* Human readable name, used in setting subtable priority commands */
64 const char *name;
65 };
66
67 int32_t dpcls_subtable_set_prio(const char *name, uint8_t priority);
68
69 dpcls_subtable_lookup_func
70 dpcls_subtable_get_best_impl(uint32_t u0_bit_count, uint32_t u1_bit_count);
71
72 /* Retrieve the array of lookup implementations for iteration.
73 * On error, returns a negative number.
74 * On success, returns the size of the arrays pointed to by the out parameter.
75 */
76 int32_t
77 dpcls_subtable_lookup_info_get(struct dpcls_subtable_lookup_info_t **out_ptr);
78
79 #endif /* dpif-netdev-lookup.h */