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 DCB2B5F19 for ; Wed, 21 Nov 2018 02:41:09 +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 wAL1f8NY002716; Wed, 21 Nov 2018 10:41:08 +0900 Received: (from root@localhost) by gwchk03.silk.ntt-tx.co.jp (unknown) id wAL1f7q4004596; Wed, 21 Nov 2018 10:41:07 +0900 Received: from gwchk.silk.ntt-tx.co.jp [10.107.0.110] by gwchk03.silk.ntt-tx.co.jp with ESMTP id LAA01867; Wed, 21 Nov 2018 10:36:01 +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 wAL1a1se009696; Wed, 21 Nov 2018 10:36:01 +0900 Received: from mgate02.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 wAL1a15k009693; Wed, 21 Nov 2018 10:36:01 +0900 Message-Id: <201811210136.wAL1a15k009693@imss03.silk.ntt-tx.co.jp> Received: from localhost by mgate02.silk.ntt-tx.co.jp (unknown) id wAL1ZwWk008346 ; Wed, 21 Nov 2018 10:36:01 +0900 From: x-fn-spp@sl.ntt-tx.co.jp To: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Cc: spp@dpdk.org Date: Wed, 21 Nov 2018 10:35:53 +0900 X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181121013558.8869-1-x-fn-spp@sl.ntt-tx.co.jp> References: <20181121013558.8869-1-x-fn-spp@sl.ntt-tx.co.jp> X-TM-AS-MML: No Subject: [spp] [PATCH 18/23] spp_vf: add check num of ports before forwarding 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: Wed, 21 Nov 2018 01:41:10 -0000 From: Hideyuki Yamashita Add check the number of ports before forwarding for forwarder and merger. For forwarder, start if both of rx and tx ports exist. For merger, start if more than one rx ports and one tx port exist. Signed-off-by: Hideyuki Yamashita Signed-off-by: Naoki Takada --- src/vf/spp_forward.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c index 5e6189c..2dbb171 100644 --- a/src/vf/spp_forward.c +++ b/src/vf/spp_forward.c @@ -147,6 +147,17 @@ spp_forward(int id) change_forward_index(id); path = &info->path[info->ref_index]; + /* Practice condition check */ + if (path->type == SPP_COMPONENT_MERGE) { + /* merger */ + if (!(path->num_tx == 1 && path->num_rx >= 1)) + return SPP_RET_OK; + } else { + /* forwarder */ + if (!(path->num_tx == 1 && path->num_rx == 1)) + return SPP_RET_OK; + } + for (cnt = 0; cnt < path->num_rx; cnt++) { rx = &path->ports[cnt].rx; tx = &path->ports[cnt].tx; -- 2.18.0