From patchwork Wed Oct 14 12:31:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 54918 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 7F65323012 for ; Wed, 14 Oct 2015 12:35:57 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf25858950wic.3 for ; Wed, 14 Oct 2015 05:35:56 -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=KWNS4G97AtJVDw1dXIWxv8PBZG7a16F5RXNkOgK2rOI=; b=musltJc+mvkQmj1lFGsxJHMkmkizG5B9dN2ad+Xd/H6YtGAxuZl6r7ESh/yTKA9mYc 84QXrhy627jhodpMOs685yz+t+7Aqa14qXHGh9hY3EpFGBjNRlzgzhw79jGJPQH3fBxx axE2QzpzqVH7ooW2smiGpo7mnupseIb3+OY8XSIq6D9dh6x9Jyf9GRGhW0G8uKRP/joJ hgMFGfnJ5EAVoWGTjoKBpAEJyeq8ux7bkjDDJNY9xf8M8mE0Crsbc5i45g41qJlNP1Jg zLGd1g1v0bKKhiPef6HL094qx1ZTRq6cxQySdTAwbPYQvIpxdJNMCDuHL76Jd1W2NK51 QajQ== X-Gm-Message-State: ALoCoQlyVDF8JecGWyF+rg3YM+JDhzewx+t348cTwXLEcKg0BocaCuDcHr1tvSXIjsJmdduyg7aA X-Received: by 10.112.150.229 with SMTP id ul5mr739109lbb.2.1444826156753; Wed, 14 Oct 2015 05:35:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.15.89 with SMTP id e86ls32242lfi.14.gmail; Wed, 14 Oct 2015 05:35:56 -0700 (PDT) X-Received: by 10.112.205.138 with SMTP id lg10mr1442508lbc.74.1444826156545; Wed, 14 Oct 2015 05:35:56 -0700 (PDT) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id p12si1339393lfe.49.2015.10.14.05.35.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2015 05:35:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lffv3 with SMTP id v3so10557408lff.0 for ; Wed, 14 Oct 2015 05:35:56 -0700 (PDT) X-Received: by 10.25.19.97 with SMTP id j94mr987949lfi.106.1444826156232; Wed, 14 Oct 2015 05:35:56 -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 w3csp2706213lbq; Wed, 14 Oct 2015 05:35:55 -0700 (PDT) X-Received: by 10.107.18.159 with SMTP id 31mr3136368ios.138.1444826155153; Wed, 14 Oct 2015 05:35:55 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w6si6983407igk.15.2015.10.14.05.35.54; Wed, 14 Oct 2015 05:35:55 -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 8A08261B7D; Wed, 14 Oct 2015 12:35:54 +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 C341561CC5; Wed, 14 Oct 2015 12:32:13 +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 95C5661A1E; Wed, 14 Oct 2015 12:31:48 +0000 (UTC) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by lists.linaro.org (Postfix) with ESMTPS id 5C95B619F5 for ; Wed, 14 Oct 2015 12:31:41 +0000 (UTC) Received: by wicge5 with SMTP id ge5so234273280wic.0 for ; Wed, 14 Oct 2015 05:31:40 -0700 (PDT) X-Received: by 10.180.82.41 with SMTP id f9mr25004521wiy.77.1444825900600; Wed, 14 Oct 2015 05:31:40 -0700 (PDT) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id ly4sm9789462wjb.4.2015.10.14.05.31.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Oct 2015 05:31:40 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Wed, 14 Oct 2015 13:31:26 +0100 Message-Id: <1444825888-29381-4-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1444825888-29381-1-git-send-email-stuart.haslam@linaro.org> References: <1444825888-29381-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 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-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.215.50 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 118fe89..702e5d0 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); printf("testing mac for %s\n", iface_name[0]); @@ -588,7 +588,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); @@ -616,7 +616,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); } @@ -655,7 +655,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); @@ -674,7 +674,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); }