From: Moti Haimovsky <motih@mellanox.com>
To: shahafs@mellanox.com
Cc: dev@dpdk.org, Moti Haimovsky <motih@mellanox.com>
Subject: [dpdk-dev] [PATCH v5 2/4] net/mlx5: tc flow to use the new infrastructure
Date: Thu, 18 Oct 2018 21:29:21 +0300 [thread overview]
Message-ID: <1539887363-27858-3-git-send-email-motih@mellanox.com> (raw)
In-Reply-To: <1539797092-2395-4-git-send-email-motih@mellanox.com>
modified TC-flow code to use the new infrastructure
introduced in "net/mlx5: refactor TC-flow infrastructure"
commit.
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
v5:
* Initial version of this patch.
---
drivers/net/mlx5/mlx5_flow_tcf.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c
index 5ce2d5f..b890aa2 100644
--- a/drivers/net/mlx5/mlx5_flow_tcf.c
+++ b/drivers/net/mlx5/mlx5_flow_tcf.c
@@ -2116,8 +2116,8 @@ struct pedit_parser {
/**
* Send Netlink message with acknowledgment.
*
- * @param nl
- * Libmnl socket to use.
+ * @param ctx
+ * Flow context to use.
* @param nlh
* Message to send. This function always raises the NLM_F_ACK flag before
* sending.
@@ -2126,12 +2126,13 @@ struct pedit_parser {
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int
-flow_tcf_nl_ack(struct mnl_socket *nl, struct nlmsghdr *nlh)
+flow_tcf_nl_ack(struct mlx5_flow_tcf_context *ctx, struct nlmsghdr *nlh)
{
alignas(struct nlmsghdr)
uint8_t ans[mnl_nlmsg_size(sizeof(struct nlmsgerr)) +
nlh->nlmsg_len - sizeof(*nlh)];
- uint32_t seq = random();
+ uint32_t seq = ctx->seq++;
+ struct mnl_socket *nl = ctx->nl;
int ret;
nlh->nlmsg_flags |= NLM_F_ACK;
@@ -2166,7 +2167,7 @@ struct pedit_parser {
struct rte_flow_error *error)
{
struct priv *priv = dev->data->dev_private;
- struct mnl_socket *nl = priv->tcf_context->nl;
+ struct mlx5_flow_tcf_context *ctx = priv->tcf_context;
struct mlx5_flow *dev_flow;
struct nlmsghdr *nlh;
@@ -2176,7 +2177,7 @@ struct pedit_parser {
nlh = dev_flow->tcf.nlh;
nlh->nlmsg_type = RTM_NEWTFILTER;
nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL;
- if (!flow_tcf_nl_ack(nl, nlh))
+ if (!flow_tcf_nl_ack(ctx, nlh))
return 0;
return rte_flow_error_set(error, rte_errno,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
@@ -2195,7 +2196,7 @@ struct pedit_parser {
flow_tcf_remove(struct rte_eth_dev *dev, struct rte_flow *flow)
{
struct priv *priv = dev->data->dev_private;
- struct mnl_socket *nl = priv->tcf_context->nl;
+ struct mlx5_flow_tcf_context *ctx = priv->tcf_context;
struct mlx5_flow *dev_flow;
struct nlmsghdr *nlh;
@@ -2209,7 +2210,7 @@ struct pedit_parser {
nlh = dev_flow->tcf.nlh;
nlh->nlmsg_type = RTM_DELTFILTER;
nlh->nlmsg_flags = NLM_F_REQUEST;
- flow_tcf_nl_ack(nl, nlh);
+ flow_tcf_nl_ack(ctx, nlh);
}
/**
@@ -2302,7 +2303,6 @@ struct pedit_parser {
{
struct nlmsghdr *nlh;
struct tcmsg *tcm;
- struct mnl_socket *nl = ctx->nl;
alignas(struct nlmsghdr)
uint8_t buf[mnl_nlmsg_size(sizeof(*tcm) + 128)];
@@ -2316,7 +2316,7 @@ struct pedit_parser {
tcm->tcm_handle = TC_H_MAKE(TC_H_INGRESS, 0);
tcm->tcm_parent = TC_H_INGRESS;
/* Ignore errors when qdisc is already absent. */
- if (flow_tcf_nl_ack(nl, nlh) &&
+ if (flow_tcf_nl_ack(ctx, nlh) &&
rte_errno != EINVAL && rte_errno != ENOENT)
return rte_flow_error_set(error, rte_errno,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
@@ -2332,7 +2332,7 @@ struct pedit_parser {
tcm->tcm_handle = TC_H_MAKE(TC_H_INGRESS, 0);
tcm->tcm_parent = TC_H_INGRESS;
mnl_attr_put_strz_check(nlh, sizeof(buf), TCA_KIND, "ingress");
- if (flow_tcf_nl_ack(nl, nlh))
+ if (flow_tcf_nl_ack(ctx, nlh))
return rte_flow_error_set(error, rte_errno,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"netlink: failed to create ingress"
@@ -2373,7 +2373,7 @@ struct mlx5_flow_tcf_context *
/**
* Destroy a libmnl context.
*
- * @param nl
+ * @param ctx
* Libmnl socket of the @p NETLINK_ROUTE kind.
*/
void
--
1.8.3.1
next prev parent reply other threads:[~2018-10-18 18:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 13:04 [dpdk-dev] [PATCH v2 0/2] support e-switch flow count action Mordechay Haimovsky
2018-10-11 13:04 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: refactor TC-flow infrastructure Mordechay Haimovsky
2018-10-14 11:07 ` Shahaf Shuler
2018-10-11 13:04 ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: support e-switch flow count action Mordechay Haimovsky
2018-10-14 11:07 ` Shahaf Shuler
2018-10-16 23:50 ` [dpdk-dev] [PATCH v3 0/2] " Mordechay Haimovsky
2018-10-16 23:50 ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: refactor TC-flow infrastructure Mordechay Haimovsky
2018-10-16 23:50 ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: support e-switch flow count action Mordechay Haimovsky
2018-10-17 17:24 ` [dpdk-dev] [PATCH v4 0/3] " Moti Haimovsky
2018-10-17 17:24 ` [dpdk-dev] [PATCH v4 1/3] net/mlx5: refactor TC-flow infrastructure Moti Haimovsky
2018-10-17 17:24 ` [dpdk-dev] [PATCH v4 2/3] net/mlx5: add flow query abstraction interface Moti Haimovsky
2018-10-17 17:24 ` [dpdk-dev] [PATCH v4 3/3] net/mlx5: support e-switch flow count action Moti Haimovsky
2018-10-18 18:29 ` [dpdk-dev] [PATCH v5 0/4] " Moti Haimovsky
2018-10-21 8:23 ` Shahaf Shuler
2018-10-18 18:29 ` [dpdk-dev] [PATCH v5 1/4] net/mlx5: refactor TC-flow infrastructure Moti Haimovsky
2018-10-18 18:29 ` Moti Haimovsky [this message]
2018-10-18 18:29 ` [dpdk-dev] [PATCH v5 3/4] net/mlx5: add flow query abstraction interface Moti Haimovsky
2018-10-18 18:29 ` [dpdk-dev] [PATCH v5 4/4] net/mlx5: support e-switch flow count action Moti Haimovsky
2018-10-22 9:14 ` Ferruh Yigit
2018-10-22 20:10 ` Shahaf Shuler
2018-10-23 8:40 ` Ferruh Yigit
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=1539887363-27858-3-git-send-email-motih@mellanox.com \
--to=motih@mellanox.com \
--cc=dev@dpdk.org \
--cc=shahafs@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).