From patchwork Thu Mar 20 11:56:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 26682 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 617FD20143 for ; Thu, 20 Mar 2014 11:54:59 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id cz12sf1838118veb.2 for ; Thu, 20 Mar 2014 04:54:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe:content-type; bh=v0/plsQPzopD9qsuq2i1mCGpt3CZcbqZqWdIxMDdmmM=; b=KQmy4omJTaEmDprxJYAqeIrOei10bCTCrttZ91gQ88OUijf/9EzNX36HMgJIfsL6Qe goY4SetfO2nrEZmjgFjSEy10HFRMB35wmnR+6SYL3/yD8yB81OIM0RV8mvwTW9CeZtgl L+WcHgfeJg9mZNx3wbWkN3FFY/93hm3MYTzLadGXD1JQiFH42/6YUrLqZ3qrrUPd0ugb nU2oOE9q+1b5xhJv8u21MCYULhQvyNiCeANFAwTXXqJmQi6jtbBd55SfWV8IU4PpuuuO wPNhA+dy+RsVLyvm7bXQdlyvAYKoMVHiqFyc5OAzkjgqx6k1H49r+7WyUJog5JtcMtNt XXJw== X-Gm-Message-State: ALoCoQmB3M1t7Zwa7hYZgLDIVenlHfeMTjAwjsS0WNfmAVsTjQa4UGzwThltYH305d1h0nM1nbsV X-Received: by 10.58.168.137 with SMTP id zw9mr8142914veb.15.1395316498964; Thu, 20 Mar 2014 04:54:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: lng-odp@linaro.org Received: by 10.140.93.194 with SMTP id d60ls189277qge.22.gmail; Thu, 20 Mar 2014 04:54:58 -0700 (PDT) X-Received: by 10.140.95.172 with SMTP id i41mr34669458qge.70.1395316498616; Thu, 20 Mar 2014 04:54:58 -0700 (PDT) Received: from mail-qc0-f173.google.com (mail-qc0-f173.google.com [209.85.216.173]) by mx.google.com with ESMTPS id f33si105906qgf.100.2014.03.20.04.54.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 04:54:58 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.216.173 is neither permitted nor denied by best guess record for domain of petri.savolainen@linaro.org) client-ip=209.85.216.173; Received: by mail-qc0-f173.google.com with SMTP id r5so744396qcx.4 for ; Thu, 20 Mar 2014 04:54:58 -0700 (PDT) X-Received: by 10.224.4.5 with SMTP id 5mr49637036qap.61.1395316498519; Thu, 20 Mar 2014 04:54:58 -0700 (PDT) Received: from localhost.localdomain (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id u7sm2996320qap.5.2014.03.20.04.54.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 04:54:57 -0700 (PDT) From: Petri Savolainen To: lng-odp@linaro.org Cc: Petri Savolainen Subject: [lng-odp] [PATCH] Fixed bugs in odp_packet_internal.h bitfields Date: Thu, 20 Mar 2014 13:56:55 +0200 Message-Id: <1395316615-29072-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 1.8.5.3 X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.216.173 is neither permitted nor denied by best guess record for domain of petri.savolainen@linaro.org) smtp.mail=petri.savolainen@linaro.org Precedence: list Mailing-list: list lng-odp@linaro.org; contact lng-odp+owners@linaro.org List-ID: X-Google-Group-Id: 474323889996 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Fixed bitfield bugs found by Bala. Signed-off-by: Petri Savolainen --- .../linux-generic/include/odp_packet_internal.h | 66 ++++++++++++---------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index f0dda95..792fc7c 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -32,28 +32,30 @@ typedef union { /* All input flags */ uint32_t all; - /* Bitfield flags for each protocol */ - uint32_t l2:1; /**< known L2 protocol present */ - uint32_t l3:1; /**< known L3 protocol present */ - uint32_t l4:1; /**< known L4 protocol present */ - - uint32_t eth:1; /**< Ethernet */ - uint32_t jumbo:1; /**< Jumbo frame */ - uint32_t vlan:1; /**< VLAN hdr found */ - uint32_t vlan_qinq:1; /**< Stacked VLAN found, QinQ */ - - uint32_t arp:1; /**< ARP */ - - uint32_t ipv4:1; /**< IPv4 */ - uint32_t ipv6:1; /**< IPv6 */ - uint32_t ipfrag:1; /**< IP fragment */ - uint32_t ipopt:1; /**< IP optional headers */ - uint32_t ipsec; /**< IPSec decryption may be needed */ - - uint32_t udp:1; /**< UDP */ - uint32_t tcp:1; /**< TCP */ - uint32_t sctp:1; /**< SCTP */ - uint32_t icmp:1; /**< ICMP */ + struct { + /* Bitfield flags for each protocol */ + uint32_t l2:1; /**< known L2 protocol present */ + uint32_t l3:1; /**< known L3 protocol present */ + uint32_t l4:1; /**< known L4 protocol present */ + + uint32_t eth:1; /**< Ethernet */ + uint32_t jumbo:1; /**< Jumbo frame */ + uint32_t vlan:1; /**< VLAN hdr found */ + uint32_t vlan_qinq:1; /**< Stacked VLAN found, QinQ */ + + uint32_t arp:1; /**< ARP */ + + uint32_t ipv4:1; /**< IPv4 */ + uint32_t ipv6:1; /**< IPv6 */ + uint32_t ipfrag:1; /**< IP fragment */ + uint32_t ipopt:1; /**< IP optional headers */ + uint32_t ipsec:1; /**< IPSec decryption may be needed */ + + uint32_t udp:1; /**< UDP */ + uint32_t tcp:1; /**< TCP */ + uint32_t sctp:1; /**< SCTP */ + uint32_t icmp:1; /**< ICMP */ + }; } input_flags_t; ODP_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), INPUT_FLAGS_SIZE_ERROR); @@ -65,12 +67,14 @@ typedef union { /* All error flags */ uint32_t all; - /* Bitfield flags for each detected error */ - uint32_t frame_len:1; /**< Frame length error */ - uint32_t l2_chksum:1; /**< L2 checksum error, checks TBD */ - uint32_t ip_err:1; /**< IP error, checks TBD */ - uint32_t tcp_err:1; /**< TCP error, checks TBD */ - uint32_t udp_err:1; /**< UDP error, checks TBD */ + struct { + /* Bitfield flags for each detected error */ + uint32_t frame_len:1; /**< Frame length error */ + uint32_t l2_chksum:1; /**< L2 checksum error, checks TBD */ + uint32_t ip_err:1; /**< IP error, checks TBD */ + uint32_t tcp_err:1; /**< TCP error, checks TBD */ + uint32_t udp_err:1; /**< UDP error, checks TBD */ + }; } error_flags_t; ODP_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), ERROR_FLAGS_SIZE_ERROR); @@ -82,8 +86,10 @@ typedef union { /* All output flags */ uint32_t all; - /* Bitfield flags for each output option */ - uint32_t l4_chksum:1; /**< Request L4 checksum calculation */ + struct { + /* Bitfield flags for each output option */ + uint32_t l4_chksum:1; /**< Request L4 checksum calculation */ + }; } output_flags_t; ODP_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), OUTPUT_FLAGS_SIZE_ERROR);