From patchwork Mon Dec 28 16:40:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 59027 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1807441lbb; Mon, 28 Dec 2015 08:43:14 -0800 (PST) X-Received: by 10.141.2.86 with SMTP id e83mr76331409qhd.64.1451320994466; Mon, 28 Dec 2015 08:43:14 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id y83si65396233qka.43.2015.12.28.08.43.14; Mon, 28 Dec 2015 08:43:14 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D6242616F8; Mon, 28 Dec 2015 16:43:13 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=TZHk4CdB; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 AFBB4616F3; Mon, 28 Dec 2015 16:40:45 +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 6F1B66170B; Mon, 28 Dec 2015 16:40:42 +0000 (UTC) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by lists.linaro.org (Postfix) with ESMTPS id 4DB2D616ED for ; Mon, 28 Dec 2015 16:40:23 +0000 (UTC) Received: by mail-lb0-f173.google.com with SMTP id oh2so93540551lbb.3 for ; Mon, 28 Dec 2015 08:40:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FJ80oYE96fd7rOSPCM7jFA4/TV+IxLXJPYH61Ku1NYI=; b=TZHk4CdB3aSVZsnCcLgbIh1TOsbKToFVL+9RBYs/mnebcVQeom6uCVa1FJzQ2nW6+3 tBASLZQxEqAVxePAKyhvpRFA+MLIig5+3FG5k90MvTACTauduYqF18n9hxN+0qcaszPa Tz253Cl/PYZzlMc38GTcttPv+Ww6QtWCj+N8E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FJ80oYE96fd7rOSPCM7jFA4/TV+IxLXJPYH61Ku1NYI=; b=maHqjRBqHNQu95VZgm7vslZjUVoOYqCNv8p+YvK6GbeBqBLCy4O4UxiNEzXe/qqH0Y hAnkwmzUdLwEgixxv6XUJ3FxyAInmJwmacJPcfRp29WTb1iuiY4nziH1Y2eVaBR3RGwC bUtj2R2yhFnPwWbaDIXgZ7CMpkxWdR3Xfycuy9fiwQAO7UamTpI+QPxYW6j8SwSTsE1W cunLPG2ukKnkFPxpw4kAUqif3Tp/LUIjDBFQE0oFOcPKZcMwzwJFxLKKMKyhD4NOIB0x KCTAH7XpjXqAQeTtHaScxV3jK7+lGc4bOJ8JigFB7xSADBOgrl9NOVIavZXnRmt169gH 5f6w== X-Gm-Message-State: ALoCoQlBKUifN4hudrCS5O1EHMLYRik2nTZPq3kvKpv9/rTQiwycQOwTNVW6YYPkw6UAn3KaqcSty7r+HIQ3pc4Jizy6M+w8aA== X-Received: by 10.112.42.67 with SMTP id m3mr20044753lbl.2.1451320822252; Mon, 28 Dec 2015 08:40:22 -0800 (PST) Received: from localhost.localdomain (ppp91-76-173-134.pppoe.mtu-net.ru. [91.76.173.134]) by smtp.gmail.com with ESMTPSA id kz5sm9252745lbc.7.2015.12.28.08.40.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Dec 2015 08:40:21 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 28 Dec 2015 19:40:13 +0300 Message-Id: <1451320813-9428-5-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1451320813-9428-1-git-send-email-maxim.uvarov@linaro.org> References: <1451320813-9428-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2 4/4] example: generator: check and print link status 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Maxim Uvarov --- example/generator/odp_generator.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 93eefe9..b34b958 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -22,6 +22,7 @@ #include #include #include +#include #define MAX_WORKERS 32 /**< max number of works */ #define SHM_PKT_POOL_SIZE (512*2048) /**< pkt pool size */ @@ -364,12 +365,19 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool) if (ret) EXAMPLE_ABORT("Error: unable to start %s\n", dev); + ret = odph_pktio_wait_linkup(pktio); + if (ret == 0) { + EXAMPLE_ERR("Link for dev %s is down, exit.\n", dev); + exit(EXIT_FAILURE); + } + printf(" created pktio:%02" PRIu64 ", dev:%s, queue mode (ATOMIC queues)\n" " default pktio%02" PRIu64 - "-INPUT queue:%" PRIu64 "\n", + "-INPUT queue:%" PRIu64 ", link_status:%d\n", odp_pktio_to_u64(pktio), dev, - odp_pktio_to_u64(pktio), odp_queue_to_u64(inq_def)); + odp_pktio_to_u64(pktio), odp_queue_to_u64(inq_def), + odp_pktio_link_status(pktio)); return pktio; }