From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Subject: [dpdk-dev] [PATCH v2 6/9] net/mlx5: support flag flow action
Date: Wed, 1 Mar 2017 13:49:45 +0100 [thread overview]
Message-ID: <8995ab6d0107cfc12355a4557aa9a47d363f36cb.1488372438.git.nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <cover.1488372438.git.nelio.laranjeiro@6wind.com>
In-Reply-To: <cover.1488372438.git.nelio.laranjeiro@6wind.com>
This action is not terminal in this PMD, it must be followed by a queue
action.
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
drivers/net/mlx5/mlx5_flow.c | 5 +++++
drivers/net/mlx5/mlx5_prm.h | 7 ++++---
drivers/net/mlx5/mlx5_rxtx.c | 19 +++++++++++--------
3 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index a885f6e..39a96ea 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -146,6 +146,7 @@ static const enum rte_flow_action_type valid_actions[] = {
RTE_FLOW_ACTION_TYPE_DROP,
RTE_FLOW_ACTION_TYPE_QUEUE,
RTE_FLOW_ACTION_TYPE_MARK,
+ RTE_FLOW_ACTION_TYPE_FLAG,
RTE_FLOW_ACTION_TYPE_END,
};
@@ -476,6 +477,8 @@ priv_flow_validate(struct priv *priv,
return -rte_errno;
}
action.mark = 1;
+ } else if (actions->type == RTE_FLOW_ACTION_TYPE_FLAG) {
+ action.mark = 1;
} else {
goto exit_action_not_supported;
}
@@ -1061,6 +1064,8 @@ priv_flow_create(struct priv *priv,
if (mark)
action.mark_id = mark->id;
action.mark = !action.drop;
+ } else if (actions->type == RTE_FLOW_ACTION_TYPE_FLAG) {
+ action.mark = 1;
} else {
rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION,
diff --git a/drivers/net/mlx5/mlx5_prm.h b/drivers/net/mlx5/mlx5_prm.h
index 33fc386..0a77f5b 100644
--- a/drivers/net/mlx5/mlx5_prm.h
+++ b/drivers/net/mlx5/mlx5_prm.h
@@ -233,9 +233,11 @@ mlx5_flow_mark_set(uint32_t val)
/*
* Add one to the user value to differentiate un-marked flows from
- * marked flows.
+ * marked flows, if the ID is equal to MLX5_FLOW_MARK_DEFAULT it
+ * remains untouched.
*/
- ++val;
+ if (val != MLX5_FLOW_MARK_DEFAULT)
+ ++val;
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
/*
* Mark is 24 bits (minus reserved values) but is stored on a 32 bit
@@ -247,7 +249,6 @@ mlx5_flow_mark_set(uint32_t val)
#else
ret = val;
#endif
- assert(ret <= MLX5_FLOW_MARK_MAX);
return ret;
}
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 122847d..58dd7c8 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1538,14 +1538,17 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
pkt->hash.rss = rss_hash_res;
pkt->ol_flags = PKT_RX_RSS_HASH;
}
- if (rxq->mark &&
- ((cqe->sop_drop_qpn !=
- htonl(MLX5_FLOW_MARK_INVALID)) &&
- (cqe->sop_drop_qpn !=
- htonl(MLX5_FLOW_MARK_DEFAULT)))) {
- pkt->hash.fdir.hi =
- mlx5_flow_mark_get(cqe->sop_drop_qpn);
- pkt->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
+ if (rxq->mark && (cqe->sop_drop_qpn !=
+ htonl(MLX5_FLOW_MARK_INVALID))) {
+ pkt->ol_flags |= PKT_RX_FDIR;
+ if (cqe->sop_drop_qpn !=
+ htonl(MLX5_FLOW_MARK_DEFAULT)) {
+ uint32_t mark = cqe->sop_drop_qpn;
+
+ pkt->ol_flags |= PKT_RX_FDIR_ID;
+ pkt->hash.fdir.hi =
+ mlx5_flow_mark_get(mark);
+ }
}
if (rxq->csum | rxq->csum_l2tun | rxq->vlan_strip |
rxq->crc_present) {
--
2.1.4
next prev parent reply other threads:[~2017-03-01 12:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1488364873.git.nelio.laranjeiro@6wind.com>
2017-03-01 12:49 ` [dpdk-dev] [PATCH v2 0/9] net/mlx5: enhance flow API Nelio Laranjeiro
2017-03-03 23:36 ` Ferruh Yigit
2017-03-04 12:42 ` Ferruh Yigit
2017-03-01 12:49 ` [dpdk-dev] [PATCH v2 1/9] net/mlx5: fix drop queue creation error Nelio Laranjeiro
2017-03-01 12:49 ` [dpdk-dev] [PATCH v2 2/9] net/mlx5: fix resources free in the right function Nelio Laranjeiro
2017-03-01 12:49 ` [dpdk-dev] [PATCH v2 3/9] net/mlx5: support ether type support in flow item Nelio Laranjeiro
2017-03-01 12:49 ` [dpdk-dev] [PATCH v2 4/9] net/mlx5: add RSS hash result with mark id Nelio Laranjeiro
2017-03-01 12:49 ` [dpdk-dev] [PATCH v2 5/9] net/mlx5: extend IPv6 flow item Nelio Laranjeiro
2017-03-01 12:49 ` Nelio Laranjeiro [this message]
2017-03-01 12:49 ` [dpdk-dev] [PATCH v2 7/9] net/mlx5: prepare support for RSS action rule Nelio Laranjeiro
2017-03-01 12:49 ` [dpdk-dev] [PATCH v2 8/9] net/mlx5: support RSS action flow rule Nelio Laranjeiro
2017-03-01 12:49 ` [dpdk-dev] [PATCH v2 9/9] net/mlx5: use an RSS drop queue Nelio Laranjeiro
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=8995ab6d0107cfc12355a4557aa9a47d363f36cb.1488372438.git.nelio.laranjeiro@6wind.com \
--to=nelio.laranjeiro@6wind.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@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).