4 * Copyright 2017 6WIND S.A.
5 * Copyright 2017 Mellanox.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of 6WIND S.A. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #include <rte_flow_driver.h>
39 #include <rte_eth_tap.h>
42 * In TC, priority 0 means we require the kernel to allocate one for us.
43 * In rte_flow, however, we want the priority 0 to be the most important one.
44 * Use an offset to have the most important priority being 1 in TC.
46 #define PRIORITY_OFFSET 1
47 #define PRIORITY_MASK (0xfff)
48 #define MAX_PRIORITY (PRIORITY_MASK - PRIORITY_OFFSET)
49 #define GROUP_MASK (0xf)
50 #define GROUP_SHIFT 12
51 #define MAX_GROUP GROUP_MASK
54 * These index are actually in reversed order: their priority is processed
55 * by subtracting their value to the lowest priority (PRIORITY_MASK).
56 * Thus the first one will have the lowest priority in the end
57 * (but biggest value).
59 enum implicit_rule_index {
61 TAP_REMOTE_BROADCASTV6,
69 int tap_dev_filter_ctrl(struct rte_eth_dev *dev,
70 enum rte_filter_type filter_type,
71 enum rte_filter_op filter_op,
73 int tap_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error);
75 int tap_flow_implicit_create(struct pmd_internals *pmd,
76 enum implicit_rule_index idx);
77 int tap_flow_implicit_destroy(struct pmd_internals *pmd,
78 enum implicit_rule_index idx);
79 int tap_flow_implicit_flush(struct pmd_internals *pmd,
80 struct rte_flow_error *error);
82 #endif /* _TAP_FLOW_H_ */