diff mbox

[DO,NOT,REVIEW,4/7] packet_io: add API definitions - Workers

Message ID 1412863729-28176-5-git-send-email-anders.roxell@linaro.org
State New
Headers show

Commit Message

Anders Roxell Oct. 9, 2014, 2:08 p.m. UTC
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 packet_io.dox | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
diff mbox

Patch

diff --git a/packet_io.dox b/packet_io.dox
index 2a90c98..6204159 100644
--- a/packet_io.dox
+++ b/packet_io.dox
@@ -375,4 +375,104 @@  int odp_pktio_promisc_disable(odp_pktio_t id);
 int odp_pktio_promisc(odp_pktio_t id);
 @endcode
 
+@section apidefworkers API Definitions - Workers
+
+@subsection odp_pktio_worker_open odp_pktio_worker_open
+
+@code
+/*
+ * Open an ODP packet IO worker instance.
+ *
+ * @param iface Packet IO interface name.
+ *
+ * @return ODP packet IO worker handle or ODP_PKTIO_WORKER_INVALID on error.
+ */
+odp_pktio_worker_t odp_pktio_worker_open(const char *iface);
+@endcode
+
+Open a handle to be used when direct access to a pktio instance is required
+from a worker thread. The interface must have already been opened using
+@c odp_pktio_open.
+
+@subsection odp_pktio_worker_close odp_pktio_worker_close
+
+@code
+/*
+ * Close an ODP packet IO worker instance.
+ *
+ * @param id ODP packet IO worker handle.
+ *
+ * @return 0 on success, -1 on failure.
+ */
+int odp_pktio_worker_close(odp_pktio_worker_t id);
+@endcode
+
+@subsection odp_pktio_worker_recv odp_pktio_worker_recv
+
+@code
+/*
+ * Receive packets directly from the packet IO device.
+ *
+ * @param      id          ODP packet IO worker handle.
+ * @param[out] pkt_table[] Storage for received packets.
+ * @param      len         Length of pkt_table[], i.e. max number of pkts to
+ *                         receive.
+ *
+ * @return Number of packets received or -1 on error.
+ */
+int odp_pktio_worker_recv(odp_pktio_worker_t id, odp_packet_t pkt_table[],
+                          unsigned len);
+@endcode
+
+Receive up to len packets directly from the pktio device and store them in
+pkt_table. This call will return only as many packets as are immediately
+available from the interface.
+
+When accessing the same interface from multiple cores, packet order is not
+maintained.
+
+This routine may only be used on pktio interfaces that have no CoS rules
+configured (and the default CoS is ODP_COS_INVALID).
+
+@subsection odp_pktio_worker_send odp_pktio_worker_send
+
+@code
+/*
+ * Send packets directly via the pktio handle.
+ *
+ * @param id           ODP packet IO worker handle.
+ * @param pkt_table[]  Array of packets to send.
+ * @param len          Length of pkt_table[].
+ *
+ * @return Number of packets sent or -1 on error.
+ */
+int odp_pktio_worker_send(odp_pktio_worker_t id, odp_packet_t pkt_table[],
+                          unsigned len);
+@endcode
+
+Send packets directly via the pktio handle. The return value indicates the
+number of packets that the implementation was able to immediately accept for
+transmission. On function return those packets have been queued for
+transmission but the actual transmission may not yet have occurred. During the
+call ownership of the packets is transferred from the application to the
+implementation, making it the responsibility of the implementation to free the
+packets.
+
+@subsection odp_packet_outq odp_packet_outq
+
+@code
+/*
+ * Get the output queue for a packet.
+ *
+ * @param pkt ODP packet buffer handle.
+ *
+ * @return output queue or ODP_QUEUE_INVALID on error.
+ */
+odp_queue_t odp_packet_outq(odp_packet_t pkt);
+@endcode
+
+This routine returns the output queue for a packet. This is a shorthand
+equivalent of calling odp_packet_get_input() followed by odp_pktio_outq_getdef()
+to determine the output queue based on the interface the packet was received on.
+
 */