From patchwork Thu Dec 18 11:04:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 42416 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 33EAE26C6B for ; Thu, 18 Dec 2014 11:04:59 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id l18sf585192wgh.6 for ; Thu, 18 Dec 2014 03:04:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state: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=B8zRLzaWxTAetiNMr804WzJ8cRBZj89gHk1xVvWlMRE=; b=mGxYBNOFI7bl02aGfUtDfsFDO58i6FIYCO139+mY3NAphajdphfRvNVE4iGu5tbW41 mBu72qIlHrY2kgVvMehCuMji2010x3C8mBiwlFcO2L5UUBypqENqamuJcHX3P9zNbUNC eTVaEVMRO1UnX70J4IVZ9ch+dbXsCHj6J+90fWdk65jTnt8EdQ8VvcFyPpTeuO98zvXv ePfSp9q1Pt6SrOuqyzz/7K31RGs1r6VarlApYBMSyeSaAOKfGxuXbRwcloHiNf1/2uQb ZFURNEJ8U5GZGKOCwSJWCL8phg01vdeGl6XnXWGSVJP0lj6Tm+fu0f2WN57GyYy1GOYI 2xRQ== X-Gm-Message-State: ALoCoQn/cLrWSEIJZueK2u8gb93QsK3VStm1Ny7p+1jUdtcqliJPD82i/FI+7RYFxK3FL3dYDSOL X-Received: by 10.180.7.226 with SMTP id m2mr315744wia.5.1418900698494; Thu, 18 Dec 2014 03:04:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.97 with SMTP id r1ls1276497lar.0.gmail; Thu, 18 Dec 2014 03:04:58 -0800 (PST) X-Received: by 10.112.173.202 with SMTP id bm10mr1576129lbc.74.1418900698335; Thu, 18 Dec 2014 03:04:58 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id b2si6560131lbm.20.2014.12.18.03.04.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 03:04:58 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gm9so750063lab.40 for ; Thu, 18 Dec 2014 03:04:58 -0800 (PST) X-Received: by 10.112.14.6 with SMTP id l6mr1548034lbc.91.1418900698011; Thu, 18 Dec 2014 03:04:58 -0800 (PST) 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.142.69 with SMTP id ru5csp1665991lbb; Thu, 18 Dec 2014 03:04:57 -0800 (PST) X-Received: by 10.229.63.71 with SMTP id a7mr2414902qci.24.1418900696479; Thu, 18 Dec 2014 03:04:56 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id n61si7773453qge.70.2014.12.18.03.04.55 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Dec 2014 03:04:56 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1Yt4-00049N-5c; Thu, 18 Dec 2014 11:04:54 +0000 Received: from mail-la0-f48.google.com ([209.85.215.48]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1Ysn-000463-1A for lng-odp@lists.linaro.org; Thu, 18 Dec 2014 11:04:37 +0000 Received: by mail-la0-f48.google.com with SMTP id gf13so764917lab.21 for ; Thu, 18 Dec 2014 03:04:31 -0800 (PST) X-Received: by 10.112.35.234 with SMTP id l10mr1657796lbj.12.1418900671459; Thu, 18 Dec 2014 03:04:31 -0800 (PST) Received: from localhost.localdomain (ppp91-76-163-205.pppoe.mtu-net.ru. [91.76.163.205]) by mx.google.com with ESMTPSA id v4sm1676892lav.25.2014.12.18.03.04.29 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 03:04:30 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 18 Dec 2014 14:04:16 +0300 Message-Id: <1418900657-21427-4-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1418900657-21427-1-git-send-email-maxim.uvarov@linaro.org> References: <1418900657-21427-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv4 3/4] validation: pktio: add mac, promisc and mtu tests X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@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.53 as permitted sender) smtp.mail=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 Signed-off-by: Maxim Uvarov --- test/validation/odp_pktio.c | 108 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 99 insertions(+), 9 deletions(-) diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index 75a9859..a1773dd 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -403,6 +403,93 @@ static void test_odp_pktio_sched_multi(void) pktio_test_txrx(ODP_QUEUE_TYPE_SCHED, 4); } +static void pktio_test_mtu(void) +{ + int i; + int ret; + int def; + odp_pktio_t pktio = create_pktio(iface_name[0]); + + def = odp_pktio_mtu(pktio); + CU_ASSERT(def > 0); + + for (i = 9000; i > 100; i /= 2) { + printf(" %d ", i); + + ret = odp_pktio_set_mtu(pktio, i); + if (ret) { + if (i <= 1500) { + CU_ASSERT(0); + } else { + printf("(Not supported)"); + continue; + } + } + + ret = odp_pktio_mtu(pktio); + CU_ASSERT(i == ret); + } + + ret = odp_pktio_set_mtu(pktio, def); + CU_ASSERT(0 == ret); + + ret = odp_pktio_close(pktio); + CU_ASSERT(ret == 0); + + return; +} + +static void pktio_test_promisc(void) +{ + int ret; + odp_pktio_t pktio = create_pktio(iface_name[0]); + + ret = odp_pktio_promisc_mode_set(pktio, 1); + CU_ASSERT(0 == ret); + + /* Check */ + ret = odp_pktio_promisc_mode(pktio); + CU_ASSERT(1 == ret); + + ret = odp_pktio_promisc_mode_set(pktio, 0); + CU_ASSERT(0 == ret); + + /* Check */ + ret = odp_pktio_promisc_mode(pktio); + CU_ASSERT(0 == ret); + + ret = odp_pktio_close(pktio); + CU_ASSERT(ret == 0); + + return; +} + +static void pktio_test_mac(void) +{ + unsigned char mac_addr[ODPH_ETHADDR_LEN]; + size_t mac_len; + int ret; + odp_pktio_t pktio = create_pktio(iface_name[0]); + + printf("testing mac for %s\n", iface_name[0]); + + mac_len = odp_pktio_mac_addr(pktio, mac_addr, ODPH_ETHADDR_LEN); + CU_ASSERT(ODPH_ETHADDR_LEN == mac_len); + + printf(" %X:%X:%X:%X:%X:%X ", + mac_addr[0], mac_addr[1], mac_addr[2], + mac_addr[3], mac_addr[4], mac_addr[5]); + + /* Fail case */ + mac_len = odp_pktio_mac_addr(pktio, mac_addr, 2); + CU_ASSERT(0 == mac_len); + + ret = odp_pktio_close(pktio); + CU_ASSERT(ret == 0); + + return; +} + static void test_odp_pktio_open(void) { odp_pktio_t pktio; @@ -483,19 +570,22 @@ static int term_pktio_suite(void) } CU_TestInfo pktio_tests[] = { - {"pktio open", test_odp_pktio_open}, - {"pktio close", test_odp_pktio_close}, - {"pktio inq", test_odp_pktio_inq}, - {"pktio outq", test_odp_pktio_outq}, - {"pktio poll queues", test_odp_pktio_poll_queue}, - {"pktio poll multi", test_odp_pktio_poll_multi}, - {"pktio sched queues", test_odp_pktio_sched_queue}, - {"pktio sched multi", test_odp_pktio_sched_multi}, + {"pktio open", test_odp_pktio_open}, + {"pktio close", test_odp_pktio_close}, + {"pktio inq", test_odp_pktio_inq}, + {"pktio outq", test_odp_pktio_outq}, + {"pktio poll queues", test_odp_pktio_poll_queue}, + {"pktio poll multi", test_odp_pktio_poll_multi}, + {"pktio sched queues", test_odp_pktio_sched_queue}, + {"pktio sched multi", test_odp_pktio_sched_multi}, + {"pktio mtu", pktio_test_mtu}, + {"pktio promisc mode", pktio_test_promisc}, + {"pktio mac", pktio_test_mac}, CU_TEST_INFO_NULL }; CU_SuiteInfo odp_testsuites[] = { - {"odp_pktio", + {"Packet I/O", init_pktio_suite, term_pktio_suite, NULL, NULL, pktio_tests}, CU_SUITE_INFO_NULL };