Commit Graph

46 Commits (5c686af149a02f415221556a6c72f6e5f99c5230)

Author SHA1 Message Date
Lukas Sismis c65ff35819 dpdk: max cache size should be lower than one of the constraints
Ticket: 6741
2 years ago
Lukas Sismis cc2eb2d8b7 dpdk: sanitize integer overflow in the configuration
Ticket: #6737
2 years ago
Lukas Sismis 2a2898053c dpdk: add interrupt (power-saving) mode
When the packet load is low, Suricata can run in interrupt
mode. This more resembles the classic approach of processing
packets - CPU cores run low and only fetch packets
on interrupt.

Ticket: #5839
2 years ago
Lukas Sismis 9dc83b6a43 dpdk: add hugepage hint on low number of hugepages
If a user doesn't allocate/allocates too little hugepages,
Suricata fails to start and outputs a hint to increase
number of hugepages (if enabled).

Ticket: #5966
2 years ago
Victor Julien becb8cefcc threading: set min thread stack size; set it early
Multi-tenancy uses loader threads that initialize detection engines. During
this, esp the AC family of MPM implementations, there is significant stack
usage. In most OS' threads have a lower stack size by default. In Linux, when
using the Musl C library, a thread by default gets 128KiB.

This patch does 2 things:

1. it centralizes the handling of the `threading.stack-size`. It it is not
   longer handled by the runmodes, but called from the global initialization
   logic.

2. it sets a minimum per thread stack size of 512k, unless `threading.stack-size`
   is set.

Ticket: #6265.
2 years ago
Lukas Sismis ff8bbda53b dpdk: treat unknown socket ID as a valid socket ID
Ticket: #6232
2 years ago
Lukas Sismis 223356bfb5 dpdk: fix DPDK thread check for IPS mode
Ticket: #6233
2 years ago
Lukas Sismis 2fdc0e497e dpdk: refactor log messages
Be more consistent with the log message format,
remove some unnecessary device name queries.

Ticket: #6116
2 years ago
Lukas Sismis 3d54a103d0 dpdk: improve DPDK thread handling
Ticket: #6106
2 years ago
liaozhiyuan a748164d58 dpdk: support multiple same EAL arguments
DPDK apps can specify multiple arguments of the same
type. YAML format only allows unique keys within a single
node. This commit adds support for multiple EAL arguments
of the same type to be used within suricata.yaml.

Ticket: #5964
2 years ago
Lukas Sismis c4b0c2888d dpdk: add support for DPDK Bond PMD
Ticket: #6099
2 years ago
Lukas Sismis 2feece601a dpdk: add debug dump of RX offload capabilities 2 years ago
Lukas Sismis a9b2f79070 dpdk: refactor i40e RSS hash function
Setting rss_conf->rss_key to NULL and rss_key_len
to zero avoids warnings about register changes
when setting up RSS configuration through RTE flows.
2 years ago
Lukas Sismis adb427a15c dpdk: minor refactoring in error handling and variable declaration 2 years ago
Lukas Sismis a331726eef dpdk: update version checking to DPDK-intended version checking API
Ticket: #5937
2 years ago
Lukas Sismis b6f7693e86 dpdk: release mempool after the device is closed
Ticket: #5936
2 years ago
Lukas Sismis 15a61f02a0 dpdk: fix multibit comparison
Ticket: #5925
2 years ago
Lukas Sismis 95abe11a92 dpdk: fix DPDK API change on NUMA/socket retrieval
Ticket: #5923
2 years ago
Victor Julien 8d016fe3ed dpdk: minor output fixup
Thanks to Josh Soref.
2 years ago
Victor Julien 8dc58a6e9d capture: spelling 2 years ago
Victor Julien ea67a2edd2 dpdk: fix scan-build warnings
runmode-dpdk.c:204:18: warning: Result of 'calloc' is converted to a pointer of type 'char *', which is incompatible with sizeof operand type 'ptrdiff_t' [unix.MallocSizeof]
    args->argv = SCCalloc(capacity, sizeof(ptrdiff_t)); // alloc array of pointers
                 ^~~~~~~~           ~~~~~~~~~~~~~~~~~
./util-mem.h:36:18: note: expanded from macro 'SCCalloc'
 #define SCCalloc calloc
                  ^~~~~~
runmode-dpdk.c:278:16: warning: Result of 'malloc' is converted to a pointer of type 'char *', which is incompatible with sizeof operand type 'char **' [unix.MallocSizeof]
    eal_argv = SCMalloc(args.argc * sizeof(args.argv));
               ^~~~~~~~             ~~~~~~~~~~~~~~~~~
./util-mem.h:35:18: note: expanded from macro 'SCMalloc'
 #define SCMalloc malloc
                  ^~~~~~
2 warnings generated.
2 years ago
Lukas Sismis e2a5bc7961 dpdk: add support for enabling IPS support in DPDK mode 3 years ago
Lukas Sismis bed16ba44c runmodes: change function prototype of runmode init functions
Commit contains prototype changes of RunModeSetLiveCaptureAutoFp and
RunModeSetLiveCaptureWorkers functions to move the IPS enable logic
out of suricata.c file.
3 years ago
Lukas Sismis ee4f75e4b4 dpdk: port deprecated DPDK macros to the newer forms 3 years ago
Lukas Sismis cb6fa894ef dpdk: add a check for HW checksum validation offload
Ticket: #5553
3 years ago
Victor Julien ebd8728219 src: fix strict-prototype warnings
Tested on Fedora 37 with clang 15.

app-layer.c:1055:27: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerSetupCounters()
                          ^
                           void
app-layer.c:1176:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerDeSetupCounters()
                            ^
                             void
2 errors generated.
3 years ago
Victor Julien 597601b294 dpdk: don't "fix" broken ips setting 3 years ago
Victor Julien 4e945351a5 dpdk: output cleanups 3 years ago
Victor Julien b31ffde6f4 output: remove error codes from output 3 years ago
Victor Julien 39f5c7f56a error: use SC_EINVAL for invalid input 3 years ago
Victor Julien e042cd785e error: use SC_ENOMEM for alloc errors 3 years ago
Victor Julien c78ebd1352 dpdk: set RSS flags for igb driver
Tested on i340.
3 years ago
Victor Julien b08e3e7460 dpdk: ips output cleanups 3 years ago
Victor Julien 58c28d1778 dpdk: fix cppcheck warnings
src/runmode-dpdk.c:202:11: warning: Size of pointer 'argv' used instead of size of its data. This is likely to lead to a buffer overflow. You probably intend to write 'sizeof(*argv)'. [pointerSize]
    args->argv = SCCalloc(capacity, sizeof(args->argv));
          ^
src/runmode-dpdk.c:777:23: error: Shifting 32-bit value by 63 bits is undefined behaviour [shiftTooManyBits]
        if (bits & (1 << i))
                      ^
src/runmode-dpdk.c:776:23: note: Assuming that condition 'i<64' is not redundant
    for (int i = 0; i < 64; i++) {
                      ^
src/runmode-dpdk.c:777:23: note: Shift
        if (bits & (1 << i))
                      ^
3 years ago
Lukas Sismis 563f8bb56b dpdk: decrease intensity of warnings related to NUMA placement
Ticket: #5617
3 years ago
Victor Julien f1068bbb08 dpdk: fix timestamp issues
Each thread had its own version of the `machine_start_time`, which
lead to slight time differences. This became apparent mostly in IPS,
where 2 threads each process a side of the flow.

This patch makes the `machine_start_time` global.
3 years ago
Lukas Sismis 5365fdccf7 dpdk: fix mempool cache error message 3 years ago
Lukas Sismis aeb690317a dpdk: allow specifying RSS hash function flags in the config
Ticket: #5400
3 years ago
Victor Julien 39cf5b151a src: includes cleanup
Work towards making `suricata-common.h` only introduce system headers
and other things that are independent of complex internal Suricata
data structures.

Update files to compile after this.

Remove special DPDK handling for strlcpy and strlcat, as this caused
many compilation failures w/o including DPDK headers for all files.

Remove packet macros from decode.h and move them into their own file,
turn them into functions and rename them to match our function naming
policy.
3 years ago
Philippe Antoine 02f2602dde src: rework includes as per cppclean 3 years ago
Lukas Sismis f668524731 dpdk: adjust setting of MTU to the new DPDK API (21.11) 4 years ago
Lukas Sismis de53e07559 dpdk/ice: setup RSS for Intel ICE PMD
Set RSS hash function according to Intel ICE PMD available hash functions

Set hash functions according to the support by the ICE PMD, so that no warning
regarding RSS setting is issued.
4 years ago
Lukas Sismis 3f7a50eeb7 dpdk/ixgbe: setup RSS for Intel IXGBE PMD
Set RSS hash function according to Intel IXGBE PMD available hash functions.

During configuration, a warning appeared stating that RSS hash function
has been changed from one value to the other. This has meant that
the supported hash functions did not cover all required hash functions
by the configuration. This commit solves the warning.
4 years ago
Lukas Sismis 639aa04c5f dpdk/i40e: support RSS on Intel i40e PMD driver
Due to peculiar behavior of i40e PMD driver, the RSS is required to be set
via rte_flow rules or a hash filter as compared to other NICs where RSS is
configured through port configuration structure.
RTE_FLOW rules are created on 5-tuples (as opposed to 3-tuple configured
on the other NICs). Fragmented traffic have been tested with this setup
and it has been proven that fragmented packets of the same flow are
received on the same queue. At the same time, setting 3-tuple on rte_flow
rules have not yield in the expected results.

Notes from the experiments:

- Configuration of 5-tuple (as is in the commit):
    fragmented and nonfragmented packets are received by the same workers
    even when I applied seed to alter them via tcpreplay-edit (option --seed)

- Setting only ETH_RSS_FRAG_IPV4 and ETH_RSS_IPV4 (i.e. setting 3-tuple):
    when setting ETH_RSS_IPV4, the PMD driver says that pctype is not
    supported (generally this means that the "type" of traffic is not
    a valid configuration for the i40e)

- Setting only ETH_RSS_FRAG_IPV4 and ETH_RSS_NONFRAG_IPV4_OTHER:
    this doesn't work well, packets of the same flow are received on
    the different workers (my explanation is that the fragmented packets are
    matched with ETH_RSS_FRAG_IPV4 but the other UDP packets are not matched
    with ETH_RSS_NONFRAG_IPV4_OTHER rte_flow rule (they would be matched with
    ETH_RSS_NONFRAG_IPV4_UDP).
4 years ago
Victor Julien f98df5c3fd dpdk: add RSS flags that are set in the NIC 4 years ago
Lukas Sismis a7faed1245 dpdk: initial support with workers runmode
Register a new runmode - DPDK. This enables a new flag on Suricata start
(--dpdk).

With the flag given, DPDK runmode is enabled.

Runmode loads the configuration and then initializes EAL.

If successful, it configures the physical NICs according to the configuration
file. After that, worker threads are initialized and then are in continuous
receive loop.
4 years ago