1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright 2017 6WIND S.A. 3 * Copyright 2017 Mellanox Technologies, Ltd 4 */ 5 6 #ifndef _TAP_FLOW_H_ 7 #define _TAP_FLOW_H_ 8 9 #include <rte_flow.h> 10 #include <rte_flow_driver.h> 11 #include <rte_eth_tap.h> 12 13 /** 14 * Mask of unsupported RSS types 15 */ 16 #define TAP_RSS_HF_MASK (~(RTE_ETH_RSS_IP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_TCP)) 17 18 /** 19 * In TC, priority 0 means we require the kernel to allocate one for us. 20 * In rte_flow, however, we want the priority 0 to be the most important one. 21 * Use an offset to have the most important priority being 1 in TC. 22 */ 23 #define PRIORITY_OFFSET 1 24 #define PRIORITY_MASK (0xfff) 25 #define MAX_PRIORITY (PRIORITY_MASK - PRIORITY_OFFSET) 26 #define GROUP_MASK (0xf) 27 #define GROUP_SHIFT 12 28 #define MAX_GROUP GROUP_MASK 29 #define RSS_PRIORITY_OFFSET RTE_PMD_TAP_MAX_QUEUES 30 31 /** 32 * These index are actually in reversed order: their priority is processed 33 * by subtracting their value to the lowest priority (PRIORITY_MASK). 34 * Thus the first one will have the lowest priority in the end 35 * (but biggest value). 36 */ 37 enum implicit_rule_index { 38 TAP_REMOTE_TX, 39 TAP_ISOLATE, 40 TAP_REMOTE_BROADCASTV6, 41 TAP_REMOTE_BROADCAST, 42 TAP_REMOTE_ALLMULTI, 43 TAP_REMOTE_PROMISC, 44 TAP_REMOTE_LOCAL_MAC, 45 TAP_REMOTE_MAX_IDX, 46 }; 47 48 int tap_dev_flow_ops_get(struct rte_eth_dev *dev, 49 const struct rte_flow_ops **ops); 50 int tap_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error); 51 52 int tap_flow_implicit_create(struct pmd_internals *pmd, 53 enum implicit_rule_index idx); 54 int tap_flow_implicit_destroy(struct pmd_internals *pmd, 55 enum implicit_rule_index idx); 56 int tap_flow_implicit_flush(struct pmd_internals *pmd, 57 struct rte_flow_error *error); 58 59 void tap_flow_bpf_destroy(struct pmd_internals *pmd); 60 61 #endif /* _TAP_FLOW_H_ */ 62