aboutsummaryrefslogtreecommitdiff
path: root/include/odp/api/packet_io.h
diff options
context:
space:
mode:
authorOla Liljedahl <ola.liljedahl@linaro.org>2015-02-04 22:07:24 +0100
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-02-05 16:19:56 +0300
commit12254559d83df65d713e78faa2325474ec4764e5 (patch)
tree51c8cb46982ec01af876f748f575b82be3686c50 /include/odp/api/packet_io.h
parent9208c4039548cf38c3b204094c1781b7e71f9ce3 (diff)
api: odp_pktio.h: odp_pktio_mac_addr() return chars written or error
Added define ODP_PKTIO_MACADDR_MAXSIZE which specifies the recommended output buffer size for odp_pktio_mac_addr(). odp_pktio_mac_addr() takes output buffer size as input and returns number of chars written (on success), <0 on failure. Updated the implementation. Updated all usages in example and test programs. Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'include/odp/api/packet_io.h')
-rw-r--r--include/odp/api/packet_io.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 3e4bac467..9d18489f9 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -18,6 +18,7 @@
extern "C" {
#endif
+#include <sys/types.h>
/** @defgroup odp_packet_io ODP PACKET IO
* Operations on a packet.
@@ -39,6 +40,12 @@ extern "C" {
* odp_pktio_t value to indicate any port
*/
+/*
+ * @def ODP_PKTIO_MACADDR_MAXSIZE
+ * Minimum size of output buffer for odp_pktio_mac_addr()
+ * Actual MAC address sizes may be different.
+ */
+
/**
* Open an ODP packet IO instance
*
@@ -169,14 +176,14 @@ int odp_pktio_promisc_mode(odp_pktio_t id);
/**
* Get the default MAC address of a packet IO interface.
*
- * @param id ODP packet IO handle.
- * @param[out] mac_addr Storage for MAC address of the packet IO interface.
- * @param addr_size Storage size for the address
+ * @param id ODP packet IO handle
+ * @param[out] mac_addr Output buffer (use ODP_PKTIO_MACADDR_MAXSIZE)
+ * @param size Size of output buffer
*
- * @retval Number of bytes written on success, 0 on failure.
+ * @return Number of bytes written (actual size of MAC address)
+ * @retval <0 on failure
*/
-size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr,
- size_t addr_size);
+ssize_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr, ssize_t size);
/**
* Setup per-port default class-of-service.