2018-01-29 14:11:36 +01:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright 2017 6WIND S.A.
|
2018-03-20 21:20:35 +02:00
|
|
|
* Copyright 2017 Mellanox Technologies, Ltd
|
2017-03-23 09:33:55 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _TAP_FLOW_H_
|
|
|
|
#define _TAP_FLOW_H_
|
|
|
|
|
|
|
|
#include <rte_flow.h>
|
|
|
|
#include <rte_flow_driver.h>
|
2017-03-23 09:42:11 +01:00
|
|
|
#include <rte_eth_tap.h>
|
2018-01-20 21:11:36 +00:00
|
|
|
#include <tap_autoconf.h>
|
2017-03-23 09:33:55 +01:00
|
|
|
|
net/tap: add basic flow API patterns and actions
Supported flow rules are now mapped to TC rules on the tap netdevice.
The netlink message used for creating the TC rule is stored in struct
rte_flow. That way, by simply changing a metadata in it, we can require
for the rule deletion without further parsing.
Supported items:
- eth: src and dst (with variable masks), and eth_type (0xffff mask).
- vlan: vid, pcp, tpid, but not eid.
- ipv4/6: src and dst (with variable masks), and ip_proto (0xffff mask).
- udp/tcp: src and dst port (0xffff) mask.
Supported actions:
- DROP
- QUEUE
- PASSTHRU
It is generally not possible to provide a "last" item. However, if the
"last" item, once masked, is identical to the masked spec, then it is
supported.
Only IPv4/6 and MAC addresses can use a variable mask. All other
items need a full mask (exact match).
Support for VLAN requires kernel headers >= 4.9, checked using
auto-config.sh.
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
2017-03-23 09:33:57 +01:00
|
|
|
/**
|
|
|
|
* In TC, priority 0 means we require the kernel to allocate one for us.
|
|
|
|
* In rte_flow, however, we want the priority 0 to be the most important one.
|
|
|
|
* Use an offset to have the most important priority being 1 in TC.
|
|
|
|
*/
|
|
|
|
#define PRIORITY_OFFSET 1
|
|
|
|
#define PRIORITY_MASK (0xfff)
|
|
|
|
#define MAX_PRIORITY (PRIORITY_MASK - PRIORITY_OFFSET)
|
|
|
|
#define GROUP_MASK (0xf)
|
|
|
|
#define GROUP_SHIFT 12
|
|
|
|
#define MAX_GROUP GROUP_MASK
|
2018-01-20 21:11:36 +00:00
|
|
|
#define RSS_PRIORITY_OFFSET RTE_PMD_TAP_MAX_QUEUES
|
net/tap: add basic flow API patterns and actions
Supported flow rules are now mapped to TC rules on the tap netdevice.
The netlink message used for creating the TC rule is stored in struct
rte_flow. That way, by simply changing a metadata in it, we can require
for the rule deletion without further parsing.
Supported items:
- eth: src and dst (with variable masks), and eth_type (0xffff mask).
- vlan: vid, pcp, tpid, but not eid.
- ipv4/6: src and dst (with variable masks), and ip_proto (0xffff mask).
- udp/tcp: src and dst port (0xffff) mask.
Supported actions:
- DROP
- QUEUE
- PASSTHRU
It is generally not possible to provide a "last" item. However, if the
"last" item, once masked, is identical to the masked spec, then it is
supported.
Only IPv4/6 and MAC addresses can use a variable mask. All other
items need a full mask (exact match).
Support for VLAN requires kernel headers >= 4.9, checked using
auto-config.sh.
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
2017-03-23 09:33:57 +01:00
|
|
|
|
2017-03-23 09:42:11 +01:00
|
|
|
/**
|
|
|
|
* These index are actually in reversed order: their priority is processed
|
|
|
|
* by subtracting their value to the lowest priority (PRIORITY_MASK).
|
|
|
|
* Thus the first one will have the lowest priority in the end
|
|
|
|
* (but biggest value).
|
|
|
|
*/
|
|
|
|
enum implicit_rule_index {
|
|
|
|
TAP_REMOTE_TX,
|
2017-05-24 17:41:12 +02:00
|
|
|
TAP_ISOLATE,
|
2017-03-23 09:42:11 +01:00
|
|
|
TAP_REMOTE_BROADCASTV6,
|
|
|
|
TAP_REMOTE_BROADCAST,
|
|
|
|
TAP_REMOTE_ALLMULTI,
|
|
|
|
TAP_REMOTE_PROMISC,
|
|
|
|
TAP_REMOTE_LOCAL_MAC,
|
|
|
|
TAP_REMOTE_MAX_IDX,
|
|
|
|
};
|
|
|
|
|
2018-01-20 21:11:36 +00:00
|
|
|
enum bpf_fd_idx {
|
|
|
|
SEC_L3_L4,
|
|
|
|
SEC_MAX,
|
|
|
|
};
|
|
|
|
|
2017-03-23 09:33:55 +01:00
|
|
|
int tap_dev_filter_ctrl(struct rte_eth_dev *dev,
|
|
|
|
enum rte_filter_type filter_type,
|
|
|
|
enum rte_filter_op filter_op,
|
|
|
|
void *arg);
|
|
|
|
int tap_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error);
|
|
|
|
|
2017-03-23 09:42:11 +01:00
|
|
|
int tap_flow_implicit_create(struct pmd_internals *pmd,
|
|
|
|
enum implicit_rule_index idx);
|
|
|
|
int tap_flow_implicit_destroy(struct pmd_internals *pmd,
|
|
|
|
enum implicit_rule_index idx);
|
|
|
|
int tap_flow_implicit_flush(struct pmd_internals *pmd,
|
|
|
|
struct rte_flow_error *error);
|
|
|
|
|
2018-01-20 21:11:35 +00:00
|
|
|
int tap_flow_bpf_cls_q(__u32 queue_idx);
|
|
|
|
int tap_flow_bpf_calc_l3_l4_hash(__u32 key_idx, int map_fd);
|
|
|
|
int tap_flow_bpf_rss_map_create(unsigned int key_size, unsigned int value_size,
|
|
|
|
unsigned int max_entries);
|
|
|
|
int tap_flow_bpf_update_rss_elem(int fd, void *key, void *value);
|
|
|
|
|
2017-03-23 09:33:55 +01:00
|
|
|
#endif /* _TAP_FLOW_H_ */
|