By allocating each SCDQDataQueue individually avoid the risk
of false sharing when accessing them from several threads.

Also align the data_queues array to cache line boundary.

I used this following semantic patch to change the references
to data_queues:

  @@
  identifier n;
  expression q;
  @@
  -data_queues[q].n
  +data_queues[q]->n

  @@
  expression queue;
  @@
  -&data_queues[queue]
  +data_queues[queue]

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: oisf/src/suricata.h
===================================================================
--- oisf.orig/src/suricata.h
+++ oisf/src/suricata.h
@@ -122,7 +122,7 @@ enum {
  */
 extern PacketQueue *trans_q[NUM_QUEUES];
 
-SCDQDataQueue data_queues[NUM_QUEUES];
+extern SCDQDataQueue *data_queues[NUM_QUEUES];
 /* memset to zeros, and mutex init! */
 void GlobalInits();
 
Index: oisf/src/suricata.c
===================================================================
--- oisf.orig/src/suricata.c
+++ oisf/src/suricata.c
@@ -213,6 +213,8 @@ SC_ATOMIC_DECLARE(unsigned int, engine_s
 
 PacketQueue *trans_q[NUM_QUEUES] __ALIGNED(CACHE_LINE_SIZE);
 
+SCDQDataQueue *data_queues[NUM_QUEUES] __ALIGNED(CACHE_LINE_SIZE);
+
 int rule_reload = 0;
 
 /** suricata engine control flags */
@@ -328,11 +330,9 @@ uint8_t print_mem_flag = 1;
 void GlobalInits()
 {
 	int q;
-
-    memset(data_queues, 0, sizeof(data_queues));
-
-    /* Initialize the trans_q mutex */
     int r = 0;
+
+    /* Initialize trans_q[] and data_queues[] */
     for (q = 0; q < NUM_QUEUES; q++) {
 		trans_q[q] = calloc(1, sizeof(PacketQueue));
 		if (trans_q[q] == NULL) {
@@ -340,11 +340,17 @@ void GlobalInits()
 			break;
 		}
 
+		data_queues[q] = calloc(1, sizeof(SCDQDataQueue));
+		if (data_queues[q] = NULL) {
+			r = ENOMEM;
+			break;
+		}
+
         r |= SCMutexInit(&trans_q[q]->mutex_q, NULL);
         r |= SCCondInit(&trans_q[q]->cond_q, NULL);
 
-        r |= SCMutexInit(&data_queues[q].mutex_q, NULL);
-        r |= SCCondInit(&data_queues[q].cond_q, NULL);
+        r |= SCMutexInit(&data_queues[q]->mutex_q, NULL);
+        r |= SCCondInit(&data_queues[q]->cond_q, NULL);
    }
 
     if (r != 0) {
Index: oisf/src/cuda-packet-batcher.c
===================================================================
--- oisf.orig/src/cuda-packet-batcher.c
+++ oisf/src/cuda-packet-batcher.c
@@ -262,7 +262,7 @@ static void SCCudaPBQueueBuffer(SCCudaPB
         last_packet->payload_len;
 
     /* enqueue the buffer in the outq to be consumed by the dispatcher TM */
-    SCDQDataQueue *dq_outq = &data_queues[tmq_outq->id];
+    SCDQDataQueue *dq_outq = data_queues[tmq_outq->id];
     SCMutexLock(&dq_outq->mutex_q);
     SCDQDataEnqueue(dq_outq, (SCDQGenericQData *)tctx->curr_pb);
     SCCondSignal(&dq_outq->cond_q);
@@ -270,7 +270,7 @@ static void SCCudaPBQueueBuffer(SCCudaPB
 
     while (run_batcher) {
         /* dequeue a new buffer */
-        SCDQDataQueue *dq_inq = &data_queues[tmq_inq->id];
+        SCDQDataQueue *dq_inq = data_queues[tmq_inq->id];
         SCMutexLock(&dq_inq->mutex_q);
         if (dq_inq->len == 0) {
             /* if we have no data in queue, wait... */
@@ -602,7 +602,7 @@ TmEcode SCCudaPBThreadInit(ThreadVars *t
     tctx->de_ctx = initdata;
 
     /* the first packet buffer from the queue */
-    tctx->curr_pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(&data_queues[tmq_inq->id]);
+    tctx->curr_pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(data_queues[tmq_inq->id]);
 
     /* register new module */
     SCCudaHlRegisterModule("SC_CUDA_PACKET_BATCHER");
@@ -929,7 +929,7 @@ void SCCudaPBSetUpQueuesAndBuffers(void)
         SCCudaPBPacketsBuffer *pb = SCCudaPBAllocSCCudaPBPacketsBuffer();
         /* dump the buffer into the inqueue for this batcher TM.  the batcher
          * thread would be the first consumer for these buffers */
-        SCDQDataEnqueue(&data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
+        SCDQDataEnqueue(data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
     }
 
     /* \todo This needs to be changed ASAP.  This can't exceed max_pending_packets.
@@ -958,7 +958,7 @@ void SCCudaPBCleanUpQueuesAndBuffers(voi
     }
 
     /* clean all the buffers present in the inq */
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     SCMutexLock(&dq->mutex_q);
     while ( (pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(dq)) != NULL) {
         if (pb->packets_buffer != NULL) {
@@ -998,7 +998,7 @@ void SCCudaPBCleanUpQueuesAndBuffers(voi
     SCCondSignal(&dq->cond_q);
 
     /* clean all the buffers present in the outq */
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     SCMutexLock(&dq->mutex_q);
     while ( (pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(dq)) != NULL) {
         if (pb->packets_buffer != NULL) {
@@ -1063,7 +1063,7 @@ void SCCudaPBSetProfile(char *profile_na
 void SCCudaPBKillBatchingPackets(void)
 {
     run_batcher = 0;
-    SCDQDataQueue *dq = &data_queues[tmq_inq->id];
+    SCDQDataQueue *dq = data_queues[tmq_inq->id];
     SCCondSignal(&dq->cond_q);
 
     return;
@@ -1222,9 +1222,9 @@ int SCCudaPBTest01(void)
     result = 1;
 
     SCCudaPBSetUpQueuesAndBuffers();
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 10);
     SCCudaPBRunningTests(1);
     SCCudaPBThreadInit(&tv_cuda_PB, de_ctx, (void *)&tctx);
@@ -1233,84 +1233,84 @@ int SCCudaPBTest01(void)
     p->payload = (uint8_t *)strings[0];
     p->payload_len = strlen(strings[0]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     p->payload = (uint8_t *)strings[1];
     p->payload_len = strlen(strings[1]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     p->payload = (uint8_t *)strings[2];
     p->payload_len = strlen(strings[2]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     p->payload = (uint8_t *)strings[3];
     p->payload_len = strlen(strings[3]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     p->payload = (uint8_t *)strings[4];
     p->payload_len = strlen(strings[4]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     p->payload = (uint8_t *)strings[5];
     p->payload_len = strlen(strings[5]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     p->payload = (uint8_t *)strings[6];
     p->payload_len = strlen(strings[6]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     p->payload = (uint8_t *)strings[7];
     p->payload_len = strlen(strings[7]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     p->payload = (uint8_t *)strings[8];
     p->payload_len = strlen(strings[8]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     p->payload = (uint8_t *)strings[9];
     p->payload_len = strlen(strings[9]);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 1);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 8);
 
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(dq);
     if (pb == NULL) {
         result = 0;
@@ -1452,9 +1452,9 @@ int SCCudaPBTest02(void)
     SigGroupBuild(de_ctx);
 
     SCCudaPBSetUpQueuesAndBuffers();
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 10);
     SCCudaPBRunningTests(1);
     SCCudaPBThreadInit(&tv_cuda_PB, de_ctx, (void *)&tctx);
@@ -1465,9 +1465,9 @@ int SCCudaPBTest02(void)
     p->payload = (uint8_t *)string;
     p->payload_len = strlen(string);
     SCCudaPBBatchPackets(NULL, p, tctx, NULL, NULL);
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     pb = tctx->curr_pb;
Index: oisf/src/flow-timeout.c
===================================================================
--- oisf.orig/src/flow-timeout.c
+++ oisf/src/flow-timeout.c
@@ -685,12 +685,12 @@ void FlowForceReassembly(void)
                 if (tv->inq->q_type == 0)
                     SCCondSignal(&trans_q[tv->inq->id]->cond_q);
                 else
-                    SCCondSignal(&data_queues[tv->inq->id].cond_q);
+                    SCCondSignal(&data_queues[tv->inq->id]->cond_q);
                 while (!TmThreadsCheckFlag(tv, THV_PAUSED)) {
                     if (tv->inq->q_type == 0)
                         SCCondSignal(&trans_q[tv->inq->id]->cond_q);
                     else
-                        SCCondSignal(&data_queues[tv->inq->id].cond_q);
+                        SCCondSignal(&data_queues[tv->inq->id]->cond_q);
                     usleep(100);
                 }
                 TmThreadsUnsetFlag(tv, THV_PAUSE);
Index: oisf/src/tm-threads.c
===================================================================
--- oisf.orig/src/tm-threads.c
+++ oisf/src/tm-threads.c
@@ -1646,7 +1646,7 @@ void TmThreadKillThread(ThreadVars *tv)
                 if (tv->inq->q_type == 0)
                     SCCondSignal(&trans_q[tv->inq->id]->cond_q);
                 else
-                    SCCondSignal(&data_queues[tv->inq->id].cond_q);
+                    SCCondSignal(&data_queues[tv->inq->id]->cond_q);
             }
             SCLogDebug("signalled tv->inq->id %" PRIu32 "", tv->inq->id);
         }
@@ -1738,7 +1738,7 @@ void TmThreadDisableThreadsWithTMS(uint8
                     if (tv->inq->q_type == 0)
                         SCCondSignal(&trans_q[tv->inq->id]->cond_q);
                     else
-                        SCCondSignal(&data_queues[tv->inq->id].cond_q);
+                        SCCondSignal(&data_queues[tv->inq->id]->cond_q);
                 }
                 SCLogDebug("signalled tv->inq->id %" PRIu32 "", tv->inq->id);
             }
Index: oisf/src/util-mpm-b2g-cuda.c
===================================================================
--- oisf.orig/src/util-mpm-b2g-cuda.c
+++ oisf/src/util-mpm-b2g-cuda.c
@@ -1982,7 +1982,7 @@ TmEcode B2gCudaMpmDispatcher(ThreadVars
     B2gCudaMpmThreadCtxData *tctx = data;
 
     SCDQDataQueue *in_dq = (SCDQDataQueue *)buffer_dq;
-    SCDQDataQueue *out_dq = &data_queues[tctx->tmq_streamq->id];
+    SCDQDataQueue *out_dq = data_queues[tctx->tmq_streamq->id];
     SCDQGenericQData *q_ptr = NULL;
     SCCudaPBPacketsBuffer *pb_in_queue = NULL;
     uint8_t curr_stream = 0;
@@ -2257,7 +2257,7 @@ void *CudaMpmB2gThreadsSlot1(void *td)
         TmThreadTestThreadUnPaused(tv);
 
         /* input data */
-        data = (SCCudaPBPacketsBuffer *)TmqhInputSimpleOnQ(&data_queues[tv->inq->id]);
+        data = (SCCudaPBPacketsBuffer *)TmqhInputSimpleOnQ(data_queues[tv->inq->id]);
 
         if (data == NULL) {
             //printf("%s: TmThreadsSlot1: p == NULL\n", tv->name);
@@ -2271,20 +2271,20 @@ void *CudaMpmB2gThreadsSlot1(void *td)
             r = SlotFunc(tv,
                               (Packet *)data,
                               (void *)tctx,
-                              (PacketQueue *)&data_queues[tv->inq->id],
+                              (PacketQueue *)data_queues[tv->inq->id],
                               NULL);
             /* handle error */
 
             /* output the packet buffer (1) */
-            TmqhOutputSimpleOnQ(&data_queues[tv->outq->id], (SCDQGenericQData *)data);
+            TmqhOutputSimpleOnQ(data_queues[tv->outq->id], (SCDQGenericQData *)data);
 
             /* output additional packet buffers (2) */
             while (data != NULL) {
-                data = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(&data_queues[tctx->tmq_streamq->id]);
+                data = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(data_queues[tctx->tmq_streamq->id]);
                 if (data == NULL) {
                     break;
                 }
-                TmqhOutputSimpleOnQ(&data_queues[tv->outq->id], (SCDQGenericQData *)data);
+                TmqhOutputSimpleOnQ(data_queues[tv->outq->id], (SCDQGenericQData *)data);
             }
         }
 
@@ -2635,9 +2635,9 @@ static int B2gCudaTest02(void)
     result = 1;
 
     /* queue state before calling the thread init function */
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 10);
 
     SCCudaPBRunningTests(1);
@@ -2646,9 +2646,9 @@ static int B2gCudaTest02(void)
     SCCudaPBSetBufferPacketThreshhold(no_of_pkts);
 
     /* queue state after calling the thread init function */
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     pb = pb_tctx->curr_pb;
@@ -2659,9 +2659,9 @@ static int B2gCudaTest02(void)
         SCCudaPBBatchPackets(NULL, p[i], pb_tctx, NULL, NULL);
     }
 
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 1);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 8);
 
     result &= (pb->nop_in_buffer == no_of_pkts);
@@ -2935,9 +2935,9 @@ static int B2gCudaTest03(void)
     result = 1;
 
     /* queue state before calling the thread init function */
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 10);
 
     SCCudaPBRunningTests(1);
@@ -2946,9 +2946,9 @@ static int B2gCudaTest03(void)
     SCCudaPBSetBufferPacketThreshhold(no_of_pkts);
 
     /* queue state after calling the thread init function */
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     pb = pb_tctx->curr_pb;
@@ -2959,9 +2959,9 @@ static int B2gCudaTest03(void)
         SCCudaPBBatchPackets(NULL, p[i], pb_tctx, NULL, NULL);
     }
 
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 1);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 8);
 
     result &= (pb->nop_in_buffer == no_of_pkts);
@@ -3258,9 +3258,9 @@ static int B2gCudaTest04(void)
     result = 1;
 
     /* queue state before calling the thread init function */
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 10);
 
     SCCudaPBRunningTests(1);
@@ -3269,9 +3269,9 @@ static int B2gCudaTest04(void)
     SCCudaPBSetBufferPacketThreshhold(max_pkts_in_buffer);
 
     /* queue state after calling the thread init function */
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     for (i = 0; i < no_of_pkts; i++) {
@@ -3280,9 +3280,9 @@ static int B2gCudaTest04(void)
         SCCudaPBBatchPackets(NULL, p[i], pb_tctx, NULL, NULL);
     }
 
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 2);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 7);
 
     int module_handle = SCCudaHlRegisterModule("SC_RULES_CONTENT_B2G_CUDA");
@@ -3306,21 +3306,21 @@ static int B2gCudaTest04(void)
     SCCudaCtxSynchronize();
 
     /* Run the dispatcher function. */
-    pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(&data_queues[tmq_outq->id]);
+    pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(data_queues[tmq_outq->id]);
     if (pb == NULL) {
         SCLogError(SC_ERR_INVALID_VALUE, "PacketBuffer should not be empty");
         result = 0;
     }
     result &= (pb->nop_in_buffer == max_pkts_in_buffer);
-    B2gCudaMpmDispatcher(NULL, (Packet *)pb, b2g_tctx, (PacketQueue *)&data_queues[tmq_outq->id], NULL);
-    TmqhOutputSimpleOnQ(&data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
-    if (data_queues[b2g_tctx->tmq_streamq->id].len != 1) {
+    B2gCudaMpmDispatcher(NULL, (Packet *)pb, b2g_tctx, (PacketQueue *)data_queues[tmq_outq->id], NULL);
+    TmqhOutputSimpleOnQ(data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
+    if (data_queues[b2g_tctx->tmq_streamq->id]->len != 1) {
         result = 0;
     }
-    while ((pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(&data_queues[b2g_tctx->tmq_streamq->id])) != NULL) {
-        TmqhOutputSimpleOnQ(&data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
+    while ((pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(data_queues[b2g_tctx->tmq_streamq->id])) != NULL) {
+        TmqhOutputSimpleOnQ(data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
     }
-    if (data_queues[b2g_tctx->tmq_streamq->id].len != 0) {
+    if (data_queues[b2g_tctx->tmq_streamq->id]->len != 0) {
         result = 0;
     }
 
@@ -3602,9 +3602,9 @@ static int B2gCudaTest05(void)
     result = 1;
 
     /* queue state before calling the thread init function */
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 10);
 
     SCCudaPBRunningTests(1);
@@ -3613,9 +3613,9 @@ static int B2gCudaTest05(void)
     SCCudaPBSetBufferPacketThreshhold(max_pkts_in_buffer);
 
     /* queue state after calling the thread init function */
-    dq = &data_queues[tmq_outq->id];
+    dq = data_queues[tmq_outq->id];
     result &= (dq->len == 0);
-    dq = &data_queues[tmq_inq->id];
+    dq = data_queues[tmq_inq->id];
     result &= (dq->len == 9);
 
     int module_handle = SCCudaHlRegisterModule("SC_RULES_CONTENT_B2G_CUDA");
@@ -3653,14 +3653,14 @@ static int B2gCudaTest05(void)
             SCCudaPBBatchPackets(NULL, p[i], pb_tctx, NULL, NULL);
         }
 
-        dq = &data_queues[tmq_outq->id];
+        dq = data_queues[tmq_outq->id];
         result &= (dq->len == 4);
-        dq = &data_queues[tmq_inq->id];
+        dq = data_queues[tmq_inq->id];
         result &= (dq->len == 5);
 
         /* Performance test with two separate calls */
-        pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(&data_queues[tmq_outq->id]);
-        pb2 = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(&data_queues[tmq_outq->id]);
+        pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(data_queues[tmq_outq->id]);
+        pb2 = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(data_queues[tmq_outq->id]);
         if (pb == NULL || pb2 == NULL) {
             SCLogError(SC_ERR_INVALID_VALUE, "PacketBuffer should not be empty");
             result = 0;
@@ -3671,12 +3671,12 @@ static int B2gCudaTest05(void)
         B2gCudaMpmDispatcher(NULL, (Packet *)pb, b2g_tctx, (PacketQueue *)NULL, (PacketQueue *)NULL);
         B2gCudaMpmDispatcher(NULL, (Packet *)pb2, b2g_tctx, (PacketQueue *)NULL, (PacketQueue *)NULL);
         stop_ = UtilCpuGetTicks();
-        TmqhOutputSimpleOnQ(&data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
-        TmqhOutputSimpleOnQ(&data_queues[tmq_inq->id], (SCDQGenericQData *)pb2);
+        TmqhOutputSimpleOnQ(data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
+        TmqhOutputSimpleOnQ(data_queues[tmq_inq->id], (SCDQGenericQData *)pb2);
         time_nostream_ += stop_ - start_;
 
         /* Performance test with one call using streams */
-        pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(&data_queues[tmq_outq->id]);
+        pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(data_queues[tmq_outq->id]);
         if (pb == NULL) {
             SCLogError(SC_ERR_INVALID_VALUE, "PacketBuffer should not be empty");
             result = 0;
@@ -3684,11 +3684,11 @@ static int B2gCudaTest05(void)
         result &= (pb->nop_in_buffer == max_pkts_in_buffer);
         result &= (pb2->nop_in_buffer == max_pkts_in_buffer);
         start_ = UtilCpuGetTicks();
-        B2gCudaMpmDispatcher(NULL, (Packet *)pb, b2g_tctx, (PacketQueue *)&data_queues[tmq_outq->id], NULL);
+        B2gCudaMpmDispatcher(NULL, (Packet *)pb, b2g_tctx, (PacketQueue *)data_queues[tmq_outq->id], NULL);
         stop_ = UtilCpuGetTicks();
-        TmqhOutputSimpleOnQ(&data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
-        while ((pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(&data_queues[b2g_tctx->tmq_streamq->id])) != NULL) {
-            TmqhOutputSimpleOnQ(&data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
+        TmqhOutputSimpleOnQ(data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
+        while ((pb = (SCCudaPBPacketsBuffer *)SCDQDataDequeue(data_queues[b2g_tctx->tmq_streamq->id])) != NULL) {
+            TmqhOutputSimpleOnQ(data_queues[tmq_inq->id], (SCDQGenericQData *)pb);
         }
         time_stream_ += stop_ - start_;
     }


