[spp] [PATCH 18/23] spp_vf: add check num of ports before forwarding

x-fn-spp at sl.ntt-tx.co.jp x-fn-spp at sl.ntt-tx.co.jp
Wed Nov 21 02:35:53 CET 2018


From: Hideyuki Yamashita <yamashita.hideyuki at po.ntt-tx.co.jp>

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 <yamashita.hideyuki at po.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki at lab.ntt.co.jp>
---
 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



More information about the spp mailing list