From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B9F70A0487 for ; Wed, 3 Jul 2019 04:25:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B1F891B994; Wed, 3 Jul 2019 04:25:14 +0200 (CEST) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by dpdk.org (Postfix) with ESMTP id 6DC691B994 for ; Wed, 3 Jul 2019 04:25:13 +0200 (CEST) Received: by mail-pf1-f181.google.com with SMTP id 81so386854pfy.13 for ; Tue, 02 Jul 2019 19:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=/+dqe3RJelfMicyCoMb1LBelhCFPw8goyxs5oE0tkEc=; b=BJWhVTd0apQPQONpZGqGrUlH4Cqe7OKXPS3P9CQNH6of+SWin1Kkeqj96xvLpX40ze s4kmAPMR4hN6X6jFHqLcEQgYA4TJdV3xQezzUpbv9DcxRV22d4lowwYv2uXlpCDOe+eN kCN2k8hW5+aC/AStDXvEiIDvUb25yPmokhRQHND0lXr7/56QLPUkKvipfwwzNDX3MmFI x6RlwB7tQz03l6MLSsWXyVi7iBq1VGmpKXuoprAZ1R8Z7iFmaQ++BKSmUM6E4r5gPqzv IJEUMyiKDz7Q7aC3Hi6QyxrTBD1FqvUbfWZl5BIqt7GAvMK9jkg11e4pJkmxRxDUudNh LxIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=/+dqe3RJelfMicyCoMb1LBelhCFPw8goyxs5oE0tkEc=; b=U0NiXFtWT0ZKFkXRpEvQymFpzCpkcsmkcWDiP+TnPEuMY2Sbvk5nWpRda+5YPF8i+Q 0fdex3t186I+0LNOJD28r5MZpWEO9P9teAxIqLAK9Zax9QiKCov9lX6Bh5nH8XhBuEHC LD51Bmfj3LOEbnzpHZK4rjSmwlY/XJ3VWl19I8TmalESn49OEpcbkgQm+067ggbYT/IO GWxkL89XNFknuFQ3EjVIIpRZvO7dKRoFuzubmQZbosDd9u9HkYLtowoATzJ/BYtmC2rV E/2+qg24OZhYFz/3LPmtcJWh8+JdqQfDdkwhBPioIVG8FiyfQACp7mKHugA9/m//ZhEq 7XJQ== X-Gm-Message-State: APjAAAXWh4b1GcHHbVZZXJLOOx74Q+O13uvZU9xcBRhoYS5rwbZ0v204 XEZuORLddaC14SQ7JWDVzu6cWCVO X-Google-Smtp-Source: APXvYqxq3cxuflFBWOrzeiURsrJPZtgGfb0fjnMRLQh7zpGRHfcLadyfOZ0dfWrdmd0DNvabIOWFww== X-Received: by 2002:a63:480e:: with SMTP id v14mr33204501pga.182.1562120712454; Tue, 02 Jul 2019 19:25:12 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id o130sm416096pfg.171.2019.07.02.19.25.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jul 2019 19:25:12 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Wed, 3 Jul 2019 11:25:00 +0900 Message-Id: <20190703022501.23738-3-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190703022501.23738-1-yasufum.o@gmail.com> References: <20190703022501.23738-1-yasufum.o@gmail.com> Subject: [spp] [PATCH 2/3] docs: update implementation 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: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa This patch is to update description and examples of spp_mirror. Signed-off-by: Yasufumi Ogawa --- 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