From: Hyong Youb Kim <hyonkim@cisco.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, John Daley <johndale@cisco.com>,
Hyong Youb Kim <hyonkim@cisco.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH 04/15] net/enic: allow flow mark ID 0
Date: Wed, 27 Feb 2019 23:03:06 -0800 [thread overview]
Message-ID: <20190228070317.17002-5-hyonkim@cisco.com> (raw)
In-Reply-To: <20190228070317.17002-1-hyonkim@cisco.com>
The driver currently accepts mark ID 0 but does not report it in
matching packet's mbuf. For example, the following testpmd command
succeeds. But, the mbuf of a matching IPv4 UDP packet does not have
PKT_RX_FDIR_ID set.
flow create 0 ingress pattern ... actions mark id 0 / queue index 0 / end
The problem has to do with mapping mark IDs (32-bit) to NIC filter
IDs. Filter ID is currently 16-bit, so values greater than 0xffff are
rejected. The firmware reserves filter ID 0 for filters that do not
mark (e.g. steer w/o mark). And, the driver reserves 0xffff for the
flag action. This leaves 1...0xfffe for app use.
It is possible to simply reject mark ID 0 as unsupported. But, 0 is
commonly used (e.g. OVS-DPDK and VPP). So, when adding a filter, set
filter ID = mark ID + 1 to support mark ID 0. The receive handler
subtracts 1 from filter ID to get back the original mark ID.
Fixes: dfbd6a9cb504 ("net/enic: extend flow director support for 1300 series")
Cc: stable@dpdk.org
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
drivers/net/enic/enic_flow.c | 15 +++++++++++----
drivers/net/enic/enic_rxtx_common.h | 3 ++-
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
index 55d8d50a1..e12a6ec73 100644
--- a/drivers/net/enic/enic_flow.c
+++ b/drivers/net/enic/enic_flow.c
@@ -1081,12 +1081,18 @@ enic_copy_action_v2(const struct rte_flow_action actions[],
if (overlap & MARK)
return ENOTSUP;
overlap |= MARK;
- /* ENIC_MAGIC_FILTER_ID is reserved and is the highest
- * in the range of allows mark ids.
+ /*
+ * Map mark ID (32-bit) to filter ID (16-bit):
+ * - Reject values > 16 bits
+ * - Filter ID 0 is reserved for filters that steer
+ * but not mark. So add 1 to the mark ID to avoid
+ * using 0.
+ * - Filter ID (ENIC_MAGIC_FILTER_ID = 0xffff) is
+ * reserved for the "flag" action below.
*/
- if (mark->id >= ENIC_MAGIC_FILTER_ID)
+ if (mark->id >= ENIC_MAGIC_FILTER_ID - 1)
return EINVAL;
- enic_action->filter_id = mark->id;
+ enic_action->filter_id = mark->id + 1;
enic_action->flags |= FILTER_ACTION_FILTER_ID_FLAG;
break;
}
@@ -1094,6 +1100,7 @@ enic_copy_action_v2(const struct rte_flow_action actions[],
if (overlap & MARK)
return ENOTSUP;
overlap |= MARK;
+ /* ENIC_MAGIC_FILTER_ID is reserved for flagging */
enic_action->filter_id = ENIC_MAGIC_FILTER_ID;
enic_action->flags |= FILTER_ACTION_FILTER_ID_FLAG;
break;
diff --git a/drivers/net/enic/enic_rxtx_common.h b/drivers/net/enic/enic_rxtx_common.h
index bfbb4909e..66f631dfe 100644
--- a/drivers/net/enic/enic_rxtx_common.h
+++ b/drivers/net/enic/enic_rxtx_common.h
@@ -226,7 +226,8 @@ enic_cq_rx_to_pkt_flags(struct cq_desc *cqd, struct rte_mbuf *mbuf)
if (filter_id) {
pkt_flags |= PKT_RX_FDIR;
if (filter_id != ENIC_MAGIC_FILTER_ID) {
- mbuf->hash.fdir.hi = clsf_cqd->filter_id;
+ /* filter_id = mark id + 1, so subtract 1 */
+ mbuf->hash.fdir.hi = filter_id - 1;
pkt_flags |= PKT_RX_FDIR_ID;
}
}
--
2.16.2
next prev parent reply other threads:[~2019-02-28 7:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-28 7:03 [dpdk-dev] [PATCH 00/15] net/enic: 19.05 updates Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 01/15] net/enic: remove unused code Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 02/15] net/enic: fix flow director SCTP matching Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 03/15] net/enic: fix SCTP match for flow API Hyong Youb Kim
2019-02-28 7:03 ` Hyong Youb Kim [this message]
2019-02-28 7:03 ` [dpdk-dev] [PATCH 05/15] net/enic: check for unsupported flow item types Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 06/15] net/enic: enable limited RSS flow action Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 07/15] net/enic: enable limited PASSTHRU " Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 08/15] net/enic: move arguments into struct Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 09/15] net/enic: enable limited support for RAW flow item Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 10/15] net/enic: initialize VXLAN port regardless of overlay offload Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 11/15] net/enic: fix a couple issues with VXLAN match Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 12/15] net/enic: fix an endian bug in VLAN match Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 13/15] net/enic: fix several issues with inner packet matching Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 14/15] doc: update enic guide Hyong Youb Kim
2019-02-28 7:03 ` [dpdk-dev] [PATCH 15/15] doc: update release notes for enic Hyong Youb Kim
2019-03-01 14:26 ` [dpdk-dev] [PATCH 00/15] net/enic: 19.05 updates Thomas Monjalon
2019-03-01 14:56 ` Hyong Youb Kim
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=20190228070317.17002-5-hyonkim@cisco.com \
--to=hyonkim@cisco.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=johndale@cisco.com \
--cc=stable@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).