From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.ics.ntt-tx.co.jp (mail05.ics.ntt-tx.co.jp [210.232.35.69]) by dpdk.org (Postfix) with ESMTP id 22B187CFA for ; Thu, 28 Dec 2017 05:56:14 +0100 (CET) Received: from gwchk03.silk.ntt-tx.co.jp (gwchk03.silk.ntt-tx.co.jp [10.107.0.111]) by mail04.ics.ntt-tx.co.jp (unknown) with ESMTP id vBS4uDk3025286 for unknown; Thu, 28 Dec 2017 13:56:13 +0900 Received: (from root@localhost) by gwchk03.silk.ntt-tx.co.jp (unknown) id vBS4u8x0027392 for unknown; Thu, 28 Dec 2017 13:56:08 +0900 Received: from gwchk.silk.ntt-tx.co.jp [10.107.0.110] by gwchk03.silk.ntt-tx.co.jp with ESMTP id PAA27380; Thu, 28 Dec 2017 13:56:08 +0900 Received: from imss03.silk.ntt-tx.co.jp (localhost [127.0.0.1]) by imss03.silk.ntt-tx.co.jp (unknown) with ESMTP id vBS4u7sf011135 for unknown; Thu, 28 Dec 2017 13:56:07 +0900 Received: from mgate01.silk.ntt-tx.co.jp (smtp02.silk.ntt-tx.co.jp [10.107.0.37]) by imss03.silk.ntt-tx.co.jp (unknown) with ESMTP id vBS4u71Y011106 for unknown; Thu, 28 Dec 2017 13:56:07 +0900 Message-Id: <201712280456.vBS4u71Y011106@imss03.silk.ntt-tx.co.jp> Received: from localhost by mgate01.silk.ntt-tx.co.jp (unknown) id vBS4u4bO025622 ; Thu, 28 Dec 2017 13:56:07 +0900 From: x-fn-spp@sl.ntt-tx.co.jp To: spp@dpdk.org Date: Thu, 28 Dec 2017 13:55:57 +0900 X-Mailer: git-send-email 1.9.1 In-Reply-To: <4aae78ff-3b6c-cdfe-a8b7-24ec08b73935@lab.ntt.co.jp> References: <4aae78ff-3b6c-cdfe-a8b7-24ec08b73935@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-MML: No Subject: [spp] [PATCH 50/57] spp_vf: refactor comments in spp_forward.c 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: Thu, 28 Dec 2017 04:56:16 -0000 From: Hiroyuki Nakamura * Update remaining Japanese to English. * Add supplemental description for some of comments. Signed-off-by: Yasufumi Ogawa --- src/vf/spp_forward.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c index e153e85..afe7c03 100644 --- a/src/vf/spp_forward.c +++ b/src/vf/spp_forward.c @@ -4,17 +4,13 @@ #define RTE_LOGTYPE_FORWARD RTE_LOGTYPE_USER1 -/* - * 送受信ポートの経路情報 - */ +/* A set of port info of rx and tx */ struct rxtx { struct spp_core_port_info rx; struct spp_core_port_info tx; }; -/* - * 使用するIF情報を移し替える - */ +/* Set destination port as source */ static void set_use_interface(struct spp_core_port_info *dst, struct spp_core_port_info *src) @@ -24,8 +20,11 @@ set_use_interface(struct spp_core_port_info *dst, dst->dpdk_port = src->dpdk_port; } -/* - * Merge/Forward +/** + * Forwarding packets as forwarder or merger + * + * Behavior of forwarding is defined as core_info->type which is given + * as an argument of void and typecasted to spp_config_info. */ int spp_forward(void *arg) @@ -35,23 +34,21 @@ spp_forward(void *arg) int if_cnt, rxtx_num = 0; struct rxtx patch[RTE_MAX_ETHPORTS]; - /* RX/TX Info setting */ + /* Decide the destination of forwarding */ rxtx_num = core_info->num_rx_port; for (if_cnt = 0; if_cnt < rxtx_num; if_cnt++) { set_use_interface(&patch[if_cnt].rx, &core_info->rx_ports[if_cnt]); + /* Forwarding type is supposed to forwarder or merger */ if (core_info->type == SPP_CONFIG_FORWARD) { - /* FORWARD */ set_use_interface(&patch[if_cnt].tx, &core_info->tx_ports[if_cnt]); } else { - /* MERGE */ set_use_interface(&patch[if_cnt].tx, &core_info->tx_ports[0]); } } - /* Thread IDLE */ core_info->status = SPP_CORE_IDLE; RTE_LOG(INFO, FORWARD, "Core[%d] Start. (type = %d)\n", lcore_id, core_info->type); @@ -67,29 +64,27 @@ spp_forward(void *arg) rx = &patch[cnt].rx; tx = &patch[cnt].tx; - /* Packet receive */ + /* Receive packets */ nb_rx = rte_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PKT_BURST); if (unlikely(nb_rx == 0)) { continue; } -#ifdef SPP_RINGLATENCYSTATS_ENABLE /* RING滞留時間 */ +#ifdef SPP_RINGLATENCYSTATS_ENABLE if (rx->if_type == RING) { - /* Receive port is RING */ spp_ringlatencystats_calculate_latency(rx->if_no, bufs, nb_rx); } if (tx->if_type == RING) { - /* Send port is RING */ spp_ringlatencystats_add_time_stamp(tx->if_no, bufs, nb_rx); } #endif /* SPP_RINGLATENCYSTATS_ENABLE */ - /* Send packet */ + /* Send packets */ nb_tx = rte_eth_tx_burst(tx->dpdk_port, 0, bufs, nb_rx); - /* Free any unsent packets. */ + /* Discard remained packets to release mbuf */ if (unlikely(nb_tx < nb_rx)) { for (buf = nb_tx; buf < nb_rx; buf++) { rte_pktmbuf_free(bufs[buf]); @@ -99,7 +94,6 @@ spp_forward(void *arg) } } - /* Thread STOP */ RTE_LOG(INFO, FORWARD, "Core[%d] End. (type = %d)\n", lcore_id, core_info->type); core_info->status = SPP_CORE_STOP; -- 1.9.1