aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYalei Wang <william.wangyalei@huawei.com>2018-03-13 16:36:34 +0800
committerYalei Wang <william.wangyalei@huawei.com>2018-03-13 16:53:35 +0800
commit3a5bf13c0e7b427b805a372dc1ed1bd5d7759082 (patch)
treeffd702b15322b978936cd19e5a4c4e40b78c46ca
parent415f9ac8797c22c45364c38bb0dcfc1f5c202bf7 (diff)
Clean up the src and update the doc
Change-Id: If9c9cdb3ae5167198f0a2ae085871ff7134b32b0 Signed-off-by: Yalei Wang <william.wangyalei@huawei.com>
-rw-r--r--README68
-rw-r--r--doc/Build_DMM.md33
-rw-r--r--doc/DMM_DeveloperManual.md58
-rw-r--r--doc/DMM_developer_manual_V1.23.docxbin360842 -> 389088 bytes
-rw-r--r--scripts/README.md12
-rw-r--r--scripts/header.template16
-rw-r--r--scripts/header2.template16
-rw-r--r--scripts/lic.sh88
-rw-r--r--scripts/remove_header.awk63
-rw-r--r--scripts/replace_header.sh27
-rw-r--r--src/adapt/nstack_epoll_comm.c1
-rw-r--r--src/framework/CMakeLists.txt1
-rw-r--r--src/framework/common/base/include/common_pal_bitwide_adjust.h20
-rw-r--r--src/framework/include/nsfw_mgr_com_api.h2
-rw-r--r--src/framework/include/nstack_log.h110
-rw-r--r--src/framework/include/nstack_trace.h76
-rw-r--r--src/framework/ipc/mgr_com/mgr_com.c6
-rw-r--r--src/framework/log/nstack_log.c4
-rw-r--r--src/framework/tracing/nstack_trace.c52
-rw-r--r--src/nSocket/kernel/linux_kernel_module.c145
-rw-r--r--src/nSocket/nstack/nstack.c2
-rw-r--r--src/nSocket/nstack/nstack_socket.c97
-rw-r--r--src/nSocket/nstack/nstack_socket.h29
23 files changed, 122 insertions, 804 deletions
diff --git a/README b/README
deleted file mode 100644
index b0f3243..0000000
--- a/README
+++ /dev/null
@@ -1,68 +0,0 @@
-一、DMM compile
-
-1.compile all module:
-cd build
-cmake -D DMM_DPDK_INSTALL_DIR=$DPDK_INSTALL_PATH ..
-make -j 8
-
-Note: DPDK_INSTALL_PATH - the path in which DPDK has been installed
-
-libnStackAdpt.so, libnStackAPI.so, libsecurec.so will be copyed to release\lib64 folder.
-declare_syscalls.h, nsocket_dmm_api.h will be copyed to release\include folder
-
-configure files :
- release\configure
- module_config.json is the stack module config file.
- rd_config.json is the rd config file.
- the content of these two configure files just a simple.
-
-2. run DMM
-nStack DMM is just a library linked by APP, no need run any other.
-
-for example:
- gcc -g -o sendmsg sendmsg.c -L./DMM/release/lib64 -lnStackAPI
- sendmsg.c is a APP that create a socket and connect to the service.
- run app:./sendmsg 192.168.1.10 1024 1
-
- module_config.json rd_config.json should be put together with sendmsg
-
- module_config.json for example:
- {
- "default_stack_name": "kernel", /*when rd can't not be find maybe choose the defualt one*/
- "module_list": [
- {
- "stack_name": "kernel",
- "function_name": "kernel_stack_register",
- "libname": "", /*library name, if loadtype is static, this maybe null, else must give a library name*/
- "loadtype": "static", /*library load type: static or dynamic*/
- "deploytype": "1",
- "maxfd": "1024",
- "minfd": "0",
- "priorty": "1",
- "stackid": "0", /*must be ordered and not be repeated*/
- }
- ]
- }
-
- rd_config.json for example:
- {
- "ip_route": [
- {
- "subnet": "192.165.1.1/16",
- "type": "nstack-kernel", /*output interface type, nstack-kernel: indicate that this ip should go through linux protocol, nstack-dpdk: go through stackx protocol*/
- },
- {
- "subnet": "192.167.1.1/16",
- "type": "nstack-kernel",
- }
- ]
- "prot_route": [
- {
- "proto_type": "11",
- "type": "nstack-kernel",
- },
- }
-
-
-
- \ No newline at end of file
diff --git a/doc/Build_DMM.md b/doc/Build_DMM.md
index 12105de..be49bd0 100644
--- a/doc/Build_DMM.md
+++ b/doc/Build_DMM.md
@@ -50,7 +50,7 @@ Check hugepage info HugePages_
```
```
- #mkdir /var/run/ip_module ##if not exist
+ #mkdir -p /var/run/ip_module
#export LD_LIBRARY_PATH=/root/xxxx/DMM/release/lib64/
```
Note:
@@ -76,34 +76,3 @@ Note:
```
#make -j 8
```
- Note:
-
- Sometimes compilation fails due to GLOB lib dependency, to solve this problem by following steps.
-
-```
- #cd ../thirdparty/glog/glog-0.3.4
- #sudo autoreconf -ivf
- #cd
- #make -j 8
- #bash -x release_tar.sh
-```
-
-Note:
-
- Update path of DPDK install with /root/dpdk_build/tmp2 in below file
-```
- #vim ./release/script/nstack_var.sh # you can change it
-```
-
-# 4. Bring up the nStackMain process:
-```
- #rm -rf /product
- #mkdir /product/
- #chmod 777 /product/
- #mkdir /mnt/nstackhuge -p
- #goto /DMM/
- #tar zxvf nStackServer.tar.gz
- #cd nStackServer
- #./start_nstack.sh
- #ps -ef | grep nStackMain
-``` \ No newline at end of file
diff --git a/doc/DMM_DeveloperManual.md b/doc/DMM_DeveloperManual.md
index cbed4f1..04df384 100644
--- a/doc/DMM_DeveloperManual.md
+++ b/doc/DMM_DeveloperManual.md
@@ -38,7 +38,7 @@
[**4.2.1.5** **DMM-adapter APIs**4bae](#DMM-adapter-APIs)
-[**4.2.1.6** **nstack\_adp\t_init**4baf](#nstack_adpt_init)
+[**4.2.1.6** **nstack\_adpt\_init**4baf](#nstack_adpt_init)
[**4.2.2** **epoll architecture** 4bb](#epoll-architecture)
@@ -230,8 +230,8 @@ b. Protocol stack needs to call the nstack\_adpt\_init
--------- | ------
event\_notify | Section 4.2.2.3
ep\_pdata\_free | Section 4.2.2.4
- obj\_recycle\_reg | Section 4.2.7.1
- mbuf\_alloc | Section 4.2.6.1
+ obj\_recycle\_reg | Section 4.2.6.1
+ obj\_recycle\_fun | Section 4.2.6.2
List2. The function provided by DMM-adaptor. This will be used by protocol stack
@@ -343,7 +343,7 @@ provided by the DMM adapter.
This field marks whether the stack needs to release the epoll resources. If it
is 1, DMM will not release resources when close is called, and the stack must
calls the interface provided by DMM adapter to release after releasing its own
-resources. If it is 0, DMM(nSocket) released the source directly directly.
+resources. If it is 0, DMM(nSocket) released the source directly.
**4.2.1.3 nstack\_stack\_register\_fn**
@@ -373,12 +373,12 @@ typedef struct __nstack_event_cb
Detail in the Section 4.2.3
-**4.2.1.4 nstack\_proc\_cb:**
+**4.2.1.4 nstack\_proc\_cb**
```
typedef struct __nstack_proc_ops{
- nstack_socket_ops socket_ops; /*posix socket api*/
- nstack_extern_ops extern_ops; /*other proc callback*/
+ nstack_socket_ops socket_ops; /*posix socket api*/
+ nstack_extern_ops extern_ops; /*other proc callback*/
} nstack_proc_cb;
typedef struct __nstack_extern_ops {
@@ -389,7 +389,7 @@ typedef struct __nstack_extern_ops {
void (*fork_free_fd) (int s, pid_t p, pid_t c); /*for SOCK_CLOEXEC when fork if needed. */
unsigned int (*ep_ctl) (int epFD, int proFD, int ctl_ops, struct epoll_event * event, void *pdata); /*when fd add to epoll fd, triggle stack to proc if need */
unsigned int (*ep_getevt) (int epFD, int profd, unsigned int events); /*check whether some events exist really */
- int (*ep_prewait_proc) (int epfd);
+ int (*ep_prewait_proc) (int epfd); /* The pretreatment before epwait by stack-x */
int (*stack_fd_check) (int s, int flag); /*check whether fd belong to stack, if belong, return 1, else return 0 */
int (*stack_alloc_fd) (); /*alloc a fd id for epoll */
int (*peak) (int s); /*used for stack-x , isource maybe no need */
@@ -699,7 +699,7 @@ The following flow chart shows how fork process is handled:
#### **4.2.4.1 fork\_init\_child**
-`int (* fork_init_child) (s, pid_t p, pid_t c)`
+`int (* fork_init_child) (pid_t p, pid_t c)`
**Description:**
@@ -710,8 +710,8 @@ reaches 0.
**Parameters:**
-*s*: file descriptor of the socket to be operated
*p*: parent process pid
+
*c*: child process pid
@@ -730,9 +730,8 @@ It is a special treatment for SOCK_CLOEXEC.
**Parameters:**
*s*: socket fd
-*p*: parent process pid
-*c*: Child process pid
+*p*: parent process pid
**Interface Implemented by:** Protocol stack.
@@ -750,7 +749,9 @@ reaches 0.
**Parameter Description:**
*s*: file descriptor of the socket to be operated
+
*p*: parent process pid
+
*c*: child process pid
**Interface Implemented by:** Protocol stack.
@@ -768,7 +769,9 @@ It is a special treatment for SOCK\_CLOEXEC.
**Parameters:**
*s*: socket fd.
+
*p*: parent process pid.
+
*c*: child process pid.
**Interface Implemented by:** Protocol stack
@@ -781,8 +784,8 @@ the feature.
### **4.2.6 Resource recovery**
Protocol stack must implement resource recovery. When the application crashes
-or exits, the resources allocated by protocol stack must be released.
-Otherwise, it causes resources leaking and can crash the system.
+or exits, the resources allocated by protocol stack must be released,
+otherwise it causes resources leaking and can crash the system.
DMM provides the following mechanism to support the feature.
@@ -826,22 +829,25 @@ The initialization function for the LRD module is defined as follows.
```
- int nstack_rd_init(nstack_stack_info *pstack, int num, nstack_get_route_data pfun)
+int nstack_rd_init (nstack_stack_info *pstack, int num, nstack_get_route_data *pfun, int fun_num)
-typedef struct __nstack_stack_info {
- char name[STACK_NAME_MAX]; /*stack name*/
- int stack_id; /*stack id*/
- /*when route info not found, high priority stack was chose,
- same priority chose fist input one*/
- int priority; /*0: highest: route info not found choose first*/
-} nstack_stack_info;
+typedef struct __nstack_rd_stack_info
+{
+ /*stack name */
+ rd_stack_plane_map stack;
+ /*stack id */
+ int stack_id;
+ /*when route info not found, high priority stack was chose, same priority chose fist input one */
+ int priority; /*0: highest: route info not found choose first */
+} nstack_rd_stack_info;
/*rd local data*/
typedef struct __rd_local_data {
- nstack_rd_stack_info *pstack_info; /* all stack info*/
+ nstack_rd_stack_info *pstack_info;
int stack_num;
- nstack_rd_list route_list[RD_DATA_TYPE_MAX]; /*route table*/
- nstack_get_route_data sys_fun;
+ nstack_rd_list route_list[RD_DATA_TYPE_MAX]; /*route table */
+ nstack_get_route_data sys_fun[NSTACK_SYS_FUN_MAX]; /*rd data sys proc function list */
+ int fun_num;
} rd_local_data;
rd_local_data *g_rd_local_data = NULL;
@@ -872,7 +878,7 @@ rd_stack_plane_map g_nstack_plane_info[] = {
```
When application calls the DMM socket, connect, sendto, sendmsg APIS, it
-triggers the nSocket module to invoke the nStack\_rd\_get\_stackid() API to get
+triggers the nSocket module to invoke the nstack\_rd\_get\_stackid() API to get
the route information. The protocol stack is then selected based on the
returned protocol stack ID.
diff --git a/doc/DMM_developer_manual_V1.23.docx b/doc/DMM_developer_manual_V1.23.docx
index d8aa3fa..b644beb 100644
--- a/doc/DMM_developer_manual_V1.23.docx
+++ b/doc/DMM_developer_manual_V1.23.docx
Binary files differ
diff --git a/scripts/README.md b/scripts/README.md
index d6c2bdc..351020e 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -1,14 +1,2 @@
To run checkstyle :
./checkstyle.sh [-options]
-
-To modify license:
-./lic.sh
-
-from
- CPUB(lwip_writev)
- NSTACK_CAL_FUN(fdInf->ops, writev, (fdInf->rlfd, iov, iovcnt), size);
- CPUE(lwip_writev)
-to
- CPUB(writev)
- NSTACK_CAL_FUN(fdInf->ops, writev, (fdInf->rlfd, iov, iovcnt), size);
- CPUE(writev) \ No newline at end of file
diff --git a/scripts/header.template b/scripts/header.template
deleted file mode 100644
index d3fe9f2..0000000
--- a/scripts/header.template
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
-*
-* Copyright (c) 2018 Huawei Technologies Co.,Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at:
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
diff --git a/scripts/header2.template b/scripts/header2.template
deleted file mode 100644
index edf38d0..0000000
--- a/scripts/header2.template
+++ /dev/null
@@ -1,16 +0,0 @@
-#########################################################################
-#
-# Copyright (c) 2018 Huawei Technologies Co.,Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#########################################################################
-
diff --git a/scripts/lic.sh b/scripts/lic.sh
deleted file mode 100644
index a3c95e2..0000000
--- a/scripts/lic.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-#########################################################################
-#
-# Copyright (c) 2018 Huawei Technologies Co.,Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#########################################################################
-
-function remove_copyright_a {
- printf "%s\n" 1,14d w q | ed "$1"
-}
-
-function remove_copyright_b {
- printf "%s\n" 1,14d w q | ed "$1"
-}
-
-function add_copyright {
- if [[ $1 == Makefile ]]; then
- ed "$1" <<END
-0i
-/*
- * Copyright (c) 2015 Huawei and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-.
-w
-q
-END
- else
- ed "$1" <<END
-0i
-/*
- * Copyright (c) 2015 HUAWEI and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-.
-w
-q
-END
- fi
-}
-
-shopt -s nullglob globstar
-#for file in **/*.[ch]; do
- # ./replace_header.sh "$file"
-#done
-
-for i in $(find ./../ -type f)
-do
- if [[ ${i} != *"thirdparty"* ]] && [[ ${i} != *"testcode"* ]] && [[ ${i} != *"resources"* ]] && [[ ${i} != *"build"* ]] ; then
- if [ "${i: -2}" == ".c" ] || [ "${i: -2}" == ".h" ] ; then
- ./replace_header.sh "$i" "header.template"
- elif [[ "${i}" == *"Makefile" ]] || [ "${i: -4}" == ".txt" ] || [ "${i: -3}" == ".sh" ] ; then
- grep -q "Apache License" ${i}
- if [ $? != 0 ]; then
- ./replace_header.sh "$i" "header2.template"
- fi
- fi
- fi
-done
diff --git a/scripts/remove_header.awk b/scripts/remove_header.awk
deleted file mode 100644
index 9e83877..0000000
--- a/scripts/remove_header.awk
+++ /dev/null
@@ -1,63 +0,0 @@
-#########################################################################
-#
-# Copyright (c) 2018 Huawei Technologies Co.,Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#########################################################################
-# This script removes ANSI C file header comments
-BEGIN { start = 0; incomment = 0;}
-
-{
- if (start == 0)
- {
- if (incomment == 0)
- {
- # C++ single line comment
- if (/^\/\//)
- {
- # print "single line"
- }
- # single line comment
- else if (/^\/\*[^\/]*\*\/$/)
- {
- # print "single line"
- }
- # multi line comment
- else if (/^\/\*/)
- {
- #print "start comment"
- # start multi line comment
- incomment = 1
- }
- else
- {
- # first line that is not a comment, start normal output
- print $0;
- start = 1;
- }
- }
- else
- {
- # search for comment end
- if (/\*\//)
- {
- #print "end comment"
- incomment = 0;
- }
- }
- }
- else
- {
- # print the complete line for the rest of the file
- print $0
- }
-}
diff --git a/scripts/replace_header.sh b/scripts/replace_header.sh
deleted file mode 100644
index 3339533..0000000
--- a/scripts/replace_header.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#########################################################################
-#
-# Copyright (c) 2018 Huawei Technologies Co.,Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#########################################################################
-
-#!/bin/bash
-SOURCE_DIR=`dirname $0`
-if [ $# != 2 ]; then
- echo "Usage: replace_header.sh <file> <header.template>"
- exit 1
-fi
-
-cat $SOURCE_DIR/$2 > $SOURCE_DIR/tmp
-cat $1 | awk -f $SOURCE_DIR/remove_header.awk >> $SOURCE_DIR/tmp
-mv $SOURCE_DIR/tmp $1
-
diff --git a/src/adapt/nstack_epoll_comm.c b/src/adapt/nstack_epoll_comm.c
index 1f3fd02..0eb0b82 100644
--- a/src/adapt/nstack_epoll_comm.c
+++ b/src/adapt/nstack_epoll_comm.c
@@ -143,7 +143,6 @@ nsep_initEpInfo (nsep_epollInfo_t * info)
NSTACK_STATIC void
nsep_destroy_epinfo (nsep_epollInfo_t * info)
{
- // TODO: Here we need to free the semaphore
return;
}
diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt
index 78c5a45..78072c6 100644
--- a/src/framework/CMakeLists.txt
+++ b/src/framework/CMakeLists.txt
@@ -27,7 +27,6 @@ FILE(GLOB LOG log/*.c)
FILE(GLOB SNAPSHOT snapshot/*.c)
FILE(GLOB STARTUP startup/*.c)
FILE(GLOB MAINTAIN maintain/*.c)
-FILE(GLOB TRACEING tracing/*.c)
FILE(GLOB HAL hal/*.c)
FILE(GLOB DMM_ADPT ../adapt/*.c)
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 850742b..96ae54e 100644
--- a/src/framework/common/base/include/common_pal_bitwide_adjust.h
+++ b/src/framework/common/base/include/common_pal_bitwide_adjust.h
@@ -26,26 +26,6 @@
#include "common_func.h"
-#ifndef _UT_FUN_DISABLE_
-/*define struct for UT restore global variant*/
-struct ut_adjust_global
-{
- void **ut_PrimAddr2LocalMap;
- uint64_t *ut_LocalAddr2PrimMap;
- void *ut_LocalBaseAddr;
- void *ut_LocalMaxAddr;
- void *ut_LocalCfgAddrBase;
- uint64_t ut_PrimBaseAddr;
- uint64_t ut_PrimMaxAddr;
- uint64_t ut_PrimCfgAddrBase;
- int ut_PrimSameFlg;
- uint64_t ut_LBitMask;
- int ut_LBitMaskLen;
- struct common_mem_memseg *ut_PMemSegArry;
- void **ut_LMegAddrArry;
-};
-#endif
-
#define ALIGN_SIZET(size) ((uint64_t)(size))
#define ALIGN_PTR(PTR) ((uint64_t)(PTR))
diff --git a/src/framework/include/nsfw_mgr_com_api.h b/src/framework/include/nsfw_mgr_com_api.h
index 2499fee..099cdbc 100644
--- a/src/framework/include/nsfw_mgr_com_api.h
+++ b/src/framework/include/nsfw_mgr_com_api.h
@@ -150,8 +150,6 @@ typedef struct _nsfw_mgr_msg
u32 src_pid;
u32 dst_pid;
- u64 traceid;
-
u8 msg_body[NSFW_MGR_MSG_BODY_LEN];
} nsfw_mgr_msg;
diff --git a/src/framework/include/nstack_log.h b/src/framework/include/nstack_log.h
index bb90ec8..1f0749a 100644
--- a/src/framework/include/nstack_log.h
+++ b/src/framework/include/nstack_log.h
@@ -34,7 +34,6 @@
#include <sys/types.h>
#include <signal.h>
#include "types.h"
-#include "nstack_trace.h"
#include "glog/nstack_glog.ph"
#include "glog/nstack_glog_in.h"
@@ -275,65 +274,24 @@ extern __thread unsigned int nstack_log_nonreentry;
/* hanging up version check log need restrain */
extern int ctrl_log_switch;
-#if defined MPTCP_UT
-#define NS_LOGPID(_module,_prestr,_level,fmt, ...)
-#elif !defined FOR_NSTACK_UT
+
#define NS_LOGPID(_module,_prestr,_level,fmt, ...) \
{\
if (log_shooting(_module, _level) && (0 == nstack_log_nonreentry) && (0 == ctrl_log_switch))\
{\
nstack_log_nonreentry = 1;\
- NSTACK_TRACING(_level, _prestr, fmt,##__VA_ARGS__);\
if(nstack_log_info_check(_module, _level))\
glog_print(LOG_TYPE(_module,_level),_prestr,level_stoa(_level),-1,GET_FILE_NAME(__FILE__),\
__LINE__,__func__,fmt, ##__VA_ARGS__);\
nstack_log_nonreentry = 0;\
}\
}
-#else
-static inline void
-ut_log_info (const char *file_name, int line_no, const char *func_name,
- int _module, const char *_prestr, unsigned int _level, char *fmt,
- ...)
-{
- va_list ap;
-
- if (log_shooting (_module, _level) && (0 == nstack_log_nonreentry)
- && (0 == ctrl_log_switch))
- {
-
- nstack_log_nonreentry = 1;
- if (nstack_log_info_check (_module, _level))
- {
- char pMsgBuf[MAX_LOG_TRANSITIONAL_LEN] = "\0";
- va_start (ap, fmt);
- VSNPRINTF_S (pMsgBuf,
- MAX_LOG_TRANSITIONAL_LEN,
- MAX_LOG_TRANSITIONAL_LEN - 1, fmt, ap);
- glog_print (LOG_TYPE (_module, _level), _prestr,
- level_stoa (_level), -1, GET_FILE_NAME (file_name),
- line_no, func_name, "%s", pMsgBuf);
- va_end (ap);
- }
- nstack_log_nonreentry = 0;
-
- }
-}
-#define NS_LOGPID(_module,_prestr,_level,fmt, ...) \
-{\
- ut_log_info(__FILE__,__LINE__, __func__, _module,_prestr,_level,fmt, ##__VA_ARGS__); \
-}
-
-#endif
-
-#ifndef FOR_NSTACK_UT
#define NS_LOG_CTRL(_id, _module, _prestr, _level, fmt, ...) \
{\
if (log_shooting(_module, _level) && (0 == nstack_log_nonreentry) && check_log_prt_time(_id))\
{\
nstack_log_nonreentry = 1;\
- NSTACK_TRACING(_level, _prestr, fmt,##__VA_ARGS__);\
if(nstack_log_info_check(_module, _level))\
glog_print(LOG_TYPE(_module,_level),_prestr,level_stoa(_level),get_unprt_log_count(_id),\
GET_FILE_NAME(__FILE__),__LINE__,__func__,fmt, ##__VA_ARGS__);\
@@ -342,42 +300,6 @@ ut_log_info (const char *file_name, int line_no, const char *func_name,
}\
}
-#else
-static inline void
-ut_ctrl_log_info (char *file_name, int line_no, char *func_name, int _id,
- int _module, char *_prestr, unsigned int _level, char *fmt,
- ...)
-{
- va_list ap;
- if (log_shooting (_module, _level) && (0 == nstack_log_nonreentry)
- && check_log_prt_time (_id))
- {
- nstack_log_nonreentry = 1;
- if (nstack_log_info_check (_module, _level))
- {
- char pMsgBuf[MAX_LOG_TRANSITIONAL_LEN] = "\0";
- va_start (ap, fmt);
- VSNPRINTF_S (pMsgBuf,
- MAX_LOG_TRANSITIONAL_LEN,
- MAX_LOG_TRANSITIONAL_LEN - 1, fmt, ap);
- glog_print (LOG_TYPE (_module, _level), _prestr,
- level_stoa (_level), get_unprt_log_count (_id),
- GET_FILE_NAME (file_name), line_no, func_name, "%s",
- pMsgBuf);
- va_end (ap);
- }
- clr_unprt_log_count (_id);
- nstack_log_nonreentry = 0;
-
- }
-}
-
-#define NS_LOG_CTRL(_id, _module, _prestr, _level, fmt, ...) \
-{\
- ut_ctrl_log_info(__FILE__,__LINE__, __func__, _id, _module,_prestr,_level,fmt, ##__VA_ARGS__); \
-}
-
-#endif
#define NS_LOG_CTRL_STACKX(_id, dbug,_module,_prestr,_level,fmt, ...) \
{\
@@ -547,34 +469,4 @@ void clr_unprt_log_count (int id);
void get_current_time (char *buf, const int len);
-#ifdef CPU_CYCLES
-static __inline__ unsigned long long
-nstack_rdtsc (void)
-{
- unsigned hi, lo;
- __asm__ __volatile__ ("rdtsc":"=a" (lo), "=d" (hi));
- return ((unsigned long long) lo) | (((unsigned long long) hi) << 32);
-}
-
-#define CPUB(name) \
-unsigned long long start##name = 0;\
-unsigned long long stop##name = 0;\
-static unsigned long long total##name = 0;\
-static unsigned long long total_cout##name = 0;\
-start##name = nstack_rdtsc();
-
-#define CPUE(name) \
-stop##name = nstack_rdtsc();\
-total##name += (stop##name - start##name);\
-if(++total_cout##name == 1000000)\
-{\
- NSSOC_LOGINF(#name" cpu %llu-------\n", total##name / total_cout##name);\
- total##name = 0;\
- total_cout##name = 0;\
-}
-#else
-#define CPUB(name)
-#define CPUE(name)
-#endif
-
#endif
diff --git a/src/framework/include/nstack_trace.h b/src/framework/include/nstack_trace.h
deleted file mode 100644
index 0f4f640..0000000
--- a/src/framework/include/nstack_trace.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-*
-* Copyright (c) 2018 Huawei Technologies Co.,Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at:
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef __NSTACK_TRACE_H__
-#define __NSTACK_TRACE_H__
-
-#ifdef __cplusplus
-/* *INDENT-OFF* */
-extern "C"{
-/* *INDENT-ON* */
-#endif
-
-/*==============================================*
- * include header files *
- *----------------------------------------------*/
-#include "types.h"
-#include "nstack_log.h"
-#include <time.h>
-#define SPAN_NAME_MAX 64
-#define TRACE_NULL 0
-#define NSTACK_TRACE_ON 0
-#define NSTACK_TRACE_OFF 1
-
-typedef struct nst_trace_header
-{
- u64 trace_id;
- u64 span_pid;
- u64 span_id; /*now us */
- int fd;
- int thread_id;
-} trace_hread_t;
-
-typedef struct nst_trace_fun
-{
- u64 (*current_traceid) ();
- void (*span_raw) (char *msg);
- void (*tracing_enable) (int enable);
- void (*tracing_simpling) (int frequency);
- void (*tracing_cleanup) ();
- void (*tracing_setup) (u32 process);
- u64 (*tracing_string_to_traceid) (const char *input, size_t length);
-} trace_fun_t;
-
-extern __thread struct nst_trace_header strace_header;
-
-#define get_trace_header() (&strace_header)
-
-//For Tracing define own tracing feature.
-#define nstack_trace_init( a )
-#define nstack_set_tracing_contex( a,b,c)
-#define nstack_get_tracing_contex(traceid,spanid,spanpid,fd)
-#define nstack_clear_tracing_contex( )
-#define NSTACK_TRACING(level, module_name,famt,...)
-#define nstack_tracing_enalbe()
-#define nstack_get_traceid() (NULL)
-
-#ifdef __cplusplus
-/* *INDENT-OFF* */
-}
-/* *INDENT-ON* */
-#endif
-
-#endif
diff --git a/src/framework/ipc/mgr_com/mgr_com.c b/src/framework/ipc/mgr_com/mgr_com.c
index 4a57d6a..5cdb044 100644
--- a/src/framework/ipc/mgr_com/mgr_com.c
+++ b/src/framework/ipc/mgr_com/mgr_com.c
@@ -109,7 +109,6 @@ nsfw_mgr_reg_msg_fun (u16 msg_type, nsfw_mgr_msg_fun fun)
{
if (NULL == g_mgr_fun[msg_type][i])
{
- /*TODO should use cas */
g_mgr_fun[msg_type][i] = fun;
NSFW_LOGINF ("reg mgr_msg fun suc]msg_type=%u,fun=%p", msg_type,
fun);
@@ -740,7 +739,6 @@ nsfw_mgr_send_msg_socket (u32 fd, nsfw_mgr_msg * msg)
off_set = NSFW_MGR_MSG_HDR_LEN;
}
- /*TODO if closed by peer, may send failed, should close this fd */
do
{
off_set += send_len;
@@ -1026,7 +1024,7 @@ nsfw_mgr_msg_in (i32 fd)
nsfw_mgr_msg_free (msg);
return FALSE;
}
- nstack_get_tracing_contex (msg->traceid, 0, 0, -1);
+
if (msg->fw_flag != TRUE)
{
(void) nsfw_mgr_new_socket (fd, msg->src_proc_type, msg->src_pid);
@@ -1049,7 +1047,6 @@ nsfw_mgr_msg_in (i32 fd)
if (FALSE != msg_match)
{
nsfw_mgr_msg_free (msg);
- nstack_clear_tracing_contex ();
return TRUE;
}
@@ -1072,7 +1069,6 @@ nsfw_mgr_msg_in (i32 fd)
g_mgr_stat.recv_drop[msg->msg_type]++;
}
nsfw_mgr_msg_free (msg);
- nstack_clear_tracing_contex ();
return FALSE;
}
diff --git a/src/framework/log/nstack_log.c b/src/framework/log/nstack_log.c
index 5e8ffd4..50279ba 100644
--- a/src/framework/log/nstack_log.c
+++ b/src/framework/log/nstack_log.c
@@ -675,11 +675,7 @@ nstack_log_init_app ()
}
init_log_ctrl_info ();
g_my_pro_type = LOG_PRO_APP;
-#ifdef FOR_NSTACK_UT
-
-#else
SetGlogCtrlOpt (TRUE);
-#endif
NSPOL_LOGERR ("app_nStack_version=%s", NSTACK_VERSION);
return;
}
diff --git a/src/framework/tracing/nstack_trace.c b/src/framework/tracing/nstack_trace.c
deleted file mode 100644
index 88c8ffb..0000000
--- a/src/framework/tracing/nstack_trace.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-*
-* Copyright (c) 2018 Huawei Technologies Co.,Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at:
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-/*==============================================*
- * include header files *
- *----------------------------------------------*/
-#include "nstack_trace.h"
-#include "nstack_securec.h"
-#include <stdarg.h>
-#include <dlfcn.h>
-
-#ifdef __cplusplus
-/* *INDENT-OFF* */
-extern "C"{
-/* *INDENT-ON* */
-#endif
-
-/*==============================================*
- * constants or macros define *
- *----------------------------------------------*/
-#define EVENT_MAX 5
-#define NSTACK_TRACE_SWICH "NSTACK_TRACE_ON"
-/*==============================================*
- * project-wide global variables *
- *----------------------------------------------*/
-trace_fun_t nstack_trace_fun;
-__thread trace_hread_t strace_header = {
- .thread_id = -1,
- .trace_id = TRACE_NULL,
-};
-
-int tracing_inited = 0;
-__thread char *cad_traceID_string = NULL;
-
-#ifdef __cplusplus
-/* *INDENT-OFF* */
-}
-/* *INDENT-ON* */
-#endif
diff --git a/src/nSocket/kernel/linux_kernel_module.c b/src/nSocket/kernel/linux_kernel_module.c
index f6feb71..148cce8 100644
--- a/src/nSocket/kernel/linux_kernel_module.c
+++ b/src/nSocket/kernel/linux_kernel_module.c
@@ -51,26 +51,26 @@ ks_ep_thread (void *arg)
int loop = 0;
struct epoll_event *events =
(struct epoll_event *) malloc (SK_MAX_EP_EVENT *
- sizeof (struct epoll_event));
+ sizeof (struct epoll_event));
struct epoll_event *innerEvt =
(struct epoll_event *) malloc (SK_MAX_EP_EVENT *
- sizeof (struct epoll_event));
+ sizeof (struct epoll_event));
if (NULL == events || NULL == innerEvt)
{
NSSOC_LOGERR ("malloc events failed");
if (events)
- {
- free (events);
- events = NULL; /* Set NULL to pointer after free */
- }
+ {
+ free (events);
+ events = NULL; /* Set NULL to pointer after free */
+ }
if (innerEvt)
- {
- free (innerEvt);
- innerEvt = NULL; /* Set NULL to pointer after free */
- }
+ {
+ free (innerEvt);
+ innerEvt = NULL; /* Set NULL to pointer after free */
+ }
/* When ks_ep_thread failed, it should set g_ksInfo.thread_inited ks_true, otherwise,it will result kernel_stack_register in dead loop */
g_ksInfo.thread_inited = ks_true;
return NULL;
@@ -86,16 +86,16 @@ ks_ep_thread (void *arg)
g_ksInfo.thread_inited = ks_true;
if (events)
- {
- free (events);
- events = NULL; /* Set NULL to pointer after free */
- }
+ {
+ free (events);
+ events = NULL; /* Set NULL to pointer after free */
+ }
if (innerEvt)
- {
- free (innerEvt);
- innerEvt = NULL; /* Set NULL to pointer after free */
- }
+ {
+ free (innerEvt);
+ innerEvt = NULL; /* Set NULL to pointer after free */
+ }
return NULL;
}
@@ -106,65 +106,60 @@ ks_ep_thread (void *arg)
{
NSTACK_CAL_FUN (&g_ksInfo.libcOps, epoll_wait,
- (g_ksInfo.epfd, events, SK_MAX_EP_EVENT, -1), eventNum);
+ (g_ksInfo.epfd, events, SK_MAX_EP_EVENT, -1), eventNum);
if (0 == eventNum)
- {
- sys_sleep_ns (0, 100000);
+ {
+ sys_sleep_ns (0, 100000);
- }
+ }
for (loop = 0; loop < eventNum; loop++)
- {
-
- NSSOC_LOGDBG ("Epoll]events=%u,epfd=%d", events[loop].events,
- events[loop].data.fd);
-
- if (events[loop].events & EPOLLIN)
- {
- int i = 0, num = 0, ret = 0, epfd = events[loop].data.fd;
- NSTACK_CAL_FUN (&g_ksInfo.libcOps, epoll_wait,
- (epfd, innerEvt, SK_MAX_EP_EVENT, 0), num);
-
- if (0 == num)
- {
- NSSOC_LOGWAR ("Num is zero");
- continue;
- }
-
- NSTACK_CAL_FUN (&g_ksInfo.libcOps, epoll_ctl,
- (g_ksInfo.epfd, EPOLL_CTL_DEL, epfd, NULL),
- ret);
-
- ret = -1;
- for (i = 0; i < num; i++)
- {
- ret &=
- g_ksInfo.regVal.event_cb (innerEvt[i].data.ptr,
- innerEvt[i].events);
- NSSOC_LOGDBG ("Kernel got one event]i=%d,ptr=%d,events=%u",
- i, innerEvt[i].data.ptr, innerEvt[i].events);
- }
-
- if (ret)
- {
- struct epoll_event ev;
- ev.data.fd = epfd;
- ev.events = EPOLLIN;
- NSTACK_CAL_FUN (&g_ksInfo.libcOps, epoll_ctl,
- (g_ksInfo.epfd, EPOLL_CTL_ADD, epfd, &ev),
- ret);
- }
- }
- }
-#ifndef FOR_NSTACK_UT
+ {
+
+ NSSOC_LOGDBG ("Epoll]events=%u,epfd=%d", events[loop].events,
+ events[loop].data.fd);
+
+ if (events[loop].events & EPOLLIN)
+ {
+ int i = 0, num = 0, ret = 0, epfd = events[loop].data.fd;
+ NSTACK_CAL_FUN (&g_ksInfo.libcOps, epoll_wait,
+ (epfd, innerEvt, SK_MAX_EP_EVENT, 0), num);
+
+ if (0 == num)
+ {
+ NSSOC_LOGWAR ("Num is zero");
+ continue;
+ }
+
+ NSTACK_CAL_FUN (&g_ksInfo.libcOps, epoll_ctl,
+ (g_ksInfo.epfd, EPOLL_CTL_DEL, epfd, NULL),
+ ret);
+
+ ret = -1;
+ for (i = 0; i < num; i++)
+ {
+ ret &=
+ g_ksInfo.regVal.event_cb (innerEvt[i].data.ptr,
+ innerEvt[i].events);
+ NSSOC_LOGDBG ("Kernel got one event]i=%d,ptr=%d,events=%u",
+ i, innerEvt[i].data.ptr, innerEvt[i].events);
+ }
+
+ if (ret)
+ {
+ struct epoll_event ev;
+ ev.data.fd = epfd;
+ ev.events = EPOLLIN;
+ NSTACK_CAL_FUN (&g_ksInfo.libcOps, epoll_ctl,
+ (g_ksInfo.epfd, EPOLL_CTL_ADD, epfd, &ev),
+ ret);
+ }
+ }
+ }
}
while (1);
-#else
- }
- while (0);
- return NULL;
-#endif
+
}
int
@@ -213,14 +208,14 @@ kernel_prewait_proc (int epfd)
unsigned int
kernel_ep_fd_add (int epFD, int proFD, int ctl_ops,
- struct epoll_event *events, void *pdata)
+ struct epoll_event *events, void *pdata)
{
struct epoll_event tmpEvt;
int ret = 0;
tmpEvt.data.ptr = pdata;
tmpEvt.events = events->events;
NSSOC_LOGINF ("epfd=%d,fd=%d,ops=%d, events=%u", epFD, proFD, ctl_ops,
- events->events);
+ events->events);
switch (ctl_ops)
{
case nstack_ep_triggle_add:
@@ -265,8 +260,8 @@ kernel_module_init ()
if (retval != 0)
{
NSMON_LOGERR
- ("pthread_setname_np failed for ep_thread]retval=%d, errno:%d",
- retval, errno);
+ ("pthread_setname_np failed for ep_thread]retval=%d, errno:%d",
+ retval, errno);
/*set thread name failed no need to return */
}
@@ -321,7 +316,7 @@ kernel_stack_register (nstack_proc_cb * ops, nstack_event_cb * val)
ops->socket_ops = g_ksInfo.libcOps;
MEMSET_S (&(ops->extern_ops), sizeof (ops->extern_ops), 0,
- sizeof (ops->extern_ops));
+ sizeof (ops->extern_ops));
NSTACK_SET_OPS_FUN (&(ops->socket_ops), listen, lk_listen);
NSTACK_SET_OPS_FUN (&(ops->socket_ops), epoll_ctl, lk_epollctl);
NSTACK_SET_OPS_FUN (&(ops->socket_ops), socket, kernel_socket);
diff --git a/src/nSocket/nstack/nstack.c b/src/nSocket/nstack/nstack.c
index 2de167d..b54829e 100644
--- a/src/nSocket/nstack/nstack.c
+++ b/src/nSocket/nstack/nstack.c
@@ -798,8 +798,6 @@ nstack_fw_init ()
nstack_framework_setModuleParam(NSFW_RECYCLE_MODULE, (void*) ((long long)proc_type));
NSTACK_THREAD_LOAD_SET();
ret = nstack_framework_init();
- /*init tracing*/
- nstack_trace_init(0);
if (ns_success == ret)
{
diff --git a/src/nSocket/nstack/nstack_socket.c b/src/nSocket/nstack/nstack_socket.c
index d27d70d..d32958c 100644
--- a/src/nSocket/nstack/nstack_socket.c
+++ b/src/nSocket/nstack/nstack_socket.c
@@ -44,7 +44,6 @@
#include "select_adapt.h"
#include "nstack_select.h"
#include "nstack_share_res.h"
-#include "nstack_trace.h"
#ifndef F_SETFL
#define F_SETFL 4
#endif
@@ -150,7 +149,6 @@ nstack_socket (int domain, int itype, int protocol)
nstack_rd_key rdkey = { 0 };
int selectmod = -1;
- nstack_set_tracing_contex (0, 0, -1);
/*check whether module init finish or not */
NSTACK_INIT_CHECK_RET (socket);
@@ -290,7 +288,6 @@ nstack_bind (int fd, const struct sockaddr *addr, socklen_t addrlen)
struct sockaddr_in *iaddr = NULL;
nstack_rd_key rdkey = { 0 };
- nstack_set_tracing_contex (0, 0, fd);
NSSOC_LOGINF ("(sockfd=%d, addr=%p, addrlen=%u) [Caller]", fd, addr,
addrlen);
@@ -457,7 +454,6 @@ nstack_listen (int fd, int backlog)
int tfd;
int func_called = 0;
- nstack_set_tracing_contex (0, 0, fd);
NSSOC_LOGINF ("(sockfd=%d, backlog=%d) [Caller]", fd, backlog);
if (fd < 0)
{
@@ -524,7 +520,7 @@ nstack_accept (int fd, struct sockaddr *addr, socklen_t * addr_len)
int ret_fd = -1;
nstack_fd_Inf *accInf;
int ret = -1;
- nstack_set_tracing_contex (0, 0, fd);
+
NSSOC_LOGINF ("(sockfd=%d, addr=%p, addrlen=%p) [Caller]", fd, addr,
addr_len);
if (fd < 0)
@@ -677,7 +673,7 @@ nstack_accept4 (int fd, struct sockaddr *addr,
int ret_fd = -1;
int ret = -1;
nstack_fd_Inf *accInf;
- nstack_set_tracing_contex (0, 0, fd);
+
NSSOC_LOGINF ("(sockfd=%d, addr=%p, addrlen=%p, flags=%d) [Caller]", fd,
addr, addr_len, flags);
if (fd < 0)
@@ -828,7 +824,6 @@ nstack_connect (int fd, const struct sockaddr *addr, socklen_t addrlen)
int selectmod = -1;
nstack_rd_key rdkey = { 0 };
- nstack_set_tracing_contex (0, 0, fd);
NSSOC_LOGINF ("(sockfd=%d, addr=%p, addrlen=%u) [Caller]", fd, addr,
addrlen);
@@ -947,7 +942,6 @@ nstack_shutdown (int fd, int how)
int retval = -1;
int tfd;
- nstack_set_tracing_contex (0, 0, fd);
if (fd < 0)
{
nstack_set_errno (EBADF);
@@ -1065,7 +1059,6 @@ nstack_close (int fd)
{
nstack_fd_Inf *fdInf;
int ret = -1;
- nstack_set_tracing_contex (0, 0, fd);
/*linux fd check */
if (!(fdInf = nstack_getValidInf (fd)))
@@ -1128,7 +1121,6 @@ nstack_send (int fd, const void *buf, size_t len, int flags)
nstack_fd_Inf *fdInf = NULL;
int size = -1;
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_SEND, NSOCKET, "NSSOC", NSLOG_DBG,
"(sockfd=%d, buf=%p, len=%zu, flags=%d) [Caller]", fd, buf,
len, flags);
@@ -1148,11 +1140,8 @@ nstack_send (int fd, const void *buf, size_t len, int flags)
return -1;
}
- /* *INDENT-OFF* */
- CPUB(stack_x_send)
- NSTACK_CAL_FUN(fdInf->ops, send, (fdInf->rlfd, buf, len, flags), size);
- CPUE(stack_x_send)
- /* *INDENT-ON* */
+ NSTACK_CAL_FUN(fdInf->ops, send, (fdInf->rlfd, buf, len, flags), size);
+
NSSOC_LOGDBG ("fd=%d,ret=%d [Return]", fd, size);
UNLOCK_SEND (fd, local_lock);
@@ -1165,7 +1154,6 @@ nstack_recv (int fd, void *buf, size_t len, int flags)
nstack_fd_Inf *fdInf = NULL;
int size = -1;
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_RECV, NSOCKET, "NSSOC", NSLOG_DBG,
"(sockfd=%d, buf=%p, len=%zu, flags=%d) [Caller]", fd, buf,
len, flags);
@@ -1185,11 +1173,8 @@ nstack_recv (int fd, void *buf, size_t len, int flags)
return -1;
}
- /* *INDENT-OFF* */
- CPUB(stack_x_recv)
- NSTACK_CAL_FUN(fdInf->ops, recv, (fdInf->rlfd, buf, len, flags), size);
- CPUE(stack_x_recv)
- /* *INDENT-ON* */
+ NSTACK_CAL_FUN(fdInf->ops, recv, (fdInf->rlfd, buf, len, flags), size);
+
NSSOC_LOGDBG ("fd=%d,ret=%d [Return]", fd, size);
UNLOCK_RECV (fd, local_lock);
@@ -1204,7 +1189,6 @@ nstack_write (int fd, const void *buf, size_t count)
NSTACK_FD_LINUX_CHECK (fd, write, fdInf, (fd, buf, count));
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_WRITE, NSOCKET, "NSSOC", NSLOG_DBG,
"(fd=%d, buf=%p, count=%zu) [Caller]", fd, buf, count);
@@ -1221,11 +1205,7 @@ nstack_write (int fd, const void *buf, size_t count)
return -1;
}
- /* *INDENT-OFF* */
- CPUB(stack_x_write)
- NSTACK_CAL_FUN(fdInf->ops, write, (fdInf->rlfd, buf, count), size);
- CPUE(stack_x_write)
- /* *INDENT-ON* */
+ NSTACK_CAL_FUN(fdInf->ops, write, (fdInf->rlfd, buf, count), size);
NSSOC_LOGDBG ("fd=%d,ret=%d [Return]", fd, size);
@@ -1239,7 +1219,6 @@ nstack_read (int fd, void *buf, size_t count)
nstack_fd_Inf *fdInf = NULL;
int size = -1;
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_READ, NSOCKET, "NSSOC", NSLOG_DBG,
"(fd=%d, buf=%p, count=%zu) [Caller]", fd, buf, count);
@@ -1257,11 +1236,7 @@ nstack_read (int fd, void *buf, size_t count)
return -1;
}
- /* *INDENT-OFF* */
- CPUB(stack_x_read)
- NSTACK_CAL_FUN(fdInf->ops, read, (fdInf->rlfd, buf, count), size);
- CPUE(stack_x_read)
- /* *INDENT-ON* */
+ NSTACK_CAL_FUN(fdInf->ops, read, (fdInf->rlfd, buf, count), size);
NSSOC_LOGDBG ("fd=%d,ret=%d [Return]", fd, size);
@@ -1275,7 +1250,6 @@ nstack_writev (int fd, const struct iovec * iov, int iovcnt)
nstack_fd_Inf *fdInf = NULL;
int size = -1;
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_WRITEV, NSOCKET, "NSSOC", NSLOG_DBG,
"(fd=%d, iov=%p, count=%d) [Caller]", fd, iov, iovcnt);
@@ -1294,11 +1268,8 @@ nstack_writev (int fd, const struct iovec * iov, int iovcnt)
return -1;
}
- /* *INDENT-OFF* */
- CPUB(stack_x_writev)
- NSTACK_CAL_FUN(fdInf->ops, writev, (fdInf->rlfd, iov, iovcnt), size);
- CPUE(stack_x_writev)
- /* *INDENT-ON* */
+
+ NSTACK_CAL_FUN(fdInf->ops, writev, (fdInf->rlfd, iov, iovcnt), size);
NSSOC_LOGDBG ("fd=%d,ret=%d [Return]", fd, size);
@@ -1312,7 +1283,6 @@ nstack_readv (int fd, const struct iovec * iov, int iovcnt)
nstack_fd_Inf *fdInf = NULL;
int size = -1;
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_READV, NSOCKET, "NSSOC", NSLOG_DBG,
"(fd=%d, iov=%p, count=%d) [Caller]", fd, iov, iovcnt);
@@ -1331,11 +1301,7 @@ nstack_readv (int fd, const struct iovec * iov, int iovcnt)
return -1;
}
- /* *INDENT-OFF* */
- CPUB(stack_x_readv)
- NSTACK_CAL_FUN(fdInf->ops, readv, (fdInf->rlfd, iov, iovcnt), size);
- CPUE(stack_x_readv)
- /* *INDENT-ON* */
+ NSTACK_CAL_FUN(fdInf->ops, readv, (fdInf->rlfd, iov, iovcnt), size);
NSSOC_LOGDBG ("fd=%d,ret=%d [Return]", fd, size);
@@ -1354,7 +1320,7 @@ nstack_sendto (int fd, const void *buf, size_t len, int flags,
int selectmod = -1;
int retval = 0;
nstack_rd_key rdkey = { 0 };
- nstack_set_tracing_contex (0, 0, fd);
+
NSSOC_LOGDBG
("(sockfd=%d, buf=%p, len=%zu, flags=%d, dest_addr=%p, addrlen=%u) [Caller]",
fd, buf, len, flags, dest_addr, addrlen);
@@ -1369,11 +1335,7 @@ nstack_sendto (int fd, const void *buf, size_t len, int flags,
if (fdInf->ops)
{
- /* *INDENT-OFF* */
- CPUB(stack_x_sendto)
- NSTACK_CAL_FUN(fdInf->ops, sendto, (fdInf->rlfd, buf, len, flags, dest_addr, addrlen), size);
- CPUE(stack_x_sendto)
- /* *INDENT-ON* */
+ NSTACK_CAL_FUN(fdInf->ops, sendto, (fdInf->rlfd, buf, len, flags, dest_addr, addrlen), size);
NSSOC_LOGDBG
("fdInf->ops:fd=%d buf=%p,len=%zu,size=%d,addr=%p [Return]", fd, buf,
@@ -1439,7 +1401,6 @@ nstack_sendmsg (int fd, const struct msghdr * msg, int flags)
int retval = 0;
nstack_rd_key rdkey = { 0 };
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_SENDMSG, NSOCKET, "NSSOC", NSLOG_DBG,
"(sockfd=%d, msg=%p, flags=%d) [Caller]", fd, msg, flags);
@@ -1460,11 +1421,7 @@ nstack_sendmsg (int fd, const struct msghdr * msg, int flags)
/*if some module select, just connect */
if (fdInf->ops)
{
- /* *INDENT-OFF* */
- CPUB(stack_x_sendmsg)
- NSTACK_CAL_FUN(fdInf->ops, sendmsg, (fdInf->rlfd, msg, flags), size);
- CPUE(stack_x_sendmsg)
- /* *INDENT-ON* */
+ NSTACK_CAL_FUN(fdInf->ops, sendmsg, (fdInf->rlfd, msg, flags), size);
NSSOC_LOGDBG ("]fd=%d,size=%d msg=%p [Return]", fd, size, msg);
UNLOCK_SEND (fd, local_lock);
return size;
@@ -1526,7 +1483,6 @@ nstack_recvfrom (int fd, void *buf, size_t len, int flags,
nstack_fd_Inf *fdInf = NULL;
int size = -1;
- nstack_set_tracing_contex (0, 0, fd);
NSSOC_LOGDBG
("(sockfd=%d, buf=%p, len=%zu, flags=%d, src_addr=%p, addrlen=%p) [Caller]",
fd, buf, len, flags, src_addr, addrlen);
@@ -1554,11 +1510,7 @@ nstack_recvfrom (int fd, void *buf, size_t len, int flags,
return -1;
}
- /* *INDENT-OFF* */
- CPUB(stack_x_recvfrom)
- NSTACK_CAL_FUN(fdInf->ops, recvfrom, (fdInf->rlfd, buf, len, flags, src_addr, addrlen), size);
- CPUE(stack_x_recvfrom)
- /* *INDENT-ON* */
+ NSTACK_CAL_FUN(fdInf->ops, recvfrom, (fdInf->rlfd, buf, len, flags, src_addr, addrlen), size);
NSSOC_LOGDBG ("fd=%d,retVal=%d [Return]", fd, size);
@@ -1572,7 +1524,6 @@ nstack_recvmsg (int fd, struct msghdr * msg, int flags)
nstack_fd_Inf *fdInf = NULL;
int size = -1;
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_RECVMSG, NSOCKET, "NSSOC", NSLOG_DBG,
"(sockfd=%d, msg=%p, flags=%d) [Caller]", fd, msg, flags);
@@ -1591,11 +1542,7 @@ nstack_recvmsg (int fd, struct msghdr * msg, int flags)
return -1;
}
- /* *INDENT-OFF* */
- CPUB(stack_x_recvmsg)
- NSTACK_CAL_FUN(fdInf->ops, recvmsg, (fdInf->rlfd, msg, flags), size);
- CPUE(stack_x_recvmsg)
- /* *INDENT-ON* */
+ NSTACK_CAL_FUN(fdInf->ops, recvmsg, (fdInf->rlfd, msg, flags), size);
NSSOC_LOGDBG ("fd=%d,ret=%d [Return]", fd, size);
@@ -1617,7 +1564,6 @@ nstack_getsockname (int fd, struct sockaddr *addr, socklen_t * addrlen)
int tfd = -1;
int ret = -1;
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_GETSOCKNAME, NSOCKET, "NSSOC", NSLOG_INF,
"(fd=%d, addr=%p, addrlen=%p) [Caller]", fd, addr, addrlen);
@@ -1688,7 +1634,6 @@ nstack_getpeername (int fd, struct sockaddr *addr, socklen_t * addrlen)
int tfd;
int ret = -1;
- nstack_set_tracing_contex (0, 0, fd);
NS_LOG_CTRL (LOG_CTRL_GETPEERNAME, NSOCKET, "NSSOC", NSLOG_INF,
"(fd=%d, addr=%p, addrlen=%p) [Caller]", fd, addr, addrlen);
@@ -1820,7 +1765,7 @@ nstack_getsockopt (int fd, int level, int optname, void *optval,
int tfd;
int ret = -1;
nstack_socket_ops *ops;
- nstack_set_tracing_contex (0, 0, fd);
+
NS_LOG_CTRL (LOG_CTRL_GETSOCKOPT, NSOCKET, "NSSOC", NSLOG_INF,
"(fd=%d, level=%d, optname=%d, optval=%p, optlen=%p) [Caller]",
fd, level, optname, optval, optlen);
@@ -1905,7 +1850,6 @@ nstack_setsockopt (int fd, int level, int optname, const void *optval,
int lerror = 0;
int flag = 0;
- nstack_set_tracing_contex (0, 0, fd);
NSSOC_LOGINF
("(fd=%d, level=%d, optname=%d, optval=%p, optlen=%u) [Caller]", fd,
level, optname, optval, optlen);
@@ -1996,7 +1940,6 @@ nstack_ioctl (int fd, unsigned long request, unsigned long argp)
int lerror = 0;
int flag = 0;
- nstack_set_tracing_contex (0, 0, fd);
NSSOC_LOGINF ("(fd=%d, request=%lu) [Caller]", fd, request);
if (fd < 0)
{
@@ -2076,7 +2019,6 @@ nstack_fcntl (int fd, int cmd, unsigned long argp)
int lerror = 0;
int flag = 0;
- nstack_set_tracing_contex (0, 0, fd);
NSSOC_LOGINF ("(fd=%d, cmd=%d) [Caller]", fd, cmd);
if (fd < 0)
{
@@ -2200,7 +2142,6 @@ nstack_select (int nfds, fd_set * readfds, fd_set * writefds,
int i;
- nstack_set_tracing_contex (0, 0, -1);
if ((nfds > __FD_SETSIZE) || (nfds < 0)
|| ((timeout) && ((timeout->tv_sec < 0) || (timeout->tv_usec < 0))))
{
@@ -2378,7 +2319,6 @@ nstack_epoll_ctl (int epfd, int op, int fd, struct epoll_event *event)
struct epoll_event ep_event = { 0 };
struct epitem *epi = NULL;
- nstack_set_tracing_contex (0, 0, fd);
NSSOC_LOGINF ("(epfd=%d, op=%d, fd=%d, event=%p) [Caller]", epfd, op, fd,
event);
if (event)
@@ -2510,7 +2450,6 @@ nstack_epoll_create (int size)
nstack_socket_ops *ops;
int ret = 0;
- nstack_set_tracing_contex (0, 0, -1);
NSTACK_INIT_CHECK_RET (epoll_create);
@@ -2642,7 +2581,6 @@ nstack_epoll_wait (int epfd, struct epoll_event *events, int maxevents,
int evt = 0;
int ret = 0;
- nstack_set_tracing_contex (0, 0, epfd);
NSTACK_FD_LINUX_CHECK (epfd, epoll_wait, fdInf,
(epfd, events, maxevents, timeout));
@@ -2769,7 +2707,6 @@ nstack_fork (void)
pid_t pid;
pid_t parent_pid = sys_get_hostpid_from_file (getpid ());
- nstack_set_tracing_contex (0, 0, -1);
common_mem_rwlock_write_lock (get_fork_lock ());
if (NSTACK_MODULE_SUCCESS == g_nStackInfo.fwInited)
{
diff --git a/src/nSocket/nstack/nstack_socket.h b/src/nSocket/nstack/nstack_socket.h
index ff05099..3bc4a10 100644
--- a/src/nSocket/nstack/nstack_socket.h
+++ b/src/nSocket/nstack/nstack_socket.h
@@ -130,7 +130,6 @@ UNLOCK_EPOLL_CTRL (int fd, nstack_fd_local_lock_info_t * local_lock)
}
}
-#ifndef FOR_NSTACK_UT
#define INC_FD_REF(fd, fd_inf, local_lock){ \
if (local_lock)\
{\
@@ -146,34 +145,6 @@ UNLOCK_EPOLL_CTRL (int fd, nstack_fd_local_lock_info_t * local_lock)
}\
} \
}
-#else
-static inline int
-ut_inc_fd_ref (int fd, nStack_info_t * fdInf,
- nstack_fd_local_lock_info_t * local_lock)
-{
- if (local_lock)
- {
- atomic_inc (&local_lock->fd_ref);
- if (local_lock->fd_status != FD_OPEN)
- {
- nstack_set_errno (EBADF);
- NSSOC_LOGERR ("nstack call, fd_status=%d [return]",
- local_lock->fd_status);
- if (atomic_dec (&local_lock->fd_ref) == 0)
- {
- release_fd (fd, local_lock);
- }
- return -1;
- }
- }
- return 0;
-}
-
-#define INC_FD_REF(fd, fd_inf, local_lock){\
- if(ut_inc_fd_ref(fd, fd_inf, local_lock) < 0)\
- return -1;\
-}
-#endif
#define LOCK_BASE(fd, fd_inf, local_lock){\
INC_FD_REF(fd, fd_inf, local_lock);\