diff mbox

[ovs-dev,V10,14/33] match: Add helper function to set tunnel tp_dst

Message ID 1496922410-36853-15-git-send-email-roid@mellanox.com
State Superseded
Headers show

Commit Message

Roi Dayan June 8, 2017, 11:46 a.m. UTC
Add help function match_set_tun_tp_dst().
Will be used in the nxt commit.
This patch doesn't change any functionality.

Signed-off-by: Roi Dayan <roid@mellanox.com>
---
 include/openvswitch/match.h |  2 ++
 lib/match.c                 | 13 +++++++++++++
 2 files changed, 15 insertions(+)

Comments

Flavio Leitner June 9, 2017, 7:44 p.m. UTC | #1
On Thu, Jun 08, 2017 at 02:46:31PM +0300, Roi Dayan wrote:
> Add help function match_set_tun_tp_dst().
> Will be used in the nxt commit.

If the committer could fix 'nxt' to 'next'

> This patch doesn't change any functionality.
> 
> Signed-off-by: Roi Dayan <roid@mellanox.com>
> ---

Acked-by: Flavio Leitner <fbl@sysclose.org>
Simon Horman June 15, 2017, 10:12 a.m. UTC | #2
On Fri, Jun 09, 2017 at 04:44:16PM -0300, Flavio Leitner wrote:
> On Thu, Jun 08, 2017 at 02:46:31PM +0300, Roi Dayan wrote:
> > Add help function match_set_tun_tp_dst().
> > Will be used in the nxt commit.
> 
> If the committer could fix 'nxt' to 'next'

Thanks, I fixed this when applying v11.

> > This patch doesn't change any functionality.
> > 
> > Signed-off-by: Roi Dayan <roid@mellanox.com>
> > ---
> 
> Acked-by: Flavio Leitner <fbl@sysclose.org>
> 
>
diff mbox

Patch

diff --git a/include/openvswitch/match.h b/include/openvswitch/match.h
index 9e15da2..70da928 100644
--- a/include/openvswitch/match.h
+++ b/include/openvswitch/match.h
@@ -86,6 +86,8 @@  void match_set_tun_tos(struct match *match, uint8_t tos);
 void match_set_tun_tos_masked(struct match *match, uint8_t tos, uint8_t mask);
 void match_set_tun_flags(struct match *match, uint16_t flags);
 void match_set_tun_flags_masked(struct match *match, uint16_t flags, uint16_t mask);
+void match_set_tun_tp_dst(struct match *match, ovs_be16 tp_dst);
+void match_set_tun_tp_dst_masked(struct match *match, ovs_be16 port, ovs_be16 mask);
 void match_set_tun_gbp_id_masked(struct match *match, ovs_be16 gbp_id, ovs_be16 mask);
 void match_set_tun_gbp_id(struct match *match, ovs_be16 gbp_id);
 void match_set_tun_gbp_flags_masked(struct match *match, uint8_t flags, uint8_t mask);
diff --git a/lib/match.c b/lib/match.c
index ebcdb29..9aa0d88 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -279,6 +279,19 @@  match_set_tun_flags_masked(struct match *match, uint16_t flags, uint16_t mask)
 }
 
 void
+match_set_tun_tp_dst(struct match *match, ovs_be16 tp_dst)
+{
+    match_set_tun_tp_dst_masked(match, tp_dst, OVS_BE16_MAX);
+}
+
+void
+match_set_tun_tp_dst_masked(struct match *match, ovs_be16 port, ovs_be16 mask)
+{
+    match->wc.masks.tunnel.tp_dst = mask;
+    match->flow.tunnel.tp_dst = port & mask;
+}
+
+void
 match_set_tun_gbp_id_masked(struct match *match, ovs_be16 gbp_id, ovs_be16 mask)
 {
     match->wc.masks.tunnel.gbp_id = mask;