From patchwork Thu Feb 15 14:00:05 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: 128435 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1783496ljc; Thu, 15 Feb 2018 06:03:37 -0800 (PST) X-Google-Smtp-Source: AH8x225cImbs7bXCmUHR7c1M0orM6EXxzCdtIez3Vx+B+QvAz9i+cuogUbUoU1fHknLRzt2i+UKZ X-Received: by 10.200.0.17 with SMTP id a17mr4477540qtg.46.1518703416840; Thu, 15 Feb 2018 06:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518703416; cv=none; d=google.com; s=arc-20160816; b=WzvXcvF4MXxQWjJtZWOWAxAJ/ZkKksr6uuce8Pwfw8do+i2hBSfIvud/uo4i+rbKxC b8ZMmgiOiQQlffKg4dqibaMKqeH48N4mrYwfyu2mg7w4IX28w9M26q0jt2b3/V+mSc7x AgEezioimBjNkvjur9LTXXDuRqBcYG+sqkcJ3PeA8DQfBsIlNEw9TdTCsXG8XWcaMdbd I9Ko6JooJT3MCb4gOux6XmBaYU3x95p18xRziqPvt6gNRV+tTA5NslBuoHitsGwX6vsf VMAD/ldKTjLOr+cLOweTTebVzC+rrjDeKAPi4IOSHT6+pj/j/b/CCj9ZMl2TIP0vAjv8 hwmQ== 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=G7o7F5BxzM2qX315Hw81szyPwO1hR2INa5qmg/A+OPg=; b=zNmeO6/mOA/WTY5OmeSdg2WOpgppoBcOvD5jFLPBD/K/VDoehMJvOVLkeIPXvWe5DO ZsTZRFB4gKSPaHnHwlceR8ifoO6b/5v9u9vsiDMBZm0Zii+asYbT2vHT3JNTq1HXh6gv tz/rYWEiztBs5keDwk4qY0bvlPf6voHrOnQAjm3xSZ7RtPWJowuHb5jFppZV5HiYUD7K SmK0pqGCykAArESEA2thwbJRes8Ms4YeN1lYeLoFJTjuEOwLQGUXvOsxPgJmkoa4LSTy 5hozWvvTC8eqnz5MGO4UvrUP9RLw6VSH9roBuB5Ijf7ya7DKRz7xSIbxkwxoO6kbAAOa 7zLQ== 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 l4si3141022qtn.22.2018.02.15.06.03.36; Thu, 15 Feb 2018 06:03:36 -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 6550961701; Thu, 15 Feb 2018 14:03:36 +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 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 7AF4460722; Thu, 15 Feb 2018 14:02:50 +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 9124461745; Thu, 15 Feb 2018 14:02:42 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 17A6D60919 for ; Thu, 15 Feb 2018 14:02:00 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward103o.mail.yandex.net (Yandex) with ESMTP id 11063588677B for ; Thu, 15 Feb 2018 17:00:10 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dC3Oui5pJa-09qO8bj0; Thu, 15 Feb 2018 17:00:10 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yLwPeDorb6-09KOeEb7; Thu, 15 Feb 2018 17:00:09 +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: Thu, 15 Feb 2018 17:00:05 +0300 Message-Id: <1518703206-19713-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518703206-19713-1-git-send-email-odpbot@yandex.ru> References: <1518703206-19713-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 484 Subject: [lng-odp] [PATCH v1 2/3] linux-gen: cls: fix single queue bugs 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: Petri Savolainen odp_cls_cos_num_queue() and odp_cls_cos_queues() returned 0 for single queue CoS. Signed-off-by: Petri Savolainen --- /** Email created from pull request 484 (psavol:master-missing-validation) ** https://github.com/Linaro/odp/pull/484 ** Patch: https://github.com/Linaro/odp/pull/484.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: 595ea205e4c4680f6a9a674fbe637dcab24b038e **/ platform/linux-generic/odp_classification.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index f22dd091c..ceef1fc13 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -250,11 +250,12 @@ odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param) cos->s.linked_cos[j] = NULL; } + cos->s.num_queue = param->num_queue; + if (param->num_queue > 1) { odp_queue_param_init(&cos->s.queue_param); cos->s.queue_group = true; cos->s.queue = ODP_QUEUE_INVALID; - cos->s.num_queue = param->num_queue; _odp_cls_update_hash_proto(cos, param->hash_proto); tbl_index = i * CLS_COS_QUEUE_MAX; @@ -358,6 +359,12 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id) ODP_ERR("Invalid odp_cos_t handle"); return -1; } + + if (cos->s.num_queue != 1) { + ODP_ERR("Hashing enabled, cannot set queue"); + return -1; + } + /* Locking is not required as intermittent stale data during CoS modification is acceptable*/ cos->s.queue = queue_id; @@ -402,6 +409,14 @@ uint32_t odp_cls_cos_queues(odp_cos_t cos_id, odp_queue_t queue[], return 0; } + if (cos->s.num_queue == 1) { + if (num == 0) + return 1; + + queue[0] = cos->s.queue; + return 1; + } + if (num < cos->s.num_queue) num_queues = num; else