From patchwork Fri Sep 4 09:55:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 53077 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 032222159E for ; Fri, 4 Sep 2015 09:59:27 +0000 (UTC) Received: by lbbmp1 with SMTP id mp1sf5146695lbb.2 for ; Fri, 04 Sep 2015 02:59:26 -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=xBzi5LOw3KQmtro7D8LekQkhE877ySAI7WXGQvi+XEk=; b=WutLZsFRiE6D1IHoynCBOkGBcRzn5T2HvgqPeWx/LqpxnXlA1+upxv/5KtIIeRwTiP 9YObEKBnI8Y6vDQ77t+xqaQnDIWH3Bw+vwMIqz81wXeAFGko9OHcBwURivEDMoWUSV1e GnQ4TNTDfTZ71u/PJbEdYP2x3vgLM2njFwRKIyXpW+g79xtAtpo8DWpLI9qjeF83d4FN ElDBgKqu9OSPv/IXCkoRvFcKUHuVOHmaNl7+YFcAeoxQATHpRlugZ7EtcUidTvduMhbJ Z1+NBxm4+b36+dF7cCRFF7ChM7gNQacjgX0v0t9mUON/COkxbHAZ8CmjkUo/O3YZIeJV rbPw== X-Gm-Message-State: ALoCoQn+HhE+D80gk/VtjsF8mj5AEg4rtS0kE7scpKsO9zmXpDUtxGUFXzdhAITUZcVZrUaWMcS/ X-Received: by 10.112.199.5 with SMTP id jg5mr806191lbc.14.1441360766007; Fri, 04 Sep 2015 02:59:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.227 with SMTP id n3ls340149lan.0.gmail; Fri, 04 Sep 2015 02:59:25 -0700 (PDT) X-Received: by 10.152.22.133 with SMTP id d5mr2863442laf.112.1441360765850; Fri, 04 Sep 2015 02:59:25 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id kq1si1849362lac.46.2015.09.04.02.59.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Sep 2015 02:59:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbpo4 with SMTP id o4so8388705lbp.2 for ; Fri, 04 Sep 2015 02:59:25 -0700 (PDT) X-Received: by 10.112.125.34 with SMTP id mn2mr2661014lbb.76.1441360765746; Fri, 04 Sep 2015 02:59:25 -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.164.42 with SMTP id yn10csp1839187lbb; Fri, 4 Sep 2015 02:59:24 -0700 (PDT) X-Received: by 10.140.84.111 with SMTP id k102mr3706803qgd.105.1441360764767; Fri, 04 Sep 2015 02:59:24 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j132si2250108qhc.13.2015.09.04.02.59.22; Fri, 04 Sep 2015 02:59:24 -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 BB763619C5; Fri, 4 Sep 2015 09:59:22 +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 D77DA61B6C; Fri, 4 Sep 2015 09:57:06 +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 A958F619B9; Fri, 4 Sep 2015 09:56:55 +0000 (UTC) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by lists.linaro.org (Postfix) with ESMTPS id A7EB46195C for ; Fri, 4 Sep 2015 09:56:23 +0000 (UTC) Received: by wibz8 with SMTP id z8so11957678wib.1 for ; Fri, 04 Sep 2015 02:56:22 -0700 (PDT) X-Received: by 10.180.74.47 with SMTP id q15mr2484924wiv.73.1441360582864; Fri, 04 Sep 2015 02:56:22 -0700 (PDT) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id vl1sm3083000wjc.0.2015.09.04.02.56.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Sep 2015 02:56:22 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Fri, 4 Sep 2015 10:55:45 +0100 Message-Id: <1441360547-18999-5-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1441360547-18999-1-git-send-email-stuart.haslam@linaro.org> References: <1441360547-18999-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 5/7] 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-Removed-Original-Auth: Dkim didn't pass. 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 209.85.217.178 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org 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 50cd901..c74fab3 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]; memset(&pktio_param, 0, sizeof(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; @@ -520,7 +520,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); mtu = odp_pktio_mtu(pktio); CU_ASSERT(mtu > 0); @@ -534,7 +534,7 @@ void pktio_test_mtu(void) 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); ret = odp_pktio_promisc_mode_set(pktio, 1); CU_ASSERT(0 == ret); @@ -561,7 +561,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); mac_len = odp_pktio_mac_addr(pktio, mac_addr, sizeof(mac_addr)); CU_ASSERT(ODPH_ETHADDR_LEN == mac_len); @@ -582,7 +582,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(pktio != ODP_PKTIO_INVALID); CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0); inq = odp_pktio_inq_getdef(pktio); @@ -610,7 +610,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(pktio != ODP_PKTIO_INVALID); CU_ASSERT(odp_pktio_close(pktio) == 0); } @@ -649,7 +649,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(pktio != ODP_PKTIO_INVALID); CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0); @@ -668,7 +668,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(pktio[i] != ODP_PKTIO_INVALID); create_inq(pktio[i], ODP_QUEUE_TYPE_SCHED); }