From patchwork Mon Dec 22 14:52: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: 42524 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CD9B425BA1 for ; Mon, 22 Dec 2014 14:52:48 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id hs14sf2998253lab.9 for ; Mon, 22 Dec 2014 06:52:47 -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: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=KoFaFOZPkCruGWyZedejeaAuMqxORX67u6nFYY/bA/M=; b=mOiwiiV+apoR+ccOjWJgGIIsx8Uxc0U0LCya5SEy4jEA8G6N8bGoGkO5uo7AtFyze0 7U0IIBq4FMbWZlV0ItevNbY+v5zZm7TmqC9hScQQE8wAb8y6VbpOW/j4KsHZYeSVWpFD v5pkkOb/oI91axq9FAFqtvRQb9f0DgyQfAodBuO9USHXshgwqsjcDwnYteV6Tm8bM6DY 4I0mh7kGTsxdTGv0J5vA37ahmQ/NwDpuUJKuoDCEFKk3+qdkejpE8zzIZQSN9JPFByn8 ovelpLjDClyAh+XW7G5TjIG/nkOnaIQDw3RkRK/i7naxNply0XNMCQwgNFLXh7wL99a+ Hl9w== X-Gm-Message-State: ALoCoQnmkN/66zkwLczXC2Gy4YvMhiYNN3meFPK4A7KxjTsteH7+8CX7zFxZDo7WEOLT+qUlna3H X-Received: by 10.112.188.199 with SMTP id gc7mr887655lbc.6.1419259966638; Mon, 22 Dec 2014 06:52:46 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.242.129 with SMTP id wq1ls194795lac.56.gmail; Mon, 22 Dec 2014 06:52:46 -0800 (PST) X-Received: by 10.152.5.198 with SMTP id u6mr22752205lau.42.1419259966425; Mon, 22 Dec 2014 06:52:46 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id cr10si18742113lad.33.2014.12.22.06.52.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Dec 2014 06:52:46 -0800 (PST) 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 mail-la0-f50.google.com with SMTP id pn19so4181227lab.9 for ; Mon, 22 Dec 2014 06:52:45 -0800 (PST) X-Received: by 10.112.136.69 with SMTP id py5mr21871354lbb.56.1419259965918; Mon, 22 Dec 2014 06:52:45 -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 ru5csp1049242lbb; Mon, 22 Dec 2014 06:52:45 -0800 (PST) X-Received: by 10.140.38.139 with SMTP id t11mr25198072qgt.83.1419259964906; Mon, 22 Dec 2014 06:52:44 -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 l9si20156478qgd.112.2014.12.22.06.52.43 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Dec 2014 06:52:44 -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 1Y34Lf-0007rI-Of; Mon, 22 Dec 2014 14:52:39 +0000 Received: from mail-la0-f41.google.com ([209.85.215.41]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y34LY-0007px-SW for lng-odp@lists.linaro.org; Mon, 22 Dec 2014 14:52:33 +0000 Received: by mail-la0-f41.google.com with SMTP id hv19so4094286lab.0 for ; Mon, 22 Dec 2014 06:52:27 -0800 (PST) X-Received: by 10.112.168.164 with SMTP id zx4mr22477938lbb.28.1419259947205; Mon, 22 Dec 2014 06:52:27 -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 h7sm5088971lbl.41.2014.12.22.06.52.25 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Dec 2014 06:52:26 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 22 Dec 2014 17:52:16 +0300 Message-Id: <1419259936-4361-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 X-Topics: patch Subject: [lng-odp] [PATCHv8] 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.50 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 Reviewed-by: Mike Holmes --- v8: fixed Mike's comments 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..ea721a8 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 test_odp_pktio_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 test_odp_pktio_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); + + /* Verify that promisc mode set */ + ret = odp_pktio_promisc_mode(pktio); + CU_ASSERT(1 == ret); + + ret = odp_pktio_promisc_mode_set(pktio, 0); + CU_ASSERT(0 == ret); + + /* Verify that promisc mode is not set */ + ret = odp_pktio_promisc_mode(pktio); + CU_ASSERT(0 == ret); + + ret = odp_pktio_close(pktio); + CU_ASSERT(ret == 0); + + return; +} + +static void test_odp_pktio_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: wrong addr_size. Expected 0. */ + mac_len = odp_pktio_mac_addr(pktio, mac_addr, 2); + CU_ASSERT(0 == mac_len); + + ret = odp_pktio_close(pktio); + CU_ASSERT(0 == ret); + + 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", test_odp_pktio_mtu}, + {"pktio promisc mode", test_odp_pktio_promisc}, + {"pktio mac", test_odp_pktio_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 };