From patchwork Thu Dec 18 11:26:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 42423 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2D7A426C8B for ; Thu, 18 Dec 2014 11:27:14 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf619511lab.0 for ; Thu, 18 Dec 2014 03:27:13 -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=KrSf4yHSwSJWuk0qbqJnkjzoJvCwGRNh7Bnu2dv7bcqG3HhLEhsy/59vv7LZWChWPi kMLfgTG7xsm4LsD8eI5dOXaVESsIpbwHNvDqo08m2lkL9/FEkAsjSMdaNXNyfHlXpfCX doV8obE+cm+RN1c3bgdWHJ3D0hJBQfoZw0x/aAH7A0vyW9c9VZDc3uGK5Kq1qUtpAmri Wdz0nhlsg3M17bAARv6TOU9v0Tp+tk07p65YOT+hckPqXY7pE/dL9TnTL2QuVj/VPaHQ q2+hNS3k/I5ISwKwpuNFICOvT669d7KKaoM1w4WiOjci11j48d1QaefIWE7ezgcJq5Sw W84g== X-Gm-Message-State: ALoCoQlahUCM2dWvdMqE5s4tWIHctQY6zZYEbVYIJXf122g3zOHzyLQtGeOMoALAe1uJUGI6XkyA X-Received: by 10.180.77.167 with SMTP id t7mr21015wiw.6.1418902033075; Thu, 18 Dec 2014 03:27:13 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.6.34 with SMTP id cr2ls1154032lad.30.gmail; Thu, 18 Dec 2014 03:27:12 -0800 (PST) X-Received: by 10.152.44.193 with SMTP id g1mr1663561lam.15.1418902032616; Thu, 18 Dec 2014 03:27:12 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id bj4si6610366lbc.26.2014.12.18.03.27.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 03:27:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id s18so808509lam.30 for ; Thu, 18 Dec 2014 03:27:12 -0800 (PST) X-Received: by 10.112.135.6 with SMTP id po6mr1653685lbb.69.1418902032514; Thu, 18 Dec 2014 03:27:12 -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 ru5csp1672014lbb; Thu, 18 Dec 2014 03:27:11 -0800 (PST) X-Received: by 10.140.102.144 with SMTP id w16mr2232178qge.59.1418902030718; Thu, 18 Dec 2014 03:27:10 -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 d7si7824568qge.72.2014.12.18.03.27.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Dec 2014 03:27:10 -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 1Y1ZEa-0006do-Iz; Thu, 18 Dec 2014 11:27:08 +0000 Received: from mail-la0-f49.google.com ([209.85.215.49]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1ZEJ-0006YF-2X for lng-odp@lists.linaro.org; Thu, 18 Dec 2014 11:26:51 +0000 Received: by mail-la0-f49.google.com with SMTP id hs14so791152lab.22 for ; Thu, 18 Dec 2014 03:26:45 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr1655811lbc.23.1418902005537; Thu, 18 Dec 2014 03:26:45 -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 pn7sm360365lbb.6.2014.12.18.03.26.43 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 03:26:44 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 18 Dec 2014 14:26:28 +0300 Message-Id: <1418901989-30502-4-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1418901989-30502-1-git-send-email-maxim.uvarov@linaro.org> References: <1418901989-30502-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv5 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.43 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 };