TAP PMD is required to support RSS queue mapping based on rte_flow API. An example usage for this requirement is failsafe transparent switching from a PCI device to TAP device while keep redirecting packets to the same RSS queues on both devices. TAP RSS implementation is based on eBPF programs sent to Linux kernel through BPF system calls and using netlink messages to reference the programs as part of traffic control commands. TC uses eBPF programs as classifiers and actions. eBPF classification: packets marked with an RSS queue will be directed to this queue using TC with "skbedit" action. BPF classifiers are downloaded to the kernel once on TAP creation for each TAP Rx queue. eBPF action: calculate the Toeplitz RSS hash based on L3 addresses and L4 ports. Mark the packet with the RSS queue according the resulting RSS hash, then reclassify the packet. BPF actions are downloaded to the kernel for each new RSS rule. TAP eBPF requires Linux version 4.9 configured with BPF. TAP PMD will successfully compile on systems with old or non-BPF configured kernels but RSS rules creation on TAP devices will not be successful Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Pascal Mazon <pascal.mazon@6wind.com>
35 lines
889 B
C
35 lines
889 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright 2017 Mellanox Technologies, Ltd.
|
|
*/
|
|
|
|
#ifndef _TAP_RSS_H_
|
|
#define _TAP_RSS_H_
|
|
|
|
#ifndef TAP_MAX_QUEUES
|
|
#define TAP_MAX_QUEUES 16
|
|
#endif
|
|
|
|
/* hashed fields for RSS */
|
|
enum hash_field {
|
|
HASH_FIELD_IPV4_L3, /* IPv4 src/dst addr */
|
|
HASH_FIELD_IPV4_L3_L4, /* IPv4 src/dst addr + L4 src/dst ports */
|
|
HASH_FIELD_IPV6_L3, /* IPv6 src/dst addr */
|
|
HASH_FIELD_IPV6_L3_L4, /* IPv6 src/dst addr + L4 src/dst ports */
|
|
HASH_FIELD_L2_SRC, /* Ethernet src addr */
|
|
HASH_FIELD_L2_DST, /* Ethernet dst addr */
|
|
HASH_FIELD_L3_SRC, /* L3 src addr */
|
|
HASH_FIELD_L3_DST, /* L3 dst addr */
|
|
HASH_FIELD_L4_SRC, /* TCP/UDP src ports */
|
|
HASH_FIELD_L4_DST, /* TCP/UDP dst ports */
|
|
};
|
|
|
|
struct rss_key {
|
|
__u8 key[128];
|
|
__u32 hash_fields;
|
|
__u32 key_size;
|
|
__u32 queues[TAP_MAX_QUEUES];
|
|
__u32 nb_queues;
|
|
} __attribute__((packed));
|
|
|
|
#endif /* _TAP_RSS_H_ */
|