From patchwork Fri Dec 19 11:46:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 42489 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 2DACC26C68 for ; Fri, 19 Dec 2014 11:47:28 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id l18sf547070wgh.2 for ; Fri, 19 Dec 2014 03:47:27 -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=4v2lJXg5zCm5cqYVJ6PvIBVU4I3X3dilcTug4+TkT0A=; b=UVOTQQX2G19eKrOzUjdeSTHINipsuIoJEkIiXIBgNWj1+HH9g4dJvjwagCCyiKyzA/ wlaqQ1Sepdk6sMdUfT/Bjc6ViK7m1of/kIFr6lTtTqLsTBDfuEVA9ME7gNtQohqjZ889 BBWDwosSjhYn8+aXHN7bAj5trS6poSr0oGENRID/nSHdzzL+JwfymSefQwZJpvPgUsWS z9M5sWv2BzfWoWO5dLhSnC57yLGgcLRlEhXni3vGnkgCRNUWrmLu4QyHu+Aamn8AFKeh +q7ls1aHFfhPfW/sICR+UFozJqMmifJNHPtTiXFUkt2dwc3q9vW5lWP5KNd4oj65yUzV N+8Q== X-Gm-Message-State: ALoCoQk8/VqNcGqrPD3LwNHY88MM/XW/R/0jZ4+ak32oWuhnDhSLRR2gPWisM8y4CleMGFMeNR/M X-Received: by 10.152.170.201 with SMTP id ao9mr284337lac.5.1418989647413; Fri, 19 Dec 2014 03:47:27 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.227 with SMTP id v3ls1334487lav.91.gmail; Fri, 19 Dec 2014 03:47:27 -0800 (PST) X-Received: by 10.152.207.37 with SMTP id lt5mr7374381lac.66.1418989647203; Fri, 19 Dec 2014 03:47:27 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id je12si9705560lac.90.2014.12.19.03.47.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 03:47:27 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so682934lbv.12 for ; Fri, 19 Dec 2014 03:47:27 -0800 (PST) X-Received: by 10.152.197.5 with SMTP id iq5mr7420449lac.6.1418989647125; Fri, 19 Dec 2014 03:47:27 -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 ru5csp241973lbb; Fri, 19 Dec 2014 03:47:26 -0800 (PST) X-Received: by 10.140.107.52 with SMTP id g49mr12029429qgf.38.1418989645594; Fri, 19 Dec 2014 03:47:25 -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 c108si6222500qga.84.2014.12.19.03.47.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 19 Dec 2014 03:47:25 -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 1Y1w1i-0006jB-Fp; Fri, 19 Dec 2014 11:47:22 +0000 Received: from mail-lb0-f181.google.com ([209.85.217.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1w1N-0006fi-49 for lng-odp@lists.linaro.org; Fri, 19 Dec 2014 11:47:01 +0000 Received: by mail-lb0-f181.google.com with SMTP id l4so648542lbv.26 for ; Fri, 19 Dec 2014 03:46:55 -0800 (PST) X-Received: by 10.112.172.162 with SMTP id bd2mr7360449lbc.87.1418989615419; Fri, 19 Dec 2014 03:46:55 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id z4sm2474524laz.8.2014.12.19.03.46.53 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 03:46:54 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 19 Dec 2014 14:46:41 +0300 Message-Id: <1418989601-14300-5-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1418989601-14300-1-git-send-email-maxim.uvarov@linaro.org> References: <1418989601-14300-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv7 4/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.217.181 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 | 89 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 80 insertions(+), 9 deletions(-) diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index f7dc80b..4e3cc00 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -403,6 +403,74 @@ static void test_odp_pktio_sched_multi(void) pktio_test_txrx(ODP_QUEUE_TYPE_SCHED, 4); } +static void pktio_test_mtu(void) +{ + int ret; + int mtu; + odp_pktio_t pktio = create_pktio(iface_name[0]); + + mtu = odp_pktio_mtu(pktio); + CU_ASSERT(mtu > 0); + + printf(" %d ", mtu); + + 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 +551,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 };