From patchwork Thu Oct 9 14:08:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 38508 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CED41202E7 for ; Thu, 9 Oct 2014 14:09:35 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id q1sf928240lam.8 for ; Thu, 09 Oct 2014 07:09:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=/eYQILyH2+B32bZkjsl4mErBMAC8owMhuGXwV7+50Fo=; b=C4opNMpNpfX45dsofFI44S1kLYJ+SE2DbxCpL+RcPojb4iiaoXIfJGSkyHzL+Vm0wh kPNJ1h8Np7wqlV2sRq5Z/sdHvknVhCRsdUnzwiishQOpAYlsgGpQJVR9Xroh/ei3xLV3 +ViUEH3CuJBF2GZHJj66YiV3Uizsxosy9m29P9wlh0cD+s8Dd4sq02QxxV9qsG2AkPlx R6ftpZ3bZGvQrYxqQpruosMaVQb9icXzvOielUmEUkuI/svsGNQncwBlatmN7bmj+D7Q LC2ItXV/k0c2IHuVZ+iUbWMSK0/KY6xVOaK2zgzOXPl4PoeDcnsTIOZra41upsyeLCra LU5g== X-Gm-Message-State: ALoCoQmyO9HZJl2OPvPubX0myj2gl3CpyLQn1TFPowKbCSO505SBcn3bwcQ0+inPO0O0mjDPMPUJ X-Received: by 10.152.42.229 with SMTP id r5mr252866lal.8.1412863774614; Thu, 09 Oct 2014 07:09:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.169 with SMTP id r9ls159988laj.57.gmail; Thu, 09 Oct 2014 07:09:34 -0700 (PDT) X-Received: by 10.152.43.99 with SMTP id v3mr18894919lal.13.1412863774473; Thu, 09 Oct 2014 07:09:34 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mx.google.com with ESMTPS id 1si4455674lal.89.2014.10.09.07.09.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Oct 2014 07:09:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id w7so1209262lbi.8 for ; Thu, 09 Oct 2014 07:09:34 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr19047543lad.40.1412863773289; Thu, 09 Oct 2014 07:09:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp254753lbz; Thu, 9 Oct 2014 07:09:32 -0700 (PDT) X-Received: by 10.140.42.68 with SMTP id b62mr50758243qga.25.1412863771775; Thu, 09 Oct 2014 07:09:31 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id q5si5861169qat.17.2014.10.09.07.09.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 09 Oct 2014 07:09:31 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XcEPK-0006xP-4P; Thu, 09 Oct 2014 14:09:30 +0000 Received: from mail-lb0-f180.google.com ([209.85.217.180]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XcEP4-0006u8-AT for lng-odp@lists.linaro.org; Thu, 09 Oct 2014 14:09:14 +0000 Received: by mail-lb0-f180.google.com with SMTP id n15so1240844lbi.11 for ; Thu, 09 Oct 2014 07:09:08 -0700 (PDT) X-Received: by 10.112.54.196 with SMTP id l4mr18251271lbp.85.1412863747788; Thu, 09 Oct 2014 07:09:07 -0700 (PDT) Received: from localhost (c-853670d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.54.133]) by mx.google.com with ESMTPSA id bk5sm993876lbd.30.2014.10.09.07.09.06 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 09 Oct 2014 07:09:07 -0700 (PDT) From: Anders Roxell To: lng-odp@lists.linaro.org Date: Thu, 9 Oct 2014 16:08:46 +0200 Message-Id: <1412863729-28176-5-git-send-email-anders.roxell@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1412863729-28176-1-git-send-email-anders.roxell@linaro.org> References: <1412863729-28176-1-git-send-email-anders.roxell@linaro.org> Subject: [lng-odp] [DO NOT REVIEW 4/7] packet_io: add API definitions - Workers X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: anders.roxell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Anders Roxell --- packet_io.dox | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) 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. + */