[dpdk-dev] [PATCH v1] Modify and modularize l3fwd code
Ravi Kerur
rkerur at gmail.com
Tue Dec 22 00:11:51 CET 2015
Many thanks to Intel team (Konstantin, Bruce and Declan) for below proposal to
make changes to l3fwd code, their valuable inputs during interal review and help
in performance tests.
The main problem with l3fwd is that it is too monolithic with everything being
in one file, and the various options all controlled by compile time flags. This
means that it's hard to read and understand, and when making any changes, you need
to go to a lot of work to try and ensure you cover all the code paths, since a
compile of the app will not touch large parts of the l3fwd codebase.
Following changes were done to fix the issues mentioned above
> Split out the various lpm and hash specific functionality into separate
files, so that l3fwd code has one file for common code e.g. args
processing, mempool creation, and then individual files for the various
forwarding approaches.
Following are new file lists
main.c (Common code for args processing, memppol creation, etc)
l3fwd_em.c (Hash/Exact match aka 'EM' functionality)
l3fwd_em_sse.h (SSE4_1 buffer optimizated 'EM' code)
l3fwd_lpm.c (Longest Prefix Match aka 'LPM' functionality)
l3fwd_lpm_sse.h (SSE4_1 buffer optimizated 'LPM' code)
l3fwd.h (Common include for 'EM' and 'LPM')
> The choosing of the lpm/hash path should be done at runtime, not
compile time, via a command-line argument. This will ensure that
both code paths get compiled in a single go
Following examples show runtime options provided
Select 'LPM' or 'EM' based on run time selection f.e.
> l3fwd -c 0x1 -n 1 -- -p 0x1 -E ... (EM)
> l3fwd -c 0x1 -n 1 -- -p 0x1 -L ... (LPM)
Options "E" and "L" are mutualy-exclusive.
If none selected, "L" is default.
Ravi Kerur (1):
Modify and modularize l3fwd code
examples/l3fwd/Makefile | 9 +-
examples/l3fwd/l3fwd.h | 209 ++++
examples/l3fwd/l3fwd_em.c | 773 ++++++++++++++
examples/l3fwd/l3fwd_em_sse.h | 479 +++++++++
examples/l3fwd/l3fwd_lpm.c | 414 ++++++++
examples/l3fwd/l3fwd_lpm_sse.h | 610 +++++++++++
examples/l3fwd/main.c | 2202 ++++------------------------------------
7 files changed, 2694 insertions(+), 2002 deletions(-)
create mode 100644 examples/l3fwd/l3fwd.h
create mode 100644 examples/l3fwd/l3fwd_em.c
create mode 100644 examples/l3fwd/l3fwd_em_sse.h
create mode 100644 examples/l3fwd/l3fwd_lpm.c
create mode 100644 examples/l3fwd/l3fwd_lpm_sse.h
--
1.9.1
More information about the dev
mailing list