diff mbox series

[ovs-dev,3/3] tunnel: Set ECN mask bits only when it is matched in the IP header

Message ID 20200710120718.38633-4-sriharsha.basavapatna@broadcom.com
State Changes Requested
Headers show
Series netdev datapath offload: misc fixes | expand

Commit Message

Sriharsha Basavapatna July 10, 2020, 12:07 p.m. UTC
IP_ECN_MASK is set unconditionally in the mask field for a
tunneled flow. Set this only when the ECN field is matched.

Fixes: abcd4402fec4 ("tunnel: Only un-wildcard the ECN bits for IP traffic")
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
---
 ofproto/tunnel.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Finn, Emma Oct. 15, 2020, 2:34 p.m. UTC | #1
> -----Original Message-----
> From: dev <ovs-dev-bounces@openvswitch.org> On Behalf Of Sriharsha
> Basavapatna via dev
> Sent: Friday 10 July 2020 13:07
> To: dev@openvswitch.org
> Subject: [ovs-dev] [PATCH 3/3] tunnel: Set ECN mask bits only when it is
> matched in the IP header
> 
> IP_ECN_MASK is set unconditionally in the mask field for a tunneled flow. Set
> this only when the ECN field is matched.
> 
> Fixes: abcd4402fec4 ("tunnel: Only un-wildcard the ECN bits for IP traffic")
> Signed-off-by: Sriharsha Basavapatna
> <sriharsha.basavapatna@broadcom.com>

Tested with X710 devices. 
Tested-by: Emma Finn <emma.finn@intel.com>

> ---
>  ofproto/tunnel.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c index 03f0ab765..d0a65b430
> 100644
> --- a/ofproto/tunnel.c
> +++ b/ofproto/tunnel.c
> @@ -455,13 +455,17 @@ tnl_port_send(const struct ofport_dpif *ofport,
> struct flow *flow,
> 
>      /* ECN fields are always inherited. */
>      if (is_ip_any(flow)) {
> -        wc->masks.nw_tos |= IP_ECN_MASK;
> -
>          if (IP_ECN_is_ce(flow->nw_tos)) {
>              flow->tunnel.ip_tos |= IP_ECN_ECT_0;
>          } else {
>              flow->tunnel.ip_tos |= flow->nw_tos & IP_ECN_MASK;
>          }
> +
> +        if (flow->tunnel.ip_tos & IP_ECN_MASK) {
> +            wc->masks.nw_tos |= IP_ECN_MASK;
> +        } else {
> +            wc->masks.nw_tos &= ~IP_ECN_MASK;
> +        }
>      }
> 
>      flow->tunnel.flags &= ~(FLOW_TNL_F_MASK & ~FLOW_TNL_PUB_F_MASK);
> --
> 2.25.0.rc2
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index 03f0ab765..d0a65b430 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -455,13 +455,17 @@  tnl_port_send(const struct ofport_dpif *ofport, struct flow *flow,
 
     /* ECN fields are always inherited. */
     if (is_ip_any(flow)) {
-        wc->masks.nw_tos |= IP_ECN_MASK;
-
         if (IP_ECN_is_ce(flow->nw_tos)) {
             flow->tunnel.ip_tos |= IP_ECN_ECT_0;
         } else {
             flow->tunnel.ip_tos |= flow->nw_tos & IP_ECN_MASK;
         }
+
+        if (flow->tunnel.ip_tos & IP_ECN_MASK) {
+            wc->masks.nw_tos |= IP_ECN_MASK;
+        } else {
+            wc->masks.nw_tos &= ~IP_ECN_MASK;
+        }
     }
 
     flow->tunnel.flags &= ~(FLOW_TNL_F_MASK & ~FLOW_TNL_PUB_F_MASK);