From patchwork Fri Dec 8 10:00:16 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: 121140 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp456214qgn; Fri, 8 Dec 2017 02:04:30 -0800 (PST) X-Google-Smtp-Source: AGs4zMb9heaXrcOlvG1Rs9hpjoG7dYu2ZTqBgP2l+R+bxKb5J9wl5EbjfdUqQ7Y1H04Ys6LHyarL X-Received: by 10.200.23.18 with SMTP id w18mr13313653qtj.47.1512727469958; Fri, 08 Dec 2017 02:04:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512727469; cv=none; d=google.com; s=arc-20160816; b=SYW+bQsE0OJn4UC2LDtqqCjCCFx3U6Awzd+LnExuELvD8aPBswAsiSvPsIyyv/R9eH /y4oWn55SXPlESn7cXwd1yLoNM+7UcVBFMvop1mWbl3MWvi3Wce8aXY8YcGdyjJ99Pmt xKAJEhCRg3mLBjpIQ25kGEEk0xkmJfcaorGfZLXlnnXOQiKThz0F+jWq0MBR5Qzsq2rF +Kv7ubsWXn5dGDEgLXaeVuTwFVPtSZnbhSi0dqBFcZMl0kWsLNdWfy3E9n0kElw0cbbJ VhEB9QAaZlNcRDAqdSd+HpBaHXZUDA86AAdNKSy+UybtowbgQZVcynECZnil4rs0X34h WctQ== 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=aS/RZUy2JRyUKgL8rNlpB32Q4uPEXJQ5R+CUfi3r7pc=; b=EN7Ns+KMbnWpXQ8Agjz3okEpuxZuRSKjR0VeD+RRKxYxKt1V0c2pyXRdb6KcUVUnKQ fGp0JMN+kX3emJakE6ZN3l2R3ARuQC3VwFYkm47qVd/hzkdisp5QxS/sGYmR3bWQN+aj UG8W6bqCxr/IIteajCGpo3pTu0fiS3Atki+8P5KJa5lTWbYpVKgZ3frt1uFaJJYyTllI HxI3glwdNDoZGUi2gwxslxowumTvMzwdvSBr1nn12LlQ5KprleFCGnWq3sLhlRKA82dW 50YPc0i5JnK7PScXU5eGQyrX9sPo+tpO2Lem5t/JtPklke5F5hNOChy6j8JF8iRycjkx w7kA== 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 d21si5487701qkg.484.2017.12.08.02.04.29; Fri, 08 Dec 2017 02:04:29 -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 A0551609F2; Fri, 8 Dec 2017 10:04:29 +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,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 3D1B6609DA; Fri, 8 Dec 2017 10:01:36 +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 7D962609D8; Fri, 8 Dec 2017 10:01:33 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 32D3A6098B for ; Fri, 8 Dec 2017 10:00:24 +0000 (UTC) Received: from mxback7j.mail.yandex.net (mxback7j.mail.yandex.net [IPv6:2a02:6b8:0:1619::110]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 35B2F4303805 for ; Fri, 8 Dec 2017 13:00:22 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback7j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id YmZQzkn2Sv-0MrWXQOb; Fri, 08 Dec 2017 13:00:22 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id p6iuZvqqGi-0LdSNq12; Fri, 08 Dec 2017 13:00:21 +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: Fri, 8 Dec 2017 13:00:16 +0300 Message-Id: <1512727218-7712-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512727218-7712-1-git-send-email-odpbot@yandex.ru> References: <1512727218-7712-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 321 Subject: [lng-odp] [PATCH v4 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: c15a810b7a47f2e07200f83aa534163ca06e2b16 ** Merge commit sha: 540836da19aed3d8c900429f089415c51b77529f **/ 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..db2a8b0f2 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, 5, 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);