From patchwork Mon Dec 4 15:00:06 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: 120567 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4543368qgn; Mon, 4 Dec 2017 07:05:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMYdBs5DyzQ9rYEcZxF3IP02EUC7YONFbQd/27cZJ9BoG3+cJDB64B50RgHJ5RhKfTOQg4aZ X-Received: by 10.237.60.206 with SMTP id e14mr21866001qtf.157.1512399928741; Mon, 04 Dec 2017 07:05:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512399928; cv=none; d=google.com; s=arc-20160816; b=Xq2pU0qYxaTEdfYOXdjh1OmeQrox/tMdwXwq28f1rQhtWN2TqPJWfcqH0iXtZrB5gv YzWRov9iPc6wPaSO51959KeWvm2teXEWMgWbOV9jlh9QBg+m+IUlxhp5gRW+7X2LHAyR t2DktW+FdB6dBAU+jpFM6vPSQwwPfGWEkSXcKIAoNYwWxA6w2DUkvqRWSBF7z8zaIrAj BmV5avVKlTr8IG6Bot64aKAMqu3ZyfPxD0vHhRF4fP0eC+lFdIe8W+SpBI+a3earYbrM vxdsijAOWIiBBYGtbfpWc/kiC0zR+RSCffdKJMljASlZbRFNk0/0JTV3uINlq2BpUjv5 9L8A== 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=ozT6rDi4NRlWXUmyLGqR77FKUkGxMoQZE4OvcpOLWXM=; b=lfPx2aNFk0wQDD3lvgLPsYc2nJPvW3QZrQ+qCT5ZExAFYpeXhY7p9QKFsfHlmi2ttA Q+gyZrZMaMWAGQSkivrWo8vfnBdz/6dtyBm0Tk37NwIzI1AgBGZtt7F6lxNJu7L4JNFV 9lkdKTfPhKhFhDuHNl1ybpWChzg98vF9HJQMs6PW+s7Xt5kAOrtxba3roJhtgf37pcR7 BUzoAHwgy1vx2Uta6DvD/QtfruYfbl3sKNfttiotSoTnCl7tKL+AUQyfSloyH3xlWatt DPvXWcxDrBcgGtWRrk+ixd0jsi5upx7hIg6uWu4qsU5QyJZaA2LU4VXqhROhgs8nUo5s qRAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 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 (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id j50si5896714qta.224.2017.12.04.07.05.28; Mon, 04 Dec 2017 07:05:28 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 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 71875608DE; Mon, 4 Dec 2017 15:05:28 +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=-3.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED, URIBL_DBL_ABUSE_SPAM 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 11AC960957; Mon, 4 Dec 2017 15:00:53 +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 CF09B608DD; Mon, 4 Dec 2017 15:00:28 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 8D0C560595 for ; Mon, 4 Dec 2017 15:00:18 +0000 (UTC) Received: from mxback7o.mail.yandex.net (mxback7o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::21]) by forward101p.mail.yandex.net (Yandex) with ESMTP id D91BC6A83D36 for ; Mon, 4 Dec 2017 18:00:12 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback7o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id vqKRPbTozt-0CZGd3SK; Mon, 04 Dec 2017 18:00:12 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Hseuacluka-0CEOCsdF; Mon, 04 Dec 2017 18:00:12 +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, 4 Dec 2017 18:00:06 +0300 Message-Id: <1512399608-12981-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512399608-12981-1-git-send-email-odpbot@yandex.ru> References: <1512399608-12981-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 321 Subject: [lng-odp] [PATCH v2 4/6] linux-gen: pktio: support using DPDK lt 17.08 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: Dmitry Eremin-Solenikov Debian unstable ships with DPDK 16.11. Add support for building with this version. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 321 (lumag:dpdk-system-master) ** https://github.com/Linaro/odp/pull/321 ** Patch: https://github.com/Linaro/odp/pull/321.patch ** Base sha: 5329e5211c447b9b823149baf76112eedfeb07fb ** Merge commit sha: 280c62aa5d2ea89ff05e376a74d7c6bbd29f002f **/ platform/linux-generic/pktio/dpdk.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 07671e62f..fa73cb93d 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -29,14 +29,27 @@ #include #include +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wimplicit-fallthrough=0" +#endif #include +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif #include #include #include #include +#include #include #include #include +#include + +#if RTE_VERSION < RTE_VERSION_NUM(17, 8, 0, 0) +#define rte_log_set_global_level rte_set_log_level +#endif #if ODP_DPDK_ZERO_COPY ODP_STATIC_ASSERT(CONFIG_PACKET_HEADROOM == RTE_PKTMBUF_HEADROOM, @@ -54,6 +67,7 @@ static int disable_pktio; /** !0 this pktio disabled, 0 enabled */ /* Has dpdk_pktio_init() been called */ static odp_bool_t dpdk_initialized; +#ifndef RTE_BUILD_SHARED_LIB #define MEMPOOL_OPS(hdl) \ extern void mp_hdlr_init_##hdl(void) @@ -77,6 +91,7 @@ void refer_constructors(void) mp_hdlr_init_ops_sp_mc(); mp_hdlr_init_ops_stack(); } +#endif /** * Calculate valid cache size for DPDK packet pool @@ -928,6 +943,11 @@ static int dpdk_close(pktio_entry_t *pktio_entry) rte_pktmbuf_free(pkt_dpdk->rx_cache[i].s.pkt[idx++]); } +#if RTE_VERSION < RTE_VERSION_NUM(17, 8, 0, 0) + if (pktio_entry->s.state != PKTIO_STATE_OPENED) + rte_eth_dev_close(pkt_dpdk->port_id); +#endif + return 0; } @@ -1064,14 +1084,16 @@ static void dpdk_mempool_free(struct rte_mempool *mp, void *arg ODP_UNUSED) static int dpdk_pktio_term(void) { - uint8_t port_id; - if (!dpdk_initialized) return 0; +#if RTE_VERSION >= RTE_VERSION_NUM(17, 8, 0, 0) + uint8_t port_id; + RTE_ETH_FOREACH_DEV(port_id) { rte_eth_dev_close(port_id); } +#endif if (!ODP_DPDK_ZERO_COPY) rte_mempool_walk(dpdk_mempool_free, NULL);