From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tama50.ecl.ntt.co.jp (tama50.ecl.ntt.co.jp [129.60.39.147]) by dpdk.org (Postfix) with ESMTP id 4FB485F34 for ; Mon, 18 Feb 2019 12:50:50 +0100 (CET) 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 x1IBon7D029215; Mon, 18 Feb 2019 20:50:49 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 2AA42EA8188; Mon, 18 Feb 2019 20:50:49 +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 1507BEA8180; Mon, 18 Feb 2019 20:50:49 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Date: Mon, 18 Feb 2019 20:48:21 +0900 Message-Id: <1550490511-31683-11-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550490511-31683-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> References: <1550490511-31683-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 10/20] docs: update usecase of spp_mirror 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: Mon, 18 Feb 2019 11:50:51 -0000 From: Yasufumi Ogawa This patch is to update usecase of spp_mirror. Signed-off-by: Yasufumi Ogawa --- docs/guides/spp_vf/use_cases/index.rst | 2 - docs/guides/spp_vf/use_cases/mirror_simple.rst | 170 ----------- docs/guides/spp_vf/use_cases/mirror_vms.rst | 285 ------------------ docs/guides/use_cases/index.rst | 1 + docs/guides/use_cases/spp_mirror.rst | 391 +++++++++++++++++++++++++ 5 files changed, 392 insertions(+), 457 deletions(-) delete mode 100644 docs/guides/spp_vf/use_cases/mirror_simple.rst delete mode 100644 docs/guides/spp_vf/use_cases/mirror_vms.rst create mode 100644 docs/guides/use_cases/spp_mirror.rst diff --git a/docs/guides/spp_vf/use_cases/index.rst b/docs/guides/spp_vf/use_cases/index.rst index 8fb2ea4..59125f4 100644 --- a/docs/guides/spp_vf/use_cases/index.rst +++ b/docs/guides/spp_vf/use_cases/index.rst @@ -7,6 +7,4 @@ Use Cases .. toctree:: :maxdepth: 2 - mirror_simple - mirror_vms pcap_simple diff --git a/docs/guides/spp_vf/use_cases/mirror_simple.rst b/docs/guides/spp_vf/use_cases/mirror_simple.rst deleted file mode 100644 index a371b38..0000000 --- a/docs/guides/spp_vf/use_cases/mirror_simple.rst +++ /dev/null @@ -1,170 +0,0 @@ -.. SPDX-License-Identifier: BSD-3-Clause - Copyright(c) 2019 Nippon Telegraph and Telephone Corporation - -.. _spp_mirror_use_cases_basic: - -Mirroring Packets from NIC -========================== - -This usecase uses two hosts. ``spp_mirror`` is running on localhost. Remote host -sends ARP packets to localhost by using ping command. ``spp_mirror`` duplicates -and sends packets to destination ports. - -Network Configuration ---------------------- - -Detailed configuration is described in -:numref:`figure_spp_mirror_use_cases_nw_config`. -In this diagram, incoming packets from ``phy:0`` are mirrored. -In ``spp_mirror`` process, worker thread ``mir1`` copies incoming packets and -sends to two destinations ``phy:1`` and ``phy:2``. - -.. _figure_spp_mirror_use_cases_nw_config: - -.. figure:: ../../images/spp_vf/basic_usecase_mirror_nwconfig.* - :width: 80% - - Network configuration of mirroring - - -Setup SPP ---------- - -Change directory to spp and confirm that it is already compiled. - -.. code-block:: console - - $ cd /path/to/spp - -Launch ``spp-ctl`` before launching SPP primary and secondary processes. -You also need to launch ``spp.py`` if you use ``spp_mirror`` from CLI. -``-b`` option is for binding IP address to communicate other SPP processes, -but no need to give it explicitly if ``127.0.0.1`` or ``localhost`` . - -.. code-block:: console - - # terminal#1 - # Launch spp-ctl - $ python3 ./src/spp-ctl/spp-ctl -b 192.168.1.100 - -.. code-block:: console - - # terminal#2 - # Launch SPP CLI - $ python ./src/spp.py -b 192.168.1.100 - -Start ``spp_primary`` with core list option ``-l 1``. - -.. code-block:: console - - # terminal#3 - $ sudo ./src/primary/x86_64-native-linuxapp-gcc/spp_primary \ - -l 1 -n 4 \ - --socket-mem 512,512 \ - --huge-dir=/run/hugepages/kvm \ - --proc-type=primary \ - -- \ - -p 0x07 -n 10 -s 192.168.1.100:5555 - - -Launch spp_mirror -~~~~~~~~~~~~~~~~~ - -Run secondary process ``spp_mirror``. - -.. code-block:: console - - # terminal#4 - $ sudo ./src/mirror/x86_64-native-linuxapp-gcc/app/spp_mirror \ - -l 0,2 -n 4 --proc-type=secondary \ - -- \ - --client-id 1 \ - -s 192.168.1.100:6666 \ - -Start mirror component with ``CORE_ID`` 2. - -.. code-block:: console - - # Start component on CORE_ID 2 - spp > mirror 1; component start mir1 2 mirror - -Add ``phy:0`` as rx ports and add ``phy:1`` and ``phy:2`` as tx port -to mirror. - -.. code-block:: none - - # add ports to mir1 - spp > mirror 1; port add phy:0 rx mir1 - spp > mirror 1; port add phy:1 tx mir1 - spp > mirror 1; port add phy:2 tx mir1 - - -Confirm Original Packet is Duplicated -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To check sent packets are mirrored, you run tcpdump for ``ens1`` and ``ens2`` -first. As you run ping for ``ens0``, you will see the same ARP requests trying -to resolve ``192.168.140.21`` on terminal 1 and 2. - -.. code-block:: console - - # terminal#1 at host1 - # capture on ens1 - $ sudo tcpdump -i ens1 - tcpdump: verbose output suppressed, use -v or -vv for full protocol decode - listening on ens1, link-type EN10MB (Ethernet), capture size 262144 bytes - 21:18:44.183261 ARP, Request who-has 192.168.140.21 tell R740n15, length 28 - 21:18:45.202182 ARP, Request who-has 192.168.140.21 tell R740n15, length 28 - ... - -.. code-block:: console - - # terminal#2 at host1 - # capture on ens2 - $ sudo tcpdump -i ens2 - tcpdump: verbose output suppressed, use -v or -vv for full protocol decode - listening on ens2, link-type EN10MB (Ethernet), capture size 262144 bytes - 21:18:44.183261 ARP, Request who-has 192.168.140.21 tell R740n15, length 28 - 21:18:45.202182 ARP, Request who-has 192.168.140.21 tell R740n15, length 28 - ... - -Start to send ARP request with ping. - -.. code-block:: console - - # terminal#3 at host1 - # send packet from NIC0 - $ ping 192.168.140.21 -I ens0 - - -Stop Mirroring -~~~~~~~~~~~~~~ - -Delete ports for components. - -.. code-block:: none - - # Delete port for mir1 - spp > mirror 1; port del phy:0 rx mir1 - spp > mirror 1; port del phy:1 tx mir1 - spp > mirror 1; port del phy:2 tx mir1 - -Next, stop components. - -.. code-block:: console - - # Stop mirror - spp > mirror 1; component stop mir1 2 mirror - - spp > mirror 1; status - Basic Information: - - client-id: 1 - - ports: [phy:0, phy:1] - Components: - - core:2 '' (type: unuse) - -Finally, terminate ``spp_mirror`` to finish this usecase. - -.. code-block:: console - - spp > mirror 1; exit diff --git a/docs/guides/spp_vf/use_cases/mirror_vms.rst b/docs/guides/spp_vf/use_cases/mirror_vms.rst deleted file mode 100644 index 70311f8..0000000 --- a/docs/guides/spp_vf/use_cases/mirror_vms.rst +++ /dev/null @@ -1,285 +0,0 @@ -.. - SPDX-License-Identifier: BSD-3-Clause - Copyright(c) 2018 Nippon Telegraph and Telephone Corporation - - -.. _spp_mirror_use_cases_usecase: - -Mirroring packet from a VM -========================== - -This section describes a usage for mirroring from a VM to other VM through -spp_mirror. Traffic from host2 is forwarded to each VM inside host1 thorough -``spp_vf``. ``spp_vf`` is required in usecase to forward traffic -from host NIC to each VM. - -.. _figure_mirroring_from_vm: - -.. figure:: ../../images/spp_vf/spp_mirror_usecase_overview.* - :width: 60% - - Mirroring from a VM - - -Network Configuration ---------------------- - -Detailed configuration of :numref:`figure_mirroring_from_vm` is described in -:numref:`figure_spp_mirror_usecase_nwconfig`. -In this senario, incoming packets though ``ring1`` are mirrored. -In ``spp_mirror`` process, worker thread ``mirror1`` copies incoming packets and -sends to orignal destination ``VM1`` and new one ``VM3``. - -.. _figure_spp_mirror_usecase_nwconfig: - -.. figure:: ../../images/spp_vf/spp_mirror_usecase_nwconfig.* - :width: 80% - - Network configuration of mirroring - - -Setup SPP and VMs ------------------ - -Launch ``spp-ctl`` before launching SPP primary and secondary processes. -You also need to launch ``spp.py`` if you use ``spp_vf`` from CLI. -``-b`` option is for binding IP address to communicate other SPP processes, -but no need to give it explicitly if ``127.0.0.1`` or ``localhost`` although -doing explicitly in this example to be more understandable. - -.. code-block:: console - - $cd /path/to/spp - - # Launch spp-ctl and spp.py - $ python3 ./src/spp-ctl/spp-ctl -b 127.0.0.1 - $ python ./src/spp.py -b 127.0.0.1 - -Start spp_primary with core list option ``-l 1``. It should be started -with ``-n 16`` for giving enough number of rings. - -.. code-block:: console - - # Type the following in different terminal - $ sudo ./src/primary/x86_64-native-linuxapp-gcc/spp_primary \ - -l 1 -n 4 \ - --socket-mem 512,512 \ - --huge-dir=/run/hugepages/kvm \ - --proc-type=primary \ - -- \ - -p 0x03 -n 16 -s 127.0.0.1:5555 - - -Launch spp_vf -~~~~~~~~~~~~~ - -Launch ``VM1`` -and launch ``spp_vf`` with core list ``-l 0,2-14`` in this usecase. - -.. code-block:: console - - $ sudo ./src/vf/x86_64-native-linuxapp-gcc/spp_vf \ - -l 0,2-14 -n 4 --proc-type=secondary \ - -- \ - --client-id 1 \ - -s 127.0.0.1:6666 \ - --vhost-client - -Start CLI. - -.. code-block:: console - - $ python src/spp.py - -Start components in ``spp_vf``. - -.. code-block:: console - - # start components - spp > vf 1; component start classifier 2 classifier_mac - spp > vf 1; component start merger 3 merge - spp > vf 1; component start forwarder1 4 forward - spp > vf 1; component start forwarder2 5 forward - spp > vf 1; component start forwarder3 6 forward - spp > vf 1; component start forwarder4 7 forward - -Add ports for started components. - -.. code-block:: console - - # add ports - spp > vf 1; port add phy:0 rx classifier - spp > vf 1; port add phy:0 tx merger - spp > vf 1; port add ring:0 tx classifier - spp > vf 1; port add ring:1 tx classifier - spp > vf 1; port add ring:0 rx forwarder1 - spp > vf 1; port add ring:1 rx forwarder2 - spp > vf 1; port add ring:2 rx merger - spp > vf 1; port add ring:3 rx merger - spp > vf 1; port add ring:2 tx forwarder3 - spp > vf 1; port add ring:3 tx forwarder4 - spp > vf 1; port add vhost:0 tx forwarder1 - spp > vf 1; port add vhost:1 rx forwarder3 - spp > vf 1; port add vhost:2 tx forwarder2 - spp > vf 1; port add vhost:3 rx forwarder4 - -Add classifier table entries. - -.. code-block:: console - - # add classifier table entry - spp > vf 1; classifier_table add mac 52:54:00:12:34:56 ring:0 - spp > vf 1; classifier_table add mac 52:54:00:12:34:58 ring:1 - - -To capture incoming packets on VM1, use tcpdump for the interface, ``ens4`` -in this case. - -.. code-block:: console - - # capture on ens4 of VM1 - $ tcpdump -i ens4 - -You send packets from the remote host1 and confirm packets are received. - -.. code-block:: console - - # spp-vm1 via NIC0 from host1 - $ ping 192.168.140.21 - - - -Launch spp_mirror -~~~~~~~~~~~~~~~~~ - -Change directory to spp and confirm that it is already compiled. - -.. code-block:: console - - $ cd /path/to/spp - -Run secondary process ``spp_mirror``. - -.. code-block:: console - - $ sudo ./src/mirror/x86_64-native-linuxapp-gcc/app/spp_mirror \ - -l 0,15 -n 4 --proc-type=secondary \ - -- \ - --client-id 2 \ - -s 127.0.0.1:6666 \ - --vhost-client - - -.. note:: - For SPP secondary processes, client id given with ``--client-id`` option - should not be overlapped each otherand. It is also the same for core list - ``-l``. - -Start mirror component with core ID 15. - -.. code-block:: console - - # Start component of spp_mirror on coreID 15 - spp > mirror 2; component start mirror1 15 mirror - -Add ``ring:0`` as rx ports and add ``ring:8`` and ``ring:9`` as tx port -to mirror. - -.. code-block:: console - - # mirror1 - spp > mirror 2; port add ring:0 rx mirror1 - spp > mirror 2; port add ring:8 tx mirror1 - spp > mirror 2; port add ring:9 tx mirror1 - -Start ``merger3`` with core ID 14. - -.. code-block:: console - - # Start component of spp_vf on coreID 14 - spp > vf 1; component start merger3 14 forward - -Add ``ring:9`` as rx port of ``merger3`` and ``vhost:4`` as -tx port of ``merger3``. - -.. code-block:: console - - # merger3 - spp > vf 1; port add ring:9 rx merger3 - spp > vf 1; port add vhost:4 tx merger3 - -Delete ``ring:0`` as rx port of ``forwarder1`` and ``ring:8`` as -rx port of ``forwarder1``. - -.. code-block:: console - - # forward1 - spp > vf 1; port del ring:0 rx forwarder1 - spp > vf 1; port add ring:8 rx forwarder1 - - -Receive packet on VM3 -~~~~~~~~~~~~~~~~~~~~~ - -You can capture incoming packets on VM3. -If you capture packet on VM1, the same packet would be captured. - -.. code-block:: console - - # capture on ens4 fo VM1 and VM3 - $ tcpdump -i ens4 - -Now, you can send packet from the remote host1. - -.. code-block:: console - - # spp-vm1 via NIC0 from host1 - $ ping 192.168.140.21 - - -Stop Mirroring -~~~~~~~~~~~~~~ - -Firstly, delete ports for components. - -Delete ports for components. - -.. code-block:: console - - # Delete port for mirror1 - spp > mirror 2; port del ring:0 rx mirror1 - spp > mirror 2; port del ring:8 tx mirror1 - spp > mirror 2; port del ring:9 tx mirror1 - - # Delete port for merger3 - spp > vf 1; port del ring:9 rx merger3 - spp > vf 1; port del vhost:4 tx merger3 - - # Delete port for forwarder1 - spp > vf 1; port del ring:8 rx forwarder1 - -Next, stop components. - -.. code-block:: console - - # Stop mirror - spp > mirror 2; component stop mirror1 15 mirror - - # Stop merger - spp > vf 1; component stop merger3 14 forward - -Add port from classifier_mac1 to VM1. - -.. code-block:: console - - # Add port from classifier_mac1 to VM1. - spp > vf 1; port add ring:0 rx forwarder1 - -Exit spp_mirror -~~~~~~~~~~~~~~~ - -Terminate spp_mirror. - -.. code-block:: console - - spp > mirror 1; exit diff --git a/docs/guides/use_cases/index.rst b/docs/guides/use_cases/index.rst index cacf563..1422045 100644 --- a/docs/guides/use_cases/index.rst +++ b/docs/guides/use_cases/index.rst @@ -10,4 +10,5 @@ Use Cases spp_nfv spp_vf + spp_mirror multi_nodes diff --git a/docs/guides/use_cases/spp_mirror.rst b/docs/guides/use_cases/spp_mirror.rst new file mode 100644 index 0000000..dac565f --- /dev/null +++ b/docs/guides/use_cases/spp_mirror.rst @@ -0,0 +1,391 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2019 Nippon Telegraph and Telephone Corporation + + +.. _spp_usecases_mirror: + +spp_mirror +========== + +Duplicate Packets +----------------- + +Simply duplicate incoming packets and send to two destinations. +Remote ``host1`` sends ARP packets by using ping command and +``spp_mirror`` running on local ``host2`` duplicates packets to +destination ports. + + +Network Configuration +~~~~~~~~~~~~~~~~~~~~~ + +Detailed configuration is described in +:numref:`figure_spp_mirror_use_cases_nw_config`. +In this diagram, incoming packets from ``phy:0`` are mirrored. +In ``spp_mirror`` process, worker thread ``mir1`` copies incoming packets and +sends to two destinations ``phy:1`` and ``phy:2``. + +.. _figure_spp_mirror_use_cases_nw_config: + +.. figure:: ../images/spp_vf/basic_usecase_mirror_nwconfig.* + :width: 80% + + Network configuration of mirroring + + +Setup SPP +~~~~~~~~~ + +Change directory to spp and confirm that it is already compiled. + +.. code-block:: console + + $ cd /path/to/spp + +Launch ``spp-ctl`` before launching SPP primary and secondary processes. +You also need to launch ``spp.py`` if you use ``spp_mirror`` from CLI. +``-b`` option is for binding IP address to communicate other SPP processes, +but no need to give it explicitly if ``127.0.0.1`` or ``localhost`` . + +.. code-block:: console + + # terminal 1 + # Launch spp-ctl + $ python3 ./src/spp-ctl/spp-ctl -b 192.168.1.100 + +.. code-block:: console + + # terminal 2 + # Launch SPP CLI + $ python3 ./src/spp.py -b 192.168.1.100 + +Start ``spp_primary`` with core list option ``-l 1`` and +three ports ``-p 0x07``. + +.. code-block:: console + + # terminal 3 + $ sudo ./src/primary/x86_64-native-linuxapp-gcc/spp_primary \ + -l 1 -n 4 \ + --socket-mem 512,512 \ + --huge-dir=/run/hugepages/kvm \ + --proc-type=primary \ + -- \ + -p 0x07 -n 10 -s 192.168.1.100:5555 + + +Launch spp_mirror +~~~~~~~~~~~~~~~~~ + +Run secondary process ``spp_mirror``. + +.. code-block:: console + + # terminal 4 + $ sudo ./src/mirror/x86_64-native-linuxapp-gcc/app/spp_mirror \ + -l 0,2 -n 4 \ + --proc-type secondary \ + -- \ + --client-id 1 \ + -s 192.168.1.100:6666 \ + +Start mirror component with core ID 2. + +.. code-block:: console + + # terminal 2 + spp > mirror 1; component start mir1 2 mirror + +Add ``phy:0`` as rx port, and ``phy:1`` and ``phy:2`` as tx ports. + +.. code-block:: none + + # terminal 2 + # add ports to mir1 + spp > mirror 1; port add phy:0 rx mir1 + spp > mirror 1; port add phy:1 tx mir1 + spp > mirror 1; port add phy:2 tx mir1 + + +Duplicate Packets +~~~~~~~~~~~~~~~~~ + +To check packets are mirrored, you run tcpdump for ``ens1`` and ``ens2``. +As you run ping for ``ens0`` next, you will see the same ARP requests trying +to resolve ``192.168.140.21`` on terminal 1 and 2. + +.. code-block:: console + + # terminal 1 at host1 + # capture on ens1 + $ sudo tcpdump -i ens1 + tcpdump: verbose output suppressed, use -v or -vv for full protocol decode + listening on ens1, link-type EN10MB (Ethernet), capture size 262144 bytes + 21:18:44.183261 ARP, Request who-has 192.168.140.21 tell R740n15, length 28 + 21:18:45.202182 ARP, Request who-has 192.168.140.21 tell R740n15, length 28 + .... + +.. code-block:: console + + # terminal 2 at host1 + # capture on ens2 + $ sudo tcpdump -i ens2 + tcpdump: verbose output suppressed, use -v or -vv for full protocol decode + listening on ens2, link-type EN10MB (Ethernet), capture size 262144 bytes + 21:18:44.183261 ARP, Request who-has 192.168.140.21 tell R740n15, length 28 + 21:18:45.202182 ARP, Request who-has 192.168.140.21 tell R740n15, length 28 + ... + +Start to send ARP request with ping. + +.. code-block:: console + + # terminal 3 at host1 + # send packet from NIC0 + $ ping 192.168.140.21 -I ens0 + + +Stop Mirroring +~~~~~~~~~~~~~~ + +Delete ports for components. + +.. code-block:: none + + # Delete port for mir1 + spp > mirror 1; port del phy:0 rx mir1 + spp > mirror 1; port del phy:1 tx mir1 + spp > mirror 1; port del phy:2 tx mir1 + +Next, stop components. + +.. code-block:: console + + # Stop mirror + spp > mirror 1; component stop mir1 2 mirror + + spp > mirror 1; status + Basic Information: + - client-id: 1 + - ports: [phy:0, phy:1] + Components: + - core:2 '' (type: unuse) + +Finally, terminate ``spp_mirror`` to finish this usecase. + +.. code-block:: console + + spp > mirror 1; exit + + +.. _spp_usecases_mirror_monitor: + +Monitoring Packets +------------------ + +Duplicate classified packets for monitoring before going to a VM. +In this usecase, we are only interested in packets going to ``VM1``. +Although you might be able to run packet monitor app on host, +run minitor on ``VM3`` considering more NFV like senario. +You use ``spp_mirror`` for copying, and ``spp_vf`` classifying packets. + +.. _figure_usecase_monitor_overview: + +.. figure:: ../images/spp_vf/spp_mirror_usecase_overview.* + :width: 60% + + Monitoring with spp_mirror + + +Network Configuration +~~~~~~~~~~~~~~~~~~~~~ + +Detailed configuration of :numref:`figure_usecase_monitor_overview` +is described in :numref:`figure_usecase_monitor_nwconfig`. +In this senario, worker thread ``mir1`` copies incoming packets +from though ``ring:0``. +Then, sends to orignal destination ``VM1`` and anohter one ``VM3``. + +.. _figure_usecase_monitor_nwconfig: + +.. figure:: ../images/spp_vf/spp_mirror_usecase_nwconfig.* + :width: 80% + + Network configuration of monitoring packets + + +Setup SPP and VMs +~~~~~~~~~~~~~~~~~ + +Launch ``spp-ctl`` before launching SPP primary and secondary processes. +You also need to launch ``spp.py`` if you use ``spp_vf`` from CLI. +``-b`` option is for binding IP address to communicate other SPP processes, +but no need to give it explicitly if ``127.0.0.1`` or ``localhost`` although +doing explicitly in this example to be more understandable. + +.. code-block:: console + + # terminal 1 + $ python3 ./src/spp-ctl/spp-ctl -b 192.168.1.100 + +.. code-block:: console + + # terminal 2 + $ python3 ./src/spp.py -b 192.168.1.100 + +Start spp_primary with core list option ``-l 1``. + +.. code-block:: console + + # terminal 3 + # Type the following in different terminal + $ sudo ./src/primary/x86_64-native-linuxapp-gcc/spp_primary \ + -l 1 -n 4 \ + --socket-mem 512,512 \ + --huge-dir=/run/hugepages/kvm \ + --proc-type=primary \ + -- \ + -p 0x03 \ + -n 10 -s 192.168.1.100:5555 + + +Launch spp_vf +~~~~~~~~~~~~~ + +Launch ``VM1``, ``VM2`` and ``spp_vf`` with core list ``-l 0,2-8``. + +.. code-block:: console + + # terminal 4 + $ sudo ./src/vf/x86_64-native-linuxapp-gcc/spp_vf \ + -l 0,2-8 \ + -n 4 --proc-type secondary \ + -- \ + --client-id 1 \ + -s 192.168.1.100:6666 \ + --vhost-client + + +Start components in ``spp_vf``. + +.. code-block:: none + + # terminal 2 + spp > vf 1; component start cls 2 classifier_mac + spp > vf 1; component start mgr1 3 merge + spp > vf 1; component start mgr2 4 merge + spp > vf 1; component start fwd1 5 forward + spp > vf 1; component start fwd2 6 forward + spp > vf 1; component start fwd3 7 forward + spp > vf 1; component start fwd4 8 forward + +Add ports for components. + +.. code-block:: none + + # terminal 2 + spp > vf 1; port add phy:0 rx cls + spp > vf 1; port add ring:0 tx cls + spp > vf 1; port add ring:1 tx cls + + spp > vf 1; port add ring:5 rx fwd1 + spp > vf 1; port add vhost:0 tx fwd1 + + spp > vf 1; port add ring:1 rx fwd2 + spp > vf 1; port add vhost:2 tx fwd2 + + spp > vf 1; port add vhost:1 rx fwd3 + spp > vf 1; port add ring:2 tx fwd3 + + spp > vf 1; port add vhost:3 rx fwd4 + spp > vf 1; port add ring:3 tx fwd4 + + spp > vf 1; port add ring:2 rx mgr1 + spp > vf 1; port add ring:3 rx mgr1 + spp > vf 1; port add phy:0 tx mgr1 + + spp > vf 1; port add ring:4 rx mgr2 + spp > vf 1; port add vhost:4 tx mgr2 + +Add classifier table entries. + +.. code-block:: none + + # terminal 2 + spp > vf 1; classifier_table add mac 52:54:00:12:34:56 ring:0 + spp > vf 1; classifier_table add mac 52:54:00:12:34:58 ring:1 + + +To capture incoming packets on ``VM1``, use tcpdump for the interface, +``ens4`` in this case. + +.. code-block:: console + + # terminal 5 + # capture on ens4 of VM1 + $ tcpdump -i ens4 + +You send packets from the remote ``host1`` and confirm packets are received. +IP address is the same as :ref:`Usecase of spp_vf`. + +.. code-block:: console + + # Send packets from host1 + $ ping 192.168.140.21 + + +Launch spp_mirror +~~~~~~~~~~~~~~~~~ + +Run ``spp_mirror``. + +.. code-block:: console + + $ sudo ./src/mirror/x86_64-native-linuxapp-gcc/app/spp_mirror \ + -l 0,9 \ + -n 4 --proc-type secondary \ + -- \ + --client-id 2 \ + -s 192.168.1.100:6666 \ + --vhost-client + +Start mirror component with lcore ID 9. + +.. code-block:: console + + # Start component on lcore 9 + spp > mirror 2; component start mir1 9 mirror + +Add ``ring:0`` as rx port, ``ring:4`` and ``ring:5`` as tx ports. + +.. code-block:: none + + # terminal 2 + spp > mirror 2; port add ring:0 rx mir1 + spp > mirror 2; port add ring:4 tx mir1 + spp > mirror 2; port add ring:5 tx mir1 + + +Receive Packet on VM3 +~~~~~~~~~~~~~~~~~~~~~ + +You can capture incoming packets on VM3. +If you capture packet on VM1, the same packet would be captured. + +.. code-block:: console + + # capture on ens4 fo VM1 and VM3 + $ tcpdump -i ens4 + +Now, you can send packet from the remote host1. + +.. code-block:: console + + # spp-vm1 via NIC0 from host1 + $ ping 192.168.140.21 + + +Stop Mirroring +~~~~~~~~~~~~~~ + +Graceful shutdown of secondary processes is same as previous usecases. -- 2.7.4