From: John Daley <johndale@cisco.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, adrien.mazarguil@6wind.com,
John Daley <johndale@cisco.com>
Subject: [dpdk-dev] [PATCH 6/6] net/enic: flow API debug
Date: Thu, 30 Mar 2017 14:28:38 -0700 [thread overview]
Message-ID: <20170330212838.31291-6-johndale@cisco.com> (raw)
In-Reply-To: <20170330212838.31291-1-johndale@cisco.com>
Added a debug function to print enic filters and actions when
rte_validate_flow is called. Compiled in CONFIG_RTE_LIBRTE_ENIC_DEBUG_FLOW
is enabled and log level is INFO.
Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
---
drivers/net/enic/enic_flow.c | 138 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 138 insertions(+)
diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
index 2ad784056..1f7256a95 100644
--- a/drivers/net/enic/enic_flow.c
+++ b/drivers/net/enic/enic_flow.c
@@ -1064,6 +1064,142 @@ enic_get_action_cap(struct enic *enic)
ea = &enic_action_cap[FILTER_ACTION_RQ_STEERING_FLAG];
return ea;
}
+
+/* Debug function to dump internal NIC action structure. */
+static void
+enic_dump_actions(const struct filter_action_v2 *ea)
+{
+ if (ea->type == FILTER_ACTION_RQ_STEERING) {
+ FLOW_LOG(INFO, "Action(V1), queue: %u\n", ea->rq_idx);
+ } else if (ea->type == FILTER_ACTION_V2) {
+ FLOW_LOG(INFO, "Actions(V2)\n");
+ if (ea->flags & FILTER_ACTION_RQ_STEERING_FLAG)
+ FLOW_LOG(INFO, "\tqueue: %u\n",
+ enic_sop_rq_idx_to_rte_idx(ea->rq_idx));
+ if (ea->flags & FILTER_ACTION_FILTER_ID_FLAG)
+ FLOW_LOG(INFO, "\tfilter_id: %u\n", ea->filter_id);
+ }
+}
+
+/* Debug function to dump internal NIC filter structure. */
+static void
+enic_dump_filter(const struct filter_v2 *filt)
+{
+ const struct filter_generic_1 *gp;
+ int i, j, mbyte;
+ char buf[128], *bp;
+ char ip4[16], ip6[16], udp[16], tcp[16], tcpudp[16], ip4csum[16];
+ char l4csum[16], ipfrag[16];
+
+ switch (filt->type) {
+ case FILTER_IPV4_5TUPLE:
+ FLOW_LOG(INFO, "FILTER_IPV4_5TUPLE\n");
+ break;
+ case FILTER_USNIC_IP:
+ case FILTER_DPDK_1:
+ /* FIXME: this should be a loop */
+ gp = &filt->u.generic_1;
+ FLOW_LOG(INFO, "Filter: vlan: 0x%04x, mask: 0x%04x\n",
+ gp->val_vlan, gp->mask_vlan);
+
+ if (gp->mask_flags & FILTER_GENERIC_1_IPV4)
+ sprintf(ip4, "%s ",
+ (gp->val_flags & FILTER_GENERIC_1_IPV4)
+ ? "ip4(y)" : "ip4(n)");
+ else
+ sprintf(ip4, "%s ", "ip4(x)");
+
+ if (gp->mask_flags & FILTER_GENERIC_1_IPV6)
+ sprintf(ip6, "%s ",
+ (gp->val_flags & FILTER_GENERIC_1_IPV4)
+ ? "ip6(y)" : "ip6(n)");
+ else
+ sprintf(ip6, "%s ", "ip6(x)");
+
+ if (gp->mask_flags & FILTER_GENERIC_1_UDP)
+ sprintf(udp, "%s ",
+ (gp->val_flags & FILTER_GENERIC_1_UDP)
+ ? "udp(y)" : "udp(n)");
+ else
+ sprintf(udp, "%s ", "udp(x)");
+
+ if (gp->mask_flags & FILTER_GENERIC_1_TCP)
+ sprintf(tcp, "%s ",
+ (gp->val_flags & FILTER_GENERIC_1_TCP)
+ ? "tcp(y)" : "tcp(n)");
+ else
+ sprintf(tcp, "%s ", "tcp(x)");
+
+ if (gp->mask_flags & FILTER_GENERIC_1_TCP_OR_UDP)
+ sprintf(tcpudp, "%s ",
+ (gp->val_flags & FILTER_GENERIC_1_TCP_OR_UDP)
+ ? "tcpudp(y)" : "tcpudp(n)");
+ else
+ sprintf(tcpudp, "%s ", "tcpudp(x)");
+
+ if (gp->mask_flags & FILTER_GENERIC_1_IP4SUM_OK)
+ sprintf(ip4csum, "%s ",
+ (gp->val_flags & FILTER_GENERIC_1_IP4SUM_OK)
+ ? "ip4csum(y)" : "ip4csum(n)");
+ else
+ sprintf(ip4csum, "%s ", "ip4csum(x)");
+
+ if (gp->mask_flags & FILTER_GENERIC_1_L4SUM_OK)
+ sprintf(l4csum, "%s ",
+ (gp->val_flags & FILTER_GENERIC_1_L4SUM_OK)
+ ? "l4csum(y)" : "l4csum(n)");
+ else
+ sprintf(l4csum, "%s ", "l4csum(x)");
+
+ if (gp->mask_flags & FILTER_GENERIC_1_IPFRAG)
+ sprintf(ipfrag, "%s ",
+ (gp->val_flags & FILTER_GENERIC_1_IPFRAG)
+ ? "ipfrag(y)" : "ipfrag(n)");
+ else
+ sprintf(ipfrag, "%s ", "ipfrag(x)");
+ FLOW_LOG(INFO, "\tFlags: %s%s%s%s%s%s%s%s\n", ip4, ip6, udp,
+ tcp, tcpudp, ip4csum, l4csum, ipfrag);
+
+ for (i = 0; i < FILTER_GENERIC_1_NUM_LAYERS; i++) {
+ mbyte = FILTER_GENERIC_1_KEY_LEN - 1;
+ while (mbyte && !gp->layer[i].mask[mbyte])
+ mbyte--;
+ if (mbyte == 0)
+ continue;
+
+ bp = buf;
+ for (j = 0; j <= mbyte; j++) {
+ sprintf(bp, "%02x",
+ gp->layer[i].mask[j]);
+ bp += 2;
+ }
+ *bp = '\0';
+ FLOW_LOG(INFO, "\tL%u mask: %s\n", i + 2, buf);
+ bp = buf;
+ for (j = 0; j <= mbyte; j++) {
+ sprintf(bp, "%02x",
+ gp->layer[i].val[j]);
+ bp += 2;
+ }
+ *bp = '\0';
+ FLOW_LOG(INFO, "\tL%u val: %s\n", i + 2, buf);
+ }
+ break;
+ default:
+ FLOW_LOG(INFO, "FILTER UNKNOWN\n");
+ break;
+ }
+}
+
+/* Debug function to dump internal NIC flow structures. */
+static void
+enic_dump_flow(const struct filter_action_v2 *ea, const struct filter_v2 *filt)
+{
+ enic_dump_filter(filt);
+ enic_dump_actions(ea);
+}
+
+
/**
* Internal flow parse/validate function.
*
@@ -1275,6 +1411,8 @@ enic_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attrs,
ret = enic_flow_parse(dev, attrs, pattern, actions, error,
&enic_filter, &enic_action);
+ if (!ret)
+ enic_dump_flow(&enic_action, &enic_filter);
return ret;
}
--
2.12.0
next prev parent reply other threads:[~2017-03-30 21:28 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-30 21:28 [dpdk-dev] [PATCH 1/6] net/enic: bring NIC interface functions up to date John Daley
2017-03-30 21:28 ` [dpdk-dev] [PATCH 2/6] net/enic: flow API skeleton John Daley
2017-03-30 21:28 ` [dpdk-dev] [PATCH 3/6] net/enic: flow API for NICs with advanced filters enabled John Daley
2017-03-30 21:28 ` [dpdk-dev] [PATCH 4/6] net/enic: flow API for NICs with advanced filters disabled John Daley
2017-03-30 21:28 ` [dpdk-dev] [PATCH 5/6] net/enic: flow API support for Legacy NICs John Daley
2017-03-30 21:28 ` John Daley [this message]
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 0/7] *** flow API support for enic *** John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 1/7] net/enic: bring NIC interface functions up to date John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 2/7] net/enic: flow API skeleton John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 3/7] net/enic: flow API for NICs with advanced filters enabled John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 4/7] net/enic: flow API for NICs with advanced filters disabled John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 5/7] net/enic: flow API for Legacy NICs John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 6/7] net/enic: flow API debug John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 7/7] net/enic: flow API documentation John Daley
2017-04-02 15:18 ` Mcnamara, John
2017-05-12 12:11 ` Ferruh Yigit
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 0/6] enic flow api support John Daley
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 1/6] net/enic: flow API skeleton John Daley
2017-05-17 11:12 ` Ferruh Yigit
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 2/6] net/enic: flow API for NICs with advanced filters enabled John Daley
2017-05-17 11:12 ` Ferruh Yigit
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 3/6] net/enic: flow API for NICs with advanced filters disabled John Daley
2017-05-17 11:13 ` Ferruh Yigit
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 4/6] net/enic: flow API for Legacy NICs John Daley
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 5/6] net/enic: flow API debug John Daley
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 6/6] net/enic: flow API documentation John Daley
2017-05-17 11:13 ` Ferruh Yigit
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 0/8] enic flow api support John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 1/8] net/enic: bring NIC interface functions up to date John Daley
2017-05-22 9:49 ` Ferruh Yigit
2017-06-08 10:44 ` Jerin Jacob
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 2/8] net/enic: flow API skeleton John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 3/8] net/enic: flow API for NICs with advanced filters enabled John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 4/8] net/enic: flow API mark and flag support John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 5/8] net/enic: flow API for NICs with advanced filters disabled John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 6/8] net/enic: flow API for Legacy NICs John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 7/8] net/enic: flow API debug John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 8/8] net/enic: flow API documentation John Daley
2017-05-22 10:05 ` [dpdk-dev] [PATCH v4 0/8] enic flow api support Ferruh Yigit
2017-05-17 11:12 ` [dpdk-dev] [PATCH v3 0/6] " Ferruh Yigit
2017-03-31 10:12 ` [dpdk-dev] [PATCH 1/6] net/enic: bring NIC interface functions up to date Ferruh Yigit
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=20170330212838.31291-6-johndale@cisco.com \
--to=johndale@cisco.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/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).