Commit Graph

117 Commits

Author SHA1 Message Date
Bruce Richardson
cd93ec8961 pipeline: fix missing header includes
The stdio.h header needs to be included to get the definition of the
FILE type.

Fixes: b32c0a2c5e ("pipeline: add SWX table update high level API")
Fixes: 3ca60ceed7 ("pipeline: add SWX pipeline specification file")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-01-21 10:27:47 +01:00
Cristian Dumitrescu
27cc077922 pipeline: fix multiple SWX emit pattern detection
Fix the detection of instruction pattern with multiple emits followed
by TX. Once detected, this is one of the instruction patterns that is
internally replaced with a single optimized instruction, as long as
none of the instructions to be replaced is referenced by a jump
instruction. The fix enforces this check for the TX instruction of
the pattern.

Fixes: 31035e87b2 ("pipeline: add SWX instruction optimizer")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-11-15 16:46:37 +01:00
Venkata Suresh Kumar P
2ceb0974ee pipeline: increase SWX immediate operand size
This patch increases the immediate operand size from 32 to 64 bits.

Signed-off-by: Venkata Suresh Kumar P <venkata.suresh.kumar.p@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-11-02 21:38:27 +01:00
Cristian Dumitrescu
0dde44843b pipeline: fix string copy into fixed size buffer
Fix potential buffer overflows by string copy into fixed size buffer.

Coverity issue: 362732, 362736, 362760, 362772, 362775, 362784
Coverity issue: 362800, 362803, 362806, 362811, 362814, 362816
Coverity issue: 362834, 362837, 362844, 362845, 362857, 362861
Coverity issue: 362868, 362890, 362893, 362904, 362905
Fixes: 56492fd536 ("pipeline: add new SWX pipeline type")
Fixes: 1e4c88caea ("pipeline: add SWX extern objects and funcs")
Fixes: e9d870dd93 ("pipeline: add SWX pipeline tables")
Fixes: a1711f948d ("pipeline: add SWX Rx and extract instructions")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-29 17:32:49 +01:00
Bruce Richardson
63b3907833 build: remove library name from version map file name
Since each version map file is contained in the subdirectory of the library
it refers to, there is no need to include the library name in the filename.
This makes things simpler in case of library renaming.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Rosen Xu <rosen.xu@intel.com>
2020-10-19 22:13:59 +02:00
Churchill Khangar
ccbbb7f23f pipeline: fix SWX jump instruction parsing
This patch fixes the jump if not valid header instruction parsing.

Fixes: b3947e25be ("pipeline: introduce SWX jump and return instructions")

Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-19 09:20:25 +02:00
Venkata Suresh Kumar P
1e17748b0a pipeline: fix SWX jump instruction population
This patch fixes jump next instruction pointer population.

Fixes: b3947e25be ("pipeline: introduce SWX jump and return instructions")

Signed-off-by: Venkata Suresh Kumar P <venkata.suresh.kumar.p@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-19 09:20:25 +02:00
Cristian Dumitrescu
f63ba2005e pipeline: fix instruction config free
Coverity issue: 362901
Fixes: a1711f948d ("pipeline: add SWX Rx and extract instructions")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-08 15:09:28 +02:00
Cristian Dumitrescu
941717ffe1 pipeline: fix unused variable
Coverity issue: 362855
Fixes: 75634474ca ("pipeline: add SWX instruction verifier")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-08 15:09:28 +02:00
Cristian Dumitrescu
0ebe8c38a3 pipeline: fix memory free
Coverity issue: 362796, 362804, 362819, 362836, 362858, 362865, 362869
Fixes: 3ca60ceed7 ("pipeline: add SWX pipeline specification file")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-08 15:09:25 +02:00
Cristian Dumitrescu
c0c9dcef88 pipeline: fix argument check
Coverity issue: 362789
Fixes: 3ca60ceed7 ("pipeline: add SWX pipeline specification file")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-08 15:04:55 +02:00
Cristian Dumitrescu
faa4536684 pipeline: fix resource leak
Coverity issue: 362812
Fixes: b32c0a2c5e ("pipeline: add SWX table update high level API")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-08 15:01:07 +02:00
Cristian Dumitrescu
bacfdd908d pipeline: fix memory leak
Coverity issue: 362741
Fixes: b32c0a2c5e ("pipeline: add SWX table update high level API")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-08 15:00:42 +02:00
David Marchand
2a8be2ff75 pipeline: fix build with glibc < 2.26
reallocarray has been introduced in glibc 2.26 but we still support
glibc >= 2.7.
Simply replace with realloc, as the considered sizes are unlikely to
overflow.

"""
The reallocarray() function changes the size of the memory block
pointed to by ptr to be large enough for an array of nmemb elements,
each of which is size bytes.  It is equivalent to the call

       realloc(ptr, nmemb * size);

However, unlike that realloc() call, reallocarray() fails safely in
the case where the multiplication would overflow.  If such an over‐
flow occurs, reallocarray() returns NULL, sets errno to ENOMEM, and
leaves the original block of memory unchanged.
"""

Fixes: 3ca60ceed7 ("pipeline: add SWX pipeline specification file")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-02 13:49:16 +02:00
Cristian Dumitrescu
3ca60ceed7 pipeline: add SWX pipeline specification file
Add support for building the SWX pipeline based on specification file
with syntax aligned to the P4 language. The specification file may be
generated by the P4C compiler in the future.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
b32c0a2c5e pipeline: add SWX table update high level API
High-level transaction-oriented API for SWX pipeline table updates. It
supports multi-table atomic updates, i.e. multiple tables can be
updated in a single step with only the before and after table set
visible to the packets. Uses the lower-level table update mechanisms.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
e87cf5d85e pipeline: add SWX pipeline flush
Flush the packets currently buffered by the SWX pipeline output ports.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
393b96e2aa pipeline: add SWX pipeline query API
Query API to be used by the control plane to detect the configuration
and state of the SWX pipeline and its internal objects.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
31035e87b2 pipeline: add SWX instruction optimizer
Instruction optimizer. Detects frequent patterns and replaces them
with some more powerful vector-like pipeline instructions without any
user effort. Executes at instruction translation, not at run-time.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
75634474ca pipeline: add SWX instruction verifier
Instruction verifier. Executes at instruction translation time during
SWX pipeline build, i.e. at initialization instead of run-time.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
11a86e2268 pipeline: add SWX instruction description
Added SWX instruction set reference table.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
b3947e25be pipeline: introduce SWX jump and return instructions
The jump instructions are either unconditional (jmp) or conditional on
positive/negative tests such as header validity (jmpv/jmpnv), table
lookup hit/miss (jmph/jmpnh), executed action (jmpa/jmpna), equality
(jmpeq/jmpneq), comparison result (jmplt/jmpgt). The return
instruction resumes the pipeline execution after action subroutine.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
c6b752cdf2 pipeline: introduce SWX extern instruction
The extern instruction calls one of the member functions of a given
extern object or it calls the given extern function. The function
arguments must be written in advance to the mailbox. The results
are available in the same place after execution.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
6077ae611d pipeline: introduce SWX table instruction
The table instruction looks up the input key into the table and then
it triggers the execution of the action found in the table entry. On
lookup miss, the default table action is executed.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
e0f51638b7 pipeline: introduce SWX SHR instruction
The shr (i.e. shift right) instruction source can be header field (H),
meta-data field (M), extern object (E) or function (F) mailbox field,
table entry action data field (T) or immediate value (I). The
destination is HMEF.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
b09ba6d0a3 pipeline: introduce SWX SHL instruction
The shl (i.e. shift left) instruction source can be header field (H),
meta-data field (M), extern object (E) or function (F) mailbox field,
table entry action data field (T) or immediate value (I). The
destination is HMEF.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
b4e607f9fd pipeline: introduce SWX XOR instruction
The xor (i.e. bitwise exclusive or) instruction source can be header
field (H), meta-data field (M), extern object (E) or function (F)
mailbox field, table entry action data field (T) or immediate value
(I). The destination is HMEF.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
8f796198dc pipeline: introduce SWX or instruction
The or (i.e. bitwise or) instruction source can be header field (H),
meta-data field (M), extern object (E) or function (F) mailbox field,
table entry action data field (T) or immediate value (I). The
destination is HMEF.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
650195cf96 pipeline: introduce SWX and instruction
The and (i.e. bitwise and) instruction source can be header field (H),
meta-data field (M), extern object (E) or function (F) mailbox field,
table entry action data field (T) or immediate value (I). The
destination is HMEF.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
1e6bf5997c pipeline: introduce SWX cksub instruction
The cksub (i.e. checksum subtract) instruction is used to update the
1's complement sum commonly used by protocols such as IPv4, TCP or
UDP.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
7aa4569822 pipeline: introduce SWX ckadd instruction
The ckadd (i.e. checksum add) instruction is used to either compute,
verify or update the 1's complement sum commonly used by protocols
such as IPv4, TCP or UDP.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:08 +02:00
Cristian Dumitrescu
c88c629438 pipeline: introduce SWX subtract instruction
The sub (i.e. subtract) instruction source can be header field (H),
meta-data field (M), extern object (E) or function (F) mailbox field,
table entry action data field (T) or immediate value (I). The
destination is HMEF.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
baf7999303 pipeline: introduce SWX add instruction
The add instruction source can be header field (H), meta-data field
(M), extern object (E) or function (F) mailbox field, table entry
action data field (T) or immediate value (I). The destination is HMEF.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
8319c47c5f pipeline: add SWX DMA instruction
The DMA instruction handles the bulk read transfer of one header from
the table entry action data. Typically used to generate headers, i.e.
headers that are not extracted from the input packet.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
7210349d5b pipeline: add SWX move instruction
The mov (i.e. move) instruction source can be header field (H),
meta-data field (M), extern object (E) or function (F) mailbox field,
table entry action data field (T) or immediate value (I). The
destination is HMEF.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
27e48ec92f pipeline: add header validate and invalidate SWX instructions
Add instructions to flag a header as valid or invalid. This flag can
be tested by the jmpv (jump if header valid) and jmpnv (jump if header
not valid) instructions.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
99abed441d pipeline: add SWX Tx and emit instructions
Add header emit and packet transmission instructions. Emit adds to the
output packet a header that is either generated (e.g. read from table
entry by action) or extracted from the input packet. Tx ends the
pipeline processing; discard is implemented by tx to special port.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
a1711f948d pipeline: add SWX Rx and extract instructions
Add packet reception and header extraction instructions. The Rx must
be the first pipeline instruction. Each extracted header is logically
removed from the packet, then it can be read/written by instructions,
emitted into the outgoing packet or discarded.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
7d666cfa96 pipeline: add SWX pipeline instructions
The SWX pipeline instructions represent the main program that defines
the life of the packet. As packets go through tables that trigger
action subroutines, the headers and meta-data get transformed along
the way.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
e9d870dd93 pipeline: add SWX pipeline tables
Add tables to the SWX pipeline. The match fields are flexibly selected
from the headers and meta-data. The set of table actions is flexibly
selected for each table from the set of pipeline actions.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
85af61ba62 pipeline: add SWX pipeline action
Add SWX actions that are dynamically-defined through instructions as
opposed to pre-defined. The actions are subroutines of the pipeline
program that triggered by table lookup. The input arguments are the
action data from the table entry (format defined by struct), the
headers and meta-data are in/out.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
1e4c88caea pipeline: add SWX extern objects and funcs
Add extern objects and functions to plug into the SWX pipeline any
functionality that cannot be efficiently implemented with existing
instructions, e.g. special checksum/ECC, crypto, meters, stats arrays,
heuristics, etc. In/out arguments are passed through mailbox with
format defined by struct.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
e719fe9e95 pipeline: add SWX headers and meta-data
Add support for dynamically-defined packet headers and meta-data to
the SWX pipeline. The header and meta-data format are defined by the
struct type they instantiate.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
99a0ba8f4c pipeline: add SWX pipeline output port
Add output ports to the newly introduced SWX pipeline type. Each port
instantiates a port type that defines the port operations, e.g. ethdev
port, PCAP port, etc. The TX interface is single packet, with packet
batching internally for performance.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
6e0ca01c93 pipeline: add SWX pipeline input port
Add input ports to the newly introduced SWX pipeline type. Each port
instantiates a port type that defines the port operations, e.g. ethdev
port, PCAP port, etc. The RX interface is single packet, with packet
batching internally for performance.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:07 +02:00
Cristian Dumitrescu
56492fd536 pipeline: add new SWX pipeline type
Add new improved Software Switch (SWX) pipeline type that supports
dynamically-defined packet headers, meta-data, actions and pipelines.
Actions and pipelines are defined through instructions.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-01 18:43:06 +02:00
Ciara Power
3cc6ecfdfe build: remove makefiles
A decision was made [1] to no longer support Make in DPDK, this patch
removes all Makefiles that do not make use of pkg-config, along with
the mk directory previously used by make.

[1] https://mails.dpdk.org/archives/dev/2020-April/162839.html

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2020-09-08 00:09:50 +02:00
Thomas Monjalon
4f86c0ba19 version: 20.11-rc0
Start a new release cycle with empty release notes.

The ABI version becomes 21.0.
The ABI major is back to normal, having only one number (21 vs 20.0).
The map files are updated to the new ABI major number (21).
The ABI exceptions are dropped.
Travis ABI check is disabled because compatibility is not preserved.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
2020-08-12 11:32:16 +02:00
Thomas Monjalon
ef5baf3486 replace packed attributes
There is a common macro __rte_packed for packing structs,
which is now used where appropriate for consistency.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2020-04-16 18:16:46 +02:00
Thomas Monjalon
f35e5b3e07 replace alignment attributes
There is a common macro __rte_aligned for alignment,
which is now used where appropriate for consistency.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
2020-04-16 18:16:18 +02:00