On 11/24/2014 12:42 PM, Maxim Uvarov wrote:
> Taras, Veky is that good for you?
> 
> Needed some more review for classification patches. They block packet 
> i/o things which also
> needed to be delivered on that week.
> 
> Thanks,
> Maxim.
> 
> On 11/21/2014 11:53 AM, Balasubramanian Manoharan wrote:
>> This patch adds TCP header description structure odph_tcphdr.
>> This structure is used for accessing TCP header information from the 
>> packet
>>
>> Signed-off-by: Balasubramanian Manoharan <bala.manoha...@linaro.org>
>> ---
>>   helper/include/odph_tcp.h | 61 
>> +++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 61 insertions(+)
>>   create mode 100644 helper/include/odph_tcp.h
>>
>> diff --git a/helper/include/odph_tcp.h b/helper/include/odph_tcp.h
>> new file mode 100644
>> index 0000000..4c5912b
>> --- /dev/null
>> +++ b/helper/include/odph_tcp.h
>> @@ -0,0 +1,61 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:     BSD-3-Clause
>> + */
>> +
>> +
>> +/**
>> + * @file
>> + *
>> + * ODP TCP header
>> + */
>> +
>> +#ifndef ODPH_TCP_H_
>> +#define ODPH_TCP_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include <odp_align.h>
>> +#include <odp_debug.h>
>> +#include <odp_byteorder.h>
>> +
>> +/** UDP header length */
>> +#define ODPH_TCPHDR_LEN 8
>> +
>> +/** TCP header */
>> +typedef struct ODP_PACKED {
>> +    uint16be_t src_port; /**< Source port */
>> +    uint16be_t dst_port; /**< Destinatino port */
>> +    uint32be_t seq_no;   /**< Sequence number */
>> +    uint32be_t ack_no;   /**< Acknowledgment number */
>> +    union {
>> +        uint32be_t flags_and_window;
>> +        struct {
>> +            uint32be_t rsvd1:8;
>> +            uint32be_t flags:8; /**< TCP flags as a byte */
>> +            uint32be_t rsvd2:16;
>> +        };
>> +        struct {
>> +            uint32be_t hl:4;    /**< Hdr len, in words */
>> +            uint32be_t rsvd3:6; /**< Reserved */
>> +            uint32be_t urg:1;   /**< ACK */
>> +            uint32be_t ack:1;
>> +            uint32be_t psh:1;
>> +            uint32be_t rst:1;
>> +            uint32be_t syn:1;
>> +            uint32be_t fin:1;
>> +            uint32be_t window:16; /**< Window size */
>> +        };

Using bit fields is not a portable solution. The order is not defined
by C99 standard.

"An implementation may allocate any addressable storage unit large enough to 
hold a bit-

field. If enough space remains, a bit-field that immediately follows another 
bit-field in a

structure shall be packed into adjacent bits of the same unit. If insufficient 
space remains,

whether a bit-field that does not fit is put into the next unit or overlaps 
adjacent units is

implementation-defined. The order of allocation of bit-fields within a unit 
(high-order to

low-order or low-order to high-order) is implementation-defined. The alignment 
of the

addressable storage unit is unspecified."

>> +    };
>> +    uint16be_t cksm;   /**< Checksum */
>> +    uint16be_t urgptr; /**< Urgent pointer */
>> +} odph_tcphdr_t;
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif
> 


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to