From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mogw1235.ocn.ad.jp (mogw1235.ocn.ad.jp [153.149.235.36]) by dpdk.org (Postfix) with ESMTP id D29D51BC34 for ; Tue, 15 May 2018 03:21:57 +0200 (CEST) Received: from mf-smf-ucb031c3 (mf-smf-ucb031c3.ocn.ad.jp [153.153.66.202]) by mogw1235.ocn.ad.jp (Postfix) with ESMTP id 617DC380107; Tue, 15 May 2018 10:21:56 +0900 (JST) Received: from ntt.pod01.mv-mta-ucb024 ([153.149.142.98]) by mf-smf-ucb031c3 with ESMTP id IOf5fGwYi7SDsIOf6fszhH; Tue, 15 May 2018 10:21:56 +0900 Received: from smtp.ocn.ne.jp ([153.149.227.167]) by ntt.pod01.mv-mta-ucb024 with id mRMw1x0053dLKTM01RMwal; Tue, 15 May 2018 01:21:56 +0000 Received: from localhost.localdomain (p5164-ipngn8501marunouchi.tokyo.ocn.ne.jp [153.214.228.164]) by smtp.ocn.ne.jp (Postfix) with ESMTPA; Tue, 15 May 2018 10:21:56 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: ferruh.yigit@intel.com, spp@dpdk.org Cc: Yasufumi Ogawa Date: Tue, 15 May 2018 10:21:44 +0900 Message-Id: <20180515012146.8899-5-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515012146.8899-1-ogawa.yasufumi@lab.ntt.co.jp> References: <20180515012146.8899-1-ogawa.yasufumi@lab.ntt.co.jp> Subject: [spp] [PATCH 4/6] docs: add usecase of pcap PMD 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: , X-List-Received-Date: Tue, 15 May 2018 01:21:58 -0000 From: Yasufumi Ogawa Signed-off-by: Yasufumi Ogawa --- docs/guides/setup/getting_started.rst | 1 + docs/guides/setup/use_cases.rst | 105 ++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/docs/guides/setup/getting_started.rst b/docs/guides/setup/getting_started.rst index ca8085b..52940e4 100644 --- a/docs/guides/setup/getting_started.rst +++ b/docs/guides/setup/getting_started.rst @@ -145,6 +145,7 @@ You can check the value as following. $ sysctl -n kernel.randomize_va_space +.. _install_dpdk_spp: Install DPDK and SPP -------------------- diff --git a/docs/guides/setup/use_cases.rst b/docs/guides/setup/use_cases.rst index 3681ad8..06f4b45 100644 --- a/docs/guides/setup/use_cases.rst +++ b/docs/guides/setup/use_cases.rst @@ -363,3 +363,108 @@ with ``sec 2``. :width: 460 em Uni-Directional l2fwd with vhost + +Single spp_nfv with PCAP PMD +----------------------------- + +PCAP PMD +~~~~~~~~ + +Pcap PMD is an interface for capturing or restoring traffic. +For usign pcap PMD, you should set ``CONFIG_RTE_LIBRTE_PMD_PCAP`` +to ``y`` and compile DPDK before SPP. +Refer to +:ref:`Install DPDK and SPP` +for details of setting up. + +Pcap PMD has two different streams for rx and tx. +Tx device is for capturing packets and rx is for restoring captured +packets. +For rx device, you can use any of pcap files other than SPP's pcap PMD. + +To start using pcap pmd, just using ``add`` subcommand as ring. +Here is an example for creating pcap PMD with index ``1``. + +.. code-block:: console + + spp > sec 1;add pcap 1 + +After running it, you can find two of pcap files in ``/tmp``. + +.. code-block:: console + + $ ls /tmp | grep pcap$ + spp-rx1.pcap + spp-tx1.pcap + +If you already have a dumped file, you can use it by it putting as +``/tmp/spp-rx1.pcap`` before running the ``add`` subcommand. +SPP does not overwrite rx pcap file if it already exist, +and it just overwrites tx pcap file. + +Capture Incoming Packets +~~~~~~~~~~~~~~~~~~~~~~~~ + +As the first usecase, add a pcap PMD and capture incoming packets from +``phy:0``. + +.. code-block:: console + + spp > sec 1;add pcap 1 + spp > sec 1;patch phy:0 pcap:1 + spp > sec 1;forward + +In this example, we use pktgen. +Once you start forwarding packets from pktgen, you can see +that the size of ``/tmp/spp-tx1.pcap`` is increased rapidly +(or gradually, it depends on the rate). + +.. code-block:: console + + Pktgen:/> set 0 size 1024 + Pktgen:/> start 0 + +To stop capturing, simply stop forwarding of ``spp_nfv``. + +.. code-block:: console + + spp > sec 1;stop + +You can analyze the dumped pcap file with other tools like as wireshark. + +Restore dumped Packets +~~~~~~~~~~~~~~~~~~~~~~ + +In this usecase, use dumped file in previsou section. +Copy ``spp-tx1.pcap`` to ``spp-rx2.pcap`` first. + +.. code-block:: console + + $ sudo cp /tmp/spp-tx1.pcap /tmp/spp-rx2.pcap + +Then, add pcap PMD to another ``spp_nfv`` with index ``2``. + +.. code-block:: console + + spp > sec 2;add pcap 2 + +You can find that ``spp-tx2.pcap`` is creaeted and ``spp-rx2.pcap`` +still remained. + +.. code-block:: console + + $ ls -al /tmp/spp*.pcap + -rw-r--r-- 1 root root 24 ... /tmp/spp-rx1.pcap + -rw-r--r-- 1 root root 2936703640 ... /tmp/spp-rx2.pcap + -rw-r--r-- 1 root root 2936703640 ... /tmp/spp-tx1.pcap + -rw-r--r-- 1 root root 0 ... /tmp/spp-tx2.pcap + +To confirm packets are restored, patch ``pcap:2`` to ``phy:1`` +and watch received packets on pktgen. + +.. code-block:: console + + spp > sec 2;patch phy:1 pcap:2 + spp > sec 2;forward + +After started forwarding, you can see that packet count is increased. -- 2.17.0