Soft Patch Panel
 help / color / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 08/10] spp_pcap: refactor comments of spp_pcap
Date: Fri, 31 May 2019 17:52:40 +0900
Message-ID: <1559292762-27042-9-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1559292762-27042-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to revise comments in `spp_pcap.c` and `spp_pcap.h` for
refactoring.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 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


  parent reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  8:52 [spp] [PATCH 00/10] Refactor cmd parser in spp_pcap ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 01/10] spp_pcap: rename enum spp_command_type ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 02/10] spp_pcap: rename struct spp_command ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 03/10] spp_pcap: revise command response codes ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 04/10] spp_pcap: revise parser functions ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 05/10] spp_pcap: refactor func for splitting cmd tokens ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 06/10] spp_pcap: revise log msgs in parser func ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 07/10] spp_pcap: remove unused string list ogawa.yasufumi
2019-05-31  8:52 ` ogawa.yasufumi [this message]
2019-05-31  8:52 ` [spp] [PATCH 09/10] spp_pcap: rename spp_get_core_status ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 10/10] spp_pcap: revise name of vars for parser error ogawa.yasufumi

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1559292762-27042-9-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Soft Patch Panel

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ http://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/ public-inbox