From patchwork Wed Oct 4 11:00:07 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: 114768 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp5819728edb; Wed, 4 Oct 2017 04:01:59 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDSM/htzZ2NjxDfEjxIh35jlUjWmSC+ThZ4aThAn5crr2FKvVnWfiWlD51Re8XuPvn1LLyq X-Received: by 10.237.62.90 with SMTP id m26mr27022982qtf.210.1507114919593; Wed, 04 Oct 2017 04:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507114919; cv=none; d=google.com; s=arc-20160816; b=cpqgTblonrPJY2UdGQTQmoyfiRfFNxF2x6cLcsuX3Xe6/0eMDbuA0t+F4SrmOHzMle bsOwG7brvvWcMGDOT5K2J5tXjcVC3Bmy3Fsolmf9/OiLwAZdq3Y5EXVWGpm8/QbtvVVC ODXr0YRbnI/52MhvxQ+85JDLLgs8UXev1W5vSkV1cE1wkVlVFIOce8SvrEYaIgujSxg5 g0C10srz55Ocql8iniRtkrfvwO5dCWao5Vtyua1d2C3psh/f9ICcouMbXYhbJebUJ4VY eN1zoJSt3teXqJh0HRpE3hz6sOypVDv2xc1nRHPxxTLBsIlEl9FycyqnPSPyC6IEtPpD t1aA== 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=KqVelYXIfPMhMRt4lSfLYUVojLsq9HYRZmTiCF5XRMo=; b=iZZyqVIVFe9/bb1Xw+Zw8yUVyraZorB6QXPR75eFf+GETtPEiBghHZDV8RhLhVxEmy Aj96512CQnHwFSe9gDy1EZ2xDM/be74AdOcGG51JizHNFkPUFygv4+IbN+aB2/yabXWV yTYQ+gegau8GbPI4YjhPqKQXWE+ad4yTsD+uSm86Uc22SLo8vEhMAKBZ72SEu1joAsyk y4A7SrOYL1iYmVJuc7bqyW5iMwoc0AaPiOoRjypSdQIhw20iE6Y2Kmbv/Utj5gTNzQNR 9jm546oCUpYy9Gj4HpiQZhYyf857sILSZp7csVPize3H5uM7sOuH75yQ29SE76LS8jXF SMtQ== 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 e6si2915295qkb.89.2017.10.04.04.01.59; Wed, 04 Oct 2017 04:01:59 -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 1D1C26071F; Wed, 4 Oct 2017 11:01:59 +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 F23DD60CC1; Wed, 4 Oct 2017 11:00:57 +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 D83A960D89; Wed, 4 Oct 2017 11:00:53 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id 9032660C2B for ; Wed, 4 Oct 2017 11:00:52 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 9122B18053C2 for ; Wed, 4 Oct 2017 14:00:50 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id tduk2nPqYI-0oo0K1WO; Wed, 04 Oct 2017 14:00:50 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JFXpMiqPsx-0nXSneLe; Wed, 04 Oct 2017 14:00:49 +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: Wed, 4 Oct 2017 14:00:07 +0300 Message-Id: <1507114809-8055-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507114809-8055-1-git-send-email-odpbot@yandex.ru> References: <1507114809-8055-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 203 Subject: [lng-odp] [PATCH API-NEXT v3 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: 75cfc6f70d5b21d6f04082e1d03a7e677a895280 ** Merge commit sha: 38387bba47b82e9d7f3e9eeb68a5713d909f16d6 **/ 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 Wed Oct 4 11: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: 114769 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp5820398edb; Wed, 4 Oct 2017 04:02:36 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDJz8cEt3YFSo30AN1Fx/7NrxLFt8rwyA1qr4N1mRdtVP7ewrI2786/jew+CcK+q1QX2EGX X-Received: by 10.55.18.165 with SMTP id 37mr5107859qks.352.1507114956046; Wed, 04 Oct 2017 04:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507114956; cv=none; d=google.com; s=arc-20160816; b=B4ADMU6+Fw298CYPnTD+SvdtDwIh0LKABV1s20v9HQRXndYacQuOTPXDccSUnpYMV1 PPUoa/ZMUj+gbn3xpkbgPiuVlLkF3WCZZ7jdoWNH/cDmoPB038pDu7rzEOfPZOSJlTAN giXspA2oZko57XYS12Ajc20JkkOGDZZq3ehaLXJNBSFDBcRDVurN4Ce+WwTmtoLhN05P kPxtNfS2UhVmHojvjn6ogfTb0swJCO7DN33RRck8Ui+GJt+fLw/yLKTu9wW0H6Tq3q64 jPGaw1HKVKw4nlAa4alrRYjgsa9XM84OHd9C9pGVWeT2HV4zgnt/PJlsgsGOb8usZkx0 66sg== 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=gqaVwVowd4Ru+XvHxftJPSdMDYdShgVxr4Pbc7Jg4Z0=; b=QTfwq3fPYsSZnZaxB0006zp0n/zfdTKOrFrIFWNy/9l516h7N8KoZCJVp9V8PCHTqc ei9zqA0QEvKmgWDLN9HegqoHS+Majrv7jxXrj3BkcnTbcdcjLqKOL3WdE3rACRTHfyPU rs7MqEpsMB/Wu9Y0D1x8vJv6B/NNc9T/8wsXbm24I3f0Buk5ZJCkPg5Zs0Lz6zoNB1YV nzacKgt/KkeFCqPrpFmQs8HhWTVt1i3ao1tZQawMjvTq+kW74g7y1W6lTdD+V+OhXXDk ALQtJhNKhI99qRuizC20kP7u8hgtzJf5yfbUMpK7MHnQuXfe0YOiYb61fgRYZOcZpexI 2v1w== 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 a124si610885qkc.87.2017.10.04.04.02.35; Wed, 04 Oct 2017 04:02:36 -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 9E05460DC9; Wed, 4 Oct 2017 11:02:35 +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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,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 50E8564475; Wed, 4 Oct 2017 11:01:04 +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 3ECE160DC9; Wed, 4 Oct 2017 11:00:57 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 4ED8460C20 for ; Wed, 4 Oct 2017 11:00:53 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward104o.mail.yandex.net (Yandex) with ESMTP id E7317704F98 for ; Wed, 4 Oct 2017 14:00:51 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id NY9mnfQr27-0p94XTEn; Wed, 04 Oct 2017 14:00:51 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JFXpMiqPsx-0pXGjlv7; Wed, 04 Oct 2017 14:00:51 +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: Wed, 4 Oct 2017 14:00:08 +0300 Message-Id: <1507114809-8055-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507114809-8055-1-git-send-email-odpbot@yandex.ru> References: <1507114809-8055-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 203 Subject: [lng-odp] [PATCH API-NEXT v3 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: 75cfc6f70d5b21d6f04082e1d03a7e677a895280 ** Merge commit sha: 38387bba47b82e9d7f3e9eeb68a5713d909f16d6 **/ .../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 Wed Oct 4 11: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: 114770 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp5821267edb; Wed, 4 Oct 2017 04:03:26 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB+HCjtUQErga8cBS+snO1/zC/oF/e7GgiILBIiZcyBcN3R5Fubuqu04yZRZN2hw4w1A9p9 X-Received: by 10.55.161.200 with SMTP id k191mr17147706qke.158.1507115006592; Wed, 04 Oct 2017 04:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507115006; cv=none; d=google.com; s=arc-20160816; b=bA69SewsT/CflEteyFmutuaBSU9GM3YuqmTqGfYQ2IIHVj/O+GoPNCdDrN9yS/lyqk pWz3zF+MtlIHXlZU0pRj3ZSU8PeQ1pY69adHcQX7nfWK7TXTHEgXVRoSrMx5QkPwaeHg mzXDhq1Cvh3N5dzRRtiOqsbhroLf3sPZNCe+qevJcaP9FHxLn4sWZ/FlLa3FfNwjBeQP hN63LHMEMj/3wbUN2tn5qOSH8Hn8TxdHUfSLejrolS9zGi75RtYR1L+LPIw4IoqKpkBl 9oouY08TogCURsemx6skRvHeJHZ9M2Zbr5Lmtu0jWZPB3GhYg0piPg5W8xv2doJLirE1 tRMg== 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=78bM+NtgVrM7E41kSiYMYzJJz5asBjn4ukgSEDy5bXQ=; b=sTkzjnjFUf8hwvDAEJTLffQp6vjfYT8/M5gcGlIKng807+yQj8t+b53x8uxrtcnW8/ JkRkjHL5W0Mu7+AjyOmMVuCR1SrCWInmCmIVHbhUlHbAaeDKexDrLXS2Xha21a1PJLCy 2ONNBRlXplTO40fRr2L0IzQra8y22n+3w7DBgeuCyvLx7UPUYdCyBPNZ83tGrsknA2w6 aRlEPzPSmF+svwWpuKjecL2r6zALCvhJ8Eabv77Gw/ZHhYxpvqrovqqoqDmeYyQyCKih rF2R1gv1xQNKG5MLr24cyNRc05D0Ay9WaH5AgnVrvOpkpEYI1KbGjAHolm76p3GvpLpo M/tw== 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 92si2530312qkq.400.2017.10.04.04.03.26; Wed, 04 Oct 2017 04:03:26 -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 38BC560DC9; Wed, 4 Oct 2017 11:03:26 +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.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 9734864474; Wed, 4 Oct 2017 11:01:09 +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 5FCB964475; Wed, 4 Oct 2017 11:01:00 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id F111160C2B for ; Wed, 4 Oct 2017 11:00:53 +0000 (UTC) Received: from mxback8o.mail.yandex.net (mxback8o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::22]) by forward104j.mail.yandex.net (Yandex) with ESMTP id A043A43793 for ; Wed, 4 Oct 2017 14:00:52 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback8o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 33r1qg1MNB-0qoWShsO; Wed, 04 Oct 2017 14:00:52 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JFXpMiqPsx-0qX4j1wu; Wed, 04 Oct 2017 14:00:52 +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: Wed, 4 Oct 2017 14:00:09 +0300 Message-Id: <1507114809-8055-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507114809-8055-1-git-send-email-odpbot@yandex.ru> References: <1507114809-8055-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 203 Subject: [lng-odp] [PATCH API-NEXT v3 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: 75cfc6f70d5b21d6f04082e1d03a7e677a895280 ** Merge commit sha: 38387bba47b82e9d7f3e9eeb68a5713d909f16d6 **/ 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); }