Re: [lng-odp] [API-NEXT PATCHv2] api: pktio link

2015-10-15 Thread Brian Brooks
On Tue, Oct 13, 2015 at 03:39:29PM +0300, Maxim Uvarov wrote:
> Define API to get pktio link state: seed, autoneg, link up/down,
> duplex, started/stopped state.
>
> Signed-off-by: Maxim Uvarov 
> ---
>  v2: - use simple struct to return pktio link state;
>  - odp will not modify link, only ready it's state;
>
>
>  include/odp/api/packet_io.h | 22 ++
>  1 file changed, 22 insertions(+)
>
> diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
> index d8e69ed..6c77e8d 100644
> --- a/include/odp/api/packet_io.h
> +++ b/include/odp/api/packet_io.h
> @@ -96,6 +96,28 @@ typedef struct odp_pktio_param_t {
>  } odp_pktio_param_t;
>
>  /**
> + * Packet IO link state information
> + */
> +typedef struct odp_pktio_link_state_t {
> + uint32_t speed; /**< Speed in Mbps: 10, 100, 1000 etc */
> + odp_bool_t up;  /**< 1 - link up, 0 - link down */
> + odp_bool_t autoneg; /**< 1 - autoneg on, 0 - off */
> + odp_bool_t fd;  /**< 1 - full duplex, 0 - half duplex */

Since AN and duplex are physical layer dependent, should the API simply be
just link state (up/down) and speed?

Letting physical layer dependent information creep into a generic 'link'
struct might result in unnatural situations where a user is wondering about
AN and duplex for 40GbE or Link Fault Signaling for 1GbE.

> + odp_bool_t stopped; /**< 1 - pktio stopped, 0 - started */
> +} odp_pktio_link_state_t;
> +
> +/**
> + * Get packet IO link state
> + *
> + * @param[in] pktio  Packet IO handle
> + * @param[out] state Buffer to save link state
> + *
> + * @retval 0 on success (state info updated)
> + * @retval <0 on failure (state info not updated)
> + */
> +int odp_pktio_link_state(odp_pktio_t pktio, odp_pktio_link_state_t *state);
> +
> +/**
>   * Open a packet IO interface
>   *
>   * An ODP program can open a single packet IO interface per device, attempts
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp



-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation: pktio: don't call APIs with an invalid pktio handle

2015-10-15 Thread Bill Fischofer
On Tue, Oct 13, 2015 at 12:05 PM, Stuart Haslam 
wrote:

> If one of the pktio interfaces used by the test unexpectedly fails to
> open an invalid pktio handle is passed on to further API calls
> resulting in undefined behaviour.
>
> Reported-by: Anders Roxell 
> Signed-off-by: Stuart Haslam 
>

Reviewed-by: Bill Fischofer 


> ---
> This causes a seg fault when testing the linux-generic implementation,
> it can be easily reproduced with;
>
> ODP_PKTIO_IF0=blah ODP_PKTIO_IF1=foo ./test/validation/pktio/pktio_main
>
>  test/validation/pktio/pktio.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
> index 118fe89..d4b447a 100644
> --- a/test/validation/pktio/pktio.c
> +++ b/test/validation/pktio/pktio.c
> @@ -520,7 +520,9 @@ void pktio_test_mtu(void)
>  {
> int ret;
> int mtu;
> +
> odp_pktio_t pktio = create_pktio(iface_name[0],
> ODP_QUEUE_TYPE_SCHED, 0);
> +   CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
>
> mtu = odp_pktio_mtu(pktio);
> CU_ASSERT(mtu > 0);
> @@ -534,7 +536,9 @@ void pktio_test_mtu(void)
>  void pktio_test_promisc(void)
>  {
> int ret;
> +
> odp_pktio_t pktio = create_pktio(iface_name[0],
> ODP_QUEUE_TYPE_SCHED, 0);
> +   CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
>
> ret = odp_pktio_promisc_mode_set(pktio, 1);
> CU_ASSERT(0 == ret);
> @@ -562,6 +566,7 @@ void pktio_test_mac(void)
> odp_pktio_t pktio;
>
> pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0);
> +   CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
>
> printf("testing mac for %s\n", iface_name[0]);
>
> @@ -589,7 +594,7 @@ void pktio_test_inq_remdef(void)
> int i;
>
> pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0);
> -   CU_ASSERT(pktio != ODP_PKTIO_INVALID);
> +   CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
> CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0);
> inq = odp_pktio_inq_getdef(pktio);
> CU_ASSERT(inq != ODP_QUEUE_INVALID);
> @@ -617,7 +622,7 @@ void pktio_test_open(void)
> /* test the sequence open->close->open->close() */
> for (i = 0; i < 2; ++i) {
> pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED,
> 0);
> -   CU_ASSERT(pktio != ODP_PKTIO_INVALID);
> +   CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
> CU_ASSERT(odp_pktio_close(pktio) == 0);
> }
>
> @@ -656,7 +661,7 @@ void pktio_test_inq(void)
> odp_pktio_t pktio;
>
> pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0);
> -   CU_ASSERT(pktio != ODP_PKTIO_INVALID);
> +   CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
>
> CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0);
> CU_ASSERT(destroy_inq(pktio) == 0);
> @@ -675,7 +680,7 @@ static void pktio_test_start_stop(void)
>
> for (i = 0; i < num_ifaces; i++) {
> pktio[i] = create_pktio(iface_name[i],
> ODP_QUEUE_TYPE_SCHED, 0);
> -   CU_ASSERT(pktio[i] != ODP_PKTIO_INVALID);
> +   CU_ASSERT_FATAL(pktio[i] != ODP_PKTIO_INVALID);
> create_inq(pktio[i],  ODP_QUEUE_TYPE_SCHED);
> }
>
> --
> 2.1.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv4 1/4] api: packet reference count support

2015-10-15 Thread Ola Liljedahl
On 9 October 2015 at 08:59, Maxim Uvarov  wrote:

> Add api for packet reference count support. Which is useful in case:
>  - multicast support
>
Different packets will probably need different headers prepended to the
shared packet. How is this handled?

 - TCP retransmission
>
When a TCP packet is retransmitted, the IP id should be changed (similar
for QUIC retransmissions where the SN is updated). So you might have to
modify the packet (header) before you know that the previous transmit has
actually completed. How is this handled?

 - traffic generator
>
A traffic generator might want to include an increasing SN or timestamp in
each packet (packet payload) which otherwise are identical. How is this
handled?


>
> Introduced new call: newpkt = odp_packet_create_ref(pkt) which creates
> reference to original packet, but handles for reference packet and original
> are different.
>
I think something like Bill's "copy-on-write" proposal (from Connect) is
better than explicit reference counting (of the whole packet). Increase the
abstraction level and allow for innovation in the underlying implementation.

Any API support should be based on use case analysis and code examples of
how the use cases are implemented using the suggested API's. Otherwise the
risk of missing the target is significant.


> Signed-off-by: Maxim Uvarov 
> ---
>  include/odp/api/config.h | 5 +
>  include/odp/api/packet.h | 9 +
>  2 files changed, 14 insertions(+)
>
> diff --git a/include/odp/api/config.h b/include/odp/api/config.h
> index 295b10d..985290a 100644
> --- a/include/odp/api/config.h
> +++ b/include/odp/api/config.h
> @@ -126,6 +126,11 @@ extern "C" {
>   */
>  #define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6)
>
> +/**
> + * Maximum packet references.
> + */
> +#define ODP_CONFIG_PACKET_REFS 2
>
???
Can a packet only have two references? Why? Why is there a limit at all?



> +
>  /** Maximum number of shared memory blocks.
>   *
>   * This the the number of separate SHM areas that can be reserved
> concurrently
> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> index 5d46b7b..f9745fb 100644
> --- a/include/odp/api/packet.h
> +++ b/include/odp/api/packet.h
> @@ -125,6 +125,15 @@ odp_packet_t odp_packet_from_event(odp_event_t ev);
>   */
>  odp_event_t odp_packet_to_event(odp_packet_t pkt);
>
> +/**
> + * Create reference for packet handle
> + *
> + * @param pkt  Packet handle
> + *
> + * @return New packet handle
> + */
> +odp_packet_t odp_packet_create_ref(odp_packet_t pkt);
> +
>  /*
>   *
>   * Pointers and lengths
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH] api: crypto: add crypto IPSec extension

2015-10-15 Thread Ola Liljedahl
On 12 October 2015 at 12:33, Agrawal Hemant  wrote:

> HI Ola,
>
> I guess you are looking for standard NIC style IPSEC task
> offload?
>
Yes. Even if a SoC-based crypto/IPsec/security engine might be able to do a
lot of things, we want the API to be possible to map to off-chip NIC's with
IPsec offload. However I am not very familiar with such NIC's.


>
>
> If yes, should not it be done differently to cover various offload types
> w.r.t PKTIO.
>
That's a good suggestion. But they are not all 100% equivalent, e.g. GSO
doesn't require any configuration or state while IPsec does.


>
> 1.   PKTIO defines the type of offloads available e.g GSO, GRO, TCP,
> IPSEC etc
>
OK


> 2.   The IPSEC decrypted packets can be on any/specific of the
> PKTIO/classification queue.
>
OK


> 3.   In case of IPSEC Session information APIs will only be required.
>
> a.   SA information is typically stored in NIC
>
> b.  RX – packet will be received as plain text(NIC will do the packet
> decryption).
>
Is the SA used for decryption also passed with the decrypted/decapsulated
packet?
I assume that inline IPsec offload should remove the outer IP/ESP/AH
headers.

> c.   TX – packet session information will be passed along with packet
> during enqueue.
>
Or should the SPD lookup be in the NIC/accelerator? Well then you need a
way to configure that. Perhaps it is better to keep this in SW, it's needed
for RX anyway (to check that the received and potentially decrypted packet
was encrypted/decrypted as expected).

How do we pass the SA handle together with the packet on RX and TX? Is this
a magic piece of metadata with ODP get/set accessors?

Thanks,
  Ola

>
>
>
>
> Regards,
>
> Hemant
>
>
>
> *From:* lng-odp [mailto:lng-odp-boun...@lists.linaro.org] *On Behalf Of *Ola
> Liljedahl
> *Sent:* Friday, October 09, 2015 4:53 PM
> *To:* Alexandru Badicioiu 
> *Cc:* LNG ODP Mailman List 
> *Subject:* Re: [lng-odp] [API-NEXT PATCH] api: crypto: add crypto IPSec
> extension
>
>
>
> On 9 October 2015 at 12:48, Alexandru Badicioiu <
> alexandru.badici...@linaro.org> wrote:
>
> So you would like inline/synchronous API mode to have a completion queue
> too? What would be the use for it?
>
> I think we are misunderstanding each other and I haven't been very
> detailed.
>
>
>
> The output of IPsec egress processing must be a queue (e.g. pktio queue)
> where complete packets (L2/L3 encapsulation specified by the user) are
> enqueued. But there probably also needs to be a queue for sending
> notifications of errors or other exceptional events (e.g. SA not found,
> seqno nears the end etc).
>
>
>
> I haven't tried to understand exactly what is needed for inline IPsec on
> ingress.
>
>
>
>
>
> On 9 October 2015 at 13:01, Ola Liljedahl 
> wrote:
>
> On 9 October 2015 at 10:37, Alexandru Badicioiu <
> alexandru.badici...@linaro.org> wrote:
>
> This was a long discussion some time ago and the result was that crypto
> output should be abstracted in the form of the completion event and access
> functions would retrieve status and output packets. Also the implementation
> is in charge with crypto completion event allocation and not the
> application even if this is not really supported in HW.
>
> Yes that is useful for lookaside crypto/IPsec operations and my intention
> is not to change that. But this model is not useful for inline IPsec
> acceleration. We need a new or (preferably?) extended API for that. That's
> what I am asking about.
>
>
>
> I know not all silicon vendors would be able to support inline IPsec
> acceleration in HW. But with an Event Machine-like programming model where
> the application uses per-queue call-backs, inline IPsec acceleration can be
> implemented/emulated in SW. Even if this model is not exposed to the user,
> an ODP implementation should be able to do something like it "under the
> hood".
>
>
>
>
>
> The previous approach was that application supplied the completion event
> as being the output packet but this was regarded as a hack.
>
>
>
> Alex
>
>
>
> On 9 October 2015 at 11:28, Ola Liljedahl 
> wrote:
>
> On 9 October 2015 at 09:34, Alexandru Badicioiu <
> alexandru.badici...@linaro.org> wrote:
>
> The problem you raised is not strictly related to this patch.
>
> A crypto session has an output queue (for async mode) where the results ,
> including the operation status, will be delivered. There is nothing in the
> API to prevent using a pktio output queue for crypto completion events but
> the pktio should be able to process the event as the application would do.
>
> In this case an extension of pktio functionality would be required.
>
> Yes but I was thinking of some change (in API and implementation) where
> the output of the crypto operations is the actual packet (with L2/L3
> encapsulation), not a crypto completion event.
>
>
>
>
>
> Alex
>
>
>
>
>
> On 8 October 2015 at 20:13, Ola Liljedahl 
> wrote:
>
> Can this proposal be extended to handle inline IPsec processing, e.g.
> e

Re: [lng-odp] [PATCH 5/8] add fbk hash table

2015-10-15 Thread Ola Liljedahl
On 12 October 2015 at 16:30, Maxim Uvarov  wrote:

> On 10/09/2015 16:27, HePeng wrote:
>
>>
>> 在 2015年10月9日,下午8:20,Maxim Uvarov >> maxim.uva...@linaro.org>> 写道:
>>>
>>> Please specify git commit hash related to original code.
>>>
>>> I'm thinking how to maintain that in future.  And looks like there will
>>> be no way other then walk over all new patches
>>> and modify them to our odp code. In that case reference to original git
>>> base will be helpful.
>>>
>>> Thank you,
>>> Maxim.
>>>
>>
>> Rujiacs is my colleague. She has proposed in total 5 patches for hash
>> table implementations (imported from DPDK):
>>
>> [5/5] Add test program for hash lib
>> [4/5] Add four byte key hash table
>> [3/5] Add cuckoo hash table
>> [2/5] Modify the Ring structure
>> [1/5] Add Jhash and CRC functions
>>
>> The 5 patches are currently all in the helper/ directory (they are not
>> APIs).
>>
>> All these patches have been discussed and reviewed (except 2/5, however
>> it has been already used by some one. I’ve seen it in the mail list).
>> Here is the outcome of the discussions:
>>
>> For hash table implementations, the reviews focus on the convention
>> differences between DPDK and ODP.
>> For hash functions, some people think that CRC should be put in the
>> odp/include as a public API.
>> I am a little bit confused with what to do next.
>> Maybe going back to firstly add the hash functions and then merging the
>> hash table implementations can make all these patches clear?
>>
>>
>> The first step includes:
>>
>> 1) add a generic hash APIs into API-NEXT branches ( in include/odp)
>>
>> 2) add  CRC hash APIs into the API-NEXT branches ( in include/odp),
>> and put SW implementations in the linux-generic. CRC is special since many
>> cpus have CRC accelerated instructions.
>>
>> 2) add Jhash implementations in helper/
>>
>> Then,
>>
>> 1) add 2 hash tables implementations in helper/
>>
>>
>> How about this ?
>> Thanks.
>>
>
> Hello He,
>
> we discussed today on meeting that. That is good steps to go. 1) crc odp
> api + it's linux-generic implementation 2) jhash for helper.
>
> For crc you can use simple crc(void *ptr, size_t len) for first version.
> I.e. do not take care about packet segmentation, and later
> we will switch it to segmented version crc(odp_packet_t pkt).
>
I doubt you want to compute the CRC over all of the data in a packet,
selected pieces of the actual payload seems more realistic. As usual, we
need an actual use case to drive the API definition.



>
> Thanks,
> Maxim.
>
>
>
>
>>
>>>
>>> On 10/09/15 11:37, HePeng wrote:
>>>

 在 2015年10月9日,下午4:36,Ola Liljedahl  ola.liljed...@linaro.org>> 写道:
>
> On 9 October 2015 at 10:33, HePeng  xnhp0...@icloud.com>> wrote:
>
>
>在 2015年10月9日,下午4:26,Ola Liljedahl
>>mailto:ola.liljed...@linaro.org>
>> > 写道:
>>
>>On 8 October 2015 at 14:43, HePeng > xnhp0...@icloud.com>
>>> wrote:
>>
>>
>>在 2015年10月8日,下午8:13,Ola Liljedahl
>>>mailto:ola.liljed...@linaro.org>
>>>> 写道:
>>>
>>>On 8 October 2015 at 10:02, Bill Fischofer
>>>mailto:bill.fischo...@linaro.org>
>>>> wrote:
>>>
>>>Trying to keep the rte_ prefix would be confusing.  One
>>>of the precepts of ODP is that it doesn't preclude an
>>>application also using an underlying SDK in addition to
>>>ODP APIs. Whether that makes sense is up to the
>>>application, of course.  But if ODP were to start using
>>>other prefixes I'd imagine that would get very messy.
>>>
>>>It would also be confusing to have functions that use odp_
>>>naming conventions but don't behave like ODP functions
>>>(with regards to e.g. handling and returning errors or
>>>checking parameters).
>>>
>>We can fix this by wrapping these functions.
>>
>>I don't follow you. How can you make these function behave like
>>ODP functions by "wrapping" them?
>>Me thinks you have to modify the implementation in order to
>>change the behaviour.
>>
>
>I mean that perhaps not all the functions needs to be changed,
>only the exposed ones (APIs). Some functions are static and are
>only used in
>the internal of implementation, these functions can reserve their
>code.
>
> Static functions can have whatever names you like. But if their
> implementation contributes to the behaviour as seen by callers of the
> public functions, that behaviour must be compliant with the ODP style.
>

 I see. Thanks.



>
>> But considering that the inter

Re: [lng-odp] [API-NEXT PATCHv2] api: pktio link

2015-10-15 Thread Ola Liljedahl
On 13 October 2015 at 08:39, Maxim Uvarov  wrote:

> Define API to get pktio link state: seed, autoneg, link up/down,
> duplex, started/stopped state.
>
> Signed-off-by: Maxim Uvarov 
> ---
>  v2: - use simple struct to return pktio link state;
>  - odp will not modify link, only ready it's state;
>
>
>  include/odp/api/packet_io.h | 22 ++
>  1 file changed, 22 insertions(+)
>
> diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
> index d8e69ed..6c77e8d 100644
> --- a/include/odp/api/packet_io.h
> +++ b/include/odp/api/packet_io.h
> @@ -96,6 +96,28 @@ typedef struct odp_pktio_param_t {
>  } odp_pktio_param_t;
>
>  /**
> + * Packet IO link state information
> + */
> +typedef struct odp_pktio_link_state_t {
> +   uint32_t speed; /**< Speed in Mbps: 10, 100, 1000 etc */
> +   odp_bool_t up;  /**< 1 - link up, 0 - link down */
> +   odp_bool_t autoneg; /**< 1 - autoneg on, 0 - off */
>
Is autonegotiation enabled/disabled of any interest to the application?
It's a configuration input, not an output or result.

+   odp_bool_t fd;  /**< 1 - full duplex, 0 - half duplex */
> +   odp_bool_t stopped; /**< 1 - pktio stopped, 0 - started */
>
Link state, link speed and duplex mode all related to the physical state of
the pktio interface. "stopped" is a logical concept of the ODP pktio
abstraction (equivalent to interface up/down?) and there is no one-to-one
correspondence between pktio instances and physical links (some pktio
classes may not even have a physical link). Seems strange to mix those
concepts. Also "stopped' is a poor name me thinks, why not "running"?


> +} odp_pktio_link_state_t;
> +
> +/**
> + * Get packet IO link state
> + *
> + * @param[in] pktioPacket IO handle
> + * @param[out] state   Buffer to save link state
> + *
> + * @retval 0 on success (state info updated)
> + * @retval <0 on failure (state info not updated)
> + */
> +int odp_pktio_link_state(odp_pktio_t pktio, odp_pktio_link_state_t
> *state);
> +
> +/**
>   * Open a packet IO interface
>   *
>   * An ODP program can open a single packet IO interface per device,
> attempts
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH 5/6] api: atomic: added cas operations

2015-10-15 Thread Ola Liljedahl
On 15 October 2015 at 10:45, Petri Savolainen 
wrote:

> Added cas operations for 32 and 64 bit atomic variables. These
> use relaxed memory order (as all other operations).
>
Do you have actual use cases for CAS where *only* relaxed memory order is
required? Or you need CAS with acquire ordering per the other patch? But
you don't need CAS with release ordering?

I would rather see a generic CAS function with the memory order as a
separate parameter. We are into lock-less territory now, not just using
atomics for simple counters/statistics where we don't have to worry about
memory ordering.


>
> Signed-off-by: Petri Savolainen 
> ---
>  include/odp/api/atomic.h| 37
> +
>  platform/linux-generic/include/odp/atomic.h | 18 ++
>  2 files changed, 55 insertions(+)
>
> diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
> index 97e8639..957d304 100644
> --- a/include/odp/api/atomic.h
> +++ b/include/odp/api/atomic.h
> @@ -136,6 +136,25 @@ uint32_t odp_atomic_fetch_dec_u32(odp_atomic_u32_t
> *atom);
>  void odp_atomic_dec_u32(odp_atomic_u32_t *atom);
>
>  /**
> + * Compare and swap atomic uint32 variable
> + *
> + * Compares value of atomic variable to the value pointed by 'old_val'.
> + * If values are equal, the operation writes 'new_val' into the atomic
> variable
> + * and returns success. If they are not equal, the operation writes
> current
> + * value of atomic variable into 'old_val' and returns failure.
> + *
> + * @param atom  Pointer to atomic variable
> + * @param[in,out] old_val   Pointer to the old value of the atomic
> variable.
> + *  Operation updates this value on failure.
> + * @param new_val   New value to be written into the atomic
> variable
> + *
> + * @return 0 on failure, !0 on success
> + *
> + */
> +int odp_atomic_cas_u32(odp_atomic_u32_t *atom, uint32_t *old_val,
> +  uint32_t new_val);
> +
> +/**
>   * Initialize atomic uint64 variable
>   *
>   * @param atomPointer to atomic variable
> @@ -229,6 +248,24 @@ uint64_t odp_atomic_fetch_dec_u64(odp_atomic_u64_t
> *atom);
>  void odp_atomic_dec_u64(odp_atomic_u64_t *atom);
>
>  /**
> + * Compare and swap atomic uint64 variable
> + *
> + * Compares value of atomic variable to the value pointed by 'old_val'.
> + * If values are equal, the operation writes 'new_val' into the atomic
> variable
> + * and returns success. If they are not equal, the operation writes
> current
> + * value of atomic variable into 'old_val' and returns failure.
> + *
> + * @param atom  Pointer to atomic variable
> + * @param[in,out] old_val   Pointer to the old value of the atomic
> variable.
> + *  Operation updates this value on failure.
> + * @param new_val   New value to be written into the atomic
> variable
> + *
> + * @return 0 on failure, !0 on success
> + */
> +int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val,
> +  uint64_t new_val);
> +
> +/**
>   * @}
>   */
>
> diff --git a/platform/linux-generic/include/odp/atomic.h
> b/platform/linux-generic/include/odp/atomic.h
> index deb4039..5a143a5 100644
> --- a/platform/linux-generic/include/odp/atomic.h
> +++ b/platform/linux-generic/include/odp/atomic.h
> @@ -85,6 +85,15 @@ static inline void odp_atomic_dec_u32(odp_atomic_u32_t
> *atom)
> (void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED);
>  }
>
> +static inline int odp_atomic_cas_u32(odp_atomic_u32_t *atom, uint32_t
> *old_val,
> +uint32_t new_val)
> +{
> +   return __atomic_compare_exchange_n(&atom->v, old_val, new_val,
> +  0 /* strong */,
> +  __ATOMIC_RELAXED,
> +  __ATOMIC_RELAXED);
> +}
> +
>  static inline void odp_atomic_init_u64(odp_atomic_u64_t *atom, uint64_t
> val)
>  {
> atom->v = val;
> @@ -186,6 +195,15 @@ static inline void
> odp_atomic_dec_u64(odp_atomic_u64_t *atom)
>  #endif
>  }
>
> +static inline int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t
> *old_val,
> +uint64_t new_val)
> +{
> +   return __atomic_compare_exchange_n(&atom->v, old_val, new_val,
> +  0 /* strong */,
> +  __ATOMIC_RELAXED,
> +  __ATOMIC_RELAXED);
> +}
> +
>  /**
>   * @}
>   */
> --
> 2.6.0
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH 6/6] api: atomic: added 32 bit acquire and release

2015-10-15 Thread Ola Liljedahl
On 15 October 2015 at 10:45, Petri Savolainen 
wrote:

> Added 32 bit acquire load/cas and release store/add/sub calls.
>
You only have cas_acquire. Don't you see a need for cas_release? I use that
in one lockless design.

I see the beginning of a combinatorial explosion here. Why not just expose
the atomic operations that take the memory ordering as a parameter?

-- Ola


> These are the minimum set of non-relaxed calls that are needed
> for building lock-free algorithms. 64 bit versions can be added
> later.
>
> Signed-off-by: Petri Savolainen 
> ---
>  include/odp/api/atomic.h| 80
> -
>  platform/linux-generic/include/odp/atomic.h | 32 
>  2 files changed, 111 insertions(+), 1 deletion(-)
>
> diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
> index 957d304..cbf241d 100644
> --- a/include/odp/api/atomic.h
> +++ b/include/odp/api/atomic.h
> @@ -21,7 +21,7 @@ extern "C" {
>  /**
>   * @defgroup odp_atomic ODP ATOMIC
>   * @details
> - *  Atomic integers 
> + *  Atomic integers using relaxed memory ordering 
>   *
>   * Atomic integer types (odp_atomic_u32_t and odp_atomic_u64_t) can be
> used to
>   * implement e.g. shared counters. If not otherwise documented,
> operations in
> @@ -31,6 +31,18 @@ extern "C" {
>   * before or after the operation), only atomicity of the operation itself
> is
>   * guaranteed.
>   *
> + *  Operations with other than relaxed memory ordering 
> + *
> + *  An operation with RELEASE  memory ordering
> (odp_atomic_xxx_rls_xxx())
> + * ensures that other threads loading the same atomic variable with
> ACQUIRE
> + * memory ordering see all stores (from the calling thread) that happened
> before
> + * this releasing store.
> + *
> + *  An operation with ACQUIRE  memory ordering
> (odp_atomic_xxx_acq_xxx())
> + * ensures that the calling thread sees all stores (done by the releasing
> + * thread) that happened before a RELEASE memory ordered store to the same
> + * atomic variable.
> + *
>   * @{
>   */
>
> @@ -265,6 +277,72 @@ void odp_atomic_dec_u64(odp_atomic_u64_t *atom);
>  int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val,
>uint64_t new_val);
>
> +/*
> + * Operations with other than relaxed memory ordering
> + * --
> + */
> +
> +/**
> + * Load value of atomic uint32 variable using ACQUIRE memory ordering
> + *
> + * Otherwise identical to odp_atomic_load_u32() but ensures ACQUIRE memory
> + * ordering.
> + *
> + * @param atomPointer to atomic variable
> + *
> + * @return Value of the variable
> + */
> +uint32_t odp_atomic_load_acq_u32(odp_atomic_u32_t *atom);
> +
> +/**
> + * Compare and swap atomic uint32 variable using ACQUIRE memory ordering
> + *
> + * Otherwise identical to odp_atomic_cas_u32() but ensures ACQUIRE memory
> + * ordering.
> + *
> + * @param atom  Pointer to atomic variable
> + * @param[in,out] old_val   Pointer to the old value of the atomic
> variable.
> + *  Operation updates this value on failure.
> + * @param new_val   New value to be written into the atomic
> variable
> + *
> + * @return 0 on failure, !0 on success
> + */
> +int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom, uint32_t *old_val,
> +  uint32_t new_val);
> +
> +/**
> + * Store value to atomic uint32 variable using RELEASE memory ordering
> + *
> + * Otherwise identical to odp_atomic_store_u32() but ensures RELEASE
> memory
> + * ordering.
> + *
> + * @param atomPointer to atomic variable
> + * @param val Value to store in the variable
> + */
> +void odp_atomic_store_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
> +
> +/**
> + * Add to atomic uint32 variable using RELEASE memory ordering
> + *
> + * Otherwise identical to odp_atomic_add_u32() but ensures RELEASE memory
> + * ordering.
> + *
> + * @param atomPointer to atomic variable
> + * @param val Value to be added to the variable
> + */
> +void odp_atomic_add_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
> +
> +/**
> + * Subtract from atomic uint32 variable using RELEASE memory ordering
> + *
> + * Otherwise identical to odp_atomic_sub_u32() but ensures RELEASE memory
> + * ordering.
> + *
> + * @param atomPointer to atomic variable
> + * @param val Value to be subtracted from the variable
> + */
> +void odp_atomic_sub_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
> +
>  /**
>   * @}
>   */
> diff --git a/platform/linux-generic/include/odp/atomic.h
> b/platform/linux-generic/include/odp/atomic.h
> index 5a143a5..8f83c04 100644
> --- a/platform/linux-generic/include/odp/atomic.h
> +++ b/platform/linux-generic/include/odp/atomic.h
> @@ -204,6 +204,38 @@ static inline int odp_atomic_cas_u64(odp_atomic_u64_t
> *atom, uint64_t *old_val,
>__ATOMIC_RELAXED);
>  }
>
> +static inline uint32_t odp_atomic_load_acq_u32(odp_atomic_u32_t *atom)
> +{
>

Re: [lng-odp] [PATCH 1/1] helpers: linux: add application defined counters

2015-10-15 Thread Ola Liljedahl
On 15 October 2015 at 14:53, Maxim Uvarov  wrote:

>
>
> On 09/08/2015 16:29, Alexandru Badicioiu wrote:
>
>>
>> On 8 September 2015 at 15:57, Ola Liljedahl > > wrote:
>>
>> On 1 September 2015 at 13:09, > > wrote:
>>
>> From: Alexandru Badicioiu > >
>>
>> This patch provides the applications with helpers to create,
>> update
>> and read counters associated with application defined objects
>> - e.g.
>> IPSec security associations in a multi-threading scenario where
>> multiple threads use the same object.
>>
>> I think this is useful functionality. But I fear it might not
>> really help on targets that do not support atomic (64-bit) reads
>> and writes.
>>
>> [Alex] Those platforms are likely 32-bit platforms and they can use
>> 32-bit counters. These counters can be useful for debugging purposes,
>> rather than providing statistics over longer period of time.
>>
>>
>> Why ODP helpers and not proper ODP?
>>
>> [Alex] By application defined counters I meant software counters. These
>> likely won't have different implementations on different platforms.
>>
>>
>> We also want an API for counters (statistics) that can be
>> offloaded to HW, some SoC's do that. It might be useful if the API
>> could be used for both HW counter and your per-thread counter
>> implementations (together with an implementation using e.g. ARM8.1
>> atomics).
>> [Alex] Pktio counters is this kind of API. Others may be proposed
>> too but this requires agreement between platforms.
>>
>>
> Yes, agree. For pktio it's needed to define exact counter size returned to
> app + it's more related to pktio hw, so there should be it's own
> pktio_cnt_add/sub().
>
Is this a public ODP API or are these functions internal? When and by whom
would those calls be used?

The pktio interface will maintain its own counters as packets are received
and transmitted. Either the HW does some or all of this or SW has to update
the counters. Existing ODP atomics can be used for that.


>
> Maxim.
>
> Each worker thread must create a local version of a given
>> counter -
>> e.g. IPSec SA request bytes/packets with
>> odph_counter32/64_create_local()
>> function and update its local counter with
>> odph_counter32/64_set/add/sub
>> functions.
>> A control thread can use odph_counter32/64_read_global() to
>> retrieve
>> the total value of the counter by summing all local values.
>>
>> Signed-off-by: Alexandru Badicioiu
>> > >
>> ---
>>  helper/include/odp/helper/linux.h |  114
>> +
>>  helper/linux.c|  128
>> +
>>  2 files changed, 242 insertions(+), 0 deletions(-)
>>
>> diff --git a/helper/include/odp/helper/linux.h
>> b/helper/include/odp/helper/linux.h
>> index ce61fdf..3c7ab15 100644
>> --- a/helper/include/odp/helper/linux.h
>> +++ b/helper/include/odp/helper/linux.h
>> @@ -31,6 +31,7 @@ extern "C" {
>>  typedef struct {
>> void *(*start_routine) (void *); /**< The function to
>> run */
>> void *arg; /**< The functions arguemnts */
>> +   void **counters_tbl; /**< Counters table address */
>>  } odp_start_args_t;
>>
>>  /** Linux pthread state information */
>> @@ -40,8 +41,18 @@ typedef struct {
>> intcpu;/**< CPU ID */
>> /** Saved starting args for join to later free */
>> odp_start_args_t *start_args;
>> +   void *counters_tbl;/**< Counters table for this
>> thread */
>>  } odph_linux_pthread_t;
>>
>> +/** Thread local counter size */
>> +typedef enum odph_counter_size {
>> +   ODPH_COUNTER_SIZE_32BIT,
>> +   ODPH_COUNTER_SIZE_64BIT,
>> +} odph_counter_size_t;
>> +
>> +#define ODPH_COUNTER_INVALID(-1)
>> +/** Thread local counter handle */
>> +typedef int32_t odph_counter_t;
>>
>>  /** Linux process state information */
>>  typedef struct {
>> @@ -77,6 +88,109 @@ int
>> odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
>>   */
>>  void odph_linux_pthread_join(odph_linux_pthread_t
>> *thread_tbl, int num);
>>
>> +/**
>> + * Creates a 32bit thread local counter
>> + * Each thread in the thread table must create a
>> + * counter for a shared object to which the counter
>> + * is associated to - e.g. an IPSec Security Association.
>> + *
>>

Re: [lng-odp] [PATCH 1/1] helpers: linux: add application defined counters

2015-10-15 Thread Maxim Uvarov



On 09/08/2015 16:29, Alexandru Badicioiu wrote:


On 8 September 2015 at 15:57, Ola Liljedahl > wrote:


On 1 September 2015 at 13:09, mailto:alexandru.badici...@linaro.org>> wrote:

From: Alexandru Badicioiu mailto:alexandru.badici...@linaro.org>>

This patch provides the applications with helpers to create,
update
and read counters associated with application defined objects
- e.g.
IPSec security associations in a multi-threading scenario where
multiple threads use the same object.

I think this is useful functionality. But I fear it might not
really help on targets that do not support atomic (64-bit) reads
and writes.

[Alex] Those platforms are likely 32-bit platforms and they can use 
32-bit counters. These counters can be useful for debugging purposes, 
rather than providing statistics over longer period of time.



Why ODP helpers and not proper ODP?

[Alex] By application defined counters I meant software counters. 
These likely won't have different implementations on different platforms.



We also want an API for counters (statistics) that can be
offloaded to HW, some SoC's do that. It might be useful if the API
could be used for both HW counter and your per-thread counter
implementations (together with an implementation using e.g. ARM8.1
atomics).
[Alex] Pktio counters is this kind of API. Others may be proposed
too but this requires agreement between platforms.



Yes, agree. For pktio it's needed to define exact counter size returned 
to app + it's more related to pktio hw, so there should be it's own 
pktio_cnt_add/sub().


Maxim.


Each worker thread must create a local version of a given
counter -
e.g. IPSec SA request bytes/packets with
odph_counter32/64_create_local()
function and update its local counter with
odph_counter32/64_set/add/sub
functions.
A control thread can use odph_counter32/64_read_global() to
retrieve
the total value of the counter by summing all local values.

Signed-off-by: Alexandru Badicioiu
mailto:alexandru.badici...@linaro.org>>
---
 helper/include/odp/helper/linux.h |  114
+
 helper/linux.c|  128
+
 2 files changed, 242 insertions(+), 0 deletions(-)

diff --git a/helper/include/odp/helper/linux.h
b/helper/include/odp/helper/linux.h
index ce61fdf..3c7ab15 100644
--- a/helper/include/odp/helper/linux.h
+++ b/helper/include/odp/helper/linux.h
@@ -31,6 +31,7 @@ extern "C" {
 typedef struct {
void *(*start_routine) (void *); /**< The function to
run */
void *arg; /**< The functions arguemnts */
+   void **counters_tbl; /**< Counters table address */
 } odp_start_args_t;

 /** Linux pthread state information */
@@ -40,8 +41,18 @@ typedef struct {
intcpu;/**< CPU ID */
/** Saved starting args for join to later free */
odp_start_args_t *start_args;
+   void *counters_tbl;/**< Counters table for this
thread */
 } odph_linux_pthread_t;

+/** Thread local counter size */
+typedef enum odph_counter_size {
+   ODPH_COUNTER_SIZE_32BIT,
+   ODPH_COUNTER_SIZE_64BIT,
+} odph_counter_size_t;
+
+#define ODPH_COUNTER_INVALID(-1)
+/** Thread local counter handle */
+typedef int32_t odph_counter_t;

 /** Linux process state information */
 typedef struct {
@@ -77,6 +88,109 @@ int
odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
  */
 void odph_linux_pthread_join(odph_linux_pthread_t
*thread_tbl, int num);

+/**
+ * Creates a 32bit thread local counter
+ * Each thread in the thread table must create a
+ * counter for a shared object to which the counter
+ * is associated to - e.g. an IPSec Security Association.
+ *
+ * Returns the counter handle
+ *
+ * @return Counter handle
+ */
+odph_counter_t odph_counter32_create_local(void);
+
+/**
+ * Creates a 64bit thread local counter
+ *
+ * Returns the counter handle
+ *
+ * @return Counter handle
+ */
+odph_counter_t odph_counter64_create_local(void);
+
+/**
+ * Get counter size
+ *
+ * Return the size of a counter
+ *
+ * @param Counter handle
+ * @return Counter size
+ *
+ */
+odph_counter_size_t
+odph_counter_size(odph_counter_t counter);
+
  

Re: [lng-odp] pktio statistic counters

2015-10-15 Thread Maxim Uvarov

I will send update.

btw, smnpd does not name variables with same name as counters, we should 
not do the same. Just correlation between standard and vars name.


Maxim.

On 10/15/2015 19:53, Ivan Khoronzhuk wrote:



On 15.10.15 19:51, Ivan Khoronzhuk wrote:



On 15.10.15 19:31, Mike Holmes wrote:



On 15 October 2015 at 14:04, Ivan Khoronzhuk 
mailto:ivan.khoronz...@linaro.org>> wrote:


Please, no Camel casemaybe we can duplicate the struct with 
names and use convenient one.




So we adopt a standard that is bigger than out own and not its 
naming convention ?

Feels presumptuous :)


Yep.


Yep - Feels presumptuous :)







On 15.10.15 15:12, Mike Holmes wrote:



On 15 October 2015 at 13:01, Bill Fischofer 
mailto:bill.fischo...@linaro.org> 
>> wrote:


 If we're going to follow RFC MIB specifications we 
should use the field names as specified in the RFCs.  We already 
need to update the checkpatch rules to allow camel case since CUnit 
uses that anyway.  We can simply have a recommendation that ODP 
doesn't use camel case except in cases like these.  It actually 
helps highlight the fact that these are externally specified names 
rather than ODP names.



Agree on using RFC names and I think checkpatch already 
ignores "MiB", but a patch to add Cunit exceptions  is a good idea



 Bill

 On Thu, Oct 15, 2015 at 6:09 AM, Savolainen, Petri 
(Nokia - FI/Espoo)  
>> wrote:


 Hi,

 These RFCs could be the ones we are looking for 
pktio interface level counters.


https://tools.ietf.org/html/rfc3635
https://tools.ietf.org/html/rfc2863
https://tools.ietf.org/html/rfc2819


 The editor tool can be used to double check which 
RFC is the lastest...

https://www.rfc-editor.org/info/rfc3635
https://www.rfc-editor.org/info/rfc2863


 The counters could be these, but in 64 bit version 
in ODP API.


 For example, ifInOctets would be specified as

 typedef struct {
uint64_t in_octets;
uint64_t in_ucastpkts;
 ...

 } odp_pktio_stat_counters_t;



 ifInOctets
 ifInUcastPkts
 ifInDiscards
 ifInErrors
 ifInUnknownProtos
 ifOutOctets
 ifOutUcastPkts
 ifOutDiscards
 ifOutErrors


 ifInOctets  The number of 
octets in valid MAC frames
  received on this 
interface, including
  the MAC header and 
FCS.  This does
  include the number 
of octets in valid
  MAC Control frames 
received on this

  Interface


 ifInUcastPkts   Refer to 
[RFC2863].  Note that this does
  not include MAC 
Control frames


 ...


 -Petri






___
 lng-odp mailing list
lng-odp@lists.linaro.org  
>

https://lists.linaro.org/mailman/listinfo/lng-odp



 ___
 lng-odp mailing list
lng-odp@lists.linaro.org  
>

https://lists.linaro.org/mailman/listinfo/lng-odp




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source 
software for ARM SoCs


__




___
lng-odp mailing list
lng-odp@lists.linaro.org 
https://lists.linaro.org/mailman/listinfo/lng-odp


--
Regards,
Ivan Khoronzhuk




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source software for 
ARM SoCs


__








___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] pktio statistic counters

2015-10-15 Thread Ivan Khoronzhuk



On 15.10.15 19:51, Ivan Khoronzhuk wrote:



On 15.10.15 19:31, Mike Holmes wrote:



On 15 October 2015 at 14:04, Ivan Khoronzhuk mailto:ivan.khoronz...@linaro.org>> wrote:

Please, no Camel casemaybe we can duplicate the struct with names and 
use convenient one.



So we adopt a standard that is bigger than out own and not its naming 
convention ?
Feels presumptuous :)


Yep.


Yep - Feels presumptuous :)







On 15.10.15 15:12, Mike Holmes wrote:



On 15 October 2015 at 13:01, Bill Fischofer mailto:bill.fischo...@linaro.org> >> wrote:

 If we're going to follow RFC MIB specifications we should use the 
field names as specified in the RFCs.  We already need to update the checkpatch 
rules to allow camel case since CUnit uses that anyway.  We can simply have a 
recommendation that ODP doesn't use camel case except in cases like these.  It 
actually helps highlight the fact that these are externally specified names 
rather than ODP names.


Agree on using RFC names and I think checkpatch already ignores "MiB", 
but a patch to add Cunit exceptions  is a good idea


 Bill

 On Thu, Oct 15, 2015 at 6:09 AM, Savolainen, Petri (Nokia - FI/Espoo) 
mailto:petri.savolai...@nokia.com> 
>> wrote:

 Hi,

 These RFCs could be the ones we are looking for pktio 
interface level counters.

https://tools.ietf.org/html/rfc3635
https://tools.ietf.org/html/rfc2863
https://tools.ietf.org/html/rfc2819


 The editor tool can be used to double check which RFC is the 
lastest...
https://www.rfc-editor.org/info/rfc3635
https://www.rfc-editor.org/info/rfc2863


 The counters could be these, but in 64 bit version in ODP API.

 For example, ifInOctets would be specified as

 typedef struct {
uint64_t in_octets;
uint64_t in_ucastpkts;
 ...

 } odp_pktio_stat_counters_t;



 ifInOctets
 ifInUcastPkts
 ifInDiscards
 ifInErrors
 ifInUnknownProtos
 ifOutOctets
 ifOutUcastPkts
 ifOutDiscards
 ifOutErrors


 ifInOctets  The number of octets in valid 
MAC frames
  received on this interface, 
including
  the MAC header and FCS.  This 
does
  include the number of octets 
in valid
  MAC Control frames received 
on this
  Interface


 ifInUcastPkts   Refer to [RFC2863].  Note that 
this does
  not include MAC Control frames

 ...


 -Petri






 ___
 lng-odp mailing list
lng-odp@lists.linaro.org  
>
https://lists.linaro.org/mailman/listinfo/lng-odp



 ___
 lng-odp mailing list
lng-odp@lists.linaro.org  
>
https://lists.linaro.org/mailman/listinfo/lng-odp




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source software for ARM 
SoCs

__




___
lng-odp mailing list
lng-odp@lists.linaro.org 
https://lists.linaro.org/mailman/listinfo/lng-odp


--
Regards,
Ivan Khoronzhuk




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source software for ARM SoCs

__






--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] pktio statistic counters

2015-10-15 Thread Ivan Khoronzhuk



On 15.10.15 19:31, Mike Holmes wrote:



On 15 October 2015 at 14:04, Ivan Khoronzhuk mailto:ivan.khoronz...@linaro.org>> wrote:

Please, no Camel casemaybe we can duplicate the struct with names and 
use convenient one.



So we adopt a standard that is bigger than out own and not its naming 
convention ?
Feels presumptuous :)


Yep.





On 15.10.15 15:12, Mike Holmes wrote:



On 15 October 2015 at 13:01, Bill Fischofer mailto:bill.fischo...@linaro.org> >> wrote:

 If we're going to follow RFC MIB specifications we should use the 
field names as specified in the RFCs.  We already need to update the checkpatch 
rules to allow camel case since CUnit uses that anyway.  We can simply have a 
recommendation that ODP doesn't use camel case except in cases like these.  It 
actually helps highlight the fact that these are externally specified names 
rather than ODP names.


Agree on using RFC names and I think checkpatch already ignores "MiB", 
but a patch to add Cunit exceptions  is a good idea


 Bill

 On Thu, Oct 15, 2015 at 6:09 AM, Savolainen, Petri (Nokia - FI/Espoo) 
mailto:petri.savolai...@nokia.com> 
>> wrote:

 Hi,

 These RFCs could be the ones we are looking for pktio 
interface level counters.

https://tools.ietf.org/html/rfc3635
https://tools.ietf.org/html/rfc2863
https://tools.ietf.org/html/rfc2819


 The editor tool can be used to double check which RFC is the 
lastest...
https://www.rfc-editor.org/info/rfc3635
https://www.rfc-editor.org/info/rfc2863


 The counters could be these, but in 64 bit version in ODP API.

 For example, ifInOctets would be specified as

 typedef struct {
uint64_t in_octets;
uint64_t in_ucastpkts;
 ...

 } odp_pktio_stat_counters_t;



 ifInOctets
 ifInUcastPkts
 ifInDiscards
 ifInErrors
 ifInUnknownProtos
 ifOutOctets
 ifOutUcastPkts
 ifOutDiscards
 ifOutErrors


 ifInOctets  The number of octets in valid 
MAC frames
  received on this interface, 
including
  the MAC header and FCS.  This 
does
  include the number of octets 
in valid
  MAC Control frames received 
on this
  Interface


 ifInUcastPkts   Refer to [RFC2863].  Note that 
this does
  not include MAC Control frames

 ...


 -Petri






 ___
 lng-odp mailing list
lng-odp@lists.linaro.org  
>
https://lists.linaro.org/mailman/listinfo/lng-odp



 ___
 lng-odp mailing list
lng-odp@lists.linaro.org  
>
https://lists.linaro.org/mailman/listinfo/lng-odp




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source software for ARM 
SoCs

__




___
lng-odp mailing list
lng-odp@lists.linaro.org 
https://lists.linaro.org/mailman/listinfo/lng-odp


--
Regards,
Ivan Khoronzhuk




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source software for ARM SoCs

__




--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] pktio statistic counters

2015-10-15 Thread Mike Holmes
On 15 October 2015 at 14:04, Ivan Khoronzhuk 
wrote:

> Please, no Camel casemaybe we can duplicate the struct with names and
> use convenient one.
>


So we adopt a standard that is bigger than out own and not its naming
convention ?
Feels presumptuous :)



>
>
> On 15.10.15 15:12, Mike Holmes wrote:
>
>>
>>
>> On 15 October 2015 at 13:01, Bill Fischofer > > wrote:
>>
>> If we're going to follow RFC MIB specifications we should use the
>> field names as specified in the RFCs.  We already need to update the
>> checkpatch rules to allow camel case since CUnit uses that anyway.  We can
>> simply have a recommendation that ODP doesn't use camel case except in
>> cases like these.  It actually helps highlight the fact that these are
>> externally specified names rather than ODP names.
>>
>>
>> Agree on using RFC names and I think checkpatch already ignores "MiB",
>> but a patch to add Cunit exceptions  is a good idea
>>
>>
>> Bill
>>
>> On Thu, Oct 15, 2015 at 6:09 AM, Savolainen, Petri (Nokia - FI/Espoo)
>> mailto:petri.savolai...@nokia.com>> wrote:
>>
>> Hi,
>>
>> These RFCs could be the ones we are looking for pktio interface
>> level counters.
>>
>> https://tools.ietf.org/html/rfc3635
>> https://tools.ietf.org/html/rfc2863
>> https://tools.ietf.org/html/rfc2819
>>
>>
>> The editor tool can be used to double check which RFC is the
>> lastest...
>> https://www.rfc-editor.org/info/rfc3635
>> https://www.rfc-editor.org/info/rfc2863
>>
>>
>> The counters could be these, but in 64 bit version in ODP API.
>>
>> For example, ifInOctets would be specified as
>>
>> typedef struct {
>>uint64_t in_octets;
>>uint64_t in_ucastpkts;
>> ...
>>
>> } odp_pktio_stat_counters_t;
>>
>>
>>
>> ifInOctets
>> ifInUcastPkts
>> ifInDiscards
>> ifInErrors
>> ifInUnknownProtos
>> ifOutOctets
>> ifOutUcastPkts
>> ifOutDiscards
>> ifOutErrors
>>
>>
>> ifInOctets  The number of octets in valid MAC
>> frames
>>  received on this interface,
>> including
>>  the MAC header and FCS.  This
>> does
>>  include the number of octets in
>> valid
>>  MAC Control frames received on
>> this
>>  Interface
>>
>>
>> ifInUcastPkts   Refer to [RFC2863].  Note that
>> this does
>>  not include MAC Control frames
>>
>> ...
>>
>>
>> -Petri
>>
>>
>>
>>
>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org 
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org 
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>>
>> --
>> Mike Holmes
>> Technical Manager - Linaro Networking Group
>> Linaro.org ***│ *Open source software for ARM
>> SoCs
>>
>> __
>>
>>
>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
> --
> Regards,
> Ivan Khoronzhuk
>



-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org  *│ *Open source software for ARM SoCs
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] New ODP Website page created

2015-10-15 Thread Mike Holmes
from status

On 15 October 2015 at 17:02, Raj Murali  wrote:

> How will this page linked through navigation menu?
>
>
>
> Raj Murali
> Director - Linaro Networking Group
> Skype: rajmurali_s  │ M: +91 98450 70135
>
> Linaro.org  *│ *Open source software for ARM SoCs
>
>
> On 15 October 2015 at 20:59, Marshall Guillory <
> marshall.guill...@linaro.org> wrote:
>
>> this story has been completed. A new page was created as requested and
>> added to the navigation structure under Status and the Developer sidebar
>> menu for ease of access.
>>
>> http://www.opendataplane.org/api-documentation/api-differences/
>>
>> Please test and report any feedback.
>>
>>
>> --
>> Sincerely,
>>
>> Marshall Guillory
>>
>> Technical Program Enabler, Agile Coach, Scrum master
>> Networking (LNG) Segment Group and Automation Teams (LAB, QAS, LAVA & Builds)
>> Linaro Engineering Group
>> Content Manager - opendataplane.org
>>
>> M:  +1.405.609.4491 IRC: marshallg
>> E: marshall.guill...@linaro.org
>>
>> Linaro.org │ Open source software for ARM SoCs
>>
>> [image: Twitter]   [image: Facebook] 
>>   [image: Google Plus] 
>>   [image: Youtube] 
>> 
>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>


-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org  *│ *Open source software for ARM SoCs
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] New ODP Website page created

2015-10-15 Thread Raj Murali
How will this page linked through navigation menu?



Raj Murali
Director - Linaro Networking Group
Skype: rajmurali_s  │ M: +91 98450 70135

Linaro.org  *│ *Open source software for ARM SoCs


On 15 October 2015 at 20:59, Marshall Guillory  wrote:

> this story has been completed. A new page was created as requested and
> added to the navigation structure under Status and the Developer sidebar
> menu for ease of access.
>
> http://www.opendataplane.org/api-documentation/api-differences/
>
> Please test and report any feedback.
>
>
> --
> Sincerely,
>
> Marshall Guillory
>
> Technical Program Enabler, Agile Coach, Scrum master
> Networking (LNG) Segment Group and Automation Teams (LAB, QAS, LAVA & Builds)
> Linaro Engineering Group
> Content Manager - opendataplane.org
>
> M:  +1.405.609.4491 IRC: marshallg
> E: marshall.guill...@linaro.org
>
> Linaro.org │ Open source software for ARM SoCs
>
> [image: Twitter]   [image: Facebook] 
>   [image: Google Plus] 
>   [image: Youtube] 
> 
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1752] timer test: Number of timeouts delivered/received too late: 0

2015-10-15 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1752

Maxim Uvarov  changed:

   What|Removed |Added

 Resolution|--- |NON REPRODUCIBLE
 Status|CONFIRMED   |RESOLVED

--- Comment #5 from Maxim Uvarov  ---
I did not see our timer test fail any time more. In CI it's also stable
passing. I close this bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1549] Untested API parse_tcp

2015-10-15 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1549

--- Comment #2 from Mike Holmes  ---
The classification tests generate their own packets and validation tests need
to run even on platforms that do not implement pcap pktio as linux-generic
does.

We have said before that ODP may run on a platform with no notion of a file
system complicating pcap support.

It might make sense to generate packets in the tests for validation, possibly
this tool gets factored out to a common mechanism that compiles in the packet
definitions pulled from pcap files ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] scripts/git_hash: fix out of tree build

2015-10-15 Thread Ivan Khoronzhuk

On 15.10.15 18:36, Nicolas Morey-Chaisemartin wrote:

Git hash was modified to handled non git builds but when building
out of tree, it detects a .git folder but do not change to this
folder to run git command.

Signed-off-by: Nicolas Morey-Chaisemartin 


Tested-by: Ivan Khoronzhuk 


---
  scripts/git_hash.sh | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/git_hash.sh b/scripts/git_hash.sh
index 6cfec2f..e15094e 100755
--- a/scripts/git_hash.sh
+++ b/scripts/git_hash.sh
@@ -8,8 +8,8 @@ ROOTDIR=${1}

  CUSTOM_STR=${CUSTOM_STR:-https://git.linaro.org/lng/odp.git}
  if [ -d ${ROOTDIR}/.git ]; then
-   hash=$(git describe | tr -d "\n")
-   if git diff-index --name-only HEAD &>/dev/null ; then
+   hash=$(git --git-dir=${ROOTDIR}/.git describe | tr -d "\n")
+   if git --git-dir=${ROOTDIR}/.git diff-index --name-only HEAD 
&>/dev/null ; then
dirty=-dirty
fi




--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] scripts/git_hash: fix out of tree build

2015-10-15 Thread Nicolas Morey-Chaisemartin
Git hash was modified to handled non git builds but when building
out of tree, it detects a .git folder but do not change to this
folder to run git command.

Signed-off-by: Nicolas Morey-Chaisemartin 
---
 scripts/git_hash.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/git_hash.sh b/scripts/git_hash.sh
index 6cfec2f..e15094e 100755
--- a/scripts/git_hash.sh
+++ b/scripts/git_hash.sh
@@ -8,8 +8,8 @@ ROOTDIR=${1}
 
 CUSTOM_STR=${CUSTOM_STR:-https://git.linaro.org/lng/odp.git}
 if [ -d ${ROOTDIR}/.git ]; then
-   hash=$(git describe | tr -d "\n")
-   if git diff-index --name-only HEAD &>/dev/null ; then
+   hash=$(git --git-dir=${ROOTDIR}/.git describe | tr -d "\n")
+   if git --git-dir=${ROOTDIR}/.git diff-index --name-only HEAD 
&>/dev/null ; then
dirty=-dirty
fi
 
-- 
2.6.1.3.g8d02103

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH RFC] Revert "platform: Makefile.inc: use `` instead of != for compatibility with older versions of Make"

2015-10-15 Thread Nicolas Morey-Chaisemartin
The issue come from git_hash it self. Not the Makefile. I'm sending a patch 
right now.

On 10/15/2015 05:28 PM, Ivan Khoronzhuk wrote:
> I build it at api-next and see this:
> ...
> fatal: No names found, cannot describe anything.
>   CC   odp_system_info.lo
> fatal: No names found, cannot describe anything.
>   CC   odp_thread.lo
> fatal: No names found, cannot describe anything.
>   CC   odp_thrmask.lo
>   CC   odp_ticketlock.lo
>   CC   odp_timer.lo
>   CC   odp_time.lo
> fatal: No names found, cannot describe anything.
> fatal: No names found, cannot describe anything.
> fatal: No names found, cannot describe anything.
> fatal: No names found, cannot describe anything.
>   CC   odp_version.lo
> fatal: No names found, cannot describe anything.
>   CC   odp_weak.lo
> fatal: No names found, cannot describe anything.
>   CC   pktio/io_ops.lo
>   CC   pktio/loop.lo
> fatal: No names found, cannot describe anything.
> fatal: No names found, cannot describe anything.
>   CC   pktio/netmap.lo
> fatal: No names found, cannot describe anything.
>   CC   pktio/socket.lo
> fatal: No names found, cannot describe anything.
>   CC   pktio/socket_mmap.lo
> fatal: No names found, cannot describe anything.
>   CC   arch/x86/odp_cpu_cycles.lo
> fatal: No names found, cannot describe anything.
> ...
>
> I had a talk with Maxim at connect and he was surprised.
> We tried several methods with modifing dirs.
> When I've used $() instead of `` it helped but broke smth else...
>
>
> On 15.10.15 18:20, Nicolas Morey-Chaisemartin wrote:
>> Maybe changing the directory before running git_hash.sh would fix your issue 
>> and keep the old make working ?
>>
>> Something like
>>
>> This was fixed some time ago:
>>
>> commit 06537738ea438c3e339fc269dedb4ed6c5e48f07
>> Author: Anders Roxell 
>> Date:   Fri Aug 14 15:25:05 2015 +0200
>>
>>  scripts/git_hash: fix build from tar source
>>
>>  Signed-off-by: Anders Roxell 
>>  Reviewed-and-tested-by: Mike Holmes 
>>  Signed-off-by: Maxim Uvarov 
>>
>> Call to git_hash now adds a path to top_srcdir and handles non git dir
>>
>> On 10/15/2015 05:10 PM, Ivan Khoronzhuk wrote:
>>> This reverts commit a9cc0fc700a4a8b9589404a18136b01974ca4aa3.
>>>
>>> This revert helps me to revert messages like:
>>> "fatal: No names found, cannot describe anything." in case if I build
>>> ODP outside of source catalog by:
>>>
>>> ../../odp/configure --enable-test-perf --enable-test-vald
>>> make
>>>
>>> Seems it's connected with nesting `...`.
>>>
>>> Is someone going to fix it?
>>>
>>> ---
>>>
>>>   platform/Makefile.inc | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/platform/Makefile.inc b/platform/Makefile.inc
>>> index f64e37c..f232daa 100644
>>> --- a/platform/Makefile.inc
>>> +++ b/platform/Makefile.inc
>>> @@ -12,6 +12,6 @@ lib_LTLIBRARIES = $(LIB)/libodp.la
>>>
>>>   AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
>>>
>>> -GIT_DESC = `$(top_srcdir)/scripts/git_hash.sh`
>>> +GIT_DESC !=$(top_srcdir)/scripts/git_hash.sh
>>>   AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
>>>   AM_CFLAGS += -DPLATFORM=${with_platform}
>>
>

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] New ODP Website page created

2015-10-15 Thread Marshall Guillory
this story has been completed. A new page was created as requested and
added to the navigation structure under Status and the Developer sidebar
menu for ease of access.

http://www.opendataplane.org/api-documentation/api-differences/

Please test and report any feedback.


-- 
Sincerely,

Marshall Guillory

Technical Program Enabler, Agile Coach, Scrum master
Networking (LNG) Segment Group and Automation Teams (LAB, QAS, LAVA & Builds)
Linaro Engineering Group
Content Manager - opendataplane.org

M:  +1.405.609.4491 IRC: marshallg
E: marshall.guill...@linaro.org

Linaro.org │ Open source software for ARM SoCs

[image: Twitter]   [image: Facebook]
  [image: Google Plus]
  [image:
Youtube] 
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH RFC] Revert "platform: Makefile.inc: use `` instead of != for compatibility with older versions of Make"

2015-10-15 Thread Ivan Khoronzhuk

I build it at api-next and see this:
...
fatal: No names found, cannot describe anything.
  CC   odp_system_info.lo
fatal: No names found, cannot describe anything.
  CC   odp_thread.lo
fatal: No names found, cannot describe anything.
  CC   odp_thrmask.lo
  CC   odp_ticketlock.lo
  CC   odp_timer.lo
  CC   odp_time.lo
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
  CC   odp_version.lo
fatal: No names found, cannot describe anything.
  CC   odp_weak.lo
fatal: No names found, cannot describe anything.
  CC   pktio/io_ops.lo
  CC   pktio/loop.lo
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
  CC   pktio/netmap.lo
fatal: No names found, cannot describe anything.
  CC   pktio/socket.lo
fatal: No names found, cannot describe anything.
  CC   pktio/socket_mmap.lo
fatal: No names found, cannot describe anything.
  CC   arch/x86/odp_cpu_cycles.lo
fatal: No names found, cannot describe anything.
...

I had a talk with Maxim at connect and he was surprised.
We tried several methods with modifing dirs.
When I've used $() instead of `` it helped but broke smth else...


On 15.10.15 18:20, Nicolas Morey-Chaisemartin wrote:

Maybe changing the directory before running git_hash.sh would fix your issue 
and keep the old make working ?

Something like

This was fixed some time ago:

commit 06537738ea438c3e339fc269dedb4ed6c5e48f07
Author: Anders Roxell 
Date:   Fri Aug 14 15:25:05 2015 +0200

 scripts/git_hash: fix build from tar source

 Signed-off-by: Anders Roxell 
 Reviewed-and-tested-by: Mike Holmes 
 Signed-off-by: Maxim Uvarov 

Call to git_hash now adds a path to top_srcdir and handles non git dir

On 10/15/2015 05:10 PM, Ivan Khoronzhuk wrote:

This reverts commit a9cc0fc700a4a8b9589404a18136b01974ca4aa3.

This revert helps me to revert messages like:
"fatal: No names found, cannot describe anything." in case if I build
ODP outside of source catalog by:

../../odp/configure --enable-test-perf --enable-test-vald
make

Seems it's connected with nesting `...`.

Is someone going to fix it?

---

  platform/Makefile.inc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index f64e37c..f232daa 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -12,6 +12,6 @@ lib_LTLIBRARIES = $(LIB)/libodp.la

  AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'

-GIT_DESC = `$(top_srcdir)/scripts/git_hash.sh`
+GIT_DESC !=$(top_srcdir)/scripts/git_hash.sh
  AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
  AM_CFLAGS += -DPLATFORM=${with_platform}




--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH RFC] Revert "platform: Makefile.inc: use `` instead of != for compatibility with older versions of Make"

2015-10-15 Thread Nicolas Morey-Chaisemartin
Please forget the first two sentences of my previous mail.
I started writing an alternate patch and then realized it was fixed in master 
already.

On 10/15/2015 05:20 PM, Nicolas Morey-Chaisemartin wrote:
> Maybe changing the directory before running git_hash.sh would fix your issue 
> and keep the old make working ?
>
> Something like
>
> This was fixed some time ago:
>
> commit 06537738ea438c3e339fc269dedb4ed6c5e48f07
> Author: Anders Roxell 
> Date:   Fri Aug 14 15:25:05 2015 +0200
>
> scripts/git_hash: fix build from tar source
> 
> Signed-off-by: Anders Roxell 
> Reviewed-and-tested-by: Mike Holmes 
> Signed-off-by: Maxim Uvarov 
>
> Call to git_hash now adds a path to top_srcdir and handles non git dir
>
> On 10/15/2015 05:10 PM, Ivan Khoronzhuk wrote:
>> This reverts commit a9cc0fc700a4a8b9589404a18136b01974ca4aa3.
>>
>> This revert helps me to revert messages like:
>> "fatal: No names found, cannot describe anything." in case if I build
>> ODP outside of source catalog by:
>>
>> ../../odp/configure --enable-test-perf --enable-test-vald
>> make
>>
>> Seems it's connected with nesting `...`.
>>
>> Is someone going to fix it?
>>
>> ---
>>
>>  platform/Makefile.inc | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/platform/Makefile.inc b/platform/Makefile.inc
>> index f64e37c..f232daa 100644
>> --- a/platform/Makefile.inc
>> +++ b/platform/Makefile.inc
>> @@ -12,6 +12,6 @@ lib_LTLIBRARIES = $(LIB)/libodp.la
>>  
>>  AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
>>  
>> -GIT_DESC = `$(top_srcdir)/scripts/git_hash.sh`
>> +GIT_DESC !=$(top_srcdir)/scripts/git_hash.sh
>>  AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
>>  AM_CFLAGS += -DPLATFORM=${with_platform}
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH RFC] Revert "platform: Makefile.inc: use `` instead of != for compatibility with older versions of Make"

2015-10-15 Thread Nicolas Morey-Chaisemartin
Maybe changing the directory before running git_hash.sh would fix your issue 
and keep the old make working ?

Something like

This was fixed some time ago:

commit 06537738ea438c3e339fc269dedb4ed6c5e48f07
Author: Anders Roxell 
Date:   Fri Aug 14 15:25:05 2015 +0200

scripts/git_hash: fix build from tar source

Signed-off-by: Anders Roxell 
Reviewed-and-tested-by: Mike Holmes 
Signed-off-by: Maxim Uvarov 

Call to git_hash now adds a path to top_srcdir and handles non git dir

On 10/15/2015 05:10 PM, Ivan Khoronzhuk wrote:
> This reverts commit a9cc0fc700a4a8b9589404a18136b01974ca4aa3.
>
> This revert helps me to revert messages like:
> "fatal: No names found, cannot describe anything." in case if I build
> ODP outside of source catalog by:
>
> ../../odp/configure --enable-test-perf --enable-test-vald
> make
>
> Seems it's connected with nesting `...`.
>
> Is someone going to fix it?
>
> ---
>
>  platform/Makefile.inc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/platform/Makefile.inc b/platform/Makefile.inc
> index f64e37c..f232daa 100644
> --- a/platform/Makefile.inc
> +++ b/platform/Makefile.inc
> @@ -12,6 +12,6 @@ lib_LTLIBRARIES = $(LIB)/libodp.la
>  
>  AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
>  
> -GIT_DESC = `$(top_srcdir)/scripts/git_hash.sh`
> +GIT_DESC !=$(top_srcdir)/scripts/git_hash.sh
>  AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
>  AM_CFLAGS += -DPLATFORM=${with_platform}

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH RFC] Revert "platform: Makefile.inc: use `` instead of != for compatibility with older versions of Make"

2015-10-15 Thread Ivan Khoronzhuk

It shouldn't depend on catalog the project is built.

On 15.10.15 18:10, Ivan Khoronzhuk wrote:

This reverts commit a9cc0fc700a4a8b9589404a18136b01974ca4aa3.

This revert helps me to revert messages like:
"fatal: No names found, cannot describe anything." in case if I build
ODP outside of source catalog by:

../../odp/configure --enable-test-perf --enable-test-vald
make

Seems it's connected with nesting `...`.

Is someone going to fix it?

---

  platform/Makefile.inc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index f64e37c..f232daa 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -12,6 +12,6 @@ lib_LTLIBRARIES = $(LIB)/libodp.la

  AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'

-GIT_DESC = `$(top_srcdir)/scripts/git_hash.sh`
+GIT_DESC !=$(top_srcdir)/scripts/git_hash.sh
  AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
  AM_CFLAGS += -DPLATFORM=${with_platform}



--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH RFC] Revert "platform: Makefile.inc: use `` instead of != for compatibility with older versions of Make"

2015-10-15 Thread Ivan Khoronzhuk
This reverts commit a9cc0fc700a4a8b9589404a18136b01974ca4aa3.

This revert helps me to revert messages like:
"fatal: No names found, cannot describe anything." in case if I build
ODP outside of source catalog by:

../../odp/configure --enable-test-perf --enable-test-vald
make

Seems it's connected with nesting `...`.

Is someone going to fix it?

---

 platform/Makefile.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index f64e37c..f232daa 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -12,6 +12,6 @@ lib_LTLIBRARIES = $(LIB)/libodp.la
 
 AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
 
-GIT_DESC = `$(top_srcdir)/scripts/git_hash.sh`
+GIT_DESC !=$(top_srcdir)/scripts/git_hash.sh
 AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
 AM_CFLAGS += -DPLATFORM=${with_platform}
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 6/6] api: atomic: added 32 bit acquire and release

2015-10-15 Thread Petri Savolainen
Added 32 bit acquire load/cas and release store/add/sub calls.
These are the minimum set of non-relaxed calls that are needed
for building lock-free algorithms. 64 bit versions can be added
later.

Signed-off-by: Petri Savolainen 
---
 include/odp/api/atomic.h| 80 -
 platform/linux-generic/include/odp/atomic.h | 32 
 2 files changed, 111 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
index 957d304..cbf241d 100644
--- a/include/odp/api/atomic.h
+++ b/include/odp/api/atomic.h
@@ -21,7 +21,7 @@ extern "C" {
 /**
  * @defgroup odp_atomic ODP ATOMIC
  * @details
- *  Atomic integers 
+ *  Atomic integers using relaxed memory ordering 
  *
  * Atomic integer types (odp_atomic_u32_t and odp_atomic_u64_t) can be used to
  * implement e.g. shared counters. If not otherwise documented, operations in
@@ -31,6 +31,18 @@ extern "C" {
  * before or after the operation), only atomicity of the operation itself is
  * guaranteed.
  *
+ *  Operations with other than relaxed memory ordering 
+ *
+ *  An operation with RELEASE  memory ordering 
(odp_atomic_xxx_rls_xxx())
+ * ensures that other threads loading the same atomic variable with ACQUIRE
+ * memory ordering see all stores (from the calling thread) that happened 
before
+ * this releasing store.
+ *
+ *  An operation with ACQUIRE  memory ordering 
(odp_atomic_xxx_acq_xxx())
+ * ensures that the calling thread sees all stores (done by the releasing
+ * thread) that happened before a RELEASE memory ordered store to the same
+ * atomic variable.
+ *
  * @{
  */
 
@@ -265,6 +277,72 @@ void odp_atomic_dec_u64(odp_atomic_u64_t *atom);
 int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val,
   uint64_t new_val);
 
+/*
+ * Operations with other than relaxed memory ordering
+ * --
+ */
+
+/**
+ * Load value of atomic uint32 variable using ACQUIRE memory ordering
+ *
+ * Otherwise identical to odp_atomic_load_u32() but ensures ACQUIRE memory
+ * ordering.
+ *
+ * @param atomPointer to atomic variable
+ *
+ * @return Value of the variable
+ */
+uint32_t odp_atomic_load_acq_u32(odp_atomic_u32_t *atom);
+
+/**
+ * Compare and swap atomic uint32 variable using ACQUIRE memory ordering
+ *
+ * Otherwise identical to odp_atomic_cas_u32() but ensures ACQUIRE memory
+ * ordering.
+ *
+ * @param atom  Pointer to atomic variable
+ * @param[in,out] old_val   Pointer to the old value of the atomic variable.
+ *  Operation updates this value on failure.
+ * @param new_val   New value to be written into the atomic variable
+ *
+ * @return 0 on failure, !0 on success
+ */
+int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom, uint32_t *old_val,
+  uint32_t new_val);
+
+/**
+ * Store value to atomic uint32 variable using RELEASE memory ordering
+ *
+ * Otherwise identical to odp_atomic_store_u32() but ensures RELEASE memory
+ * ordering.
+ *
+ * @param atomPointer to atomic variable
+ * @param val Value to store in the variable
+ */
+void odp_atomic_store_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
+
+/**
+ * Add to atomic uint32 variable using RELEASE memory ordering
+ *
+ * Otherwise identical to odp_atomic_add_u32() but ensures RELEASE memory
+ * ordering.
+ *
+ * @param atomPointer to atomic variable
+ * @param val Value to be added to the variable
+ */
+void odp_atomic_add_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
+
+/**
+ * Subtract from atomic uint32 variable using RELEASE memory ordering
+ *
+ * Otherwise identical to odp_atomic_sub_u32() but ensures RELEASE memory
+ * ordering.
+ *
+ * @param atomPointer to atomic variable
+ * @param val Value to be subtracted from the variable
+ */
+void odp_atomic_sub_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
+
 /**
  * @}
  */
diff --git a/platform/linux-generic/include/odp/atomic.h 
b/platform/linux-generic/include/odp/atomic.h
index 5a143a5..8f83c04 100644
--- a/platform/linux-generic/include/odp/atomic.h
+++ b/platform/linux-generic/include/odp/atomic.h
@@ -204,6 +204,38 @@ static inline int odp_atomic_cas_u64(odp_atomic_u64_t 
*atom, uint64_t *old_val,
   __ATOMIC_RELAXED);
 }
 
+static inline uint32_t odp_atomic_load_acq_u32(odp_atomic_u32_t *atom)
+{
+   return __atomic_load_n(&atom->v, __ATOMIC_ACQUIRE);
+}
+
+static inline int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom,
+uint32_t *old_val, uint32_t new_val)
+{
+   return __atomic_compare_exchange_n(&atom->v, old_val, new_val,
+  0 /* strong */,
+  __ATOMIC_ACQUIRE,
+  __ATOMIC_RELAXED);
+}
+
+static inline void odp_atomic_store_rls_u32(odp_atomic_u32_t *atom,
+ 

[lng-odp] [API-NEXT PATCH 3/6] api: doc: re-organize doxygen doc for synchronizer

2015-10-15 Thread Petri Savolainen
Removed module synchronizer from doxygen documentation and
introduced new modules for locks, atomics and barriers. Removed
unnecessary group tagging from internal headers, which are not
visible to doxygen anyway.

Signed-off-by: Petri Savolainen 
---
 include/odp/api/atomic.h  |  2 +-
 include/odp/api/barrier.h |  4 ++--
 include/odp/api/rwlock.h  | 19 +++
 include/odp/api/rwlock_recursive.h| 17 ++---
 include/odp/api/spinlock.h| 11 ---
 include/odp/api/spinlock_recursive.h  | 15 +--
 include/odp/api/sync.h|  2 +-
 include/odp/api/ticketlock.h  | 16 ++--
 platform/linux-generic/include/odp/atomic.h   |  2 +-
 platform/linux-generic/include/odp/barrier.h  |  8 
 .../linux-generic/include/odp/plat/atomic_types.h |  8 
 .../linux-generic/include/odp/plat/barrier_types.h|  8 
 .../include/odp/plat/rwlock_recursive_types.h | 13 +
 .../linux-generic/include/odp/plat/rwlock_types.h | 13 +
 .../include/odp/plat/spinlock_recursive_types.h   | 13 +
 .../linux-generic/include/odp/plat/spinlock_types.h   | 14 +-
 .../linux-generic/include/odp/plat/ticketlock_types.h | 13 +
 platform/linux-generic/include/odp/rwlock.h   |  8 
 platform/linux-generic/include/odp/spinlock.h |  8 
 platform/linux-generic/include/odp/sync.h |  8 
 platform/linux-generic/include/odp/ticketlock.h   |  9 -
 platform/linux-generic/include/odp_atomic_internal.h  |  9 -
 22 files changed, 58 insertions(+), 162 deletions(-)

diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
index ba5c354..8aacc9d 100644
--- a/include/odp/api/atomic.h
+++ b/include/odp/api/atomic.h
@@ -18,7 +18,7 @@
 extern "C" {
 #endif
 
-/** @addtogroup odp_synchronizers
+/** @defgroup odp_atomic ODP ATOMIC
  *  Atomic types and relaxed operations. These operations cannot be used for
  *  synchronization.
  *  @{
diff --git a/include/odp/api/barrier.h b/include/odp/api/barrier.h
index 28310ba..8ca2647 100644
--- a/include/odp/api/barrier.h
+++ b/include/odp/api/barrier.h
@@ -18,8 +18,8 @@
 extern "C" {
 #endif
 
-/** @addtogroup odp_synchronizers
- *  Synchronize threads.
+/** @defgroup odp_barrier ODP BARRIER
+ *  Thread excution and memory ordering barriers.
  *  @{
  */
 
diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
index d730a70..54f426f 100644
--- a/include/odp/api/rwlock.h
+++ b/include/odp/api/rwlock.h
@@ -17,18 +17,21 @@
 extern "C" {
 #endif
 
-/** @defgroup odp_synchronizers ODP SYNCRONIZERS
- *  Operations on reader/writer locks.
- *  A reader/writer lock allows multiple simultaneous readers but only one
- *  writer at a time.
- *  A thread that wants write access will have to wait until there are no
- *  threads that want read access. This casues a risk for starvation.
- *  @{
+/**
+ * @defgroup odp_locks ODP LOCKS
+ * @details
+ *  Reader / writer lock (odp_rwlock_t) 
+ *
+ * A reader/writer lock allows multiple simultaneous readers but only one
+ * writer at a time. A thread that wants write access will have to wait until
+ * there are no threads that want read access. This casues a risk for
+ * starvation.
+ * @{
  */
 
 /**
  * @typedef odp_rwlock_t
- * ODP rwlock
+ * ODP reader/writer lock
  */
 
 
diff --git a/include/odp/api/rwlock_recursive.h 
b/include/odp/api/rwlock_recursive.h
index 4c7556a..10b2f79 100644
--- a/include/odp/api/rwlock_recursive.h
+++ b/include/odp/api/rwlock_recursive.h
@@ -17,15 +17,12 @@
 extern "C" {
 #endif
 
-/** @addtogroup odp_synchronizers
- *  Operations on recursive rwlocks.
- *  @{
- */
-
 /**
- * @typedef odp_rwlock_recursive_t
- * Recursive rwlock
+ * @addtogroup odp_locks
+ * @details
+ *  Recursive reader/writer lock (odp_rwlock_recursive_t) 
  *
+ * This is recursive version of the reader/writer lock.
  * A thread can read- or write-acquire a recursive read-write lock multiple
  * times without a deadlock. To release the lock, the thread must unlock it
  * the same number of times. Recursion is supported only for a pure series of
@@ -38,6 +35,12 @@ extern "C" {
  *
  * ... but this is not supported.
  *   * read_lock(); write_lock(); write_unlock(); read_unlock();
+ * @{
+ */
+
+/**
+ * @typedef odp_rwlock_recursive_t
+ * Recursive rwlock
  */
 
 /**
diff --git a/include/odp/api/spinlock.h b/include/odp/api/spinlock.h
index 9a5a929..154d025 100644
--- a/include/odp/api/spinlock.h
+++ b/include/odp/api/spinlock.h
@@ -18,9 +18,14 @@
 extern "C" {
 #endif
 
-/** @addtogroup odp_synchronizers
- *  Operations on spin locks.
- *  @{
+/**
+ * @addtogroup odp_locks
+ * @details
+ *  Spin lock (odp_spinlock_t) 
+ *
+ * Spinlock simply re-tries to

[lng-odp] [API-NEXT PATCH 4/6] api: atomic: clean atomic API documentation

2015-10-15 Thread Petri Savolainen
Refined and centralized comment about relaxed memory ordering.
Removed in/out doxygen tags since 'atom' pointer to an object
that application must not directly access (only through the API).

Signed-off-by: Petri Savolainen 
---
 include/odp/api/atomic.h | 112 ---
 1 file changed, 48 insertions(+), 64 deletions(-)

diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
index 8aacc9d..97e8639 100644
--- a/include/odp/api/atomic.h
+++ b/include/odp/api/atomic.h
@@ -18,10 +18,20 @@
 extern "C" {
 #endif
 
-/** @defgroup odp_atomic ODP ATOMIC
- *  Atomic types and relaxed operations. These operations cannot be used for
- *  synchronization.
- *  @{
+/**
+ * @defgroup odp_atomic ODP ATOMIC
+ * @details
+ *  Atomic integers 
+ *
+ * Atomic integer types (odp_atomic_u32_t and odp_atomic_u64_t) can be used to
+ * implement e.g. shared counters. If not otherwise documented, operations in
+ * this API are implemented using  RELAXED memory ordering  (see memory
+ * order descriptions in the C11 specification). Relaxed operations do not
+ * provide synchronization or ordering for other memory accesses (initiated
+ * before or after the operation), only atomicity of the operation itself is
+ * guaranteed.
+ *
+ * @{
  */
 
 /**
@@ -34,19 +44,16 @@ extern "C" {
 
 /**
  * Initialize atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchronization
  *
- * @param[out] atom Pointer to an atomic uint32 variable
- * @param val Value to initialize the variable with
+ * @param atomPointer to atomic variable
+ * @param val Value to initialize the variable with
  */
 void odp_atomic_init_u32(odp_atomic_u32_t *atom, uint32_t val);
 
-
 /**
  * Load value of atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchronization
  *
- * @param atom Pointer to an atomic uint32 variable
+ * @param atomPointer to atomic variable
  *
  * @return Value of the variable
  */
@@ -54,19 +61,17 @@ uint32_t odp_atomic_load_u32(odp_atomic_u32_t *atom);
 
 /**
  * Store value to atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchronization
  *
- * @param[out] atom Pointer to an atomic uint32 variable
- * @param val Value to store in the variable
+ * @param atomPointer to atomic variable
+ * @param val Value to store in the variable
  */
 void odp_atomic_store_u32(odp_atomic_u32_t *atom, uint32_t val);
 
 /**
  * Fetch and add to atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchronization
  *
- * @param[in,out] atom Pointer to an atomic uint32 variable
- * @param val Value to be added to the variable
+ * @param atomPointer to atomic variable
+ * @param val Value to be added to the variable
  *
  * @return Value of the variable before the addition
  */
@@ -74,19 +79,17 @@ uint32_t odp_atomic_fetch_add_u32(odp_atomic_u32_t *atom, 
uint32_t val);
 
 /**
  * Add to atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchronization
  *
- * @param[in,out] atom Pointer to an atomic uint32 variable
- * @param val A value to be added to the variable
+ * @param atomPointer to atomic variable
+ * @param val Value to be added to the variable
  */
 void odp_atomic_add_u32(odp_atomic_u32_t *atom, uint32_t val);
 
 /**
  * Fetch and subtract from atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchronization
  *
- * @param[in,out] atom Pointer to an atomic uint32 variable
- * @param val A value to be subracted from the variable
+ * @param atomPointer to atomic variable
+ * @param val Value to be subracted from the variable
  *
  * @return Value of the variable before the subtraction
  */
@@ -94,37 +97,32 @@ uint32_t odp_atomic_fetch_sub_u32(odp_atomic_u32_t *atom, 
uint32_t val);
 
 /**
  * Subtract from atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchronization
  *
- * @param[in,out] atom Pointer to an atomic uint32 variable
- * @param val Value to be subtracted from the variable
+ * @param atomPointer to atomic variable
+ * @param val Value to be subtracted from the variable
  */
 void odp_atomic_sub_u32(odp_atomic_u32_t *atom, uint32_t val);
 
 /**
  * Fetch and increment atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchronization
  *
- * @param[in,out] atom Pointer to an atomic uint32 variable
+ * @param atomPointer to atomic variable
  *
  * @return Value of the variable before the increment
  */
-
 uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *atom);
 
 /**
  * Increment atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchronization
  *
- * @param[in,out] atom Pointer to an atomic uint32 variable
+ * @param atomPointer to atomic variable
  */
 void odp_atomic_inc_u32(odp_atomic_u32_t *atom);
 
 /**
  * Fetch and decrement atomic uint32 variable
- * @note Relaxed memory order, cannot be used for synchr

[lng-odp] [API-NEXT PATCH 2/6] doc: add doxygen layout file to control group page output

2015-10-15 Thread Petri Savolainen
Group level documentation can be used for API level general
description. Layout file is needed to place detailed group
description on the top of a page. By default doxygen shows
only the brief description on top (the first sentence).

Signed-off-by: Petri Savolainen 
---
 doc/doxygen.cfg   |   1 +
 doc/doxygenlayout.xml | 195 ++
 2 files changed, 196 insertions(+)
 create mode 100644 doc/doxygenlayout.xml

diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
index f28ec24..909f0ce 100644
--- a/doc/doxygen.cfg
+++ b/doc/doxygen.cfg
@@ -33,6 +33,7 @@ EXAMPLE_PATTERNS = *.c
 EXAMPLE_RECURSIVE = YES
 IMAGE_PATH = $(SRCDIR)/doc/images
 HTML_EXTRA_STYLESHEET = $(SRCDIR)/doc/odpdoxygen.css
+LAYOUT_FILE = $(SRCDIR)/doc/doxygenlayout.xml
 ENABLE_PREPROCESSING = YES
 MACRO_EXPANSION = YES
 EXPAND_ONLY_PREDEF = YES
diff --git a/doc/doxygenlayout.xml b/doc/doxygenlayout.xml
new file mode 100644
index 000..54467c8
--- /dev/null
+++ b/doc/doxygenlayout.xml
@@ -0,0 +1,195 @@
+
+  
+  
+  
+
+
+
+
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+
+
+  
+
+  
+  
+
+
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+
+
+  
+
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+
+
+  
+
+  
+  
+
+
+
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+  
+
+
+  
+
+  
+  
+
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+
+  
+  
+
+
+
+  
+  
+
+
+  
+
-- 
2.6.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 5/6] api: atomic: added cas operations

2015-10-15 Thread Petri Savolainen
Added cas operations for 32 and 64 bit atomic variables. These
use relaxed memory order (as all other operations).

Signed-off-by: Petri Savolainen 
---
 include/odp/api/atomic.h| 37 +
 platform/linux-generic/include/odp/atomic.h | 18 ++
 2 files changed, 55 insertions(+)

diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
index 97e8639..957d304 100644
--- a/include/odp/api/atomic.h
+++ b/include/odp/api/atomic.h
@@ -136,6 +136,25 @@ uint32_t odp_atomic_fetch_dec_u32(odp_atomic_u32_t *atom);
 void odp_atomic_dec_u32(odp_atomic_u32_t *atom);
 
 /**
+ * Compare and swap atomic uint32 variable
+ *
+ * Compares value of atomic variable to the value pointed by 'old_val'.
+ * If values are equal, the operation writes 'new_val' into the atomic variable
+ * and returns success. If they are not equal, the operation writes current
+ * value of atomic variable into 'old_val' and returns failure.
+ *
+ * @param atom  Pointer to atomic variable
+ * @param[in,out] old_val   Pointer to the old value of the atomic variable.
+ *  Operation updates this value on failure.
+ * @param new_val   New value to be written into the atomic variable
+ *
+ * @return 0 on failure, !0 on success
+ *
+ */
+int odp_atomic_cas_u32(odp_atomic_u32_t *atom, uint32_t *old_val,
+  uint32_t new_val);
+
+/**
  * Initialize atomic uint64 variable
  *
  * @param atomPointer to atomic variable
@@ -229,6 +248,24 @@ uint64_t odp_atomic_fetch_dec_u64(odp_atomic_u64_t *atom);
 void odp_atomic_dec_u64(odp_atomic_u64_t *atom);
 
 /**
+ * Compare and swap atomic uint64 variable
+ *
+ * Compares value of atomic variable to the value pointed by 'old_val'.
+ * If values are equal, the operation writes 'new_val' into the atomic variable
+ * and returns success. If they are not equal, the operation writes current
+ * value of atomic variable into 'old_val' and returns failure.
+ *
+ * @param atom  Pointer to atomic variable
+ * @param[in,out] old_val   Pointer to the old value of the atomic variable.
+ *  Operation updates this value on failure.
+ * @param new_val   New value to be written into the atomic variable
+ *
+ * @return 0 on failure, !0 on success
+ */
+int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val,
+  uint64_t new_val);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/include/odp/atomic.h 
b/platform/linux-generic/include/odp/atomic.h
index deb4039..5a143a5 100644
--- a/platform/linux-generic/include/odp/atomic.h
+++ b/platform/linux-generic/include/odp/atomic.h
@@ -85,6 +85,15 @@ static inline void odp_atomic_dec_u32(odp_atomic_u32_t *atom)
(void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED);
 }
 
+static inline int odp_atomic_cas_u32(odp_atomic_u32_t *atom, uint32_t *old_val,
+uint32_t new_val)
+{
+   return __atomic_compare_exchange_n(&atom->v, old_val, new_val,
+  0 /* strong */,
+  __ATOMIC_RELAXED,
+  __ATOMIC_RELAXED);
+}
+
 static inline void odp_atomic_init_u64(odp_atomic_u64_t *atom, uint64_t val)
 {
atom->v = val;
@@ -186,6 +195,15 @@ static inline void odp_atomic_dec_u64(odp_atomic_u64_t 
*atom)
 #endif
 }
 
+static inline int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val,
+uint64_t new_val)
+{
+   return __atomic_compare_exchange_n(&atom->v, old_val, new_val,
+  0 /* strong */,
+  __ATOMIC_RELAXED,
+  __ATOMIC_RELAXED);
+}
+
 /**
  * @}
  */
-- 
2.6.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 1/6] api: doc: remove broken doxygen reference

2015-10-15 Thread Petri Savolainen
Reference caused warning when creating doxygen documentation.

Signed-off-by: Petri Savolainen 
---
 include/odp/api/packet_io.h| 2 +-
 platform/linux-generic/include/odp/debug.h | 8 
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 3479af1..c17f8fa 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -30,7 +30,7 @@ extern "C" {
  * odp_pktio_send().
  * Diagnostic messages can be enhanced by using odp_pktio_to_u64 which
  * will generate a printable reference for a pktio handle for use with
- * the logging @ref odp_ver_abt_log_dbg.
+ * the logging.
  *  @{
  */
 
diff --git a/platform/linux-generic/include/odp/debug.h 
b/platform/linux-generic/include/odp/debug.h
index 987ced2..a2e59bf 100644
--- a/platform/linux-generic/include/odp/debug.h
+++ b/platform/linux-generic/include/odp/debug.h
@@ -17,14 +17,6 @@
 extern "C" {
 #endif
 
-/** @ingroup odp_ver_abt_log_dbg
- *  @{
- */
-
-/**
- * @}
- */
-
 #include 
 
 #ifdef __cplusplus
-- 
2.6.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT/PATCHv5] validation: classification: added additional suite to test individual PMRs

2015-10-15 Thread Ivan Khoronzhuk



On 15.10.15 16:39, Bala Manoharan wrote:

Hi Ivan,

Thanks for pointing out the issues. Since this patch is merged I will
create a bug and add the missing points.
Pls provide your inputs on the comments.

On 15 October 2015 at 16:53, Ivan Khoronzhuk  wrote:

Hi, Bala

Just compared this version with requirements for v2 and saw some mistmaches.
I didn't analize it deeply, seemply checked what was needed to be changed.
See comments below.

Sorry, I haven't found v4, and haven't revewed v3.


On 14.10.15 08:03, Balasubramanian Manoharan wrote:


Additional test suite is added to classification validation suite to test
individual PMRs. This suite will test the defined PMRs by configuring
pktio separately for every test case.

Fixes:
https://bugs.linaro.org/show_bug.cgi?id=1542
https://bugs.linaro.org/show_bug.cgi?id=1544
https://bugs.linaro.org/show_bug.cgi?id=1545
https://bugs.linaro.org/show_bug.cgi?id=1546

Signed-off-by: Balasubramanian Manoharan 
---
v5: rebase on latest api-next

   helper/include/odp/helper/tcp.h|   1 +
   test/validation/classification/Makefile.am |   2 +
   test/validation/classification/classification.c|   5 +
   test/validation/classification/classification.h|  44 ++
   .../classification/odp_classification_common.c | 252 +
   .../classification/odp_classification_test_pmr.c   | 579
+
   .../classification/odp_classification_tests.c  | 309 ++-
   .../classification/odp_classification_testsuites.h |  15 +-
   8 files changed, 948 insertions(+), 259 deletions(-)
   create mode 100644
test/validation/classification/odp_classification_common.c
   create mode 100644
test/validation/classification/odp_classification_test_pmr.c

diff --git a/helper/include/odp/helper/tcp.h
b/helper/include/odp/helper/tcp.h
index defe422..42f0cbe 100644
--- a/helper/include/odp/helper/tcp.h
+++ b/helper/include/odp/helper/tcp.h
@@ -26,6 +26,7 @@ extern "C" {
*  @{
*/

+#define ODPH_TCPHDR_LEN 20 /**< Min length of TCP header (no options) */

   /** TCP header */
   typedef struct ODP_PACKED {
diff --git a/test/validation/classification/Makefile.am
b/test/validation/classification/Makefile.am
index 5881665..4235309 100644
--- a/test/validation/classification/Makefile.am
+++ b/test/validation/classification/Makefile.am
@@ -3,6 +3,8 @@ include ../Makefile.inc
   noinst_LTLIBRARIES = libtestclassification.la
   libtestclassification_la_SOURCES = odp_classification_basic.c \
odp_classification_tests.c \
+  odp_classification_test_pmr.c \
+  odp_classification_common.c \
classification.c

   bin_PROGRAMS = classification_main$(EXEEXT)
diff --git a/test/validation/classification/classification.c
b/test/validation/classification/classification.c
index d0fef93..6641893 100644
--- a/test/validation/classification/classification.c
+++ b/test/validation/classification/classification.c
@@ -13,6 +13,11 @@ CU_SuiteInfo classification_suites[] = {
 { .pName = "classification basic",
 .pTests = classification_suite_basic,
 },
+   { .pName = "classification pmr tests",
+   .pTests = classification_suite_pmr,
+   .pInitFunc = classification_suite_pmr_init,
+   .pCleanupFunc = classification_suite_pmr_term,
+   },
 { .pName = "classification tests",
 .pTests = classification_suite,
 .pInitFunc = classification_suite_init,
diff --git a/test/validation/classification/classification.h
b/test/validation/classification/classification.h
index d2847e5..de9c37e 100644
--- a/test/validation/classification/classification.h
+++ b/test/validation/classification/classification.h
@@ -9,6 +9,50 @@

   #include 

+#define SHM_PKT_NUM_BUFS32
+#define SHM_PKT_BUF_SIZE1024
+
+/* Config values for Default CoS */
+#define TEST_DEFAULT   1
+#defineCLS_DEFAULT 0
+#define CLS_DEFAULT_SADDR  "10.0.0.1/32"
+#define CLS_DEFAULT_DADDR  "10.0.0.100/32"
+#define CLS_DEFAULT_SPORT  1024
+#define CLS_DEFAULT_DPORT  2048
+
+/* Config values for Error CoS */
+#define TEST_ERROR 1
+#define CLS_ERROR  1
+
+/* Config values for PMR_CHAIN */
+#define TEST_PMR_CHAIN 1
+#define CLS_PMR_CHAIN_SRC  2
+#define CLS_PMR_CHAIN_DST  3
+#define CLS_PMR_CHAIN_SADDR"10.0.0.5/32"
+#define CLS_PMR_CHAIN_SPORT3000
+
+/* Config values for PMR */
+#define TEST_PMR   1
+#define CLS_PMR4
+#define CLS_PMR_SPORT  4000
+
+/* Config values for PMR SET */
+#define TEST_PMR_SET   1
+#define CLS_PMR_SET5
+#define CLS_PMR_SET_SADDR  "10.0.0.6/32"
+#define CLS_PMR_SET_SPORT  5000
+
+/* Config values for CoS L2 Priority */
+#define TEST_L2_QOS 

Re: [lng-odp] [API-NEXT/PATCHv5] validation: classification: added additional suite to test individual PMRs

2015-10-15 Thread Bala Manoharan
Hi Ivan,

Thanks for pointing out the issues. Since this patch is merged I will
create a bug and add the missing points.
Pls provide your inputs on the comments.

On 15 October 2015 at 16:53, Ivan Khoronzhuk  wrote:
> Hi, Bala
>
> Just compared this version with requirements for v2 and saw some mistmaches.
> I didn't analize it deeply, seemply checked what was needed to be changed.
> See comments below.
>
> Sorry, I haven't found v4, and haven't revewed v3.
>
>
> On 14.10.15 08:03, Balasubramanian Manoharan wrote:
>>
>> Additional test suite is added to classification validation suite to test
>> individual PMRs. This suite will test the defined PMRs by configuring
>> pktio separately for every test case.
>>
>> Fixes:
>> https://bugs.linaro.org/show_bug.cgi?id=1542
>> https://bugs.linaro.org/show_bug.cgi?id=1544
>> https://bugs.linaro.org/show_bug.cgi?id=1545
>> https://bugs.linaro.org/show_bug.cgi?id=1546
>>
>> Signed-off-by: Balasubramanian Manoharan 
>> ---
>> v5: rebase on latest api-next
>>
>>   helper/include/odp/helper/tcp.h|   1 +
>>   test/validation/classification/Makefile.am |   2 +
>>   test/validation/classification/classification.c|   5 +
>>   test/validation/classification/classification.h|  44 ++
>>   .../classification/odp_classification_common.c | 252 +
>>   .../classification/odp_classification_test_pmr.c   | 579
>> +
>>   .../classification/odp_classification_tests.c  | 309 ++-
>>   .../classification/odp_classification_testsuites.h |  15 +-
>>   8 files changed, 948 insertions(+), 259 deletions(-)
>>   create mode 100644
>> test/validation/classification/odp_classification_common.c
>>   create mode 100644
>> test/validation/classification/odp_classification_test_pmr.c
>>
>> diff --git a/helper/include/odp/helper/tcp.h
>> b/helper/include/odp/helper/tcp.h
>> index defe422..42f0cbe 100644
>> --- a/helper/include/odp/helper/tcp.h
>> +++ b/helper/include/odp/helper/tcp.h
>> @@ -26,6 +26,7 @@ extern "C" {
>>*  @{
>>*/
>>
>> +#define ODPH_TCPHDR_LEN 20 /**< Min length of TCP header (no options) */
>>
>>   /** TCP header */
>>   typedef struct ODP_PACKED {
>> diff --git a/test/validation/classification/Makefile.am
>> b/test/validation/classification/Makefile.am
>> index 5881665..4235309 100644
>> --- a/test/validation/classification/Makefile.am
>> +++ b/test/validation/classification/Makefile.am
>> @@ -3,6 +3,8 @@ include ../Makefile.inc
>>   noinst_LTLIBRARIES = libtestclassification.la
>>   libtestclassification_la_SOURCES = odp_classification_basic.c \
>>odp_classification_tests.c \
>> +  odp_classification_test_pmr.c \
>> +  odp_classification_common.c \
>>classification.c
>>
>>   bin_PROGRAMS = classification_main$(EXEEXT)
>> diff --git a/test/validation/classification/classification.c
>> b/test/validation/classification/classification.c
>> index d0fef93..6641893 100644
>> --- a/test/validation/classification/classification.c
>> +++ b/test/validation/classification/classification.c
>> @@ -13,6 +13,11 @@ CU_SuiteInfo classification_suites[] = {
>> { .pName = "classification basic",
>> .pTests = classification_suite_basic,
>> },
>> +   { .pName = "classification pmr tests",
>> +   .pTests = classification_suite_pmr,
>> +   .pInitFunc = classification_suite_pmr_init,
>> +   .pCleanupFunc = classification_suite_pmr_term,
>> +   },
>> { .pName = "classification tests",
>> .pTests = classification_suite,
>> .pInitFunc = classification_suite_init,
>> diff --git a/test/validation/classification/classification.h
>> b/test/validation/classification/classification.h
>> index d2847e5..de9c37e 100644
>> --- a/test/validation/classification/classification.h
>> +++ b/test/validation/classification/classification.h
>> @@ -9,6 +9,50 @@
>>
>>   #include 
>>
>> +#define SHM_PKT_NUM_BUFS32
>> +#define SHM_PKT_BUF_SIZE1024
>> +
>> +/* Config values for Default CoS */
>> +#define TEST_DEFAULT   1
>> +#defineCLS_DEFAULT 0
>> +#define CLS_DEFAULT_SADDR  "10.0.0.1/32"
>> +#define CLS_DEFAULT_DADDR  "10.0.0.100/32"
>> +#define CLS_DEFAULT_SPORT  1024
>> +#define CLS_DEFAULT_DPORT  2048
>> +
>> +/* Config values for Error CoS */
>> +#define TEST_ERROR 1
>> +#define CLS_ERROR  1
>> +
>> +/* Config values for PMR_CHAIN */
>> +#define TEST_PMR_CHAIN 1
>> +#define CLS_PMR_CHAIN_SRC  2
>> +#define CLS_PMR_CHAIN_DST  3
>> +#define CLS_PMR_CHAIN_SADDR"10.0.0.5/32"
>> +#define CLS_PMR_CHAIN_SPORT3000
>> +
>> +/* Config values for PMR */
>> +#define TEST_PMR   1
>> +#define CLS_PMR4
>> +#define CLS_PMR_SPORT  

[lng-odp] [Bug 1365] Lock-up following sendmmsg failure

2015-10-15 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1365

--- Comment #6 from Stuart Haslam  ---
Updated patches on the list; http://patches.opendataplane.org/patch/3293/

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] linux-generic: packet: use packet metadata copy function on packet realloc

2015-10-15 Thread Nicolas Morey-Chaisemartin
Ping

On 09/14/2015 11:14 AM, Nicolas Morey-Chaisemartin wrote:
> Remove duplicated code and use  preexisting metadata copy function
>
> Signed-off-by: Nicolas Morey-Chaisemartin 
> ---
>  platform/linux-generic/odp_packet.c | 34 ++
>  1 file changed, 2 insertions(+), 32 deletions(-)
>
> diff --git a/platform/linux-generic/odp_packet.c 
> b/platform/linux-generic/odp_packet.c
> index 5581cc4..3d36b34 100644
> --- a/platform/linux-generic/odp_packet.c
> +++ b/platform/linux-generic/odp_packet.c
> @@ -427,22 +427,7 @@ odp_packet_t odp_packet_add_data(odp_packet_t pkt, 
> uint32_t offset,
>   odp_packet_free(newpkt);
>   newpkt = ODP_PACKET_INVALID;
>   } else {
> - odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
> - new_hdr->input = pkt_hdr->input;
> - new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
> - if (new_hdr->buf_hdr.uarea_addr != NULL &&
> - pkt_hdr->buf_hdr.uarea_addr != NULL)
> - memcpy(new_hdr->buf_hdr.uarea_addr,
> -pkt_hdr->buf_hdr.uarea_addr,
> -new_hdr->buf_hdr.uarea_size <=
> -pkt_hdr->buf_hdr.uarea_size ?
> -new_hdr->buf_hdr.uarea_size :
> -pkt_hdr->buf_hdr.uarea_size);
> - odp_atomic_store_u32(
> - &new_hdr->buf_hdr.ref_count,
> - odp_atomic_load_u32(
> - &pkt_hdr->buf_hdr.ref_count));
> - copy_packet_parser_metadata(pkt_hdr, new_hdr);
> + _odp_packet_copy_md_to_packet(pkt, newpkt);
>   odp_packet_free(pkt);
>   }
>   }
> @@ -471,22 +456,7 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt, 
> uint32_t offset,
>   odp_packet_free(newpkt);
>   newpkt = ODP_PACKET_INVALID;
>   } else {
> - odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
> - new_hdr->input = pkt_hdr->input;
> - new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
> - if (new_hdr->buf_hdr.uarea_addr != NULL &&
> - pkt_hdr->buf_hdr.uarea_addr != NULL)
> - memcpy(new_hdr->buf_hdr.uarea_addr,
> -pkt_hdr->buf_hdr.uarea_addr,
> -new_hdr->buf_hdr.uarea_size <=
> -pkt_hdr->buf_hdr.uarea_size ?
> -new_hdr->buf_hdr.uarea_size :
> -pkt_hdr->buf_hdr.uarea_size);
> - odp_atomic_store_u32(
> - &new_hdr->buf_hdr.ref_count,
> - odp_atomic_load_u32(
> - &pkt_hdr->buf_hdr.ref_count));
> - copy_packet_parser_metadata(pkt_hdr, new_hdr);
> + _odp_packet_copy_md_to_packet(pkt, newpkt);
>   odp_packet_free(pkt);
>   }
>   }

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] pktio statistic counters

2015-10-15 Thread Ivan Khoronzhuk

Please, no Camel casemaybe we can duplicate the struct with names and use 
convenient one.


On 15.10.15 15:12, Mike Holmes wrote:



On 15 October 2015 at 13:01, Bill Fischofer mailto:bill.fischo...@linaro.org>> wrote:

If we're going to follow RFC MIB specifications we should use the field 
names as specified in the RFCs.  We already need to update the checkpatch rules 
to allow camel case since CUnit uses that anyway.  We can simply have a 
recommendation that ODP doesn't use camel case except in cases like these.  It 
actually helps highlight the fact that these are externally specified names 
rather than ODP names.


Agree on using RFC names and I think checkpatch already ignores "MiB", but a 
patch to add Cunit exceptions  is a good idea


Bill

On Thu, Oct 15, 2015 at 6:09 AM, Savolainen, Petri (Nokia - FI/Espoo) 
mailto:petri.savolai...@nokia.com>> wrote:

Hi,

These RFCs could be the ones we are looking for pktio interface level 
counters.

https://tools.ietf.org/html/rfc3635
https://tools.ietf.org/html/rfc2863
https://tools.ietf.org/html/rfc2819


The editor tool can be used to double check which RFC is the lastest...
https://www.rfc-editor.org/info/rfc3635
https://www.rfc-editor.org/info/rfc2863


The counters could be these, but in 64 bit version in ODP API.

For example, ifInOctets would be specified as

typedef struct {
   uint64_t in_octets;
   uint64_t in_ucastpkts;
...

} odp_pktio_stat_counters_t;



ifInOctets
ifInUcastPkts
ifInDiscards
ifInErrors
ifInUnknownProtos
ifOutOctets
ifOutUcastPkts
ifOutDiscards
ifOutErrors


ifInOctets  The number of octets in valid MAC frames
 received on this interface, including
 the MAC header and FCS.  This does
 include the number of octets in valid
 MAC Control frames received on this
 Interface


ifInUcastPkts   Refer to [RFC2863].  Note that this does
 not include MAC Control frames

...


-Petri






___
lng-odp mailing list
lng-odp@lists.linaro.org 
https://lists.linaro.org/mailman/listinfo/lng-odp



___
lng-odp mailing list
lng-odp@lists.linaro.org 
https://lists.linaro.org/mailman/listinfo/lng-odp




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source software for ARM SoCs

__




___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp



--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH v4 5/5] test/example: avoid "cycle" word usage

2015-10-15 Thread Ivan Khoronzhuk
The word "cycle" is left from old API time names. The "cycle" is
ambiguous word, especially when it can be used for other purposes.
So better to use "tick" or "time" word or just "t" symbol.

Signed-off-by: Ivan Khoronzhuk 
---
 test/performance/odp_pktio_perf.c | 35 ++---
 test/validation/scheduler/scheduler.c |  5 ++---
 test/validation/time/time.c   | 42 +--
 test/validation/time/time.h   |  6 ++---
 4 files changed, 43 insertions(+), 45 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index 6e001a3..e78616c 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -106,7 +106,7 @@ struct tx_stats_s {
uint64_t tx_cnt;/* Packets transmitted */
uint64_t alloc_failures;/* Packet allocation failures */
uint64_t enq_failures;  /* Enqueue failures */
-   odp_time_t idle_cycles; /* Idle cycle count in TX loop */
+   odp_time_t idle_ticks;  /* Idle ticks count in TX loop */
 };
 
 typedef union tx_stats_u {
@@ -305,8 +305,8 @@ static void *run_thread_tx(void *arg)
int thr_id;
odp_queue_t outq;
pkt_tx_stats_t *stats;
-   odp_time_t start_cycles, cur_cycles, send_duration;
-   odp_time_t burst_start_cycles, burst_gap_cycles;
+   odp_time_t start_time, cur_time, send_duration;
+   odp_time_t burst_start_time, burst_gap;
uint32_t batch_len;
int unsent_pkts = 0;
odp_event_t  tx_event[BATCH_LEN_MAX];
@@ -328,36 +328,35 @@ static void *run_thread_tx(void *arg)
if (outq == ODP_QUEUE_INVALID)
LOG_ABORT("Failed to get output queue for thread %d\n", thr_id);
 
-   burst_gap_cycles = odp_time_from_ns(
+   burst_gap = odp_time_from_ns(
ODP_TIME_SEC / (targs->pps / targs->batch_len));
send_duration = odp_time_from_ns(targs->duration * ODP_TIME_SEC);
 
odp_barrier_wait(&globals->tx_barrier);
 
-   cur_cycles = odp_time();
-   start_cycles   = cur_cycles;
-   burst_start_cycles = odp_time_diff(burst_gap_cycles, cur_cycles);
-   while (odp_time_diff(start_cycles, cur_cycles) < send_duration) {
+   cur_time = odp_time();
+   start_time   = cur_time;
+   burst_start_time = odp_time_diff(burst_gap, cur_time);
+   while (odp_time_diff(start_time, cur_time) < send_duration) {
unsigned alloc_cnt = 0, tx_cnt;
 
-   if (odp_time_diff(burst_start_cycles, cur_cycles)
-   < burst_gap_cycles) {
-   cur_cycles = odp_time();
+   if (odp_time_diff(burst_start_time, cur_time) < burst_gap) {
+   cur_time = odp_time();
if (!odp_time_cmp(ODP_TIME_NULL, idle_start))
-   idle_start = cur_cycles;
+   idle_start = cur_time;
continue;
}
 
if (odp_time_cmp(ODP_TIME_NULL, idle_start)) {
-   odp_time_t diff = odp_time_diff(idle_start, cur_cycles);
+   odp_time_t diff = odp_time_diff(idle_start, cur_time);
 
-   stats->s.idle_cycles =
-   odp_time_sum(diff, stats->s.idle_cycles);
+   stats->s.idle_ticks =
+   odp_time_sum(diff, stats->s.idle_ticks);
 
idle_start = ODP_TIME_NULL;
}
 
-   burst_start_cycles += burst_gap_cycles;
+   burst_start_time += burst_gap;
 
alloc_cnt = alloc_packets(tx_event, batch_len - unsent_pkts);
if (alloc_cnt != batch_len)
@@ -368,14 +367,14 @@ static void *run_thread_tx(void *arg)
stats->s.enq_failures += unsent_pkts;
stats->s.tx_cnt += tx_cnt;
 
-   cur_cycles = odp_time();
+   cur_time = odp_time();
}
 
VPRINT(" %02d: TxPkts %-8"PRIu64" EnqFail %-6"PRIu64
   " AllocFail %-6"PRIu64" Idle %"PRIu64"ms\n",
   thr_id, stats->s.tx_cnt,
   stats->s.enq_failures, stats->s.alloc_failures,
-  odp_time_to_ns(stats->s.idle_cycles) / (uint64_t)ODP_TIME_MSEC);
+  odp_time_to_ns(stats->s.idle_ticks) / (uint64_t)ODP_TIME_MSEC);
 
return NULL;
 }
diff --git a/test/validation/scheduler/scheduler.c 
b/test/validation/scheduler/scheduler.c
index 96e0781..8d8a0a5 100644
--- a/test/validation/scheduler/scheduler.c
+++ b/test/validation/scheduler/scheduler.c
@@ -465,11 +465,10 @@ static void *schedule_common_(void *arg)
CU_ASSERT(from != ODP_QUEUE_INVALID);
if (locked) {
int cnt;
-   odp_time_t cycles = ODP_TIME_NULL;
+ 

[lng-odp] [API-NEXT PATCH v4 3/5] api: time: unbind CPU cycles from time API

2015-10-15 Thread Ivan Khoronzhuk
Current time API supposes that frequency of counter is equal
to CPU frequency. But that's not always true, for instance,
in case if no access to CPU cycle counter, another hi-resolution
timer can be used, and it`s rate can be different from CPU
rate. There is no big difference in which cycles to measure
time, the better hi-resolution timer the better measurements.
So, unbind CPU cycle counter from time API by eliminating word
"cycle" as it's believed to be used with CPU.

Also add new opaque type for time odp_time_t, as it asks user to use
API and abstracts time from units. New odp_time_t requires several
additional API functions to be added:

odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2);
int odp_time_cmp(odp_time_t t1, odp_time_t t2);
uint64_t odp_time_to_u64(odp_time_t hdl);

Also added new definition that represents 0 ticks for time -
ODP_TIME_NULL. It can be used instead of odp_time_from_ns(0) for
comparison and initialization.

This patch changes only used time API, it doesn't change used var
names for simplicity.

Signed-off-by: Ivan Khoronzhuk 
---
 example/generator/odp_generator.c | 12 +++
 include/odp/api/time.h| 65 ---
 test/performance/odp_pktio_perf.c | 49 +-
 test/validation/pktio/pktio.c | 20 +--
 test/validation/scheduler/scheduler.c |  5 +--
 test/validation/time/time.c   | 27 ---
 6 files changed, 111 insertions(+), 67 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 47d28a6..b39ce2b 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -585,7 +585,7 @@ static void *gen_recv_thread(void *arg)
  */
 static void print_global_stats(int num_workers)
 {
-   uint64_t start, wait, diff;
+   odp_time_t start, wait, diff;
uint64_t pkts, pkts_prev = 0, pps, maximum_pps = 0;
int verbose_interval = 20;
odp_thrmask_t thrd_mask;
@@ -593,8 +593,8 @@ static void print_global_stats(int num_workers)
while (odp_thrmask_worker(&thrd_mask) < num_workers)
continue;
 
-   wait = odp_time_ns_to_cycles(verbose_interval * ODP_TIME_SEC);
-   start = odp_time_cycles();
+   wait = odp_time_from_ns(verbose_interval * ODP_TIME_SEC);
+   start = odp_time();
 
while (odp_thrmask_worker(&thrd_mask) == num_workers) {
if (args->appl.number != -1 &&
@@ -603,11 +603,11 @@ static void print_global_stats(int num_workers)
break;
}
 
-   diff = odp_time_diff_cycles(start, odp_time_cycles());
-   if (diff < wait)
+   diff = odp_time_diff(start, odp_time());
+   if (odp_time_cmp(diff, wait) > 0)
continue;
 
-   start = odp_time_cycles();
+   start = odp_time();
 
if (args->appl.mode == APPL_MODE_RCV) {
pkts = odp_atomic_load_u64(&counters.udp);
diff --git a/include/odp/api/time.h b/include/odp/api/time.h
index b0072fc..60800ba 100644
--- a/include/odp/api/time.h
+++ b/include/odp/api/time.h
@@ -28,14 +28,22 @@ extern "C" {
 #define ODP_TIME_MSEC 100ULL/**< Millisecond in nsec */
 #define ODP_TIME_SEC  10ULL /**< Second in nsec */
 
+/**
+ * @typedef odp_time_t
+ * ODP time stamp. Time stamp is global and can be shared between threads.
+ */
 
 /**
- * Current time in CPU cycles
- *
- * @return Current time in CPU cycles
+ * @def ODP_TIME_NULL
+ * Zero time stamp
  */
-uint64_t odp_time_cycles(void);
 
+/**
+ * Current global time stamp.
+ *
+ * @return Time stamp. It should be hi-resolution time.
+ */
+odp_time_t odp_time(void);
 
 /**
  * Time difference
@@ -43,29 +51,60 @@ uint64_t odp_time_cycles(void);
  * @param t1First time stamp
  * @param t2Second time stamp
  *
- * @return Difference of time stamps in CPU cycles
+ * @return Difference of time stamps
  */
-uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2);
+odp_time_t odp_time_diff(odp_time_t t1, odp_time_t t2);
 
+/**
+ * Time sum
+ *
+ * @param t1time stamp
+ * @param t2time stamp
+ *
+ * @return Sum of time stamps
+ */
+odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2);
 
 /**
- * Convert CPU cycles to nanoseconds
+ * Convert time to nanoseconds
  *
- * @param cycles  Time in CPU cycles
+ * @param time  Time
  *
  * @return Time in nanoseconds
  */
-uint64_t odp_time_cycles_to_ns(uint64_t cycles);
-
+uint64_t odp_time_to_ns(odp_time_t time);
 
 /**
- * Convert nanoseconds to CPU cycles
+ * Convert nanoseconds to time
  *
  * @param ns  Time in nanoseconds
  *
- * @return Time in CPU cycles
+ * @return Time stamp
+ */
+odp_time_t odp_time_from_ns(uint64_t ns);
+
+/**
+ * Compare two times as absolute ranges
+ *
+ * @param t1First time
+ * @param t2Second time
+ *
+ * @retval -1 if t2 < t1, 0 if t1 = t2, 1 if t2 > t1
+ */
+int odp_time_cm

[lng-odp] [API-NEXT PATCH v4 4/5] linux-generic: align implementation with new time API

2015-10-15 Thread Ivan Khoronzhuk
The time API names were changed from odp_time_cycle* to odp_time*.
Also new time API operates with new opaque type - odp_time_t, as
result several new API calls were added. For odp_schdule.c avoid
"cycle" word usage as it was left from old time API names.

This patch is intended to align linux-generic implementation with
new time API.

Signed-off-by: Ivan Khoronzhuk 
---
 platform/linux-generic/Makefile.am |  1 +
 .../linux-generic/include/odp/plat/time_types.h| 36 +
 platform/linux-generic/include/odp/time.h  |  1 +
 platform/linux-generic/odp_schedule.c  | 16 +++---
 platform/linux-generic/odp_time.c  | 62 ++
 5 files changed, 97 insertions(+), 19 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/time_types.h

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 85c976d..b0842c5 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -74,6 +74,7 @@ odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/strong_types.h \
  $(srcdir)/include/odp/plat/thrmask_types.h \
  $(srcdir)/include/odp/plat/ticketlock_types.h \
+ $(srcdir)/include/odp/plat/time_types.h \
  $(srcdir)/include/odp/plat/timer_types.h \
  $(srcdir)/include/odp/plat/version_types.h
 
diff --git a/platform/linux-generic/include/odp/plat/time_types.h 
b/platform/linux-generic/include/odp/plat/time_types.h
new file mode 100644
index 000..9ba1508
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -0,0 +1,36 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP time service
+ */
+
+#ifndef ODP_TIME_TYPES_H_
+#define ODP_TIME_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup odp_time
+ *  @{
+ **/
+
+typedef uint64_t odp_time_t;
+
+#define ODP_TIME_NULL ((odp_time_t)0)
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/time.h 
b/platform/linux-generic/include/odp/time.h
index 3a3960b..44e0d0d 100644
--- a/platform/linux-generic/include/odp/time.h
+++ b/platform/linux-generic/include/odp/time.h
@@ -21,6 +21,7 @@ extern "C" {
 
 
 
+#include 
 #include 
 
 #ifdef __cplusplus
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 6df8073..e88f3f2 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -585,10 +585,10 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
 odp_event_t out_ev[],
 unsigned int max_num, unsigned int max_deq)
 {
-   uint64_t start_cycle, cycle, diff;
+   odp_time_t start_time, time, diff;
int ret;
 
-   start_cycle = 0;
+   start_time = ODP_TIME_NULL;
 
while (1) {
ret = schedule(out_queue, out_ev, max_num, max_deq);
@@ -602,15 +602,15 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
if (wait == ODP_SCHED_NO_WAIT)
break;
 
-   if (start_cycle == 0) {
-   start_cycle = odp_time_cycles();
+   if (!odp_time_cmp(start_time, ODP_TIME_NULL)) {
+   start_time = odp_time();
continue;
}
 
-   cycle = odp_time_cycles();
-   diff  = odp_time_diff_cycles(start_cycle, cycle);
+   time = odp_time();
+   diff  = odp_time_diff(start_time, time);
 
-   if (wait < diff)
+   if (odp_time_cmp(diff, wait) > 0)
break;
}
 
@@ -651,7 +651,7 @@ void odp_schedule_resume(void)
 
 uint64_t odp_schedule_wait_time(uint64_t ns)
 {
-   return odp_time_ns_to_cycles(ns);
+   return odp_time_to_u64(odp_time_from_ns(ns));
 }
 
 
diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index abafd12..e0aceb1 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -14,33 +14,73 @@
 
 #define GIGA 10
 
-uint64_t odp_time_cycles(void)
+static inline
+uint64_t time_to_tick(odp_time_t time)
 {
-   return odp_cpu_cycles();
+   return (uint64_t)time;
 }
 
-uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
+static inline
+odp_time_t tick_to_time(uint64_t tick)
 {
-   return _odp_cpu_cycles_diff(t1, t2);
+   return (odp_time_t)tick;
 }
 
-uint64_t odp_time_cycles_to_ns(uint64_t cycles)
+odp_time_t odp_time(void)
+{
+   return tick_to_time(odp_cpu_cycles());
+}
+
+odp_time_t odp_time_diff(odp_time_t t1, odp_time_t t2)
+{
+   return tick_to_time(_odp_cpu_cycles_diff(t1, t2));
+}
+
+uint64_t odp_time_to_ns(odp_time_t time)
 {
 

[lng-odp] [API-NEXT PATCH v4 2/5] example: generator: compare ticks instead of ns in loop

2015-10-15 Thread Ivan Khoronzhuk
It's more accurate to compare ticks instead of ns in each
iteration, so calculate wait range before entering the loop.

Signed-off-by: Ivan Khoronzhuk 
---
 example/generator/odp_generator.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 5a0d5a4..47d28a6 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -585,7 +585,7 @@ static void *gen_recv_thread(void *arg)
  */
 static void print_global_stats(int num_workers)
 {
-   uint64_t start, now, diff;
+   uint64_t start, wait, diff;
uint64_t pkts, pkts_prev = 0, pps, maximum_pps = 0;
int verbose_interval = 20;
odp_thrmask_t thrd_mask;
@@ -593,6 +593,7 @@ static void print_global_stats(int num_workers)
while (odp_thrmask_worker(&thrd_mask) < num_workers)
continue;
 
+   wait = odp_time_ns_to_cycles(verbose_interval * ODP_TIME_SEC);
start = odp_time_cycles();
 
while (odp_thrmask_worker(&thrd_mask) == num_workers) {
@@ -602,12 +603,9 @@ static void print_global_stats(int num_workers)
break;
}
 
-   now = odp_time_cycles();
-   diff = odp_time_diff_cycles(start, now);
-   if (odp_time_cycles_to_ns(diff) <
-   verbose_interval * ODP_TIME_SEC) {
+   diff = odp_time_diff_cycles(start, odp_time_cycles());
+   if (diff < wait)
continue;
-   }
 
start = odp_time_cycles();
 
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH v4 0/5] api: time: unbind CPU cycles from time API

2015-10-15 Thread Ivan Khoronzhuk
This seres is intended to unbind time API names from CPU "cycles".
Also remove usage of word "cycle" from appropriate places as it's
no more valid. This patch series only change API names and adds
calls required for that and doesn't add new API functionality.
API to get rate of time and delay call will be added separately as
they require to modify some examples and tests.

v3:
api: time: change API to use ticks instead of cycles
https://lists.linaro.org/pipermail/lng-odp/2015-August/014198.html

Since v3:
- don't use "tick" word in API names
- added opaque type odp_time_t
- added additional function: cmpr, sum, to_u64
- use "time stamp" word instead of "handle"
- described more clearly timestamps order in functions
- two new patches:
  performance: odp_pktio_perf: fix potential overflow in wait loop
  example: generator: compare ticks instead of ns in loop

Since v1, v2:
- changed series name a little bit
- added opaque type odp_time_t
- added missed spaces in printf
- removed legacy "count" words

Ivan Khoronzhuk (5):
  performance: odp_pktio_perf: fix potential overflow in wait loop
  example: generator: compare ticks instead of ns in loop
  api: time: unbind CPU cycles from time API
  linux-generic: align implementation with new time API
  test/example: avoid "cycle" word usage

 example/generator/odp_generator.c  | 14 ++---
 include/odp/api/time.h | 65 +-
 platform/linux-generic/Makefile.am |  1 +
 .../linux-generic/include/odp/plat/time_types.h| 36 
 platform/linux-generic/include/odp/time.h  |  1 +
 platform/linux-generic/odp_schedule.c  | 16 +++---
 platform/linux-generic/odp_time.c  | 62 +
 test/performance/odp_pktio_perf.c  | 56 ++-
 test/validation/pktio/pktio.c  | 20 +++
 test/validation/scheduler/scheduler.c  |  4 +-
 test/validation/time/time.c| 47 
 test/validation/time/time.h|  6 +-
 12 files changed, 225 insertions(+), 103 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/time_types.h

-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH v4 1/5] performance: odp_pktio_perf: fix potential overflow in wait loop

2015-10-15 Thread Ivan Khoronzhuk
There cannot be used direct comparison of timestamps of counter
that can overflow, better to compare ranges.

Signed-off-by: Ivan Khoronzhuk 
---
 test/performance/odp_pktio_perf.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index 018b7f5..09e1f6f 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -591,9 +591,13 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
  */
 static void busy_loop_ns(uint64_t wait_ns)
 {
-   uint64_t end = odp_time_cycles() + odp_time_ns_to_cycles(wait_ns);
-   while (odp_time_cycles() < end)
-   ;
+   uint64_t diff;
+   uint64_t start_time = odp_time_cycles();
+   uint64_t wait = odp_time_ns_to_cycles(wait_ns);
+
+   do {
+   diff = odp_time_diff_cycles(start_time, odp_time_cycles());
+   } while (diff < wait);
 }
 
 /*
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] pktio statistic counters

2015-10-15 Thread Savolainen, Petri (Nokia - FI/Espoo)
Camel case should not be used in the API. We can refer to RFC number and terms 
in documentation, but field names should use ODP style (no camel case).

For example,

 typedef struct {
  /** The number of octets in valid MAC frames
* received on this interface, including
* the MAC header and FCS. See ifHCInOctets
* counter description in RFC 3635 for details.
*/
  uint64_t in_octets;

  uint64_t in_ucastpkts;
...

} odp_pktio_stat_counters_t;



-Petri


From: EXT Mike Holmes [mailto:mike.hol...@linaro.org] 
Sent: Thursday, October 15, 2015 3:13 PM
To: Bill Fischofer
Cc: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] pktio statistic counters



On 15 October 2015 at 13:01, Bill Fischofer  wrote:
If we're going to follow RFC MIB specifications we should use the field names 
as specified in the RFCs.  We already need to update the checkpatch rules to 
allow camel case since CUnit uses that anyway.  We can simply have a 
recommendation that ODP doesn't use camel case except in cases like these.  It 
actually helps highlight the fact that these are externally specified names 
rather than ODP names.

Agree on using RFC names and I think checkpatch already ignores "MiB", but a 
patch to add Cunit exceptions  is a good idea


Bill

On Thu, Oct 15, 2015 at 6:09 AM, Savolainen, Petri (Nokia - FI/Espoo) 
 wrote:
Hi,

These RFCs could be the ones we are looking for pktio interface level counters.

https://tools.ietf.org/html/rfc3635
https://tools.ietf.org/html/rfc2863
https://tools.ietf.org/html/rfc2819


The editor tool can be used to double check which RFC is the lastest...
https://www.rfc-editor.org/info/rfc3635
https://www.rfc-editor.org/info/rfc2863


The counters could be these, but in 64 bit version in ODP API.

For example, ifInOctets would be specified as

typedef struct {
  uint64_t in_octets;
  uint64_t in_ucastpkts;
...

} odp_pktio_stat_counters_t;



ifInOctets
ifInUcastPkts
ifInDiscards
ifInErrors
ifInUnknownProtos
ifOutOctets
ifOutUcastPkts
ifOutDiscards
ifOutErrors


ifInOctets                      The number of octets in valid MAC frames
                                received on this interface, including
                                the MAC header and FCS.  This does
                                include the number of octets in valid
                                MAC Control frames received on this
                                Interface


ifInUcastPkts                   Refer to [RFC2863].  Note that this does
                                not include MAC Control frames

...


-Petri






___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org │ Open source software for ARM SoCs

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH 1/5] api: pktio: add odp_pktio_param_init() API

2015-10-15 Thread Maxim Uvarov

Merged,
Maxim.

On 10/14/2015 14:51, Bill Fischofer wrote:

Signed-off-by: Bill Fischofer 
---
  include/odp/api/packet_io.h | 9 +
  1 file changed, 9 insertions(+)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index d8e69ed..3479af1 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -349,6 +349,15 @@ int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t 
headroom);
  uint64_t odp_pktio_to_u64(odp_pktio_t pktio);
  
  /**

+ * Intiailize pktio params
+ *
+ * Initialize an odp_pktio_param_t to its default values for all fields
+ *
+ * @param param Address of the odp_pktio_param_t to be initialized
+ */
+void odp_pktio_param_init(odp_pktio_param_t *param);
+
+/**
   * @}
   */
  


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT/PATCH 1/1] validation: classification: add odp_pktio_param_init() API

2015-10-15 Thread Bill Fischofer
On Thu, Oct 15, 2015 at 1:15 AM, Balasubramanian Manoharan <
bala.manoha...@linaro.org> wrote:

> odp_pktio_param_init() API is used to initialize odp_pktio_param_t params
>
> Signed-off-by: Balasubramanian Manoharan 
>

Reviewed-by: Bill Fischofer 


> ---
>  test/validation/classification/odp_classification_test_pmr.c | 2 +-
>  test/validation/classification/odp_classification_tests.c| 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/test/validation/classification/odp_classification_test_pmr.c
> b/test/validation/classification/odp_classification_test_pmr.c
> index 37de892..e794bda 100644
> --- a/test/validation/classification/odp_classification_test_pmr.c
> +++ b/test/validation/classification/odp_classification_test_pmr.c
> @@ -80,7 +80,7 @@ odp_pktio_t create_pktio(odp_queue_type_t q_type)
> if (pool == ODP_POOL_INVALID)
> return ODP_PKTIO_INVALID;
>
> -   memset(&pktio_param, 0, sizeof(pktio_param));
> +   odp_pktio_param_init(&pktio_param);
> if (q_type == ODP_QUEUE_TYPE_POLL)
> pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
> else
> diff --git a/test/validation/classification/odp_classification_tests.c
> b/test/validation/classification/odp_classification_tests.c
> index 74d1060..fe55419 100644
> --- a/test/validation/classification/odp_classification_tests.c
> +++ b/test/validation/classification/odp_classification_tests.c
> @@ -71,7 +71,7 @@ int classification_suite_init(void)
> return -1;
> }
>
> -   memset(&pktio_param, 0, sizeof(pktio_param));
> +   odp_pktio_param_init(&pktio_param);
> pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
>
> pktio_loop = odp_pktio_open("loop", pool_default, &pktio_param);
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] pktio statistic counters

2015-10-15 Thread Mike Holmes
On 15 October 2015 at 13:01, Bill Fischofer 
wrote:

> If we're going to follow RFC MIB specifications we should use the field
> names as specified in the RFCs.  We already need to update the checkpatch
> rules to allow camel case since CUnit uses that anyway.  We can simply have
> a recommendation that ODP doesn't use camel case except in cases like
> these.  It actually helps highlight the fact that these are externally
> specified names rather than ODP names.
>

Agree on using RFC names and I think checkpatch already ignores "MiB", but
a patch to add Cunit exceptions  is a good idea


> Bill
>
> On Thu, Oct 15, 2015 at 6:09 AM, Savolainen, Petri (Nokia - FI/Espoo) <
> petri.savolai...@nokia.com> wrote:
>
>> Hi,
>>
>> These RFCs could be the ones we are looking for pktio interface level
>> counters.
>>
>> https://tools.ietf.org/html/rfc3635
>> https://tools.ietf.org/html/rfc2863
>> https://tools.ietf.org/html/rfc2819
>>
>>
>> The editor tool can be used to double check which RFC is the lastest...
>> https://www.rfc-editor.org/info/rfc3635
>> https://www.rfc-editor.org/info/rfc2863
>>
>>
>> The counters could be these, but in 64 bit version in ODP API.
>>
>> For example, ifInOctets would be specified as
>>
>> typedef struct {
>>   uint64_t in_octets;
>>   uint64_t in_ucastpkts;
>> ...
>>
>> } odp_pktio_stat_counters_t;
>>
>>
>>
>> ifInOctets
>> ifInUcastPkts
>> ifInDiscards
>> ifInErrors
>> ifInUnknownProtos
>> ifOutOctets
>> ifOutUcastPkts
>> ifOutDiscards
>> ifOutErrors
>>
>>
>> ifInOctets  The number of octets in valid MAC frames
>> received on this interface, including
>> the MAC header and FCS.  This does
>> include the number of octets in valid
>> MAC Control frames received on this
>> Interface
>>
>>
>> ifInUcastPkts   Refer to [RFC2863].  Note that this does
>> not include MAC Control frames
>>
>> ...
>>
>>
>> -Petri
>>
>>
>>
>>
>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>


-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org  *│ *Open source software for ARM SoCs
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] pktio statistic counters

2015-10-15 Thread Bill Fischofer
If we're going to follow RFC MIB specifications we should use the field
names as specified in the RFCs.  We already need to update the checkpatch
rules to allow camel case since CUnit uses that anyway.  We can simply have
a recommendation that ODP doesn't use camel case except in cases like
these.  It actually helps highlight the fact that these are externally
specified names rather than ODP names.

Bill

On Thu, Oct 15, 2015 at 6:09 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> Hi,
>
> These RFCs could be the ones we are looking for pktio interface level
> counters.
>
> https://tools.ietf.org/html/rfc3635
> https://tools.ietf.org/html/rfc2863
> https://tools.ietf.org/html/rfc2819
>
>
> The editor tool can be used to double check which RFC is the lastest...
> https://www.rfc-editor.org/info/rfc3635
> https://www.rfc-editor.org/info/rfc2863
>
>
> The counters could be these, but in 64 bit version in ODP API.
>
> For example, ifInOctets would be specified as
>
> typedef struct {
>   uint64_t in_octets;
>   uint64_t in_ucastpkts;
> ...
>
> } odp_pktio_stat_counters_t;
>
>
>
> ifInOctets
> ifInUcastPkts
> ifInDiscards
> ifInErrors
> ifInUnknownProtos
> ifOutOctets
> ifOutUcastPkts
> ifOutDiscards
> ifOutErrors
>
>
> ifInOctets  The number of octets in valid MAC frames
> received on this interface, including
> the MAC header and FCS.  This does
> include the number of octets in valid
> MAC Control frames received on this
> Interface
>
>
> ifInUcastPkts   Refer to [RFC2863].  Note that this does
> not include MAC Control frames
>
> ...
>
>
> -Petri
>
>
>
>
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] linux-generic: pktio: fill in L2 parse results by default

2015-10-15 Thread Bill Fischofer
Hard to say from looking at this whether this improves OVS performance,
which was the main reason lazy parsing was added.  Presumably the idea here
is that you can use the l2 APIs without triggering a full parse for many
applications, so that should be a plus.


On Mon, Oct 12, 2015 at 3:15 AM, Petri Savolainen <
petri.savolai...@nokia.com> wrote:

> Optimize and simplify packet parsing. Fill in L2 metadata
> allways in packet input. Perform full packet parsing only
> if other than L2 metadata is requested. Perform parsing only
> for packets received from the network (disable parsing of
> user created packets).
>
> Signed-off-by: Petri Savolainen 
> ---
>  .../linux-generic/include/odp_packet_internal.h|  61 ++-
>  platform/linux-generic/odp_classification.c|   4 +-
>  platform/linux-generic/odp_packet.c| 184
> ++---
>  platform/linux-generic/odp_packet_flags.c  |  24 ++-
>  platform/linux-generic/odp_pool.c  |   3 -
>  platform/linux-generic/pktio/loop.c|   8 +-
>  platform/linux-generic/pktio/netmap.c  |  10 +-
>  platform/linux-generic/pktio/socket.c  |  10 +-
>  platform/linux-generic/pktio/socket_mmap.c |  11 +-
>  9 files changed, 186 insertions(+), 129 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_packet_internal.h
> b/platform/linux-generic/include/odp_packet_internal.h
> index 8c41491..7c42bcb 100644
> --- a/platform/linux-generic/include/odp_packet_internal.h
> +++ b/platform/linux-generic/include/odp_packet_internal.h
> @@ -36,7 +36,8 @@ typedef union {
> uint32_t all;
>
> struct {
> -   uint32_t unparsed:1;  /**< Set to inticate parse needed */
> +   uint32_t parsed_l2:1; /**< L2 parsed */
> +   uint32_t parsed_all:1;/**< Parsing complite */
>

s/complite/complete


>
> uint32_t l2:1;/**< known L2 protocol present */
> uint32_t l3:1;/**< known L3 protocol present */
> @@ -152,43 +153,6 @@ static inline odp_packet_hdr_t
> *odp_packet_hdr(odp_packet_t pkt)
> return (odp_packet_hdr_t *)odp_buf_to_hdr((odp_buffer_t)pkt);
>  }
>
> -/**
> - * Initialize packet buffer
> - */
> -static inline void packet_init(pool_entry_t *pool,
> -  odp_packet_hdr_t *pkt_hdr,
> -  size_t size)
> -{
> -   /*
> -   * Reset parser metadata.  Note that we clear via memset to make
> -   * this routine indepenent of any additional adds to packet
> metadata.
> -   */
> -   const size_t start_offset = ODP_FIELD_SIZEOF(odp_packet_hdr_t,
> buf_hdr);
> -   uint8_t *start;
> -   size_t len;
> -
> -   start = (uint8_t *)pkt_hdr + start_offset;
> -   len = sizeof(odp_packet_hdr_t) - start_offset;
> -   memset(start, 0, len);
> -
> -   /* Set metadata items that initialize to non-zero values */
> -   pkt_hdr->l2_offset = ODP_PACKET_OFFSET_INVALID;
> -   pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID;
> -   pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID;
> -   pkt_hdr->payload_offset = ODP_PACKET_OFFSET_INVALID;
> -
> -   /*
> -   * Packet headroom is set from the pool's headroom
> -   * Packet tailroom is rounded up to fill the last
> -   * segment occupied by the allocated length.
> -   */
> -   pkt_hdr->frame_len = size;
> -   pkt_hdr->headroom  = pool->s.headroom;
> -   pkt_hdr->tailroom  =
> -   (pool->s.seg_size * pkt_hdr->buf_hdr.segcount) -
> -   (pool->s.headroom + size);
> -}
> -
>  static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
>odp_packet_hdr_t *dst_hdr)
>  {
> @@ -250,12 +214,14 @@ static inline void packet_set_len(odp_packet_t pkt,
> uint32_t len)
> odp_packet_hdr(pkt)->frame_len = len;
>  }
>
> -#define ODP_PACKET_UNPARSED ~0
> +static inline int packet_parse_l2_not_done(odp_packet_hdr_t *pkt_hdr)
> +{
> +   return !pkt_hdr->input_flags.parsed_l2;
> +}
>
> -static inline void _odp_packet_reset_parse(odp_packet_t pkt)
> +static inline int packet_parse_not_complete(odp_packet_hdr_t *pkt_hdr)
>  {
> -   odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
> -   pkt_hdr->input_flags.all = ODP_PACKET_UNPARSED;
> +   return !pkt_hdr->input_flags.parsed_all;
>  }
>
>  /* Forward declarations */
> @@ -265,9 +231,16 @@ int _odp_packet_copy_to_packet(odp_packet_t srcpkt,
> uint32_t srcoffset,
>
>  void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t
> dstpkt);
>
> -odp_packet_t _odp_packet_alloc(odp_pool_t pool_hdl);
> +odp_packet_t packet_alloc(odp_pool_t pool_hdl, uint32_t len, int parse);
>
> -int _odp_packet_parse(odp_packet_hdr_t *pkt_hdr);
> +/* Fill in parser metadata for L2 */
> +void packet_parse_l2(odp_packet_hdr_t *pkt_hdr);
> +
> +/* Perform full packet parse */
> +int packet_parse_full(odp_packet

Re: [lng-odp] [API-NEXT/PATCHv5] validation: classification: added additional suite to test individual PMRs

2015-10-15 Thread Ivan Khoronzhuk

Hi, Bala

Just compared this version with requirements for v2 and saw some mistmaches.
I didn't analize it deeply, seemply checked what was needed to be changed.
See comments below.

Sorry, I haven't found v4, and haven't revewed v3.

On 14.10.15 08:03, Balasubramanian Manoharan wrote:

Additional test suite is added to classification validation suite to test
individual PMRs. This suite will test the defined PMRs by configuring
pktio separately for every test case.

Fixes:
https://bugs.linaro.org/show_bug.cgi?id=1542
https://bugs.linaro.org/show_bug.cgi?id=1544
https://bugs.linaro.org/show_bug.cgi?id=1545
https://bugs.linaro.org/show_bug.cgi?id=1546

Signed-off-by: Balasubramanian Manoharan 
---
v5: rebase on latest api-next

  helper/include/odp/helper/tcp.h|   1 +
  test/validation/classification/Makefile.am |   2 +
  test/validation/classification/classification.c|   5 +
  test/validation/classification/classification.h|  44 ++
  .../classification/odp_classification_common.c | 252 +
  .../classification/odp_classification_test_pmr.c   | 579 +
  .../classification/odp_classification_tests.c  | 309 ++-
  .../classification/odp_classification_testsuites.h |  15 +-
  8 files changed, 948 insertions(+), 259 deletions(-)
  create mode 100644 test/validation/classification/odp_classification_common.c
  create mode 100644 
test/validation/classification/odp_classification_test_pmr.c

diff --git a/helper/include/odp/helper/tcp.h b/helper/include/odp/helper/tcp.h
index defe422..42f0cbe 100644
--- a/helper/include/odp/helper/tcp.h
+++ b/helper/include/odp/helper/tcp.h
@@ -26,6 +26,7 @@ extern "C" {
   *  @{
   */

+#define ODPH_TCPHDR_LEN 20 /**< Min length of TCP header (no options) */

  /** TCP header */
  typedef struct ODP_PACKED {
diff --git a/test/validation/classification/Makefile.am 
b/test/validation/classification/Makefile.am
index 5881665..4235309 100644
--- a/test/validation/classification/Makefile.am
+++ b/test/validation/classification/Makefile.am
@@ -3,6 +3,8 @@ include ../Makefile.inc
  noinst_LTLIBRARIES = libtestclassification.la
  libtestclassification_la_SOURCES = odp_classification_basic.c \
   odp_classification_tests.c \
+  odp_classification_test_pmr.c \
+  odp_classification_common.c \
   classification.c

  bin_PROGRAMS = classification_main$(EXEEXT)
diff --git a/test/validation/classification/classification.c 
b/test/validation/classification/classification.c
index d0fef93..6641893 100644
--- a/test/validation/classification/classification.c
+++ b/test/validation/classification/classification.c
@@ -13,6 +13,11 @@ CU_SuiteInfo classification_suites[] = {
{ .pName = "classification basic",
.pTests = classification_suite_basic,
},
+   { .pName = "classification pmr tests",
+   .pTests = classification_suite_pmr,
+   .pInitFunc = classification_suite_pmr_init,
+   .pCleanupFunc = classification_suite_pmr_term,
+   },
{ .pName = "classification tests",
.pTests = classification_suite,
.pInitFunc = classification_suite_init,
diff --git a/test/validation/classification/classification.h 
b/test/validation/classification/classification.h
index d2847e5..de9c37e 100644
--- a/test/validation/classification/classification.h
+++ b/test/validation/classification/classification.h
@@ -9,6 +9,50 @@

  #include 

+#define SHM_PKT_NUM_BUFS32
+#define SHM_PKT_BUF_SIZE1024
+
+/* Config values for Default CoS */
+#define TEST_DEFAULT   1
+#defineCLS_DEFAULT 0
+#define CLS_DEFAULT_SADDR  "10.0.0.1/32"
+#define CLS_DEFAULT_DADDR  "10.0.0.100/32"
+#define CLS_DEFAULT_SPORT  1024
+#define CLS_DEFAULT_DPORT  2048
+
+/* Config values for Error CoS */
+#define TEST_ERROR 1
+#define CLS_ERROR  1
+
+/* Config values for PMR_CHAIN */
+#define TEST_PMR_CHAIN 1
+#define CLS_PMR_CHAIN_SRC  2
+#define CLS_PMR_CHAIN_DST  3
+#define CLS_PMR_CHAIN_SADDR"10.0.0.5/32"
+#define CLS_PMR_CHAIN_SPORT3000
+
+/* Config values for PMR */
+#define TEST_PMR   1
+#define CLS_PMR4
+#define CLS_PMR_SPORT  4000
+
+/* Config values for PMR SET */
+#define TEST_PMR_SET   1
+#define CLS_PMR_SET5
+#define CLS_PMR_SET_SADDR  "10.0.0.6/32"
+#define CLS_PMR_SET_SPORT  5000
+
+/* Config values for CoS L2 Priority */
+#define TEST_L2_QOS1
+#define CLS_L2_QOS_0   6
+#define CLS_L2_QOS_MAX 5
+
+#define CLS_ENTRIES(CLS_L2_QOS_0 + CLS_L2_QOS_MAX)
+
+/* Test Packet values */
+#define DATA_MAGIC 0x01020304
+#define TEST_SEQ_INVALID   ((uint32_t)~0)
+
  /* test functions: */

Re: [lng-odp] [API-NEXT PATCH 3/5] example: use odp_pktio_param_init() API

2015-10-15 Thread Bill Fischofer
I can certainly  combine them, but I thought our policy was to separate
examples from validation, etc.

On Thu, Oct 15, 2015 at 6:05 AM, Maxim Uvarov 
wrote:

> I think it's better to have single patch from patches 3,4 and 5, since
> they do the same thing.
>
> Maxim.
>
>
> On 10/14/2015 14:51, Bill Fischofer wrote:
>
>> Signed-off-by: Bill Fischofer 
>> ---
>>   example/classifier/odp_classifier.c | 2 +-
>>   example/generator/odp_generator.c   | 2 +-
>>   example/ipsec/odp_ipsec.c   | 2 +-
>>   example/packet/odp_pktio.c  | 2 +-
>>   4 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/example/classifier/odp_classifier.c
>> b/example/classifier/odp_classifier.c
>> index 05a1eaa..18cd3bb 100644
>> --- a/example/classifier/odp_classifier.c
>> +++ b/example/classifier/odp_classifier.c
>> @@ -227,7 +227,7 @@ static odp_pktio_t create_pktio(const char *dev,
>> odp_pool_t pool)
>> int ret;
>> odp_pktio_param_t pktio_param;
>>   - memset(&pktio_param, 0, sizeof(pktio_param));
>> +   odp_pktio_param_init(&pktio_param);
>> pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
>> /* Open a packet IO instance */
>> diff --git a/example/generator/odp_generator.c
>> b/example/generator/odp_generator.c
>> index 5a0d5a4..f80104c 100644
>> --- a/example/generator/odp_generator.c
>> +++ b/example/generator/odp_generator.c
>> @@ -330,7 +330,7 @@ static odp_pktio_t create_pktio(const char *dev,
>> odp_pool_t pool)
>> odp_queue_t inq_def;
>> odp_pktio_param_t pktio_param;
>>   - memset(&pktio_param, 0, sizeof(pktio_param));
>> +   odp_pktio_param_init(&pktio_param);
>> pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
>> /* Open a packet IO instance */
>> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
>> index 9c1e03c..474f4a5 100644
>> --- a/example/ipsec/odp_ipsec.c
>> +++ b/example/ipsec/odp_ipsec.c
>> @@ -496,7 +496,7 @@ void initialize_intf(char *intf)
>> char src_mac_str[MAX_STRING];
>> odp_pktio_param_t pktio_param;
>>   - memset(&pktio_param, 0, sizeof(pktio_param));
>> +   odp_pktio_param_init(&pktio_param);
>> if (getenv("ODP_IPSEC_USE_POLL_QUEUES"))
>> pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
>> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
>> index 4a8686e..93c38f5 100644
>> --- a/example/packet/odp_pktio.c
>> +++ b/example/packet/odp_pktio.c
>> @@ -118,7 +118,7 @@ static odp_pktio_t create_pktio(const char *dev,
>> odp_pool_t pool, int mode)
>> int ret;
>> odp_pktio_param_t pktio_param;
>>   - memset(&pktio_param, 0, sizeof(pktio_param));
>> +   odp_pktio_param_init(&pktio_param);
>> switch (mode) {
>> case  APPL_MODE_PKT_BURST:
>>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] pktio statistic counters

2015-10-15 Thread Savolainen, Petri (Nokia - FI/Espoo)
Hi,

These RFCs could be the ones we are looking for pktio interface level counters. 

https://tools.ietf.org/html/rfc3635
https://tools.ietf.org/html/rfc2863
https://tools.ietf.org/html/rfc2819


The editor tool can be used to double check which RFC is the lastest...
https://www.rfc-editor.org/info/rfc3635
https://www.rfc-editor.org/info/rfc2863


The counters could be these, but in 64 bit version in ODP API.

For example, ifInOctets would be specified as

typedef struct {
  uint64_t in_octets;
  uint64_t in_ucastpkts;
...

} odp_pktio_stat_counters_t;



ifInOctets
ifInUcastPkts
ifInDiscards
ifInErrors
ifInUnknownProtos
ifOutOctets
ifOutUcastPkts
ifOutDiscards
ifOutErrors


ifInOctets  The number of octets in valid MAC frames
received on this interface, including
the MAC header and FCS.  This does
include the number of octets in valid
MAC Control frames received on this
Interface


ifInUcastPkts   Refer to [RFC2863].  Note that this does
not include MAC Control frames

...


-Petri






___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH 3/5] example: use odp_pktio_param_init() API

2015-10-15 Thread Maxim Uvarov
I think it's better to have single patch from patches 3,4 and 5, since 
they do the same thing.


Maxim.

On 10/14/2015 14:51, Bill Fischofer wrote:

Signed-off-by: Bill Fischofer 
---
  example/classifier/odp_classifier.c | 2 +-
  example/generator/odp_generator.c   | 2 +-
  example/ipsec/odp_ipsec.c   | 2 +-
  example/packet/odp_pktio.c  | 2 +-
  4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/example/classifier/odp_classifier.c 
b/example/classifier/odp_classifier.c
index 05a1eaa..18cd3bb 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -227,7 +227,7 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t 
pool)
int ret;
odp_pktio_param_t pktio_param;
  
-	memset(&pktio_param, 0, sizeof(pktio_param));

+   odp_pktio_param_init(&pktio_param);
pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
  
  	/* Open a packet IO instance */

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 5a0d5a4..f80104c 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -330,7 +330,7 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t 
pool)
odp_queue_t inq_def;
odp_pktio_param_t pktio_param;
  
-	memset(&pktio_param, 0, sizeof(pktio_param));

+   odp_pktio_param_init(&pktio_param);
pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
  
  	/* Open a packet IO instance */

diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 9c1e03c..474f4a5 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -496,7 +496,7 @@ void initialize_intf(char *intf)
char src_mac_str[MAX_STRING];
odp_pktio_param_t pktio_param;
  
-	memset(&pktio_param, 0, sizeof(pktio_param));

+   odp_pktio_param_init(&pktio_param);
  
  	if (getenv("ODP_IPSEC_USE_POLL_QUEUES"))

pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 4a8686e..93c38f5 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -118,7 +118,7 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t 
pool, int mode)
int ret;
odp_pktio_param_t pktio_param;
  
-	memset(&pktio_param, 0, sizeof(pktio_param));

+   odp_pktio_param_init(&pktio_param);
  
  	switch (mode) {

case  APPL_MODE_PKT_BURST:


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1542] Untested API verify_pmr_ip_proto

2015-10-15 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1542

--- Comment #5 from Bala Manoharan  ---
*** Bug 1828 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1828] Untested internal API verify_pmr_ip_proto

2015-10-15 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1828

Bala Manoharan  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|UNCONFIRMED |RESOLVED

--- Comment #1 from Bala Manoharan  ---


*** This bug has been marked as a duplicate of bug 1542 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1546] Untested API verify_pmr_udp_dport

2015-10-15 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1546

Bala Manoharan  changed:

   What|Removed |Added

 Status|IN_PROGRESS |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Bala Manoharan  ---
commit cd83d24e012adc852a4ae2cca1e584039dec2bab
Author: Balasubramanian Manoharan 
Date:   Wed Oct 14 10:33:00 2015 +0530

validation: classification: added additional suite to test individual PMRs

Additional test suite is added to classification validation suite to test
individual PMRs. This suite will test the defined PMRs by configuring
pktio separately for every test case.

Fixes:
https://bugs.linaro.org/show_bug.cgi?id=1542
https://bugs.linaro.org/show_bug.cgi?id=1544
https://bugs.linaro.org/show_bug.cgi?id=1545
https://bugs.linaro.org/show_bug.cgi?id=1546

Signed-off-by: Balasubramanian Manoharan 
Reviewed-by: Mike Holmes 
Signed-off-by: Maxim Uvarov 

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1545] Untested API verify_pmr_tcp_dport

2015-10-15 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1545

Bala Manoharan  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|IN_PROGRESS |RESOLVED

--- Comment #4 from Bala Manoharan  ---
commit cd83d24e012adc852a4ae2cca1e584039dec2bab
Author: Balasubramanian Manoharan 
Date:   Wed Oct 14 10:33:00 2015 +0530

validation: classification: added additional suite to test individual PMRs

Additional test suite is added to classification validation suite to test
individual PMRs. This suite will test the defined PMRs by configuring
pktio separately for every test case.

Fixes:
https://bugs.linaro.org/show_bug.cgi?id=1542
https://bugs.linaro.org/show_bug.cgi?id=1544
https://bugs.linaro.org/show_bug.cgi?id=1545
https://bugs.linaro.org/show_bug.cgi?id=1546

Signed-off-by: Balasubramanian Manoharan 
Reviewed-by: Mike Holmes 
Signed-off-by: Maxim Uvarov 

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1544] Untested API verify_pmr_tcp_sport

2015-10-15 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1544

Bala Manoharan  changed:

   What|Removed |Added

 Status|IN_PROGRESS |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Bala Manoharan  ---
commit cd83d24e012adc852a4ae2cca1e584039dec2bab
Author: Balasubramanian Manoharan 
Date:   Wed Oct 14 10:33:00 2015 +0530

validation: classification: added additional suite to test individual PMRs

Additional test suite is added to classification validation suite to test
individual PMRs. This suite will test the defined PMRs by configuring
pktio separately for every test case.

Fixes:
https://bugs.linaro.org/show_bug.cgi?id=1542
https://bugs.linaro.org/show_bug.cgi?id=1544
https://bugs.linaro.org/show_bug.cgi?id=1545
https://bugs.linaro.org/show_bug.cgi?id=1546

Signed-off-by: Balasubramanian Manoharan 
Reviewed-by: Mike Holmes 
Signed-off-by: Maxim Uvarov 

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1542] Untested API verify_pmr_ip_proto

2015-10-15 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1542

Bala Manoharan  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|IN_PROGRESS |RESOLVED

--- Comment #4 from Bala Manoharan  ---
commit cd83d24e012adc852a4ae2cca1e584039dec2bab
Author: Balasubramanian Manoharan 
Date:   Wed Oct 14 10:33:00 2015 +0530

validation: classification: added additional suite to test individual PMRs

Additional test suite is added to classification validation suite to test
individual PMRs. This suite will test the defined PMRs by configuring
pktio separately for every test case.

Fixes:
https://bugs.linaro.org/show_bug.cgi?id=1542
https://bugs.linaro.org/show_bug.cgi?id=1544
https://bugs.linaro.org/show_bug.cgi?id=1545
https://bugs.linaro.org/show_bug.cgi?id=1546

Signed-off-by: Balasubramanian Manoharan 
Reviewed-by: Mike Holmes 
Signed-off-by: Maxim Uvarov 

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT/PATCHv5] validation: classification: added additional suite to test individual PMRs

2015-10-15 Thread Maxim Uvarov

Merged,
Maxim.

On 10/15/2015 08:54, Bala Manoharan wrote:

Hi Bill,

Agreed. Maybe we can merge this patch and then I will send a separate
patch to resolve the conflict so that both your patch and the conflict
patch could be merged together.
IMO, if this patch is acceptable we can merge this as it is now and
then I can send a conflict resolution patch to be merged with your
patch.

Regards,
Bala

On 15 October 2015 at 02:20, Bill Fischofer  wrote:

On Wed, Oct 14, 2015 at 12:03 AM, Balasubramanian Manoharan
 wrote:

Additional test suite is added to classification validation suite to test
individual PMRs. This suite will test the defined PMRs by configuring
pktio separately for every test case.

Fixes:
https://bugs.linaro.org/show_bug.cgi?id=1542
https://bugs.linaro.org/show_bug.cgi?id=1544
https://bugs.linaro.org/show_bug.cgi?id=1545
https://bugs.linaro.org/show_bug.cgi?id=1546

Signed-off-by: Balasubramanian Manoharan 
---
v5: rebase on latest api-next

  helper/include/odp/helper/tcp.h|   1 +
  test/validation/classification/Makefile.am |   2 +
  test/validation/classification/classification.c|   5 +
  test/validation/classification/classification.h|  44 ++
  .../classification/odp_classification_common.c | 252 +
  .../classification/odp_classification_test_pmr.c   | 579
+
  .../classification/odp_classification_tests.c  | 309 ++-
  .../classification/odp_classification_testsuites.h |  15 +-
  8 files changed, 948 insertions(+), 259 deletions(-)
  create mode 100644
test/validation/classification/odp_classification_common.c
  create mode 100644
test/validation/classification/odp_classification_test_pmr.c

diff --git a/helper/include/odp/helper/tcp.h
b/helper/include/odp/helper/tcp.h
index defe422..42f0cbe 100644
--- a/helper/include/odp/helper/tcp.h
+++ b/helper/include/odp/helper/tcp.h
@@ -26,6 +26,7 @@ extern "C" {
   *  @{
   */

+#define ODPH_TCPHDR_LEN 20 /**< Min length of TCP header (no options) */

  /** TCP header */
  typedef struct ODP_PACKED {
diff --git a/test/validation/classification/Makefile.am
b/test/validation/classification/Makefile.am
index 5881665..4235309 100644
--- a/test/validation/classification/Makefile.am
+++ b/test/validation/classification/Makefile.am
@@ -3,6 +3,8 @@ include ../Makefile.inc
  noinst_LTLIBRARIES = libtestclassification.la
  libtestclassification_la_SOURCES = odp_classification_basic.c \
odp_classification_tests.c \
+  odp_classification_test_pmr.c \
+  odp_classification_common.c \
classification.c

  bin_PROGRAMS = classification_main$(EXEEXT)
diff --git a/test/validation/classification/classification.c
b/test/validation/classification/classification.c
index d0fef93..6641893 100644
--- a/test/validation/classification/classification.c
+++ b/test/validation/classification/classification.c
@@ -13,6 +13,11 @@ CU_SuiteInfo classification_suites[] = {
 { .pName = "classification basic",
 .pTests = classification_suite_basic,
 },
+   { .pName = "classification pmr tests",
+   .pTests = classification_suite_pmr,
+   .pInitFunc = classification_suite_pmr_init,
+   .pCleanupFunc = classification_suite_pmr_term,
+   },
 { .pName = "classification tests",
 .pTests = classification_suite,
 .pInitFunc = classification_suite_init,
diff --git a/test/validation/classification/classification.h
b/test/validation/classification/classification.h
index d2847e5..de9c37e 100644
--- a/test/validation/classification/classification.h
+++ b/test/validation/classification/classification.h
@@ -9,6 +9,50 @@

  #include 

+#define SHM_PKT_NUM_BUFS32
+#define SHM_PKT_BUF_SIZE1024
+
+/* Config values for Default CoS */
+#define TEST_DEFAULT   1
+#defineCLS_DEFAULT 0
+#define CLS_DEFAULT_SADDR  "10.0.0.1/32"
+#define CLS_DEFAULT_DADDR  "10.0.0.100/32"
+#define CLS_DEFAULT_SPORT  1024
+#define CLS_DEFAULT_DPORT  2048
+
+/* Config values for Error CoS */
+#define TEST_ERROR 1
+#define CLS_ERROR  1
+
+/* Config values for PMR_CHAIN */
+#define TEST_PMR_CHAIN 1
+#define CLS_PMR_CHAIN_SRC  2
+#define CLS_PMR_CHAIN_DST  3
+#define CLS_PMR_CHAIN_SADDR"10.0.0.5/32"
+#define CLS_PMR_CHAIN_SPORT3000
+
+/* Config values for PMR */
+#define TEST_PMR   1
+#define CLS_PMR4
+#define CLS_PMR_SPORT  4000
+
+/* Config values for PMR SET */
+#define TEST_PMR_SET   1
+#define CLS_PMR_SET5
+#define CLS_PMR_SET_SADDR  "10.0.0.6/32"
+#define CLS_PMR_SET_SPORT  5000
+
+/* Config values for CoS L2 Priority */
+#define TEST_L2_QOS1
+#define CLS_L2_QOS_0   6
+#de

Re: [lng-odp] [PATCHv3 0/5] add ability to mark tests as inactive

2015-10-15 Thread Maxim Uvarov

Merged,
Maxim.

On 10/14/2015 15:11, Christophe Milard wrote:
That is my point:I think such a macro would make the overloading 
clearer (more visible).

And I agree it can be done later. hence my reviews :-)

Christophe.

On 14 October 2015 at 14:03, Stuart Haslam > wrote:


On Wed, Oct 14, 2015 at 01:17:34PM +0200, Christophe Milard wrote:
> I have just reviewed the all series. As a side note though, I
thing a MACRO
> called ODP_TEST_OVERLOAD(test_func, new_test_func) should be
defined if a
> given test function should be "replaced") using the update
function. The
> TEST_INFO macro would not be able to be used as, for this
macro,  the name
> of the test matches the name of the function and functions cannot be
> overloaded in C.
> I think that could be done in another patch, though. (hence my
reviews)
>
> Do you agree Stuart?
>

Replacing test functions can be done but it's a bit ugly as there's no
macro for doing it - see end of this mail -

https://lists.linaro.org/pipermail/lng-odp/2015-September/015506.html

I don't really have any objection to adding one but it can be done
later, nobody needs it right now.

--
Stuart.




___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [ODP-DPDK] SpanningTree and block a port ?

2015-10-15 Thread Kury Nicolas
Hi!

Thank you very much for the answer!

Regards
Nicolas



De : Brian Brooks 
Envoyé : mercredi 7 octobre 2015 15:49
À : Kury Nicolas; lng-odp@lists.linaro.org
Objet : RE: [ODP-DPDK] SpanningTree and block a port ?

Hi Nicolas,

In your use case, a STP 'application' and a traffic generator 'application' 
need to be designed to run as separate processes that work together.

Multi-process aside, odp_pktio_start/stop() is documented as a way to 
start/stop tx & rx on a packet IO interface. Depending on the implementation, 
this may be usable for STP.

For MSTP, perhaps you could utilize the classification APIs to match on pktio + 
VLAN and drop for ingress blocking. However, the application would need to be 
aware of the spanning tree state to prevent transmitting packets destined for 
blocked ports.

Note the API for polling link state: 
https://lists.linaro.org/pipermail/lng-odp/2015-September/015557.html

Regards,
Brian

From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Kury 
Nicolas
Sent: Friday, October 02, 2015 8:50 AM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [ODP-DPDK] SpanningTree and block a port ?

Hi

I would like to implement an application with spanning tree protocol. But can 
the application "spanningtree" stop and start a port used by another 
applications (exemple odp_generator) ?
Here a diagram:  http://s8.postimg.org/yis5flhed/spanningtree.png

For exemple, if the link #1 is down, spanningtree application enables port 0.

Thank you
Nicolas
Transmitting



-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] performance: l2fwd: obey -t in queue mode

2015-10-15 Thread Maxim Uvarov

Merged,

changed short description to test/performance to be clear that it's for 
tests.


Maxim.

On 09/10/2015 14:55, Stuart Haslam wrote:

The -t command line argument specifies the length of time the application
should run before exiting, but this doesn't always work in queue mode as
the odp_schedule() call may not return if no packets are received.

Signed-off-by: Stuart Haslam 
---
  test/performance/odp_l2fwd.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 64fc1b2..75e5cb8 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -131,6 +131,7 @@ static void *pktio_queue_thread(void *arg)
odp_packet_t pkt;
odp_event_t ev;
thread_args_t *thr_args = arg;
+   uint64_t wait;
  
  	stats_t *stats = calloc(1, sizeof(stats_t));

*thr_args->stats = stats;
@@ -140,10 +141,14 @@ static void *pktio_queue_thread(void *arg)
printf("[%02i] QUEUE mode\n", thr);
odp_barrier_wait(&barrier);
  
+	wait = odp_schedule_wait_time(ODP_TIME_MSEC * 100);

+
/* Loop packets */
while (!exit_threads) {
/* Use schedule to get buf from any input queue */
-   ev  = odp_schedule(NULL, ODP_SCHED_WAIT);
+   ev  = odp_schedule(NULL, wait);
+   if (ev == ODP_EVENT_INVALID)
+   continue;
pkt = odp_packet_from_event(ev);
  
  		/* Drop packets with errors */


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] linux-generic: pktio: remove hyphens from veth interface names

2015-10-15 Thread Maxim Uvarov

Merged,
Maxim.

On 10/14/2015 12:39, Stuart Haslam wrote:

Recent netmap versions support veth devices so can be tested using the
environment setup by the pktio_env script, the only problem is it
doesn't like hyphens in interface names:

nm_open [839] unexpected character: 'p' pktio-p0-p1

Signed-off-by: Stuart Haslam 
---
  platform/linux-generic/test/pktio/pktio_env | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/test/pktio/pktio_env 
b/platform/linux-generic/test/pktio/pktio_env
index 5e547e4..345b5bd 100644
--- a/platform/linux-generic/test/pktio/pktio_env
+++ b/platform/linux-generic/test/pktio/pktio_env
@@ -18,10 +18,10 @@
  # Network set up
  # IF0 <---> IF1
  # IF2 <---> IF3
-IF0=pktio-p0-p1
-IF1=pktio-p1-p0
-IF2=pktio-p2-p3
-IF3=pktio-p3-p2
+IF0=pktiop0p1
+IF1=pktiop1p0
+IF2=pktiop2p3
+IF3=pktiop3p2
  
  if [ "$0" = "$BASH_SOURCE" ]; then

echo "Error: Platform specific env file has to be sourced."


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] [API-NEXT PATCH v5] api: hash: Added crc32 and crc32c hash functions

2015-10-15 Thread Savolainen, Petri (Nokia - FI/Espoo)

Reviewed-by: Petri Savolainen 


> -Original Message-
> From: EXT Peng [mailto:xnhp0...@icloud.com]
> Sent: Thursday, October 15, 2015 10:51 AM
> To: lng-odp@lists.linaro.org
> Cc: Savolainen, Petri (Nokia - FI/Espoo); Peng
> Subject: [PATCH] [API-NEXT PATCH v5] api: hash: Added crc32 and crc32c hash
> functions
> 
> From: Peng 
> 
> v2: Add copyright license.
> v3: APIs: crc32c, crc32 and generic CRC hash impl
> linux-generic: add impl for crc32c.
> v4: linux-generic:
> change odp_crc32c_1word to crc32c_u32,
> change odp_crc32c_2words to crc32c_u64,
> drop inline decorator for odp_hash_crc32c.
> change copyrights to 2015.
> v5: linux-generic:
> add copyrights to 2015 for linux-generic headers
> 
> Signed-off-by: Peng 
> ---
>  include/odp.h |   1 +
>  include/odp/api/hash.h|  98 ++
>  platform/linux-generic/Makefile.am|   3 +
>  platform/linux-generic/include/odp/hash.h |  34 +++
>  platform/linux-generic/odp_hash.c | 487
> ++
>  5 files changed, 623 insertions(+)
>  create mode 100644 include/odp/api/hash.h
>  create mode 100644 platform/linux-generic/include/odp/hash.h
>  create mode 100644 platform/linux-generic/odp_hash.c
> 
> diff --git a/include/odp.h b/include/odp.h
> index 825c7e1..da57da8 100644
> --- a/include/odp.h
> +++ b/include/odp.h
> @@ -24,6 +24,7 @@ extern "C" {
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/include/odp/api/hash.h b/include/odp/api/hash.h
> new file mode 100644
> index 000..59466c1
> --- /dev/null
> +++ b/include/odp/api/hash.h
> @@ -0,0 +1,98 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:  BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP Hash functions
> + */
> +
> +#ifndef ODP_API_HASH_H_
> +#define ODP_API_HASH_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +
> +/** @defgroup odp_hash ODP HASH FUNCTIONS
> + *  ODP Hash functions
> + *  @{
> + */
> +
> +/**
> +* Calculate CRC-32
> +*
> +* Calculates CRC-32 over the data. The polynomial is 0x04c11db7.
> +*
> +* @param data   Pointer to data
> +* @param data_len   Data length in bytes
> +* @param init_val   CRC generator initialization value
> +*
> +* @return CRC32 value
> +*/
> +uint32_t odp_hash_crc32(const void *data, uint32_t data_len, uint32_t
> init_val);
> +
> +/**
> +* Calculate CRC-32C
> +*
> +* Calculates CRC-32C (a.k.a. CRC-32 Castagnoli) over the data.
> +* The polynomial is 0x1edc6f41.
> +*
> +* @param data   Pointer to data
> +* @param data_len   Data length in bytes
> +* @param init_val   CRC generator initialization value
> +*
> +* @return CRC32C value
> +*/
> +uint32_t odp_hash_crc32c(const void *data, uint32_t data_len,
> +  uint32_t init_val);
> +
> +/**
> +* CRC parameters
> +*
> +* Supports CRCs up to 64 bits
> +*/
> +typedef struct odp_hash_crc_param_t {
> + /** CRC width in bits */
> + uint32_t width;
> + /** Polynomial (stored in 'width' LSB bits) */
> + uint64_t poly;
> + /** 0: don't reflect, 1: reflect bits in input bytes */
> + odp_bool_t reflect_in;
> + /** 0: don't reflect, 1: reflect bits in output bytes */
> + odp_bool_t reflect_out;
> + /** XOR this value to CRC output (stored in 'width' LSB bits) */
> + uint64_t xor_out;
> +} odp_hash_crc_param_t;
> +
> +/**
> +* Calculate up to 64 bit CRC using the given parameters
> +*
> +* Calculates CRC over the data using the given parameters.
> +*
> +* @param data   Pointer to data
> +* @param data_len   Data length in bytes
> +* @param init_val   CRC generator initialization value
> +* @param crc_param  CRC parameters
> +* @param crcPointer for CRC output
> +*
> +* @return 0 on success, <0 on failure (e.g. not supported algorithm)
> +*/
> +int odp_hash_crc_gen64(const void *data, uint32_t data_len,
> +uint64_t init_val, odp_hash_crc_param_t *param,
> +uint64_t *crc);
> +
> +/**
> + * @}
> + */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-
> generic/Makefile.am
> index 202ec6a..083e8d9 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -26,6 +26,7 @@ odpinclude_HEADERS = \
> $(srcdir)/include/odp/debug.h \
> $(srcdir)/include/odp/errno.h \
> $(srcdir)/include/odp/event.h \
> +   $(srcdir)/include/odp/hash.h \
> $(srcdir)/include/odp/hints.h \
> $(srcdir)/include/odp/init.h \
> $(srcdir)/include/odp/packet_flags.h \
> @@ -93,6 +94,7 @@ odpapiinclude_HEADERS = \
> $(top_srcdir)/include/odp/api/debug.h \
> $(top_srcdir)/include/odp/api/errno.h \
> $(top_srcdir)/include/odp/a

[lng-odp] [PATCH] [API-NEXT PATCH v5] api: hash: Added crc32 and crc32c hash functions

2015-10-15 Thread Peng
From: Peng 

v2: Add copyright license.
v3: APIs: crc32c, crc32 and generic CRC hash impl
linux-generic: add impl for crc32c.
v4: linux-generic:
change odp_crc32c_1word to crc32c_u32,
change odp_crc32c_2words to crc32c_u64,
drop inline decorator for odp_hash_crc32c.
change copyrights to 2015.
v5: linux-generic:
add copyrights to 2015 for linux-generic headers

Signed-off-by: Peng 
---
 include/odp.h |   1 +
 include/odp/api/hash.h|  98 ++
 platform/linux-generic/Makefile.am|   3 +
 platform/linux-generic/include/odp/hash.h |  34 +++
 platform/linux-generic/odp_hash.c | 487 ++
 5 files changed, 623 insertions(+)
 create mode 100644 include/odp/api/hash.h
 create mode 100644 platform/linux-generic/include/odp/hash.h
 create mode 100644 platform/linux-generic/odp_hash.c

diff --git a/include/odp.h b/include/odp.h
index 825c7e1..da57da8 100644
--- a/include/odp.h
+++ b/include/odp.h
@@ -24,6 +24,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/odp/api/hash.h b/include/odp/api/hash.h
new file mode 100644
index 000..59466c1
--- /dev/null
+++ b/include/odp/api/hash.h
@@ -0,0 +1,98 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Hash functions
+ */
+
+#ifndef ODP_API_HASH_H_
+#define ODP_API_HASH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @defgroup odp_hash ODP HASH FUNCTIONS
+ *  ODP Hash functions
+ *  @{
+ */
+
+/**
+* Calculate CRC-32
+*
+* Calculates CRC-32 over the data. The polynomial is 0x04c11db7.
+*
+* @param data   Pointer to data
+* @param data_len   Data length in bytes
+* @param init_val   CRC generator initialization value
+*
+* @return CRC32 value
+*/
+uint32_t odp_hash_crc32(const void *data, uint32_t data_len, uint32_t 
init_val);
+
+/**
+* Calculate CRC-32C
+*
+* Calculates CRC-32C (a.k.a. CRC-32 Castagnoli) over the data.
+* The polynomial is 0x1edc6f41.
+*
+* @param data   Pointer to data
+* @param data_len   Data length in bytes
+* @param init_val   CRC generator initialization value
+*
+* @return CRC32C value
+*/
+uint32_t odp_hash_crc32c(const void *data, uint32_t data_len,
+uint32_t init_val);
+
+/**
+* CRC parameters
+*
+* Supports CRCs up to 64 bits
+*/
+typedef struct odp_hash_crc_param_t {
+   /** CRC width in bits */
+   uint32_t width;
+   /** Polynomial (stored in 'width' LSB bits) */
+   uint64_t poly;
+   /** 0: don't reflect, 1: reflect bits in input bytes */
+   odp_bool_t reflect_in;
+   /** 0: don't reflect, 1: reflect bits in output bytes */
+   odp_bool_t reflect_out;
+   /** XOR this value to CRC output (stored in 'width' LSB bits) */
+   uint64_t xor_out;
+} odp_hash_crc_param_t;
+
+/**
+* Calculate up to 64 bit CRC using the given parameters
+*
+* Calculates CRC over the data using the given parameters.
+*
+* @param data   Pointer to data
+* @param data_len   Data length in bytes
+* @param init_val   CRC generator initialization value
+* @param crc_param  CRC parameters
+* @param crcPointer for CRC output
+*
+* @return 0 on success, <0 on failure (e.g. not supported algorithm)
+*/
+int odp_hash_crc_gen64(const void *data, uint32_t data_len,
+  uint64_t init_val, odp_hash_crc_param_t *param,
+  uint64_t *crc);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 202ec6a..083e8d9 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -26,6 +26,7 @@ odpinclude_HEADERS = \
  $(srcdir)/include/odp/debug.h \
  $(srcdir)/include/odp/errno.h \
  $(srcdir)/include/odp/event.h \
+ $(srcdir)/include/odp/hash.h \
  $(srcdir)/include/odp/hints.h \
  $(srcdir)/include/odp/init.h \
  $(srcdir)/include/odp/packet_flags.h \
@@ -93,6 +94,7 @@ odpapiinclude_HEADERS = \
  $(top_srcdir)/include/odp/api/debug.h \
  $(top_srcdir)/include/odp/api/errno.h \
  $(top_srcdir)/include/odp/api/event.h \
+ $(top_srcdir)/include/odp/api/hash.h \
  $(top_srcdir)/include/odp/api/hints.h \
  $(top_srcdir)/include/odp/api/init.h \
  $(top_srcdir)/include/odp/api/packet.h \
@@ -152,6 +154,7 @@ __LIB__libodp_la_SOURCES = \
   odp_crypto.c \
   odp_errno.c \
   odp_event.c \
+  odp_hash.c \
   odp_init.c \
   odp_impl.c \
   odp_packet.c \
diff --git a/platf

[lng-odp] [PATCH] [API-NEXT PATCH v4] api: hash: Added crc32 and crc32c hash functions

2015-10-15 Thread Peng
From: Peng 

v2: Add copyright license.
v3: APIs: crc32c, crc32 and generic CRC hash impl
linux-generic: add impl for crc32c.
v4: linux-generic:
change odp_crc32c_1word to crc32c_u32,
change odp_crc32c_2words to crc32c_u64,
drop inline decorator for odp_hash_crc32c.
change copyrights to 2015.

Signed-off-by: Peng 
---
 include/odp.h |   1 +
 include/odp/api/hash.h|  98 ++
 platform/linux-generic/Makefile.am|   3 +
 platform/linux-generic/include/odp/hash.h |  34 +++
 platform/linux-generic/odp_hash.c | 487 ++
 5 files changed, 623 insertions(+)
 create mode 100644 include/odp/api/hash.h
 create mode 100644 platform/linux-generic/include/odp/hash.h
 create mode 100644 platform/linux-generic/odp_hash.c

diff --git a/include/odp.h b/include/odp.h
index 825c7e1..da57da8 100644
--- a/include/odp.h
+++ b/include/odp.h
@@ -24,6 +24,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/odp/api/hash.h b/include/odp/api/hash.h
new file mode 100644
index 000..59466c1
--- /dev/null
+++ b/include/odp/api/hash.h
@@ -0,0 +1,98 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Hash functions
+ */
+
+#ifndef ODP_API_HASH_H_
+#define ODP_API_HASH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @defgroup odp_hash ODP HASH FUNCTIONS
+ *  ODP Hash functions
+ *  @{
+ */
+
+/**
+* Calculate CRC-32
+*
+* Calculates CRC-32 over the data. The polynomial is 0x04c11db7.
+*
+* @param data   Pointer to data
+* @param data_len   Data length in bytes
+* @param init_val   CRC generator initialization value
+*
+* @return CRC32 value
+*/
+uint32_t odp_hash_crc32(const void *data, uint32_t data_len, uint32_t 
init_val);
+
+/**
+* Calculate CRC-32C
+*
+* Calculates CRC-32C (a.k.a. CRC-32 Castagnoli) over the data.
+* The polynomial is 0x1edc6f41.
+*
+* @param data   Pointer to data
+* @param data_len   Data length in bytes
+* @param init_val   CRC generator initialization value
+*
+* @return CRC32C value
+*/
+uint32_t odp_hash_crc32c(const void *data, uint32_t data_len,
+uint32_t init_val);
+
+/**
+* CRC parameters
+*
+* Supports CRCs up to 64 bits
+*/
+typedef struct odp_hash_crc_param_t {
+   /** CRC width in bits */
+   uint32_t width;
+   /** Polynomial (stored in 'width' LSB bits) */
+   uint64_t poly;
+   /** 0: don't reflect, 1: reflect bits in input bytes */
+   odp_bool_t reflect_in;
+   /** 0: don't reflect, 1: reflect bits in output bytes */
+   odp_bool_t reflect_out;
+   /** XOR this value to CRC output (stored in 'width' LSB bits) */
+   uint64_t xor_out;
+} odp_hash_crc_param_t;
+
+/**
+* Calculate up to 64 bit CRC using the given parameters
+*
+* Calculates CRC over the data using the given parameters.
+*
+* @param data   Pointer to data
+* @param data_len   Data length in bytes
+* @param init_val   CRC generator initialization value
+* @param crc_param  CRC parameters
+* @param crcPointer for CRC output
+*
+* @return 0 on success, <0 on failure (e.g. not supported algorithm)
+*/
+int odp_hash_crc_gen64(const void *data, uint32_t data_len,
+  uint64_t init_val, odp_hash_crc_param_t *param,
+  uint64_t *crc);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 202ec6a..083e8d9 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -26,6 +26,7 @@ odpinclude_HEADERS = \
  $(srcdir)/include/odp/debug.h \
  $(srcdir)/include/odp/errno.h \
  $(srcdir)/include/odp/event.h \
+ $(srcdir)/include/odp/hash.h \
  $(srcdir)/include/odp/hints.h \
  $(srcdir)/include/odp/init.h \
  $(srcdir)/include/odp/packet_flags.h \
@@ -93,6 +94,7 @@ odpapiinclude_HEADERS = \
  $(top_srcdir)/include/odp/api/debug.h \
  $(top_srcdir)/include/odp/api/errno.h \
  $(top_srcdir)/include/odp/api/event.h \
+ $(top_srcdir)/include/odp/api/hash.h \
  $(top_srcdir)/include/odp/api/hints.h \
  $(top_srcdir)/include/odp/api/init.h \
  $(top_srcdir)/include/odp/api/packet.h \
@@ -152,6 +154,7 @@ __LIB__libodp_la_SOURCES = \
   odp_crypto.c \
   odp_errno.c \
   odp_event.c \
+  odp_hash.c \
   odp_init.c \
   odp_impl.c \
   odp_packet.c \
diff --git a/platform/linux-generic/include/odp/hash.h 
b/platform/linux-generic/include/o