diff mbox series

[ovs-dev,v2,3/5] netdev-offload-tc: Use masks instead of keys while parsing tunnel attributes.

Message ID 20220729145319.3228334-4-i.maximets@ovn.org
State Superseded
Headers show
Series tc: Fixes for tunnel offloading. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Ilya Maximets July 29, 2022, 2:53 p.m. UTC
If the key is zero, it doesn't mean we don't need to match on it.
Masks should be checked instead.

For the metadata length that's a bit tricky, because the length in the
mask section of the 'flower' structure represents the actual length of
the mask and not the mask of the length field in the key.  But lengths
of the mask and the key must be equal in the OVS use case, so we can
use them interchangeably.

Fixes: 49a7961fca65 ("lib/tc: Avoid matching on tunnel ttl or tos if not needed")
Fixes: a468645c6d33 ("lib/tc: add geneve with option match offload")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 lib/netdev-offload-tc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Roi Dayan Aug. 1, 2022, 6:31 a.m. UTC | #1
On 2022-07-29 5:53 PM, Ilya Maximets wrote:
> If the key is zero, it doesn't mean we don't need to match on it.
> Masks should be checked instead.
> 
> For the metadata length that's a bit tricky, because the length in the
> mask section of the 'flower' structure represents the actual length of
> the mask and not the mask of the length field in the key.  But lengths
> of the mask and the key must be equal in the OVS use case, so we can
> use them interchangeably.
> 
> Fixes: 49a7961fca65 ("lib/tc: Avoid matching on tunnel ttl or tos if not needed")
> Fixes: a468645c6d33 ("lib/tc: add geneve with option match offload")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
>   lib/netdev-offload-tc.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
> index 336507d59..a3eee8df3 100644
> --- a/lib/netdev-offload-tc.c
> +++ b/lib/netdev-offload-tc.c
> @@ -1106,19 +1106,19 @@ parse_tc_flower_to_match(struct tc_flower *flower,
>                                             &flower->key.tunnel.ipv6.ipv6_src,
>                                             &flower->mask.tunnel.ipv6.ipv6_src);
>           }
> -        if (flower->key.tunnel.tos) {
> +        if (flower->mask.tunnel.tos) {
>               match_set_tun_tos_masked(match, flower->key.tunnel.tos,
>                                        flower->mask.tunnel.tos);
>           }
> -        if (flower->key.tunnel.ttl) {
> +        if (flower->mask.tunnel.ttl) {
>               match_set_tun_ttl_masked(match, flower->key.tunnel.ttl,
>                                        flower->mask.tunnel.ttl);
>           }
> -        if (flower->key.tunnel.tp_dst) {
> +        if (flower->mask.tunnel.tp_dst) {
>               match_set_tun_tp_dst_masked(match, flower->key.tunnel.tp_dst,
>                                           flower->mask.tunnel.tp_dst);
>           }
> -        if (flower->key.tunnel.metadata.present.len) {
> +        if (flower->mask.tunnel.metadata.present.len) {
>               flower_tun_opt_to_match(match, flower);
>           }
>       }

Reviewed-by: Roi Dayan <roid@nvidia.com>
diff mbox series

Patch

diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
index 336507d59..a3eee8df3 100644
--- a/lib/netdev-offload-tc.c
+++ b/lib/netdev-offload-tc.c
@@ -1106,19 +1106,19 @@  parse_tc_flower_to_match(struct tc_flower *flower,
                                           &flower->key.tunnel.ipv6.ipv6_src,
                                           &flower->mask.tunnel.ipv6.ipv6_src);
         }
-        if (flower->key.tunnel.tos) {
+        if (flower->mask.tunnel.tos) {
             match_set_tun_tos_masked(match, flower->key.tunnel.tos,
                                      flower->mask.tunnel.tos);
         }
-        if (flower->key.tunnel.ttl) {
+        if (flower->mask.tunnel.ttl) {
             match_set_tun_ttl_masked(match, flower->key.tunnel.ttl,
                                      flower->mask.tunnel.ttl);
         }
-        if (flower->key.tunnel.tp_dst) {
+        if (flower->mask.tunnel.tp_dst) {
             match_set_tun_tp_dst_masked(match, flower->key.tunnel.tp_dst,
                                         flower->mask.tunnel.tp_dst);
         }
-        if (flower->key.tunnel.metadata.present.len) {
+        if (flower->mask.tunnel.metadata.present.len) {
             flower_tun_opt_to_match(match, flower);
         }
     }