suricata
source-napatech.c File Reference
#include "suricata-common.h"
#include "action-globals.h"
#include "decode.h"
#include "packet.h"
#include "suricata.h"
#include "threadvars.h"
#include "util-datalink.h"
#include "util-optimize.h"
#include "tm-queuehandlers.h"
#include "tm-threads.h"
#include "tm-modules.h"
#include "util-privs.h"
#include "tmqh-packetpool.h"
#include "util-napatech.h"
#include "source-napatech.h"
#include "runmode-napatech.h"
#include <numa.h>
#include <nt.h>
Include dependency graph for source-napatech.c:

Go to the source code of this file.

Data Structures

struct  NapatechThreadVars_
 
struct  NapatechNumaDetect_
 

Typedefs

typedef struct NapatechThreadVars_ NapatechThreadVars
 
typedef struct NapatechNumaDetect_ NapatechNumaDetect
 

Functions

TmEcode NapatechStreamThreadInit (ThreadVars *tv, const void *initdata, void **data)
 Initialize the Napatech receiver thread, generate a single NapatechThreadVar structure for each thread, this will contain a NtNetStreamRx_t stream handle which is used when the thread executes to acquire the packets. More...
 
void NapatechStreamThreadExitStats (ThreadVars *tv, void *data)
 Print some stats to the log at program exit. More...
 
TmEcode NapatechPacketLoop (ThreadVars *tv, void *data, void *slot)
 Main Napatechpacket processing loop. More...
 
TmEcode NapatechDecodeThreadInit (ThreadVars *tv, const void *initdata, void **data)
 Initialization of Napatech Thread. More...
 
TmEcode NapatechDecodeThreadDeinit (ThreadVars *tv, void *data)
 Deinitialization of Napatech Thread. More...
 
TmEcode NapatechDecode (ThreadVars *tv, Packet *p, void *data)
 This function passes off to link type decoders. More...
 
 SC_ATOMIC_DECLARE (uint64_t, total_packets)
 
 SC_ATOMIC_DECLARE (uint64_t, total_drops)
 
 SC_ATOMIC_DECLARE (uint16_t, total_tallied)
 
 SC_ATOMIC_DECLARE (uint16_t, stream_count)
 
 SC_ATOMIC_DECLARE (uint64_t, flow_callback_cnt)
 
 SC_ATOMIC_DECLARE (uint64_t, flow_callback_handled_pkts)
 
 SC_ATOMIC_DECLARE (uint64_t, flow_callback_udp_pkts)
 
 SC_ATOMIC_DECLARE (uint64_t, flow_callback_tcp_pkts)
 
 SC_ATOMIC_DECLARE (uint64_t, flow_callback_unhandled_pkts)
 
void TmModuleNapatechStreamRegister (void)
 Register the Napatech receiver (reader) module. More...
 
void TmModuleNapatechDecodeRegister (void)
 Register the Napatech decoder module. More...
 
TmEcode NapatechStreamThreadDeinit (ThreadVars *tv, void *data)
 Deinitializes the NAPATECH card. More...
 

Variables

uint16_t max_pending_packets
 
NapatechNumaDetectnuma_detect = NULL
 

Detailed Description

Definition in file source-napatech.c.

Typedef Documentation

◆ NapatechNumaDetect

◆ NapatechThreadVars

Function Documentation

◆ NapatechDecode()

TmEcode NapatechDecode ( ThreadVars tv,
Packet p,
void *  data 
)

This function passes off to link type decoders.

NapatechDecode decodes packets from Napatech and passes them off to the proper link type decoder.

Parameters
tpointer to ThreadVars
ppointer to the current packet
datapointer that gets cast into PcapThreadVars for ptv

Definition at line 1064 of file source-napatech.c.

References BUG_ON, Packet_::datalink, DecodeEthernet(), DecodeUpdatePacketCounters(), dtv, GET_PKT_DATA, GET_PKT_LEN, LINKTYPE_ETHERNET, PacketDecodeFinalize(), PKT_IS_PSEUDOPKT, SCEnter, SCLogError, SCReturnInt, TM_ECODE_OK, and tv.

Referenced by TmModuleNapatechDecodeRegister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NapatechDecodeThreadDeinit()

TmEcode NapatechDecodeThreadDeinit ( ThreadVars tv,
void *  data 
)

Deinitialization of Napatech Thread.

Parameters
tvpointer to ThreadVars
datapointer that gets cast into DecoderThreadVars

Definition at line 1116 of file source-napatech.c.

References DecodeThreadVarsFree(), SCReturnInt, TM_ECODE_OK, and tv.

Referenced by TmModuleNapatechDecodeRegister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NapatechDecodeThreadInit()

TmEcode NapatechDecodeThreadInit ( ThreadVars tv,
const void *  initdata,
void **  data 
)

Initialization of Napatech Thread.

Parameters
tpointer to ThreadVars
initdata- unused.
datapointer that gets cast into DecoderThreadVars

Definition at line 1096 of file source-napatech.c.

References DecodeRegisterPerfCounters(), DecodeThreadVarsAlloc(), dtv, SCEnter, SCReturnInt, TM_ECODE_FAILED, TM_ECODE_OK, and tv.

Referenced by TmModuleNapatechDecodeRegister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NapatechPacketLoop()

TmEcode NapatechPacketLoop ( ThreadVars tv,
void *  data,
void *  slot 
)

Main Napatechpacket processing loop.

Parameters
tvThread variable to ThreadVars
dataPointer to NapatechThreadVars with data specific to Napatech
slotTMSlot where this instance is running.

Definition at line 794 of file source-napatech.c.

References ConfGetBool(), MAX_ADAPTERS, NapatechUseHWBypass(), and NapatechThreadVars_::stream_id.

Referenced by TmModuleNapatechStreamRegister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NapatechStreamThreadDeinit()

TmEcode NapatechStreamThreadDeinit ( ThreadVars tv,
void *  data 
)

Deinitializes the NAPATECH card.

Parameters
tvpointer to ThreadVars
datapointer that gets cast into PcapThreadVars for ptv

Definition at line 1043 of file source-napatech.c.

References NapatechThreadVars_::rx_stream, SCEnter, SCLogDebug, SCReturnInt, NapatechThreadVars_::stream_id, and TM_ECODE_OK.

Referenced by TmModuleNapatechStreamRegister().

Here is the caller graph for this function:

◆ NapatechStreamThreadExitStats()

void NapatechStreamThreadExitStats ( ThreadVars tv,
void *  data 
)

Print some stats to the log at program exit.

Parameters
tvPointer to ThreadVars.
dataPointer to data, ErfFileThreadVars.

Definition at line 1001 of file source-napatech.c.

References NapatechCurrentStats_::current_bytes, NapatechCurrentStats_::current_drop_packets, NapatechCurrentStats_::current_packets, NapatechGetCurrentStats(), NapatechGetNumConfiguredStreams(), SC_ATOMIC_ADD, SC_ATOMIC_GET, SCLogInfo, and NapatechThreadVars_::stream_id.

Referenced by TmModuleNapatechStreamRegister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NapatechStreamThreadInit()

TmEcode NapatechStreamThreadInit ( ThreadVars tv,
const void *  initdata,
void **  data 
)

Initialize the Napatech receiver thread, generate a single NapatechThreadVar structure for each thread, this will contain a NtNetStreamRx_t stream handle which is used when the thread executes to acquire the packets.

Parameters
tvThread variable to ThreadVars
initdataInitial data to the adapter passed from the user, this is processed by the user.

For now, we assume that we have only a single name for the NAPATECH adapter.

Parameters
datadata pointer gets populated with

Definition at line 672 of file source-napatech.c.

References DatalinkSetGlobalType(), FatalError, LINKTYPE_ETHERNET, SCCalloc, SCEnter, SCLogDebug, SCReturnInt, NapatechStreamDevConf::stream_id, NapatechThreadVars_::stream_id, TM_ECODE_OK, tv, NapatechThreadVars_::tv, and unlikely.

Referenced by TmModuleNapatechStreamRegister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SC_ATOMIC_DECLARE() [1/9]

SC_ATOMIC_DECLARE ( uint16_t  ,
stream_count   
)

◆ SC_ATOMIC_DECLARE() [2/9]

SC_ATOMIC_DECLARE ( uint16_t  ,
total_tallied   
)

◆ SC_ATOMIC_DECLARE() [3/9]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_cnt   
)

◆ SC_ATOMIC_DECLARE() [4/9]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_handled_pkts   
)

◆ SC_ATOMIC_DECLARE() [5/9]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_tcp_pkts   
)

◆ SC_ATOMIC_DECLARE() [6/9]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_udp_pkts   
)

◆ SC_ATOMIC_DECLARE() [7/9]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_unhandled_pkts   
)

◆ SC_ATOMIC_DECLARE() [8/9]

SC_ATOMIC_DECLARE ( uint64_t  ,
total_drops   
)

◆ SC_ATOMIC_DECLARE() [9/9]

SC_ATOMIC_DECLARE ( uint64_t  ,
total_packets   
)

◆ TmModuleNapatechDecodeRegister()

void TmModuleNapatechDecodeRegister ( void  )

Register the Napatech decoder module.

Definition at line 192 of file source-napatech.c.

References TmModule_::cap_flags, TmModule_::flags, TmModule_::Func, TmModule_::name, NapatechDecode(), NapatechDecodeThreadDeinit(), NapatechDecodeThreadInit(), TmModule_::ThreadDeinit, TmModule_::ThreadExitPrintStats, TmModule_::ThreadInit, TM_FLAG_DECODE_TM, TMM_DECODENAPATECH, and tmm_modules.

Referenced by RegisterAllModules().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmModuleNapatechStreamRegister()

void TmModuleNapatechStreamRegister ( void  )

Variable Documentation

◆ numa_detect

NapatechNumaDetect* numa_detect = NULL

Definition at line 121 of file source-napatech.c.