diff options
Diffstat (limited to 'src/framework/common')
18 files changed, 128 insertions, 128 deletions
diff --git a/src/framework/common/base/include/common/common_mem_buf.h b/src/framework/common/base/include/common/common_mem_buf.h index d0d3588..441da6a 100644 --- a/src/framework/common/base/include/common/common_mem_buf.h +++ b/src/framework/common/base/include/common/common_mem_buf.h @@ -26,7 +26,7 @@ typedef enum __DMM_PROC_TYPE { DMM_PROC_T_AUTO = 0, /*auto detect */ DMM_PROC_T_PRIMARY = 1, /* set to primary */ - DMM_PROC_T_SECONDARY = 2, /* set to seconday */ + DMM_PROC_T_SECONDARY = 2, /* set to secondary */ DMM_PROC_T_INVALID } DMM_PROC_TYPE; diff --git a/src/framework/common/base/include/common_pal_bitwide_adjust.h b/src/framework/common/base/include/common_pal_bitwide_adjust.h index 96ae54e..0e68533 100644 --- a/src/framework/common/base/include/common_pal_bitwide_adjust.h +++ b/src/framework/common/base/include/common_pal_bitwide_adjust.h @@ -34,11 +34,11 @@ extern void **g_LMegAddrArry; /*get Local Seg addr by segIdx*/ #define HMEM_SEG_LVADDR(segid) (g_LMegAddrArry[segid]) -/*get SegIDX by PrimSegAddr, just get the arry Idx of g_PMemSegArry*/ +/*get SegIDX by PrimSegAddr, just get the array Idx of g_PMemSegArry*/ #define HMEM_SEGID(segaddr) ((struct common_mem_memseg*)segaddr - &(g_PMemSegArry[0])) /***************************************************************** -Parameters : LMegAddrArry[] Loacol common_mem_memseg addr Arry +Parameters : LMegAddrArry[] Local common_mem_memseg addr Array SegNum common_mem_memseg Num. Return : Description : init g_PrimAddr2LocalMap g_LocalAddr2PrimMap while the process start diff --git a/src/framework/common/base/liblinuxapi/nsfw_base_linux_api.c b/src/framework/common/base/liblinuxapi/nsfw_base_linux_api.c index de98877..4e59d68 100644 --- a/src/framework/common/base/liblinuxapi/nsfw_base_linux_api.c +++ b/src/framework/common/base/liblinuxapi/nsfw_base_linux_api.c @@ -50,7 +50,7 @@ typedef struct __base_linux_api #include "base_linux_api_declare.h" } base_linux_api; -nsfw_base_state g_nsfw_mudule_state = BASE_STATE_INIT; +nsfw_base_state g_nsfw_module_state = BASE_STATE_INIT; pthread_mutex_t g_nsfw_init_mutex = PTHREAD_MUTEX_INITIALIZER; base_linux_api g_nsfw_posix_api = { 0 }; @@ -84,30 +84,30 @@ nsfw_posix_api_init () int iret = NSFW_BASE_OK; /*if init already, just return success, if init fail before, just return err */ - if (BASE_STATE_INIT != g_nsfw_mudule_state) + if (BASE_STATE_INIT != g_nsfw_module_state) { return (BASE_STATE_SUCCESS == - g_nsfw_mudule_state ? NSFW_BASE_OK : NSFW_BASE_FAIL); + g_nsfw_module_state ? NSFW_BASE_OK : NSFW_BASE_FAIL); } (void) pthread_mutex_lock (&g_nsfw_init_mutex); /*if init already, just return success, if init fail before, just return err */ - if (BASE_STATE_INIT != g_nsfw_mudule_state) + if (BASE_STATE_INIT != g_nsfw_module_state) { (void) pthread_mutex_unlock (&g_nsfw_init_mutex); return (BASE_STATE_SUCCESS == - g_nsfw_mudule_state ? NSFW_BASE_OK : NSFW_BASE_FAIL); + g_nsfw_module_state ? NSFW_BASE_OK : NSFW_BASE_FAIL); } iret = nsfw_posix_symbol_load (); if (NSFW_BASE_OK == iret) { - g_nsfw_mudule_state = BASE_STATE_SUCCESS; + g_nsfw_module_state = BASE_STATE_SUCCESS; } else { - g_nsfw_mudule_state = BASE_STATE_FAIL; + g_nsfw_module_state = BASE_STATE_FAIL; } (void) pthread_mutex_unlock (&g_nsfw_init_mutex); diff --git a/src/framework/common/data_struct/eprb_tree.c b/src/framework/common/data_struct/eprb_tree.c index c8af17c..c8e616d 100644 --- a/src/framework/common/data_struct/eprb_tree.c +++ b/src/framework/common/data_struct/eprb_tree.c @@ -55,7 +55,7 @@ __ep_rb_rotate_left (struct ep_rb_node *X, struct ep_rb_root *root) **************************/ struct ep_rb_node *Y = (struct ep_rb_node *) ADDR_SHTOL (X->rb_right); - /* estblish X->Right link */ + /* establish X->Right link */ X->rb_right = Y->rb_left; if (Y->rb_left != NULL) @@ -64,7 +64,7 @@ __ep_rb_rotate_left (struct ep_rb_node *X, struct ep_rb_root *root) (struct ep_rb_node *) ADDR_LTOSH_EXT (X); } - /* estblish Y->Parent link */ + /* establish Y->Parent link */ Y->rb_parent = X->rb_parent; if (X->rb_parent) @@ -101,7 +101,7 @@ __ep_rb_rotate_right (struct ep_rb_node *X, struct ep_rb_root *root) ****************************/ struct ep_rb_node *Y = (struct ep_rb_node *) ADDR_SHTOL (X->rb_left); - /* estblish X->Left link */ + /* establish X->Left link */ X->rb_left = Y->rb_right; if (Y->rb_right != NULL) @@ -110,7 +110,7 @@ __ep_rb_rotate_right (struct ep_rb_node *X, struct ep_rb_root *root) (struct ep_rb_node *) ADDR_LTOSH_EXT (X); } - /* estblish Y->Parent link */ + /* establish Y->Parent link */ Y->rb_parent = X->rb_parent; if (X->rb_parent) @@ -190,7 +190,7 @@ ep_rb_insert_color (struct ep_rb_node *X, struct ep_rb_root *root) } else { - /* miror image of above code */ + /* mirror image of above code */ struct ep_rb_node *Y = (struct ep_rb_node *) ADDR_SHTOL (EP_RBTREE_GRANDF (X)->rb_left); diff --git a/src/framework/common/data_struct/sha256.c b/src/framework/common/data_struct/sha256.c index 213eb4e..f0773cf 100644 --- a/src/framework/common/data_struct/sha256.c +++ b/src/framework/common/data_struct/sha256.c @@ -270,7 +270,7 @@ SHA_fin1 (u8 hval[], SHA256_CTX ctx[1], const unsigned int hlen) { u32 i = (u32) (ctx->count[0] & SHA256_MASK); - /* Not unusal shift operation. Checked with purify. */ + /* Not unusual shift operation. Checked with purify. */ /*put bytes in the buffer in an order in which references to */ /*32-bit words will put bytes with lower addresses into the */ diff --git a/src/framework/common/mem_mgr/include/nsfw_mem_desc.h b/src/framework/common/mem_mgr/include/nsfw_mem_desc.h index 1e959d9..9a14c8d 100644 --- a/src/framework/common/mem_mgr/include/nsfw_mem_desc.h +++ b/src/framework/common/mem_mgr/include/nsfw_mem_desc.h @@ -30,10 +30,10 @@ #define NSFW_NAME_LENCHECK_RET(name, desc) \ { \ i32 inamelen = strlen(name); \ - if (inamelen >= NSFW_MEM_APPNAME_LENTH) \ + if (inamelen >= NSFW_MEM_APPNAME_LENGTH) \ { \ NSCOMM_LOGERR("name length check fail] desc=%s, name len=%d, expected max=%d", \ - #desc, inamelen, NSFW_MEM_APPNAME_LENTH); \ + #desc, inamelen, NSFW_MEM_APPNAME_LENGTH); \ return NSFW_MEM_ERR; \ } \ } @@ -41,10 +41,10 @@ #define NSFW_NAME_LENCHECK_RET_NULL(name, desc) \ { \ i32 inamelen = strlen(name); \ - if (inamelen >= NSFW_MEM_APPNAME_LENTH) \ + if (inamelen >= NSFW_MEM_APPNAME_LENGTH) \ { \ NSCOMM_LOGERR("name length check fail] desc=%s, name len=%d, expected max=%d", \ - #desc, inamelen, NSFW_MEM_APPNAME_LENTH); \ + #desc, inamelen, NSFW_MEM_APPNAME_LENGTH); \ return NULL; \ } \ } @@ -123,7 +123,7 @@ typedef struct { i32 (*mem_ops_init) (nsfw_mem_para * para); void (*mem_ops_destroy) (void); - mzone_handle (*mem_ops_zone_creae) (nsfw_mem_zone * pinfo); + mzone_handle (*mem_ops_zone_create) (nsfw_mem_zone * pinfo); i32 (*mem_ops_zone_createv) (nsfw_mem_zone * pmeminfo, i32 inum, mzone_handle * paddr_array, i32 iarray_num); mzone_handle (*mem_ops_zone_lookup) (nsfw_mem_name * pname); diff --git a/src/framework/common/mem_mgr/include/nsfw_ring_data.h b/src/framework/common/mem_mgr/include/nsfw_ring_data.h index 99ec0ed..e6007ab 100644 --- a/src/framework/common/mem_mgr/include/nsfw_ring_data.h +++ b/src/framework/common/mem_mgr/include/nsfw_ring_data.h @@ -65,7 +65,7 @@ struct nsfw_mem_ring u8 ringflag; //scmp, scsp, mcsp,mcmp u16 reserv; //reserv data u32 size; //size of the Ring, must 2^n - u32 eltsize; //for sppool, it is the size of per buf, if is ring, eltsize is zero. + u32 eltsize; //for s-pool, it is the size of per buf, if is ring, eltsize is zero. u32 mask; //mask of the Ring, used mask mod Head/Tail to get real pos, must 2^n-1 void *Addrbase; /*Cause the Addr we support just 40b(1024G), we using a basAddr+offset to get the real addr; ring[x].data_s.val just store offset; * not used when no shared mode @@ -78,13 +78,13 @@ struct nsfw_mem_ring struct { - volatile u32 head; //Head of the Ring, used to indicat pos where to pull a val + volatile u32 head; //Head of the Ring, used to indicate pos where to pull a val volatile u32 tail; //for nshmem, shmem not used. } prod; struct { volatile u32 head; //for nshmem, shmem not used. - volatile u32 tail; //Tail of the Ring, used to indicat pos where to push a val + volatile u32 tail; //Tail of the Ring, used to indicate pos where to push a val } cons; u32 uireserv[4]; //reserved for update union RingData_U ring[0]; //Value of Ring diff --git a/src/framework/common/mem_mgr/include/nsfw_ring_fun.h b/src/framework/common/mem_mgr/include/nsfw_ring_fun.h index 57a7bf3..d74cc4b 100644 --- a/src/framework/common/mem_mgr/include/nsfw_ring_fun.h +++ b/src/framework/common/mem_mgr/include/nsfw_ring_fun.h @@ -71,7 +71,7 @@ nsfw_mem_ring_init (struct nsfw_mem_ring *ring, unsigned int size, /* another way to init Pool while no continuous space -1. init a empt rte_perf_ring +1. init a empty rte_perf_ring 2. add element to PerRing. */ static inline void diff --git a/src/framework/common/mem_mgr/nsfw_mem_api.c b/src/framework/common/mem_mgr/nsfw_mem_api.c index b795921..c89ada1 100644 --- a/src/framework/common/mem_mgr/nsfw_mem_api.c +++ b/src/framework/common/mem_mgr/nsfw_mem_api.c @@ -34,7 +34,7 @@ /***************************************************************************** * Prototype : nsfw_mem_init * Description : memory mgr module init -* Input : point to nstak_fwmem_para +* Input : point to nstack_fwmem_para * Output : None * Return Value : i32 * Calls : @@ -88,7 +88,7 @@ nsfw_mem_init (void *para) } } - /*if some module init fail, destory the moudles that success */ + /*if some module init fail, destory the modules that success */ if (icount < g_mem_type_num) { for (iindex = 0; iindex < icount; iindex++) @@ -111,7 +111,7 @@ nsfw_mem_init (void *para) * Description : create a block memory with name * nsfw_mem_zone::stname * nsfw_mem_zone::isize -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_zone* pinfo * Output : None * Return Value : mzone_handle @@ -130,16 +130,16 @@ nsfw_mem_zone_create (nsfw_mem_zone * pinfo) return NULL; } - MEM_OP_CALL_OK_RET (pinfo->stname.entype, mem_ops_zone_creae, (pinfo)); + MEM_OP_CALL_OK_RET (pinfo->stname.entype, mem_ops_zone_create, (pinfo)); NSCOMM_LOGINF ("mem create fail] memtype=%d, name=%s, size=%zu", - pinfo->stname.entype, pinfo->stname.aname, pinfo->lenth); + pinfo->stname.entype, pinfo->stname.aname, pinfo->length); return NULL; } /***************************************************************************** * Prototype : nsfw_mem_zone_createv * Description : create some memory blocks -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_zone* pmeminfo * i32 inum * mzone_handle* paddr_array @@ -174,7 +174,7 @@ nsfw_mem_zone_createv (nsfw_mem_zone * pmeminfo, i32 inum, /***************************************************************************** * Prototype : nsfw_mem_zone_lookup * Description : look up a memory -* 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory. * note : 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, * end with none created by nStackMaster, and end with _<pid> created by other. @@ -252,7 +252,7 @@ nsfw_mem_mbfmp_create (nsfw_mem_mbfpool * pbufinfo) /***************************************************************************** * Prototype : nsfw_mem_mbfmp_createv * Description : create some mbuf pools -* 1. the name of lenth must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the name of length must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_mbfpool* pmbfname * i32 inum * mpool_handle* phandle_array @@ -328,7 +328,7 @@ nsfw_mem_mbf_free (mbuf_handle mhandle, nsfw_mem_type entype) /***************************************************************************** * Prototype : nsfw_mem_mbfmp_lookup * Description : look up mbuf mpool -* 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory. * note : 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, * end with none created by nStackMaster, and end with _<pid> created by other. @@ -358,7 +358,7 @@ nsfw_mem_mbfmp_lookup (nsfw_mem_name * pmbfname) /***************************************************************************** * Prototype : nsfw_mem_mbfmp_release * Description : release mbuf pool -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_name* pname * Output : None * Return Value : i32 @@ -379,7 +379,7 @@ nsfw_mem_mbfmp_release (nsfw_mem_name * pname) /***************************************************************************** * Prototype : nsfw_mem_sp_create * Description : create a simple pool -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_sppool* pmpinfo * Output : None * Return Value : mring_handle @@ -407,7 +407,7 @@ nsfw_mem_sp_create (nsfw_mem_sppool * pmpinfo) /***************************************************************************** * Prototype : nsfw_mem_sp_createv * Description : create some simple pools one time -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_sppool* pmpinfo * i32 inum * mring_handle* pringhandle_array @@ -433,7 +433,7 @@ nsfw_mem_sp_createv (nsfw_mem_sppool * pmpinfo, i32 inum, /***************************************************************************** * Prototype : nsfw_mem_sp_ring_create * Description : create a simple pool with many rings -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_mring* pringinfo * mring_handle* pringhandle_array * i32 iringnum @@ -459,7 +459,7 @@ nsfw_mem_sp_ring_create (nsfw_mem_mring * pringinfo, /***************************************************************************** * Prototype : nsfw_mem_sp_release * Description : release a simple mempool -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * Input : nsfw_mem_name* pname * Output : None * Return Value : i32 @@ -479,7 +479,7 @@ nsfw_mem_sp_release (nsfw_mem_name * pname) /***************************************************************************** * Prototype : nsfw_mem_sp_lookup * Description : look up a simpile ring -* 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory. * note : 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, * end with none created by nStackMaster, and end with _<pid> created by other. @@ -510,8 +510,8 @@ nsfw_mem_sp_lookup (nsfw_mem_name * pname) /***************************************************************************** * Prototype : nsfw_mem_ring_create * Description : create a ring -* note : 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. -* 2. shared memory ring (NSFW_SHMEM) just can put a pointor into the queue, the queue also point to a shared block memory. +* note : 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. +* 2. shared memory ring (NSFW_SHMEM) just can put a pointer into the queue, the queue also point to a shared block memory. * no shared memory ring(NSFW_NSHMEM) is other wise. * Input : nsfw_mem_mring* pringinfo * Output : None @@ -541,7 +541,7 @@ nsfw_mem_ring_create (nsfw_mem_mring * pringinfo) /***************************************************************************** * Prototype : nsfw_mem_ring_lookup * Description : look up a ring by name -* 1. the lenth of name must be less than NSFW_MEM_APPNAME_LENTH. +* 1. the length of name must be less than NSFW_MEM_APPNAME_LENGTH. * 2. if the memory is shared, pname->enowner indicate that who create this memory. * note: * 1. when calling any shared memory create inferface, the name of memory end with _0 created by nStackMain, @@ -730,7 +730,7 @@ nsfw_mem_mbfpool_free_count (mpool_handle mhandle) /***************************************************************************** * Prototype : nsfw_mem_ring_release * Description : release a ring memory -* notes : the lenth of name must be less than NSFW_MEM_APPNAME_LENTH +* notes : the length of name must be less than NSFW_MEM_APPNAME_LENGTH * Input : nsfw_mem_name* pname * Output : None * Return Value : i32 @@ -752,7 +752,7 @@ nsfw_mem_ring_release (nsfw_mem_name * pname) * Prototype : nsfw_mem_get_len * Description : statics mbufpool, sppool, ring mem size. * return: <=0, err happen, >0 mem size -* NSFW_MEM_MZONE: not surport because you already know the lenth when create +* NSFW_MEM_MZONE: not surport because you already know the length when create * Input : void * handle * nsfw_mem_struct_type type * Output : None @@ -853,25 +853,25 @@ nsfw_mem_mbuf_iterator (mpool_handle handle, u32 start, u32 end, * Description : print ring info * Input : mring_handle mhandle * Output : None -* Return Value : if no err happen, return the lenth of string print, 0 or -1 maybe err happen +* Return Value : if no err happen, return the length of string print, 0 or -1 maybe err happen * Calls : * Called By : *****************************************************************************/ i32 -nsfw_mem_dfx_ring_print (mring_handle mhandle, char *pbuf, int lenth) +nsfw_mem_dfx_ring_print (mring_handle mhandle, char *pbuf, int length) { struct nsfw_mem_ring *temp = (struct nsfw_mem_ring *) mhandle; u32 head = 0; u32 tail = 0; int ret = 0; - if ((!temp) || (!pbuf) || (lenth <= 0)) + if ((!temp) || (!pbuf) || (length <= 0)) { return 0; } head = temp->prod.head; tail = temp->cons.tail; ret = - SPRINTF_S (pbuf, lenth, + SPRINTF_S (pbuf, length, "[.Head=%u,\n .Tail=%u,\n .(|Tail-Head|)=%u,\n .size=%u,\n .mask=%u]\n", head, tail, (tail >= head) ? (tail - head) : (head - tail), temp->size, temp->mask); diff --git a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mdesc.c b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mdesc.c index c78c27e..fdb2079 100644 --- a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mdesc.c +++ b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mdesc.c @@ -40,7 +40,7 @@ nsfw_mem_ops g_nshmem_ops = { nsfw_nshmem_ringcreate, NULL, nsfw_nshmem_ringrelease, - nsfw_nshmem_stactic, + nsfw_nshmem_static, NULL, NULL, /*mem_ops_sp_iterator */ NULL, /*mem_ops_mbuf_iterator */ diff --git a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.c b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.c index d5661fd..49e3769 100644 --- a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.c +++ b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.c @@ -181,7 +181,7 @@ nsfw_nshmem_destory (void) * Prototype : nsfw_nshmem_reserv_safe * Description : malloc a memory and save to memzone * Input : const char* name -* size_t lenth +* size_t length * Output : None * Return Value : mzone_handle * Calls : @@ -189,20 +189,20 @@ nsfw_nshmem_destory (void) * *****************************************************************************/ mzone_handle -nsfw_nshmem_reserv_safe (const char *name, size_t lenth) +nsfw_nshmem_reserv_safe (const char *name, size_t length) { void *addr = NULL; i32 iret = NSFW_MEM_OK; nsfw_nshmem_mzone *pmemzone = NULL; - if (lenth <= 0) + if (length <= 0) { return NULL; } nsfw_write_lock (nsfw_get_glb_lock ()); - addr = malloc (lenth); + addr = malloc (length); if (!addr) { NSCOMM_LOGERR ("nshmem malloc addr fail] addr=%p", addr); @@ -210,7 +210,7 @@ nsfw_nshmem_reserv_safe (const char *name, size_t lenth) return NULL; } - iret = MEMSET_S (addr, lenth, 0, lenth); + iret = MEMSET_S (addr, length, 0, length); if (EOK != iret) { NSCOMM_LOGERR ("nshmem malloc addr MEMSET_S fail] addr=%p", addr); @@ -230,8 +230,8 @@ nsfw_nshmem_reserv_safe (const char *name, size_t lenth) } pmemzone->addr = addr; - pmemzone->lenth = lenth; - /*name must be less than NSFW_MEM_APPNAME_LENTH */ + pmemzone->length = length; + /*name must be less than NSFW_MEM_APPNAME_LENGTH */ if (EOK != STRCPY_S ((char *) pmemzone->aname, sizeof (pmemzone->aname), name)) { @@ -256,7 +256,7 @@ nsfw_nshmem_create (nsfw_mem_zone * pinfo) NSFW_NAME_LENCHECK_RET_NULL (pinfo->stname.aname, "nshmem create"); NSFW_NSHMEM_INIT_CHK_RET_NULL (); - return nsfw_nshmem_reserv_safe (pinfo->stname.aname, pinfo->lenth); + return nsfw_nshmem_reserv_safe (pinfo->stname.aname, pinfo->length); } /***************************************************************************** @@ -284,7 +284,7 @@ nsfw_nshmem_lookup (nsfw_mem_name * pname) mz = &g_nshmem_internal_cfg->amemzone[icnt]; if (mz->addr != NULL - && !strncmp (pname->aname, mz->aname, NSFW_MEM_NAME_LENTH)) + && !strncmp (pname->aname, mz->aname, NSFW_MEM_NAME_LENGTH)) { nsfw_read_unlock (nsfw_get_glb_lock ()); return mz->addr; @@ -320,7 +320,7 @@ nsfw_nshmem_release (nsfw_mem_name * pname) mz = &g_nshmem_internal_cfg->amemzone[icnt]; if (mz->addr != NULL - && !strncmp (pname->aname, mz->aname, NSFW_MEM_NAME_LENTH)) + && !strncmp (pname->aname, mz->aname, NSFW_MEM_NAME_LENGTH)) { nsfw_nshmem_free_zone (mz); nsfw_read_unlock (nsfw_get_glb_lock ()); @@ -380,7 +380,7 @@ nsfw_nshmem_spcreate (nsfw_mem_sppool * pmpinfo) ringflag].ring_ops_enqueue (pringhead, (void *) pmz)) { - NSCOMM_LOGERR ("nsfw_nshmem_ringenqueue enque fail] uscnt=%u", + NSCOMM_LOGERR ("nsfw_nshmem_ringenqueue enqueue fail] uscnt=%u", uscnt); } @@ -516,7 +516,7 @@ nsfw_nshmem_ring_statics (mring_handle handle) } /***************************************************************************** -* Prototype : nsfw_nshmem_stactic +* Prototype : nsfw_nshmem_static * Description : static the memory size according to mem type * Input : void* handle * nsfw_mem_struct_type type @@ -527,7 +527,7 @@ nsfw_nshmem_ring_statics (mring_handle handle) * *****************************************************************************/ ssize_t -nsfw_nshmem_stactic (void *handle, nsfw_mem_struct_type type) +nsfw_nshmem_static (void *handle, nsfw_mem_struct_type type) { switch (type) { diff --git a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.h b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.h index 3f5b1b9..06ab562 100644 --- a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.h +++ b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_mng.h @@ -25,9 +25,9 @@ typedef struct { - i8 aname[NSFW_MEM_NAME_LENTH]; + i8 aname[NSFW_MEM_NAME_LENGTH]; void *addr; - int lenth; + int length; } nsfw_nshmem_mzone; typedef struct @@ -42,7 +42,7 @@ typedef struct i32 nsfw_nshmem_init (nsfw_mem_para * para); /* - * no share memory moudle destory + * no share memory module destory */ void nsfw_nshmem_destory (void); @@ -65,6 +65,6 @@ mring_handle nsfw_nshmem_ringcreate (nsfw_mem_mring * pringinfo); i32 nsfw_nshmem_ringrelease (nsfw_mem_name * pname); -ssize_t nsfw_nshmem_stactic (void *handle, nsfw_mem_struct_type type); +ssize_t nsfw_nshmem_static (void *handle, nsfw_mem_struct_type type); #endif diff --git a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_ring.c b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_ring.c index 780596c..7e56f3c 100644 --- a/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_ring.c +++ b/src/framework/common/mem_mgr/nsfw_nshmem/nsfw_nshmem_ring.c @@ -186,7 +186,7 @@ nsfw_nshmem_ring_mp_enqueue (struct nsfw_mem_ring *mem_ring, void *obj_table) common_mem_pause (); /* Set COMMON_RING_PAUSE_REP_COUNT to avoid spin too long waiting - * for other thread finish. It gives pre-empted thread a chance + * for other thread finish. It gives pre-emptied thread a chance * to proceed and finish with ring dequeue operation. */ /* check the queue can be operate */ if (++rep == 5) @@ -311,7 +311,7 @@ nsfw_nshmem_ring_mc_dequeuev (struct nsfw_mem_ring *r, void **obj_table, common_mem_pause (); /* Set COMMON_RING_PAUSE_REP_COUNT to avoid spin too long waiting - * for other thread finish. It gives pre-empted thread a chance + * for other thread finish. It gives pre-emptied thread a chance * to proceed and finish with ring dequeue operation. */ /* check the queue can be operate */ if (++rep == 5) @@ -327,7 +327,7 @@ nsfw_nshmem_ring_mc_dequeuev (struct nsfw_mem_ring *r, void **obj_table, } /*this is a multi thread/process dequeue function, please pay attention to the bellow point -1. while dequeue corrupt, the tail no one added, may multy the try times. +1. while dequeue corrupt, the tail no one added, may multi the try times. */ int nsfw_nshmem_ring_mc_dequeue (struct nsfw_mem_ring *ring, void **box) @@ -422,7 +422,7 @@ nsfw_nshmem_ring_singlethread_dequeuev (struct nsfw_mem_ring *ring, { 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; 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; |