Hi,

ODP/ODPH prefixes are needed always. First to make it clear what comes ODP/ODP 
helper, and secondly to avoid name space collisions (e.g. with 
linux/posix/application files that define similar things).

-Petri


> -----Original Message-----
> From: [email protected] [mailto:lng-odp-
> [email protected]] On Behalf Of ext Maxim Uvarov
> Sent: Friday, August 29, 2014 1:36 PM
> To: [email protected]
> Subject: Re: [lng-odp] [PATCH 2/2] odph_icmp: add ODPH_ prefix
> 
> I think we do not need to rename defines.  For example
> 
> #define ICMP_ECHOREPLY                0       /**< Echo Reply                 
> */
> 
> is always ICMP_ECHOREPLY and is always 0. I suppose that defines were
> copied from
> some header file. And my opinion that we should have them as is, not
> implementing new
> names.
> 
> For helper functions odph_ prefix is ok. But for standard defines it
> look a little ugly.
> 
> Best regards,
> Maxim.
> 
> On 08/29/2014 02:02 AM, Anders Roxell wrote:
> > Signed-off-by: Anders Roxell <[email protected]>
> > ---
> >   example/generator/odp_generator.c   |  6 +--
> >   helper/include/odph_chksum.h        |  2 +-
> >   helper/include/odph_eth.h           |  2 +-
> >   helper/include/odph_icmp.h          | 79 ++++++++++++++++++-----------
> --------
> >   helper/include/odph_ip.h            |  2 +-
> >   helper/include/odph_linux.h         |  2 +-
> >   helper/include/odph_packet_helper.h |  2 +-
> >   helper/include/odph_ring.h          |  2 +-
> >   8 files changed, 48 insertions(+), 49 deletions(-)
> >
> > diff --git a/example/generator/odp_generator.c
> b/example/generator/odp_generator.c
> > index 70c0353..246bccf 100644
> > --- a/example/generator/odp_generator.c
> > +++ b/example/generator/odp_generator.c
> > @@ -264,7 +264,7 @@ static void pack_icmp_pkt(odp_buffer_t obuf)
> >     odph_ipv4_csum_update(pkt);
> >     /* icmp */
> >     icmp = (odph_icmphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN);
> > -   icmp->type = ICMP_ECHO;
> > +   icmp->type = ODPH_ICMP_ECHO;
> >     icmp->code = 0;
> >     icmp->un.echo.id = 0;
> >     icmp->un.echo.sequence = ip->id;
> > @@ -419,7 +419,7 @@ static void print_pkts(int thr, odp_packet_t
> pkt_tbl[], unsigned len)
> >             if (ip->proto == ODPH_IPPROTO_ICMP) {
> >                     icmp = (odph_icmphdr_t *)(buf + offset);
> >                     /* echo reply */
> > -                   if (icmp->type == ICMP_ECHOREPLY) {
> > +                   if (icmp->type == ODPH_ICMP_ECHOREPLY) {
> >                             odp_atomic_inc_u64(&counters.icmp);
> >                             memcpy(&tvsend, buf + offset + ODPH_ICMPHDR_LEN,
> >                                    sizeof(struct timeval));
> > @@ -432,7 +432,7 @@ static void print_pkts(int thr, odp_packet_t
> pkt_tbl[], unsigned len)
> >                                     "ICMP Echo Reply seq %d time %.1f ",
> >                                     odp_be_to_cpu_16(icmp->un.echo.sequence)
> >                                     , rtt);
> > -                   } else if (icmp->type == ICMP_ECHO) {
> > +                   } else if (icmp->type == ODPH_ICMP_ECHO) {
> >                             rlen += sprintf(msg + rlen,
> >                                             "Icmp Echo Request");
> >                     }
> > diff --git a/helper/include/odph_chksum.h b/helper/include/odph_chksum.h
> > index 710711a..3bcc2b6 100644
> > --- a/helper/include/odph_chksum.h
> > +++ b/helper/include/odph_chksum.h
> > @@ -8,7 +8,7 @@
> >   /**
> >    * @file
> >    *
> > - * ODP Checksum
> > + * ODPH Checksum
> >    */
> >   #ifndef ODP_CHKSUM_H_
> >   #define ODP_CHKSUM_H_
> > diff --git a/helper/include/odph_eth.h b/helper/include/odph_eth.h
> > index 55a2b1e..45f7fea 100644
> > --- a/helper/include/odph_eth.h
> > +++ b/helper/include/odph_eth.h
> > @@ -8,7 +8,7 @@
> >   /**
> >    * @file
> >    *
> > - * ODP ethernet header
> > + * ODPH ethernet header
> >    */
> >
> >   #ifndef ODPH_ETH_H_
> > diff --git a/helper/include/odph_icmp.h b/helper/include/odph_icmp.h
> > index 8414d7e..622f48b 100644
> > --- a/helper/include/odph_icmp.h
> > +++ b/helper/include/odph_icmp.h
> > @@ -8,7 +8,7 @@
> >   /**
> >    * @file
> >    *
> > - * ODP ICMP header
> > + * ODPH ICMP header
> >    */
> >
> >   #ifndef ODPH_ICMP_H_
> > @@ -43,51 +43,50 @@ typedef struct ODPH_PACKED {
> >     } un;                   /**< icmp sub header */
> >   } odph_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      /**< Number of icmp types       
> > */
> > +#define ODPH_ICMP_ECHOREPLY                0  /**< Echo Reply */
> > +#define ODPH_ICMP_DEST_UNREACH             3  /**< Destination Unreachable
> */
> > +#define ODPH_ICMP_SOURCE_QUENCH            4  /**< Source Quench */
> > +#define ODPH_ICMP_REDIRECT         5  /**< Redirect (change route) */
> > +#define ODPH_ICMP_ECHO                     8  /**< Echo Request */
> > +#define ODPH_ICMP_TIME_EXCEEDED            11 /**< Time Exceeded */
> > +#define ODPH_ICMP_PARAMETERPROB            12 /**< Parameter Problem */
> > +#define ODPH_ICMP_TIMESTAMP                13 /**< Timestamp Request */
> > +#define ODPH_ICMP_TIMESTAMPREPLY   14 /**< Timestamp Reply */
> > +#define ODPH_ICMP_INFO_REQUEST             15 /**< Information Request */
> > +#define ODPH_ICMP_INFO_REPLY               16 /**< Information Reply */
> > +#define ODPH_ICMP_ADDRESS          17 /**< Address Mask Request */
> > +#define ODPH_ICMP_ADDRESSREPLY             18 /**< Address Mask Reply */
> > +#define ODPH_NR_ICMP_TYPES         18 /**< Number of icmp types */
> >
> >   /** 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       /**< Network Unknown            */
> > -#define ICMP_HOST_UNKNOWN  7       /**< Host Unknown               */
> > -#define ICMP_HOST_ISOLATED 8       /**< Host Isolated              */
> > -#define ICMP_NET_ANO               9       /**< ICMP_NET_ANO               
> > */
> > -#define ICMP_HOST_ANO              10      /**< ICMP_HOST_ANO              
> > */
> > -#define ICMP_NET_UNR_TOS   11      /**< ICMP_NET_UNR_TOS           */
> > -#define ICMP_HOST_UNR_TOS  12      /**< ICMP_HOST_UNR_TOS          */
> > -#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 */
> > +#define ODPH_ICMP_NET_UNREACH              0  /**< Network Unreachable */
> > +#define ODPH_ICMP_HOST_UNREACH             1  /**< Host Unreachable */
> > +#define ODPH_ICMP_PROT_UNREACH             2  /**< Protocol Unreachable */
> > +#define ODPH_ICMP_PORT_UNREACH             3  /**< Port Unreachable */
> > +#define ODPH_ICMP_FRAG_NEEDED              4  /**< Fragmentation Needed/DF
> set */
> > +#define ODPH_ICMP_SR_FAILED                5  /**< Source Route failed */
> > +#define ODPH_ICMP_NET_UNKNOWN              6  /**< Network Unknown */
> > +#define ODPH_ICMP_HOST_UNKNOWN             7  /**< Host Unknown */
> > +#define ODPH_ICMP_HOST_ISOLATED            8  /**< Host Isolated */
> > +#define ODPH_ICMP_NET_ANO          9  /**< ICMP_NET_ANO */
> > +#define ODPH_ICMP_HOST_ANO         10 /**< ICMP_HOST_ANO */
> > +#define ODPH_ICMP_NET_UNR_TOS              11 /**< ICMP_NET_UNR_TOS */
> > +#define ODPH_ICMP_HOST_UNR_TOS             12 /**< ICMP_HOST_UNR_TOS */
> > +#define ODPH_ICMP_PKT_FILTERED             13 /**< Packet filtered */
> > +#define ODPH_ICMP_PREC_VIOLATION   14 /**< Precedence violation */
> > +#define ODPH_ICMP_PREC_CUTOFF              15 /**< Precedence cut off */
> > +#define ODPH_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      */
> > +#define ODPH_ICMP_REDIR_NET                0  /**< Redirect Net */
> > +#define ODPH_ICMP_REDIR_HOST               1  /**< Redirect Host */
> > +#define ODPH_ICMP_REDIR_NETTOS             2  /**< Redirect Net for TOS */
> > +#define ODPH_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*/
> > +#define ODPH_ICMP_EXC_TTL          0  /**< TTL count exceeded */
> > +#define ODPH_ICMP_EXC_FRAGTIME             1  /**< Fragment Reass time
> exceeded*/
> >
> >   /** @internal Compile time assert */
> >   ODP_STATIC_ASSERT(sizeof(odph_icmphdr_t) == ODPH_ICMPHDR_LEN,
> "ODPH_ICMPHDR_T__SIZE_ERROR");
> > diff --git a/helper/include/odph_ip.h b/helper/include/odph_ip.h
> > index ca71c44..4fb9c12 100644
> > --- a/helper/include/odph_ip.h
> > +++ b/helper/include/odph_ip.h
> > @@ -8,7 +8,7 @@
> >   /**
> >    * @file
> >    *
> > - * ODP IP header
> > + * ODPH IP header
> >    */
> >
> >   #ifndef ODPH_IP_H_
> > diff --git a/helper/include/odph_linux.h b/helper/include/odph_linux.h
> > index 1ea349a..be91dd3 100644
> > --- a/helper/include/odph_linux.h
> > +++ b/helper/include/odph_linux.h
> > @@ -8,7 +8,7 @@
> >   /**
> >    * @file
> >    *
> > - * ODP Linux helper API
> > + * ODPH Linux helper API
> >    *
> >    * This file is an optional helper to odp.h APIs. Application can
> manage
> >    * pthreads also by other means.
> > diff --git a/helper/include/odph_packet_helper.h
> b/helper/include/odph_packet_helper.h
> > index c18f48d..c5315a9 100644
> > --- a/helper/include/odph_packet_helper.h
> > +++ b/helper/include/odph_packet_helper.h
> > @@ -8,7 +8,7 @@
> >   /**
> >    * @file
> >    *
> > - * Optional ODP packet helper functions
> > + * Optional ODPH packet helper functions
> >    */
> >
> >   #ifndef ODPH_PACKET_HELPER_H_
> > diff --git a/helper/include/odph_ring.h b/helper/include/odph_ring.h
> > index 76c1db8..82d2d13 100644
> > --- a/helper/include/odph_ring.h
> > +++ b/helper/include/odph_ring.h
> > @@ -192,7 +192,7 @@ typedef struct odph_ring {
> >    *    - ENOMEM - no appropriate memory area found in which to create
> memzone
> >    */
> >   odph_ring_t *odph_ring_create(const char *name, unsigned count,
> > -                       unsigned flags);
> > +                         unsigned flags);
> >
> >
> >   /**
> 
> 
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to