From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 2/3] docs: update implementation of spp_mirror
Date: Wed, 3 Jul 2019 11:25:00 +0900 [thread overview]
Message-ID: <20190703022501.23738-3-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190703022501.23738-1-yasufum.o@gmail.com>
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This patch is to update description and examples of spp_mirror.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
docs/guides/design/impl/spp_mirror.rst | 85 ++++++++------------------
1 file changed, 27 insertions(+), 58 deletions(-)
diff --git a/docs/guides/design/impl/spp_mirror.rst b/docs/guides/design/impl/spp_mirror.rst
index bb4548e..6233de9 100644
--- a/docs/guides/design/impl/spp_mirror.rst
+++ b/docs/guides/design/impl/spp_mirror.rst
@@ -6,81 +6,50 @@
spp_mirror
==========
-Initializing
-------------
+This section describes implementation of ``spp_mirror``.
+It consists of master thread and several worker threads for duplicating
+packets.
-A main thread of ``spp_mirror`` initialize eal by ``rte_eal_init()``.
-Then each of worker threads is launched from ``rte_eal_remote_launch()``
-by giving a function ``slave_main()`` for forwarding.
-
-.. code-block:: c
-
- /* spp_mirror.c */
- int ret_dpdk = rte_eal_init(argc, argv);
-
- /* Start worker threads of classifier and forwarder */
- unsigned int lcore_id = 0;
- RTE_LCORE_FOREACH_SLAVE(lcore_id) {
- rte_eal_remote_launch(slave_main, NULL, lcore_id);
- }
+Slave Main
+----------
-Main function of slave thread
------------------------------
-
-In ``slave_main()``, it calls ``mirror_proc()`` in which packet processing for
-duplicating is defined after finding a core on which running the duplicating.
+Main function of worker thread is defined as ``slave_main()`` in which
+for duplicating packets is ``mirror_proc()`` on each of lcores.
.. code-block:: c
- RTE_LOG(INFO, MIRROR, "Core[%d] Start.\n", lcore_id);
- set_core_status(lcore_id, SPP_CORE_IDLE);
-
- while ((status = spp_get_core_status(lcore_id)) !=
- SPP_CORE_STOP_REQUEST) {
- if (status != SPP_CORE_FORWARD)
- continue;
-
- if (spp_check_core_index(lcore_id)) {
- /* Setting with the flush command trigger. */
- info->ref_index = (info->upd_index+1) %
- SPP_INFO_AREA_MAX;
- core = get_core_info(lcore_id);
- }
-
for (cnt = 0; cnt < core->num; cnt++) {
- /*
- * mirror returns at once.
- * It is for processing multiple components.
- */
+
ret = mirror_proc(core->id[cnt]);
if (unlikely(ret != 0))
break;
}
- if (unlikely(ret != 0)) {
- RTE_LOG(ERR, MIRROR,
- "Core[%d] Component Error. (id = %d)\n",
- lcore_id, core->id[cnt]);
- break;
- }
- }
- set_core_status(lcore_id, SPP_CORE_STOP);
- RTE_LOG(INFO, MIRROR, "Core[%d] End.\n", lcore_id);
-Packet mirroring
-----------------
+Mirroring Packets
+-----------------
-In ``mirror_proc()``, it receives packets from rx port.
+Worker thread receives and duplicate packets. There are two modes of copying
+packets, ``shallowcopy`` and ``deepcopy``.
+Deep copy is for duplicating whole of packet data, but less performance than
+shallow copy. Shallow copy duplicates only packet header and body is not shared
+among original packet and duplicated packet. So, changing packet data affects
+both of original and copied packet.
-.. code-block:: c
+You can configure using which of modes in Makefile. Default mode is
+``shallowcopy``. If you change the mode to ``deepcopy``, comment out this
+line of CFLAGS.
+
+.. code-block:: makefile
- /* Receive packets */
- nb_rx = spp_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PKT_BURST);
+ # Default mode is shallow copy.
+ CFLAGS += -DSPP_MIRROR_SHALLOWCOPY
-Each of received packet is copied with ``rte_pktmbuf_clone()`` if you use
-``shallowcopy`` defined as default in Makefile.
-If you use ``deepcopy``, several mbuf objects are allocated for copying.
+This code is a part of ``mirror_proc()``. In this function,
+``rte_pktmbuf_clone()`` is just called if in shallow copy
+mode, or create a new packet with ``rte_pktmbuf_alloc()`` for duplicated
+packet if in deep copy mode.
.. code-block:: c
--
2.17.1
next prev parent reply other threads:[~2019-07-03 2:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 2:24 [spp] [PATCH 0/3] Update docs of implementation of SPP secondaries yasufum.o
2019-07-03 2:24 ` [spp] [PATCH 1/3] docs: update implementation of spp_vf yasufum.o
2019-07-03 2:25 ` yasufum.o [this message]
2019-07-03 2:25 ` [spp] [PATCH 3/3] docs: update implementation of spp_pcap yasufum.o
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=20190703022501.23738-3-yasufum.o@gmail.com \
--to=yasufum.o@gmail.com \
--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
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).