Re: [PATCH v8 0/7] eBPF RSS support for virtio-net.

2021-05-14 Thread no-reply
Patchew URL: https://patchew.org/QEMU/20210514114835.267316-1-and...@daynix.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210514114835.267316-1-and...@daynix.com
Subject: [PATCH v8 0/7] eBPF RSS support for virtio-net.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag] patchew/20210514114835.267316-1-and...@daynix.com -> 
patchew/20210514114835.267316-1-and...@daynix.com
Switched to a new branch 'test'
1619e1f MAINTAINERS: Added eBPF maintainers information.
aba59a3 docs: Added eBPF documentation.
14a875c virtio-net: Added eBPF RSS to virtio-net.
cd612cb ebpf: Added eBPF RSS loader.
b5ded54 ebpf: Added eBPF RSS program.
cedb364 net: Added SetSteeringEBPF method for NetClientState.
d3b32d3 net/tap: Added TUNSETSTEERINGEBPF code.

=== OUTPUT BEGIN ===
1/7 Checking commit d3b32d3868ff (net/tap: Added TUNSETSTEERINGEBPF code.)
2/7 Checking commit cedb3648f753 (net: Added SetSteeringEBPF method for 
NetClientState.)
3/7 Checking commit b5ded54bcb50 (ebpf: Added eBPF RSS program.)
Use of uninitialized value $acpi_testexpected in string eq at 
./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#22: 
new file mode 100755

total: 0 errors, 1 warnings, 593 lines checked

Patch 3/7 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/7 Checking commit cd612cb859b2 (ebpf: Added eBPF RSS loader.)
Use of uninitialized value $acpi_testexpected in string eq at 
./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#71: 
new file mode 100644

WARNING: architecture specific defines should be avoided
#353: FILE: ebpf/rss.bpf.skeleton.h:4:
+#ifndef __RSS_BPF_SKEL_H__

ERROR: code indent should never use tabs
#360: FILE: ebpf/rss.bpf.skeleton.h:11:
+^Istruct bpf_object_skeleton *skeleton;$

ERROR: code indent should never use tabs
#361: FILE: ebpf/rss.bpf.skeleton.h:12:
+^Istruct bpf_object *obj;$

ERROR: code indent should never use tabs
#362: FILE: ebpf/rss.bpf.skeleton.h:13:
+^Istruct {$

ERROR: code indent should never use tabs
#363: FILE: ebpf/rss.bpf.skeleton.h:14:
+^I^Istruct bpf_map *tap_rss_map_configurations;$

ERROR: code indent should never use tabs
#364: FILE: ebpf/rss.bpf.skeleton.h:15:
+^I^Istruct bpf_map *tap_rss_map_indirection_table;$

ERROR: code indent should never use tabs
#365: FILE: ebpf/rss.bpf.skeleton.h:16:
+^I^Istruct bpf_map *tap_rss_map_toeplitz_key;$

ERROR: code indent should never use tabs
#366: FILE: ebpf/rss.bpf.skeleton.h:17:
+^I} maps;$

ERROR: code indent should never use tabs
#367: FILE: ebpf/rss.bpf.skeleton.h:18:
+^Istruct {$

ERROR: code indent should never use tabs
#368: FILE: ebpf/rss.bpf.skeleton.h:19:
+^I^Istruct bpf_program *tun_rss_steering_prog;$

ERROR: code indent should never use tabs
#369: FILE: ebpf/rss.bpf.skeleton.h:20:
+^I} progs;$

ERROR: code indent should never use tabs
#370: FILE: ebpf/rss.bpf.skeleton.h:21:
+^Istruct {$

ERROR: code indent should never use tabs
#371: FILE: ebpf/rss.bpf.skeleton.h:22:
+^I^Istruct bpf_link *tun_rss_steering_prog;$

ERROR: code indent should never use tabs
#372: FILE: ebpf/rss.bpf.skeleton.h:23:
+^I} links;$

ERROR: code indent should never use tabs
#378: FILE: ebpf/rss.bpf.skeleton.h:29:
+^Iif (!obj)$

ERROR: braces {} are necessary for all arms of this statement
#378: FILE: ebpf/rss.bpf.skeleton.h:29:
+   if (!obj)
[...]

ERROR: code indent should never use tabs
#379: FILE: ebpf/rss.bpf.skeleton.h:30:
+^I^Ireturn;$

ERROR: code indent should never use tabs
#380: FILE: ebpf/rss.bpf.skeleton.h:31:
+^Iif (obj->skeleton)$

ERROR: braces {} are necessary for all arms of this statement
#380: FILE: ebpf/rss.bpf.skeleton.h:31:
+   if (obj->skeleton)
[...]

ERROR: code indent should never use tabs
#381: FILE: ebpf/rss.bpf.skeleton.h:32:
+^I^Ibpf_object__destroy_skeleton(obj->skeleton);$

ERROR: code indent should never use tabs
#382: FILE: ebpf/rss.bpf.skeleton.h:33:
+^Ifree(obj);$

ERROR: code indent should never use tabs
#391: FILE: ebpf/rss.bpf.skeleton.h:42:
+^Istruct rss_bpf *obj;$

ERROR: code indent should never use tabs
#393: FILE: ebpf/rss.bpf.skeleton.h:44:
+^Iobj = (struct rss_bpf *)calloc(1, sizeof(*obj));$

ERROR: code indent should never use tabs
#394: FILE: ebpf/rss.bpf.skeleton.h:45:
+^Iif (!obj)$

ERROR: braces {} are necessary for all arms of this statement
#394: FILE: ebpf/rss.bpf.skeleton.h:45:
+   if (!obj)
[...]

ERROR: code indent should never use tabs
#395: FILE: ebpf/r

[PATCH v8 0/7] eBPF RSS support for virtio-net.

2021-05-14 Thread Andrew Melnychenko
This set of patches introduces the usage of eBPF for packet steering
and RSS hash calculation:
* RSS(Receive Side Scaling) is used to distribute network packets to
guest virtqueues by calculating packet hash
* Additionally adding support for the usage of RSS with vhost

The eBPF works on kernels 5.8+
On earlier kerneld it fails to load and the RSS feature is reported
only without vhost and implemented in 'in-qemu' software.

Implementation notes:
Linux TAP TUNSETSTEERINGEBPF ioctl was used to set the eBPF program.
Added libbpf dependency and eBPF support.
The eBPF program is part of the qemu and presented as an array
of BPF ELF file data. The eBPF array file initially generated by bpftool.
The compilation of eBPF is not part of QEMU build and can be done
using provided Makefile.ebpf.
Added changes to virtio-net and vhost, primary eBPF RSS is used.
'in-qemu' RSS used in the case of hash population and as a fallback option.
For vhost, the hash population feature is not reported to the guest.

Please also see the documentation in PATCH 6/7.

Known issues:
* hash population not supported by eBPF RSS: 'in-qemu' RSS used
as a fallback, also, hash population feature is not reported to guests
with vhost.
* IPv6 extensions still in progress.

Changes since v1:
* using libbpf instead of direct 'bpf' system call.
* added libbpf dependency to the configure/meson scripts.
* changed python script for eBPF .h file generation.
* changed eBPF program - reading L3 proto from ethernet frame.
* added TUNSETSTEERINGEBPF define for TUN.
* changed the maintainer's info.
* added license headers.
* refactored code.

Changes since v2:
* using bpftool for eBPF skeleton generation.
* ebpf_rss is refactored to use skeleton generated by bpftool.
* added/adjasted license in comment sections and in eBPF file.
* rss.bpf.c and Makefile.ebpf moved to the tool/ebpf folder.
* virtio-net eBPF rss refactored. Now eBPF initialized during realize().

Changes since v3:
* rebased to last master.
* fixed issue with failed build without libbpf.
* fixed ebpf loading without rss option.
* refactored labels in ebpf_rss.c

Changes since v4:
* refactored configure/meson script.
* added checks for load_bytes in ebpf.
* documentation added to the index.
* refactored Makefile and rss.bpf.c.
* rebased to last master.

Changes since v5:
* fixed issue with dstopt parsing in the eBPF program.
* added fragment packet parsing to skip L4.

Changes since v6:
* Added eBPF skeleton check to the meson.build file.

Changes since v7:
* Refactored code style and fixed warnings.
* Added explicit pkg-config method for libbpf dependency.

Andrew Melnychenko (7):
  net/tap: Added TUNSETSTEERINGEBPF code.
  net: Added SetSteeringEBPF method for NetClientState.
  ebpf: Added eBPF RSS program.
  ebpf: Added eBPF RSS loader.
  virtio-net: Added eBPF RSS to virtio-net.
  docs: Added eBPF documentation.
  MAINTAINERS: Added eBPF maintainers information.

 MAINTAINERS|   8 +
 configure  |   8 +-
 docs/devel/ebpf_rss.rst| 125 
 docs/devel/index.rst   |   1 +
 ebpf/ebpf_rss-stub.c   |  40 +++
 ebpf/ebpf_rss.c| 165 ++
 ebpf/ebpf_rss.h|  44 +++
 ebpf/meson.build   |   1 +
 ebpf/rss.bpf.skeleton.h| 431 +
 ebpf/trace-events  |   4 +
 ebpf/trace.h   |   2 +
 hw/net/vhost_net.c |   3 +
 hw/net/virtio-net.c| 116 ++-
 include/hw/virtio/virtio-net.h |   4 +
 include/net/net.h  |   2 +
 meson.build|  23 ++
 meson_options.txt  |   2 +
 net/tap-bsd.c  |   5 +
 net/tap-linux.c|  13 +
 net/tap-linux.h|   1 +
 net/tap-solaris.c  |   5 +
 net/tap-stub.c |   5 +
 net/tap.c  |   9 +
 net/tap_int.h  |   1 +
 net/vhost-vdpa.c   |   2 +
 tools/ebpf/Makefile.ebpf   |  22 ++
 tools/ebpf/rss.bpf.c   | 571 +
 27 files changed, 1609 insertions(+), 4 deletions(-)
 create mode 100644 docs/devel/ebpf_rss.rst
 create mode 100644 ebpf/ebpf_rss-stub.c
 create mode 100644 ebpf/ebpf_rss.c
 create mode 100644 ebpf/ebpf_rss.h
 create mode 100644 ebpf/meson.build
 create mode 100644 ebpf/rss.bpf.skeleton.h
 create mode 100644 ebpf/trace-events
 create mode 100644 ebpf/trace.h
 create mode 100755 tools/ebpf/Makefile.ebpf
 create mode 100644 tools/ebpf/rss.bpf.c

-- 
2.31.1