From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 7CA62A045E for ; Fri, 31 May 2019 10:55:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 64D181B95A; Fri, 31 May 2019 10:55:19 +0200 (CEST) Received: from tama50.ecl.ntt.co.jp (tama50.ecl.ntt.co.jp [129.60.39.147]) by dpdk.org (Postfix) with ESMTP id B3F721B94B for ; Fri, 31 May 2019 10:55:16 +0200 (CEST) Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x4V8tFjL027741; Fri, 31 May 2019 17:55:15 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 8E662EA85FD; Fri, 31 May 2019 17:55:15 +0900 (JST) Received: from localhost.localdomain (lobster.nslab.ecl.ntt.co.jp [129.60.13.95]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 89E79EA84F3; Fri, 31 May 2019 17:55:15 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Date: Fri, 31 May 2019 17:52:40 +0900 Message-Id: <1559292762-27042-9-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559292762-27042-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> References: <1559292762-27042-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 08/10] spp_pcap: refactor comments of spp_pcap X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa This update is to revise comments in `spp_pcap.c` and `spp_pcap.h` for refactoring. Signed-off-by: Yasufumi Ogawa --- src/pcap/spp_pcap.c | 66 +++++++++++++++++++++------------------------ src/pcap/spp_pcap.h | 12 +-------- 2 files changed, 31 insertions(+), 47 deletions(-) diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c index 7c66f16..a7f95e9 100644 --- a/src/pcap/spp_pcap.c +++ b/src/pcap/spp_pcap.c @@ -56,15 +56,9 @@ enum worker_thread_type { /* compress file generate mode */ enum comp_file_generate_mode { - INIT_MODE, /** - * initial generation mode which is used - * when capture is started - */ - UPDATE_MODE, /** - * update generation mode which is used - * when capture file reached max size - */ - CLOSE_MODE /* close mode which is used when capture is stopped */ + INIT_MODE, /** Initial gen mode while capture is starting. */ + UPDATE_MODE, /** Update gen mode when cap file size reached max. */ + CLOSE_MODE /* Close mode used when capture is stopped. */ }; /* lz4 preferences */ @@ -74,45 +68,45 @@ static const LZ4F_preferences_t g_kprefs = { LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, - 0, /* unknown content size */ - { 0, 0}, /* reserved, must be set to 0 */ + 0, /* unknown content size */ + { 0, 0}, /* reserved, must be set to 0 */ }, - 0, /* compression level; 0 == default */ - 0, /* autoflush */ - { 0, 0, 0, 0}, /* reserved, must be set to 0 */ + 0, /* compression level; 0 == default */ + 0, /* autoflush */ + { 0, 0, 0, 0}, /* reserved, must be set to 0 */ }; /* pcap file header */ struct __attribute__((__packed__)) pcap_header { uint32_t magic_number; /* magic number */ - uint16_t version_major; /* major version number */ - uint16_t version_minor; /* minor version number */ - int32_t thiszone; /* GMT to local correction */ - uint32_t sigfigs; /* accuracy of timestamps */ - uint32_t snaplen; /* max length of captured packets, in octets */ - uint32_t network; /* data link type */ + uint16_t major_ver; /* major version */ + uint16_t minor_ver; /* minor version */ + int32_t thiszone; /* GMT to local correction */ + uint32_t sigfigs; /* accuracy of timestamps */ + uint32_t snaplen; /* max length of captured packets, in octets */ + uint32_t network; /* data link type */ }; /* pcap packet header */ struct pcap_packet_header { - uint32_t ts_sec; /* time stamp seconds */ - uint32_t ts_usec; /* time stamp micro seconds */ - uint32_t write_len; /* write length */ - uint32_t packet_len; /* packet length */ + uint32_t ts_sec; /* time stamp seconds */ + uint32_t ts_usec; /* time stamp micro seconds */ + uint32_t write_len; /* write length */ + uint32_t packet_len; /* packet length */ }; /* Option for pcap. */ struct pcap_option { - struct timespec start_time; /* start time */ - uint64_t fsize_limit; /* file size limit */ - char compress_file_path[PCAP_FPATH_STRLEN]; /* file path */ - char compress_file_date[PCAP_FDATE_STRLEN]; /* file name date */ + struct timespec start_time; /* start time */ + uint64_t fsize_limit; /* file size limit */ + char compress_file_path[PCAP_FPATH_STRLEN]; /* file path */ + char compress_file_date[PCAP_FDATE_STRLEN]; /* file name date */ struct sppwk_port_info port_cap; /* capture port */ - struct rte_ring *cap_ring; /* RTE ring structure */ + struct rte_ring *cap_ring; /* RTE ring structure */ }; /** - * pcap management info which stores attributes + * pcap management info which stores attributes. * (e.g. worker thread type, file number, pointer to writing file etc) per core */ struct pcap_mng_info { @@ -130,14 +124,14 @@ struct pcap_mng_info { /* Pcap status info. */ struct pcap_status_info { - int thread_cnt; /* thread count */ - int start_up_cnt; /* thread start up count */ + int thread_cnt; /* thread count */ + int start_up_cnt; /* thread start up count */ }; -/* Logical core ID for main thread */ +/* Lcore ID of main thread. */ static unsigned int g_main_lcore_id = 0xffffffff; -/* Execution parameter of spp_pcap */ +/* Arguments for spp_pcap process. */ static struct startup_param g_startup_param; /* Interface management information */ @@ -662,8 +656,8 @@ static int file_compression_operation(struct pcap_mng_info *info, /* init the common pcap header */ pcap_h.magic_number = TCPDUMP_MAGIC; - pcap_h.version_major = PCAP_VERSION_MAJOR; - pcap_h.version_minor = PCAP_VERSION_MINOR; + pcap_h.major_ver = PCAP_VERSION_MAJOR; + pcap_h.minor_ver = PCAP_VERSION_MINOR; pcap_h.thiszone = 0; pcap_h.sigfigs = 0; pcap_h.snaplen = PCAP_SNAPLEN_MAX; diff --git a/src/pcap/spp_pcap.h b/src/pcap/spp_pcap.h index bf2eec1..b23fbbc 100644 --- a/src/pcap/spp_pcap.h +++ b/src/pcap/spp_pcap.h @@ -7,20 +7,10 @@ #include "cmd_utils.h" -/** - * @file - * SPP_PCAP main - * - * Main function of spp_pcap. - * This provides the function for initializing and starting the threads. - * - */ - /** * Pcap get core status * - * @param lcore_id - * The logical core ID for forwarder and merger. + * @param lcore_id The logical core ID for forwarder and merger. * @param params * The pointer to struct spp_iterate_core_params.@n * Detailed data of pcap status. -- 2.17.1