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