From patchwork Mon Mar 20 07:28:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bogdan Pricope X-Patchwork-Id: 95472 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp816502qgd; Mon, 20 Mar 2017 00:30:05 -0700 (PDT) X-Received: by 10.36.88.202 with SMTP id f193mr7685642itb.14.1489995005625; Mon, 20 Mar 2017 00:30:05 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m206si16882410ioa.155.2017.03.20.00.30.05; Mon, 20 Mar 2017 00:30:05 -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 sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 2C71860F06; Mon, 20 Mar 2017 07:30:05 +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 1F5C762DA7; Mon, 20 Mar 2017 07:29:04 +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 3BFE560EE5; Mon, 20 Mar 2017 07:28:56 +0000 (UTC) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by lists.linaro.org (Postfix) with ESMTPS id 049C463E78 for ; Mon, 20 Mar 2017 07:28:50 +0000 (UTC) Received: by mail-wm0-f50.google.com with SMTP id n11so55996489wma.1 for ; Mon, 20 Mar 2017 00:28:49 -0700 (PDT) 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:in-reply-to :references; bh=0yWhOFiYsdO4Mi46ZvTrKD61NKhwtsFjNNWdnLRJK/Q=; b=YRwNll3MKWuM4zSssqh+9ewuzuQBkxIeJo56FqeF7hbzSoxN53gYLGuvQhiWgesDVW 3rLP78MJY3NmxallV+eEFpSw29iBnmHFL0ujHFUivPhxuiS31pacW2rURzrh+ITMu3Bn bIwk2ACc6bDaM7/IEa2LYGMx6EoUWTVc1NcIQnMnZaUnX2SkpE/D732+1qoloeDu23Vg tdfK/jpW9X2OkZVNrvK9xLkvTOD8xMHnS4tdObq+/cY8S5Zczqw7MUBxayYi7ekRc93+ F/TfSqN6jzepa4Z+XXf/vGL43W7w8hXMVObicMnSbdT/kXHfzKjjTsW0AmG8Mv/AsiPY ohYw== X-Gm-Message-State: AFeK/H0V7sWWu98ZxsuRyWvacM/Xv3c6hx5+5hDByePHMQJmExmP4Mitg46RZI4Vjjk5FMXvEXo= X-Received: by 10.28.195.197 with SMTP id t188mr9016570wmf.61.1489994929143; Mon, 20 Mar 2017 00:28:49 -0700 (PDT) Received: from localhost.localdomain ([193.202.22.66]) by smtp.gmail.com with ESMTPSA id w130sm12267319wmg.0.2017.03.20.00.28.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 00:28:48 -0700 (PDT) From: Bogdan Pricope To: lng-odp@lists.linaro.org Date: Mon, 20 Mar 2017 09:28:16 +0200 Message-Id: <1489994897-6836-5-git-send-email-bogdan.pricope@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489994897-6836-1-git-send-email-bogdan.pricope@linaro.org> References: <1489994897-6836-1-git-send-email-bogdan.pricope@linaro.org> Subject: [lng-odp] [PATCHv3 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 1932852..81f89bf 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -382,9 +382,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; @@ -400,7 +402,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)) { @@ -750,6 +761,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; @@ -873,8 +885,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));