From patchwork Tue Oct 27 16:42:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 55645 Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1905674lbq; Tue, 27 Oct 2015 09:48:02 -0700 (PDT) X-Received: by 10.50.70.40 with SMTP id j8mr25209776igu.70.1445964481890; Tue, 27 Oct 2015 09:48:01 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 130si16425999ioo.129.2015.10.27.09.48.01; Tue, 27 Oct 2015 09:48:01 -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; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 11CDB61E53; Tue, 27 Oct 2015 16:48:01 +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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 483F561E6D; Tue, 27 Oct 2015 16:45: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 AEF3261D82; Tue, 27 Oct 2015 16:44:43 +0000 (UTC) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by lists.linaro.org (Postfix) with ESMTPS id 6413761E4F for ; Tue, 27 Oct 2015 16:42:37 +0000 (UTC) Received: by wicll6 with SMTP id ll6so168998150wic.1 for ; Tue, 27 Oct 2015 09:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=qsNfav3Xpt4B4tujrayo946nAcDROoWI8peZxwI4WNU=; b=OIL8AdirNKwmvmDZoU2VHu4obRh8M/vO9t4CanC1mgNOLiIOvW45E1L3rbJRnMaof8 Z21aV+VM7YKmjnqQaSvCuKRsQfO/1jjBLcUXOwa8XGsK4sMQ4QzDmk3YwEGRnWbs/Uny LX86XmMG2moag+Ct90WOM+vzm9Gl9YKSz4XB6L0imdhlNLxR/ilCa7l5yPDsWKX6vXET kNFyzxWVxHLhiNw3S7y8iadIaoZmRgi8haEb4zYh5VyR3V1Gh/B2md8bG5X1fNtmOQ10 frP1rVtrn+K+nPB7WdJaEfQh47xDtaXLF6soN5rbubJ4AiUOB+pYKZsIM8wpYiUjoXMM EFzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=qsNfav3Xpt4B4tujrayo946nAcDROoWI8peZxwI4WNU=; b=WYYA6HuG+6Pp1leARsv46cmC3CdiCvuVjV7834JeP0sch4nx/H4m/lmbHbGlp8QvfU rE0EQDkrgjdOVm7R4svmWKLUqK8vMP1E7YpNj1o8qkUStj8ss2n1E5cTd5GK2gTZdBHY lbd6roQVOoQ+dmYyl8UyyKAqyxSPYyr/vUDfVg/lLaQYh55OS/KKdqru2mWu2n7WDvLp iVpC0tEfHC8qpUBtn+0QJse01WmMvJ/ADzcupuhU2YLCy3uIfBNVRIT4UdELUOF3O6nN rag/LoUUSU6ydx64yO0coyawTFAIM6ma+MvuZ3GHlxGWi6UeZSWLBJs0u0lDUnk7kn88 Vf7w== X-Gm-Message-State: ALoCoQkKgRjxi2/tLW4qiUYwRzSIYKkvtKmWEN9hfF+LO+vfig/AGXP/+U3gOSKEnEPlS/BmIL6g X-Received: by 10.180.210.210 with SMTP id mw18mr28848195wic.23.1445964156604; Tue, 27 Oct 2015 09:42:36 -0700 (PDT) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id q8sm18359749wiz.23.2015.10.27.09.42.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Oct 2015 09:42:36 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Tue, 27 Oct 2015 16:42:03 +0000 Message-Id: <1445964125-21658-4-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1445964125-21658-1-git-send-email-stuart.haslam@linaro.org> References: <1445964125-21658-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv5 3/5] validation: pktio: pass interface index rather than name 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" Avoid the need to pass the interface name to the create_pktio() function as it can be derived from the index which must also be passed. This means the caller can't make the mistake of passing a mismatched name and index - there was one instance of this which is now fixed. Signed-off-by: Stuart Haslam --- test/validation/pktio/pktio.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c index a746b9a..14c1f5e 100644 --- a/test/validation/pktio/pktio.c +++ b/test/validation/pktio/pktio.c @@ -250,11 +250,11 @@ static int default_pool_create(void) return 0; } -static odp_pktio_t create_pktio(const char *iface, odp_queue_type_t q_type, - int num) +static odp_pktio_t create_pktio(int iface_idx, odp_queue_type_t q_type) { odp_pktio_t pktio; odp_pktio_param_t pktio_param; + const char *iface = iface_name[iface_idx]; odp_pktio_param_init(&pktio_param); @@ -263,7 +263,7 @@ static odp_pktio_t create_pktio(const char *iface, odp_queue_type_t q_type, else pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; - pktio = odp_pktio_open(iface, pool[num], &pktio_param); + pktio = odp_pktio_open(iface, pool[iface_idx], &pktio_param); if (pktio == ODP_PKTIO_INVALID) pktio = odp_pktio_lookup(iface); CU_ASSERT(pktio != ODP_PKTIO_INVALID); @@ -461,7 +461,7 @@ static void test_txrx(odp_queue_type_t q_type, int num_pkts) io = &pktios[i]; io->name = iface_name[i]; - io->id = create_pktio(iface_name[i], q_type, i); + io->id = create_pktio(i, q_type); if (io->id == ODP_PKTIO_INVALID) { CU_FAIL("failed to open iface"); return; @@ -521,7 +521,7 @@ void pktio_test_mtu(void) int ret; int mtu; - odp_pktio_t pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); + odp_pktio_t pktio = create_pktio(0, ODP_QUEUE_TYPE_SCHED); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); mtu = odp_pktio_mtu(pktio); @@ -537,7 +537,7 @@ void pktio_test_promisc(void) { int ret; - odp_pktio_t pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); + odp_pktio_t pktio = create_pktio(0, ODP_QUEUE_TYPE_SCHED); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); ret = odp_pktio_promisc_mode_set(pktio, 1); @@ -565,7 +565,7 @@ void pktio_test_mac(void) int ret; odp_pktio_t pktio; - pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); + pktio = create_pktio(0, ODP_QUEUE_TYPE_SCHED); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); printf("testing mac for %s\n", iface_name[0]); @@ -593,7 +593,7 @@ void pktio_test_inq_remdef(void) uint64_t wait; int i; - pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); + pktio = create_pktio(0, ODP_QUEUE_TYPE_SCHED); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0); inq = odp_pktio_inq_getdef(pktio); @@ -621,7 +621,7 @@ void pktio_test_open(void) /* test the sequence open->close->open->close() */ for (i = 0; i < 2; ++i) { - pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); + pktio = create_pktio(0, ODP_QUEUE_TYPE_SCHED); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); CU_ASSERT(odp_pktio_close(pktio) == 0); } @@ -660,7 +660,7 @@ void pktio_test_inq(void) { odp_pktio_t pktio; - pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0); + pktio = create_pktio(0, ODP_QUEUE_TYPE_SCHED); CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0); @@ -679,7 +679,7 @@ static void pktio_test_start_stop(void) uint64_t wait = odp_schedule_wait_time(ODP_TIME_MSEC); for (i = 0; i < num_ifaces; i++) { - pktio[i] = create_pktio(iface_name[i], ODP_QUEUE_TYPE_SCHED, 0); + pktio[i] = create_pktio(i, ODP_QUEUE_TYPE_SCHED); CU_ASSERT_FATAL(pktio[i] != ODP_PKTIO_INVALID); create_inq(pktio[i], ODP_QUEUE_TYPE_SCHED); }