From patchwork Mon Oct 9 06:00:08 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: 115179 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2192719qgn; Sun, 8 Oct 2017 23:01:50 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBjMnP2l6AbyJ6xu0rO2idM/+gCpwHG4/qoXuI1FQ1Kvg3w4FxRVjk5NY36yCYkgMnn8m2b X-Received: by 10.200.40.216 with SMTP id j24mr12784106qtj.289.1507528910083; Sun, 08 Oct 2017 23:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507528910; cv=none; d=google.com; s=arc-20160816; b=fOjsRiWqVF/DKvKhmgEogpTPgOIdBzcNaCWrGdCpaZsbUyD5ycd9tg8yKVs/ILgRj7 D5/z00Zw6ygnccjs0ALkpP5XfgotVgerUhEyqixJJbj7UylF0yPjBw6W92LSS6/1/N7G W5LfSPXtfnUmB1n/cOvm3qal/uEaO296TcKzzoiEwDoPdFO7C8K8qP82+Xfuhw6ruDs8 yZvpneW+J7FztSVPyE9wnO5J8G6IGmNDkNT2nGj8DKw/t/tvPAoDSX3r1i1y04y2acIZ oRCFkT2N7qA0rsfcIJWDVYVXcmn8fuFkfdFDSl2IMpVNDweVbkNG4g3qbBDWTeoaRGKw X1KA== 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=zNuVeByr4SHu2GNPYI02JL+xiKrBAHUiBgQ2H4nCryg=; b=OU1LZtSZXRWchT/f8+bXFQbZvZPhpvbgTY+S9eU/bnQPCD8OipbW+0Ds/WDGcxaKHn rm0Q8wX9aH8hdZyJ0bkagQNasiaXOnXpFbFJ0OzrqWXigzMJGcyuBHiA7ff0nAjFpXvj 2pKLFkcSmee1z8LiryxyuyAIHuR9PxREi3uRHdzH7Wnc2oSgGOSQ3eC/ZEk6T+R4tfdZ 4T1gWDW5Sy2JzKymsPPUJSNqTt3auCxa+bq9JjqU4VkqkeEKuz0orAsp5rSdiqjLgeXl 61IcXBgqG0uGe+HxZ0yYpxI+VHYvi/uxbIksPUixSZeWoeLOKZTM+G4oC4jBECiT2vMw 7blA== 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 88si5837465qtc.394.2017.10.08.23.01.49; Sun, 08 Oct 2017 23:01:50 -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 B9F6860B3F; Mon, 9 Oct 2017 06:01:49 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 B908060A55; Mon, 9 Oct 2017 06: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 413C8607B2; Mon, 9 Oct 2017 06:00:41 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 28221607B2 for ; Mon, 9 Oct 2017 06:00:35 +0000 (UTC) Received: from mxback3o.mail.yandex.net (mxback3o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1d]) by forward101p.mail.yandex.net (Yandex) with ESMTP id A235F6A819CC for ; Mon, 9 Oct 2017 09:00:33 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id trZZeBjFao-0XF0me8w; Mon, 09 Oct 2017 09:00:33 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id RM0lQRMRr5-0WmamLtG; Mon, 09 Oct 2017 09:00:33 +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: Mon, 9 Oct 2017 09:00:08 +0300 Message-Id: <1507528810-26008-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507528810-26008-1-git-send-email-odpbot@yandex.ru> References: <1507528810-26008-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 203 Subject: [lng-odp] [PATCH API-NEXT v4 1/3] api: packet_io: add 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 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: b2330885d3eb101d2b618264e0bc830f93ba54e7 **/ include/odp/api/spec/packet_io.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index b56a5205d..4ce108592 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -482,6 +482,8 @@ typedef union odp_pktio_set_op_t { struct { /** Promiscuous mode */ uint32_t promisc_mode : 1; + /** MAC address */ + uint32_t mac_addr : 1; } op; /** All bits of the bit field structure. * This field can be used to set/clear all flags, or bitwise @@ -979,6 +981,20 @@ int odp_pktio_promisc_mode(odp_pktio_t pktio); int odp_pktio_mac_addr(odp_pktio_t pktio, void *mac_addr, int size); /** + * Set the default MAC address of a packet IO interface. + * + * @param pktio Packet IO handle + * @param[in] mac_addr Input buffer containing MAC address + * @param[in] size Size of the MAC address contained in + * input buffer + * + * @return 0 on success + * @retval <0 on failure + */ +int odp_pktio_mac_addr_set(odp_pktio_t pktio, const void *mac_addr, + int size); + +/** * Setup per-port default class-of-service. * * @param[in] pktio Ingress port pktio handle. From patchwork Mon Oct 9 06:00:09 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: 115180 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2193128qgn; Sun, 8 Oct 2017 23:02:23 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCWch9j1gW9VHcW5Cfyx+15Uj3CTAcrJz2/7dGmBKrF5+hqHi1jtyGQTEytX6SiKKKQmZHm X-Received: by 10.55.17.33 with SMTP id b33mr8087094qkh.58.1507528943839; Sun, 08 Oct 2017 23:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507528943; cv=none; d=google.com; s=arc-20160816; b=aKOyz4izuh1qz9D3tyle5Z/x48xyBhr4FiScQHYsj0Vc1DVxwa+g3oSejV8T7laefT X9E23MODfAdTbMhU3sSls9C+RwT6pJZ2so6Miwcn53DanumhnDqxgtbe0Db+L1CduqvX 39hWb1hXKkZzO4BXTmBGeD8AdzewaO9F96YoQypNF+7jz5V2HoiHW4fAxj7MW62BX+RD 9O3SgGs1hJIGIHd356a9c5CamecIZVftih4RoFUUhauvBXhoRW5gfV22VCJOoNCPg19y Lpw4GRN2ueE0Ml/M8Qnzw0tjAGpf+x9+B0R3RNT+1g+pV2ZH3sFebL6oGqRpQcmlgrFy n+ww== 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=q90dnVGHj1A2xkdFu+agwoFyVOUzZSJwPPS1mvzyYxQ=; b=rP0/Yfs0Km6n9BKqc9xyPdXelgCUrx57gjmuPlt/o9n7dymLlldv4FaFcnuygrM2rn Mpv6P2h2HxBwTvZsksqnD87wejwy1UOOIdLwBIh6xk3entUd8BBzm1sbb2yj/X6pKT5m xIafeu9raBcBTLb7Kszuhv9ETvCSqbExDd6z3Kci8Kg0hBeXiZVHBdgs4QA3QOsWxekd oW8VXTdbL/OU/6K05BIvU/1xA8aa/MQMgmIZcpf9+aLRpSmROVuyx0WfyVHvLMU425aP /nM4LLM7O7bCZEkquva370fOp1RsqNga4QhsWwRY8S9B+hR8LDPyPsKTSRvQwSZjy/uh QtIA== 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 i45si5915696qti.257.2017.10.08.23.02.23; Sun, 08 Oct 2017 23:02:23 -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 8872160B15; Mon, 9 Oct 2017 06:02:23 +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 269E960A1A; Mon, 9 Oct 2017 06:00:54 +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 5B3B860A51; Mon, 9 Oct 2017 06:00:42 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id A0DA8607E1 for ; Mon, 9 Oct 2017 06:00:36 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 6709741B0B for ; Mon, 9 Oct 2017 09:00:34 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LCnSp6Nha0-0YdSYvbd; Mon, 09 Oct 2017 09:00:34 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id RM0lQRMRr5-0XmiqmCF; Mon, 09 Oct 2017 09:00:33 +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: Mon, 9 Oct 2017 09:00:09 +0300 Message-Id: <1507528810-26008-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507528810-26008-1-git-send-email-odpbot@yandex.ru> References: <1507528810-26008-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 203 Subject: [lng-odp] [PATCH API-NEXT v4 2/3] linux-gen: pktio: implement 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 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: b2330885d3eb101d2b618264e0bc830f93ba54e7 **/ .../linux-generic/include/odp_packet_io_internal.h | 1 + platform/linux-generic/odp_packet_io.c | 36 ++++++++++++++++++++++ platform/linux-generic/pktio/dpdk.c | 1 + platform/linux-generic/pktio/ipc.c | 1 + platform/linux-generic/pktio/loop.c | 1 + platform/linux-generic/pktio/netmap.c | 1 + platform/linux-generic/pktio/pcap.c | 1 + platform/linux-generic/pktio/socket.c | 1 + platform/linux-generic/pktio/socket_mmap.c | 1 + platform/linux-generic/pktio/tap.c | 1 + 10 files changed, 45 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 1a4e345f5..41a1be108 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -210,6 +210,7 @@ typedef struct pktio_if_ops { int (*promisc_mode_set)(pktio_entry_t *pktio_entry, int enable); int (*promisc_mode_get)(pktio_entry_t *pktio_entry); int (*mac_get)(pktio_entry_t *pktio_entry, void *mac_addr); + int (*mac_set)(pktio_entry_t *pktio_entry, const void *mac_addr); int (*link_status)(pktio_entry_t *pktio_entry); int (*capability)(pktio_entry_t *pktio_entry, odp_pktio_capability_t *capa); diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 64ec1f670..f81eb792f 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -895,6 +895,42 @@ int odp_pktio_mac_addr(odp_pktio_t hdl, void *mac_addr, int addr_size) return ret; } +int odp_pktio_mac_addr_set(odp_pktio_t hdl, const void *mac_addr, int addr_size) +{ + pktio_entry_t *entry; + int ret = -1; + + if (addr_size < ETH_ALEN) { + /* Input buffer too small */ + return -1; + } + + entry = get_pktio_entry(hdl); + if (entry == NULL) { + ODP_DBG("pktio entry %d does not exist\n", hdl); + return -1; + } + + lock_entry(entry); + + if (odp_unlikely(is_free(entry))) { + unlock_entry(entry); + ODP_DBG("already freed pktio\n"); + return -1; + } + + if (entry->s.state == PKTIO_STATE_STARTED) { + unlock_entry(entry); + return -1; + } + + if (entry->s.ops->mac_set) + ret = entry->s.ops->mac_set(entry, mac_addr); + + unlock_entry(entry); + return ret; +} + int odp_pktio_link_status(odp_pktio_t hdl) { pktio_entry_t *entry; diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 26ca0d6b4..45153af82 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -1542,6 +1542,7 @@ const pktio_if_ops_t dpdk_pktio_ops = { .promisc_mode_set = dpdk_promisc_mode_set, .promisc_mode_get = dpdk_promisc_mode_get, .mac_get = dpdk_mac_addr_get, + .mac_set = NULL, .capability = dpdk_capability, .pktin_ts_res = NULL, .pktin_ts_from_ns = NULL, diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index a7f346ae5..c8880ae93 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -790,6 +790,7 @@ const pktio_if_ops_t ipc_pktio_ops = { .promisc_mode_set = NULL, .promisc_mode_get = NULL, .mac_get = ipc_mac_addr_get, + .mac_set = NULL, .pktin_ts_res = NULL, .pktin_ts_from_ns = NULL, .config = NULL diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 428b6cebd..eba6d3b03 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -265,6 +265,7 @@ const pktio_if_ops_t loopback_pktio_ops = { .promisc_mode_set = loopback_promisc_mode_set, .promisc_mode_get = loopback_promisc_mode_get, .mac_get = loopback_mac_addr_get, + .mac_set = NULL, .link_status = loopback_link_status, .capability = loopback_capability, .pktin_ts_res = NULL, diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 4d771fcb4..9ee412f0a 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -962,6 +962,7 @@ const pktio_if_ops_t netmap_pktio_ops = { .promisc_mode_set = netmap_promisc_mode_set, .promisc_mode_get = netmap_promisc_mode_get, .mac_get = netmap_mac_addr_get, + .mac_set = NULL, .capability = netmap_capability, .pktin_ts_res = NULL, .pktin_ts_from_ns = NULL, diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index 783b85a9c..596bf6f28 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -440,6 +440,7 @@ const pktio_if_ops_t pcap_pktio_ops = { .promisc_mode_set = pcapif_promisc_mode_set, .promisc_mode_get = pcapif_promisc_mode_get, .mac_get = pcapif_mac_addr_get, + .mac_set = NULL, .capability = pcapif_capability, .pktin_ts_res = NULL, .pktin_ts_from_ns = NULL, diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 5841e2448..0a80035f5 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -873,6 +873,7 @@ const pktio_if_ops_t sock_mmsg_pktio_ops = { .promisc_mode_set = sock_promisc_mode_set, .promisc_mode_get = sock_promisc_mode_get, .mac_get = sock_mac_addr_get, + .mac_set = NULL, .link_status = sock_link_status, .capability = sock_capability, .pktin_ts_res = NULL, diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index f71180238..67c5b2067 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -730,6 +730,7 @@ const pktio_if_ops_t sock_mmap_pktio_ops = { .promisc_mode_set = sock_mmap_promisc_mode_set, .promisc_mode_get = sock_mmap_promisc_mode_get, .mac_get = sock_mmap_mac_addr_get, + .mac_set = NULL, .link_status = sock_mmap_link_status, .capability = sock_mmap_capability, .pktin_ts_res = NULL, diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index 917db006e..ed4479445 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -391,6 +391,7 @@ const pktio_if_ops_t tap_pktio_ops = { .promisc_mode_set = tap_promisc_mode_set, .promisc_mode_get = tap_promisc_mode_get, .mac_get = tap_mac_addr_get, + .mac_set = NULL, .capability = tap_capability, .pktin_ts_res = NULL, .pktin_ts_from_ns = NULL, From patchwork Mon Oct 9 06:00:10 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: 115178 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2192260qgn; Sun, 8 Oct 2017 23:01:16 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBt7jcOyL7vMCjTPtOsnItBpRrgcFfWxLpPjfYwvCRPDOGm/GgG6guWKtB0HX+4k3BgNSaO X-Received: by 10.36.73.99 with SMTP id z96mr12560792ita.36.1507528875890; Sun, 08 Oct 2017 23:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507528875; cv=none; d=google.com; s=arc-20160816; b=f9ZgZBPYUAXEuCq81b/tu+8uIS9p44L2s420Ssm1YnHYSjE5MkdDirjHkzbmQsyNSP lHEXzhIel2KJnR12Y0KzZFPnsqVeNEwe7ZC1r2QWALWGnqSpoIIwFq1SkaCh62aRCwhy AwvOBpDmnYa2WLRnGZooAf9pXDy6kNPKNKw48x4E7dwVilVyqs6Ze4XRxnkR1+qHHoVy ZyH5hIYSGP4vFAX6Kjyudx2//POwtNlXNTP5yfY1EFJ3VvpW+HKJxaK1HpNYu+Uj/+F/ Nr2QyUMVUeMewCy93357UCxu1MmozRTuv38NrFI0624fd2D6sm5NwcWm1etRITjNWHoI FSbg== 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=o+ZOkc7X80Bm7jDbYOYHy9XpHnkO1XKMZE27GWeNtlI=; b=IZnURLfno7XTNvMR+L26Fj1C9QP4IO3zbwpMWIPid4jG5gs3KSpYQ/acoocSIh9Dq1 G7KxclCm3c/mVFJK9mQNzFxOGh11eGR6vjViwsA/ufxJYWTWDrtYYC7LGQflVat+tL8k JDfUkleEaOvL3ufSdMjJ8C5Rh9ydHALlfIGCzle/TDIiP0ZMTPHVvMUdoWa/UqejflUr e7AluQlGd/BVHF9anqHyY1YVeG8G9ewo5yCeCwMsRwfMCZ9g390I/0+17mcDtkGpI6UQ Bpw+rXAyTyZehTVMqnulvw+xPOMe9h0gMFnYFoYKZzjAD3B52piX2OwRF/bWUb7BWgik glNg== 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 a186si5931369iog.225.2017.10.08.23.01.15; Sun, 08 Oct 2017 23:01:15 -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 5FBBA60AC8; Mon, 9 Oct 2017 06:01:15 +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=-4.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM, 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 576FE60A3E; Mon, 9 Oct 2017 06:00:41 +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 19D02609FD; Mon, 9 Oct 2017 06:00:38 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id 5FCCE6081D for ; Mon, 9 Oct 2017 06:00:36 +0000 (UTC) Received: from mxback6o.mail.yandex.net (mxback6o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::20]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 079795A0220F for ; Mon, 9 Oct 2017 09:00:35 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback6o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id oPX1qCZ8S4-0YD40d3E; Mon, 09 Oct 2017 09:00:35 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id RM0lQRMRr5-0YmqF2OL; Mon, 09 Oct 2017 09:00:34 +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: Mon, 9 Oct 2017 09:00:10 +0300 Message-Id: <1507528810-26008-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507528810-26008-1-git-send-email-odpbot@yandex.ru> References: <1507528810-26008-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 203 Subject: [lng-odp] [PATCH API-NEXT v4 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 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: b2330885d3eb101d2b618264e0bc830f93ba54e7 **/ test/common_plat/validation/api/pktio/pktio.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/common_plat/validation/api/pktio/pktio.c b/test/common_plat/validation/api/pktio/pktio.c index 6a085729b..e9f4a2aa2 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,27 @@ 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) { + printf("\n mac address set not supported for %s!\n", + iface_name[0]); + ret = odp_pktio_close(pktio); + CU_ASSERT(ret == 0); + return; + } + + /* 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); + ret = odp_pktio_close(pktio); CU_ASSERT(0 == ret); }