From patchwork Mon May 18 01:44:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1292278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=je6UZvwB; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49QMKF1PZjz9sT8 for ; Mon, 18 May 2020 11:45:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 88EB4884A0; Mon, 18 May 2020 01:45:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5lzWfrXf8sPn; Mon, 18 May 2020 01:45:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 4632F8841A; Mon, 18 May 2020 01:45:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 34555C0881; Mon, 18 May 2020 01:45:18 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id B0698C07FF for ; Mon, 18 May 2020 01:45:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A01678841A for ; Mon, 18 May 2020 01:45:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7NrlwDmq5T-U for ; Mon, 18 May 2020 01:45:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id 86D06883F5 for ; Mon, 18 May 2020 01:45:15 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id b12so3551956plz.13 for ; Sun, 17 May 2020 18:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/62Xb60Ls3sMI+8FQ7Uw506mTV4Sfm4DXqXAJrWy4j0=; b=je6UZvwBHViTod7diJ3Ryn7OL2Nv/ak+shFQsYonwkn0x1GB+ijLXgxpK6vxpHiGGE XwBbpf9ljQ6il2cHoWmPAaC04sSjLQKlSnOlDEYYrCBhKz+bnZY19SzbF+Rl/LOl51zj cQeeQdK0G+5gRFOx7auLoPqnNCp1Q1g8OIEHPtRTunMeLaPwhs55a6qeHBPUf/c9BPlD +PEMWaGfEGL+uqY3346TqQwfvvS84mGxpx7lNn9COjNflVTjVNdD1pMZG8jKZx3x+6uj /aWE7KgE3iiDKVVmA1cOANQKfg+KHo0SmiBIrTA8dqAr6qBOVKF9WBSs2IaZVnzTR/sz Iyyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/62Xb60Ls3sMI+8FQ7Uw506mTV4Sfm4DXqXAJrWy4j0=; b=C0dSlneKzsim1Jq5RQMD/hKvuA+ZE5JuB4XFYP34QxiSm+REkPRq3i2UYOnd5zbJNU iXZX7Qz1b9XjlvdT+vAUzd/R+JrS5B8wEKUoiu/VAbzAxr0Dv4blGT1i0hhfu0cS22He dC3iDrSEuGM8B5lTMCs/NlS7pp/5wjo9vZTcQQkAwqwhmYVSOTiWO53feuKg8h73XpuB HyoDu7J0tzytKOBtZJEQhnhVjsff65WpkBQl+jDjnuy9PVGdV7sq8r39mgisXLFogAwj emHLCz8AOEyEigqRWdmb7pJcRn3JlHlq41cvwcA/ySJWkWn0ZMdASucUYG/7o1nGZp3w TnuA== X-Gm-Message-State: AOAM531cRGtYsqVbIfXJbEBLIZSM16f8J2QI2+4LcsS+8LXNXPTYvpEx TbRVCXNKcVvcd+MMZ+fQuEo= X-Google-Smtp-Source: ABdhPJzBskVGZKN7piF72oBJ0CGN4EUdpyqFNcndjfz25mdG+jtPaTcTa5KyHOSId4Fx8rH2iBTFFQ== X-Received: by 2002:a17:90a:ad49:: with SMTP id w9mr16744173pjv.20.1589766315198; Sun, 17 May 2020 18:45:15 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id y6sm7000163pjw.15.2020.05.17.18.45.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2020 18:45:14 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: simon.horman@netronome.com, paulb@mellanox.com, roid@mellanox.com, blp@ovn.org, u9012063@gmail.com, i.maximets@ovn.org, dev@openvswitch.org Date: Mon, 18 May 2020 09:44:43 +0800 Message-Id: <20200518014443.1529-3-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20200518014443.1529-1-xiangxia.m.yue@gmail.com> References: <20200518014443.1529-1-xiangxia.m.yue@gmail.com> Subject: [ovs-dev] [PATCH 3/3] netdev-offload-tc: Use ipv6_addr_is_set instead of is_all_zeros X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Tonghao Zhang Not bugfix, make the codes more readable. Cc: Simon Horman Cc: Paul Blakey Cc: Roi Dayan Cc: Ben Pfaff Cc: William Tu Cc: Ilya Maximets Signed-off-by: Tonghao Zhang Acked-by: Roi Dayan --- lib/netdev-offload-tc.c | 6 ++---- lib/tc.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 39cf25f63ce0..21ff2baec268 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -750,13 +750,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 9ac40f692c17..ac5ecc2b7e6f 100644 --- a/lib/tc.c +++ b/lib/tc.c @@ -2060,7 +2060,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, @@ -2157,12 +2157,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); }