[ovs-dev,V2,1/1] netdev-tc-offloads: Do not set 0 port attribute to TC tunnel

Message ID 20181226073435.24625-1-elibr@mellanox.com
State New
Headers show
Series
  • [ovs-dev,V2,1/1] netdev-tc-offloads: Do not set 0 port attribute to TC tunnel
Related show

Commit Message

Eli Britstein Dec. 26, 2018, 7:34 a.m.
For non UDP tunnels as GRE there is no UDP port, i.e initialized to 0.

Do not set the port attribute in such case.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
---
 lib/netdev-tc-offloads.c | 6 ++++--
 lib/tc.c                 | 8 ++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

Comments

Simon Horman Dec. 29, 2018, 12:18 a.m. | #1
On Wed, Dec 26, 2018 at 09:34:35AM +0200, Eli Britstein wrote:
> For non UDP tunnels as GRE there is no UDP port, i.e initialized to 0.
> 
> Do not set the port attribute in such case.
> 
> Signed-off-by: Eli Britstein <elibr@mellanox.com>
> Reviewed-by: Paul Blakey <paulb@mellanox.com>

Thanks,

this patch looks good to me. I am verifying that it passes
travic-ci and plan to apply this patch if that passes.

https://travis-ci.org/horms2/ovs/builds/473190038
Simon Horman Dec. 29, 2018, 11:29 p.m. | #2
On Sat, Dec 29, 2018 at 09:18:41AM +0900, Simon Horman wrote:
> On Wed, Dec 26, 2018 at 09:34:35AM +0200, Eli Britstein wrote:
> > For non UDP tunnels as GRE there is no UDP port, i.e initialized to 0.
> > 
> > Do not set the port attribute in such case.
> > 
> > Signed-off-by: Eli Britstein <elibr@mellanox.com>
> > Reviewed-by: Paul Blakey <paulb@mellanox.com>
> 
> Thanks,
> 
> this patch looks good to me. I am verifying that it passes
> travic-ci and plan to apply this patch if that passes.
> 
> https://travis-ci.org/horms2/ovs/builds/473190038

Thanks again, I have applied this patch to master.

Patch

diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c
index 606a4f4db..5e6f69951 100644
--- a/lib/netdev-tc-offloads.c
+++ b/lib/netdev-tc-offloads.c
@@ -651,8 +651,10 @@  parse_tc_flower_to_match(struct tc_flower *flower,
                     nl_msg_put_u8(buf, OVS_TUNNEL_KEY_ATTR_TTL,
                                   action->encap.ttl);
                 }
-                nl_msg_put_be16(buf, OVS_TUNNEL_KEY_ATTR_TP_DST,
-                                action->encap.tp_dst);
+                if (action->encap.tp_dst) {
+                    nl_msg_put_be16(buf, OVS_TUNNEL_KEY_ATTR_TP_DST,
+                                    action->encap.tp_dst);
+                }
                 if (!action->encap.no_csum) {
                     nl_msg_put_u8(buf, OVS_TUNNEL_KEY_ATTR_CSUM,
                                   !action->encap.no_csum);
diff --git a/lib/tc.c b/lib/tc.c
index 47127ca2c..5681ee096 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -1661,7 +1661,9 @@  nl_msg_put_act_tunnel_key_set(struct ofpbuf *request, ovs_be64 id,
         if (ttl) {
             nl_msg_put_u8(request, TCA_TUNNEL_KEY_ENC_TTL, ttl);
         }
-        nl_msg_put_be16(request, TCA_TUNNEL_KEY_ENC_DST_PORT, tp_dst);
+        if (tp_dst) {
+            nl_msg_put_be16(request, TCA_TUNNEL_KEY_ENC_DST_PORT, tp_dst);
+        }
         nl_msg_put_act_tunnel_geneve_option(request, tun_metadata);
         nl_msg_put_u8(request, TCA_TUNNEL_KEY_NO_CSUM, no_csum);
     }
@@ -2035,7 +2037,9 @@  nl_msg_put_flower_tunnel(struct ofpbuf *request, struct tc_flower *flower)
         nl_msg_put_u8(request, TCA_FLOWER_KEY_ENC_IP_TTL, ttl);
         nl_msg_put_u8(request, TCA_FLOWER_KEY_ENC_IP_TTL_MASK, ttl_mask);
     }
-    nl_msg_put_be16(request, TCA_FLOWER_KEY_ENC_UDP_DST_PORT, tp_dst);
+    if (tp_dst) {
+        nl_msg_put_be16(request, TCA_FLOWER_KEY_ENC_UDP_DST_PORT, tp_dst);
+    }
     nl_msg_put_be32(request, TCA_FLOWER_KEY_ENC_KEY_ID, id);
     nl_msg_put_flower_tunnel_opts(request, TCA_FLOWER_KEY_ENC_OPTS,
                                   flower->key.tunnel.metadata);