Commit Graph

4 Commits

Author SHA1 Message Date
Ferruh Yigit
b74fd6b842 add missing static keyword to globals
Some global variables can indeed be static, add static keyword to them.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-10-29 02:01:08 +01:00
Shahaf Shuler
5feecc57d9 align SPDX Mellanox copyrights
Aligning Mellanox SPDX copyrights to a single format.
In addition replace to SPDX licence files which were missed.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-04-11 01:47:47 +02:00
Ophir Munk
54aad2f231 net/tap: fix eBPF handling of non-RSS flows
The eBPF classifier (section "cls_q" in tap_bpf_program.c) is tracing
marked packets in which skb->cb[1] contains an RSS queue number, and
redirects those packets to the matched queue.
It is expected that skb->cb[1] has been previously set with a valid RSS
queue number during an eBPF action (section "l3_l4" in tap_bpf_program.c).
However, for non-RSS flows, skb->cb[1] may contain a random unset value,
which could falsely be interpreted as a valid RSS queue.
To avoid this potential error, tap_bpf_program.c has been updated as
follows:
1. After calculating the RSS queue number, it is added a unique offset in
order to uniquely identify it as a valid RSS queue number.
2. After matching an RSS queue to a packet, skb->cb[1] is set to 0.

Fixes: cdc07e83bb ("net/tap: add eBPF program file")
Fixes: aabe70df73 ("net/tap: add eBPF bytes code")

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Pascal Mazon <pascal.mazon@6wind.com>
2018-02-05 19:56:04 +01:00
Ophir Munk
aabe70df73 net/tap: add eBPF bytes code
File tap_bpf_insns.h was added. It includes  eBPF bytes code
which corresponds to source file tap_bpf_program.c
(see "net/tap: add eBPF program file").
The bytes code is in the format of C arrays of struct bpf_insn and
was generated from the C file tap_bpf_program.c
1. The C file was compiled via LLVM into an object file in ELF
format as:
   clang -O2 -emit-llvm -c tap_bpf_program.c -o - | llc -march=bpf \
   -filetype=obj -o <tap_bpf_program.o>

clang version must be 3.7 and above
The C functions are under different ELF sections and are considered
different BPF programs to be downloaded to the kernel

2. Using an external tool the ELF sections are parsed and the C arrays
of struct bpf_insn are generated. Each C array (corresponding to a
different function under an ELF section) is downloaded to the kernel
using an BPF systm call. The external tool that generates the C arrays
will be added in separate commits.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Pascal Mazon <pascal.mazon@6wind.com>
2018-01-21 15:51:52 +01:00