From patchwork Thu Dec 7 14: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: 120979 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp8397487qgn; Thu, 7 Dec 2017 06:05:21 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ3h78+8achPM0m3E5ttp3jLs5wwBXjM/2PlvDPrYIat0eZyUpe2ElMS6g5pP+t7Aqfho06 X-Received: by 10.107.183.67 with SMTP id h64mr38279341iof.46.1512655521003; Thu, 07 Dec 2017 06:05:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512655520; cv=none; d=google.com; s=arc-20160816; b=Az5Y42hH9zAhpe+cQQ2S3wnsda107NDzPzvTZ3jZ507MWq+reo6i9qMNnTLDwlUeph bX82F5ZLIRbUyWilGeVqjAVFi9nv2TZGO2Twp1BqJ+yKoAhInshPwbVzeJyH/raE4leQ p6PmGfc51X0+DYuRgrqNP1mqSA7Vxe5MCxoB9cPLP085FybfchUeqL+f7rlPDJ1nZLnc Ea5Y/dNCwnNNhlIhVMOMUfUvq13lCT4Mbls09wKBbv6I/Uxq9CDjkRDI1FjsB4fFlw/K XU/Tn5Xmzz6nBi+hVCnK1pa+/T/9GM9hLOlLGjMZQsvlDHAH6UfQHDfsfD5EHU2xiJkv Kpyg== 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=rex+osyMc1JfKYGKcPBEVs3aWylRX3Bby1JTU0mOm68=; b=ct9q1CjBiOzsFo2OuAMaGo+JSo2ARDTF5xTqaMzipBznsKCn+bHl2RE96Rkz8q3yzJ /N+ZXo7a/EsrgcysHK0n9jtu0NUYjfSmvX8PPL5KaaUe2fwK3u17ZDq/TbcpdDBZV6ib Gd+STtM1a6oowEdHgnOYroOUYGC20MrzLuZfGAhw0aTbzbA7BEEfetr7lR3gqu37bBTq H6thrs91otBQfcF6qb0j0bs5kRwH0upE64lEz1wxXelXXVZwZNDkI9qwDLBN5ymeQ0Ea 5n0gyfK/vUX2Z6NSAcwLjw/Csoso0dcnUA6fHUbga32zRT7cRlNxV9491raQ9rgp1xSt rYhQ== 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 p72si3895792itc.68.2017.12.07.06.05.20; Thu, 07 Dec 2017 06:05:20 -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 0B9936098C; Thu, 7 Dec 2017 14:05:20 +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 9D0946095E; Thu, 7 Dec 2017 14:00:50 +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 9652F6064A; Thu, 7 Dec 2017 14:00:25 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id EC4546090A for ; Thu, 7 Dec 2017 14:00:16 +0000 (UTC) Received: from mxback2o.mail.yandex.net (mxback2o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1c]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 83E081342D7D for ; Thu, 7 Dec 2017 17:00:15 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback2o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LVeAFErPjf-0Fuqa7lT; Thu, 07 Dec 2017 17:00:15 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id N0uwl7gRuJ-0EhmXMZ3; Thu, 07 Dec 2017 17:00:15 +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: Thu, 7 Dec 2017 17:00:10 +0300 Message-Id: <1512655212-29682-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512655212-29682-1-git-send-email-odpbot@yandex.ru> References: <1512655212-29682-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 321 Subject: [lng-odp] [PATCH v3 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: 811281a22b6274b7f41b926a9cfbe09e48a366bd ** Merge commit sha: 7aed25e962c1322b020ff261d9e5ee0ab3dda1a1 **/ 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);