Skip to contentSkip to conversation

net/tap: remove kernel side RSS via BPF

RFC New Stephen Hemminger 1 participant 1 message Dec 15, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 net/tap: remove kernel side RSS via BPF

The support of BPF in TAP device was problematic since the API to BPF in kernel is not stable and keeps changing.

Since the RTE_FLOW_ACTION_TYPE_RSS is the only part using this remove support for kernel side flow remapping.

---
 doc/guides/nics/tap.rst               |   74 --
 drivers/net/tap/bpf/Makefile          |   19 -
 drivers/net/tap/bpf/bpf_api.h         |  276 ----
 drivers/net/tap/bpf/bpf_elf.h         |   53 -
 drivers/net/tap/bpf/bpf_extract.py    |   86 --
 drivers/net/tap/bpf/tap_bpf_program.c |  255 ----
 drivers/net/tap/meson.build           |    5 -
 drivers/net/tap/rte_eth_tap.h         |    5 +-
 drivers/net/tap/tap_bpf.h             |  121 --
 drivers/net/tap/tap_bpf_api.c         |  190 ---
 drivers/net/tap/tap_bpf_insns.h       | 1743 -------------------------
 drivers/net/tap/tap_flow.c            |  496 +------
 drivers/net/tap/tap_flow.h            |   12 -
 drivers/net/tap/tap_tcmsgs.h          |    3 -
 14 files changed, 4 insertions(+), 3334 deletions(-)
 delete mode 100644 drivers/net/tap/bpf/Makefile
 delete mode 100644 drivers/net/tap/bpf/bpf_api.h
 delete mode 100644 drivers/net/tap/bpf/bpf_elf.h
 delete mode 100644 drivers/net/tap/bpf/bpf_extract.py
 delete mode 100644 drivers/net/tap/bpf/tap_bpf_program.c
 delete mode 100644 drivers/net/tap/tap_bpf.h
 delete mode 100644 drivers/net/tap/tap_bpf_api.c
 delete mode 100644 drivers/net/tap/tap_bpf_insns.h
doc/guides/nics/tap.rst +0 -74
index d4f45c02a1e5..5779f5d08e31 100644
@@ -123,7 +123,6 @@ Supported actions:
 - DROP
 - QUEUE
 - PASSTHRU
-- RSS (requires kernel 4.9)
 
 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.
@@ -153,10 +152,6 @@ Drop UDP packets in vlan 3::
    testpmd> flow create 0 priority 3 ingress pattern eth / vlan vid is 3 / \
             ipv4 proto is 17 / end actions drop / end
 
-Distribute IPv4 TCP packets using RSS to a given MAC address over queues 0-3::
-
-   testpmd> flow create 0 priority 4 ingress pattern eth dst is 0a:0b:0c:0d:0e:0f \
-            / ipv4 / tcp / end actions rss queues 0 1 2 3 end / end
 
 Multi-process sharing
 ---------------------
@@ -227,80 +222,11 @@ size of the packets after you stop the traffic. Use pktgen ``help``
 command to see a list of all commands. You can also use the ``-f`` option to
 load commands at startup in command line or Lua script in pktgen.
 
-RSS specifics
--------------
-Packet distribution in TAP is done by the kernel which has a default
-distribution. This feature is adding RSS distribution based on eBPF code.
-The default eBPF code calculates RSS hash based on Toeplitz algorithm for
-a fixed RSS key. It is calculated on fixed packet offsets. For IPv4 and IPv6 it
-is calculated over src/dst addresses (8 or 32 bytes for IPv4 or IPv6
-respectively) and src/dst TCP/UDP ports (4 bytes).
-
-The RSS algorithm is written in file ``tap_bpf_program.c`` which
-does not take part in TAP PMD compilation. Instead this file is compiled
-in advance to eBPF object file. The eBPF object file is then parsed and
-translated into eBPF byte code in the format of C arrays of eBPF
-instructions. The C array of eBPF instructions is part of TAP PMD tree and
-is taking part in TAP PMD compilation. At run time the C arrays are uploaded to
-the kernel via BPF system calls and the RSS hash is calculated by the
-kernel.
-
-It is possible to support different RSS hash algorithms by updating file
-``tap_bpf_program.c``  In order to add a new RSS hash algorithm follow these
-steps:
-
-#. Write the new RSS implementation in file ``tap_bpf_program.c``
-
-   BPF programs which are uploaded to the kernel correspond to
-   C functions under different ELF sections.
-
-#. Install ``LLVM`` library and ``clang`` compiler versions 3.7 and above
-
-#. Use make to compile  `tap_bpf_program.c`` via ``LLVM`` into an object file
-   and extract the resulting instructions into ``tap_bpf_insn.h``::
-
-    cd bpf; make
-
-#. Recompile the TAP PMD.
-
-The C arrays are uploaded to the kernel using BPF system calls.
-
-``tc`` (traffic control) is a well known user space utility program used to
-configure the Linux kernel packet scheduler. It is usually packaged as
-part of the ``iproute2`` package.
-Since commit 11c39b5e9 ("tc: add eBPF support to f_bpf") ``tc`` can be used
-to uploads eBPF code to the kernel and can be patched in order to print the
-C arrays of eBPF instructions just before calling the BPF system call.
-Please refer to ``iproute2`` package file ``lib/bpf.c`` function
-``bpf_prog_load()``.
-
-An example utility for eBPF instruction generation in the format of C arrays will
-be added in next releases
-
-TAP reports on supported RSS functions as part of dev_infos_get callback:
-``RTE_ETH_RSS_IP``, ``RTE_ETH_RSS_UDP`` and ``RTE_ETH_RSS_TCP``.
-**Known limitation:** TAP supports all of the above hash functions together
-and not in partial combinations.
 
 Systems supporting flow API
 ---------------------------
 
 - "tc flower" classifier requires linux kernel above 4.2
-- eBPF/RSS requires linux kernel above 4.9
-
-+--------------------+-----------------------+
-| RH7.3              | No flow rule support  |
-+--------------------+-----------------------+
-| RH7.4              | No RSS action support |
-+--------------------+-----------------------+
-| RH7.5              | No RSS action support |
-+--------------------+-----------------------+
-| SLES 15,           | No limitation         |
-| kernel 4.12        |                       |
-+--------------------+-----------------------+
-| Azure Ubuntu 16.04,| No limitation         |
-| kernel 4.13        |                       |
-+--------------------+-----------------------+
 
 Limitations
 -----------
drivers/net/tap/bpf/Makefile deleted +0 -19
deleted file mode 100644
index 9efeeb1bc704..000000000000
@@ -1,19 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# This file is not built as part of normal DPDK build.
-# It is used to generate the eBPF code for TAP RSS.
-
-CLANG=clang
-CLANG_OPTS=-O2
-TARGET=../tap_bpf_insns.h
-
-all: $(TARGET)
-
-clean:
-	rm tap_bpf_program.o $(TARGET)
-
-tap_bpf_program.o: tap_bpf_program.c
-	$(CLANG) $(CLANG_OPTS) -emit-llvm -c $< -o - | \
-	llc -march=bpf -filetype=obj -o $@
-
-$(TARGET): tap_bpf_program.o
-	python3 bpf_extract.py -stap_bpf_program.c -o $@ $<
drivers/net/tap/bpf/bpf_api.h deleted +0 -276

276 lines not on this page · raw message

drivers/net/tap/bpf/bpf_elf.h deleted +0 -53

53 lines not on this page · raw message

drivers/net/tap/bpf/bpf_extract.py deleted +0 -86

86 lines not on this page · raw message

drivers/net/tap/bpf/tap_bpf_program.c deleted +0 -255

255 lines not on this page · raw message

drivers/net/tap/meson.build +0 -5
index 5099ccdff11b..f83f460a7808 100644
@@ -7,7 +7,6 @@ if not is_linux
 endif
 sources = files(
         'rte_eth_tap.c',
-        'tap_bpf_api.c',
         'tap_flow.c',
         'tap_intr.c',
         'tap_netlink.c',
@@ -25,10 +24,6 @@ cflags += '-DTAP_MAX_QUEUES=16'
 args = [
         [ 'HAVE_TC_FLOWER', 'linux/pkt_cls.h', 'TCA_FLOWER_UNSPEC' ],
         [ 'HAVE_TC_VLAN_ID', 'linux/pkt_cls.h', 'TCA_FLOWER_KEY_VLAN_PRIO' ],
-        [ 'HAVE_TC_BPF', 'linux/pkt_cls.h', 'TCA_BPF_UNSPEC' ],
-        [ 'HAVE_TC_BPF_FD', 'linux/pkt_cls.h', 'TCA_BPF_FD' ],
-        [ 'HAVE_TC_ACT_BPF', 'linux/tc_act/tc_bpf.h', 'TCA_ACT_BPF_UNSPEC' ],
-        [ 'HAVE_TC_ACT_BPF_FD', 'linux/tc_act/tc_bpf.h', 'TCA_ACT_BPF_FD' ],
 ]
 config = configuration_data()
 foreach arg:args
drivers/net/tap/rte_eth_tap.h +1 -4
index 5ac93f93e961..e19824583651 100644
@@ -79,11 +79,8 @@ struct pmd_internals {
 	int flow_isolate;                 /* 1 if flow isolation is enabled */
 	int flower_support;               /* 1 if kernel supports, else 0 */
 	int flower_vlan_support;          /* 1 if kernel supports, else 0 */
-	int rss_enabled;                  /* 1 if RSS is enabled, else 0 */
 	int persist;			  /* 1 if keep link up, else 0 */
-	/* implicit rules set when RSS is enabled */
-	int map_fd;                       /* BPF RSS map fd */
-	int bpf_fd[RTE_PMD_TAP_MAX_QUEUES];/* List of bpf fds per queue */
+
 	LIST_HEAD(tap_rss_flows, rte_flow) rss_flows;
 	LIST_HEAD(tap_flows, rte_flow) flows;        /* rte_flow rules */
 	/* implicit rte_flow rules set when a remote device is active */
drivers/net/tap/tap_bpf.h deleted +0 -121

121 lines not on this page · raw message

drivers/net/tap/tap_bpf_api.c deleted +0 -190

190 lines not on this page · raw message

drivers/net/tap/tap_bpf_insns.h deleted +0 -1743

1,743 lines not on this page · raw message

drivers/net/tap/tap_flow.c +3 -493

131 lines not on this page · raw message

drivers/net/tap/tap_flow.h +0 -12
index 240fbc3dfaef..099704437b2f 100644

Lines of this file are not shown. View the raw message.

drivers/net/tap/tap_tcmsgs.h +0 -3
index a64cb29d6fa8..4b0413579749 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.