From patchwork Tue Oct 10 09:00:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 115364 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp3277930edb; Tue, 10 Oct 2017 02:00:56 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDnfVW6Lc0qlMFVTN50RNeqcHKKnhPDpLeEHHgcMvoC6rJwFZP58rWwdmjqaOWtG7cpli/P X-Received: by 10.36.54.195 with SMTP id l186mr16549913itl.37.1507626055913; Tue, 10 Oct 2017 02:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507626055; cv=none; d=google.com; s=arc-20160816; b=jQV2bsRjgUZLkiPjVWgxNhGc/y3eyGHloOvt9NR3Yr7zFl5U6T07fIdVIYIJG2EqWi mXBsdFk1iJRfCniQEgJWvcjqiBQcGbM+OS7hLIBp++YQJttAmbpsVBuFPwvmYiO2xIlx 6oWEzOUB7ZbjjZ5yUh9HhsICMFkGDeL40Oe5bnHKzpYU54Jsy/LwqMFpo5mB5AZaA3Vr pBTJVFggUUHtEDJW0evJIFA0lThRKrImIauHNMzAsX/gVMCMx+yfrlap8OFI0gaP/dxj itsmHoO1y+QyHzvai/1PgXlPcnUPd21+4VFR/wWK8aNJqJBQS/xI6EFgRZOhsKE0JcLy VjNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=Bj9u6fkjYs7GFi3bvdp3RIusmZzXWEcgIbyg4vyffXA=; b=w3RHiWh/l/sNKF8FoXwqV1SpKSkyCO/j2DCbROFkfX46EEKoomO7uoqc2tIMuTu6GK pO92Kt0/La1rpMW6Tjje03AXI8SO3uKx32k92Yuj4kz07yPMDbSnLto13+PLufqN/A+S mUmWHIgSkoBWLGJRhW56yb69/IAI9rhaTTjhRMqvBqIjj4fUMY7WN6CbWVHnJaQXDyFZ SnZGC6U+3mpQb9fLM+YqHjCiVrS28T4Q81ijwap1sctE3jFBI40Ulg0XCf+PK3OJNDWb 5iULQ6l6Ck0EQkcoEGPL8LM1hBpt+6AfaDodkou6xDI4qZxb8Lnb/zCf4d30TYc7Q2J+ 5EnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g141si6729969itg.13.2017.10.10.02.00.55; Tue, 10 Oct 2017 02:00:55 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id EEC6560C1F; Tue, 10 Oct 2017 09:00:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 36B90607A9; Tue, 10 Oct 2017 09:00:46 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 9BE3460BFB; Tue, 10 Oct 2017 09:00:43 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id B591760BF6 for ; Tue, 10 Oct 2017 09:00:41 +0000 (UTC) Received: from mxback3o.mail.yandex.net (mxback3o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1d]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 6C001180189C for ; Tue, 10 Oct 2017 12:00:40 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback3o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Xu5Y8mBC7G-0ewS3wA1; Tue, 10 Oct 2017 12:00:40 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id drzNSBeNeN-0dRm5GVm; Tue, 10 Oct 2017 12:00:39 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 10 Oct 2017 12:00:11 +0300 Message-Id: <1507626011-15870-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507626011-15870-1-git-send-email-odpbot@yandex.ru> References: <1507626011-15870-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 203 Subject: [lng-odp] [PATCH API-NEXT v5 3/3] test: validation: pktio: validate MAC address set function X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Add validation tests for MAC address set API. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 203 (bogdanPricope:set_mac_pr) ** https://github.com/Linaro/odp/pull/203 ** Patch: https://github.com/Linaro/odp/pull/203.patch ** Base sha: bf803098eb1518dfb9e719071256fe22700b8c72 ** Merge commit sha: 9741b2bb193f1cb28f8dd4bf382bc598e1dbd5ef **/ test/common_plat/validation/api/pktio/pktio.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/common_plat/validation/api/pktio/pktio.c b/test/common_plat/validation/api/pktio/pktio.c index 6a085729b..720707358 100644 --- a/test/common_plat/validation/api/pktio/pktio.c +++ b/test/common_plat/validation/api/pktio/pktio.c @@ -1065,9 +1065,12 @@ void pktio_test_promisc(void) void pktio_test_mac(void) { unsigned char mac_addr[ODP_PKTIO_MACADDR_MAXSIZE]; + unsigned char mac_addr_ref[ODP_PKTIO_MACADDR_MAXSIZE] = { + 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0}; int mac_len; int ret; odp_pktio_t pktio; + odp_pktio_capability_t capa; pktio = create_pktio(0, ODP_PKTIN_MODE_SCHED, ODP_PKTOUT_MODE_DIRECT); @@ -1088,6 +1091,26 @@ void pktio_test_mac(void) mac_len = odp_pktio_mac_addr(pktio, mac_addr, 2); CU_ASSERT(mac_len < 0); + CU_ASSERT_FATAL(odp_pktio_capability(pktio, &capa) == 0); + if (capa.set_op.op.mac_addr) { + /* Fail case: wrong addr_size. Expected <0. */ + ret = odp_pktio_mac_addr_set(pktio, mac_addr_ref, 2); + CU_ASSERT_FATAL(ret < 0); + + ret = odp_pktio_mac_addr_set(pktio, mac_addr_ref, + ODPH_ETHADDR_LEN); + CU_ASSERT_FATAL(ret == 0); + + mac_len = odp_pktio_mac_addr(pktio, mac_addr, + ODPH_ETHADDR_LEN); + CU_ASSERT(ODPH_ETHADDR_LEN == mac_len); + + CU_ASSERT(odp_memcmp(mac_addr_ref, mac_addr, + ODPH_ETHADDR_LEN) == 0); + } else + printf("\n mac address set not supported for %s!\n", + iface_name[0]); + ret = odp_pktio_close(pktio); CU_ASSERT(0 == ret); }