diff mbox

[PATCHv2] Add helper: odp_icmp.h

Message ID 1398071709-5807-1-git-send-email-weilong.chen@linaro.org
State Accepted
Headers show

Commit Message

Weilong Chen April 21, 2014, 9:15 a.m. UTC
Signed-off-by: Weilong Chen <weilong.chen@linaro.org>
---
 include/helper/odp_icmp.h |   97 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100644 include/helper/odp_icmp.h

Comments

Maxim Uvarov April 21, 2014, 2:18 p.m. UTC | #1
On 04/21/2014 01:15 PM, Weilong Chen wrote:
> Signed-off-by: Weilong Chen <weilong.chen@linaro.org>
> ---
>   include/helper/odp_icmp.h |   97 +++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 97 insertions(+)
>   create mode 100644 include/helper/odp_icmp.h
>
> diff --git a/include/helper/odp_icmp.h b/include/helper/odp_icmp.h
> new file mode 100644
> index 0000000..bfa356d
> --- /dev/null
> +++ b/include/helper/odp_icmp.h
> @@ -0,0 +1,97 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:		 BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP ICMP header
> + */
> +
> +#ifndef ODP_ICMP_H_
> +#define ODP_ICMP_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <odp_align.h>
> +#include <odp_debug.h>
> +#include <odp_byteorder.h>
> +
> +/** ICMP header length */
> +#define ODP_ICMPHDR_LEN 8
> +
> +/** ICMP header */
> +typedef struct ODP_PACKED {
> +	uint8_t type;		/** message type */
> +	uint8_t code;		/** type sub-code */
> +	uint16be_t chksum;
> +	union {
> +		struct {
> +			uint16be_t id;
> +			uint16be_t sequence;
> +		} echo;			/** echo datagram */
> +		uint32be_t gateway;	/** gateway address */
> +		struct {
> +			uint16be_t __unused;
> +			uint16be_t mtu;
> +		} frag;			/** path mtu discovery */
> +	} un;
> +} odp_icmphdr_t;
> +
> +#define ICMP_ECHOREPLY		0	/** Echo Reply			*/
> +#define ICMP_DEST_UNREACH	3	/** Destination Unreachable	*/
> +#define ICMP_SOURCE_QUENCH	4	/** Source Quench		*/
> +#define ICMP_REDIRECT		5	/** Redirect (change route)	*/
> +#define ICMP_ECHO		8	/** Echo Request		*/
> +#define ICMP_TIME_EXCEEDED	11	/** Time Exceeded		*/
> +#define ICMP_PARAMETERPROB	12	/** Parameter Problem		*/
> +#define ICMP_TIMESTAMP		13	/** Timestamp Request		*/
> +#define ICMP_TIMESTAMPREPLY	14	/** Timestamp Reply		*/
> +#define ICMP_INFO_REQUEST	15	/** Information Request		*/
> +#define ICMP_INFO_REPLY		16	/** Information Reply		*/
tabulation here.
> +#define ICMP_ADDRESS		17	/** Address Mask Request	*/
> +#define ICMP_ADDRESSREPLY	18	/** Address Mask Reply		*/
> +#define NR_ICMP_TYPES		18
> +
> +/** Codes for UNREACH. */
> +#define ICMP_NET_UNREACH	0	/** Network Unreachable		*/
> +#define ICMP_HOST_UNREACH	1	/** Host Unreachable		*/
> +#define ICMP_PROT_UNREACH	2	/** Protocol Unreachable	*/
> +#define ICMP_PORT_UNREACH	3	/** Port Unreachable		*/
> +#define ICMP_FRAG_NEEDED	4	/** Fragmentation Needed/DF set	*/
> +#define ICMP_SR_FAILED		5	/** Source Route failed		*/
> +#define ICMP_NET_UNKNOWN	6
> +#define ICMP_HOST_UNKNOWN	7
> +#define ICMP_HOST_ISOLATED	8
> +#define ICMP_NET_ANO		9
> +#define ICMP_HOST_ANO		10
> +#define ICMP_NET_UNR_TOS	11
> +#define ICMP_HOST_UNR_TOS	12
> +#define ICMP_PKT_FILTERED	13	/** Packet filtered	 */
> +#define ICMP_PREC_VIOLATION	14	/** Precedence violation */
> +#define ICMP_PREC_CUTOFF	15	/** Precedence cut off   */
> +#define NR_ICMP_UNREACH		15	/** instead of hardcoding immediate value */

Should NR_ICMP_UNREACH be 16?



> +
> +/** Codes for REDIRECT. */
> +#define ICMP_REDIR_NET		0	/** Redirect Net		*/
> +#define ICMP_REDIR_HOST		1	/** Redirect Host		*/
is here double tab? 1 in not in the same column that 0, 2,3.
> +#define ICMP_REDIR_NETTOS	2	/** Redirect Net for TOS	*/
> +#define ICMP_REDIR_HOSTTOS	3	/** Redirect Host for TOS	*/
> +
> +/** Codes for TIME_EXCEEDED. */
> +#define ICMP_EXC_TTL		0	/** TTL count exceeded		*/
> +#define ICMP_EXC_FRAGTIME	1	/** Fragment Reass time exceeded	*/
> +
> +/** @internal Compile time assert */
> +ODP_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN, ODP_ICMPHDR_T__SIZE_ERROR);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
Weilong Chen April 23, 2014, 3:19 a.m. UTC | #2
On 21 April 2014 22:18, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 04/21/2014 01:15 PM, Weilong Chen wrote:
>
>> Signed-off-by: Weilong Chen <weilong.chen@linaro.org>
>> ---
>>   include/helper/odp_icmp.h |   97 ++++++++++++++++++++++++++++++
>> +++++++++++++++
>>   1 file changed, 97 insertions(+)
>>   create mode 100644 include/helper/odp_icmp.h
>>
>> diff --git a/include/helper/odp_icmp.h b/include/helper/odp_icmp.h
>> new file mode 100644
>> index 0000000..bfa356d
>> --- /dev/null
>> +++ b/include/helper/odp_icmp.h
>> @@ -0,0 +1,97 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:             BSD-3-Clause
>> + */
>> +
>> +
>> +/**
>> + * @file
>> + *
>> + * ODP ICMP header
>> + */
>> +
>> +#ifndef ODP_ICMP_H_
>> +#define ODP_ICMP_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include <odp_align.h>
>> +#include <odp_debug.h>
>> +#include <odp_byteorder.h>
>> +
>> +/** ICMP header length */
>> +#define ODP_ICMPHDR_LEN 8
>> +
>> +/** ICMP header */
>> +typedef struct ODP_PACKED {
>> +       uint8_t type;           /** message type */
>> +       uint8_t code;           /** type sub-code */
>> +       uint16be_t chksum;
>> +       union {
>> +               struct {
>> +                       uint16be_t id;
>> +                       uint16be_t sequence;
>> +               } echo;                 /** echo datagram */
>> +               uint32be_t gateway;     /** gateway address */
>> +               struct {
>> +                       uint16be_t __unused;
>> +                       uint16be_t mtu;
>> +               } frag;                 /** path mtu discovery */
>> +       } un;
>> +} odp_icmphdr_t;
>> +
>> +#define ICMP_ECHOREPLY         0       /** Echo Reply                  */
>> +#define ICMP_DEST_UNREACH      3       /** Destination Unreachable     */
>> +#define ICMP_SOURCE_QUENCH     4       /** Source Quench               */
>> +#define ICMP_REDIRECT          5       /** Redirect (change route)     */
>> +#define ICMP_ECHO              8       /** Echo Request                */
>> +#define ICMP_TIME_EXCEEDED     11      /** Time Exceeded               */
>> +#define ICMP_PARAMETERPROB     12      /** Parameter Problem           */
>> +#define ICMP_TIMESTAMP         13      /** Timestamp Request           */
>> +#define ICMP_TIMESTAMPREPLY    14      /** Timestamp Reply             */
>> +#define ICMP_INFO_REQUEST      15      /** Information Request         */
>> +#define ICMP_INFO_REPLY                16      /** Information Reply
>>       */
>>
> tabulation here.

​Sorry, I didn't get you.​
​I use checkpatch, and doesn't get a warning.
And set tab = 8,​ it looks good to me.

>
>  +#define ICMP_ADDRESS           17      /** Address Mask Request        */
>> +#define ICMP_ADDRESSREPLY      18      /** Address Mask Reply          */
>> +#define NR_ICMP_TYPES          18
>> +
>> +/** Codes for UNREACH. */
>> +#define ICMP_NET_UNREACH       0       /** Network Unreachable         */
>> +#define ICMP_HOST_UNREACH      1       /** Host Unreachable            */
>> +#define ICMP_PROT_UNREACH      2       /** Protocol Unreachable        */
>> +#define ICMP_PORT_UNREACH      3       /** Port Unreachable            */
>> +#define ICMP_FRAG_NEEDED       4       /** Fragmentation Needed/DF set */
>> +#define ICMP_SR_FAILED         5       /** Source Route failed         */
>> +#define ICMP_NET_UNKNOWN       6
>> +#define ICMP_HOST_UNKNOWN      7
>> +#define ICMP_HOST_ISOLATED     8
>> +#define ICMP_NET_ANO           9
>> +#define ICMP_HOST_ANO          10
>> +#define ICMP_NET_UNR_TOS       11
>> +#define ICMP_HOST_UNR_TOS      12
>> +#define ICMP_PKT_FILTERED      13      /** Packet filtered      */
>> +#define ICMP_PREC_VIOLATION    14      /** Precedence violation */
>> +#define ICMP_PREC_CUTOFF       15      /** Precedence cut off   */
>> +#define NR_ICMP_UNREACH                15      /** instead of hardcoding
>> immediate value */
>>
>
> Should NR_ICMP_UNREACH be 16?
>
> ​No it is 15.​

>
>
>
>  +
>> +/** Codes for REDIRECT. */
>> +#define ICMP_REDIR_NET         0       /** Redirect Net                */
>> +#define ICMP_REDIR_HOST                1       /** Redirect Host
>>       */
>>
> is here double tab? 1 in not in the same column that 0, 2,3.
>
>  +#define ICMP_REDIR_NETTOS      2       /** Redirect Net for TOS        */
>> +#define ICMP_REDIR_HOSTTOS     3       /** Redirect Host for TOS       */
>> +
>> +/** Codes for TIME_EXCEEDED. */
>> +#define ICMP_EXC_TTL           0       /** TTL count exceeded          */
>> +#define ICMP_EXC_FRAGTIME      1       /** Fragment Reass time exceeded
>>        */
>> +
>> +/** @internal Compile time assert */
>> +ODP_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN,
>> ODP_ICMPHDR_T__SIZE_ERROR);
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif
>>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov April 23, 2014, 2:45 p.m. UTC | #3
On 04/23/2014 07:19 AM, Weilong Chen wrote:
>
>
>
> On 21 April 2014 22:18, Maxim Uvarov <maxim.uvarov@linaro.org 
> <mailto:maxim.uvarov@linaro.org>> wrote:
>
>     On 04/21/2014 01:15 PM, Weilong Chen wrote:
>
>         Signed-off-by: Weilong Chen <weilong.chen@linaro.org
>         <mailto:weilong.chen@linaro.org>>
>         ---
>           include/helper/odp_icmp.h |   97
>         +++++++++++++++++++++++++++++++++++++++++++++
>           1 file changed, 97 insertions(+)
>           create mode 100644 include/helper/odp_icmp.h
>
>         diff --git a/include/helper/odp_icmp.h b/include/helper/odp_icmp.h
>         new file mode 100644
>         index 0000000..bfa356d
>         --- /dev/null
>         +++ b/include/helper/odp_icmp.h
>         @@ -0,0 +1,97 @@
>         +/* Copyright (c) 2014, Linaro Limited
>         + * All rights reserved.
>         + *
>         + * SPDX-License-Identifier: BSD-3-Clause
>         + */
>         +
>         +
>         +/**
>         + * @file
>         + *
>         + * ODP ICMP header
>         + */
>         +
>         +#ifndef ODP_ICMP_H_
>         +#define ODP_ICMP_H_
>         +
>         +#ifdef __cplusplus
>         +extern "C" {
>         +#endif
>         +
>         +#include <odp_align.h>
>         +#include <odp_debug.h>
>         +#include <odp_byteorder.h>
>         +
>         +/** ICMP header length */
>         +#define ODP_ICMPHDR_LEN 8
>         +
>         +/** ICMP header */
>         +typedef struct ODP_PACKED {
>         +       uint8_t type;           /** message type */
>         +       uint8_t code;           /** type sub-code */
>         +       uint16be_t chksum;
>         +       union {
>         +               struct {
>         +                       uint16be_t id;
>         +                       uint16be_t sequence;
>         +               } echo;                 /** echo datagram */
>         +               uint32be_t gateway;     /** gateway address */
>         +               struct {
>         +                       uint16be_t __unused;
>         +                       uint16be_t mtu;
>         +               } frag;                 /** path mtu discovery */
>         +       } un;
>         +} odp_icmphdr_t;
>         +
>         +#define ICMP_ECHOREPLY         0       /** Echo Reply        
>                  */
>         +#define ICMP_DEST_UNREACH      3       /** Destination
>         Unreachable     */
>         +#define ICMP_SOURCE_QUENCH     4       /** Source Quench    
>                   */
>         +#define ICMP_REDIRECT          5       /** Redirect (change
>         route)     */
>         +#define ICMP_ECHO              8       /** Echo Request      
>                  */
>         +#define ICMP_TIME_EXCEEDED     11      /** Time Exceeded    
>                   */
>         +#define ICMP_PARAMETERPROB     12      /** Parameter Problem
>                   */
>         +#define ICMP_TIMESTAMP         13      /** Timestamp Request
>                   */
>         +#define ICMP_TIMESTAMPREPLY    14      /** Timestamp Reply  
>                   */
>         +#define ICMP_INFO_REQUEST      15      /** Information
>         Request         */
>         +#define ICMP_INFO_REPLY                16      /**
>         Information Reply           */
>
>     tabulation here.
>
> ​Sorry, I didn't get you.​
> ​I use checkpatch, and doesn't get a warning.
> And set tab = 8,​ it looks good to me.

here you set 2 tabs, everything else 1 tab.

So indent for that line does not match.  I see it in vim. Or you can see 
it in patchwork:
https://patches.linaro.org/28668/

Maxim.

>
>         +#define ICMP_ADDRESS           17      /** Address Mask
>         Request        */
>         +#define ICMP_ADDRESSREPLY      18      /** Address Mask Reply
>                  */
>         +#define NR_ICMP_TYPES          18
>         +
>         +/** Codes for UNREACH. */
>         +#define ICMP_NET_UNREACH       0       /** Network
>         Unreachable         */
>         +#define ICMP_HOST_UNREACH      1       /** Host Unreachable  
>                  */
>         +#define ICMP_PROT_UNREACH      2       /** Protocol
>         Unreachable        */
>         +#define ICMP_PORT_UNREACH      3       /** Port Unreachable  
>                  */
>         +#define ICMP_FRAG_NEEDED       4       /** Fragmentation
>         Needed/DF set */
>         +#define ICMP_SR_FAILED         5       /** Source Route
>         failed         */
>         +#define ICMP_NET_UNKNOWN       6
>         +#define ICMP_HOST_UNKNOWN      7
>         +#define ICMP_HOST_ISOLATED     8
>         +#define ICMP_NET_ANO           9
>         +#define ICMP_HOST_ANO          10
>         +#define ICMP_NET_UNR_TOS       11
>         +#define ICMP_HOST_UNR_TOS      12
>         +#define ICMP_PKT_FILTERED      13      /** Packet filtered  
>            */
>         +#define ICMP_PREC_VIOLATION    14      /** Precedence
>         violation */
>         +#define ICMP_PREC_CUTOFF       15      /** Precedence cut off
>           */
>         +#define NR_ICMP_UNREACH                15      /** instead of
>         hardcoding immediate value */
>
>
>     Should NR_ICMP_UNREACH be 16?
>
> ​No it is 15.​
>
>
>
>
>         +
>         +/** Codes for REDIRECT. */
>         +#define ICMP_REDIR_NET         0       /** Redirect Net      
>                  */
>         +#define ICMP_REDIR_HOST                1       /** Redirect
>         Host               */
>
>     is here double tab? 1 in not in the same column that 0, 2,3.
>
>         +#define ICMP_REDIR_NETTOS      2       /** Redirect Net for
>         TOS        */
>         +#define ICMP_REDIR_HOSTTOS     3       /** Redirect Host for
>         TOS       */
>         +
>         +/** Codes for TIME_EXCEEDED. */
>         +#define ICMP_EXC_TTL           0       /** TTL count exceeded
>                  */
>         +#define ICMP_EXC_FRAGTIME      1       /** Fragment Reass
>         time exceeded        */
>         +
>         +/** @internal Compile time assert */
>         +ODP_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN,
>         ODP_ICMPHDR_T__SIZE_ERROR);
>         +
>         +#ifdef __cplusplus
>         +}
>         +#endif
>         +
>         +#endif
>
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
Weilong Chen April 24, 2014, 6:52 a.m. UTC | #4
On 23 April 2014 22:45, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 04/23/2014 07:19 AM, Weilong Chen wrote:
>
>>
>>
>>
>> On 21 April 2014 22:18, Maxim Uvarov <maxim.uvarov@linaro.org <mailto:
>> maxim.uvarov@linaro.org>> wrote:
>>
>>     On 04/21/2014 01:15 PM, Weilong Chen wrote:
>>
>>         Signed-off-by: Weilong Chen <weilong.chen@linaro.org
>>         <mailto:weilong.chen@linaro.org>>
>>
>>         ---
>>           include/helper/odp_icmp.h |   97
>>         +++++++++++++++++++++++++++++++++++++++++++++
>>           1 file changed, 97 insertions(+)
>>           create mode 100644 include/helper/odp_icmp.h
>>
>>         diff --git a/include/helper/odp_icmp.h b/include/helper/odp_icmp.h
>>         new file mode 100644
>>         index 0000000..bfa356d
>>         --- /dev/null
>>         +++ b/include/helper/odp_icmp.h
>>         @@ -0,0 +1,97 @@
>>         +/* Copyright (c) 2014, Linaro Limited
>>         + * All rights reserved.
>>         + *
>>         + * SPDX-License-Identifier: BSD-3-Clause
>>         + */
>>         +
>>         +
>>         +/**
>>         + * @file
>>         + *
>>         + * ODP ICMP header
>>         + */
>>         +
>>         +#ifndef ODP_ICMP_H_
>>         +#define ODP_ICMP_H_
>>         +
>>         +#ifdef __cplusplus
>>         +extern "C" {
>>         +#endif
>>         +
>>         +#include <odp_align.h>
>>         +#include <odp_debug.h>
>>         +#include <odp_byteorder.h>
>>         +
>>         +/** ICMP header length */
>>         +#define ODP_ICMPHDR_LEN 8
>>         +
>>         +/** ICMP header */
>>         +typedef struct ODP_PACKED {
>>         +       uint8_t type;           /** message type */
>>         +       uint8_t code;           /** type sub-code */
>>         +       uint16be_t chksum;
>>         +       union {
>>         +               struct {
>>         +                       uint16be_t id;
>>         +                       uint16be_t sequence;
>>         +               } echo;                 /** echo datagram */
>>         +               uint32be_t gateway;     /** gateway address */
>>         +               struct {
>>         +                       uint16be_t __unused;
>>         +                       uint16be_t mtu;
>>         +               } frag;                 /** path mtu discovery */
>>         +       } un;
>>         +} odp_icmphdr_t;
>>         +
>>         +#define ICMP_ECHOREPLY         0       /** Echo Reply
>>               */
>>         +#define ICMP_DEST_UNREACH      3       /** Destination
>>         Unreachable     */
>>         +#define ICMP_SOURCE_QUENCH     4       /** Source Quench
>>              */
>>         +#define ICMP_REDIRECT          5       /** Redirect (change
>>         route)     */
>>         +#define ICMP_ECHO              8       /** Echo Request
>>               */
>>         +#define ICMP_TIME_EXCEEDED     11      /** Time Exceeded
>>              */
>>         +#define ICMP_PARAMETERPROB     12      /** Parameter Problem
>>                   */
>>         +#define ICMP_TIMESTAMP         13      /** Timestamp Request
>>                   */
>>         +#define ICMP_TIMESTAMPREPLY    14      /** Timestamp Reply
>>              */
>>         +#define ICMP_INFO_REQUEST      15      /** Information
>>         Request         */
>>         +#define ICMP_INFO_REPLY                16      /**
>>         Information Reply           */
>>
>>     tabulation here.
>>
>> ​Sorry, I didn't get you.​
>> ​I use checkpatch, and doesn't get a warning.
>> And set tab = 8,​ it looks good to me.
>>
>
> here you set 2 tabs, everything else 1 tab.
>
Several lines such as #define ICMP_HOST_ANO and #define ICMP_HOST_ANO has 2
tabs.

>
> So indent for that line does not match.  I see it in vim. Or you can see
> it in patchwork:
> https://patches.linaro.org/28668/
>
> Maxim.
>
> ​I see it.Very strange.
Can you git am this path, and open include/helper/odp_icmp.h by vim
to see if there's a indent problem ?
If so, I will resend this patch

Thanks!​

>
>>         +#define ICMP_ADDRESS           17      /** Address Mask
>>         Request        */
>>         +#define ICMP_ADDRESSREPLY      18      /** Address Mask Reply
>>                  */
>>         +#define NR_ICMP_TYPES          18
>>         +
>>         +/** Codes for UNREACH. */
>>         +#define ICMP_NET_UNREACH       0       /** Network
>>         Unreachable         */
>>         +#define ICMP_HOST_UNREACH      1       /** Host Unreachable
>>               */
>>         +#define ICMP_PROT_UNREACH      2       /** Protocol
>>         Unreachable        */
>>         +#define ICMP_PORT_UNREACH      3       /** Port Unreachable
>>               */
>>         +#define ICMP_FRAG_NEEDED       4       /** Fragmentation
>>         Needed/DF set */
>>         +#define ICMP_SR_FAILED         5       /** Source Route
>>         failed         */
>>         +#define ICMP_NET_UNKNOWN       6
>>         +#define ICMP_HOST_UNKNOWN      7
>>         +#define ICMP_HOST_ISOLATED     8
>>         +#define ICMP_NET_ANO           9
>>         +#define ICMP_HOST_ANO          10
>>         +#define ICMP_NET_UNR_TOS       11
>>         +#define ICMP_HOST_UNR_TOS      12
>>         +#define ICMP_PKT_FILTERED      13      /** Packet filtered
>>       */
>>         +#define ICMP_PREC_VIOLATION    14      /** Precedence
>>         violation */
>>         +#define ICMP_PREC_CUTOFF       15      /** Precedence cut off
>>           */
>>         +#define NR_ICMP_UNREACH                15      /** instead of
>>         hardcoding immediate value */
>>
>>
>>     Should NR_ICMP_UNREACH be 16?
>>
>> ​No it is 15.​
>>
>>
>>
>>
>>         +
>>         +/** Codes for REDIRECT. */
>>         +#define ICMP_REDIR_NET         0       /** Redirect Net
>>               */
>>         +#define ICMP_REDIR_HOST                1       /** Redirect
>>         Host               */
>>
>>     is here double tab? 1 in not in the same column that 0, 2,3.
>>
>>         +#define ICMP_REDIR_NETTOS      2       /** Redirect Net for
>>         TOS        */
>>         +#define ICMP_REDIR_HOSTTOS     3       /** Redirect Host for
>>         TOS       */
>>         +
>>         +/** Codes for TIME_EXCEEDED. */
>>         +#define ICMP_EXC_TTL           0       /** TTL count exceeded
>>                  */
>>         +#define ICMP_EXC_FRAGTIME      1       /** Fragment Reass
>>         time exceeded        */
>>         +
>>         +/** @internal Compile time assert */
>>         +ODP_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN,
>>         ODP_ICMPHDR_T__SIZE_ERROR);
>>         +
>>         +#ifdef __cplusplus
>>         +}
>>         +#endif
>>         +
>>         +#endif
>>
>>
>>
>>     _______________________________________________
>>     lng-odp mailing list
>>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>     http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>
Weilong Chen April 24, 2014, 7:13 a.m. UTC | #5
Maybe it's the '+' on the patchwork makes this problem.
strlen(#define NR_ICMP_UNREACH) = 23,there's only 1 byte
left for 3 tabs(24 byte).


On 24 April 2014 14:52, Weilong Chen <weilong.chen@linaro.org> wrote:

>
>
>
> On 23 April 2014 22:45, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>
>> On 04/23/2014 07:19 AM, Weilong Chen wrote:
>>
>>>
>>>
>>>
>>> On 21 April 2014 22:18, Maxim Uvarov <maxim.uvarov@linaro.org <mailto:
>>> maxim.uvarov@linaro.org>> wrote:
>>>
>>>     On 04/21/2014 01:15 PM, Weilong Chen wrote:
>>>
>>>         Signed-off-by: Weilong Chen <weilong.chen@linaro.org
>>>         <mailto:weilong.chen@linaro.org>>
>>>
>>>         ---
>>>           include/helper/odp_icmp.h |   97
>>>         +++++++++++++++++++++++++++++++++++++++++++++
>>>           1 file changed, 97 insertions(+)
>>>           create mode 100644 include/helper/odp_icmp.h
>>>
>>>         diff --git a/include/helper/odp_icmp.h
>>> b/include/helper/odp_icmp.h
>>>         new file mode 100644
>>>         index 0000000..bfa356d
>>>         --- /dev/null
>>>         +++ b/include/helper/odp_icmp.h
>>>         @@ -0,0 +1,97 @@
>>>         +/* Copyright (c) 2014, Linaro Limited
>>>         + * All rights reserved.
>>>         + *
>>>         + * SPDX-License-Identifier: BSD-3-Clause
>>>         + */
>>>         +
>>>         +
>>>         +/**
>>>         + * @file
>>>         + *
>>>         + * ODP ICMP header
>>>         + */
>>>         +
>>>         +#ifndef ODP_ICMP_H_
>>>         +#define ODP_ICMP_H_
>>>         +
>>>         +#ifdef __cplusplus
>>>         +extern "C" {
>>>         +#endif
>>>         +
>>>         +#include <odp_align.h>
>>>         +#include <odp_debug.h>
>>>         +#include <odp_byteorder.h>
>>>         +
>>>         +/** ICMP header length */
>>>         +#define ODP_ICMPHDR_LEN 8
>>>         +
>>>         +/** ICMP header */
>>>         +typedef struct ODP_PACKED {
>>>         +       uint8_t type;           /** message type */
>>>         +       uint8_t code;           /** type sub-code */
>>>         +       uint16be_t chksum;
>>>         +       union {
>>>         +               struct {
>>>         +                       uint16be_t id;
>>>         +                       uint16be_t sequence;
>>>         +               } echo;                 /** echo datagram */
>>>         +               uint32be_t gateway;     /** gateway address */
>>>         +               struct {
>>>         +                       uint16be_t __unused;
>>>         +                       uint16be_t mtu;
>>>         +               } frag;                 /** path mtu discovery */
>>>         +       } un;
>>>         +} odp_icmphdr_t;
>>>         +
>>>         +#define ICMP_ECHOREPLY         0       /** Echo Reply
>>>               */
>>>         +#define ICMP_DEST_UNREACH      3       /** Destination
>>>         Unreachable     */
>>>         +#define ICMP_SOURCE_QUENCH     4       /** Source Quench
>>>                */
>>>         +#define ICMP_REDIRECT          5       /** Redirect (change
>>>         route)     */
>>>         +#define ICMP_ECHO              8       /** Echo Request
>>>               */
>>>         +#define ICMP_TIME_EXCEEDED     11      /** Time Exceeded
>>>                */
>>>         +#define ICMP_PARAMETERPROB     12      /** Parameter Problem
>>>                   */
>>>         +#define ICMP_TIMESTAMP         13      /** Timestamp Request
>>>                   */
>>>         +#define ICMP_TIMESTAMPREPLY    14      /** Timestamp Reply
>>>                */
>>>         +#define ICMP_INFO_REQUEST      15      /** Information
>>>         Request         */
>>>         +#define ICMP_INFO_REPLY                16      /**
>>>         Information Reply           */
>>>
>>>     tabulation here.
>>>
>>> ​Sorry, I didn't get you.​
>>> ​I use checkpatch, and doesn't get a warning.
>>> And set tab = 8,​ it looks good to me.
>>>
>>
>> here you set 2 tabs, everything else 1 tab.
>>
> Several lines such as #define ICMP_HOST_ANO and #define ICMP_HOST_ANO has
> 2 tabs.
>
>>
>> So indent for that line does not match.  I see it in vim. Or you can see
>> it in patchwork:
>> https://patches.linaro.org/28668/
>>
>> Maxim.
>>
>> ​I see it.Very strange.
> Can you git am this path, and open include/helper/odp_icmp.h by vim
> to see if there's a indent problem ?
> If so, I will resend this patch
>
> Thanks!​
>
>>
>>>         +#define ICMP_ADDRESS           17      /** Address Mask
>>>         Request        */
>>>         +#define ICMP_ADDRESSREPLY      18      /** Address Mask Reply
>>>                  */
>>>         +#define NR_ICMP_TYPES          18
>>>         +
>>>         +/** Codes for UNREACH. */
>>>         +#define ICMP_NET_UNREACH       0       /** Network
>>>         Unreachable         */
>>>         +#define ICMP_HOST_UNREACH      1       /** Host Unreachable
>>>               */
>>>         +#define ICMP_PROT_UNREACH      2       /** Protocol
>>>         Unreachable        */
>>>         +#define ICMP_PORT_UNREACH      3       /** Port Unreachable
>>>               */
>>>         +#define ICMP_FRAG_NEEDED       4       /** Fragmentation
>>>         Needed/DF set */
>>>         +#define ICMP_SR_FAILED         5       /** Source Route
>>>         failed         */
>>>         +#define ICMP_NET_UNKNOWN       6
>>>         +#define ICMP_HOST_UNKNOWN      7
>>>         +#define ICMP_HOST_ISOLATED     8
>>>         +#define ICMP_NET_ANO           9
>>>         +#define ICMP_HOST_ANO          10
>>>         +#define ICMP_NET_UNR_TOS       11
>>>         +#define ICMP_HOST_UNR_TOS      12
>>>         +#define ICMP_PKT_FILTERED      13      /** Packet filtered
>>>         */
>>>         +#define ICMP_PREC_VIOLATION    14      /** Precedence
>>>         violation */
>>>         +#define ICMP_PREC_CUTOFF       15      /** Precedence cut off
>>>           */
>>>         +#define NR_ICMP_UNREACH                15      /** instead of
>>>         hardcoding immediate value */
>>>
>>>
>>>     Should NR_ICMP_UNREACH be 16?
>>>
>>> ​No it is 15.​
>>>
>>>
>>>
>>>
>>>         +
>>>         +/** Codes for REDIRECT. */
>>>         +#define ICMP_REDIR_NET         0       /** Redirect Net
>>>               */
>>>         +#define ICMP_REDIR_HOST                1       /** Redirect
>>>         Host               */
>>>
>>>     is here double tab? 1 in not in the same column that 0, 2,3.
>>>
>>>         +#define ICMP_REDIR_NETTOS      2       /** Redirect Net for
>>>         TOS        */
>>>         +#define ICMP_REDIR_HOSTTOS     3       /** Redirect Host for
>>>         TOS       */
>>>         +
>>>         +/** Codes for TIME_EXCEEDED. */
>>>         +#define ICMP_EXC_TTL           0       /** TTL count exceeded
>>>                  */
>>>         +#define ICMP_EXC_FRAGTIME      1       /** Fragment Reass
>>>         time exceeded        */
>>>         +
>>>         +/** @internal Compile time assert */
>>>         +ODP_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN,
>>>         ODP_ICMPHDR_T__SIZE_ERROR);
>>>         +
>>>         +#ifdef __cplusplus
>>>         +}
>>>         +#endif
>>>         +
>>>         +#endif
>>>
>>>
>>>
>>>     _______________________________________________
>>>     lng-odp mailing list
>>>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>>     http://lists.linaro.org/mailman/listinfo/lng-odp
>>>
>>>
>>>
>>
>
Maxim Uvarov April 24, 2014, 8:25 a.m. UTC | #6
On 04/24/2014 11:13 AM, Weilong Chen wrote:
>
>
> ​I see it.Very strange.
> Can you git am this path, and open include/helper/odp_icmp.h by vim
> to see if there's a indent problem ?
> If so, I will resend this patch
>
> Thanks!​
yes, looks like it's some patch issue. Source after applyng looks good.

Applied.

Thanks,
Maxim.
diff mbox

Patch

diff --git a/include/helper/odp_icmp.h b/include/helper/odp_icmp.h
new file mode 100644
index 0000000..bfa356d
--- /dev/null
+++ b/include/helper/odp_icmp.h
@@ -0,0 +1,97 @@ 
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:		 BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP ICMP header
+ */
+
+#ifndef ODP_ICMP_H_
+#define ODP_ICMP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp_align.h>
+#include <odp_debug.h>
+#include <odp_byteorder.h>
+
+/** ICMP header length */
+#define ODP_ICMPHDR_LEN 8
+
+/** ICMP header */
+typedef struct ODP_PACKED {
+	uint8_t type;		/** message type */
+	uint8_t code;		/** type sub-code */
+	uint16be_t chksum;
+	union {
+		struct {
+			uint16be_t id;
+			uint16be_t sequence;
+		} echo;			/** echo datagram */
+		uint32be_t gateway;	/** gateway address */
+		struct {
+			uint16be_t __unused;
+			uint16be_t mtu;
+		} frag;			/** path mtu discovery */
+	} un;
+} odp_icmphdr_t;
+
+#define ICMP_ECHOREPLY		0	/** Echo Reply			*/
+#define ICMP_DEST_UNREACH	3	/** Destination Unreachable	*/
+#define ICMP_SOURCE_QUENCH	4	/** Source Quench		*/
+#define ICMP_REDIRECT		5	/** Redirect (change route)	*/
+#define ICMP_ECHO		8	/** Echo Request		*/
+#define ICMP_TIME_EXCEEDED	11	/** Time Exceeded		*/
+#define ICMP_PARAMETERPROB	12	/** Parameter Problem		*/
+#define ICMP_TIMESTAMP		13	/** Timestamp Request		*/
+#define ICMP_TIMESTAMPREPLY	14	/** Timestamp Reply		*/
+#define ICMP_INFO_REQUEST	15	/** Information Request		*/
+#define ICMP_INFO_REPLY		16	/** Information Reply		*/
+#define ICMP_ADDRESS		17	/** Address Mask Request	*/
+#define ICMP_ADDRESSREPLY	18	/** Address Mask Reply		*/
+#define NR_ICMP_TYPES		18
+
+/** Codes for UNREACH. */
+#define ICMP_NET_UNREACH	0	/** Network Unreachable		*/
+#define ICMP_HOST_UNREACH	1	/** Host Unreachable		*/
+#define ICMP_PROT_UNREACH	2	/** Protocol Unreachable	*/
+#define ICMP_PORT_UNREACH	3	/** Port Unreachable		*/
+#define ICMP_FRAG_NEEDED	4	/** Fragmentation Needed/DF set	*/
+#define ICMP_SR_FAILED		5	/** Source Route failed		*/
+#define ICMP_NET_UNKNOWN	6
+#define ICMP_HOST_UNKNOWN	7
+#define ICMP_HOST_ISOLATED	8
+#define ICMP_NET_ANO		9
+#define ICMP_HOST_ANO		10
+#define ICMP_NET_UNR_TOS	11
+#define ICMP_HOST_UNR_TOS	12
+#define ICMP_PKT_FILTERED	13	/** Packet filtered	 */
+#define ICMP_PREC_VIOLATION	14	/** Precedence violation */
+#define ICMP_PREC_CUTOFF	15	/** Precedence cut off   */
+#define NR_ICMP_UNREACH		15	/** instead of hardcoding immediate value */
+
+/** Codes for REDIRECT. */
+#define ICMP_REDIR_NET		0	/** Redirect Net		*/
+#define ICMP_REDIR_HOST		1	/** Redirect Host		*/
+#define ICMP_REDIR_NETTOS	2	/** Redirect Net for TOS	*/
+#define ICMP_REDIR_HOSTTOS	3	/** Redirect Host for TOS	*/
+
+/** Codes for TIME_EXCEEDED. */
+#define ICMP_EXC_TTL		0	/** TTL count exceeded		*/
+#define ICMP_EXC_FRAGTIME	1	/** Fragment Reass time exceeded	*/
+
+/** @internal Compile time assert */
+ODP_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN, ODP_ICMPHDR_T__SIZE_ERROR);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif