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 9/9] net/mlx5: add drop action to Direct Verbs E-Switch
Date: Sun, 14 Apr 2019 21:12:37 +0000 [thread overview]
Message-ID: <1555276357-4892-10-git-send-email-orika@mellanox.com> (raw)
Message-ID: <20190414211237.A3DWc05dTmZ8VDV-1Pm_6sWCheDZJFGRbQHWMJDCUAM@z> (raw)
In-Reply-To: <1555276357-4892-1-git-send-email-orika@mellanox.com>
This commit adds support for drop action when creating E-Switch flow
using DV.
Signed-off-by: Ori Kam <orika@mellanox.com>
---
drivers/net/mlx5/mlx5.c | 9 +++++++++
drivers/net/mlx5/mlx5.h | 1 +
drivers/net/mlx5/mlx5_flow_dv.c | 26 ++++++++++++++++----------
drivers/net/mlx5/mlx5_glue.c | 12 ++++++++++++
drivers/net/mlx5/mlx5_glue.h | 1 +
5 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 938ba1c..e3c6d24 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -357,6 +357,7 @@ struct mlx5_dev_spawn_data {
goto error;
}
sh->fdb_ns = ns;
+ sh->drop_action = mlx5_glue->dr_create_flow_action_drop();
}
#endif
sh->dv_refcnt++;
@@ -377,6 +378,10 @@ struct mlx5_dev_spawn_data {
mlx5_glue->dr_destroy_ns(sh->fdb_ns);
sh->fdb_ns = NULL;
}
+ if (sh->drop_action) {
+ mlx5_glue->destroy_flow_action(sh->drop_action);
+ sh->drop_action = NULL;
+ }
return err;
#else
(void)priv;
@@ -417,6 +422,10 @@ struct mlx5_dev_spawn_data {
mlx5_glue->dr_destroy_ns(sh->fdb_ns);
sh->fdb_ns = NULL;
}
+ if (sh->drop_action) {
+ mlx5_glue->destroy_flow_action(sh->drop_action);
+ sh->drop_action = NULL;
+ }
#endif
pthread_mutex_destroy(&sh->dv_mutex);
#else
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 016984d..fd85b9d 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -275,6 +275,7 @@ struct mlx5_ibv_shared {
/* RX Direct Rules tables. */
void *tx_ns; /* TX Direct Rules name space handle. */
struct mlx5_flow_tbl_resource tx_tbl[MLX5_MAX_TABLES];
+ void *drop_action; /* Pointer to drop action. */
/* TX Direct Rules tables/ */
LIST_HEAD(matchers, mlx5_flow_dv_matcher) matchers;
LIST_HEAD(encap_decap, mlx5_flow_dv_encap_decap_resource) encaps_decaps;
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index d4dc439..4a8e894 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4062,6 +4062,7 @@ struct field_modify_info modify_tcp[] = {
{
struct mlx5_flow_dv *dv;
struct mlx5_flow *dev_flow;
+ struct mlx5_priv *priv = dev->data->dev_private;
int n;
int err;
@@ -4069,17 +4070,22 @@ struct field_modify_info modify_tcp[] = {
dv = &dev_flow->dv;
n = dv->actions_n;
if (flow->actions & MLX5_FLOW_ACTION_DROP) {
- dv->hrxq = mlx5_hrxq_drop_new(dev);
- if (!dv->hrxq) {
- rte_flow_error_set
- (error, errno,
- RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
- "cannot get drop hash queue");
- goto error;
+ if (flow->transfer)
+ dv->actions[n++] = priv->sh->drop_action;
+ else {
+ dv->hrxq = mlx5_hrxq_drop_new(dev);
+ if (!dv->hrxq) {
+ rte_flow_error_set
+ (error, errno,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ "cannot get drop hash queue");
+ goto error;
+ }
+ dv->actions[n++] =
+ mlx5_glue->dv_create_flow_action_dest_ibv_qp
+ (dv->hrxq->qp);
}
- dv->actions[n++] =
- mlx5_glue->dv_create_flow_action_dest_ibv_qp
- (dv->hrxq->qp);
} else if (flow->actions &
(MLX5_FLOW_ACTION_QUEUE | MLX5_FLOW_ACTION_RSS)) {
struct mlx5_hrxq *hrxq;
diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
index 117190f..b32cd09c 100644
--- a/drivers/net/mlx5/mlx5_glue.c
+++ b/drivers/net/mlx5/mlx5_glue.c
@@ -394,6 +394,16 @@
}
static void *
+mlx5_glue_dr_create_flow_action_drop(void)
+{
+#ifdef HAVE_MLX5DV_DR_ESWITCH
+ return mlx5dv_dr_create_action_drop();
+#else
+ return NULL;
+#endif
+}
+
+static void *
mlx5_glue_dr_create_flow_tbl(void *ns, uint32_t level)
{
#ifdef HAVE_MLX5DV_DR
@@ -861,6 +871,8 @@
mlx5_glue_dr_create_flow_action_dest_flow_tbl,
.dr_create_flow_action_dest_vport =
mlx5_glue_dr_create_flow_action_dest_vport,
+ .dr_create_flow_action_drop =
+ mlx5_glue_dr_create_flow_action_drop,
.dr_create_flow_tbl = mlx5_glue_dr_create_flow_tbl,
.dr_destroy_flow_tbl = mlx5_glue_dr_destroy_flow_tbl,
.dr_create_ns = mlx5_glue_dr_create_ns,
diff --git a/drivers/net/mlx5/mlx5_glue.h b/drivers/net/mlx5/mlx5_glue.h
index 26f5cb3..1d06583 100644
--- a/drivers/net/mlx5/mlx5_glue.h
+++ b/drivers/net/mlx5/mlx5_glue.h
@@ -147,6 +147,7 @@ struct mlx5_glue {
struct ibv_cq *(*cq_ex_to_cq)(struct ibv_cq_ex *cq);
void *(*dr_create_flow_action_dest_flow_tbl)(void *tbl);
void *(*dr_create_flow_action_dest_vport)(void *ns, uint32_t vport);
+ void *(*dr_create_flow_action_drop)();
void *(*dr_create_flow_tbl)(void *ns, uint32_t level);
int (*dr_destroy_flow_tbl)(void *tbl);
void *(*dr_create_ns)(struct ibv_context *ctx,
--
1.8.3.1
next prev parent reply other threads:[~2019-04-14 21:14 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 ` Ori Kam [this message]
2019-04-14 21:12 ` [dpdk-dev] [PATCH 9/9] net/mlx5: add drop action to Direct Verbs E-Switch 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 ` [dpdk-dev] [PATCH v2 8/9] net/mlx5: add Forward Database table type Ori Kam
2019-04-18 11:28 ` 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=1555276357-4892-10-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).