From patchwork Mon Feb 13 12:50:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bogdan Pricope X-Patchwork-Id: 93877 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1079099qgi; Mon, 13 Feb 2017 04:50:53 -0800 (PST) X-Received: by 10.237.59.28 with SMTP id p28mr19588636qte.152.1486990253068; Mon, 13 Feb 2017 04:50:53 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p129si7129960qkc.253.2017.02.13.04.50.52; Mon, 13 Feb 2017 04:50:53 -0800 (PST) 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 sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A592460668; Mon, 13 Feb 2017 12:50:52 +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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 5CA3A60698; Mon, 13 Feb 2017 12:50:47 +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 5A3DB6085D; Mon, 13 Feb 2017 12:50:44 +0000 (UTC) Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by lists.linaro.org (Postfix) with ESMTPS id 6135660ACC for ; Mon, 13 Feb 2017 12:50:24 +0000 (UTC) Received: by mail-wm0-f46.google.com with SMTP id v186so157133590wmd.0 for ; Mon, 13 Feb 2017 04:50:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Z89XZ4+vQqcTomepVp85ZW4mOjBb4MZpisg732v283I=; b=cRXPTqviGw/JkXOO/KK8eZC/fVs7fkJ7x237pfBxtk96/irUrbebpY/TNyMrDViDvQ n0pNXjnImu0WNOOx8YmL1NMhTp/n2n2ZrTm45Sl/iPi1SWcNte+T732oCj2wGbYu3Q7M hFwIjz5bXD9aVntwueibAZdUf6+v4vOtodQpqopX2ujiRrmCH0iO1pw+dF3B9f02IZrz Apo3Dx3GhXbqpL54AqAC1vmDp090vo9zrLRgda2L2dtzQ7RmdaS/tjI0tAxQURgqC/Gh Kn1qnNDo1dlSAHdbNU0wfDmrD4oQqfnEVkuOa/SzFDrJ7R/E5wsA0UeaQPrQC4RWaz6Z tc+A== X-Gm-Message-State: AMke39mWYc5K6qhmavEAlzVJ/Axc6k8Cp47vS4cuEestMGRqOE1VUEpYOtUxDeIljsdykK8wO2o= X-Received: by 10.28.217.83 with SMTP id q80mr36020201wmg.58.1486990223109; Mon, 13 Feb 2017 04:50:23 -0800 (PST) Received: from localhost.localdomain ([193.202.22.66]) by smtp.gmail.com with ESMTPSA id w70sm13686350wrc.47.2017.02.13.04.50.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Feb 2017 04:50:22 -0800 (PST) From: Bogdan Pricope To: lng-odp@lists.linaro.org Date: Mon, 13 Feb 2017 14:50:34 +0200 Message-Id: <1486990234-20622-1-git-send-email-bogdan.pricope@linaro.org> X-Mailer: git-send-email 1.9.1 Subject: [lng-odp] [PATCH 4/5] test: generator: use multiple RX queue in receiving mode 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" Signed-off-by: Bogdan Pricope --- example/generator/odp_generator.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index fbd3ec0..8ed3b4b 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -383,9 +383,11 @@ static odp_packet_t pack_icmp_pkt(odp_pool_t pool, odp_packet_t pkt_ref) * @return The handle of the created pktio object. * @warning This routine aborts if the create is unsuccessful. */ -static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool) +static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool, + unsigned num_rx_queues) { odp_pktio_t pktio; + odp_pktio_capability_t capa; int ret; odp_pktio_param_t pktio_param; odp_pktin_queue_param_t pktin_param; @@ -401,7 +403,16 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool) exit(EXIT_FAILURE); } + if (odp_pktio_capability(pktio, &capa)) { + EXAMPLE_ERR("Error: Failed to get interface capabilities %s\n", + dev); + exit(EXIT_FAILURE); + } + if (num_rx_queues > capa.max_input_queues) + num_rx_queues = capa.max_input_queues; + odp_pktin_queue_param_init(&pktin_param); + pktin_param.num_queues = num_rx_queues; pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC; if (odp_pktin_queue_config(pktio, &pktin_param)) { @@ -748,6 +759,7 @@ int main(int argc, char *argv[]) odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int num_workers; + unsigned num_rx_queues; int i; odp_shm_t shm; odp_cpumask_t cpumask; @@ -871,8 +883,15 @@ int main(int argc, char *argv[]) pktio = malloc(sizeof(odp_pktio_t) * args->appl.if_count); + if (args->appl.mode == APPL_MODE_PING || + args->appl.mode == APPL_MODE_UDP) + num_rx_queues = 1; + else + num_rx_queues = num_workers; + for (i = 0; i < args->appl.if_count; ++i) - pktio[i] = create_pktio(args->appl.if_names[i], pool); + pktio[i] = create_pktio(args->appl.if_names[i], pool, + num_rx_queues); /* Create and init worker threads */ memset(thread_tbl, 0, sizeof(thread_tbl));