From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6203745AAF; Fri, 4 Oct 2024 18:25:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A208A42EB6; Fri, 4 Oct 2024 18:24:45 +0200 (CEST) Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) by mails.dpdk.org (Postfix) with ESMTP id 472C242E4D for ; Fri, 4 Oct 2024 18:24:36 +0200 (CEST) Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-3a34802247eso10931675ab.0 for ; Fri, 04 Oct 2024 09:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728059075; x=1728663875; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rIGNo3z1OTFq/4Ps9N6YpAxUcxPRcLS67vGqkwnW4FA=; b=LFwop1+Nn3gkvSPxiA8eJFx9vsTzheRdOYwjno6D/lpJRCG/lvrx58rKUkv70Vp59n Jk0MRM68llpm0/jcshE5oFbxM7dicb7Pbrw69/GFKed1YPdhQSY+/ANbycddCEBl+8tE r60uudc/OYGHGdCCFZ21CV/8JagmjurlCSsj2GjkEdJUJfLftTFJ++56IUteipxHaKzX RKpxbL6Z2RFRhl01HLVAs1fet2sAajCMiopretLlzAmsuJ8gtH41VZ/0QAFh02xIhRLQ h7spRXDD2XZOu/8gP8NUqCcy+VmXExAf9k1EbeglkzfAXxBGx1jsxBhgYToIvgMefYpA fvHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059075; x=1728663875; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rIGNo3z1OTFq/4Ps9N6YpAxUcxPRcLS67vGqkwnW4FA=; b=XyKXnFTXPAtN0cL/12nTqP0hS2X/t9z+uKWfrpKKOqMGchki+LkzjC2DlI24XDaL+t 8fzAWFU1iKUfAHl3dZ3b5iHtb+vjGcB5k8MYqr+bcdbr80VtWRF1WC3+dhUW5rxj863U djVY0wHXnSouYkuPpPsHM0yNjz6jOJVlYU9FoKpMuF6dhECwPZT5iU4U3BryBZCDZakK Vjbr6saTTyRwJ0eB8iz8kK0GB7Vmm9nGO5/FaZP1pDURgPx9AxMPYqNCQ/m8Nzyo0WIi I4Yy1QFGhhyI+aOmPY2mXN/bTAr81IPrjw19PyDE4HOTWZ8yA0Zdf0M9uXKY1X4Jxjm7 XfBA== X-Gm-Message-State: AOJu0YzV1L8XkVnmNUnSE4lBk/BXROGs83g0GT12cYfi3pWFB8Ro1/cS N+maVI8FnWtr9NIuez4xHRjwkVbonkZi/L6fmUisDzOz/RGeaoF74Hp8BKeZj9VPkgBnBAxOdI0 5a9c3+g== X-Google-Smtp-Source: AGHT+IGkbs4C+gDZr/MzGzGkV328cSdtdodlaJ4FMH0stPDn94b62fRUs2VxJ07O+Gon7leZasXBBw== X-Received: by 2002:a05:6e02:1fcd:b0:39f:558a:e404 with SMTP id e9e14a558f8ab-3a3759780bemr35339645ab.4.1728059075471; Fri, 04 Oct 2024 09:24:35 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f680d7a1sm139231a12.19.2024.10.04.09.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 09:24:35 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH 08/10] examples/qos_sched: check return value from rte_eth_link_get Date: Fri, 4 Oct 2024 09:21:55 -0700 Message-ID: <20241004162418.52940-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162418.52940-1-stephen@networkplumber.org> References: <20241004162418.52940-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The return status of link is undefined if call to rte_eth_link_get returns an error. Signed-off-by: Stephen Hemminger --- examples/qos_sched/init.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index 32964fd57e..ace7279c67 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -323,6 +323,7 @@ int app_init(void) uint32_t i; char ring_name[MAX_NAME_LEN]; char pool_name[MAX_NAME_LEN]; + int ret; if (rte_eth_dev_count_avail() == 0) rte_exit(EXIT_FAILURE, "No Ethernet port - bye\n"); @@ -368,12 +369,20 @@ int app_init(void) app_init_port(qos_conf[i].tx_port, qos_conf[i].mbuf_pool); memset(&link, 0, sizeof(link)); - rte_eth_link_get(qos_conf[i].tx_port, &link); + ret = rte_eth_link_get(qos_conf[i].tx_port, &link); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "rte_eth_link_get: err=%d, port=%u: %s\n", + ret, qos_conf[i].tx_port, rte_strerror(-ret)); if (link.link_status == 0) printf("Waiting for link on port %u\n", qos_conf[i].tx_port); + while (link.link_status == 0 && retry_count--) { rte_delay_ms(retry_delay); - rte_eth_link_get(qos_conf[i].tx_port, &link); + ret = rte_eth_link_get(qos_conf[i].tx_port, &link); + rte_exit(EXIT_FAILURE, + "rte_eth_link_get: err=%d, port=%u: %s\n", + ret, qos_conf[i].tx_port, rte_strerror(-ret)); } qos_conf[i].sched_port = app_init_sched_port(qos_conf[i].tx_port, socket); -- 2.45.2