From patchwork Thu Dec 18 10:27:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 42413 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 273DF26C6B for ; Thu, 18 Dec 2014 10:28:06 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id l18sf544441wgh.6 for ; Thu, 18 Dec 2014 02:28:05 -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: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=W5RMqf13+UnSV4KC4lc7VtRmfm8I9P6DuT3d3ezFEIc=; b=bchzLQPabPtPAMY6+JSDuJGUUsVezz6/x+f21j9crN/hChQWmFSIWuhl3bPIBrcjsg PqwkmPKn6Qne/d7cJSaBS5qFOn4z+ZZyRgoyvT/RCQPIKlUJLtJBjX/whPoHTsjB3TMB aarbIF7I6uy3HvkjKZRmflgyn6LQOaU3jfg28ZA8r7s+dqD9eHnV8cvm/69oXeZRK8Wq lAgvwA3s4sUy3c9qQg4h99v8n+nhPDdKsGMUmpmT5Oxp8IS7wAImV11+aWkj80BALv5V YhEA1wZsvckroZ4zcxVt3ZEvJg6YzpMEBtBpx0AeiiSx3O1uOpjCN6F1CwZHu1guezQj q64Q== X-Gm-Message-State: ALoCoQkPS9f0IMRiHUne5v7D7A6a7XlotDxmHgQvsvfIvjwCg1kV8dJW71Ewv/MrVk9Ko2vPcrw2 X-Received: by 10.112.168.70 with SMTP id zu6mr212229lbb.8.1418898485346; Thu, 18 Dec 2014 02:28:05 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.201 with SMTP id x9ls823408lae.89.gmail; Thu, 18 Dec 2014 02:28:05 -0800 (PST) X-Received: by 10.112.93.231 with SMTP id cx7mr1348565lbb.89.1418898485079; Thu, 18 Dec 2014 02:28:05 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id ks1si6463860lac.22.2014.12.18.02.28.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 02:28:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id hz20so731939lab.34 for ; Thu, 18 Dec 2014 02:28:04 -0800 (PST) X-Received: by 10.152.26.201 with SMTP id n9mr1484250lag.50.1418898484707; Thu, 18 Dec 2014 02:28:04 -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 ru5csp1656798lbb; Thu, 18 Dec 2014 02:28:03 -0800 (PST) X-Received: by 10.224.127.74 with SMTP id f10mr2145520qas.16.1418898483158; Thu, 18 Dec 2014 02:28:03 -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 5si7649227qgf.115.2014.12.18.02.28.02 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Dec 2014 02:28:03 -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 1Y1YJM-0008AW-AR; Thu, 18 Dec 2014 10:28:00 +0000 Received: from mail-la0-f46.google.com ([209.85.215.46]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1YJG-0008AK-JC for lng-odp@lists.linaro.org; Thu, 18 Dec 2014 10:27:54 +0000 Received: by mail-la0-f46.google.com with SMTP id q1so728930lam.5 for ; Thu, 18 Dec 2014 02:27:48 -0800 (PST) X-Received: by 10.112.169.34 with SMTP id ab2mr1375712lbc.77.1418898468777; Thu, 18 Dec 2014 02:27:48 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id r3sm1648512lal.37.2014.12.18.02.27.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Dec 2014 02:27:48 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org, Stuart Haslam Date: Thu, 18 Dec 2014 12:27:43 +0200 Message-Id: <1418898463-25492-1-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH] linux-generic: queue: fix PKTIN queue destroy 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: taras.kondratiuk@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.47 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 PKTIN queue was not handled correctly. Check queue status instead of queue type. Reported-by: Stuart Haslam Signed-off-by: Taras Kondratiuk --- platform/linux-generic/odp_queue.c | 39 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 1462b41..c128aa0 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -207,27 +207,30 @@ int odp_queue_destroy(odp_queue_t handle) queue->s.enqueue = queue_enq_dummy; queue->s.enqueue_multi = queue_enq_multi_dummy; - if (queue->s.type == ODP_QUEUE_TYPE_POLL || - queue->s.type == ODP_QUEUE_TYPE_PKTOUT) { + switch (queue->s.status) { + case QUEUE_STATUS_READY: queue->s.status = QUEUE_STATUS_FREE; queue->s.head = NULL; queue->s.tail = NULL; - } else if (queue->s.type == ODP_QUEUE_TYPE_SCHED) { - if (queue->s.status == QUEUE_STATUS_SCHED) { - /* - * Override dequeue_multi to destroy queue when it will - * be scheduled next time. - */ - queue->s.status = QUEUE_STATUS_DESTROYED; - queue->s.dequeue_multi = queue_deq_multi_destroy; - } else { - /* Queue won't be scheduled anymore */ - odp_buffer_free(queue->s.sched_buf); - queue->s.sched_buf = ODP_BUFFER_INVALID; - queue->s.status = QUEUE_STATUS_FREE; - queue->s.head = NULL; - queue->s.tail = NULL; - } + break; + case QUEUE_STATUS_SCHED: + /* + * Override dequeue_multi to destroy queue when it will + * be scheduled next time. + */ + queue->s.status = QUEUE_STATUS_DESTROYED; + queue->s.dequeue_multi = queue_deq_multi_destroy; + break; + case QUEUE_STATUS_NOTSCHED: + /* Queue won't be scheduled anymore */ + odp_buffer_free(queue->s.sched_buf); + queue->s.sched_buf = ODP_BUFFER_INVALID; + queue->s.status = QUEUE_STATUS_FREE; + queue->s.head = NULL; + queue->s.tail = NULL; + break; + default: + ODP_ABORT("Unexpected queue status\n"); } UNLOCK(&queue->s.lock);