counters: make increment call take threadvars

This hides the implementation from the caller.
pull/1508/head
Victor Julien 12 years ago
parent 9a8bff7d96
commit e9b067c1eb

@ -81,9 +81,9 @@ void HTPDecrMemuse(uint64_t size)
void HTPMemuseCounter(ThreadVars *tv, TcpReassemblyThreadCtx *trt) void HTPMemuseCounter(ThreadVars *tv, TcpReassemblyThreadCtx *trt)
{ {
uint64_t tmpval = SC_ATOMIC_GET(htp_memuse); uint64_t tmpval = SC_ATOMIC_GET(htp_memuse);
SCPerfCounterSetUI64(trt->counter_htp_memuse, tv->perf_private_ctx, tmpval); SCPerfCounterSetUI64(tv, trt->counter_htp_memuse, tmpval);
tmpval = SC_ATOMIC_GET(htp_memcap); tmpval = SC_ATOMIC_GET(htp_memcap);
SCPerfCounterSetUI64(trt->counter_htp_memcap, tv->perf_private_ctx, tmpval); SCPerfCounterSetUI64(tv, trt->counter_htp_memcap, tmpval);
return; return;
} }
/** /**

@ -78,12 +78,9 @@ static void DNSUpdateCounters(ThreadVars *tv, AppLayerThreadCtx *app_tctx)
DNSMemcapGetCounters(&memuse, &memcap_state, &memcap_global); DNSMemcapGetCounters(&memuse, &memcap_state, &memcap_global);
SCPerfCounterSetUI64(app_tctx->counter_dns_memuse, SCPerfCounterSetUI64(tv, app_tctx->counter_dns_memuse, memuse);
tv->perf_private_ctx, memuse); SCPerfCounterSetUI64(tv, app_tctx->counter_dns_memcap_state, memcap_state);
SCPerfCounterSetUI64(app_tctx->counter_dns_memcap_state, SCPerfCounterSetUI64(tv, app_tctx->counter_dns_memcap_global, memcap_global);
tv->perf_private_ctx, memcap_state);
SCPerfCounterSetUI64(app_tctx->counter_dns_memcap_global,
tv->perf_private_ctx, memcap_global);
} }
/***** L7 layer dispatchers *****/ /***** L7 layer dispatchers *****/

@ -79,8 +79,10 @@ void SCPerfOutputCounters(ThreadVars *tv)
* \param pca Counter array that holds the local counter for this TM * \param pca Counter array that holds the local counter for this TM
* \param x Value to add to this local counter * \param x Value to add to this local counter
*/ */
void SCPerfCounterAddUI64(uint16_t id, SCPerfPrivateContext *pca, uint64_t x) void SCPerfCounterAddUI64(ThreadVars *tv, uint16_t id, uint64_t x)
{ {
SCPerfPrivateContext *pca = tv->perf_private_ctx;
if (!pca) { if (!pca) {
SCLogDebug("counterarray is NULL"); SCLogDebug("counterarray is NULL");
return; return;
@ -99,8 +101,10 @@ void SCPerfCounterAddUI64(uint16_t id, SCPerfPrivateContext *pca, uint64_t x)
* \param id Index of the counter in the counter array * \param id Index of the counter in the counter array
* \param pca Counter array that holds the local counters for this TM * \param pca Counter array that holds the local counters for this TM
*/ */
void SCPerfCounterIncr(uint16_t id, SCPerfPrivateContext *pca) void SCPerfCounterIncr(ThreadVars *tv, uint16_t id)
{ {
SCPerfPrivateContext *pca = tv->perf_private_ctx;
if (pca == NULL) { if (pca == NULL) {
SCLogDebug("counterarray is NULL"); SCLogDebug("counterarray is NULL");
return; return;
@ -122,9 +126,10 @@ void SCPerfCounterIncr(uint16_t id, SCPerfPrivateContext *pca)
* \param pca Pointer to the SCPerfPrivateContext * \param pca Pointer to the SCPerfPrivateContext
* \param x The value to set for the counter * \param x The value to set for the counter
*/ */
void SCPerfCounterSetUI64(uint16_t id, SCPerfPrivateContext *pca, void SCPerfCounterSetUI64(ThreadVars *tv, uint16_t id, uint64_t x)
uint64_t x)
{ {
SCPerfPrivateContext *pca = tv->perf_private_ctx;
if (!pca) { if (!pca) {
SCLogDebug("counterarray is NULL"); SCLogDebug("counterarray is NULL");
return; return;
@ -1435,10 +1440,10 @@ static int SCPerfTestCntArraySize07()
SCPerfRegisterCounter("t2", "c2", SC_PERF_TYPE_UINT64, NULL, SCPerfRegisterCounter("t2", "c2", SC_PERF_TYPE_UINT64, NULL,
&tv.perf_public_ctx); &tv.perf_public_ctx);
pca = SCPerfGetAllCountersArray(&tv.perf_public_ctx); pca = tv.perf_private_ctx = SCPerfGetAllCountersArray(&tv.perf_public_ctx);
SCPerfCounterIncr(1, pca); SCPerfCounterIncr(&tv, 1);
SCPerfCounterIncr(2, pca); SCPerfCounterIncr(&tv, 2);
result = pca->size; result = pca->size;
@ -1460,10 +1465,10 @@ static int SCPerfTestUpdateCounter08()
id = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64, NULL, id = SCPerfRegisterCounter("t1", "c1", SC_PERF_TYPE_UINT64, NULL,
&tv.perf_public_ctx); &tv.perf_public_ctx);
pca = SCPerfGetAllCountersArray(&tv.perf_public_ctx); pca = tv.perf_private_ctx = SCPerfGetAllCountersArray(&tv.perf_public_ctx);
SCPerfCounterIncr(id, pca); SCPerfCounterIncr(&tv, id);
SCPerfCounterAddUI64(id, pca, 100); SCPerfCounterAddUI64(&tv, id, 100);
result = pca->head[id].ui64_cnt; result = pca->head[id].ui64_cnt;
@ -1493,10 +1498,10 @@ static int SCPerfTestUpdateCounter09()
id2 = SCPerfRegisterCounter("t5", "c5", SC_PERF_TYPE_UINT64, NULL, id2 = SCPerfRegisterCounter("t5", "c5", SC_PERF_TYPE_UINT64, NULL,
&tv.perf_public_ctx); &tv.perf_public_ctx);
pca = SCPerfGetAllCountersArray(&tv.perf_public_ctx); pca = tv.perf_private_ctx = SCPerfGetAllCountersArray(&tv.perf_public_ctx);
SCPerfCounterIncr(id2, pca); SCPerfCounterIncr(&tv, id2);
SCPerfCounterAddUI64(id2, pca, 100); SCPerfCounterAddUI64(&tv, id2, 100);
result = (pca->head[id1].ui64_cnt == 0) && (pca->head[id2].ui64_cnt == 101); result = (pca->head[id1].ui64_cnt == 0) && (pca->head[id2].ui64_cnt == 101);
@ -1523,12 +1528,12 @@ static int SCPerfTestUpdateGlobalCounter10()
id3 = SCPerfRegisterCounter("t3", "c3", SC_PERF_TYPE_UINT64, NULL, id3 = SCPerfRegisterCounter("t3", "c3", SC_PERF_TYPE_UINT64, NULL,
&tv.perf_public_ctx); &tv.perf_public_ctx);
pca = SCPerfGetAllCountersArray(&tv.perf_public_ctx); pca = tv.perf_private_ctx = SCPerfGetAllCountersArray(&tv.perf_public_ctx);
SCPerfCounterIncr(id1, pca); SCPerfCounterIncr(&tv, id1);
SCPerfCounterAddUI64(id2, pca, 100); SCPerfCounterAddUI64(&tv, id2, 100);
SCPerfCounterIncr(id3, pca); SCPerfCounterIncr(&tv, id3);
SCPerfCounterAddUI64(id3, pca, 100); SCPerfCounterAddUI64(&tv, id3, 100);
SCPerfUpdateCounterArray(pca, &tv.perf_public_ctx); SCPerfUpdateCounterArray(pca, &tv.perf_public_ctx);
@ -1561,12 +1566,12 @@ static int SCPerfTestCounterValues11()
id4 = SCPerfRegisterCounter("t4", "c4", SC_PERF_TYPE_UINT64, NULL, id4 = SCPerfRegisterCounter("t4", "c4", SC_PERF_TYPE_UINT64, NULL,
&tv.perf_public_ctx); &tv.perf_public_ctx);
pca = SCPerfGetAllCountersArray(&tv.perf_public_ctx); pca = tv.perf_private_ctx = SCPerfGetAllCountersArray(&tv.perf_public_ctx);
SCPerfCounterIncr(id1, pca); SCPerfCounterIncr(&tv, id1);
SCPerfCounterAddUI64(id2, pca, 256); SCPerfCounterAddUI64(&tv, id2, 256);
SCPerfCounterAddUI64(id3, pca, 257); SCPerfCounterAddUI64(&tv, id3, 257);
SCPerfCounterAddUI64(id4, pca, 16843024); SCPerfCounterAddUI64(&tv, id4, 16843024);
SCPerfUpdateCounterArray(pca, &tv.perf_public_ctx); SCPerfUpdateCounterArray(pca, &tv.perf_public_ctx);

@ -171,13 +171,13 @@ void SCPerfReleaseResources(void);
void SCPerfReleasePerfCounterS(SCPerfCounter *); void SCPerfReleasePerfCounterS(SCPerfCounter *);
void SCPerfReleasePCA(SCPerfPrivateContext *); void SCPerfReleasePCA(SCPerfPrivateContext *);
void SCPerfCounterSetUI64(uint16_t, SCPerfPrivateContext *, uint64_t); void SCPerfCounterSetUI64(struct ThreadVars_ *, uint16_t, uint64_t);
void SCPerfCounterIncr(uint16_t, SCPerfPrivateContext *); void SCPerfCounterIncr(struct ThreadVars_ *, uint16_t);
void SCPerfRegisterTests(void); void SCPerfRegisterTests(void);
/* functions used to update local counter values */ /* functions used to update local counter values */
void SCPerfCounterAddUI64(uint16_t, SCPerfPrivateContext *, uint64_t); void SCPerfCounterAddUI64(struct ThreadVars_ *, uint16_t, uint64_t);
#define SCPerfSyncCounters(tv) \ #define SCPerfSyncCounters(tv) \
SCPerfUpdateCounterArray((tv)->perf_private_ctx, &(tv)->perf_public_ctx); \ SCPerfUpdateCounterArray((tv)->perf_private_ctx, &(tv)->perf_public_ctx); \

@ -41,7 +41,7 @@
int DecodeEthernet(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, int DecodeEthernet(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
uint8_t *pkt, uint16_t len, PacketQueue *pq) uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_eth, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_eth);
if (unlikely(len < ETHERNET_HEADER_LEN)) { if (unlikely(len < ETHERNET_HEADER_LEN)) {
ENGINE_SET_INVALID_EVENT(p, ETHERNET_PKT_TOO_SMALL); ENGINE_SET_INVALID_EVENT(p, ETHERNET_PKT_TOO_SMALL);

@ -48,7 +48,7 @@ int DecodeGRE(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, ui
uint16_t header_len = GRE_HDR_LEN; uint16_t header_len = GRE_HDR_LEN;
GRESreHdr *gsre = NULL; GRESreHdr *gsre = NULL;
SCPerfCounterIncr(dtv->counter_gre, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_gre);
if(len < GRE_HDR_LEN) { if(len < GRE_HDR_LEN) {
ENGINE_SET_INVALID_EVENT(p, GRE_PKT_TOO_SMALL); ENGINE_SET_INVALID_EVENT(p, GRE_PKT_TOO_SMALL);

@ -153,7 +153,7 @@ void DecodePartialIPV4( Packet* p, uint8_t* partial_packet, uint16_t len )
*/ */
int DecodeICMPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodeICMPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_icmpv4, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_icmpv4);
if (len < ICMPV4_HEADER_LEN) { if (len < ICMPV4_HEADER_LEN) {
ENGINE_SET_INVALID_EVENT(p, ICMPV4_PKT_TOO_SMALL); ENGINE_SET_INVALID_EVENT(p, ICMPV4_PKT_TOO_SMALL);

@ -168,7 +168,7 @@ int DecodeICMPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
uint8_t *pkt, uint16_t len, PacketQueue *pq) uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
int full_hdr = 0; int full_hdr = 0;
SCPerfCounterIncr(dtv->counter_icmpv6, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_icmpv6);
if (len < ICMPV6_HEADER_LEN) { if (len < ICMPV6_HEADER_LEN) {
SCLogDebug("ICMPV6_PKT_TOO_SMALL"); SCLogDebug("ICMPV6_PKT_TOO_SMALL");

@ -519,7 +519,7 @@ static int DecodeIPV4Packet(Packet *p, uint8_t *pkt, uint16_t len)
int DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_ipv4, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_ipv4);
SCLogDebug("pkt %p len %"PRIu16"", pkt, len); SCLogDebug("pkt %p len %"PRIu16"", pkt, len);

@ -65,7 +65,7 @@ static void DecodeIPv4inIPv6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, u
PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV6); PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV6);
/* add the tp to the packet queue. */ /* add the tp to the packet queue. */
PacketEnqueue(pq,tp); PacketEnqueue(pq,tp);
SCPerfCounterIncr(dtv->counter_ipv4inipv6, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_ipv4inipv6);
return; return;
} }
} }
@ -92,7 +92,7 @@ static int DecodeIP6inIP6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint
if (tp != NULL) { if (tp != NULL) {
PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV6); PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV6);
PacketEnqueue(pq,tp); PacketEnqueue(pq,tp);
SCPerfCounterIncr(dtv->counter_ipv6inipv6, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_ipv6inipv6);
} }
} }
} else { } else {
@ -601,7 +601,7 @@ int DecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, u
{ {
int ret; int ret;
SCPerfCounterIncr(dtv->counter_ipv6, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_ipv6);
/* do the actual decoding */ /* do the actual decoding */
ret = DecodeIPV6Packet (tv, dtv, p, pkt, len); ret = DecodeIPV6Packet (tv, dtv, p, pkt, len);

@ -51,7 +51,7 @@ int DecodeMPLS(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt,
int label; int label;
int event = 0; int event = 0;
SCPerfCounterIncr(dtv->counter_mpls, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_mpls);
do { do {
if (len < MPLS_HEADER_LEN) { if (len < MPLS_HEADER_LEN) {

@ -47,7 +47,7 @@
int DecodeNull(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodeNull(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_null, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_null);
if (unlikely(len < HDR_SIZE)) { if (unlikely(len < HDR_SIZE)) {
ENGINE_SET_INVALID_EVENT(p, LTNULL_PKT_TOO_SMALL); ENGINE_SET_INVALID_EVENT(p, LTNULL_PKT_TOO_SMALL);

@ -42,7 +42,7 @@
int DecodePPP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodePPP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_ppp, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_ppp);
if (unlikely(len < PPP_HEADER_LEN)) { if (unlikely(len < PPP_HEADER_LEN)) {
ENGINE_SET_INVALID_EVENT(p, PPP_PKT_TOO_SMALL); ENGINE_SET_INVALID_EVENT(p, PPP_PKT_TOO_SMALL);

@ -49,7 +49,7 @@
*/ */
int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_pppoe, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pppoe);
if (len < PPPOE_DISCOVERY_HEADER_MIN_LEN) { if (len < PPPOE_DISCOVERY_HEADER_MIN_LEN) {
ENGINE_SET_INVALID_EVENT(p, PPPOE_PKT_TOO_SMALL); ENGINE_SET_INVALID_EVENT(p, PPPOE_PKT_TOO_SMALL);
@ -128,7 +128,7 @@ int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8
*/ */
int DecodePPPOESession(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodePPPOESession(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_pppoe, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pppoe);
if (len < PPPOE_SESSION_HEADER_LEN) { if (len < PPPOE_SESSION_HEADER_LEN) {
ENGINE_SET_INVALID_EVENT(p, PPPOE_PKT_TOO_SMALL); ENGINE_SET_INVALID_EVENT(p, PPPOE_PKT_TOO_SMALL);

@ -45,7 +45,7 @@
int DecodeRaw(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodeRaw(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_raw, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_raw);
/* If it is ipv4 or ipv6 it should at least be the size of ipv4 */ /* If it is ipv4 or ipv6 it should at least be the size of ipv4 */
if (unlikely(len < IPV4_HEADER_LEN)) { if (unlikely(len < IPV4_HEADER_LEN)) {

@ -61,7 +61,7 @@ static int DecodeSCTPPacket(ThreadVars *tv, Packet *p, uint8_t *pkt, uint16_t le
int DecodeSCTP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodeSCTP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_sctp, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_sctp);
if (unlikely(DecodeSCTPPacket(tv, p,pkt,len) < 0)) { if (unlikely(DecodeSCTPPacket(tv, p,pkt,len) < 0)) {
p->sctph = NULL; p->sctph = NULL;

@ -38,7 +38,7 @@
int DecodeSll(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodeSll(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_sll, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_sll);
if (unlikely(len < SLL_HEADER_LEN)) { if (unlikely(len < SLL_HEADER_LEN)) {
ENGINE_SET_INVALID_EVENT(p, SLL_PKT_TOO_SMALL); ENGINE_SET_INVALID_EVENT(p, SLL_PKT_TOO_SMALL);

@ -186,7 +186,7 @@ static int DecodeTCPPacket(ThreadVars *tv, Packet *p, uint8_t *pkt, uint16_t len
int DecodeTCP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodeTCP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_tcp, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_tcp);
if (unlikely(DecodeTCPPacket(tv, p,pkt,len) < 0)) { if (unlikely(DecodeTCPPacket(tv, p,pkt,len) < 0)) {
SCLogDebug("invalid TCP packet"); SCLogDebug("invalid TCP packet");

@ -96,7 +96,7 @@ int DecodeTeredo(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt,
PKT_SET_SRC(tp, PKT_SRC_DECODER_TEREDO); PKT_SET_SRC(tp, PKT_SRC_DECODER_TEREDO);
/* add the tp to the packet queue. */ /* add the tp to the packet queue. */
PacketEnqueue(pq,tp); PacketEnqueue(pq,tp);
SCPerfCounterIncr(dtv->counter_teredo, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_teredo);
return TM_ECODE_OK; return TM_ECODE_OK;
} }
} }

@ -72,7 +72,7 @@ static int DecodeUDPPacket(ThreadVars *t, Packet *p, uint8_t *pkt, uint16_t len)
int DecodeUDP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) int DecodeUDP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq)
{ {
SCPerfCounterIncr(dtv->counter_udp, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_udp);
if (unlikely(DecodeUDPPacket(tv, p,pkt,len) < 0)) { if (unlikely(DecodeUDPPacket(tv, p,pkt,len) < 0)) {
p->udph = NULL; p->udph = NULL;

@ -61,9 +61,9 @@ int DecodeVLAN(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, u
uint32_t proto; uint32_t proto;
if (p->vlan_idx == 0) if (p->vlan_idx == 0)
SCPerfCounterIncr(dtv->counter_vlan, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_vlan);
else if (p->vlan_idx == 1) else if (p->vlan_idx == 1)
SCPerfCounterIncr(dtv->counter_vlan_qinq, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_vlan_qinq);
if(len < VLAN_HEADER_LEN) { if(len < VLAN_HEADER_LEN) {
ENGINE_SET_INVALID_EVENT(p, VLAN_HEADER_TOO_SMALL); ENGINE_SET_INVALID_EVENT(p, VLAN_HEADER_TOO_SMALL);

@ -106,7 +106,7 @@ void PacketDecodeFinalize(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
{ {
if (p->flags & PKT_IS_INVALID) if (p->flags & PKT_IS_INVALID)
SCPerfCounterIncr(dtv->counter_invalid, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_invalid);
#ifdef __SC_CUDA_SUPPORT__ #ifdef __SC_CUDA_SUPPORT__
if (dtv->cuda_vars.mpm_is_cuda) if (dtv->cuda_vars.mpm_is_cuda)

@ -771,8 +771,7 @@ insert:
if (tracker->af == AF_INET) { if (tracker->af == AF_INET) {
r = Defrag4Reassemble(tv, tracker, p); r = Defrag4Reassemble(tv, tracker, p);
if (r != NULL && tv != NULL && dtv != NULL) { if (r != NULL && tv != NULL && dtv != NULL) {
SCPerfCounterIncr(dtv->counter_defrag_ipv4_reassembled, SCPerfCounterIncr(tv, dtv->counter_defrag_ipv4_reassembled);
tv->perf_private_ctx);
if (pq && DecodeIPV4(tv, dtv, r, (void *)r->ip4h, if (pq && DecodeIPV4(tv, dtv, r, (void *)r->ip4h,
IPV4_GET_IPLEN(r), pq) != TM_ECODE_OK) { IPV4_GET_IPLEN(r), pq) != TM_ECODE_OK) {
TmqhOutputPacketpool(tv, r); TmqhOutputPacketpool(tv, r);
@ -784,8 +783,7 @@ insert:
else if (tracker->af == AF_INET6) { else if (tracker->af == AF_INET6) {
r = Defrag6Reassemble(tv, tracker, p); r = Defrag6Reassemble(tv, tracker, p);
if (r != NULL && tv != NULL && dtv != NULL) { if (r != NULL && tv != NULL && dtv != NULL) {
SCPerfCounterIncr(dtv->counter_defrag_ipv6_reassembled, SCPerfCounterIncr(tv, dtv->counter_defrag_ipv6_reassembled);
tv->perf_private_ctx);
if (pq && DecodeIPV6(tv, dtv, r, (uint8_t *)r->ip6h, if (pq && DecodeIPV6(tv, dtv, r, (uint8_t *)r->ip6h,
IPV6_GET_PLEN(r) + IPV6_HEADER_LEN, IPV6_GET_PLEN(r) + IPV6_HEADER_LEN,
pq) != TM_ECODE_OK) { pq) != TM_ECODE_OK) {
@ -925,12 +923,10 @@ Defrag(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, PacketQueue *pq)
if (tv != NULL && dtv != NULL) { if (tv != NULL && dtv != NULL) {
if (af == AF_INET) { if (af == AF_INET) {
SCPerfCounterIncr(dtv->counter_defrag_ipv4_fragments, SCPerfCounterIncr(tv, dtv->counter_defrag_ipv4_fragments);
tv->perf_private_ctx);
} }
else if (af == AF_INET6) { else if (af == AF_INET6) {
SCPerfCounterIncr(dtv->counter_defrag_ipv6_fragments, SCPerfCounterIncr(tv, dtv->counter_defrag_ipv6_fragments);
tv->perf_private_ctx);
} }
} }

@ -1437,13 +1437,13 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_MPM); PACKET_PROFILING_DETECT_END(p, PROF_DETECT_MPM);
#ifdef PROFILING #ifdef PROFILING
if (th_v) { if (th_v) {
SCPerfCounterAddUI64(det_ctx->counter_mpm_list, th_v->perf_private_ctx, SCPerfCounterAddUI64(th_v, det_ctx->counter_mpm_list,
(uint64_t)det_ctx->pmq.rule_id_array_cnt); (uint64_t)det_ctx->pmq.rule_id_array_cnt);
SCPerfCounterAddUI64(det_ctx->counter_nonmpm_list, th_v->perf_private_ctx, SCPerfCounterAddUI64(th_v, det_ctx->counter_nonmpm_list,
(uint64_t)det_ctx->sgh->non_mpm_store_cnt); (uint64_t)det_ctx->sgh->non_mpm_store_cnt);
/* non mpm sigs after mask prefilter */ /* non mpm sigs after mask prefilter */
SCPerfCounterAddUI64(det_ctx->counter_fnonmpm_list, SCPerfCounterAddUI64(th_v, det_ctx->counter_fnonmpm_list,
th_v->perf_private_ctx, (uint64_t)det_ctx->non_mpm_id_cnt); (uint64_t)det_ctx->non_mpm_id_cnt);
} }
#endif #endif
@ -1457,7 +1457,7 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
SigIntId match_cnt = det_ctx->match_array_cnt; SigIntId match_cnt = det_ctx->match_array_cnt;
#ifdef PROFILING #ifdef PROFILING
if (th_v) { if (th_v) {
SCPerfCounterAddUI64(det_ctx->counter_match_list, th_v->perf_private_ctx, SCPerfCounterAddUI64(th_v, det_ctx->counter_match_list,
(uint64_t)match_cnt); (uint64_t)match_cnt);
} }
#endif #endif
@ -1790,7 +1790,7 @@ end:
PACKET_PROFILING_DETECT_START(p, PROF_DETECT_ALERT); PACKET_PROFILING_DETECT_START(p, PROF_DETECT_ALERT);
PacketAlertFinalize(de_ctx, det_ctx, p); PacketAlertFinalize(de_ctx, det_ctx, p);
if (p->alerts.cnt > 0) { if (p->alerts.cnt > 0) {
SCPerfCounterAddUI64(det_ctx->counter_alerts, det_ctx->tv->perf_private_ctx, (uint64_t)p->alerts.cnt); SCPerfCounterAddUI64(th_v, det_ctx->counter_alerts, (uint64_t)p->alerts.cnt);
} }
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_ALERT); PACKET_PROFILING_DETECT_END(p, PROF_DETECT_ALERT);

@ -605,7 +605,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
SCLogDebug("Flow emergency mode entered..."); SCLogDebug("Flow emergency mode entered...");
SCPerfCounterIncr(ftd->flow_emerg_mode_enter, th_v->perf_private_ctx); SCPerfCounterIncr(th_v, ftd->flow_emerg_mode_enter);
} }
} }
@ -635,24 +635,24 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
IPPairTimeoutHash(&ts); IPPairTimeoutHash(&ts);
} }
/* /*
SCPerfCounterAddUI64(flow_mgr_host_prune, th_v->perf_private_ctx, (uint64_t)hosts_pruned); SCPerfCounterAddUI64(th_v, flow_mgr_host_prune, (uint64_t)hosts_pruned);
uint32_t hosts_active = HostGetActiveCount(); uint32_t hosts_active = HostGetActiveCount();
SCPerfCounterSetUI64(flow_mgr_host_active, th_v->perf_private_ctx, (uint64_t)hosts_active); SCPerfCounterSetUI64(th_v, flow_mgr_host_active, (uint64_t)hosts_active);
uint32_t hosts_spare = HostGetSpareCount(); uint32_t hosts_spare = HostGetSpareCount();
SCPerfCounterSetUI64(flow_mgr_host_spare, th_v->perf_private_ctx, (uint64_t)hosts_spare); SCPerfCounterSetUI64(th_v, flow_mgr_host_spare, (uint64_t)hosts_spare);
*/ */
SCPerfCounterAddUI64(ftd->flow_mgr_cnt_clo, th_v->perf_private_ctx, (uint64_t)counters.clo); SCPerfCounterAddUI64(th_v, ftd->flow_mgr_cnt_clo, (uint64_t)counters.clo);
SCPerfCounterAddUI64(ftd->flow_mgr_cnt_new, th_v->perf_private_ctx, (uint64_t)counters.new); SCPerfCounterAddUI64(th_v, ftd->flow_mgr_cnt_new, (uint64_t)counters.new);
SCPerfCounterAddUI64(ftd->flow_mgr_cnt_est, th_v->perf_private_ctx, (uint64_t)counters.est); SCPerfCounterAddUI64(th_v, ftd->flow_mgr_cnt_est, (uint64_t)counters.est);
long long unsigned int flow_memuse = SC_ATOMIC_GET(flow_memuse); long long unsigned int flow_memuse = SC_ATOMIC_GET(flow_memuse);
SCPerfCounterSetUI64(ftd->flow_mgr_memuse, th_v->perf_private_ctx, (uint64_t)flow_memuse); SCPerfCounterSetUI64(th_v, ftd->flow_mgr_memuse, (uint64_t)flow_memuse);
SCPerfCounterAddUI64(ftd->flow_tcp_reuse, th_v->perf_private_ctx, (uint64_t)counters.tcp_reuse); SCPerfCounterAddUI64(th_v, ftd->flow_tcp_reuse, (uint64_t)counters.tcp_reuse);
uint32_t len = 0; uint32_t len = 0;
FQLOCK_LOCK(&flow_spare_q); FQLOCK_LOCK(&flow_spare_q);
len = flow_spare_q.len; len = flow_spare_q.len;
FQLOCK_UNLOCK(&flow_spare_q); FQLOCK_UNLOCK(&flow_spare_q);
SCPerfCounterSetUI64(ftd->flow_mgr_spare, th_v->perf_private_ctx, (uint64_t)len); SCPerfCounterSetUI64(th_v, ftd->flow_mgr_spare, (uint64_t)len);
/* Don't fear, FlowManagerThread is here... /* Don't fear, FlowManagerThread is here...
* clear emergency bit if we have at least xx flows pruned. */ * clear emergency bit if we have at least xx flows pruned. */
@ -676,7 +676,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
"%% flows at the queue", (uintmax_t)ts.tv_sec, "%% flows at the queue", (uintmax_t)ts.tv_sec,
(uintmax_t)ts.tv_usec, len * 100 / flow_config.prealloc); (uintmax_t)ts.tv_usec, len * 100 / flow_config.prealloc);
SCPerfCounterIncr(ftd->flow_emerg_mode_over, th_v->perf_private_ctx); SCPerfCounterIncr(th_v, ftd->flow_emerg_mode_over);
} else { } else {
flow_update_delay_sec = FLOW_EMERG_MODE_UPDATE_DELAY_SEC; flow_update_delay_sec = FLOW_EMERG_MODE_UPDATE_DELAY_SEC;
flow_update_delay_nsec = FLOW_EMERG_MODE_UPDATE_DELAY_NSEC; flow_update_delay_nsec = FLOW_EMERG_MODE_UPDATE_DELAY_NSEC;

@ -511,8 +511,8 @@ static inline void AFPDumpCounters(AFPThreadVars *ptv)
SCLogDebug("(%s) Kernel: Packets %" PRIu32 ", dropped %" PRIu32 "", SCLogDebug("(%s) Kernel: Packets %" PRIu32 ", dropped %" PRIu32 "",
ptv->tv->name, ptv->tv->name,
kstats.tp_packets, kstats.tp_drops); kstats.tp_packets, kstats.tp_drops);
SCPerfCounterAddUI64(ptv->capture_kernel_packets, ptv->tv->perf_private_ctx, kstats.tp_packets); SCPerfCounterAddUI64(ptv->tv, ptv->capture_kernel_packets, kstats.tp_packets);
SCPerfCounterAddUI64(ptv->capture_kernel_drops, ptv->tv->perf_private_ctx, kstats.tp_drops); SCPerfCounterAddUI64(ptv->tv, ptv->capture_kernel_drops, kstats.tp_drops);
(void) SC_ATOMIC_ADD(ptv->livedev->drop, (uint64_t) kstats.tp_drops); (void) SC_ATOMIC_ADD(ptv->livedev->drop, (uint64_t) kstats.tp_drops);
(void) SC_ATOMIC_ADD(ptv->livedev->pkts, (uint64_t) kstats.tp_packets); (void) SC_ATOMIC_ADD(ptv->livedev->pkts, (uint64_t) kstats.tp_packets);
} }
@ -1856,22 +1856,22 @@ TmEcode DecodeAFP(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet
return TM_ECODE_OK; return TM_ECODE_OK;
/* update counters */ /* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx); // SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
#if 0 #if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx, SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0); (GET_PKT_LEN(p) * 8)/1000000.0);
#endif #endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* If suri has set vlan during reading, we increase vlan counter */ /* If suri has set vlan during reading, we increase vlan counter */
if (p->vlan_idx) { if (p->vlan_idx) {
SCPerfCounterIncr(dtv->counter_vlan, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_vlan);
} }
/* call the decoder */ /* call the decoder */

@ -444,8 +444,7 @@ ProcessErfDagRecords(ErfDagThreadVars *ewtn, uint8_t *top, uint32_t *pkts_read)
break; break;
case TYPE_ETH: case TYPE_ETH:
if (dr->lctr) { if (dr->lctr) {
SCPerfCounterAddUI64(ewtn->drops, ewtn->tv->perf_private_ctx, SCPerfCounterAddUI64(tv, ewtn->drops, ntohs(dr->lctr));
ntohs(dr->lctr));
} }
break; break;
default: default:
@ -538,7 +537,7 @@ ProcessErfDagRecord(ErfDagThreadVars *ewtn, char *prec)
p->ts.tv_sec++; p->ts.tv_sec++;
} }
SCPerfCounterIncr(ewtn->packets, ewtn->tv->perf_private_ctx); SCPerfCounterIncr(tv, ewtn->packets);
ewtn->bytes += wlen; ewtn->bytes += wlen;
if (TmThreadsSlotProcessPkt(ewtn->tv, ewtn->slot, p) != TM_ECODE_OK) { if (TmThreadsSlotProcessPkt(ewtn->tv, ewtn->slot, p) != TM_ECODE_OK) {
@ -624,20 +623,18 @@ DecodeErfDag(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
return TM_ECODE_OK; return TM_ECODE_OK;
/* update counters */ /* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx); // SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
#if 0 #if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx, SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0); (GET_PKT_LEN(p) * 8)/1000000.0);
#endif #endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx,
GET_PKT_LEN(p));
/* call the decoder */ /* call the decoder */
switch(p->datalink) { switch(p->datalink) {

@ -284,18 +284,18 @@ DecodeErfFile(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, PacketQueu
return TM_ECODE_OK; return TM_ECODE_OK;
/* Update counters. */ /* Update counters. */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx); // SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
#if 0 #if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx, SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0 ); (GET_PKT_LEN(p) * 8)/1000000.0 );
#endif #endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq); DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -452,10 +452,10 @@ TmEcode DecodeIPFW(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
return TM_ECODE_OK; return TM_ECODE_OK;
/* update counters */ /* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* Process IP packets */ /* Process IP packets */
if (IPV4_GET_RAW_VER(ip4h) == 4) { if (IPV4_GET_RAW_VER(ip4h) == 4) {

@ -382,8 +382,7 @@ TmEcode ReceiveMpipeLoop(ThreadVars *tv, void *data, void *slot)
__insn_prefetch(&idesc[i]); __insn_prefetch(&idesc[i]);
} }
if (unlikely(n > max_queued)) { if (unlikely(n > max_queued)) {
SCPerfCounterSetUI64(ptv->max_mpipe_depth, SCPerfCounterSetUI64(tv, ptv->max_mpipe_depth,
tv->perf_private_ctx,
(uint64_t)n); (uint64_t)n);
max_queued = n; max_queued = n;
} }
@ -399,11 +398,10 @@ TmEcode ReceiveMpipeLoop(ThreadVars *tv, void *data, void *slot)
if (idesc->be) { if (idesc->be) {
/* Buffer Error - No buffer available, so mPipe /* Buffer Error - No buffer available, so mPipe
* dropped the packet. */ * dropped the packet. */
SCPerfCounterIncr(XlateStack(ptv, idesc->stack_idx), SCPerfCounterIncr(tv, XlateStack(ptv, idesc->stack_idx));
tv->perf_private_ctx);
} else { } else {
/* Bad packet. CRC error */ /* Bad packet. CRC error */
SCPerfCounterIncr(ptv->mpipe_drop, tv->perf_private_ctx); SCPerfCounterIncr(tv, ptv->mpipe_drop);
gxio_mpipe_iqueue_drop(iqueue, idesc); gxio_mpipe_iqueue_drop(iqueue, idesc);
} }
gxio_mpipe_iqueue_release(iqueue, idesc); gxio_mpipe_iqueue_release(iqueue, idesc);
@ -1063,13 +1061,13 @@ TmEcode DecodeMpipe(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
return TM_ECODE_OK; return TM_ECODE_OK;
/* update counters */ /* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx); // SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* call the decoder */ /* call the decoder */
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq); DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -357,11 +357,11 @@ TmEcode NapatechDecode(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
return TM_ECODE_OK; return TM_ECODE_OK;
/* update counters */ /* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx); // SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
switch (p->datalink) { switch (p->datalink) {
case LINKTYPE_ETHERNET: case LINKTYPE_ETHERNET:

@ -483,8 +483,8 @@ static int NetmapClose(NetmapDevice *dev)
*/ */
static inline void NetmapDumpCounters(NetmapThreadVars *ntv) static inline void NetmapDumpCounters(NetmapThreadVars *ntv)
{ {
SCPerfCounterAddUI64(ntv->capture_kernel_packets, ntv->tv->perf_private_ctx, ntv->pkts); SCPerfCounterAddUI64(ntv->tv, ntv->capture_kernel_packets, ntv->pkts);
SCPerfCounterAddUI64(ntv->capture_kernel_drops, ntv->tv->perf_private_ctx, ntv->drops); SCPerfCounterAddUI64(ntv->tv, ntv->capture_kernel_drops, ntv->drops);
(void) SC_ATOMIC_ADD(ntv->livedev->drop, ntv->drops); (void) SC_ATOMIC_ADD(ntv->livedev->drop, ntv->drops);
(void) SC_ATOMIC_ADD(ntv->livedev->pkts, ntv->pkts); (void) SC_ATOMIC_ADD(ntv->livedev->pkts, ntv->pkts);
ntv->drops = 0; ntv->drops = 0;
@ -934,10 +934,10 @@ static TmEcode DecodeNetmap(ThreadVars *tv, Packet *p, void *data, PacketQueue *
SCReturnInt(TM_ECODE_OK); SCReturnInt(TM_ECODE_OK);
/* update counters */ /* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq); DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -503,10 +503,10 @@ TmEcode DecodeNFLOG(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Pack
IPV6Hdr *ip6h = (IPV6Hdr *)GET_PKT_DATA(p); IPV6Hdr *ip6h = (IPV6Hdr *)GET_PKT_DATA(p);
DecodeThreadVars *dtv = (DecodeThreadVars *)data; DecodeThreadVars *dtv = (DecodeThreadVars *)data;
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
if (IPV4_GET_RAW_VER(ip4h) == 4) { if (IPV4_GET_RAW_VER(ip4h) == 4) {
SCLogDebug("IPv4 packet"); SCLogDebug("IPv4 packet");

@ -1223,10 +1223,10 @@ TmEcode DecodeNFQ(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet
if (p->flags & PKT_PSEUDO_STREAM_END) if (p->flags & PKT_PSEUDO_STREAM_END)
return TM_ECODE_OK; return TM_ECODE_OK;
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
#if 0 #if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx, SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,

@ -401,17 +401,17 @@ TmEcode DecodePcapFile(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, P
return TM_ECODE_OK; return TM_ECODE_OK;
/* update counters */ /* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx); // SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
#if 0 #if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx, SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0 ); (GET_PKT_LEN(p) * 8)/1000000.0 );
#endif #endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
double curr_ts = p->ts.tv_sec + p->ts.tv_usec / 1000.0; double curr_ts = p->ts.tv_sec + p->ts.tv_usec / 1000.0;
if (curr_ts < prev_signaled_ts || (curr_ts - prev_signaled_ts) > 60.0) { if (curr_ts < prev_signaled_ts || (curr_ts - prev_signaled_ts) > 60.0) {

@ -155,10 +155,10 @@ static inline void PcapDumpCounters(PcapThreadVars *ptv)
{ {
struct pcap_stat pcap_s; struct pcap_stat pcap_s;
if (likely((pcap_stats(ptv->pcap_handle, &pcap_s) >= 0))) { if (likely((pcap_stats(ptv->pcap_handle, &pcap_s) >= 0))) {
SCPerfCounterSetUI64(ptv->capture_kernel_packets, ptv->tv->perf_private_ctx, pcap_s.ps_recv); SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_packets, pcap_s.ps_recv);
SCPerfCounterSetUI64(ptv->capture_kernel_drops, ptv->tv->perf_private_ctx, pcap_s.ps_drop); SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_drops, pcap_s.ps_drop);
(void) SC_ATOMIC_SET(ptv->livedev->drop, pcap_s.ps_drop); (void) SC_ATOMIC_SET(ptv->livedev->drop, pcap_s.ps_drop);
SCPerfCounterSetUI64(ptv->capture_kernel_ifdrops, ptv->tv->perf_private_ctx, pcap_s.ps_ifdrop); SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_ifdrops, pcap_s.ps_ifdrop);
} }
} }
@ -716,18 +716,18 @@ TmEcode DecodePcap(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
return TM_ECODE_OK; return TM_ECODE_OK;
/* update counters */ /* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx); // SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
#if 0 #if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx, SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0); (GET_PKT_LEN(p) * 8)/1000000.0);
#endif #endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* call the decoder */ /* call the decoder */
switch(p->datalink) { switch(p->datalink) {

@ -204,8 +204,8 @@ static inline void PfringDumpCounters(PfringThreadVars *ptv)
ptv->tv->perf_private_ctx); ptv->tv->perf_private_ctx);
SC_ATOMIC_ADD(ptv->livedev->pkts, pfring_s.recv - th_pkts); SC_ATOMIC_ADD(ptv->livedev->pkts, pfring_s.recv - th_pkts);
SC_ATOMIC_ADD(ptv->livedev->drop, pfring_s.drop - th_drops); SC_ATOMIC_ADD(ptv->livedev->drop, pfring_s.drop - th_drops);
SCPerfCounterSetUI64(ptv->capture_kernel_packets, ptv->tv->perf_private_ctx, pfring_s.recv); SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_packets, pfring_s.recv);
SCPerfCounterSetUI64(ptv->capture_kernel_drops, ptv->tv->perf_private_ctx, pfring_s.drop); SCPerfCounterSetUI64(ptv->tv, ptv->capture_kernel_drops, pfring_s.drop);
} }
} }
@ -608,22 +608,22 @@ TmEcode DecodePfring(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Pac
return TM_ECODE_OK; return TM_ECODE_OK;
/* update counters */ /* update counters */
SCPerfCounterIncr(dtv->counter_pkts, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_pkts);
// SCPerfCounterIncr(dtv->counter_pkts_per_sec, tv->perf_private_ctx); // SCPerfCounterIncr(tv, dtv->counter_pkts_per_sec);
SCPerfCounterAddUI64(dtv->counter_bytes, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_bytes, GET_PKT_LEN(p));
#if 0 #if 0
SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddDouble(dtv->counter_bytes_per_sec, tv->perf_private_ctx, GET_PKT_LEN(p));
SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx, SCPerfCounterAddDouble(dtv->counter_mbit_per_sec, tv->perf_private_ctx,
(GET_PKT_LEN(p) * 8)/1000000.0 ); (GET_PKT_LEN(p) * 8)/1000000.0 );
#endif #endif
SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterAddUI64(tv, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->perf_private_ctx, GET_PKT_LEN(p)); SCPerfCounterSetUI64(tv, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
/* If suri has set vlan during reading, we increase vlan counter */ /* If suri has set vlan during reading, we increase vlan counter */
if (p->vlan_idx) { if (p->vlan_idx) {
SCPerfCounterIncr(dtv->counter_vlan, tv->perf_private_ctx); SCPerfCounterIncr(tv, dtv->counter_vlan);
} }
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq); DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq);

@ -139,7 +139,7 @@ void StreamTcpReassembleMemuseCounter(ThreadVars *tv, TcpReassemblyThreadCtx *rt
{ {
uint64_t smemuse = SC_ATOMIC_GET(ra_memuse); uint64_t smemuse = SC_ATOMIC_GET(ra_memuse);
if (tv != NULL && rtv != NULL) if (tv != NULL && rtv != NULL)
SCPerfCounterSetUI64(rtv->counter_tcp_reass_memuse, tv->perf_private_ctx, smemuse); SCPerfCounterSetUI64(tv, rtv->counter_tcp_reass_memuse, smemuse);
return; return;
} }
@ -1905,7 +1905,7 @@ int StreamTcpReassembleHandleSegmentHandleData(ThreadVars *tv, TcpReassemblyThre
if (stream->flags & STREAMTCP_STREAM_FLAG_DEPTH_REACHED) { if (stream->flags & STREAMTCP_STREAM_FLAG_DEPTH_REACHED) {
/* increment stream depth counter */ /* increment stream depth counter */
SCPerfCounterIncr(ra_ctx->counter_tcp_stream_depth, tv->perf_private_ctx); SCPerfCounterIncr(tv, ra_ctx->counter_tcp_stream_depth);
stream->flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY; stream->flags |= STREAMTCP_STREAM_FLAG_NOREASSEMBLY;
SCLogDebug("ssn %p: reassembly depth reached, " SCLogDebug("ssn %p: reassembly depth reached, "
@ -2606,7 +2606,7 @@ int DoHandleGap(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
stream->flags |= STREAMTCP_STREAM_FLAG_GAP; stream->flags |= STREAMTCP_STREAM_FLAG_GAP;
StreamTcpSetEvent(p, STREAM_REASSEMBLY_SEQ_GAP); StreamTcpSetEvent(p, STREAM_REASSEMBLY_SEQ_GAP);
SCPerfCounterIncr(ra_ctx->counter_tcp_reass_gap, tv->perf_private_ctx); SCPerfCounterIncr(tv, ra_ctx->counter_tcp_reass_gap);
#ifdef DEBUG #ifdef DEBUG
dbg_app_layer_gap++; dbg_app_layer_gap++;
#endif #endif
@ -2952,7 +2952,7 @@ int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
stream->flags |= STREAMTCP_STREAM_FLAG_GAP; stream->flags |= STREAMTCP_STREAM_FLAG_GAP;
StreamTcpSetEvent(p, STREAM_REASSEMBLY_SEQ_GAP); StreamTcpSetEvent(p, STREAM_REASSEMBLY_SEQ_GAP);
SCPerfCounterIncr(ra_ctx->counter_tcp_reass_gap, tv->perf_private_ctx); SCPerfCounterIncr(tv, ra_ctx->counter_tcp_reass_gap);
#ifdef DEBUG #ifdef DEBUG
dbg_app_layer_gap++; dbg_app_layer_gap++;
#endif #endif
@ -3596,7 +3596,7 @@ TcpSegment* StreamTcpGetSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
segment_pool[idx]->allocated); segment_pool[idx]->allocated);
/* Increment the counter to show that we are not able to serve the /* Increment the counter to show that we are not able to serve the
segment request due to memcap limit */ segment request due to memcap limit */
SCPerfCounterIncr(ra_ctx->counter_tcp_segment_memcap, tv->perf_private_ctx); SCPerfCounterIncr(tv, ra_ctx->counter_tcp_segment_memcap);
} else { } else {
seg->flags = stream_config.segment_init_flags; seg->flags = stream_config.segment_init_flags;
seg->next = NULL; seg->next = NULL;

@ -147,7 +147,7 @@ void StreamTcpDecrMemuse(uint64_t size)
void StreamTcpMemuseCounter(ThreadVars *tv, StreamTcpThread *stt) void StreamTcpMemuseCounter(ThreadVars *tv, StreamTcpThread *stt)
{ {
uint64_t memusecopy = SC_ATOMIC_GET(st_memuse); uint64_t memusecopy = SC_ATOMIC_GET(st_memuse);
SCPerfCounterSetUI64(stt->counter_tcp_memuse, tv->perf_private_ctx, memusecopy); SCPerfCounterSetUI64(tv, stt->counter_tcp_memuse, memusecopy);
return; return;
} }
@ -843,10 +843,10 @@ static int StreamTcpPacketStateNone(ThreadVars *tv, Packet *p,
if (ssn == NULL) { if (ssn == NULL) {
ssn = StreamTcpNewSession(p, stt->ssn_pool_id); ssn = StreamTcpNewSession(p, stt->ssn_pool_id);
if (ssn == NULL) { if (ssn == NULL) {
SCPerfCounterIncr(stt->counter_tcp_ssn_memcap, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_ssn_memcap);
return -1; return -1;
} }
SCPerfCounterIncr(stt->counter_tcp_sessions, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_sessions);
} }
/* set the state */ /* set the state */
StreamTcpPacketSetState(p, ssn, TCP_SYN_RECV); StreamTcpPacketSetState(p, ssn, TCP_SYN_RECV);
@ -924,11 +924,11 @@ static int StreamTcpPacketStateNone(ThreadVars *tv, Packet *p,
if (ssn == NULL) { if (ssn == NULL) {
ssn = StreamTcpNewSession(p, stt->ssn_pool_id); ssn = StreamTcpNewSession(p, stt->ssn_pool_id);
if (ssn == NULL) { if (ssn == NULL) {
SCPerfCounterIncr(stt->counter_tcp_ssn_memcap, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_ssn_memcap);
return -1; return -1;
} }
SCPerfCounterIncr(stt->counter_tcp_sessions, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_sessions);
} }
/* set the state */ /* set the state */
@ -977,10 +977,10 @@ static int StreamTcpPacketStateNone(ThreadVars *tv, Packet *p,
if (ssn == NULL) { if (ssn == NULL) {
ssn = StreamTcpNewSession(p, stt->ssn_pool_id); ssn = StreamTcpNewSession(p, stt->ssn_pool_id);
if (ssn == NULL) { if (ssn == NULL) {
SCPerfCounterIncr(stt->counter_tcp_ssn_memcap, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_ssn_memcap);
return -1; return -1;
} }
SCPerfCounterIncr(stt->counter_tcp_sessions, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_sessions);
} }
/* set the state */ /* set the state */
StreamTcpPacketSetState(p, ssn, TCP_ESTABLISHED); StreamTcpPacketSetState(p, ssn, TCP_ESTABLISHED);
@ -4460,12 +4460,12 @@ int StreamTcpPacket (ThreadVars *tv, Packet *p, StreamTcpThread *stt,
/* update counters */ /* update counters */
if ((p->tcph->th_flags & (TH_SYN|TH_ACK)) == (TH_SYN|TH_ACK)) { if ((p->tcph->th_flags & (TH_SYN|TH_ACK)) == (TH_SYN|TH_ACK)) {
SCPerfCounterIncr(stt->counter_tcp_synack, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_synack);
} else if (p->tcph->th_flags & (TH_SYN)) { } else if (p->tcph->th_flags & (TH_SYN)) {
SCPerfCounterIncr(stt->counter_tcp_syn, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_syn);
} }
if (p->tcph->th_flags & (TH_RST)) { if (p->tcph->th_flags & (TH_RST)) {
SCPerfCounterIncr(stt->counter_tcp_rst, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_rst);
} }
/* broken TCP http://ask.wireshark.org/questions/3183/acknowledgment-number-broken-tcp-the-acknowledge-field-is-nonzero-while-the-ack-flag-is-not-set */ /* broken TCP http://ask.wireshark.org/questions/3183/acknowledgment-number-broken-tcp-the-acknowledge-field-is-nonzero-while-the-ack-flag-is-not-set */
@ -5019,13 +5019,13 @@ TmEcode StreamTcp (ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
return TM_ECODE_OK; return TM_ECODE_OK;
if (p->flow == NULL) { if (p->flow == NULL) {
SCPerfCounterIncr(stt->counter_tcp_no_flow, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_no_flow);
return TM_ECODE_OK; return TM_ECODE_OK;
} }
if (stream_config.flags & STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION) { if (stream_config.flags & STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION) {
if (StreamTcpValidateChecksum(p) == 0) { if (StreamTcpValidateChecksum(p) == 0) {
SCPerfCounterIncr(stt->counter_tcp_invalid_checksum, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_invalid_checksum);
return TM_ECODE_OK; return TM_ECODE_OK;
} }
} else { } else {
@ -5896,7 +5896,7 @@ void StreamTcpPseudoPacketCreateStreamEndPacket(ThreadVars *tv, StreamTcpThread
Packet *np = StreamTcpPseudoSetup(p, GET_PKT_DATA(p), GET_PKT_LEN(p)); Packet *np = StreamTcpPseudoSetup(p, GET_PKT_DATA(p), GET_PKT_LEN(p));
if (np == NULL) { if (np == NULL) {
SCLogDebug("The packet received from packet allocation is NULL"); SCLogDebug("The packet received from packet allocation is NULL");
SCPerfCounterIncr(stt->counter_tcp_pseudo_failed, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_pseudo_failed);
SCReturn; SCReturn;
} }
PKT_SET_SRC(np, PKT_SRC_STREAM_TCP_STREAM_END_PSEUDO); PKT_SET_SRC(np, PKT_SRC_STREAM_TCP_STREAM_END_PSEUDO);
@ -5931,7 +5931,7 @@ void StreamTcpPseudoPacketCreateStreamEndPacket(ThreadVars *tv, StreamTcpThread
PacketEnqueue(pq, np); PacketEnqueue(pq, np);
SCPerfCounterIncr(stt->counter_tcp_pseudo, tv->perf_private_ctx); SCPerfCounterIncr(tv, stt->counter_tcp_pseudo);
SCReturn; SCReturn;
} }

Loading…
Cancel
Save