Soft Patch Panel
 help / color / mirror / Atom feed
From: x-fn-spp@sl.ntt-tx.co.jp
To: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Cc: spp@dpdk.org
Subject: [spp] [PATCH 3/6] docs: add spp_pcap document of design
Date: Tue, 22 Jan 2019 20:42:36 +0900	[thread overview]
Message-ID: <201901221142.x0MBgdb9022796@imss03.silk.ntt-tx.co.jp> (raw)
In-Reply-To: <20190122114239.3353-1-x-fn-spp@sl.ntt-tx.co.jp>

From: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>

Add spp_pcap document of design.

Signed-off-by: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 docs/guides/spp_vf/design.rst        | 98 +++++++++++++++++++++++++++-
 docs/guides/spp_vf/gsg/howto_use.rst | 39 +++++++++--
 2 files changed, 129 insertions(+), 8 deletions(-)

diff --git a/docs/guides/spp_vf/design.rst b/docs/guides/spp_vf/design.rst
index 8b9e7f3..0f3e5c8 100644
--- a/docs/guides/spp_vf/design.rst
+++ b/docs/guides/spp_vf/design.rst
@@ -1,5 +1,5 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation
+    Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
 
 .. _spp_vf_design:
 
@@ -98,3 +98,99 @@ than ``deepcopy``, but it should be used for read only for the packet.
 
 You should choose ``deepcopy`` if you use VLAN feature to make no change for
 original packet while copied packet is modified.
+
+.. _spp_vf_design_spp_pcap:
+
+spp_pcap
+--------
+``spp_pcap`` cosisits of main thread, ``receiver`` thread runs on a core of
+the second smallest ID and ``wirter`` threads on the rest of cores. You should
+have enough cores if you need to capture large amount of packets.
+
+``spp_pcap`` has 4 types of command. ``start``,``stop``,``exit`` and ``status``
+to control behavior of ``spp_pcap``.
+
+With ``start`` command, you can start capturing.
+Incoming packets are received by ``receiver`` thread and it is transferred to
+``writer`` thread(s) via multi-producer/multi-consumer ring.
+Multi-producer/multi-consumer ring is the ring which multiple producers
+can enqueue and multiple consumers can dequeue. When those packets are
+received by ``writer`` thread(s), it will be compressed using LZ4 library and
+then be written to storage. In case more than 1 cores are assigned,
+incoming packets are written into storage per core basis so packet capture file
+will be divided per core.
+When ``spp_pcap`` has already been started, ``start`` command cannot
+be accepted.
+
+With ``stop`` command, capture will be stopped. When spp_pcap has already
+been stopped, ``stop`` command cannot be accepted.
+
+With ``exit`` command, ``spp_pcap`` exits the program. ``exit`` command
+during started state, stops capturing and then exits the program.
+
+With ``status`` command, status related to ``spp_pcap`` is shown.
+
+In :numref:`figure_spp_pcap_design`,
+the internal structure of ``spp_pcap`` is shown.
+
+.. _figure_spp_pcap_design:
+
+.. figure:: ../images/spp_pcap/spp_pcap_design.*
+    :width: 55%
+
+    spp_pcap internal structure
+
+.. _spp_pcap_design_output_file_format:
+
+:numref:`figure_spp_pcap_design` shows the case when ``spp_pcap`` is connected
+with ``phy:0``.
+There is only one ``receiver`` thread and multiple ``writer`` threads.
+Each ``writer`` writes packets into file.
+Once exceeds maximum file size ,
+it creates new file so that multiple output files are created.
+
+
+Apptication option
+^^^^^^^^^^^^^^^^^^
+
+``spp_pcap`` specific options are:
+
+ * -client-id: client id which can be seen as secondary ID from spp.py.
+ * -s: IPv4 address and port for spp-ctl.
+ * -i: port to which spp_pcap attached with.
+ * --output: Output file path
+   where capture files are written.\
+   When this parameter is omitted,
+   ``/tmp`` is used.
+ * --port_name: port_name which can be specified as
+   either of phy:N or \
+   ring:N.
+   When used as part of file name ``:`` is removed to avoid misconversion.
+ * --limit_file_option: Maximum size of a capture file.
+   Default value is ``1GiB``.Captured files are not deleted automatically
+   because file rotation is not supported.
+
+The output file format is as following:
+
+.. code-block:: none
+
+    spp_pcap.YYYYMMDDhhmmss.[port_name].[wcore_num]
+    wcore_num is write core number which starts with 1
+
+Each ``writer`` thread has
+unique integer number which is used to determine the name of capture file.
+YYYYMMDDhhmmss is the time when ``spp_pcap`` receives ``start`` command.
+
+.. code-block:: none
+
+    /tmp/spp_pcap.20181108110600.ring0.1.2.pcap.lz4.tmp
+This example shows that ``receiver`` thread receives ``start`` command at
+20181108110600.  Port is ring:0, wcore_num is 1 and sequential number is 2.
+
+
+Until writing is finished, packets are stored into temporary file.
+The example is as following:
+
+.. code-block:: none
+
+    /tmp/spp_pcap.20181108110600.ring0.1.2.pcap.lz4.tmp
diff --git a/docs/guides/spp_vf/gsg/howto_use.rst b/docs/guides/spp_vf/gsg/howto_use.rst
index 750de13..dc1a7bb 100644
--- a/docs/guides/spp_vf/gsg/howto_use.rst
+++ b/docs/guides/spp_vf/gsg/howto_use.rst
@@ -1,5 +1,5 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
-    Copyright(c) 2010-2014 Intel Corporation
+    Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
 
 .. _spp_vf_gsg_howto_use:
 
@@ -80,9 +80,12 @@ DPDK, the other is ``spp_vf``.
 .. code-block:: console
 
     $ sudo ./src/vf/x86_64-native-linuxapp-gcc/spp_vf \
-    -l 0,2-13 -n 4 --proc-type=secondary \
-    -- \
-    --client-id 1 -s 127.0.0.1:6666 --vhost-client
+      -l 0,2-13 -n 4 \
+      --proc-type=secondary \
+      -- \
+      --client-id 1 \
+      -s 127.0.0.1:6666 \
+      --vhost-client
 
 If ``--vhost-client`` option is specified, then ``vhost-user`` act as
 the client, otherwise the server.
@@ -102,9 +105,31 @@ spp_mirror
 .. code-block:: console
 
     $ sudo ./src/mirror/x86_64-native-linuxapp-gcc/spp_mirror \
-    -l 2 -n 4 --proc-type=secondary \
-    -- \
-    --client-id 1 -s 127.0.0.1:6666 --vhost-client
+      -l 2 -n 4 \
+      --proc-type=secondary \
+      -- \
+      --client-id 1 \
+      -s 127.0.0.1:6666 \
+      -vhost-client
+
+.. _spp_vf_gsg_howto_use_spp_pcap:
+
+spp_pcap
+--------
+
+After run ``spp_primary`` is launched, run secondary process ``spp_pcap``.
+
+.. code-block:: console
+
+    $ sudo ./src/pcap/x86_64-native-linuxapp-gcc/spp_pcap \
+      -l 0-3 -n 4 \
+      --proc-type=secondary \
+      -- \
+      --client-id 1 \
+      -s 127.0.0.1:6666 \
+      -i phy:0 \
+      --output /mnt/pcap \
+      --limit_file_size 107374182
 
 VM
 --
-- 
2.17.1

  parent reply	other threads:[~2019-01-22 11:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190122114239.3353-1-x-fn-spp@sl.ntt-tx.co.jp>
2019-01-22 11:42 ` [spp] [PATCH 1/6] docs: add command reference of spp_pcap x-fn-spp
2019-01-22 11:42 ` [spp] [PATCH 2/6] docs: add spp_pcap into document of overview x-fn-spp
2019-01-22 11:42 ` x-fn-spp [this message]
2019-01-22 11:42 ` [spp] [PATCH 4/6] docs: add spp_pcap into document of usecase x-fn-spp
2019-01-22 11:42 ` [spp] [PATCH 5/6] docs: add spp_pcap into document of explanation x-fn-spp
2019-01-22 11:42 ` [spp] [PATCH 6/6] docs: add spp_pcap into document of setup x-fn-spp

Reply instructions:

You may reply publicly 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=201901221142.x0MBgdb9022796@imss03.silk.ntt-tx.co.jp \
    --to=x-fn-spp@sl.ntt-tx.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=ogawa.yasufumi@lab.ntt.co.jp \
    --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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).