diff options
author | charan makkina <charan795m@gmail.com> | 2019-04-30 17:40:53 +0530 |
---|---|---|
committer | charan makkina <charan795m@gmail.com> | 2019-05-20 18:14:40 +0530 |
commit | a826fe833d3f2a8fe2673fa05811fe1a22baf045 (patch) | |
tree | da11a17c46ca9b8a002a52a290628574fa3f5eda /stacks/lwip_stack/release/lwip_helper_files/arch/queue.c | |
parent | 3e6bf7b64eea418c59959c18750261b815b2892c (diff) |
Feature: 19.04 part 1
Change-Id: Ibba924b8deca1f246b9dcb12d89d085b6fd33046
Signed-off-by: charan makkina <charan795m@gmail.com>
Diffstat (limited to 'stacks/lwip_stack/release/lwip_helper_files/arch/queue.c')
-rw-r--r-- | stacks/lwip_stack/release/lwip_helper_files/arch/queue.c | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/stacks/lwip_stack/release/lwip_helper_files/arch/queue.c b/stacks/lwip_stack/release/lwip_helper_files/arch/queue.c deleted file mode 100644 index 4916dae..0000000 --- a/stacks/lwip_stack/release/lwip_helper_files/arch/queue.c +++ /dev/null @@ -1,120 +0,0 @@ -#include <pthread.h> -#include "lwip/memp.h" -#include "lwip/mem.h" - -#include "arch/queue.h" -#include "lwip/sys.h" -#include "nstack_log.h" -#include "lwip/sockets.h" -#include "stackx_spl_share.h" -#include "lwip/api.h" -#include "lwip/ip.h" -#include <netif/sc_dpdk.h> - -err_t -queue_push (queue_t * q, void *pmsg, int isTrypush) -{ - int pushRet; - // struct tcpip_msg* _msg = pmsg; - - //enum tcpip_msg_type tcpip_type = TCPIP_MSG_MAX; - //struct new_api_msg* lo_newapimsg = NULL; - // enum api_msg_type api_type = NEW_MSG_API_MAX; - // struct netconn *lo_conn = NULL; - //u64_t tcp_tx_bytes = 0; - while (1) - { - pushRet = nsfw_mem_ring_enqueue (q->llring, pmsg); - - switch (pushRet) - { - - case -1: - NSSOC_LOGERR ("Box range check has failed]llring_a=%p, msg=%p", - q->llring, pmsg); - return ERR_MEM; - - case 1: - return ERR_OK; - - default: - if (isTrypush) - { - return ERR_MEM; - } - else - { - continue; - } - } - } -} - -void * -queue_pop (queue_t * q, u32_t * timeout, int isTryPop) -{ - void *pmsg; - int popRet; - int retVal; - u32_t ellapsetime = 0; -// struct tcpip_msg* _msg; - struct timespec starttm = { 0 }; - struct timespec endtm; - u32_t timeDiff; - if (*timeout != 0) - { - retVal = clock_gettime (CLOCK_MONOTONIC, &starttm); - if (0 != retVal) - { - NSPOL_LOGERR ("clock_gettime() failed]"); - *timeout = SYS_ARCH_TIMEOUT; - return NULL; - } - } - - while (1) - { - //TODO:May have to consider, take out the data sharing problem - popRet = nsfw_mem_ring_dequeue (q->llring, &pmsg); - - switch (popRet) - { - case 1: - *timeout = ellapsetime; - return pmsg; - - default: - - if (isTryPop) - { - *timeout = SYS_ARCH_TIMEOUT; - return NULL; - } - else - { - if (*timeout != 0) - { - retVal = clock_gettime (CLOCK_MONOTONIC, &endtm); - if (0 != retVal) - { - NSPOL_LOGERR ("clock_gettime() failed]"); - *timeout = SYS_ARCH_TIMEOUT; - return NULL; - } - - timeDiff = endtm.tv_sec - starttm.tv_sec; - if (timeDiff > *timeout) - { - *timeout = SYS_ARCH_TIMEOUT; - return NULL; - } - sys_sleep_ns (0, 100000); - } - - continue; - } - - } - } - -} |