From patchwork Wed Jun 29 11:59:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 71186 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp2108064qgy; Wed, 29 Jun 2016 05:01:10 -0700 (PDT) X-Received: by 10.55.184.5 with SMTP id i5mr9979691qkf.33.1467201670120; Wed, 29 Jun 2016 05:01:10 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d126si2756715qkg.179.2016.06.29.05.01.09; Wed, 29 Jun 2016 05:01:10 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 68FA46745A; Wed, 29 Jun 2016 12:01:09 +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, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED 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 6AE8567458; Wed, 29 Jun 2016 12:00:01 +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 DE7446745D; Wed, 29 Jun 2016 11:59:53 +0000 (UTC) Received: from mail-ob0-f173.google.com (mail-ob0-f173.google.com [209.85.214.173]) by lists.linaro.org (Postfix) with ESMTPS id 459A667457 for ; Wed, 29 Jun 2016 11:59:51 +0000 (UTC) Received: by mail-ob0-f173.google.com with SMTP id xn17so22010900obc.0 for ; Wed, 29 Jun 2016 04:59:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Td0yxXe/5idfSz/io5LnzMVa2SK9XBaqh54hAPLpRuw=; b=ctMN/A/Km+oC+rQD8Q8NkAT58TNpd2R/Kg73NmLzO4AYPwz30Jdutmbijp7wBqDRRT LhqyYenSY3JH0BPPghogF/4uH0PNWgRvQp77zEafz761jbmfDhJ6Jfb5g8cb0rUoCbmR bDab2758FL8+Xb21YydKSOBGDOeLfRu6r3Bz//XMmBBGP8cj9KLNf/j5tv5bQCh4T8cI WJ9UA/P+MP9bljGi8HaQumJAugxMtlRDBbnJDXu+3KBGD9GQRrR63TCIEReX6mw7huai r9fEzkh4g/WvD0AD6F9OWM3UweruC8JWUD5ELM4P97dtWJ8Mj+qlFVkTyISy7N+CXSgX QjpA== X-Gm-Message-State: ALyK8tLQxnu7kYsPZf5biN91EU6wABGYGd4OOkf5g0RjGmkFT5xa4etGVKaRoSe3t5AvH5MfxN4= X-Received: by 10.202.180.5 with SMTP id d5mr5327728oif.30.1467201590809; Wed, 29 Jun 2016 04:59:50 -0700 (PDT) Received: from localhost.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id m80sm1248365oik.6.2016.06.29.04.59.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jun 2016 04:59:50 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 29 Jun 2016 06:59:43 -0500 Message-Id: <1467201583-4892-3-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467201583-4892-1-git-send-email-bill.fischofer@linaro.org> References: <1467201583-4892-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 2/2] validation: queue: use malloc to avoid limits on max_queues 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" odp_queue_capability() returns max_queues which may be more than 64K. Use malloc to allocate an array of queue handles to test the ability to create max_queues to avoid limiting the test to 64K queues. If this malloc fails then attempt a reduced test with 64K queues. Signed-off-by: Bill Fischofer --- test/validation/queue/queue.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c index 96941f4..2c8658e 100644 --- a/test/validation/queue/queue.c +++ b/test/validation/queue/queue.c @@ -55,7 +55,7 @@ void queue_test_capa(void) odp_queue_capability_t capa; odp_queue_param_t qparams; char name[ODP_QUEUE_NAME_LEN]; - odp_queue_t queue[MAX_QUEUES]; + odp_queue_t *queue; uint32_t num_queues, i; memset(&capa, 0, sizeof(odp_queue_capability_t)); @@ -71,10 +71,15 @@ void queue_test_capa(void) name[ODP_QUEUE_NAME_LEN - 1] = 0; - if (capa.max_queues > MAX_QUEUES) + num_queues = capa.max_queues; + queue = malloc(num_queues * sizeof(odp_queue_t)); + if (queue == NULL) { + printf("Unable to alloc %d queues, trying with %d\n", + num_queues, MAX_QUEUES); num_queues = MAX_QUEUES; - else - num_queues = capa.max_queues; + queue = malloc(num_queues * sizeof(odp_queue_t)); + CU_ASSERT_FATAL(queue != NULL); + } odp_queue_param_init(&qparams); @@ -93,6 +98,8 @@ void queue_test_capa(void) for (i = 0; i < num_queues; i++) CU_ASSERT(odp_queue_destroy(queue[i]) == 0); + + free(queue); } void queue_test_mode(void)