This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, devel/native-drivers has been updated
via 121a1e14d0b3b205420df876587ec1e8ef4cf723 (commit)
from 6336beb21e88eef30fbfcd415e6d038c96f4343d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 121a1e14d0b3b205420df876587ec1e8ef4cf723
Author: Josep Puigdemont <josep.puigdemont(a)linaro.org>
Date: Thu Dec 14 15:45:12 2017 +0100
physmem: rename init/term functions
Signed-off-by: Josep Puigdemont <josep.puigdemont(a)linaro.org>
diff --git a/platform/linux-generic/pktio/physmem/physmem.c b/platform/linux-generic/pktio/physmem/physmem.c
index 54b62d2d..b426c21d 100644
--- a/platform/linux-generic/pktio/physmem/physmem.c
+++ b/platform/linux-generic/pktio/physmem/physmem.c
@@ -544,7 +544,7 @@ static void init_blocks(void)
LIST_INIT(&block_data.empty);
}
-int physmem_block_global_init(void)
+int physmem_block_init_global(void)
{
init_blocks();
@@ -557,7 +557,7 @@ int physmem_block_global_init(void)
return 0;
}
-int physmem_block_global_term(void)
+int physmem_block_term_global(void)
{
for (int i = 0; i < MAX_HUGEPAGES; ++i) {
if (pages[i].fd == 0)
diff --git a/platform/linux-generic/pktio/physmem/physmem.h b/platform/linux-generic/pktio/physmem/physmem.h
index 0ebc2ba6..9a7f37c4 100644
--- a/platform/linux-generic/pktio/physmem/physmem.h
+++ b/platform/linux-generic/pktio/physmem/physmem.h
@@ -32,8 +32,8 @@ struct physmem_block {
physmem_block_type_t type;
};
-int physmem_block_global_init(void);
-int physmem_block_global_term(void);
+int physmem_block_init_global(void);
+int physmem_block_term_global(void);
struct physmem_block *physmem_block_alloc(uint64_t);
void physmem_block_free(struct physmem_block *);
-----------------------------------------------------------------------
Summary of changes:
platform/linux-generic/pktio/physmem/physmem.c | 4 ++--
platform/linux-generic/pktio/physmem/physmem.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
hooks/post-receive
--
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, api-next has been updated
via da9d347e0bbe337ea86448306432080206f3ef49 (commit)
via d533d85ad15ea431a431c407dad468e38ae87ec0 (commit)
via fa7ce5da4b669e55b8d34c7d90b67070879ba5da (commit)
from d96a8207591fbcaac25b79286d7d72a537354c1f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit da9d347e0bbe337ea86448306432080206f3ef49
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Tue Nov 21 14:12:02 2017 +0200
validation: queue: refer to blocking level
Refer to the new blocking level capability and parameter
fields to check that those exist.
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Reviewed-by: Balasubramanian Manoharan <bala.manoharan(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue/queue.c
index 1ec05b1f..3c6db33a 100644
--- a/test/validation/api/queue/queue.c
+++ b/test/validation/api/queue/queue.c
@@ -69,6 +69,8 @@ void queue_test_capa(void)
CU_ASSERT(capa.sched_prios != 0);
CU_ASSERT(capa.plain.max_num != 0);
CU_ASSERT(capa.sched.max_num != 0);
+ CU_ASSERT(capa.plain.nonblocking >= ODP_BLOCKING);
+ CU_ASSERT(capa.sched.nonblocking >= ODP_BLOCKING);
min = capa.plain.max_num;
if (min > capa.sched.max_num)
@@ -82,6 +84,7 @@ void queue_test_capa(void)
name[ODP_QUEUE_NAME_LEN - 1] = 0;
odp_queue_param_init(&qparams);
+ CU_ASSERT(qparams.nonblocking == ODP_BLOCKING);
for (j = 0; j < 2; j++) {
if (j == 0) {
commit d533d85ad15ea431a431c407dad468e38ae87ec0
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Tue Nov 21 13:52:00 2017 +0200
linux-gen: queue: fill blocking capa
Currently, only blocking queues are implemented.
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Reviewed-by: Balasubramanian Manoharan <bala.manoharan(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index 3f355e69..58103930 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -150,7 +150,9 @@ static int queue_capability(odp_queue_capability_t *capa)
capa->max_sched_groups = sched_fn->num_grps();
capa->sched_prios = odp_schedule_num_prio();
capa->plain.max_num = capa->max_queues;
+ capa->plain.nonblocking = ODP_BLOCKING;
capa->sched.max_num = capa->max_queues;
+ capa->sched.nonblocking = ODP_BLOCKING;
return 0;
}
@@ -601,6 +603,7 @@ static void queue_param_init(odp_queue_param_t *params)
params->type = ODP_QUEUE_TYPE_PLAIN;
params->enq_mode = ODP_QUEUE_OP_MT;
params->deq_mode = ODP_QUEUE_OP_MT;
+ params->nonblocking = ODP_BLOCKING;
params->sched.prio = ODP_SCHED_PRIO_DEFAULT;
params->sched.sync = ODP_SCHED_SYNC_PARALLEL;
params->sched.group = ODP_SCHED_GROUP_ALL;
diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c
index 07201ce7..88a5a8c2 100644
--- a/platform/linux-generic/odp_queue_scalable.c
+++ b/platform/linux-generic/odp_queue_scalable.c
@@ -315,8 +315,10 @@ static int queue_capability(odp_queue_capability_t *capa)
capa->sched_prios = odp_schedule_num_prio();
capa->plain.max_num = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES;
capa->plain.max_size = 0;
+ capa->plain.nonblocking = ODP_BLOCKING;
capa->sched.max_num = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES;
capa->sched.max_size = 0;
+ capa->sched.nonblocking = ODP_BLOCKING;
return 0;
}
@@ -861,6 +863,7 @@ static void queue_param_init(odp_queue_param_t *params)
params->type = ODP_QUEUE_TYPE_PLAIN;
params->enq_mode = ODP_QUEUE_OP_MT;
params->deq_mode = ODP_QUEUE_OP_MT;
+ params->nonblocking = ODP_BLOCKING;
params->sched.prio = ODP_SCHED_PRIO_DEFAULT;
params->sched.sync = ODP_SCHED_SYNC_PARALLEL;
params->sched.group = ODP_SCHED_GROUP_ALL;
commit fa7ce5da4b669e55b8d34c7d90b67070879ba5da
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Tue Nov 21 13:41:14 2017 +0200
api: queue: non-blocking level parameter
Add queue parameter and capability to indicate queue operation
blocking level. This guarantee of non-blocking is important for
real-time applications. HW based implementations may be always
non-blocking. Where as, SW based implementation need to trade-off
between block freedom and performance.
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Reviewed-by: Balasubramanian Manoharan <bala.manoharan(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h
index 014d3362..79a26df3 100644
--- a/include/odp/api/spec/queue.h
+++ b/include/odp/api/spec/queue.h
@@ -96,6 +96,54 @@ typedef enum odp_queue_op_mode_t {
} odp_queue_op_mode_t;
+/**
+ * Non-blocking level
+ *
+ * A non-blocking level defines implementation guarantees for application
+ * progress when multiple threads operate on the same resource (e.g. a queue)
+ * simultaneously. The first level (ODP_BLOCKING) does not have any block
+ * freedom guarantees, but a suspending thread may block the other threads for
+ * the entire time it remains suspended (infinitely if crashed).
+ * On the contrary, actual non-blocking levels provide guarantees of progress:
+ *
+ * ODP_NONBLOCKING_LF: A non-blocking and lock-free implementation guarantees
+ * that at least one of the threads successfully completes
+ * its operations, regardless of what other threads do.
+ * Application progress is guaranteed, but individual
+ * threads may starve while trying to execute their
+ * operations on the shared resource.
+ *
+ * ODP_NONBLOCKING_WF: A non-blocking and wait-free implementation guarantees
+ * application progress with starvation freedom. All
+ * threads are guaranteed to complete their operations in
+ * a bounded number of steps, regardless of what other
+ * threads do.
+ *
+ * Non-blocking levels are listed from the weakest to the strongest guarantee of
+ * block freedom. Performance of a non-blocking implementation may be lower than
+ * the blocking one. Non-blocking guarantees are important e.g. for real-time
+ * applications when real-time and non real-time threads share a resource.
+ */
+typedef enum odp_nonblocking_t {
+ /** Blocking implementation. A suspeding thread may block all other
+ * threads, i.e. no block freedom guarantees. This is the lowest level.
+ */
+ ODP_BLOCKING = 0,
+
+ /** Non-blocking and lock-free implementation. Other threads can make
+ * progress while a thread is suspended. Starvation freedom is not
+ * guaranteed.
+ */
+ ODP_NONBLOCKING_LF,
+
+ /** Non-blocking and wait-free implementation. Other threads can make
+ * progress while a thread is suspended. Starvation freedom is
+ * guaranteed.
+ */
+ ODP_NONBLOCKING_WF
+
+} odp_nonblocking_t;
+
/**
* Queue capabilities
*/
@@ -125,6 +173,10 @@ typedef struct odp_queue_capability_t {
* store all available events. */
uint32_t max_size;
+ /** The strongest guarantee of block freedom that is supported
+ * for plain queues. */
+ odp_nonblocking_t nonblocking;
+
} plain;
/** Scheduled queue capabilities */
@@ -138,6 +190,10 @@ typedef struct odp_queue_capability_t {
* store all available events. */
uint32_t max_size;
+ /** The strongest guarantee of block freedom that is supported
+ * for scheduled queues. */
+ odp_nonblocking_t nonblocking;
+
} sched;
} odp_queue_capability_t;
@@ -178,6 +234,13 @@ typedef struct odp_queue_param_t {
* ODP_QUEUE_TYPE_SCHED. */
odp_schedule_param_t sched;
+ /** Non-blocking level
+ *
+ * Queue implementation must guarantee at least this level of block
+ * freedom for queue enqueue and dequeue/schedule operations.
+ * The default value is ODP_BLOCKING. */
+ odp_nonblocking_t nonblocking;
+
/** Queue context pointer
*
* User defined context pointer associated with the queue. The same
-----------------------------------------------------------------------
Summary of changes:
include/odp/api/spec/queue.h | 63 +++++++++++++++++++++++++++++
platform/linux-generic/odp_queue.c | 3 ++
platform/linux-generic/odp_queue_scalable.c | 3 ++
test/validation/api/queue/queue.c | 3 ++
4 files changed, 72 insertions(+)
hooks/post-receive
--
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, devel/caterpillar has been created
at 63fd88635cc10caaa02fdccd3f52c9494487bdd2 (commit)
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
hooks/post-receive
--
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, api-next has been updated
via d96a8207591fbcaac25b79286d7d72a537354c1f (commit)
via 21ed0fc8045e32e3263f5782401dbfe860152965 (commit)
from 87d47c93d93ed934af9502937d2aceaec59d229a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d96a8207591fbcaac25b79286d7d72a537354c1f
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Mon Dec 11 14:45:17 2017 +0200
validation: shm: add name tests
Test shm blocks with NULL and maximum length names.
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Balasubramanian Manoharan <bala.manoharan(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/test/validation/api/shmem/shmem.c b/test/validation/api/shmem/shmem.c
index d1abc62b..30eb08da 100644
--- a/test/validation/api/shmem/shmem.c
+++ b/test/validation/api/shmem/shmem.c
@@ -136,24 +136,59 @@ void shmem_test_basic(void)
odp_shm_t shm2;
shared_test_data_t *shared_test_data;
odp_cpumask_t unused;
+ int i;
+ char max_name[ODP_SHM_NAME_LEN];
+
+ for (i = 0; i < ODP_SHM_NAME_LEN; i++)
+ max_name[i] = 'A' + (i % 26);
+
+ max_name[ODP_QUEUE_NAME_LEN - 1] = 0;
+
+ /* NULL name */
+ shm = odp_shm_reserve(NULL,
+ sizeof(shared_test_data_t), ALIGN_SIZE, 0);
+ CU_ASSERT(ODP_SHM_INVALID != shm);
+ shared_test_data = odp_shm_addr(shm);
+ CU_ASSERT_FATAL(NULL != shared_test_data);
+ shared_test_data->foo = 0;
+ CU_ASSERT(0 == odp_shm_free(shm));
+
+ /* Maximum length name */
+ shm = odp_shm_reserve(max_name,
+ sizeof(shared_test_data_t), ALIGN_SIZE, 0);
+ CU_ASSERT(ODP_SHM_INVALID != shm);
+ shm2 = odp_shm_lookup(max_name);
+ CU_ASSERT(ODP_SHM_INVALID != shm2);
+ CU_ASSERT(odp_shm_addr(shm) == odp_shm_addr(shm2));
+ shared_test_data = odp_shm_addr(shm);
+ CU_ASSERT_FATAL(NULL != shared_test_data);
+ shared_test_data->foo = 0;
+ CU_ASSERT(0 == odp_shm_free(shm));
+ /* Non-unique name */
shm = odp_shm_reserve(MEM_NAME,
sizeof(shared_test_data_t), ALIGN_SIZE, 0);
CU_ASSERT(ODP_SHM_INVALID != shm);
CU_ASSERT(odp_shm_to_u64(shm) !=
odp_shm_to_u64(ODP_SHM_INVALID));
-
- /* also check that another reserve with same name is accepted: */
shm2 = odp_shm_reserve(MEM_NAME,
sizeof(shared_test_data_t), ALIGN_SIZE, 0);
CU_ASSERT(ODP_SHM_INVALID != shm2);
CU_ASSERT(odp_shm_to_u64(shm2) !=
odp_shm_to_u64(ODP_SHM_INVALID));
+ CU_ASSERT(odp_shm_addr(shm) != odp_shm_addr(shm2));
+ shared_test_data = odp_shm_addr(shm);
+ CU_ASSERT_FATAL(NULL != shared_test_data);
+ shared_test_data->foo = 0;
+ shared_test_data = odp_shm_addr(shm2);
+ CU_ASSERT_FATAL(NULL != shared_test_data);
+ shared_test_data->foo = 0;
CU_ASSERT(0 == odp_shm_free(shm));
CU_ASSERT(0 == odp_shm_free(shm2));
CU_ASSERT(ODP_SHM_INVALID == odp_shm_lookup(MEM_NAME));
+ /* Share with multiple threads */
shm = odp_shm_reserve(MEM_NAME,
sizeof(shared_test_data_t), ALIGN_SIZE, 0);
CU_ASSERT(ODP_SHM_INVALID != shm);
commit 21ed0fc8045e32e3263f5782401dbfe860152965
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Mon Dec 11 14:22:16 2017 +0200
api: shm: name is optional
Align shared memory name parameter specification with other
APIs. Name is optional and does not need to be unique, except
when it's used for lookups.
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Balasubramanian Manoharan <bala.manoharan(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h
index 60a0cdde..38c82a10 100644
--- a/include/odp/api/spec/shared_memory.h
+++ b/include/odp/api/spec/shared_memory.h
@@ -127,7 +127,14 @@ int odp_shm_capability(odp_shm_capability_t *capa);
/**
* Reserve a contiguous block of shared memory
*
- * @param name Name of the block (maximum ODP_SHM_NAME_LEN - 1 chars)
+ * Reserve a contiguous block of shared memory that fulfills size, alignment
+ * and shareability (ODP_SHM_* flags) requirements. In general, a name is
+ * optional and does not need to be unique. However, if the block will be
+ * searched with odp_shm_lookup() or odp_shm_import(), a unique name is needed
+ * for correct match.
+ *
+ * @param name Name of the block or NULL. Maximum string length is
+ * ODP_SHM_NAME_LEN.
* @param size Block size in bytes
* @param align Block alignment in bytes
* @param flags Shared memory parameter flags (ODP_SHM_*). Default value is 0.
-----------------------------------------------------------------------
Summary of changes:
include/odp/api/spec/shared_memory.h | 9 ++++++++-
test/validation/api/shmem/shmem.c | 39 ++++++++++++++++++++++++++++++++++--
2 files changed, 45 insertions(+), 3 deletions(-)
hooks/post-receive
--
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, api-next has been updated
via 87d47c93d93ed934af9502937d2aceaec59d229a (commit)
from bcbbe7e92c5a9510735a541d06342cc4923e5bbd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 87d47c93d93ed934af9502937d2aceaec59d229a
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Mon Dec 11 15:21:05 2017 +0200
api: crypto: typo correction
Subtype PACKET_CRYPTO in capital letters.
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index 2109509f..293c15c6 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -830,7 +830,7 @@ odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt);
* Successful crypto operations of all types (SYNC and ASYNC) produce packets
* which contain crypto result metadata. This function copies the operation
* results from an crypto processed packet. Event subtype of this kind of
- * packet is ODP_EVENT_PACKET_crypto. Results are undefined if a non-crypto
+ * packet is ODP_EVENT_PACKET_CRYPTO. Results are undefined if a non-crypto
* processed packet is passed as input.
*
* @param packet An crypto processed packet (ODP_EVENT_PACKET_CRYPTO)
-----------------------------------------------------------------------
Summary of changes:
include/odp/api/spec/crypto.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
hooks/post-receive
--
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, api-next has been updated
via bcbbe7e92c5a9510735a541d06342cc4923e5bbd (commit)
via 99a2871375955861c46a271162e86a4ac13a2d8b (commit)
via fe7221162f62b820b053a8b12fa2b11005769693 (commit)
via 4612aa0de04cea3b7dc1b74678a9b25d2bc832b0 (commit)
via 76997bb4087981751966df0fa1d0897486a3da1d (commit)
from 65d690fbcf03c6a4d5eb3f01bde36807833feaaa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bcbbe7e92c5a9510735a541d06342cc4923e5bbd
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Fri Dec 8 15:21:54 2017 +0200
linux-gen: packet: set next layer offsets allways
Update implementation to follow API change of layer offsets.
Set L3 offset always after successful L2 parse. Set L4 offset
always after successful L3 parse.
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 4e74d269..5b5a9827 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -2198,11 +2198,12 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr,
{
uint8_t ip_proto;
+ prs->l3_offset = offset;
+
if (layer <= ODP_PKTIO_PARSER_LAYER_L2)
return prs->error_flags.all != 0;
- /* Set l3_offset+flag only for known ethtypes */
- prs->l3_offset = offset;
+ /* Set l3 flag only for known ethtypes */
prs->input_flags.l3 = 1;
/* Parse Layer 3 headers */
@@ -2210,12 +2211,14 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr,
case _ODP_ETHTYPE_IPV4:
prs->input_flags.ipv4 = 1;
ip_proto = parse_ipv4(prs, &parseptr, &offset, frame_len);
+ prs->l4_offset = offset;
break;
case _ODP_ETHTYPE_IPV6:
prs->input_flags.ipv6 = 1;
ip_proto = parse_ipv6(prs, &parseptr, &offset, frame_len,
seg_len);
+ prs->l4_offset = offset;
break;
case _ODP_ETHTYPE_ARP:
@@ -2225,15 +2228,13 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr,
default:
prs->input_flags.l3 = 0;
- prs->l3_offset = ODP_PACKET_OFFSET_INVALID;
ip_proto = 255; /* Reserved invalid by IANA */
}
if (layer == ODP_PKTIO_PARSER_LAYER_L3)
return prs->error_flags.all != 0;
- /* Set l4_offset+flag only for known ip_proto */
- prs->l4_offset = offset;
+ /* Set l4 flag only for known ip_proto */
prs->input_flags.l4 = 1;
/* Parse Layer 4 headers */
@@ -2279,7 +2280,6 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr,
default:
prs->input_flags.l4 = 0;
- prs->l4_offset = ODP_PACKET_OFFSET_INVALID;
break;
}
commit 99a2871375955861c46a271162e86a4ac13a2d8b
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Fri Dec 8 14:22:10 2017 +0200
api: parse: set next layer offset
Explicitly require that implementation sets the next layer
offset after user defined last parse layer. Next layer offset
can be set without checking the layer itself. For example:
l4_offset = l3_offset + l3_hdr_len
Also renamed packet_parse_param 'layer' to 'last_layer' since
it's documenting the usage better:
parse.proto = ODP_PROTO_IPV4;
parse.last_layer = ODP_PROTO_LAYER_L4;
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 6f00a2c9..538472a5 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -148,10 +148,15 @@ typedef struct odp_ipsec_inbound_config_t {
/** Parse packet headers after IPSEC transformation
*
* Select header parsing level after inbound processing. Headers of the
- * resulting packet must be parsed (at least) up to this level. Parsing
- * starts from IP (layer 3). Each successfully transformed packet has
- * a valid value for L3 offset regardless of the parse configuration.
- * Default value is ODP_IPSEC_LAYER_NONE.
+ * resulting packet must be checked (at least) up to this level.
+ * Parsing starts from IP (layer 3). Packet metadata from IP to this
+ * layer is set. In addition, offset (and pointer) to the next layer
+ * is set. Other layer/protocol specific metadata have undefined
+ * values.
+ *
+ * Each successfully transformed packet has a valid value for L3 offset
+ * regardless of the parse configuration. Default value is
+ * ODP_IPSEC_LAYER_NONE. ODP_IPSEC_LAYER_L2 is not a valid value.
*/
odp_ipsec_proto_layer_t parse;
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 02333fe1..3655f589 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1246,7 +1246,7 @@ typedef struct odp_packet_parse_param_t {
/** Continue parsing until this layer. Must be the same or higher
* layer than the layer of 'proto'. */
- odp_proto_layer_t layer;
+ odp_proto_layer_t last_layer;
/** Flags to control payload data checksums checks up to the selected
* parse layer. Checksum checking status can be queried for each packet
@@ -1260,19 +1260,21 @@ typedef struct odp_packet_parse_param_t {
/**
* Parse packet
*
- * Parse protocol headers in packet data. Parsing starts at 'offset', which
- * is the first header byte of protocol 'param.proto'. Parameter 'param.layer'
- * defines the last layer application is interested about.
- * Use ODP_PROTO_LAYER_ALL for all layers. A successful operation sets or resets
- * packet metadata for all layers from the layer of 'param.proto' to the
- * application defined last layer. Metadata of other layers have undefined
- * values. When operation fails, metadata of all protocol layers have undefined
- * values.
+ * Parse protocol headers in packet data and update layer/protocol specific
+ * metadata (e.g. offsets, errors, protocols, checksum statuses, etc). Parsing
+ * starts at 'offset', which is the first header byte of protocol 'param.proto'.
+ * Parameter 'param.last_layer' defines the last layer application requests
+ * to check. Use ODP_PROTO_LAYER_ALL for all layers. A successful operation
+ * sets (or resets) packet metadata for all layers from the layer of
+ * 'param.proto' to the application defined last layer. In addition, offset
+ * (and pointer) to the next layer is set. Other layer/protocol specific
+ * metadata have undefined values. When operation fails, all layer/protocol
+ * specific metadata have undefined values.
*
* @param pkt Packet handle
* @param offset Byte offset into the packet
- * @param param Parse parameters. Proto and layer fields must be set. Clear
- * all check bits that are not used.
+ * @param param Parse parameters. Proto and last_layer fields must be set.
+ * Clear all check bits that are not used.
*
* @retval 0 on success
* @retval <0 on failure
@@ -1284,14 +1286,14 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset,
* Parse multiple packets
*
* Otherwise like odp_packet_parse(), but parses multiple packets. Packets may
- * have unique offsets, but must start with the same protocol. Also, packets are
- * parsed up to the same protocol layer.
+ * have unique offsets, but must start with the same protocol. The same
+ * parse parameters are applied to all packets.
*
* @param pkt Packet handle array
* @param offset Byte offsets into the packets
* @param num Number of packets and offsets
- * @param param Parse parameters. Proto and layer fields must be set. Clear
- * all check bits that are not used.
+ * @param param Parse parameters. Proto and last_layer fields must be set.
+ * Clear all check bits that are not used.
*
* @return Number of packets parsed successfully (0 ... num)
* @retval <0 on failure
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index d25afa3e..a3312d28 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -430,8 +430,13 @@ typedef enum odp_pktio_parser_layer_t {
typedef struct odp_pktio_parser_config_t {
/** Protocol parsing level in packet input
*
- * Parse protocol layers in minimum up to this level during packet
- * input. The default value is ODP_PKTIO_PARSER_LAYER_ALL. */
+ * Application requires that protocol headers in a packet are checked
+ * up to this layer during packet input. Use ODP_PROTO_LAYER_ALL for
+ * all layers. Packet metadata for this and all preceding layers are
+ * set. In addition, offset (and pointer) to the next layer is set.
+ * Other layer/protocol specific metadata have undefined values.
+ *
+ * The default value is ODP_PKTIO_PARSER_LAYER_ALL. */
odp_pktio_parser_layer_t layer;
} odp_pktio_parser_config_t;
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 222fa8c8..4e74d269 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -2355,7 +2355,7 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset,
uint32_t seg_len;
uint32_t packet_len = pkt_hdr->frame_len;
odp_proto_t proto = param->proto;
- odp_proto_layer_t layer = param->layer;
+ odp_proto_layer_t layer = param->last_layer;
int ret;
uint16_t ethtype;
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c
index b3ef6980..1dbacb1f 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -2512,7 +2512,7 @@ void packet_test_parse(void)
}
parse.proto = ODP_PROTO_ETH;
- parse.layer = ODP_PROTO_LAYER_ALL;
+ parse.last_layer = ODP_PROTO_LAYER_ALL;
parse.chksums.all_chksum = 0;
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
@@ -2543,7 +2543,7 @@ void packet_test_parse(void)
}
parse.proto = ODP_PROTO_IPV4;
- parse.layer = ODP_PROTO_LAYER_L4;
+ parse.last_layer = ODP_PROTO_LAYER_L4;
parse.chksums.all_chksum = 0;
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
@@ -2573,7 +2573,7 @@ void packet_test_parse(void)
}
parse.proto = ODP_PROTO_ETH;
- parse.layer = ODP_PROTO_LAYER_L4;
+ parse.last_layer = ODP_PROTO_LAYER_L4;
parse.chksums.all_chksum = 0;
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
@@ -2603,7 +2603,7 @@ void packet_test_parse(void)
}
parse.proto = ODP_PROTO_ETH;
- parse.layer = ODP_PROTO_LAYER_L4;
+ parse.last_layer = ODP_PROTO_LAYER_L4;
parse.chksums.all_chksum = 0;
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
@@ -2634,7 +2634,7 @@ void packet_test_parse(void)
}
parse.proto = ODP_PROTO_ETH;
- parse.layer = ODP_PROTO_LAYER_ALL;
+ parse.last_layer = ODP_PROTO_LAYER_ALL;
parse.chksums.all_chksum = 0;
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0);
commit fe7221162f62b820b053a8b12fa2b11005769693
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Thu Dec 7 17:08:03 2017 +0200
api: packet_flags: adjust white spaces
Improve header file readability by aligning param and
retval documentation with spaces.
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h
index e940f00f..dfbed4bb 100644
--- a/include/odp/api/spec/packet_flags.h
+++ b/include/odp/api/spec/packet_flags.h
@@ -137,9 +137,10 @@ int odp_packet_has_eth(odp_packet_t pkt);
* ODP recognizes the destination MAC address FF:FF:FF:FF:FF:FF as
* a broadcast address. All others are considered non-broadcast.
*
- * @param pkt Packet handle
- * @retval non-zero if Ethernet destination address is the broadcast address
- * @retval 0 if Ethernet destination address is not the broadcast address
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Ethernet destination address is the broadcast address
+ * @retval 0 Ethernet destination address is not the broadcast address
*/
int odp_packet_has_eth_bcast(odp_packet_t pkt);
@@ -148,63 +149,70 @@ int odp_packet_has_eth_bcast(odp_packet_t pkt);
*
* ODP recognizes the destination MAC address as multicast if bit 7 is 1.
*
- * @param pkt Packet handle
- * @retval non-zero if Ethernet destination address is a multicast address
- * @retval 0 if Ethernet destination address is not a multicast address
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Ethernet destination address is a multicast address
+ * @retval 0 Ethernet destination address is not a multicast address
*/
int odp_packet_has_eth_mcast(odp_packet_t pkt);
/**
* Check for jumbo frame
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a jumbo frame
- * @retval 0 if packet does not contain a jumbo frame
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet is a jumbo frame
+ * @retval 0 Packet is not a jumbo frame
*/
int odp_packet_has_jumbo(odp_packet_t pkt);
/**
* Check for VLAN
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a VLAN header
- * @retval 0 if packet does not contain a VLAN header
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains a VLAN header
+ * @retval 0 Packet does not contain a VLAN header
*/
int odp_packet_has_vlan(odp_packet_t pkt);
/**
* Check for VLAN QinQ (stacked VLAN)
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a VLAN QinQ header
- * @retval 0 if packet does not contain a VLAN QinQ header
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains a VLAN QinQ header
+ * @retval 0 Packet does not contain a VLAN QinQ header
*/
int odp_packet_has_vlan_qinq(odp_packet_t pkt);
/**
* Check for ARP
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains an ARP message
- * @retval 0 if packet does not contain an ARP message
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains an ARP message
+ * @retval 0 Packet does not contain an ARP message
*/
int odp_packet_has_arp(odp_packet_t pkt);
/**
* Check for IPv4
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains an IPv4 header
- * @retval 0 if packet does not contain an IPv4 header
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains an IPv4 header
+ * @retval 0 Packet does not contain an IPv4 header
*/
int odp_packet_has_ipv4(odp_packet_t pkt);
/**
* Check for IPv6
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains an IPv6 header
- * @retval 0 if packet does not contain an IPv6 header
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains an IPv6 header
+ * @retval 0 Packet does not contain an IPv6 header
*/
int odp_packet_has_ipv6(odp_packet_t pkt);
@@ -216,9 +224,10 @@ int odp_packet_has_ipv6(odp_packet_t pkt);
*
* For IPv6, no destination addresses are recognized as broadcast addresses.
*
- * @param pkt Packet handle
- * @retval non-zero if IP destination address is a broadcast address
- * @retval 0 if IP destination address is not a broadcast address
+ * @param pkt Packet handle
+ *
+ * @retval non-zero IP destination address is a broadcast address
+ * @retval 0 IP destination address is not a broadcast address
*/
int odp_packet_has_ip_bcast(odp_packet_t pkt);
@@ -231,91 +240,100 @@ int odp_packet_has_ip_bcast(odp_packet_t pkt);
* For IPv6 ODP recognizes destination IP addresses with prefixes FF00::
* through FFFF:: as multicast addresses.
*
- * @param pkt Packet handle
- * @retval non-zero if IP destination address is a multicast address
- * @retval 0 if IP destination address is not a multicast address
+ * @param pkt Packet handle
+ *
+ * @retval non-zero IP destination address is a multicast address
+ * @retval 0 IP destination address is not a multicast address
*/
int odp_packet_has_ip_mcast(odp_packet_t pkt);
/**
* Check for IP fragment
*
- * @param pkt Packet handle
- * @retval non-zero if packet is an IP fragment
- * @retval 0 if packet is not an IP fragment
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet is an IP fragment
+ * @retval 0 Packet is not an IP fragment
*/
int odp_packet_has_ipfrag(odp_packet_t pkt);
/**
* Check for IP options
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains IP options
- * @retval 0 if packet does not contain IP options
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains IP options
+ * @retval 0 Packet does not contain IP options
*/
int odp_packet_has_ipopt(odp_packet_t pkt);
/**
* Check for IPSec
*
- * @param pkt Packet handle
- * @retval non-zero if packet requires IPSec processing
- * @retval 0 if packet does not require IPSec processing
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet requires IPSec processing
+ * @retval 0 Packet does not require IPSec processing
*/
int odp_packet_has_ipsec(odp_packet_t pkt);
/**
* Check for UDP
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a UDP header
- * @retval 0 if packet does not contain a UDP header
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains a UDP header
+ * @retval 0 Packet does not contain a UDP header
*/
int odp_packet_has_udp(odp_packet_t pkt);
/**
* Check for TCP
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a TCP header
- * @retval 0 if packet does not contain a TCP header
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains a TCP header
+ * @retval 0 Packet does not contain a TCP header
*/
int odp_packet_has_tcp(odp_packet_t pkt);
/**
* Check for SCTP
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a SCTP header
- * @retval 0 if packet does not contain a SCTP header
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains a SCTP header
+ * @retval 0 Packet does not contain a SCTP header
*/
int odp_packet_has_sctp(odp_packet_t pkt);
/**
* Check for ICMP
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains an ICMP header
- * @retval 0 if packet does not contain an ICMP header
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains an ICMP header
+ * @retval 0 Packet does not contain an ICMP header
*/
int odp_packet_has_icmp(odp_packet_t pkt);
/**
* Check for packet flow hash
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a hash value
- * @retval 0 if packet does not contain a hash value
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains a hash value
+ * @retval 0 Packet does not contain a hash value
*/
int odp_packet_has_flow_hash(odp_packet_t pkt);
/**
* Check for packet timestamp
*
- * @param pkt Packet handle
+ * @param pkt Packet handle
*
- * @retval non-zero if packet contains a timestamp value
- * @retval 0 if packet does not contain a timestamp value
+ * @retval non-zero Packet contains a timestamp value
+ * @retval 0 Packet does not contain a timestamp value
*
* @see odp_packet_has_ts_clr()
*/
commit 4612aa0de04cea3b7dc1b74678a9b25d2bc832b0
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Thu Dec 7 16:40:30 2017 +0200
api: packet_flags: refine error and layer flags
Error flag functions (packet_has_error, packet_has_l4_error)
indicate if an error was found. Layer flag functions
(packet_has_l4) tell if parser did found and checked a protocol
(header) of a layer. Both are controlled by parser configuration.
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h
index 377b75ba..e940f00f 100644
--- a/include/odp/api/spec/packet_flags.h
+++ b/include/odp/api/spec/packet_flags.h
@@ -23,87 +23,111 @@ extern "C" {
#include <odp/api/packet.h>
/** @addtogroup odp_packet
- * Boolean operations on a packet.
+ * Operations on packet metadata flags.
* @{
*/
/**
- * Check for packet errors
+ * Check for all errors in packet
*
- * Checks all error flags at once.
+ * Check if packet parsing has found any errors in the packet. The level of
+ * error checking depends on the parse configuration (e.g. included layers and
+ * checksums). Protocol layer functions (e.g. odp_packet_has_l3()) indicate
+ * which layers have been checked, and layer error functions
+ * (e.g. odp_packet_has_l3_error()) which layers have errors.
*
- * @param pkt Packet handle
- * @retval non-zero packet has errors
- * @retval 0 packet has no errors
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet has errors
+ * @retval 0 No errors were found
*/
int odp_packet_has_error(odp_packet_t pkt);
/**
- * Check for packet L2 errors
+ * Check for errors in layer 2
*
- * check for all L2 errors
+ * When layer 2 is included in the parse configuration, check if any errors were
+ * found in layer 2 of the packet.
*
- * @param pkt Packet handle
- * @retval non-zero packet has L2 errors
- * @retval 0 packet has no L2 error
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet has errors in layer 2
+ * @retval 0 No errors were found in layer 2
*/
int odp_packet_has_l2_error(odp_packet_t pkt);
/**
- * Check for L2 header, e.g. ethernet
+ * Check for errors in layer 3
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a valid & known L2 header
- * @retval 0 if packet does not contain a valid & known L2 header
+ * When layer 3 is included in the parse configuration, check if any errors were
+ * found in layer 3 of the packet.
+ *
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet has errors in layer 3
+ * @retval 0 No errors found in layer 3
*/
-int odp_packet_has_l2(odp_packet_t pkt);
+int odp_packet_has_l3_error(odp_packet_t pkt);
/**
- * Check for packet L3 errors
+ * Check for errors in layer 4
*
- * check for all L3 errors
+ * When layer 4 is included in the parse configuration, check if any errors were
+ * found in layer 4 of the packet.
*
- * @param pkt Packet handle
- * @retval non-zero packet has L3 errors
- * @retval 0 packet has no L3 error
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet has errors in layer 4
+ * @retval 0 No errors were found in layer 4
*/
-int odp_packet_has_l3_error(odp_packet_t pkt);
+int odp_packet_has_l4_error(odp_packet_t pkt);
/**
- * Check for L3 header, e.g. IPv4, IPv6
+ * Check for layer 2 protocols
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a valid & known L3 header
- * @retval 0 if packet does not contain a valid & known L3 header
+ * When layer 2 is included in the parse configuration, check if packet parsing
+ * has found and checked a layer 2 protocol (e.g. Ethernet) in the packet.
+ *
+ * @param pkt Packet handle
+ *
+ * @retval non-zero A layer 2 protocol header was found and checked
+ * @retval 0 No layer 2 protocol was found
*/
-int odp_packet_has_l3(odp_packet_t pkt);
+int odp_packet_has_l2(odp_packet_t pkt);
/**
- * Check for packet L4 errors
+ * Check for layer 3 protocols
*
- * check for all L4 errors
+ * When layer 3 is included in the parse configuration, check if packet parsing
+ * has found and checked a layer 3 protocol (e.g. IPv4, IPv6) in the packet.
*
- * @param pkt Packet handle
- * @retval non-zero packet has L4 errors
- * @retval 0 packet has no L4 error
+ * @param pkt Packet handle
+ *
+ * @retval non-zero A layer 3 protocol header was found and checked
+ * @retval 0 No layer 3 protocol was found
*/
-int odp_packet_has_l4_error(odp_packet_t pkt);
+int odp_packet_has_l3(odp_packet_t pkt);
/**
- * Check for L4 header, e.g. UDP, TCP, SCTP (also ICMP)
+ * Check for layer 4 protocols
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a valid & known L4 header
- * @retval 0 if packet does not contain a valid & known L4 header
+ * When layer 4 is included in the parse configuration, check if packet parsing
+ * has found and checked a layer 4 protocol (e.g. UDP, TCP, SCTP) in the packet.
+ *
+ * @param pkt Packet handle
+ *
+ * @retval non-zero A layer 4 protocol header was found and checked
+ * @retval 0 No layer 4 protocol was found
*/
int odp_packet_has_l4(odp_packet_t pkt);
/**
* Check for Ethernet header
*
- * @param pkt Packet handle
- * @retval non-zero if packet contains a valid eth header
- * @retval 0 if packet does not contain a valid eth header
+ * @param pkt Packet handle
+ *
+ * @retval non-zero Packet contains an Ethernet header
+ * @retval 0 Packet does not contain an Ethernet header
*/
int odp_packet_has_eth(odp_packet_t pkt);
commit 76997bb4087981751966df0fa1d0897486a3da1d
Author: Petri Savolainen <petri.savolainen(a)linaro.org>
Date: Thu Dec 7 15:29:04 2017 +0200
api: packet: refine layer offset specification
Offset functions just point to the start of an layer. Offsets
may be set also when a layer does not have a known header or
a known header has an error. For example, L4 offset may be
set always after a successful parse of L3 (IP) layer. There
are other API calls to check if L4 is a known protocol
(e.g. packet_has_l4, packet_has_udp), or if it contain errors
(e.g. packet_has_l4_error).
Signed-off-by: Petri Savolainen <petri.savolainen(a)linaro.org>
Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index bb62ef87..02333fe1 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1387,15 +1387,16 @@ uint32_t odp_packet_user_area_size(odp_packet_t pkt);
/**
* Layer 2 start pointer
*
- * Returns pointer to the start of the layer 2 header. Optionally, outputs
- * number of data bytes in the segment following the pointer.
+ * Returns pointer to the start of layer 2. Optionally, outputs number of data
+ * bytes in the segment following the pointer. The pointer value is generated
+ * from the current layer 2 offset.
*
* @param pkt Packet handle
* @param[out] len Number of data bytes remaining in the segment (output).
* Ignored when NULL.
*
- * @return Layer 2 start pointer
- * @retval NULL packet does not contain a valid L2 header
+ * @return Layer 2 start pointer
+ * @retval NULL Layer 2 offset has not been set
*
* @see odp_packet_l2_offset(), odp_packet_l2_offset_set(), odp_packet_has_l2()
*/
@@ -1404,16 +1405,16 @@ void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len);
/**
* Layer 2 start offset
*
- * Returns offset to the start of the layer 2 header. The offset is calculated
- * from the current odp_packet_data() position in bytes.
- *
- * User is responsible to update the offset when modifying the packet data
- * pointer position.
+ * Returns offset to the start of layer 2. The offset is calculated from the
+ * current odp_packet_data() position in bytes. Packet parsing sets the offset
+ * according to parse configuration and layers recognized in the packet. Data
+ * start position updating functions (e.g. odp_packet_push_head()) do not modify
+ * the offset, but user sets a new value when needed.
*
* @param pkt Packet handle
*
- * @return Layer 2 start offset
- * @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L2 header
+ * @return Layer 2 start offset
+ * @retval ODP_PACKET_OFFSET_INVALID Layer 2 offset has not been set
*
* @see odp_packet_l2_offset_set(), odp_packet_has_l2()
*/
@@ -1422,9 +1423,9 @@ uint32_t odp_packet_l2_offset(odp_packet_t pkt);
/**
* Set layer 2 start offset
*
- * Set offset to the start of the layer 2 header. The offset is calculated from
- * the current odp_packet_data() position in bytes. Offset must not exceed
- * packet data length. Packet is not modified on an error.
+ * Set offset to the start of layer 2. The offset is calculated from the current
+ * odp_packet_data() position in bytes. Offset must not exceed packet data
+ * length. Offset is not modified on an error.
*
* @param pkt Packet handle
* @param offset Layer 2 start offset (0 ... odp_packet_len()-1)
@@ -1437,15 +1438,16 @@ int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset);
/**
* Layer 3 start pointer
*
- * Returns pointer to the start of the layer 3 header. Optionally, outputs
- * number of data bytes in the segment following the pointer.
+ * Returns pointer to the start of layer 3. Optionally, outputs number of data
+ * bytes in the segment following the pointer. The pointer value is generated
+ * from the current layer 3 offset.
*
* @param pkt Packet handle
* @param[out] len Number of data bytes remaining in the segment (output).
* Ignored when NULL.
*
- * @return Layer 3 start pointer
- * @retval NULL packet does not contain a valid L3 header
+ * @return Layer 3 start pointer
+ * @retval NULL Layer 3 offset has not been set
*
* @see odp_packet_l3_offset(), odp_packet_l3_offset_set(), odp_packet_has_l3()
*/
@@ -1454,16 +1456,16 @@ void *odp_packet_l3_ptr(odp_packet_t pkt, uint32_t *len);
/**
* Layer 3 start offset
*
- * Returns offset to the start of the layer 3 header. The offset is calculated
- * from the current odp_packet_data() position in bytes.
- *
- * User is responsible to update the offset when modifying the packet data
- * pointer position.
+ * Returns offset to the start of layer 3. The offset is calculated from the
+ * current odp_packet_data() position in bytes. Packet parsing sets the offset
+ * according to parse configuration and layers recognized in the packet. Data
+ * start position updating functions (e.g. odp_packet_push_head()) do not modify
+ * the offset, but user sets a new value when needed.
*
* @param pkt Packet handle
*
- * @return Layer 3 start offset, or ODP_PACKET_OFFSET_INVALID when packet does
- * not contain a valid L3 header.
+ * @return Layer 3 start offset
+ * @retval ODP_PACKET_OFFSET_INVALID Layer 3 offset has not been set
*
* @see odp_packet_l3_offset_set(), odp_packet_has_l3()
*/
@@ -1472,9 +1474,9 @@ uint32_t odp_packet_l3_offset(odp_packet_t pkt);
/**
* Set layer 3 start offset
*
- * Set offset to the start of the layer 3 header. The offset is calculated from
- * the current odp_packet_data() position in bytes. Offset must not exceed
- * packet data length. Packet is not modified on an error.
+ * Set offset to the start of layer 3. The offset is calculated from the current
+ * odp_packet_data() position in bytes. Offset must not exceed packet data
+ * length. Offset is not modified on an error.
*
* @param pkt Packet handle
* @param offset Layer 3 start offset (0 ... odp_packet_len()-1)
@@ -1487,15 +1489,16 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset);
/**
* Layer 4 start pointer
*
- * Returns pointer to the start of the layer 4 header. Optionally, outputs
- * number of data bytes in the segment following the pointer.
+ * Returns pointer to the start of layer 4. Optionally, outputs number of data
+ * bytes in the segment following the pointer. The pointer value is generated
+ * from the current layer 4 offset.
*
* @param pkt Packet handle
* @param[out] len Number of data bytes remaining in the segment (output).
* Ignored when NULL.
*
- * @return Layer 4 start pointer
- * @retval NULL packet does not contain a valid L4 header
+ * @return Layer 4 start pointer
+ * @retval NULL Layer 4 offset has not been set
*
* @see odp_packet_l4_offset(), odp_packet_l4_offset_set(), odp_packet_has_l4()
*/
@@ -1504,16 +1507,16 @@ void *odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len);
/**
* Layer 4 start offset
*
- * Returns offset to the start of the layer 4 header. The offset is calculated
- * from the current odp_packet_data() position in bytes.
- *
- * User is responsible to update the offset when modifying the packet data
- * pointer position.
+ * Returns offset to the start of layer 4. The offset is calculated from the
+ * current odp_packet_data() position in bytes. Packet parsing sets the offset
+ * according to parse configuration and layers recognized in the packet. Data
+ * start position updating functions (e.g. odp_packet_push_head()) do not modify
+ * the offset, but user sets a new value when needed.
*
* @param pkt Packet handle
*
- * @return Layer 4 start offset
- * @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L4 header
+ * @return Layer 4 start offset
+ * @retval ODP_PACKET_OFFSET_INVALID Layer 4 offset has not been set
*
* @see odp_packet_l4_offset_set(), odp_packet_has_l4()
*/
@@ -1522,9 +1525,9 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
/**
* Set layer 4 start offset
*
- * Set offset to the start of the layer 4 header. The offset is calculated from
- * the current odp_packet_data() position in bytes. Offset must not exceed
- * packet data length. Packet is not modified on an error.
+ * Set offset to the start of layer 4. The offset is calculated from the current
+ * odp_packet_data() position in bytes. Offset must not exceed packet data
+ * length. Offset is not modified on an error.
*
* @param pkt Packet handle
* @param offset Layer 4 start offset (0 ... odp_packet_len()-1)
-----------------------------------------------------------------------
Summary of changes:
include/odp/api/spec/ipsec.h | 13 +-
include/odp/api/spec/packet.h | 119 +++++++++---------
include/odp/api/spec/packet_flags.h | 236 +++++++++++++++++++++---------------
include/odp/api/spec/packet_io.h | 9 +-
platform/linux-generic/odp_packet.c | 14 +--
test/validation/api/packet/packet.c | 10 +-
6 files changed, 229 insertions(+), 172 deletions(-)
hooks/post-receive
--