suricata
source-napatech.c File Reference
#include "suricata-common.h"
#include "suricata.h"
#include "threadvars.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 <numa.h>
#include <nt.h>
Include dependency graph for source-napatech.c:

Go to the source code of this file.

Data Structures

struct  NapatechThreadVars_
 

Typedefs

typedef struct NapatechThreadVars_ NapatechThreadVars
 

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 (uint16_t, numa0_count)
 
 SC_ATOMIC_DECLARE (uint16_t, numa1_count)
 
 SC_ATOMIC_DECLARE (uint16_t, numa2_count)
 
 SC_ATOMIC_DECLARE (uint16_t, numa3_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

int max_pending_packets
 

Detailed Description

Definition in file source-napatech.c.

Typedef Documentation

◆ 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 1058 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, SC_ERR_DATALINK_UNIMPLEMENTED, 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 1111 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 1091 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 746 of file source-napatech.c.

References ConfGetBool(), 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 1037 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 995 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 622 of file source-napatech.c.

References NapatechStreamDevConf::hba, NapatechThreadVars_::hba, SC_ERR_MEM_ALLOC, SCCalloc, SCEnter, SCLogDebug, SCLogError, SCReturnInt, NapatechStreamDevConf::stream_id, NapatechThreadVars_::stream_id, TM_ECODE_OK, tv, NapatechThreadVars_::tv, and unlikely.

Referenced by TmModuleNapatechStreamRegister().

Here is the caller graph for this function:

◆ SC_ATOMIC_DECLARE() [1/13]

SC_ATOMIC_DECLARE ( uint16_t  ,
numa0_count   
)

◆ SC_ATOMIC_DECLARE() [2/13]

SC_ATOMIC_DECLARE ( uint16_t  ,
numa1_count   
)

◆ SC_ATOMIC_DECLARE() [3/13]

SC_ATOMIC_DECLARE ( uint16_t  ,
numa2_count   
)

◆ SC_ATOMIC_DECLARE() [4/13]

SC_ATOMIC_DECLARE ( uint16_t  ,
numa3_count   
)

◆ SC_ATOMIC_DECLARE() [5/13]

SC_ATOMIC_DECLARE ( uint16_t  ,
stream_count   
)

◆ SC_ATOMIC_DECLARE() [6/13]

SC_ATOMIC_DECLARE ( uint16_t  ,
total_tallied   
)

◆ SC_ATOMIC_DECLARE() [7/13]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_cnt   
)

◆ SC_ATOMIC_DECLARE() [8/13]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_handled_pkts   
)

◆ SC_ATOMIC_DECLARE() [9/13]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_tcp_pkts   
)

◆ SC_ATOMIC_DECLARE() [10/13]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_udp_pkts   
)

◆ SC_ATOMIC_DECLARE() [11/13]

SC_ATOMIC_DECLARE ( uint64_t  ,
flow_callback_unhandled_pkts   
)

◆ SC_ATOMIC_DECLARE() [12/13]

SC_ATOMIC_DECLARE ( uint64_t  ,
total_drops   
)

◆ SC_ATOMIC_DECLARE() [13/13]

SC_ATOMIC_DECLARE ( uint64_t  ,
total_packets   
)

◆ TmModuleNapatechDecodeRegister()

void TmModuleNapatechDecodeRegister ( void  )

Register the Napatech decoder module.

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

References TmModule_::cap_flags, TmModule_::flags, TmModule_::Func, TmModule_::name, NapatechDecode(), NapatechDecodeThreadDeinit(), NapatechDecodeThreadInit(), TmModule_::RegisterTests, 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()