diff options
author | Stuart Haslam <stuart.haslam@arm.com> | 2015-01-09 11:38:49 +0000 |
---|---|---|
committer | Mike Holmes <mike.holmes@linaro.org> | 2015-01-09 14:13:10 -0500 |
commit | 77048fe2e1b61dd499861d680d54b6e64039333f (patch) | |
tree | bed90725497ae765a185608181857cbebaadf280 /platform/linux-generic/include/api | |
parent | d92f80f068dce1e95dc19ed77bb4d4457a4eccf7 (diff) |
api: odp_packet_io.h: make pktio handles single instance per device
This patch changes odp_pktio_open() to ensure a one-to-one relationship
between a pktio device an a pktio handle. Attempts to open a device
which is already open will fail, setting errno to -EEXIST to indicate
the reason for the failure. A new API odp_pktio_lookup() is added which
can be used to obtain a handle to an already open device.
Signed-off-by: Stuart Haslam <stuart.haslam@arm.com>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
Diffstat (limited to 'platform/linux-generic/include/api')
-rw-r--r-- | platform/linux-generic/include/api/odp_packet_io.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h index e4577c378..0c34f2957 100644 --- a/platform/linux-generic/include/api/odp_packet_io.h +++ b/platform/linux-generic/include/api/odp_packet_io.h @@ -32,8 +32,13 @@ extern "C" { /** * Open an ODP packet IO instance * - * @param dev Packet IO device - * @param pool Pool to use for packet IO + * Packet IO handles are single instance per device, attempts to open an already + * open device will fail, returning ODP_PKTIO_INVALID with errno set to -EEXIST. + * odp_pktio_lookup() may be used to obtain a handle to an already open device. + * + * @param dev Packet IO device name + * @param pool Pool from which to allocate buffers for storing packets + * received over this packet IO * * @return ODP packet IO handle or ODP_PKTIO_INVALID on error * @@ -53,6 +58,15 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool); int odp_pktio_close(odp_pktio_t id); /** + * Return a packet IO handle for an already open device + * + * @param dev Packet IO device name + * + * @return ODP packet IO handle or ODP_PKTIO_INVALID + */ +odp_pktio_t odp_pktio_lookup(const char *dev); + +/** * Receive packets * * @param id ODP packet IO handle |