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); }