From patchwork Fri Oct 23 09:16:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 55469 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f71.google.com (mail-lf0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id F147820581 for ; Fri, 23 Oct 2015 09:19:15 +0000 (UTC) Received: by lffv3 with SMTP id v3sf45605322lff.1 for ; Fri, 23 Oct 2015 02:19:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=JISQs8+kkcGkVrLT76Vmz++/ZB0d/5c4F3iIryDjkGY=; b=AmP46r6f57aj1rQrwdtGoHVz+Q1Xl/TBjsXf8UpxSoLNHNU0z8M5kEcJAxBTk78sSp nvKfoOS1oJ2ZsFJe7wA6mF+ANGPmLJM5+J3aUonqZy8niHxGiJg3VNOd+dE2w/pB4qGX 2sVB6Dqg+JK+5LDMy4TdoZ3o6dwPMu08mRV6719chG5uQgiqo90pXrdTH8Uc3TNOx9Mn 5wsykgvt6fUKm5MQUFynxRnjgpXPtGDWQG9ttbV3TOJjz6ZES5VXtJM1560WZZJB+NtO yqbSmIbveWph3F3iJPg/xALE0WaYl+vWjO7GYdhvZ861LX1B+rRhtWkgtuUwC36+IGcx cNtg== X-Gm-Message-State: ALoCoQkD3GT23mk+VaRY3QsauXLW0iqAstsXpEV1lSXJ9Dj+GKIxWk+H4nlXp4EGeEXb4zzrt7Sp X-Received: by 10.194.248.131 with SMTP id ym3mr4680647wjc.7.1445591954943; Fri, 23 Oct 2015 02:19:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.41.4 with SMTP id p4ls373181lfp.58.gmail; Fri, 23 Oct 2015 02:19:14 -0700 (PDT) X-Received: by 10.112.170.35 with SMTP id aj3mr10670418lbc.108.1445591954788; Fri, 23 Oct 2015 02:19:14 -0700 (PDT) Received: from mail-lf0-x22b.google.com (mail-lf0-x22b.google.com. [2a00:1450:4010:c07::22b]) by mx.google.com with ESMTPS id s71si12136913lfs.95.2015.10.23.02.19.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 02:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c07::22b as permitted sender) client-ip=2a00:1450:4010:c07::22b; Received: by lfaz124 with SMTP id z124so76661058lfa.1 for ; Fri, 23 Oct 2015 02:19:14 -0700 (PDT) X-Received: by 10.25.28.73 with SMTP id c70mr5838895lfc.76.1445591954647; Fri, 23 Oct 2015 02:19:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1093398lbq; Fri, 23 Oct 2015 02:19:13 -0700 (PDT) X-Received: by 10.140.107.228 with SMTP id h91mr23293427qgf.48.1445591952691; Fri, 23 Oct 2015 02:19:12 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w15si17640871qha.131.2015.10.23.02.19.12; Fri, 23 Oct 2015 02:19:12 -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; Received: by lists.linaro.org (Postfix, from userid 109) id 5B41E62C8E; Fri, 23 Oct 2015 09:19:12 +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 6C6BD62C97; Fri, 23 Oct 2015 09:17:26 +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 7726C62C96; Fri, 23 Oct 2015 09:17:20 +0000 (UTC) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by lists.linaro.org (Postfix) with ESMTPS id 312BC62C6F for ; Fri, 23 Oct 2015 09:17:16 +0000 (UTC) Received: by wicfx6 with SMTP id fx6so22479382wic.1 for ; Fri, 23 Oct 2015 02:17:15 -0700 (PDT) X-Received: by 10.180.76.170 with SMTP id l10mr3464569wiw.68.1445591835412; Fri, 23 Oct 2015 02:17:15 -0700 (PDT) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id jt9sm6422177wjc.24.2015.10.23.02.17.14 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Oct 2015 02:17:14 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Fri, 23 Oct 2015 10:16:50 +0100 Message-Id: <1445591812-10857-4-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1445591812-10857-1-git-send-email-stuart.haslam@linaro.org> References: <1445591812-10857-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv4 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: 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" X-Original-Sender: stuart.haslam@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c07::22b as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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); }