diff mbox series

[ovs-dev,v2,2/4] netdev-offload-tc: Use ipv6_addr_is_set instead of is_all_zeros

Message ID 20200602135025.20704-3-xiangxia.m.yue@gmail.com
State Accepted
Commit 4f4be08e4713941285ecb71555c9a64c46cdb8ae
Headers show
Series netdev-offload-tc: Allow to match the IP and port mask of tunnel | expand

Commit Message

Tonghao Zhang June 2, 2020, 1:50 p.m. UTC
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Not bugfix, make the codes more readable.

Cc: Simon Horman <simon.horman@netronome.com>
Cc: Paul Blakey <paulb@mellanox.com>
Cc: Roi Dayan <roid@mellanox.com>
Cc: Ben Pfaff <blp@ovn.org>
Cc: William Tu <u9012063@gmail.com>
Cc: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Roi Dayan <roid@mellanox.com>
---
 lib/netdev-offload-tc.c | 6 ++----
 lib/tc.c                | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

Comments

0-day Robot June 5, 2020, 10:03 p.m. UTC | #1
Bleep bloop.  Greetings Tonghao Zhang, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 86 characters long (recommended limit is 79)
#146 FILE: lib/tc.c:1750:
            VLOG_ERR_RL(&error_rl, "failed to parse flower classifier terse options");

Lines checked: 226, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
index 875ebef71941..9b7c74aae887 100644
--- a/lib/netdev-offload-tc.c
+++ b/lib/netdev-offload-tc.c
@@ -734,13 +734,11 @@  parse_tc_flower_to_match(struct tc_flower *flower,
                     nl_msg_put_be32(buf, OVS_TUNNEL_KEY_ATTR_IPV4_DST,
                                     action->encap.ipv4.ipv4_dst);
                 }
-                if (!is_all_zeros(&action->encap.ipv6.ipv6_src,
-                                  sizeof action->encap.ipv6.ipv6_src)) {
+                if (ipv6_addr_is_set(&action->encap.ipv6.ipv6_src)) {
                     nl_msg_put_in6_addr(buf, OVS_TUNNEL_KEY_ATTR_IPV6_SRC,
                                         &action->encap.ipv6.ipv6_src);
                 }
-                if (!is_all_zeros(&action->encap.ipv6.ipv6_dst,
-                                  sizeof action->encap.ipv6.ipv6_dst)) {
+                if (ipv6_addr_is_set(&action->encap.ipv6.ipv6_dst)) {
                     nl_msg_put_in6_addr(buf, OVS_TUNNEL_KEY_ATTR_IPV6_DST,
                                         &action->encap.ipv6.ipv6_dst);
                 }
diff --git a/lib/tc.c b/lib/tc.c
index 12af0192b614..a6297445ca33 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -2038,7 +2038,7 @@  nl_msg_put_act_tunnel_key_set(struct ofpbuf *request, bool id_present,
         if (ipv4_dst) {
             nl_msg_put_be32(request, TCA_TUNNEL_KEY_ENC_IPV4_SRC, ipv4_src);
             nl_msg_put_be32(request, TCA_TUNNEL_KEY_ENC_IPV4_DST, ipv4_dst);
-        } else if (!is_all_zeros(ipv6_dst, sizeof *ipv6_dst)) {
+        } else if (ipv6_addr_is_set(ipv6_dst)) {
             nl_msg_put_in6_addr(request, TCA_TUNNEL_KEY_ENC_IPV6_DST,
                                 ipv6_dst);
             nl_msg_put_in6_addr(request, TCA_TUNNEL_KEY_ENC_IPV6_SRC,
@@ -2135,12 +2135,10 @@  nl_msg_put_act_ct(struct ofpbuf *request, struct tc_action *action)
                                     action->ct.range.ipv4.max);
                     }
                 } else if (action->ct.range.ip_family == AF_INET6) {
-                    size_t ipv6_sz = sizeof(action->ct.range.ipv6.max);
 
                     nl_msg_put_in6_addr(request, TCA_CT_NAT_IPV6_MIN,
                                         &action->ct.range.ipv6.min);
-                    if (!is_all_zeros(&action->ct.range.ipv6.max,
-                                      ipv6_sz)) {
+                    if (ipv6_addr_is_set(&action->ct.range.ipv6.max)) {
                         nl_msg_put_in6_addr(request, TCA_CT_NAT_IPV6_MAX,
                                             &action->ct.range.ipv6.max);
                     }