From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Shahaf Shuler <shahafs@mellanox.com>,
Yongseok Koh <yskoh@mellanox.com>,
Slava Ovsiienko <viacheslavo@mellanox.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 6/8] net/mlx5: add convenience macros to switch flow rule engine
Date: Fri, 31 Aug 2018 11:57:38 +0200 [thread overview]
Message-ID: <20180831092038.23051-7-adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <20180831092038.23051-1-adrien.mazarguil@6wind.com>
Upcoming patches will rely on them.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx5/mlx5_nl_flow.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_nl_flow.c b/drivers/net/mlx5/mlx5_nl_flow.c
index d20416026..91ff90a13 100644
--- a/drivers/net/mlx5/mlx5_nl_flow.c
+++ b/drivers/net/mlx5/mlx5_nl_flow.c
@@ -236,6 +236,13 @@ static const union {
struct rte_flow_item_udp udp;
} mlx5_nl_flow_mask_empty;
+#define ETHER_ADDR_MASK "\xff\xff\xff\xff\xff\xff"
+#define IN_ADDR_MASK RTE_BE32(0xffffffff)
+#define IN6_ADDR_MASK \
+ "\xff\xff\xff\xff\xff\xff\xff\xff" \
+ "\xff\xff\xff\xff\xff\xff\xff\xff"
+#define BE16_MASK RTE_BE16(0xffff)
+
/** Supported masks for known item types. */
static const struct {
struct rte_flow_item_port_id port_id;
@@ -251,8 +258,8 @@ static const struct {
},
.eth = {
.type = RTE_BE16(0xffff),
- .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
- .src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
+ .dst.addr_bytes = ETHER_ADDR_MASK,
+ .src.addr_bytes = ETHER_ADDR_MASK,
},
.vlan = {
/* PCP and VID only, no DEI. */
@@ -261,25 +268,21 @@ static const struct {
},
.ipv4.hdr = {
.next_proto_id = 0xff,
- .src_addr = RTE_BE32(0xffffffff),
- .dst_addr = RTE_BE32(0xffffffff),
+ .src_addr = IN_ADDR_MASK,
+ .dst_addr = IN_ADDR_MASK,
},
.ipv6.hdr = {
.proto = 0xff,
- .src_addr =
- "\xff\xff\xff\xff\xff\xff\xff\xff"
- "\xff\xff\xff\xff\xff\xff\xff\xff",
- .dst_addr =
- "\xff\xff\xff\xff\xff\xff\xff\xff"
- "\xff\xff\xff\xff\xff\xff\xff\xff",
+ .src_addr = IN6_ADDR_MASK,
+ .dst_addr = IN6_ADDR_MASK,
},
.tcp.hdr = {
- .src_port = RTE_BE16(0xffff),
- .dst_port = RTE_BE16(0xffff),
+ .src_port = BE16_MASK,
+ .dst_port = BE16_MASK,
},
.udp.hdr = {
- .src_port = RTE_BE16(0xffff),
- .dst_port = RTE_BE16(0xffff),
+ .src_port = BE16_MASK,
+ .dst_port = BE16_MASK,
},
};
--
2.11.0
next prev parent reply other threads:[~2018-08-31 9:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-31 9:57 [dpdk-dev] [PATCH 0/8] net/mlx5: add switch offload for VXLAN encap/decap Adrien Mazarguil
2018-08-31 9:57 ` [dpdk-dev] [PATCH 1/8] net/mlx5: speed up interface index retrieval for flow rules Adrien Mazarguil
2018-08-31 9:57 ` [dpdk-dev] [PATCH 2/8] net/mlx5: clean up redundant interface name getters Adrien Mazarguil
2018-08-31 9:57 ` [dpdk-dev] [PATCH 3/8] net/mlx5: rename internal function Adrien Mazarguil
2018-08-31 9:57 ` [dpdk-dev] [PATCH 4/8] net/mlx5: enhance TC flow rule send/ack function Adrien Mazarguil
2018-08-31 9:57 ` [dpdk-dev] [PATCH 5/8] net/mlx5: prepare switch flow rule parser for encap offloads Adrien Mazarguil
2018-08-31 9:57 ` Adrien Mazarguil [this message]
2018-08-31 9:57 ` [dpdk-dev] [PATCH 7/8] net/mlx5: add VXLAN encap support to switch flow rules Adrien Mazarguil
2018-08-31 9:57 ` [dpdk-dev] [PATCH 8/8] net/mlx5: add VXLAN decap " Adrien Mazarguil
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=20180831092038.23051-7-adrien.mazarguil@6wind.com \
--to=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--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).