From patchwork Mon Jan 15 16:00:10 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: 124538 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp714024lje; Mon, 15 Jan 2018 08:01:14 -0800 (PST) X-Google-Smtp-Source: ACJfBotH9dyDkZJ7dFODy4Dqkwx0wqLTthbAb8qo666iyZAgfSWbHpMSIaWqhiNjlK5IOzjZdDkd X-Received: by 10.55.25.95 with SMTP id k92mr51904068qkh.22.1516032074015; Mon, 15 Jan 2018 08:01:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516032074; cv=none; d=google.com; s=arc-20160816; b=jkdBpuq+NDumAwA20Fqw0m29JEYbnd/1qQjmPA/Kf7IYVX3cE+q+fI+z0/S1C+R8C+ 5fFuD3yijQcptg0RV+JRdLXtLZcyfswm1FZndJp0EEll/Meo4n9yifbdrRYTsxLJlZtd /+3Fzr9FWt6i9X/mnVI3m9eGMVxKggOayzbsHusdUYIMZXVIpu9MvhjyL56SKzLMgucp kDT7k8tu6OKhKUEdwdFn9cd5bpWzvA/8jjfueWStOAzkoHYyemlPdI3lWQnFnqy9C68v q8J5VkbXpssq1F4fQuJjHS8k86Qbty8MkHU5QmNU/XV+6ot62UZTTWpdlFvoj/n4luZO Mscg== 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=hwE2XgPvZG06UaAhAt+XbO3XSJIE+j3IiRJemmoNqNQ=; b=Fon+RrfVUfUR2rkTaTz1MvMkdFtTX7zoN5Squ1omqqQeOa344OhNJL+21jrUI1Us42 9bE1ZP8Z32f3S9mMQOjw7j+ZqrXvtOgu6VVgZaYCTX5qDqTaYDjDOwbxe7A8qUzUjpOi 3tjL/xODfYXnwgs/lmcaprqXqLNoGRuhPKLHVFcL0oR/2OjyNIXoyAhx/XEF92yr6MMB G8T3ZidGvg5RFmjtqIwj/NK//xUA1uxoO0NWK0BjMt1Rr6BQAA+yY1TwEBkwTNoalgfL dcsE5S1EMKC//BQCFDP8TW5tInZ7gsYMNDXqgRbKwnCVeWCga1OEfO25Zdtg496zoVJj qphg== 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 s88si5090046qtd.117.2018.01.15.08.01.13; Mon, 15 Jan 2018 08:01:14 -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 8CAAE617A6; Mon, 15 Jan 2018 16:01:13 +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 534A86173E; Mon, 15 Jan 2018 16:00:35 +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 78E9B61748; Mon, 15 Jan 2018 16:00:28 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 071AD61706 for ; Mon, 15 Jan 2018 16:00:27 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 5EF0B4302F2F for ; Mon, 15 Jan 2018 19:00:25 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id g10cLq3Imf-0PRmASUl; Mon, 15 Jan 2018 19:00:25 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id xQGEAL5EIv-0IeKkIUS; Mon, 15 Jan 2018 19:00:18 +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: Mon, 15 Jan 2018 19:00:10 +0300 Message-Id: <1516032011-16269-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516032011-16269-1-git-send-email-odpbot@yandex.ru> References: <1516032011-16269-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 387 Subject: [lng-odp] [PATCH API-NEXT v2 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: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 44a458d201cb186a2ad2462da1fa9c4cd3a386b2 **/ 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 16:00:11 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: 124539 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp714719lje; Mon, 15 Jan 2018 08:02:46 -0800 (PST) X-Google-Smtp-Source: ACJfBouz8NoNkktpvet8f0Qypc3TJXPekJf6g0yhGJ7WM6lKKyrgIr+vBzM48bUa0jGN5IlA4VPx X-Received: by 10.200.81.139 with SMTP id c11mr7609882qtn.118.1516032165968; Mon, 15 Jan 2018 08:02:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516032165; cv=none; d=google.com; s=arc-20160816; b=WFGLJJ2Tlm12Qb7vu785e+t5zqKO5WrSf/AJBo9BEpFFEdfi3DVboMxPmgtyCdna5O nFTyPpoAM6PPU1TNuIlVY4GmgfOQwlAYb7kKwA6qNeeZPirvvw6AlozeeeUVpaVnU/Iu cawMZiM4qYirKi+vxvCpoC5XQ/W7/QzAEn1XsFM7qt3ECvT1hz5MxRZE30CF0tSPM4hC MZ3XcEyVO5dPZVO3zgAGjPL4N1T6Qz8eHAO9p/1JJGiwcDwWLTYAAuqSpTKeQ75V5Uzs RvLpXpRQnW1RMGwqB+QE0pD/zDpacUM2F4q9imJuOuU+vCLidwRdiOCWNXYsImllUUtV dHFw== 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=xGyVbKYqYI6wr66GdZEaKsI2UgB40Ebfso3eikaqKas=; b=PdiJmEHHUL2H1vrc5YoDoZX3NWNwBI4x2x1pJoA3DxX4r5eT03h0aq6FWLUIKdw5/v wY7oYDh9xSim0Dc4t1LVhu7UhFqVL/oyVkO5Wodbj/hneAvvp+n/JgDNb8LI+sap4wrf 4h7Vo2LjpprnoJ0X/O/2AhBO0PxspmCOXu8vtk6SlE15iFgTRUyPq/OCL79eBuIKH2Nf p9sU5kITdSpDWL4xWJfwdih6oRasra41tRjRCQqe0JbYYfpsFuqLe2wW/l2w76MtXSIR ivB7/3K/ek2v4Ll0aAqhvMxmCiMRSkguc2Rxvc4ByP15rLBfc/uJPJTeD/aaQGFBbFNu An0A== 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 t74si2912281qka.3.2018.01.15.08.02.43; Mon, 15 Jan 2018 08:02:45 -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 945B4617C1; Mon, 15 Jan 2018 16:02:43 +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 F34556177F; Mon, 15 Jan 2018 16:02:13 +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 D06D261741; Mon, 15 Jan 2018 16:01:59 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 2E526617AE for ; Mon, 15 Jan 2018 16:00:52 +0000 (UTC) Received: from mxback4o.mail.yandex.net (mxback4o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1e]) by forward104p.mail.yandex.net (Yandex) with ESMTP id CABE5181DA8 for ; Mon, 15 Jan 2018 19:00:50 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback4o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id CdMW40eamm-0nIOumtg; Mon, 15 Jan 2018 19:00:50 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id xQGEAL5EIv-0Pe8Adrm; Mon, 15 Jan 2018 19:00:25 +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: Mon, 15 Jan 2018 19:00:11 +0300 Message-Id: <1516032011-16269-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516032011-16269-1-git-send-email-odpbot@yandex.ru> References: <1516032011-16269-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 387 Subject: [lng-odp] [PATCH API-NEXT v2 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: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 44a458d201cb186a2ad2462da1fa9c4cd3a386b2 **/ 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); }