From: Ori Kam <orika@mellanox.com>
To: yskoh@mellanox.com, shahafs@mellanox.com, matan@mellanox.com,
viacheslavo@mellanox.com, motih@mellanox.com
Cc: dev@dpdk.org, orika@mellanox.com
Subject: [dpdk-dev] [PATCH v2 8/9] net/mlx5: add Forward Database table type
Date: Thu, 18 Apr 2019 11:28:49 +0000 [thread overview]
Message-ID: <1555586930-109097-9-git-send-email-orika@mellanox.com> (raw)
Message-ID: <20190418112849.4FlfRNxhObaIGce2bKZZvrwYuUwFcPXax6qhohLIt6U@z> (raw)
In-Reply-To: <1555586930-109097-1-git-send-email-orika@mellanox.com>
Actions like encap/decap, modify header require setting the flow table
type. Until now we supported only Nic RX and Nic TX, this commits adds
the support for FDB table type for those actions.
Signed-off-by: Ori Kam <orika@mellanox.com>
---
v2:
* Address ML comments.
---
drivers/net/mlx5/mlx5_flow_dv.c | 56 +++++++++++++++++++++++++++++------------
1 file changed, 40 insertions(+), 16 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 9c5826c..5997182 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -40,6 +40,10 @@
#define MLX5DV_FLOW_ACTION_COUNTERS_DEVX 0
#endif
+#ifndef HAVE_MLX5DV_DR_ESWITCH
+#define MLX5DV_FLOW_TABLE_TYPE_FDB 0
+#endif
+
union flow_dv_attr {
struct {
uint32_t valid:1;
@@ -939,7 +943,9 @@ struct field_modify_info modify_tcp[] = {
struct mlx5dv_dr_ns *ns;
resource->flags = flow->group ? 0 : 1;
- if (flow->ingress)
+ if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB)
+ ns = sh->fdb_ns;
+ else if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_NIC_RX)
ns = sh->rx_ns;
else
ns = sh->tx_ns;
@@ -1360,6 +1366,8 @@ struct field_modify_info modify_tcp[] = {
* Pointer to action structure.
* @param[in, out] dev_flow
* Pointer to the mlx5_flow.
+ * @param[in] transfer
+ * Mark if the flow is E-Switch flow.
* @param[out] error
* Pointer to the error structure.
*
@@ -1370,6 +1378,7 @@ struct field_modify_info modify_tcp[] = {
flow_dv_create_action_l2_encap(struct rte_eth_dev *dev,
const struct rte_flow_action *action,
struct mlx5_flow *dev_flow,
+ uint8_t transfer,
struct rte_flow_error *error)
{
const struct rte_flow_item *encap_data;
@@ -1377,7 +1386,8 @@ struct field_modify_info modify_tcp[] = {
struct mlx5_flow_dv_encap_decap_resource res = {
.reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL,
- .ft_type = MLX5DV_FLOW_TABLE_TYPE_NIC_TX,
+ .ft_type = transfer ? MLX5DV_FLOW_TABLE_TYPE_FDB :
+ MLX5DV_FLOW_TABLE_TYPE_NIC_TX,
};
if (action->type == RTE_FLOW_ACTION_TYPE_RAW_ENCAP) {
@@ -1412,6 +1422,8 @@ struct field_modify_info modify_tcp[] = {
* Pointer to rte_eth_dev structure.
* @param[in, out] dev_flow
* Pointer to the mlx5_flow.
+ * @param[in] transfer
+ * Mark if the flow is E-Switch flow.
* @param[out] error
* Pointer to the error structure.
*
@@ -1421,13 +1433,15 @@ struct field_modify_info modify_tcp[] = {
static int
flow_dv_create_action_l2_decap(struct rte_eth_dev *dev,
struct mlx5_flow *dev_flow,
+ uint8_t transfer,
struct rte_flow_error *error)
{
struct mlx5_flow_dv_encap_decap_resource res = {
.size = 0,
.reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2,
- .ft_type = MLX5DV_FLOW_TABLE_TYPE_NIC_RX,
+ .ft_type = transfer ? MLX5DV_FLOW_TABLE_TYPE_FDB :
+ MLX5DV_FLOW_TABLE_TYPE_NIC_RX,
};
if (flow_dv_encap_decap_resource_register(dev, &res, dev_flow, error))
@@ -1470,8 +1484,11 @@ struct field_modify_info modify_tcp[] = {
res.reformat_type = attr->egress ?
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL :
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2;
- res.ft_type = attr->egress ? MLX5DV_FLOW_TABLE_TYPE_NIC_TX :
- MLX5DV_FLOW_TABLE_TYPE_NIC_RX;
+ if (attr->transfer)
+ res.ft_type = MLX5DV_FLOW_TABLE_TYPE_FDB;
+ else
+ res.ft_type = attr->egress ? MLX5DV_FLOW_TABLE_TYPE_NIC_TX :
+ MLX5DV_FLOW_TABLE_TYPE_NIC_RX;
if (flow_dv_encap_decap_resource_register(dev, &res, dev_flow, error))
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1806,11 +1823,14 @@ struct field_modify_info modify_tcp[] = {
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_ibv_shared *sh = priv->sh;
struct mlx5_flow_dv_modify_hdr_resource *cache_resource;
+ struct mlx5dv_dr_ns *ns;
- struct mlx5dv_dr_ns *ns =
- resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_NIC_TX ?
- sh->tx_ns : sh->rx_ns;
-
+ if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB)
+ ns = sh->fdb_ns;
+ else if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_NIC_TX)
+ ns = sh->tx_ns;
+ else
+ ns = sh->rx_ns;
/* Lookup a matching resource from cache. */
LIST_FOREACH(cache_resource, &sh->modify_cmds, next) {
if (resource->ft_type == cache_resource->ft_type &&
@@ -3604,6 +3624,8 @@ struct field_modify_info modify_tcp[] = {
union flow_dv_attr flow_attr = { .attr = 0 };
struct mlx5_flow_dv_tag_resource tag_resource;
+ if (attr->transfer)
+ res.ft_type = MLX5DV_FLOW_TABLE_TYPE_FDB;
if (priority == MLX5_FLOW_PRIO_RSVD)
priority = priv->config.flow_prio - 1;
for (; !actions_end ; actions++) {
@@ -3709,7 +3731,9 @@ struct field_modify_info modify_tcp[] = {
case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
if (flow_dv_create_action_l2_encap(dev, actions,
- dev_flow, error))
+ dev_flow,
+ attr->transfer,
+ error))
return -rte_errno;
dev_flow->dv.actions[actions_n++] =
dev_flow->dv.encap_decap->verbs_action;
@@ -3721,6 +3745,7 @@ struct field_modify_info modify_tcp[] = {
case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
if (flow_dv_create_action_l2_decap(dev, dev_flow,
+ attr->transfer,
error))
return -rte_errno;
dev_flow->dv.actions[actions_n++] =
@@ -3740,9 +3765,9 @@ struct field_modify_info modify_tcp[] = {
dev_flow->dv.encap_decap->verbs_action;
} else {
/* Handle encap without preceding decap. */
- if (flow_dv_create_action_l2_encap(dev, actions,
- dev_flow,
- error))
+ if (flow_dv_create_action_l2_encap
+ (dev, actions, dev_flow, attr->transfer,
+ error))
return -rte_errno;
dev_flow->dv.actions[actions_n++] =
dev_flow->dv.encap_decap->verbs_action;
@@ -3757,9 +3782,8 @@ struct field_modify_info modify_tcp[] = {
}
/* Handle decap only if it isn't followed by encap. */
if (action->type != RTE_FLOW_ACTION_TYPE_RAW_ENCAP) {
- if (flow_dv_create_action_l2_decap(dev,
- dev_flow,
- error))
+ if (flow_dv_create_action_l2_decap
+ (dev, dev_flow, attr->transfer, error))
return -rte_errno;
dev_flow->dv.actions[actions_n++] =
dev_flow->dv.encap_decap->verbs_action;
--
1.8.3.1
next prev parent reply other threads:[~2019-04-18 11:30 UTC|newest]
Thread overview: 124+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-14 21:12 [dpdk-dev] [PATCH 0/9] net/mlx5: add Direct Verbs E-Switch support Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 1/9] net/mlx5: fix translate vport function name Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-16 23:47 ` Yongseok Koh
2019-04-16 23:47 ` Yongseok Koh
2019-04-14 21:12 ` [dpdk-dev] [PATCH 2/9] net/mlx5: fix menson compilation with Direct Rules Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-17 0:01 ` Yongseok Koh
2019-04-17 0:01 ` Yongseok Koh
2019-04-17 0:34 ` Yongseok Koh
2019-04-17 0:34 ` Yongseok Koh
2019-04-17 5:18 ` Ori Kam
2019-04-17 5:18 ` Ori Kam
2019-04-17 5:18 ` Ori Kam
2019-04-17 5:18 ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 3/9] net/mlx5: add Direct Rules configuration support Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-17 1:42 ` Yongseok Koh
2019-04-17 1:42 ` Yongseok Koh
2019-04-17 6:19 ` Ori Kam
2019-04-17 6:19 ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 4/9] net/mlx5: add validation for Direct Rule E-Switch Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-17 23:59 ` Yongseok Koh
2019-04-17 23:59 ` Yongseok Koh
2019-04-18 4:40 ` Ori Kam
2019-04-18 4:40 ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 5/9] net/mlx5: add port ID item to Direct Verbs Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-18 0:19 ` Yongseok Koh
2019-04-18 0:19 ` Yongseok Koh
2019-04-18 4:43 ` Ori Kam
2019-04-18 4:43 ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 6/9] net/mlx5: add transfer attribute to matcher Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-18 0:38 ` Yongseok Koh
2019-04-18 0:38 ` Yongseok Koh
2019-04-18 4:57 ` Ori Kam
2019-04-18 4:57 ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 7/9] net/mlx5: add port ID action to Direct Verbs Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-18 0:59 ` Yongseok Koh
2019-04-18 0:59 ` Yongseok Koh
2019-04-18 5:06 ` Ori Kam
2019-04-18 5:06 ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 8/9] net/mlx5: add Forward Database table type Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-18 1:16 ` Yongseok Koh
2019-04-18 1:16 ` Yongseok Koh
2019-04-18 5:13 ` Ori Kam
2019-04-18 5:13 ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 9/9] net/mlx5: add drop action to Direct Verbs E-Switch Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-18 1:28 ` Yongseok Koh
2019-04-18 1:28 ` Yongseok Koh
2019-04-18 5:15 ` Ori Kam
2019-04-18 5:15 ` Ori Kam
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 0/9] net/mlx5: add Direct Verbs E-Switch support Ori Kam
2019-04-18 11:28 ` Ori Kam
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 1/9] net/mlx5: fix translate vport function name Ori Kam
2019-04-18 11:28 ` Ori Kam
2019-04-18 12:06 ` Yongseok Koh
2019-04-18 12:06 ` Yongseok Koh
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 2/9] net/mlx5: fix meson build for Direct Rules Ori Kam
2019-04-18 11:28 ` Ori Kam
2019-04-18 12:09 ` Yongseok Koh
2019-04-18 12:09 ` Yongseok Koh
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 3/9] net/mlx5: add Direct Rules E-Switch support Ori Kam
2019-04-18 11:28 ` Ori Kam
2019-04-18 12:11 ` Yongseok Koh
2019-04-18 12:11 ` Yongseok Koh
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 4/9] net/mlx5: add validation for Direct Rule E-Switch Ori Kam
2019-04-18 11:28 ` Ori Kam
2019-04-18 12:16 ` Yongseok Koh
2019-04-18 12:16 ` Yongseok Koh
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 5/9] net/mlx5: add port ID item to Direct Verbs Ori Kam
2019-04-18 11:28 ` Ori Kam
2019-04-18 12:17 ` Yongseok Koh
2019-04-18 12:17 ` Yongseok Koh
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 6/9] net/mlx5: add transfer attribute to matcher Ori Kam
2019-04-18 11:28 ` Ori Kam
2019-04-18 12:19 ` Yongseok Koh
2019-04-18 12:19 ` Yongseok Koh
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 7/9] net/mlx5: add E-Switch port ID action to Direct Verbs Ori Kam
2019-04-18 11:28 ` Ori Kam
2019-04-18 12:19 ` Yongseok Koh
2019-04-18 12:19 ` Yongseok Koh
2019-04-18 11:28 ` Ori Kam [this message]
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 8/9] net/mlx5: add Forward Database table type Ori Kam
2019-04-18 12:21 ` Yongseok Koh
2019-04-18 12:21 ` Yongseok Koh
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 9/9] net/mlx5: add drop action to Direct Verbs E-Switch Ori Kam
2019-04-18 11:28 ` Ori Kam
2019-04-18 12:28 ` Yongseok Koh
2019-04-18 12:28 ` Yongseok Koh
2019-04-18 13:15 ` [dpdk-dev] [PATCH v3 0/9] net/mlx5: add Direct Verbs E-Switch support Ori Kam
2019-04-18 13:15 ` Ori Kam
2019-04-18 13:15 ` [dpdk-dev] [PATCH v3 1/9] net/mlx5: fix translate vport function name Ori Kam
2019-04-18 13:15 ` Ori Kam
2019-04-18 13:16 ` [dpdk-dev] [PATCH v3 2/9] net/mlx5: fix meson build for Direct Rules Ori Kam
2019-04-18 13:16 ` Ori Kam
2019-04-18 13:16 ` [dpdk-dev] [PATCH v3 3/9] net/mlx5: add Direct Rules E-Switch support Ori Kam
2019-04-18 13:16 ` Ori Kam
2019-04-18 13:16 ` [dpdk-dev] [PATCH v3 4/9] net/mlx5: add validation for Direct Rule E-Switch Ori Kam
2019-04-18 13:16 ` Ori Kam
2019-04-18 13:16 ` [dpdk-dev] [PATCH v3 5/9] net/mlx5: add port ID item to Direct Verbs Ori Kam
2019-04-18 13:16 ` Ori Kam
2019-04-18 13:16 ` [dpdk-dev] [PATCH v3 6/9] net/mlx5: add transfer attribute to matcher Ori Kam
2019-04-18 13:16 ` Ori Kam
2019-04-18 13:16 ` [dpdk-dev] [PATCH v3 7/9] net/mlx5: add E-Switch port ID action to Direct Verbs Ori Kam
2019-04-18 13:16 ` Ori Kam
2019-04-18 13:16 ` [dpdk-dev] [PATCH v3 8/9] net/mlx5: add Forward Database table type Ori Kam
2019-04-18 13:16 ` Ori Kam
2019-04-18 13:16 ` [dpdk-dev] [PATCH v3 9/9] net/mlx5: add drop action to Direct Verbs E-Switch Ori Kam
2019-04-18 13:16 ` Ori Kam
2019-04-18 13:23 ` Yongseok Koh
2019-04-18 13:23 ` Yongseok Koh
2019-04-18 13:47 ` Ori Kam
2019-04-18 13:47 ` Ori Kam
2019-04-18 18:14 ` Shahaf Shuler
2019-04-18 18:14 ` Shahaf Shuler
2019-04-18 18:55 ` [dpdk-dev] [PATCH v3 0/9] net/mlx5: add Direct Verbs E-Switch support Shahaf Shuler
2019-04-18 18:55 ` Shahaf Shuler
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=1555586930-109097-9-git-send-email-orika@mellanox.com \
--to=orika@mellanox.com \
--cc=dev@dpdk.org \
--cc=matan@mellanox.com \
--cc=motih@mellanox.com \
--cc=shahafs@mellanox.com \
--cc=viacheslavo@mellanox.com \
--cc=yskoh@mellanox.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).