From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Cc: Yaacov Hazan <yaacovh@mellanox.com>,
Adrien Mazarguil <adrien.mazarguil@6wind.com>
Subject: [dpdk-dev] [PATCH 5/8] net/mlx5: fix support for flow director drop mode
Date: Wed, 7 Sep 2016 09:02:23 +0200 [thread overview]
Message-ID: <04cead97e44f1e762ed208a0a4034bba45e688af.1473230641.git.nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <cover.1473230641.git.nelio.laranjeiro@6wind.com>
From: Yaacov Hazan <yaacovh@mellanox.com>
Packet rejection was routed to a polled queue. This patch route them to a
dummy queue which is not polled.
Fixes: 76f5c99e6840 ("mlx5: support flow director")
Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
doc/guides/nics/mlx5.rst | 3 ++-
drivers/net/mlx5/mlx5.h | 1 +
drivers/net/mlx5/mlx5_fdir.c | 41 +++++++++++++++++++++++++++++++++++++++--
3 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 5c10cd3..8923173 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -84,7 +84,8 @@ Features
- Promiscuous mode.
- Multicast promiscuous mode.
- Hardware checksum offloads.
-- Flow director (RTE_FDIR_MODE_PERFECT and RTE_FDIR_MODE_PERFECT_MAC_VLAN).
+- Flow director (RTE_FDIR_MODE_PERFECT, RTE_FDIR_MODE_PERFECT_MAC_VLAN and
+ RTE_ETH_FDIR_REJECT).
- Secondary process TX is supported.
- KVM and VMware ESX SR-IOV modes are supported.
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index fa78623..8349e5b 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -134,6 +134,7 @@ struct priv {
unsigned int (*reta_idx)[]; /* RETA index table. */
unsigned int reta_idx_n; /* RETA index size. */
struct fdir_filter_list *fdir_filter_list; /* Flow director rules. */
+ struct fdir_queue *fdir_drop_queue; /* Flow director drop queue. */
rte_spinlock_t lock; /* Lock for control functions. */
};
diff --git a/drivers/net/mlx5/mlx5_fdir.c b/drivers/net/mlx5/mlx5_fdir.c
index 802669b..25c8c52 100644
--- a/drivers/net/mlx5/mlx5_fdir.c
+++ b/drivers/net/mlx5/mlx5_fdir.c
@@ -75,6 +75,7 @@ struct fdir_flow_desc {
struct mlx5_fdir_filter {
LIST_ENTRY(mlx5_fdir_filter) next;
uint16_t queue; /* Queue assigned to if FDIR match. */
+ enum rte_eth_fdir_behavior behavior;
struct fdir_flow_desc desc;
struct ibv_exp_flow *flow;
};
@@ -567,6 +568,33 @@ priv_get_fdir_queue(struct priv *priv, uint16_t idx)
}
/**
+ * Get or flow director drop queue. Create it if it does not exist.
+ *
+ * @param priv
+ * Private structure.
+ *
+ * @return
+ * Flow director drop queue on success, NULL otherwise.
+ */
+static struct fdir_queue *
+priv_get_fdir_drop_queue(struct priv *priv)
+{
+ struct fdir_queue *fdir_queue = priv->fdir_drop_queue;
+
+ if (fdir_queue == NULL) {
+ unsigned int socket = SOCKET_ID_ANY;
+
+ /* Select a known NUMA socket if possible. */
+ if (priv->rxqs_n && (*priv->rxqs)[0])
+ socket = container_of((*priv->rxqs)[0],
+ struct rxq_ctrl, rxq)->socket;
+ fdir_queue = priv_fdir_queue_create(priv, NULL, socket);
+ priv->fdir_drop_queue = fdir_queue;
+ }
+ return fdir_queue;
+}
+
+/**
* Enable flow director filter and create steering rules.
*
* @param priv
@@ -588,7 +616,11 @@ priv_fdir_filter_enable(struct priv *priv,
return 0;
/* Get fdir_queue for specific queue. */
- fdir_queue = priv_get_fdir_queue(priv, mlx5_fdir_filter->queue);
+ if (mlx5_fdir_filter->behavior == RTE_ETH_FDIR_REJECT)
+ fdir_queue = priv_get_fdir_drop_queue(priv);
+ else
+ fdir_queue = priv_get_fdir_queue(priv,
+ mlx5_fdir_filter->queue);
if (fdir_queue == NULL) {
ERROR("failed to create flow director rxq for queue %d",
@@ -707,6 +739,10 @@ priv_fdir_disable(struct priv *priv)
priv_fdir_queue_destroy(priv, rxq_ctrl->fdir_queue);
rxq_ctrl->fdir_queue = NULL;
}
+ if (priv->fdir_drop_queue) {
+ priv_fdir_queue_destroy(priv, priv->fdir_drop_queue);
+ priv->fdir_drop_queue = NULL;
+ }
}
/**
@@ -807,8 +843,9 @@ priv_fdir_filter_add(struct priv *priv,
return err;
}
- /* Set queue. */
+ /* Set action parameters. */
mlx5_fdir_filter->queue = fdir_filter->action.rx_queue;
+ mlx5_fdir_filter->behavior = fdir_filter->action.behavior;
/* Convert to mlx5 filter descriptor. */
fdir_filter_to_flow_desc(fdir_filter,
--
2.1.4
next prev parent reply other threads:[~2016-09-07 7:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 7:02 [dpdk-dev] [PATCH 0/8] net/mlx5: various fixes Nelio Laranjeiro
2016-09-07 7:02 ` [dpdk-dev] [PATCH 1/8] net/mlx5: fix inconsistent return value in Flow Director Nelio Laranjeiro
2016-09-07 7:02 ` [dpdk-dev] [PATCH 2/8] net/mlx5: fix Rx VLAN offload capability report Nelio Laranjeiro
2016-09-07 7:02 ` [dpdk-dev] [PATCH 3/8] net/mlx5: fix removing VLAN filter Nelio Laranjeiro
2016-09-07 7:02 ` [dpdk-dev] [PATCH 4/8] net/mlx5: refactor allocation of flow director queues Nelio Laranjeiro
2016-09-07 7:02 ` Nelio Laranjeiro [this message]
2016-09-07 7:02 ` [dpdk-dev] [PATCH 6/8] net/mlx5: force inline for completion function Nelio Laranjeiro
2016-09-07 7:02 ` [dpdk-dev] [PATCH 7/8] net/mlx5: re-factorize functions Nelio Laranjeiro
2016-09-07 7:02 ` [dpdk-dev] [PATCH 8/8] net/mlx5: fix inline logic Nelio Laranjeiro
2016-09-14 10:43 ` Ferruh Yigit
2016-09-14 11:07 ` Nélio Laranjeiro
2016-09-14 11:53 ` [dpdk-dev] [PATCH V2 0/8] net/mlx5: various fixes Nelio Laranjeiro
2016-09-14 12:21 ` Nélio Laranjeiro
2016-09-19 15:30 ` Bruce Richardson
2016-09-14 11:53 ` [dpdk-dev] [PATCH V2 1/8] net/mlx5: fix inconsistent return value in Flow Director Nelio Laranjeiro
2016-09-14 11:53 ` [dpdk-dev] [PATCH V2 2/8] net/mlx5: fix Rx VLAN offload capability report Nelio Laranjeiro
2016-09-14 11:53 ` [dpdk-dev] [PATCH V2 3/8] net/mlx5: fix removing VLAN filter Nelio Laranjeiro
2016-09-14 11:53 ` [dpdk-dev] [PATCH V2 4/8] net/mlx5: refactor allocation of flow director queues Nelio Laranjeiro
2016-09-14 11:53 ` [dpdk-dev] [PATCH V2 5/8] net/mlx5: fix support for flow director drop mode Nelio Laranjeiro
2016-09-14 11:53 ` [dpdk-dev] [PATCH V2 6/8] net/mlx5: force inline for completion function Nelio Laranjeiro
2016-09-14 11:53 ` [dpdk-dev] [PATCH V2 7/8] net/mlx5: re-factorize functions Nelio Laranjeiro
2016-09-14 11:53 ` [dpdk-dev] [PATCH V2 8/8] net/mlx5: fix inline logic 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=04cead97e44f1e762ed208a0a4034bba45e688af.1473230641.git.nelio.laranjeiro@6wind.com \
--to=nelio.laranjeiro@6wind.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=yaacovh@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).