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 144a2cd89865b5565a6064c3b1db4987bd1b4e58 (commit) via e554ba1a30e0bd7f6fe0c3ccd8c8846ef41ae9e4 (commit) via 06eed47498a6697365cb3498975caf90a581179a (commit) via effdb6228cd9c56a0f3af7f1ef3277cbf1971c23 (commit) from 2e2d96234dd05c5a4dac03c31d1634bc9008da0a (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 144a2cd89865b5565a6064c3b1db4987bd1b4e58 Author: Petri Savolainen petri.savolainen@linaro.org Date: Wed Feb 15 14:29:32 2017 +0200
linux-gen: packet: implement references as copy
Implement packet references API as packet copy. This is the simplest way to support the API, as other packet functions are not affected at all.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 024f694..9eccb57 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2221,3 +2221,77 @@ uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl) { return _odp_pri(hdl); } + +odp_packet_t odp_packet_ref_static(odp_packet_t pkt) +{ + return odp_packet_copy(pkt, odp_packet_pool(pkt)); +} + +odp_packet_t odp_packet_ref(odp_packet_t pkt, uint32_t offset) +{ + odp_packet_t new; + int ret; + + new = odp_packet_copy(pkt, odp_packet_pool(pkt)); + + if (new == ODP_PACKET_INVALID) { + ODP_ERR("copy failed\n"); + return ODP_PACKET_INVALID; + } + + ret = odp_packet_trunc_head(&new, offset, NULL, NULL); + + if (ret < 0) { + ODP_ERR("trunk_head failed\n"); + odp_packet_free(new); + return ODP_PACKET_INVALID; + } + + return new; +} + +odp_packet_t odp_packet_ref_pkt(odp_packet_t pkt, uint32_t offset, + odp_packet_t hdr) +{ + odp_packet_t new; + int ret; + + new = odp_packet_copy(pkt, odp_packet_pool(pkt)); + + if (new == ODP_PACKET_INVALID) { + ODP_ERR("copy failed\n"); + return ODP_PACKET_INVALID; + } + + if (offset) { + ret = odp_packet_trunc_head(&new, offset, NULL, NULL); + + if (ret < 0) { + ODP_ERR("trunk_head failed\n"); + odp_packet_free(new); + return ODP_PACKET_INVALID; + } + } + + ret = odp_packet_concat(&hdr, new); + + if (ret < 0) { + ODP_ERR("concat failed\n"); + odp_packet_free(new); + return ODP_PACKET_INVALID; + } + + return hdr; +} + +int odp_packet_has_ref(odp_packet_t pkt) +{ + (void)pkt; + + return 0; +} + +uint32_t odp_packet_unshared_len(odp_packet_t pkt) +{ + return odp_packet_len(pkt); +}
commit e554ba1a30e0bd7f6fe0c3ccd8c8846ef41ae9e4 Author: Petri Savolainen petri.savolainen@linaro.org Date: Wed Feb 15 14:29:29 2017 +0200
api: packet: references may be implemented as copy
Some implementations may implement new references as packet copy. odp_packet_has_ref() will return 0 for copies, since those are unique packets.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b6450c1..92c35ae 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -892,9 +892,6 @@ odp_packet_t odp_packet_ref_static(odp_packet_t pkt); * dynamic references must not be mixed. Results are undefined if these * restrictions are not observed. * - * odp_packet_unshared_len() may be used to determine the number of bytes - * starting at offset zero that are unique to a packet handle. - * * The packet handle 'pkt' may itself by a (dynamic) reference to a packet. * * If the caller does not intend to modify either the packet or the new @@ -952,8 +949,9 @@ odp_packet_t odp_packet_ref_pkt(odp_packet_t pkt, uint32_t offset, * When a packet has multiple references, packet data is divided into two * parts: unshared and shared. The unshared part always precedes the shared * part. This call returns number of bytes in the unshared part. When a - * packet has only a single reference, all packet data is unshared and - * unshared length equals the packet length (odp_packet_len()). + * packet has only a single reference (see odp_packet_has_ref()), all packet + * data is unshared and unshared length equals the packet length + * (odp_packet_len()). * * Application may modify only the unshared part, the rest of the packet data * must be treated as read only. @@ -967,8 +965,17 @@ uint32_t odp_packet_unshared_len(odp_packet_t pkt); /** * Test if packet has multiple references * - * A packet that has multiple references shares data and possibly metadata - * with other packets. Shared part must be treated as read only. + * A packet that has multiple references share data with other packets. In case + * of a static reference it also shares metadata. Shared parts must be treated + * as read only. + * + * New references are created with odp_packet_ref_static(), odp_packet_ref() and + * odp_packet_ref_pkt() calls. The intent of multiple references is to avoid + * packet copies, however some implementations may do a packet copy for some of + * the calls. If a copy is done, the new reference is actually a new, unique + * packet and this function returns '0' for it. When a real reference is + * created (instead of a copy), this function returns '1' for both packets + * (the original packet and the new reference). * * @param pkt Packet handle *
commit 06eed47498a6697365cb3498975caf90a581179a Author: Maxim Uvarov maxim.uvarov@linaro.org Date: Sat Feb 25 11:08:46 2017 +0300
Revert "linux-gen: packet: implement references as copy"
This reverts commit 44ae9773bc94f8cd349034901f08a2eed46dc822. Version 1 instead of 2 was applied. Revert it with following applying v2. Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 1d2b506..024f694 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2221,81 +2221,3 @@ uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl) { return _odp_pri(hdl); } - -odp_packet_t odp_packet_ref_static(odp_packet_t pkt) -{ - odp_packet_t new; - - new = odp_packet_copy(pkt, odp_packet_pool(pkt)); - - return new; -} - -odp_packet_t odp_packet_ref(odp_packet_t pkt, uint32_t offset) -{ - odp_packet_t new; - int ret; - - new = odp_packet_copy(pkt, odp_packet_pool(pkt)); - - if (new == ODP_PACKET_INVALID) { - ODP_ERR("copy failed\n"); - return ODP_PACKET_INVALID; - } - - ret = odp_packet_trunc_head(&new, offset, NULL, NULL); - - if (ret < 0) { - ODP_ERR("trunk_head failed\n"); - odp_packet_free(new); - return ODP_PACKET_INVALID; - } - - return new; -} - -odp_packet_t odp_packet_ref_pkt(odp_packet_t pkt, uint32_t offset, - odp_packet_t hdr) -{ - odp_packet_t new; - int ret; - - new = odp_packet_copy(pkt, odp_packet_pool(pkt)); - - if (new == ODP_PACKET_INVALID) { - ODP_ERR("copy failed\n"); - return ODP_PACKET_INVALID; - } - - if (offset) { - ret = odp_packet_trunc_head(&new, offset, NULL, NULL); - - if (ret < 0) { - ODP_ERR("trunk_head failed\n"); - odp_packet_free(new); - return ODP_PACKET_INVALID; - } - } - - ret = odp_packet_concat(&hdr, new); - - if (ret < 0) { - ODP_ERR("concat failed\n"); - odp_packet_free(new); - return ODP_PACKET_INVALID; - } - - return hdr; -} - -int odp_packet_has_ref(odp_packet_t pkt) -{ - (void)pkt; - - return 0; -} - -uint32_t odp_packet_unshared_len(odp_packet_t pkt) -{ - return odp_packet_len(pkt); -}
commit effdb6228cd9c56a0f3af7f1ef3277cbf1971c23 Author: Maxim Uvarov maxim.uvarov@linaro.org Date: Sat Feb 25 11:07:22 2017 +0300
Revert "api: packet: references may be implemented as copy"
This reverts commit f72f999552de02c602864baa82bb374322415b24. Version 1 instead of 2 was applied. Revert it with following applying v2. Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 05ffd68..b6450c1 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -892,6 +892,9 @@ odp_packet_t odp_packet_ref_static(odp_packet_t pkt); * dynamic references must not be mixed. Results are undefined if these * restrictions are not observed. * + * odp_packet_unshared_len() may be used to determine the number of bytes + * starting at offset zero that are unique to a packet handle. + * * The packet handle 'pkt' may itself by a (dynamic) reference to a packet. * * If the caller does not intend to modify either the packet or the new @@ -949,9 +952,8 @@ odp_packet_t odp_packet_ref_pkt(odp_packet_t pkt, uint32_t offset, * When a packet has multiple references, packet data is divided into two * parts: unshared and shared. The unshared part always precedes the shared * part. This call returns number of bytes in the unshared part. When a - * packet has only a single reference (see odp_packet_has_ref()), all packet - * data is unshared and unshared length equals the packet length - * (odp_packet_len()). + * packet has only a single reference, all packet data is unshared and + * unshared length equals the packet length (odp_packet_len()). * * Application may modify only the unshared part, the rest of the packet data * must be treated as read only. @@ -965,16 +967,8 @@ uint32_t odp_packet_unshared_len(odp_packet_t pkt); /** * Test if packet has multiple references * - * A packet that has multiple references share data with other packets. In case - * of a static reference it also shares metadata. Shared parts must be treated - * as read only. - * - * New references are created with odp_packet_ref_static(), odp_packet_ref() and - * odp_packet_ref_pkt() calls. However, some of those calls may implement the - * new reference as a packet copy. If a copy is done, the new reference is - * actually a new, unique packet and this function returns '0' for it. - * When a real reference is created (instead of a copy), this function - * returns '1' for both packets (the original packet and the new reference). + * A packet that has multiple references shares data and possibly metadata + * with other packets. Shared part must be treated as read only. * * @param pkt Packet handle *
-----------------------------------------------------------------------
Summary of changes: include/odp/api/spec/packet.h | 11 ++++++----- platform/linux-generic/odp_packet.c | 6 +----- 2 files changed, 7 insertions(+), 10 deletions(-)
hooks/post-receive