Thread (16 messages) 16 messages, 6 authors, 2023-03-23

Re: [dpdk-dev] [RFC PATCH] ethdev: add support for testpmd-compliant flow rule dumping

From: Singh, Aman Deep <hidden>
Date: 2021-06-14 12:42:37

Hi Ivan,

As a suggestion, can we add a check for debug log_level in 
"rte_flow_snprint" itself.

So we can avoid CPU time, in cases where we don't want these logs.


On 5/27/2021 1:55 PM, Ivan Malov wrote:
DPDK applications (for example, OvS) or tests which use RTE
flow API need to log created or rejected flow rules to help
to recognise what goes right or wrong. From this standpoint,
testpmd-compliant format is nice for the purpose because it
allows to copy-paste the flow rules and debug using testpmd.

Recognisable pattern items:
VOID, VF, PF, PHY_PORT, PORT_ID, ETH, VLAN, IPV4, IPV6, UDP,
TCP, VXLAN, NVGRE, GENEVE, MARK, PPPOES, PPPOED.

Recognisable actions:
VOID, JUMP, MARK, FLAG, QUEUE, DROP, COUNT, RSS, PF, VF, PHY_PORT,
PORT_ID, OF_POP_VLAN, OF_PUSH_VLAN, OF_SET_VLAN_VID,
OF_SET_VLAN_PCP, VXLAN_ENCAP, VXLAN_DECAP.

Recognisable RSS types (action RSS):
IPV4, FRAG_IPV4, NONFRAG_IPV4_TCP, NONFRAG_IPV4_UDP, NONFRAG_IPV4_OTHER,
IPV6, FRAG_IPV6, NONFRAG_IPV6_TCP, NONFRAG_IPV6_UDP, NONFRAG_IPV6_OTHER,
IPV6_EX, IPV6_TCP_EX, IPV6_UDP_EX, L3_SRC_ONLY, L3_DST_ONLY,
L4_SRC_ONLY, L4_DST_ONLY.

Unrecognised parts of the flow specification are represented by
tokens "{unknown}" and "{unknown bits}". Interested parties are
welcome to extend this tool to recognise more items and actions.

Signed-off-by: Ivan Malov <redacted>

+int
+rte_flow_snprint(char *buf, size_t buf_size, size_t *nb_chars_total,
+		 const struct rte_flow_attr *attr,
+		 const struct rte_flow_item pattern[],
+		 const struct rte_flow_action actions[])
+{
+	int rc;
+
Like add a check with "rte_log_can_log()" and return from here.
+	if (buf == NULL && buf_size != 0)
+		return -EINVAL;
+
+	*nb_chars_total = 0;
+
+	rc = rte_flow_snprint_attr(buf, buf_size, nb_chars_total, attr);
+	if (rc != 0)
+		return rc;
+
+	rc = rte_flow_snprint_pattern(buf, buf_size, nb_chars_total, pattern);
+	if (rc != 0)
+		return rc;
+
+	rc = rte_flow_snprint_actions(buf, buf_size, nb_chars_total, actions);
+	if (rc != 0)
+		return rc;
+
+	return 0;
+}
Regards

Aman
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help