aboutsummaryrefslogtreecommitdiffstats
path: root/src/framework/common/mem_mgr/nsfw_shmem
diff options
context:
space:
mode:
authorRahul Gupta <rahul.g.chimera@gmail.com>2018-06-26 11:19:13 +0530
committerRahul Gupta <rahul.g.chimera@gmail.com>2018-06-26 11:19:13 +0530
commit82b5e45ebf316afd7daa97d9f9b7b75636fb4e64 (patch)
treefabed7d2c0cc187206b2f2e768a4afaafa046bd8 /src/framework/common/mem_mgr/nsfw_shmem
parent24cbcfaa6fa1121dec1a029a1df114f065341156 (diff)
Spell correction
Change-Id: Icc062e358398ecf0fc46b7a55ce1c37a71aee650 Signed-off-by: Rahul Gupta <rahul.g.chimera@gmail.com>
Diffstat (limited to 'src/framework/common/mem_mgr/nsfw_shmem')
-rw-r--r--src/framework/common/mem_mgr/nsfw_shmem/nsfw_rshmem_mng.c38
-rw-r--r--src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mdesc.c2
-rw-r--r--src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c44
-rw-r--r--src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.h8
-rw-r--r--src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_ring.c22
5 files changed, 57 insertions, 57 deletions
diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_rshmem_mng.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_rshmem_mng.c
index dc3400d..c29b108 100644
--- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_rshmem_mng.c
+++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_rshmem_mng.c
@@ -53,16 +53,16 @@
}
/*init the msg head*/
-#define NSFW_SHMEM_MSG_HEAD_INIT(pmsg, type, lenth) { \
+#define NSFW_SHMEM_MSG_HEAD_INIT(pmsg, type, length) { \
(pmsg)->usmsg_type = (type); \
- (pmsg)->uslenth = (lenth); \
+ (pmsg)->uslength = (length); \
}
/*rsp msg head check, and if err goto*/
-#define NSFW_SHMEM_MSGHEAD_CHK_GOTO(pmsg, type, lenth, gotoflag) { \
- if (((type) != pmsg->usmsg_type) && ((lenth) != pmsg->uslenth)) \
+#define NSFW_SHMEM_MSGHEAD_CHK_GOTO(pmsg, type, length, gotoflag) { \
+ if (((type) != pmsg->usmsg_type) && ((length) != pmsg->uslength)) \
{ \
- NSCOMM_LOGERR("check fail] msgtype=%d, type_para=%d, len=%d", (pmsg->usmsg_type), (type), (lenth)); \
+ NSCOMM_LOGERR("check fail] msgtype=%d, type_para=%d, len=%d", (pmsg->usmsg_type), (type), (length)); \
goto gotoflag; \
} \
}
@@ -77,9 +77,9 @@
}
/*mzone msg init*/
-#define NSFW_SHMEM_MZONE_DATA_INIT(pdata, slenth, seg, socketid) { \
+#define NSFW_SHMEM_MZONE_DATA_INIT(pdata, slength, seg, socketid) { \
(pdata)->isocket_id = (socketid); \
- (pdata)->lenth = (slenth); \
+ (pdata)->length = (slength); \
(pdata)->usseq = (seg); \
(pdata)->ireserv = 0; \
}
@@ -201,7 +201,7 @@ release:
}
/*
- *create some memorys by send a msg
+ *create some memories by send a msg
*/
i32
nsfw_memzone_remote_reserv_v (nsfw_mem_zone * pmeminfo,
@@ -255,9 +255,9 @@ nsfw_memzone_remote_reserv_v (nsfw_mem_zone * pmeminfo,
pmeminfo[itindex].stname.aname, pid);
if (-1 == retVal)
{
- NSCOMM_LOGERR ("SPRINTF_S faild]ret=%d", retVal);
+ NSCOMM_LOGERR ("SPRINTF_S failed]ret=%d", retVal);
}
- NSFW_SHMEM_MZONE_DATA_INIT (ptempdata, pmeminfo[itindex].lenth,
+ NSFW_SHMEM_MZONE_DATA_INIT (ptempdata, pmeminfo[itindex].length,
(u16) itindex,
pmeminfo[itindex].isocket_id);
@@ -302,9 +302,9 @@ nsfw_memzone_remote_reserv_v (nsfw_mem_zone * pmeminfo,
pmeminfo[itindex].stname.aname, pid);
if (-1 == retVal)
{
- NSCOMM_LOGERR ("SPRINTF_S faild]ret=%d", retVal);
+ NSCOMM_LOGERR ("SPRINTF_S failed]ret=%d", retVal);
}
- NSFW_SHMEM_MZONE_DATA_INIT (ptempdata, pmeminfo[itindex].lenth,
+ NSFW_SHMEM_MZONE_DATA_INIT (ptempdata, pmeminfo[itindex].length,
(u16) itindex,
pmeminfo[itindex].isocket_id);
ptempdata++;
@@ -526,7 +526,7 @@ nsfw_remote_shmem_mbf_createv (nsfw_mem_mbfpool * pmbfname,
goto lerr;
}
- /*interrup msg head */
+ /*interrupt msg head */
pack_head = GET_USER_MSG (nsfw_shmem_msg_head, prsp_msg);
NSFW_SHMEM_MSGHEAD_CHK_GOTO (pack_head, NSFW_MBUF_ACK_MSG,
ieltnum * sizeof (nsfw_shmem_ack),
@@ -737,7 +737,7 @@ nsfw_remote_shmem_mpcreatev (nsfw_mem_sppool * pmpinfo,
goto mperr;
}
- /*interrup mgs head */
+ /*interrupt mgs head */
pack_head = GET_USER_MSG (nsfw_shmem_msg_head, prsp_msg);
NSFW_SHMEM_MSGHEAD_CHK_GOTO (pack_head, NSFW_SPPOOL_ACK_MSG,
ieltnum * sizeof (nsfw_shmem_ack),
@@ -851,7 +851,7 @@ nsfw_remote_shmem_ringcreate (const char *name, unsigned int n, i32 socket_id,
goto release;
}
- /*interrup mgs head */
+ /*interrupt mgs head */
pack_head = GET_USER_MSG (nsfw_shmem_msg_head, prsp_msg);
NSFW_SHMEM_MSGHEAD_CHK_GOTO (pack_head, NSFW_RING_ACK_MSG,
sizeof (nsfw_shmem_ack), release);
@@ -871,8 +871,8 @@ release:
/*
*create a mem pool that the members are rings by send a msg
*ieltnum:the num of ring member
- *iringnum:the num of ring in simple mem pook
- *entype:the defualt the of ring
+ *iringnum:the num of ring in simple mem pool
+ *entype:the default the of ring
*/
i32
nsfw_remote_shmem_ringcreatev (const char *name, i32 ieltnum,
@@ -951,7 +951,7 @@ nsfw_remote_shmem_lookup (const i8 * name, nsfw_mem_struct_type entype)
pdata = NSFW_SHMEM_GET_DATA (pdata_head, nsfw_shmem_lookup_req);
if (EOK != STRCPY_S (pdata->aname, sizeof (pdata->aname), name))
{
- NSCOMM_LOGERR ("STRCPY_S faild]name=%s", name);
+ NSCOMM_LOGERR ("STRCPY_S failed]name=%s", name);
}
pdata->usseq = 0;
pdata->ustype = entype;
@@ -965,7 +965,7 @@ nsfw_remote_shmem_lookup (const i8 * name, nsfw_mem_struct_type entype)
goto release;
}
- /*interrup mgs head */
+ /*interrupt mgs head */
pack_head = GET_USER_MSG (nsfw_shmem_msg_head, prsp_msg);
NSFW_SHMEM_MSGHEAD_CHK_GOTO (pack_head, NSFW_MEM_LOOKUP_ACK_MSG,
sizeof (nsfw_shmem_ack), perr);
diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mdesc.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mdesc.c
index e7a11ad..2e9c969 100644
--- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mdesc.c
+++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mdesc.c
@@ -40,7 +40,7 @@ nsfw_mem_ops g_shmem_ops = {
nsfw_shmem_ringcreate,
nsfw_shmem_ring_lookup,
nsfw_shmem_ringrelease,
- nsfw_shmem_stactic,
+ nsfw_shmem_static,
nsfw_shmem_mbuf_recycle,
nsfw_shmem_sp_iterator,
nsfw_shmem_mbuf_iterator
diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c
index f85e70d..270e0f8 100644
--- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c
+++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.c
@@ -155,23 +155,23 @@ nsfw_shmem_create (nsfw_mem_zone * pinfo)
NSFW_INIT_CHK_RET_NULL ()if (NSFW_PROC_MAIN == NSFW_SHMEM_FLAG)
{
return common_memzone_data_reserve_name (pinfo->stname.aname,
- pinfo->lenth,
+ pinfo->length,
pinfo->isocket_id);
}
else
{
- /*app must less than NSFW_MEM_APPNAME_LENTH */
+ /*app must less than NSFW_MEM_APPNAME_LENGTH */
NSFW_NAME_LENCHECK_RET_NULL (pinfo->stname.aname, "shmem create")
if (-1 ==
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x",
pinfo->stname.aname, NSFW_SHMEM_PID))
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S failed]");
return NULL;
}
}
- return nsfw_memzone_remote_reserv ((char *) &aname[0], pinfo->lenth,
+ return nsfw_memzone_remote_reserv ((char *) &aname[0], pinfo->length,
SOCKET_ID_ANY);
}
@@ -220,20 +220,20 @@ nsfw_shmem_lookup (nsfw_mem_name * pname)
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s", pname->aname);
if (-1 == retVal)
{
- NSCOMM_LOGERR ("SPRINTF_S faild");
+ NSCOMM_LOGERR ("SPRINTF_S failed");
return NULL;
}
}
else
{
- /*app must less than NSFW_MEM_APPNAME_LENTH */
+ /*app must less than NSFW_MEM_APPNAME_LENGTH */
NSFW_NAME_LENCHECK_RET_NULL (pname->aname, "shmem lookup")
int retVal =
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x", pname->aname,
NSFW_SHMEM_PID);
if (-1 == retVal)
{
- NSCOMM_LOGERR ("SPRINTF_S faild");
+ NSCOMM_LOGERR ("SPRINTF_S failed");
return NULL;
}
}
@@ -265,7 +265,7 @@ nsfw_shmem_release (nsfw_mem_name * pname)
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x",
pname->aname, NSFW_SHMEM_PID))
{
- NSCOMM_LOGERR ("SPRINTF_S faild");
+ NSCOMM_LOGERR ("SPRINTF_S failed");
return NSFW_MEM_ERR;
}
}
@@ -291,13 +291,13 @@ nsfw_shmem_mbfmpcreate (nsfw_mem_mbfpool * pbufinfo)
}
else
{
- /*app must less than NSFW_MEM_APPNAME_LENTH */
+ /*app must less than NSFW_MEM_APPNAME_LENGTH */
NSFW_NAME_LENCHECK_RET_NULL (pbufinfo->stname.aname, "mbufpool create")
if (-1 ==
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x",
pbufinfo->stname.aname, NSFW_SHMEM_PID))
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S failed]");
}
}
@@ -374,18 +374,18 @@ nsfw_shmem_mbfmplookup (nsfw_mem_name * pmbfname)
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s",
pmbfname->aname))
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S failed]");
}
}
else
{
- /*app must less than NSFW_MEM_APPNAME_LENTH */
+ /*app must less than NSFW_MEM_APPNAME_LENGTH */
NSFW_NAME_LENCHECK_RET_NULL (pmbfname->aname, "shmem lookup")
if (-1 ==
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x",
pmbfname->aname, NSFW_SHMEM_PID))
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S failed]");
}
}
@@ -412,7 +412,7 @@ nsfw_shmem_spcreate (nsfw_mem_sppool * pmpinfo)
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x",
pmpinfo->stname.aname, NSFW_SHMEM_PID))
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S failed]");
}
}
@@ -512,7 +512,7 @@ nswf_shmem_sp_ringcreate (nsfw_mem_mring * prpoolinfo,
prpoolinfo->stname.aname, NSFW_SHMEM_PID);
if (-1 == retVal)
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S failed]");
}
}
@@ -549,7 +549,7 @@ nsfw_shmem_sprelease (nsfw_mem_name * pname)
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x",
pname->aname, NSFW_SHMEM_PID))
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S failed]");
}
}
@@ -584,18 +584,18 @@ nsfw_shmem_sp_lookup (nsfw_mem_name * pname)
if (-1 ==
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s", pname->aname))
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S fails]");
}
}
else
{
- /*app's name can not over NSFW_MEM_APPNAME_LENTH */
+ /*app's name can not over NSFW_MEM_APPNAME_LENGTH */
NSFW_NAME_LENCHECK_RET_NULL (pname->aname, "shmem lookup")
if (-1 ==
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x",
pname->aname, NSFW_SHMEM_PID))
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S failed]");
}
}
@@ -622,7 +622,7 @@ nsfw_shmem_ringcreate (nsfw_mem_mring * pringinfo)
SPRINTF_S (aname, COMMON_MEM_MEMPOOL_NAMESIZE, "%s_%x",
pringinfo->stname.aname, NSFW_SHMEM_PID))
{
- NSCOMM_LOGERR ("SPRINTF_S faild]");
+ NSCOMM_LOGERR ("SPRINTF_S failed]");
}
}
@@ -680,7 +680,7 @@ nsfw_shmem_ring_statics (mring_handle handle)
}
ssize_t
-nsfw_shmem_stactic (void *handle, nsfw_mem_struct_type type)
+nsfw_shmem_static (void *handle, nsfw_mem_struct_type type)
{
switch (type)
{
@@ -737,7 +737,7 @@ nsfw_shmem_mbuf_recycle (mpool_handle handle)
1.if proc.head != proc.tail set proc.head to proc.tail [may lost some buf,but the queue still can use]
App May not putIn Data , just done head++, we can't set proc.tail to proc.head.
2.if cons.head != cons.tail set cons.tail to cons.head [may lost some buf,but the queue still can use]
- App May alread finish deque,just not tail++, we can't set cons.head to cons.tail.
+ App May already finish deque,just not tail++, we can't set cons.head to cons.tail.
*/
if ((rteRing->prod.head != rteRing->prod.tail)
|| (rteRing->cons.head != rteRing->cons.tail))
diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.h b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.h
index f81b34a..d489525 100644
--- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.h
+++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_mng.h
@@ -19,7 +19,7 @@
/*
* mem mgr module init
- * para:point to nstak_fwmem_para
+ * para:point to nstack_fwmem_para
*/
i32 nsfw_shmem_init (nsfw_mem_para * para);
@@ -37,7 +37,7 @@ void nsfw_shmem_destroy (void);
mzone_handle nsfw_shmem_create (nsfw_mem_zone * pinfo);
/*
- *create some blocks memeory
+ *create some blocks memory
*/
i32 nsfw_shmem_createv (nsfw_mem_zone * pmeminfo, i32 inum,
mzone_handle * paddr_array, i32 iarray_num);
@@ -72,7 +72,7 @@ mbuf_handle nsfw_shmem_mbfalloc (mpool_handle mhandle);
i32 nsfw_shmem_mbffree (mbuf_handle mhandle);
/*
- *put mbuf backto mbuf pool
+ *put mbuf back to mbuf pool
*/
i32 nsfw_shmem_mbfmprelease (nsfw_mem_name * pname);
@@ -121,7 +121,7 @@ mring_handle nsfw_shmem_ring_lookup (nsfw_mem_name * pname);
*/
i32 nsfw_shmem_ringrelease (nsfw_mem_name * pname);
-ssize_t nsfw_shmem_stactic (void *handle, nsfw_mem_struct_type type);
+ssize_t nsfw_shmem_static (void *handle, nsfw_mem_struct_type type);
i32 nsfw_shmem_mbuf_recycle (mpool_handle handle);
diff --git a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_ring.c b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_ring.c
index af46e18..c42c840 100644
--- a/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_ring.c
+++ b/src/framework/common/mem_mgr/nsfw_shmem/nsfw_shmem_ring.c
@@ -119,7 +119,7 @@ nsfw_shmem_pool_create (const char *name, unsigned int n,
unsigned int num = common_mem_align32pow2 (n + 1);
struct nsfw_shmem_ring_head *pcur = NULL;
- /*calculat the empty rte_perf_ring Size */
+ /*calculate the empty rte_perf_ring Size */
size_t len =
sizeof (struct nsfw_shmem_ring_head) + sizeof (struct nsfw_mem_ring) +
(size_t) num * sizeof (union RingData_U) + (size_t) num * elt_size;
@@ -258,7 +258,7 @@ nsfw_shmem_pool_create (const char *name, unsigned int n,
break;
}
- // second time allocate should not containd all ring head
+ // second time allocate should not contained all ring head
alloc_len =
(size_t) (num - alloc_index) * elt_size +
sizeof (struct nsfw_shmem_ring_head);
@@ -341,7 +341,7 @@ nsfw_shmem_ring_mp_enqueue (struct nsfw_mem_ring *ring, void *box)
if (tmpTail + size - CurHead == 0)
{
/*
- here we give enque a chance to recorrect the Tail, if tail not has Data let tail++
+ here we give enqueue a chance to recorrect the Tail, if tail not has Data let tail++
*/
if (ring->ring[tmpTail & mask].data_s.val == 0)
{
@@ -374,10 +374,10 @@ nsfw_shmem_ring_mp_enqueue (struct nsfw_mem_ring *ring, void *box)
{
/*
enqueue success, add Head Value now
- here we using CAS set instead __sync_fetch_and_add(&ring->Head, 1) to assume that, if one process enque sucess && been killed before
+ here we using CAS set instead __sync_fetch_and_add(&ring->Head, 1) to assume that, if one process enqueue success && been killed before
add Head, other process can recorrect the Head Value;
one more thing the direction of Tail must been add-direction, so we using the condition (ring->Head - CurHead >0x80000000);
- while many thread do enque at same time, Head may not correct,exp:
+ while many thread do enqueue at same time, Head may not correct,exp:
thread A get old head 10, thread A want set head to 11
thread B get old head 10, thread B want set head to 12
thread A do CAS && thread B do CAS at same time, thread A do CAS success;
@@ -385,7 +385,7 @@ nsfw_shmem_ring_mp_enqueue (struct nsfw_mem_ring *ring, void *box)
then thread C get old head 11, thread C will set head to 13[cause pos 12 already has value, thread C will skill 12],
the head will be recorrect by thread C.
- if no thread C, thread A& B are the last enque thread; the head must recorrect by the deque function.
+ if no thread C, thread A& B are the last enqueue thread; the head must recorrect by the deque function.
*/
tmpHead = ring->prod.head;
@@ -441,7 +441,7 @@ nsfw_shmem_ring_sp_enqueue (struct nsfw_mem_ring *ring, void *box)
if (tmpTail + uisize - CurHead == 0)
{
/*
- *here we give enque a chance to recorrect the Tail, if tail not has Data let tail++
+ *here we give enqueue a chance to recorrect the Tail, if tail not has Data let tail++
*/
if (ring->ring[tmpTail & mask].data_s.val == 0)
{
@@ -523,7 +523,7 @@ nsfw_shmem_ring_mc_dequeue (struct nsfw_mem_ring *ring, void **box)
/*
enqueue success, add Tail Value now
- here we using CAS set instead __sync_fetch_and_add(&ring->Tail, 1) to assume that, if one process dequeue sucess && been killed before
+ here we using CAS set instead __sync_fetch_and_add(&ring->Tail, 1) to assume that, if one process dequeue success && been killed before
add Tail, other process can recorrect the Tail Value;
one more thing the direction of Tail must been add-direction, so we using the condition (rlTail - CurTail >0x80000000);
while multi CAS done the result value of CurTail may not correct, but we don't care, it will be recorrect while next deque done.
@@ -611,7 +611,7 @@ nsfw_shmem_ring_mc_dequeuev (struct nsfw_mem_ring *ring, void **box,
/*
enqueue success, add Tail Value now
- here we using CAS set instead __sync_fetch_and_add(&ring->Tail, 1) to assume that, if one process dequeue sucess && been killed before
+ here we using CAS set instead __sync_fetch_and_add(&ring->Tail, 1) to assume that, if one process dequeue success && been killed before
add Tail, other process can recorrect the Tail Value;
one more thing the direction of Tail must been add-direction, so we using the condition (rlTail - CurTail >0x80000000);
@@ -790,7 +790,7 @@ nsfw_shmem_ring_singlethread_dequeue (struct nsfw_mem_ring *ring, void **box)
{
u32 tail = 0;
- /* if all entries are dequed return 0 */
+ /* if all entries are dequeued return 0 */
if (unlikely (ring->prod.head == ring->cons.tail))
{
return 0;
@@ -818,7 +818,7 @@ nsfw_shmem_ring_singlethread_dequeuev (struct nsfw_mem_ring *ring, void **box,
{
tail = ring->cons.tail;
- /* if all entries are dequed return 0 */
+ /* if all entries are dequeued return 0 */
if (unlikely (ring->prod.head == ring->cons.tail))
{
return num;