From: Zeng Xiaoxiao <xiaoxiaox.zeng@intel.com>
To: dts@dpdk.org
Cc: Zeng Xiaoxiao <xiaoxiaox.zeng@intel.com>
Subject: [dts] [PATCH V1 2/2] tests/rte_flow_common: add function for cvl_advanced_iavf_rss
Date: Tue, 2 Jun 2020 11:42:04 +0000 [thread overview]
Message-ID: <20200602114204.6110-1-xiaoxiaox.zeng@intel.com> (raw)
Signed-off-by: Zeng Xiaoxiao <xiaoxiaox.zeng@intel.com>
---
tests/rte_flow_common.py | 66 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py
index be0e434..0c4a13a 100644
--- a/tests/rte_flow_common.py
+++ b/tests/rte_flow_common.py
@@ -473,3 +473,69 @@ def find_queueid_rxpackets_list(id, q_rx_list):
if (int(item[0]) == id):
return int(item[1])
return 0
+
+def check_iavf_packets_rss_queue(out, count, rss_match=True):
+ """
+ check each queue has receive packets
+ """
+ out = out.split("Forward statistics for port 0")[0]
+ lines = out.split("\r\n")
+ queue_flag = 0
+ packet_sumnum = 0
+
+ for line in lines:
+ line = line.strip()
+ if "Forward Stats" in line.strip():
+ result_scanner = r"RX Port= \d+/Queue=\s?([0-9]+)"
+ scanner = re.compile(result_scanner, re.DOTALL)
+ m = scanner.search(line)
+ queue_num = m.group(1)
+ if queue_num is not None:
+ queue_flag = queue_flag + 1
+
+ elif line.strip().startswith("RX-packets"):
+ result_scanner = r"RX-packets:\s?([0-9]+)"
+ scanner = re.compile(result_scanner, re.DOTALL)
+ m = scanner.search(line)
+ packet_num = m.group(1)
+ if len(packet_num) != 0:
+ packet_sumnum = packet_sumnum + int(packet_num)
+
+ if rss_match:
+ if queue_flag >= 10 and packet_sumnum == count:
+ log_msg = "Packets has send to %s queues" % queue_flag
+ return True, log_msg
+ else:
+ log_msg = "Packets not send to different queues"
+ return False, log_msg
+ else:
+ if queue_flag == 1 and packet_sumnum == count:
+ log_msg = "Packets not match rule"
+ return True, log_msg
+ else:
+ log_msg = "Packets send to different queues"
+ return False, log_msg
+
+
+def check_pf_rss_queue(out, count):
+ """
+ check each queue has receive packets
+ """
+ lines = out.split("\r\n")
+ queue_num = []
+ packet_sumnum = 0
+
+ for line in lines:
+ line = line.strip()
+ if "_packets" in line.strip():
+ result_scanner = r"rx_queue_\d+_packets:\s?(\d+)"
+ scanner = re.compile(result_scanner, re.DOTALL)
+ m = scanner.search(line)
+ queue_pkg = m.group(1)
+ queue_num.append(queue_pkg)
+ packet_sumnum = packet_sumnum + int(queue_pkg)
+
+ if packet_sumnum == count and len(queue_num) == 10:
+ return True
+ else:
+ return False
\ No newline at end of file
--
2.17.1
next reply other threads:[~2020-06-02 2:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 11:42 Zeng Xiaoxiao [this message]
2020-06-02 3:26 ` He, Zhiwei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200602114204.6110-1-xiaoxiaox.zeng@intel.com \
--to=xiaoxiaox.zeng@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).