From patchwork Fri Sep 4 20:53:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 514760 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 4168714029C for ; Sat, 5 Sep 2015 06:53:44 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1CAF210C43; Fri, 4 Sep 2015 13:53:35 -0700 (PDT) X-Original-To: dev@openvswitch.com Delivered-To: dev@openvswitch.com Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by archives.nicira.com (Postfix) with ESMTPS id 98E7B10895 for ; Fri, 4 Sep 2015 13:53:33 -0700 (PDT) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 503428F2E3 for ; Fri, 4 Sep 2015 20:53:33 +0000 (UTC) Received: from aconole.bos.com (vpn-63-96.rdu2.redhat.com [10.10.63.96]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t84KrVlJ001959 for ; Fri, 4 Sep 2015 16:53:32 -0400 From: Aaron Conole To: dev@openvswitch.com Date: Fri, 4 Sep 2015 16:53:29 -0400 Message-Id: <1441400010-15363-3-git-send-email-aconole@redhat.com> In-Reply-To: <1441400010-15363-1-git-send-email-aconole@redhat.com> References: <1441400010-15363-1-git-send-email-aconole@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Subject: [ovs-dev] [PATCH 2/3] Commit 74ff3298c880 introduced a compilation issue due to a bad unsigned 64-bit constant, as well as an implicit narrow. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" This commit uses the C99 ULL suffix to tell the compiler to treat the constant as 64-bits, and also masks portions of the uint64_t argument to the htons() calls to avoid compiler errors. Signed-off-by: Aaron Conole --- lib/packets.h | 4 ++-- tests/test-aa.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/packets.h b/lib/packets.h index fd235dc..a4f6383 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -230,8 +230,8 @@ static inline uint64_t eth_addr_vlan_to_uint64(const struct eth_addr ea, static inline void eth_addr_from_uint64(uint64_t x, struct eth_addr *ea) { ea->be16[0] = htons(x >> 32); - ea->be16[1] = htons(x >> 16); - ea->be16[2] = htons(x); + ea->be16[1] = htons((x & 0xFFFF0000) >> 16); + ea->be16[2] = htons(x & 0xFFFF); } static inline struct eth_addr eth_addr_invert(const struct eth_addr src) diff --git a/tests/test-aa.c b/tests/test-aa.c index 0b0e256..2da572d 100644 --- a/tests/test-aa.c +++ b/tests/test-aa.c @@ -153,7 +153,7 @@ test_aa_send(void) hardware.h_lport.p_element.type = LLDP_TLV_AA_ELEM_TYPE_CLIENT_VIRTUAL_SWITCH; hardware.h_lport.p_element.mgmt_vlan = 0xCDC; - eth_addr_from_uint64(0x010203040506, + eth_addr_from_uint64(0x010203040506ULL, &hardware.h_lport.p_element.system_id.system_mac); hardware.h_lport.p_element.system_id.conn_type = 0x5;