From patchwork Tue Jun 2 13:50:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1302469 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=JvL1Z53G; 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 49btkb4LzNz9sSd for ; Tue, 2 Jun 2020 23:51:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 84700883C0; Tue, 2 Jun 2020 13:51:49 +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 yL3Cb-tWDnNP; Tue, 2 Jun 2020 13:51:48 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 9CA5A883A4; Tue, 2 Jun 2020 13:51:48 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8462FC0178; Tue, 2 Jun 2020 13:51:48 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5B288C016E for ; Tue, 2 Jun 2020 13:51:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 57A3887482 for ; Tue, 2 Jun 2020 13:51:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4d6tdRmeU+cF for ; Tue, 2 Jun 2020 13:51:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by whitealder.osuosl.org (Postfix) with ESMTPS id C2103877E1 for ; Tue, 2 Jun 2020 13:51:46 +0000 (UTC) Received: by mail-pj1-f67.google.com with SMTP id k2so1393387pjs.2 for ; Tue, 02 Jun 2020 06:51:46 -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=cd1fbrRwKQ8oECp9PvwUDQCezS6PuomjvxnEMHDe9PQ=; b=JvL1Z53G64b4h6ZQ5mdhEYWv7SleCLftXU+GB3sYh910wBx2FJaNrMSGUqPKrUDIe+ RVIfght/CKfbgdoM5LxApqHtkdxWx80nty0Yx8kutAjXNbD1CO6kMSRjTN+FConf8o8p rXJPHV9fyvVPZyIkncDJbmCRhl5reKepmPHWf/S/G7zqO734ZuYTlLAYZW7shTnx6Fu8 WxC5MBETO+Zk2qQNamQJz5WHbCFpFH6BlLBj+vViZ33OtvaUaYrLRlxe48b+NCEq2Cz0 w8uk+RihpXSW1qxQJrADg7TPRawvCI6P/WJSEPE10uXc92R7tCX/SEtZ9BrKxeUMXGMK g9KQ== 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=cd1fbrRwKQ8oECp9PvwUDQCezS6PuomjvxnEMHDe9PQ=; b=iC15na5e+nIWvIr6BROGhVbw8nBMbQkcL0961AfbcHIss1y7d3Gzn4T3PuAWBr6uex FqkCm/eI81sajT08elX5ypM3JcgTEkhzHgB0Ec9GMEdulq960lYnRJFtftdFHt232tS3 j5VXaUGPCN41azZ4r5ZIM08nZExMpCLieiBAxDq7Z4W1rq+e141qYGNGTqjZ3uYqMbgQ 1iRkChugUWC+DqI7aTeeczz2GrVKkOPBP5k4SWVK67QePsCNmSnW5QeoddoQG4N2N6OP VUbWUHfbfhhuytxX+dt6NCK0PQ0VSv0VxAHypjx3In4xJR4JeP8dnXc1hFfhSaW7K4og wzAQ== X-Gm-Message-State: AOAM530BJFmC6C4/Yo6vKyUET1CQLjV9Mzo0/tJWM54lgWt4bMZTmAyr CILXUUtHKj9z0+eMSrVXpvopSpxCri+g1Q== X-Google-Smtp-Source: ABdhPJwXvyWqZTM+5Yd/6nD3kmy5oFg5mjINmP5T6raOqtfwJkE1/fEYJXSKvoZG9esSOaNi+QpmMQ== X-Received: by 2002:a17:90a:881:: with SMTP id v1mr5774607pjc.227.1591105906286; Tue, 02 Jun 2020 06:51:46 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id h21sm2514622pjz.6.2020.06.02.06.51.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2020 06:51:45 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: dev@openvswitch.org Date: Tue, 2 Jun 2020 21:50:23 +0800 Message-Id: <20200602135025.20704-3-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20200602135025.20704-1-xiangxia.m.yue@gmail.com> References: <20200602135025.20704-1-xiangxia.m.yue@gmail.com> Cc: simon.horman@netronome.com, i.maximets@ovn.org Subject: [ovs-dev] [PATCH v2 2/4] 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 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); }