From patchwork Wed Dec 17 22:41:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 42399 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 ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ECE1626C76 for ; Wed, 17 Dec 2014 22:42:39 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf128274wiv.9 for ; Wed, 17 Dec 2014 14:42:39 -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=2AllrYVpzegykuoH+feJuS1niBgl7bk+57wLCy95cA8=; b=CLsm5JRKlwurDGS9vuXiD9r8ONIap9sEZDn0CX3FyxMOHvDJ6H/8xJdMy7e1Vk4mKC EW1NIz5Q+c/Cgs6iVbAPFi+5TT5nYPrbW5Hmp8dRnwAfx2JQ4NYfweKzMF4lYW1V+foE eYV8hPrX11niNzqNm/xRnrklFC4+O6L8MvdPsauzKvU4alwPlafEZ8OhkRtqiCSH1sxe pEu2+pzhqXqo1nV8W0zWDnKT3zBqNYOtP4419ziRbUfyHNC4goVrlcBSPvegG1tFg1lm E6EZmUS5RIA+mjMqTzsENKjkb1nI4vnbawA33UODNi8ufSRrjMbzMEHCfoSg1xGmRmk9 VSeg== X-Gm-Message-State: ALoCoQnsztNkQf9Rm1+q+52mccklcz4ZB2B7bQY5t5cPpY7K80/TS49zGnsvwy2R1GJgb5QK3BY0 X-Received: by 10.180.85.72 with SMTP id f8mr1694888wiz.0.1418856159277; Wed, 17 Dec 2014 14:42:39 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.232 with SMTP id m8ls1033015laa.45.gmail; Wed, 17 Dec 2014 14:42:38 -0800 (PST) X-Received: by 10.112.183.197 with SMTP id eo5mr43416280lbc.81.1418856158875; Wed, 17 Dec 2014 14:42:38 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id h2si5098954lbd.101.2014.12.17.14.42.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 14:42:38 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id p9so24642lbv.14 for ; Wed, 17 Dec 2014 14:42:38 -0800 (PST) X-Received: by 10.112.135.229 with SMTP id pv5mr43484355lbb.52.1418856158780; Wed, 17 Dec 2014 14:42:38 -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 ru5csp1513518lbb; Wed, 17 Dec 2014 14:42:37 -0800 (PST) X-Received: by 10.224.79.212 with SMTP id q20mr81645075qak.4.1418856157241; Wed, 17 Dec 2014 14:42:37 -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 y30si6276180qge.9.2014.12.17.14.42.35 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 17 Dec 2014 14:42:37 -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 1Y1NIg-0007n4-4Y; Wed, 17 Dec 2014 22:42:34 +0000 Received: from mail-lb0-f179.google.com ([209.85.217.179]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1NII-0007j4-V6 for lng-odp@lists.linaro.org; Wed, 17 Dec 2014 22:42:11 +0000 Received: by mail-lb0-f179.google.com with SMTP id z11so17783lbi.24 for ; Wed, 17 Dec 2014 14:42:05 -0800 (PST) X-Received: by 10.152.234.140 with SMTP id ue12mr42402651lac.78.1418856125448; Wed, 17 Dec 2014 14:42:05 -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 kt7sm1265060lac.4.2014.12.17.14.42.04 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 14:42:04 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 18 Dec 2014 01:41:52 +0300 Message-Id: <1418856112-8589-4-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1418856112-8589-1-git-send-email-maxim.uvarov@linaro.org> References: <1418856112-8589-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 3/3] 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.217.169 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 | 105 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 96 insertions(+), 9 deletions(-) diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index 0ba9938..02c4a7b 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -398,6 +398,90 @@ 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]); + + printf("testing mtu for %s\n", 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); + CU_ASSERT(0 == ret); + + 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]); + + printf("testing promisc for %s\n", 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[2]; @@ -472,18 +556,21 @@ static int init_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", init_pktio_suite, NULL, NULL, NULL, pktio_tests}, + {"Packet I/O", init_pktio_suite, NULL, NULL, NULL, pktio_tests}, CU_SUITE_INFO_NULL };