From patchwork Wed Dec 17 22:41:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 42397 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AC08226C76 for ; Wed, 17 Dec 2014 22:42:32 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf11439wgh.9 for ; Wed, 17 Dec 2014 14:42:32 -0800 (PST) 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:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=OZXV8Si+iDLX9a1XUoL59SDcamTGss2GMJeHz7IIHEg=; b=Azum/Hm0XKqqFVhQE121ySWNXxSkIkC89vj+2af/BLPsZ0NP26Js0fwQR5BgACeOrr JH08Ur/no/ku0mrSsHjXaH30bkoBaUMhLnxBbANwh3ehddErsJNd24nx9L+BYLkhgzw3 kGhmuu6fUfqxub2wZA5fuitKXa0LX7nvW17gUa/1acQp3DQ+HVdtTNhalbHE9A0nvLpO UeM83O8IouX482yVqxBIQMqs0geBA9MIN1Rf3i7Dxz4kJI0EV+jT50eyHgXuVxL8mUKo Maip1w73IK1D1Ge7vIBRlJFroBZQmjmo95nWiKicwTK/GUW9jCqx0LW3EmXyChTZtwj+ hvNQ== X-Gm-Message-State: ALoCoQm4/JgcgLeV6C+XK+qt7MMTg9FTzyWjNt/GgjXfboEp/CUmK6b8UyGvhp5NxG2XqaEtRdyO X-Received: by 10.112.169.101 with SMTP id ad5mr6803080lbc.1.1418856151956; Wed, 17 Dec 2014 14:42:31 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.11.6 with SMTP id ee6ls1124489lad.7.gmail; Wed, 17 Dec 2014 14:42:31 -0800 (PST) X-Received: by 10.152.207.37 with SMTP id lt5mr43298321lac.66.1418856151714; Wed, 17 Dec 2014 14:42:31 -0800 (PST) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id uo8si5103138lbb.96.2014.12.17.14.42.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 14:42:31 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id gq15so15731lab.32 for ; Wed, 17 Dec 2014 14:42:31 -0800 (PST) X-Received: by 10.112.135.197 with SMTP id pu5mr43153090lbb.22.1418856151454; Wed, 17 Dec 2014 14:42:31 -0800 (PST) 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.142.69 with SMTP id ru5csp1513488lbb; Wed, 17 Dec 2014 14:42:30 -0800 (PST) X-Received: by 10.224.74.207 with SMTP id v15mr79363246qaj.53.1418856149594; Wed, 17 Dec 2014 14:42:29 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id n11si6241411qay.42.2014.12.17.14.42.25 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 17 Dec 2014 14:42:29 -0800 (PST) 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 1Y1NIV-0007m4-B9; Wed, 17 Dec 2014 22:42:23 +0000 Received: from mail-lb0-f179.google.com ([209.85.217.179]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1NIG-0007j2-5L for lng-odp@lists.linaro.org; Wed, 17 Dec 2014 22:42:08 +0000 Received: by mail-lb0-f179.google.com with SMTP id z11so25316lbi.10 for ; Wed, 17 Dec 2014 14:42:02 -0800 (PST) X-Received: by 10.152.20.98 with SMTP id m2mr42254969lae.49.1418856122318; Wed, 17 Dec 2014 14:42:02 -0800 (PST) Received: from localhost.localdomain (ppp91-76-163-205.pppoe.mtu-net.ru. [91.76.163.205]) by mx.google.com with ESMTPSA id kt7sm1265060lac.4.2014.12.17.14.42.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 14:42:01 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 18 Dec 2014 01:41:50 +0300 Message-Id: <1418856112-8589-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1418856112-8589-1-git-send-email-maxim.uvarov@linaro.org> References: <1418856112-8589-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 1/3] linux-generic: fix odp_pktio_inq_remdef 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: maxim.uvarov@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.215.45 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 Correctly remove queue from packet i/o and remove it from scheduler. Signed-off-by: Maxim Uvarov --- platform/linux-generic/odp_packet_io.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 3ca8100..1b3ab24 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -391,7 +391,31 @@ int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue) int odp_pktio_inq_remdef(odp_pktio_t id) { - return odp_pktio_inq_setdef(id, ODP_QUEUE_INVALID); + pktio_entry_t *pktio_entry = get_pktio_entry(id); + odp_queue_t queue; + queue_entry_t *qentry; + + if (pktio_entry == NULL) + return -1; + + lock_entry(pktio_entry); + queue = pktio_entry->s.inq_default; + qentry = queue_to_qentry(queue); + + queue_lock(qentry); + if (qentry->s.status == QUEUE_STATUS_FREE) { + queue_unlock(qentry); + unlock_entry(pktio_entry); + return -1; /* Queue is already free or not empty */ + } + + qentry->s.enqueue = queue_enq_dummy; + qentry->s.enqueue_multi = queue_enq_multi_dummy; + qentry->s.status = QUEUE_STATUS_FREE; + queue_unlock(qentry); + unlock_entry(pktio_entry); + + return 0; } odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id)