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 355DD45AAF; Fri, 4 Oct 2024 18:25:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD25342E7E; Fri, 4 Oct 2024 18:24:39 +0200 (CEST) Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by mails.dpdk.org (Postfix) with ESMTP id 85BE642DE9 for ; Fri, 4 Oct 2024 18:24:33 +0200 (CEST) Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3e0402a98caso1267907b6e.3 for ; Fri, 04 Oct 2024 09:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728059073; x=1728663873; 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=7Fn+HA/+MQIZnnVV8BaGhJ1Z65AXKEWTPOlH3Rf8+sI=; b=jwmdFvqYYb7os1hwFIgHCT4cNZSvAkmaWoLbF4ofGjA6w0EzT/jdsK/X+/kUk9Kbo7 4TKIqwtvHTvEGVHQwiqpxFZrpbbRI4DmwIiEKO4XewCw6WNy8H5JNDzXbnP+nA9vIJFW npGrCwkgVCFKHK6gLOWMYWv1SWcV9KYfPagXyQECIASArCi7GZkBacZucUbUdruHuFwh L18+hEnqZr2utlrc8Lx/cX4PNIg2MoT+Vwv/q1BERHOtojRjLrP/FXTSlct/XTbrsY/U IyJj6chRFPU8458FXNL8Oyb1V1ahvaDNLSwa7vcfTS/gJyKZfZhh5pNI/a8T7AXVkz4P +m2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059073; x=1728663873; 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=7Fn+HA/+MQIZnnVV8BaGhJ1Z65AXKEWTPOlH3Rf8+sI=; b=ajq3TWYCv2NBSziXlou/g0k7xK5fQAuRmG3mkt8tNV6H0ObQW6yM1PHFZBDvx4Dfqn CSFJppQtenV/rne7ZkSMZ4NAjlxWFuhFRkMYdo/GlNCEphZUeXf1nww+RMhB+FAJlE60 XKfEkYB/NV2qNaUJiG+JeG2MzkIiBHZVnfcddguN2d1eqlEBOnRubkcM0Q1PT+hBCeps ZJOaQUssaE/SkWQBCWA2VGgKvFNx+XxhwFk5DBSa1xdrMas0ueTC59oFcwL2AoVGb4nQ LLfHkdtGsGaTBrBIvCN2FqolH/upkbZTKbZ1Vyug6KFEEjruvozGtxvCDoUFyBNb8h8A 4mqg== X-Gm-Message-State: AOJu0YwBIYZHrGhnVvh9BYTK90hieGtEblGFp8hKsoDIa2PNr5YlDPGf 5EEVeP9z8+qwQdw+9gFyW3c3L0VL+adt0TqmhcrIQlDta9wwjK3FBoUA1VswFB9Fgoks0AkX1UI PFadwkQ== X-Google-Smtp-Source: AGHT+IE6eYN3cBWoHw2gR19RTH/jDupfFsciL7hGJfFB4wSHw4JuRcBEEQSoCkjFDRUPQ6AmZr3fgA== X-Received: by 2002:a05:6808:1382:b0:3e0:67f2:b5dd with SMTP id 5614622812f47-3e3c1329c34mr3536106b6e.19.1728059072735; Fri, 04 Oct 2024 09:24:32 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 09:24:32 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram , Zhirun Yan Subject: [PATCH 05/10] examples/l3fwd: check return value from ethdev info Date: Fri, 4 Oct 2024 09:21:52 -0700 Message-ID: <20241004162418.52940-6-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 Need to check return value from rte_eth_dev_info_get. Signed-off-by: Stephen Hemminger --- examples/l3fwd-graph/main.c | 12 ++++++++++-- examples/l3fwd/l3fwd_fib.c | 16 ++++++++++++---- examples/l3fwd/l3fwd_lpm.c | 14 ++++++++++---- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c index a13dc01138..26b33184e5 100644 --- a/examples/l3fwd-graph/main.c +++ b/examples/l3fwd-graph/main.c @@ -1088,7 +1088,10 @@ main(int argc, char **argv) printf("Creating queues: nb_rxq=%d nb_txq=%u... ", nb_rx_queue, n_tx_queue); - rte_eth_dev_info_get(portid, &dev_info); + ret = rte_eth_dev_info_get(portid, &dev_info); + if (ret != 0) + rte_exit(EXIT_FAILURE, + "Unable to get info for port %u\n", portid); ret = config_port_max_pkt_len(&local_port_conf, &dev_info); if (ret != 0) @@ -1220,7 +1223,12 @@ main(int argc, char **argv) printf("rxq=%d,%d,%d ", portid, queueid, socketid); fflush(stdout); - rte_eth_dev_info_get(portid, &dev_info); + ret = rte_eth_dev_info_get(portid, &dev_info); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "rte_eth_dev_info_get: err=%d, port=%u\n", + ret, portid); + rxq_conf = dev_info.default_rxconf; rxq_conf.offloads = port_conf.rxmode.offloads; if (!per_port_pool) diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c index f38b19af3f..2000fac168 100644 --- a/examples/l3fwd/l3fwd_fib.c +++ b/examples/l3fwd/l3fwd_fib.c @@ -675,8 +675,12 @@ setup_fib(const int socketid) enabled_port_mask) == 0) continue; - rte_eth_dev_info_get(route_base_v4[i].if_out, - &dev_info); + ret = rte_eth_dev_info_get(route_base_v4[i].if_out, &dev_info); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Unable to get device info for port %u\n", + route_base_v4[i].if_out); + ret = rte_fib_add(ipv4_l3fwd_fib_lookup_struct[socketid], route_base_v4[i].ip, route_base_v4[i].depth, @@ -729,8 +733,12 @@ setup_fib(const int socketid) enabled_port_mask) == 0) continue; - rte_eth_dev_info_get(route_base_v6[i].if_out, - &dev_info); + ret = rte_eth_dev_info_get(route_base_v6[i].if_out, &dev_info); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Unable to get device info for port %u\n", + route_base_v6[i].if_out); + ret = rte_fib6_add(ipv6_l3fwd_fib_lookup_struct[socketid], route_base_v6[i].ip_8, route_base_v6[i].depth, diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index e8fd95aae9..39e5d7607b 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -588,8 +588,11 @@ setup_lpm(const int socketid) enabled_port_mask) == 0) continue; - rte_eth_dev_info_get(route_base_v4[i].if_out, - &dev_info); + ret = rte_eth_dev_info_get(route_base_v4[i].if_out, &dev_info); + if (ret < 0) + rte_exit(EXIT_FAILURE, "Unable to get device info for port %u\n", + route_base_v4[i].if_out); + ret = rte_lpm_add(ipv4_l3fwd_lpm_lookup_struct[socketid], route_base_v4[i].ip, route_base_v4[i].depth, @@ -632,8 +635,11 @@ setup_lpm(const int socketid) enabled_port_mask) == 0) continue; - rte_eth_dev_info_get(route_base_v6[i].if_out, - &dev_info); + ret = rte_eth_dev_info_get(route_base_v6[i].if_out, &dev_info); + if (ret < 0) + rte_exit(EXIT_FAILURE, "Unable to get device info for port %u\n", + route_base_v6[i].if_out); + ret = rte_lpm6_add(ipv6_l3fwd_lpm_lookup_struct[socketid], route_base_v6[i].ip_8, route_base_v6[i].depth, -- 2.45.2