[spp] [PATCH 20/23] spp_vf: add checking the number of ports

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


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

Add checking the number of ports for classifier. It only allows exactly
one of rx port, tx port and classifier table exist while starting to
classify.

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/classifier_mac.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 0244f7e..cfaf96a 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -879,11 +879,25 @@ spp_classifier_mac_do(int id)
 		/* change index of update side */
 		change_update_index(mng_info, id);
 
-		/* decide classifier information of the current cycle */
+		/**
+		 * decide classifier information of the current cycle
+		 * If at least, one rx port, one tx port and one
+		 * classifier_table exist, then start classifying.
+		 * If not, stop classifying.
+		 */
 		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
 		clsd_data_rx = &cmp_info->classified_data_rx;
 		clsd_data_tx = cmp_info->classified_data_tx;
 
+		/**
+		 * Perform condition check if reception/transmission
+		 * of packet should be done or not
+		 */
+		if (!(clsd_data_rx->iface_type != UNDEF &&
+				cmp_info->n_classified_data_tx >= 1 &&
+				cmp_info->mac_addr_entry == 1))
+			continue;
+
 		/* drain tx packets, if buffer is not filled for interval */
 		cur_tsc = rte_rdtsc();
 		if (unlikely(cur_tsc - prev_tsc > drain_tsc)) {
-- 
2.18.0



More information about the spp mailing list