From patchwork Mon Jan 15 23:00:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124559 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp819805lje; Mon, 15 Jan 2018 15:01:21 -0800 (PST) X-Google-Smtp-Source: ACJfBovyN3QZ1TI7D2RXMurHtPbV9J/0hixr2iGuczbD4dE3LZpwJ1jDW5nQ9s4H5IwZIkNa4Kfy X-Received: by 10.200.38.177 with SMTP id 46mr3510216qto.165.1516057280867; Mon, 15 Jan 2018 15:01:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516057280; cv=none; d=google.com; s=arc-20160816; b=wDjPfc1ZP3SGk8JxjDBBftJWy3K46RmTM+Ie8gLqaLFnsEcPU+OsIQ2060MQoDKb9T mFyeATZKgVJ2KSDYkVEZQV7TMIWQLhkcKqFgETkNrggOvmvx8NGSrtdax7iMdu1NPFkJ z+i2zBKmfZ5KktPJ/2kZ6lf74fDNJ3KpbcXYOkj90qvnuos38jChloGk0yXZRuyWTKXd ECQIvLBJGwi4DZZBNgQwvpCPQJDbYDEkuO635uxkwIlbw408ojjEkedQBQXrWcXjArye PG4T51RBAF9wLAYiMyM67RrOOjSvC8Nn0wjw+S0FbB2TDoC0cpgCQH37ko7EGkb6kPV4 dQDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=VwpfZdARon7egvh9jScUZpVD5Kz/avTU+MYqbssDtZk=; b=SdaMjtoP/mDfBMkco0wvWoEqTRP7Hq83gMMR7Hyk8i6fpjX34TXRzVjFYM4Y5mZ8cO JcmL6YBRWU81deh7/TK4XXR52lok6bWfWhF2O8+WZIF8/qUt6BcumNoOkj6f2bgQT/Bm 15wUSo81OW2/QpfVTtbZfRW0OW2T3555wqxsC2RsMdBFmp/YqocPsuH0nEgrvVF+QLZ3 UKAAjx1V1IYbbAJIhJU9dOVKq3uvBgDWUsvEgZiQ+mC89lzJrJwxWBjf8RHM5pYWSsza A9h/YDbRIiVokOPcYFUZpioyrCW9C4cRLOI944pFAMO33mELtvl8wcN31UfooNsZ4XXs D6Mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id m67si29842qkd.30.2018.01.15.15.01.20; Mon, 15 Jan 2018 15:01:20 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 8DDB6617A9; Mon, 15 Jan 2018 23:01:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 1C43C6177E; Mon, 15 Jan 2018 23:00:45 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id AFA066175B; Mon, 15 Jan 2018 23:00:40 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id C35026097D for ; Mon, 15 Jan 2018 23:00:38 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 2151240830A6 for ; Tue, 16 Jan 2018 02:00:37 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 0RWp84oiXA-0bROX2RW; Tue, 16 Jan 2018 02:00:37 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id RRsihTHxBd-0arGCLs6; Tue, 16 Jan 2018 02:00:36 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 16 Jan 2018 02:00:19 +0300 Message-Id: <1516057220-24653-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516057220-24653-1-git-send-email-odpbot@yandex.ru> References: <1516057220-24653-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 387 Subject: [lng-odp] [PATCH API-NEXT v3 1/2] api: pktio: clarify timeout and stop interaction X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bill Fischofer Clarify how odp_pktin_recv_tmo() and odp_pktin_recv_mq_tmo() interact with odp_pktio_stop(). In particular, specify that a stop operation will terminate indefinite receive waits. Signed-off-by: Bill Fischofer --- /** Email created from pull request 387 (Bill-Fischofer-Linaro:pktio-docs) ** https://github.com/Linaro/odp/pull/387 ** Patch: https://github.com/Linaro/odp/pull/387.patch ** Base sha: f6dab2bfa90ef5d3146cb76f86bc8782666f0f3e ** Merge commit sha: b1f177bfce913daf4fabbba1e18912aed180b1e8 **/ include/odp/api/spec/packet_io.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index bf30877f5..f4a4059c9 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -813,14 +813,17 @@ int odp_pktio_start(odp_pktio_t pktio); * received from the network may be still available from interface and * application can receive those normally. New packets may not be accepted for * transmit. Packets already stored for transmit are not freed. A following - * odp_packet_start() call restarts packet receive and transmit. + * odp_packet_start() call restarts packet receive and transmit. Any active + * odp_pktin_recv_tmo() or odp_pktin_recv_mq_tmo() calls for this interface + * are terminated by this call. * * @param pktio Packet IO handle * * @retval 0 on success * @retval <0 on failure * - * @see odp_pktio_start(), odp_pktio_close() + * @see odp_pktio_start(), odp_pktio_close(), odp_pktin_recv_tmo(), + * odp_pktin_recv_mq_tmo() */ int odp_pktio_stop(odp_pktio_t pktio); @@ -884,14 +887,19 @@ int odp_pktin_recv(odp_pktin_queue_t queue, odp_packet_t packets[], int num); * @param num Maximum number of packets to receive * @param wait Wait time specified as as follows: * * ODP_PKTIN_NO_WAIT: Do not wait - * * ODP_PKTIN_WAIT: Wait infinitely + * * ODP_PKTIN_WAIT: Wait indefinitely. Returns + * <0 if interface is stopped during the wait. * * Other values specify the minimum time to wait. * Use odp_pktin_wait_time() to convert nanoseconds * to a valid parameter value. Wait time may be * rounded up a small, platform specific amount. + * Timeout value may be expired early if the + * interface is stopped during the timed wait. * * @return Number of packets received * @retval <0 on failure + * + * @see odp_pktio_stop() */ int odp_pktin_recv_tmo(odp_pktin_queue_t queue, odp_packet_t packets[], int num, uint64_t wait); @@ -923,14 +931,19 @@ int odp_pktin_recv_tmo(odp_pktin_queue_t queue, odp_packet_t packets[], * @param num Maximum number of packets to receive * @param wait Wait time specified as as follows: * * ODP_PKTIN_NO_WAIT: Do not wait - * * ODP_PKTIN_WAIT: Wait infinitely + * * ODP_PKTIN_WAIT: Wait indefinitely. Returns + * <0 if interface is stopped during the wait. * * Other values specify the minimum time to wait. * Use odp_pktin_wait_time() to convert nanoseconds * to a valid parameter value. Wait time may be * rounded up a small, platform specific amount. + * Timeout value may be expired early if the + * interface is stopped during the timed wait. * * @return Number of packets received * @retval <0 on failure + * + * @see odp_pktio_stop() */ int odp_pktin_recv_mq_tmo(const odp_pktin_queue_t queues[], unsigned num_q, unsigned *from, odp_packet_t packets[], int num, From patchwork Mon Jan 15 23:00:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124560 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp819971lje; Mon, 15 Jan 2018 15:01:56 -0800 (PST) X-Google-Smtp-Source: ACJfBovnM7OW2fUda+H2es16/QfcCcJMsFHJFFEIC227tYGZNXYN150OalxOF6dfaaX/GH0dl/Na X-Received: by 10.237.32.42 with SMTP id 39mr51176773qta.18.1516057316157; Mon, 15 Jan 2018 15:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516057316; cv=none; d=google.com; s=arc-20160816; b=ZatVPEkimn6iDgIR3wGKfHowPWJao6Glyfpx+2iE8Xxkk/4y6phZvhvH8kVsGFP/t7 maj9QJqGQetGhNa99lxwkbmSpRUDCWOrVsS/+eVtkmpLE6U3vlhAX2Prh6VNEs7B6Mq/ uW+kjuIjumGWlPSu2/Pv6gwW/IR2FPD3bVn2bewnIoBEFRh1pqpp+xYD2qMPhtic1rC5 nsllcLpwyZZ1UHhYaFaDr7dv+mJtKXk7Dr0KFTNDM8IMuV7MppphfmeN2ONGvMuom4i+ hY5Wbh8/nSlUSwHgNvRnrlZeDw0EV7mwXiummbFBV0XkhTq7lYClLu0BSGxoARxF3iwX rECg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=H4/FXkIhfbqGEUV1WfDZO195t4Gt9vn8xubcWXFhgd4=; b=lLYfPvF+o8jo1UE+n0RVC3/nZAVrnUn0z5k7ebey9nrXMILL5C33GIjR6h7JA1x3aG 6cUFe58iymCEgvNw5aW9vkE9pFElV+RKEdZURr3iQqY1sJ7CzzqRVSjl17hnXp81BhBz zbUf6+RI45wxutH95Dtrzh0zygQR7l9ggPobGs2bXrS9a5ReGrRreuWLE4tL3xVvKbL9 /ixp6rKcf75tc1jGC4Ckve7lg1pU0USrLLCKDFtLceLbwwIjZZ55ldAsyTvTXEWKebL+ PpqHpedL2xFAIvh85H0FOp31laXQhiwigmtfpV9VzcNslrRr2Pf/Qj2q4GICd7HlfFVW +vow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id a9si747662qtg.455.2018.01.15.15.01.55; Mon, 15 Jan 2018 15:01:56 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id C16E261732; Mon, 15 Jan 2018 23:01:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 7153361791; Mon, 15 Jan 2018 23:00:48 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 36D006097D; Mon, 15 Jan 2018 23:00:42 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 1B95561732 for ; Mon, 15 Jan 2018 23:00:39 +0000 (UTC) Received: from mxback3o.mail.yandex.net (mxback3o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1d]) by forward101o.mail.yandex.net (Yandex) with ESMTP id AE4391341F95 for ; Tue, 16 Jan 2018 02:00:37 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id nMYuRN1E0c-0b2SeMxm; Tue, 16 Jan 2018 02:00:37 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id RRsihTHxBd-0br8ReBI; Tue, 16 Jan 2018 02:00:37 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 16 Jan 2018 02:00:20 +0300 Message-Id: <1516057220-24653-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516057220-24653-1-git-send-email-odpbot@yandex.ru> References: <1516057220-24653-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 387 Subject: [lng-odp] [PATCH API-NEXT v3 2/2] linux-generic: pktio: fail send/recv calls if pktio is not started X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bill Fischofer Fail send and recv calls if the pktio is not in the STARTED state. This allows pending recv_tmo() calls to be terminated by odp_pktio_stop(). Signed-off-by: Bill Fischofer --- /** Email created from pull request 387 (Bill-Fischofer-Linaro:pktio-docs) ** https://github.com/Linaro/odp/pull/387 ** Patch: https://github.com/Linaro/odp/pull/387.patch ** Base sha: f6dab2bfa90ef5d3146cb76f86bc8782666f0f3e ** Merge commit sha: b1f177bfce913daf4fabbba1e18912aed180b1e8 **/ platform/linux-generic/odp_packet_io.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index ffbc73b26..dcb46c7b5 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -1669,6 +1669,9 @@ int odp_pktin_recv(odp_pktin_queue_t queue, odp_packet_t packets[], int num) return -1; } + if (entry->s.state != PKTIO_STATE_STARTED) + return -1; + return entry->s.ops->recv(entry, queue.index, packets, num); } @@ -1791,5 +1794,8 @@ int odp_pktout_send(odp_pktout_queue_t queue, const odp_packet_t packets[], return -1; } + if (entry->s.state != PKTIO_STATE_STARTED) + return -1; + return entry->s.ops->send(entry, queue.index, packets, num); }