From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from compass.polito.it (compass.polito.it [130.192.55.110]) by dpdk.org (Postfix) with ESMTP id 89BF85598 for ; Fri, 29 Apr 2016 17:48:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by compass.polito.it (Postfix) with ESMTP id 23BC110019F for ; Fri, 29 Apr 2016 17:48:27 +0200 (CEST) Authentication-Results: compass.polito.it (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=studenti.polito.it DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= studenti.polito.it; h=x-mailer:message-id:date:date:subject :subject:to:from:from:received:received; s=y2k10; t=1461944905; bh=fuKCtddPFz4de8rIlfVQJI4xTY3dAu3xnEQ1PY5QajU=; b=mQ/TTCotxuYp 44Gyh/RrpQDpEo6GfPJQiN7+lWvnIWk+7phifkX0uejsTG+wmHdQOBKkr6+dH8qO PYhYUt9ut/Avte2vbp39SfG6aa4ihJnOwoP7ilBS3YPp33pxmdJtGHxAsek6bYCH ZrgpneXvKIiiXRaZwDn+FT1o+KhslIA= X-Virus-Scanned: amavisd-new at studenti.polito.it X-Spam-Flag: NO X-Spam-Score: -5.765 X-Spam-Level: X-Spam-Status: No, score=-5.765 tagged_above=-100 required=3.5 tests=[ALL_TRUSTED=-5, AWL=0.735, BAYES_00=-1.5] autolearn=ham Received: from compass.polito.it ([127.0.0.1]) by localhost (compass.polito.it [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Wi9MHro_znGc for ; Fri, 29 Apr 2016 17:48:25 +0200 (CEST) Received: from mvb-X455LJ.ipv6.polito.it (unknown [130.192.225.144]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: s203403@studenti.polito.it) by compass.polito.it (Postfix) with ESMTPSA id 004A710017C for ; Fri, 29 Apr 2016 17:48:24 +0200 (CEST) From: Mauricio Vasquez B To: dev@dpdk.org Date: Fri, 29 Apr 2016 17:48:19 +0200 Message-Id: <1461944899-28944-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] examples: remove useless checking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 15:48:27 -0000 The rte_eth_dev_count() function will never return a value greater than RTE_MAX_ETHPORTS, so that checking is useless. Signed-off-by: Mauricio Vasquez B --- app/proc_info/main.c | 4 ---- app/test/test_pmd_perf.c | 3 --- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 3 --- doc/guides/sample_app_ug/l2_forward_real_virtual.rst | 3 --- doc/guides/sample_app_ug/link_status_intr.rst | 3 --- examples/dpdk_qat/main.c | 2 -- examples/ip_fragmentation/main.c | 4 +--- examples/ip_reassembly/main.c | 4 +--- examples/ipsec-secgw/ipsec-secgw.c | 4 ---- examples/l2fwd-crypto/main.c | 3 --- examples/l2fwd-ivshmem/host/host.c | 3 --- examples/l2fwd-jobstats/main.c | 3 --- examples/l2fwd-keepalive/main.c | 3 --- examples/l2fwd/main.c | 3 --- examples/l3fwd-acl/main.c | 2 -- examples/l3fwd-power/main.c | 3 --- examples/l3fwd-vf/main.c | 2 -- examples/l3fwd/main.c | 2 -- examples/link_status_interrupt/main.c | 3 --- examples/multi_process/l2fwd_fork/main.c | 3 --- examples/performance-thread/l3fwd-thread/main.c | 2 -- examples/tep_termination/main.c | 2 -- examples/vhost/main.c | 2 -- examples/vhost_xen/main.c | 2 -- examples/vmdq/main.c | 2 -- examples/vmdq_dcb/main.c | 2 -- 26 files changed, 2 insertions(+), 70 deletions(-) diff --git a/app/proc_info/main.c b/app/proc_info/main.c index 341176d..5f83092 100644 --- a/app/proc_info/main.c +++ b/app/proc_info/main.c @@ -327,10 +327,6 @@ main(int argc, char **argv) if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* If no port mask was specified*/ if (enabled_port_mask == 0) enabled_port_mask = 0xffff; diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 59803f7..3d56cd2 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -709,9 +709,6 @@ test_pmd_perf(void) return -1; } - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - nb_lcores = rte_lcore_count(); memset(lcore_conf, 0, sizeof(lcore_conf)); diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index 03d9977..2444e36 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -238,9 +238,6 @@ in the *DPDK Programmer's Guide* and the *DPDK API Reference*. if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* reset l2fwd_dst_ports */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index e77d67c..b51b2dc 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -242,9 +242,6 @@ in the *DPDK Programmer's Guide* - Rel 1.4 EAR and the *DPDK API Reference*. if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* reset l2fwd_dst_ports */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index a4dbb54..779df97 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -145,9 +145,6 @@ To fully understand this code, it is recommended to study the chapters that rela if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* * Each logical core is assigned a dedicated TX queue on each port. */ diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c index dc68989..3c6112d 100644 --- a/examples/dpdk_qat/main.c +++ b/examples/dpdk_qat/main.c @@ -661,8 +661,6 @@ main(int argc, char **argv) return -1; nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; if (check_port_config(nb_ports) < 0) rte_panic("check_port_config failed\n"); diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 81a4918..b00f1e6 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -824,9 +824,7 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid arguments"); nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - else if (nb_ports == 0) + if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No ports found!\n"); nb_lcores = rte_lcore_count(); diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index c27e735..a8aabdc 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -1040,9 +1040,7 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid IP reassembly parameters\n"); nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - else if (nb_ports == 0) + if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No ports found!\n"); nb_lcores = rte_lcore_count(); diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 00ab2d8..1dc505c 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -636,8 +636,6 @@ check_params(void) } nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; for (i = 0; i < nb_lcore_params; ++i) { lcore = lcore_params[i].lcore_id; @@ -1286,8 +1284,6 @@ main(int32_t argc, char **argv) unprotected_port_mask); nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; if (check_params() < 0) rte_exit(EXIT_FAILURE, "check_params failed\n"); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index d4e2d8d..d18c813 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -1785,9 +1785,6 @@ initialize_ports(struct l2fwd_crypto_options *options) return -1; } - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* Reset l2fwd_dst_ports */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) l2fwd_dst_ports[portid] = 0; diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c index 4bd7c41..cd284b7 100644 --- a/examples/l2fwd-ivshmem/host/host.c +++ b/examples/l2fwd-ivshmem/host/host.c @@ -677,9 +677,6 @@ int main(int argc, char **argv) if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* * reserve memzone to communicate with VMs - we cannot use rte_malloc here * because while it is technically possible, it is a very bad idea to share diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 9f3a77d..c193840 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -811,9 +811,6 @@ main(int argc, char **argv) if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* reset l2fwd_dst_ports */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) l2fwd_dst_ports[portid] = 0; diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 8da89aa..4a0d9b6 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -570,9 +570,6 @@ main(int argc, char **argv) if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* reset l2fwd_dst_ports */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) l2fwd_dst_ports[portid] = 0; diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 1ad9488..c093d4d 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -551,9 +551,6 @@ main(int argc, char **argv) if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* reset l2fwd_dst_ports */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) l2fwd_dst_ports[portid] = 0; diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 26d9f5e..dbf4c1e 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1914,8 +1914,6 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n"); nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; if (check_port_config(nb_ports) < 0) rte_exit(EXIT_FAILURE, "check_port_config failed\n"); diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index cb42bfb..f746960 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -1572,10 +1572,7 @@ main(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n"); - nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; if (check_port_config(nb_ports) < 0) rte_exit(EXIT_FAILURE, "check_port_config failed\n"); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 034c22a..ca01b11 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -982,8 +982,6 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n"); nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; if (check_port_config(nb_ports) < 0) rte_exit(EXIT_FAILURE, "check_port_config failed\n"); diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index bf6d885..7a79cd2 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -868,8 +868,6 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n"); nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; if (check_port_config(nb_ports) < 0) rte_exit(EXIT_FAILURE, "check_port_config failed\n"); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 9981598..04dc3e4 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -580,9 +580,6 @@ main(int argc, char **argv) if (nb_ports == 0) rte_panic("No Ethernet port - bye\n"); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* * Each logical core is assigned a dedicated TX queue on each port. */ diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c index 2dc8b82..368b309 100644 --- a/examples/multi_process/l2fwd_fork/main.c +++ b/examples/multi_process/l2fwd_fork/main.c @@ -979,9 +979,6 @@ main(int argc, char **argv) if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; - /* create the mbuf pool */ for (portid = 0; portid < nb_ports; portid++) { /* skip ports that are not enabled */ diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 4ad16ea..400daed 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -3482,8 +3482,6 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "init_rx_rings failed\n"); nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; if (check_port_config(nb_ports) < 0) rte_exit(EXIT_FAILURE, "check_port_config failed\n"); diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c index f97d552..887cb26 100644 --- a/examples/tep_termination/main.c +++ b/examples/tep_termination/main.c @@ -1190,8 +1190,6 @@ main(int argc, char *argv[]) /* Get the number of physical ports. */ nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; /* * Update the global var NB_PORTS and global array PORTS diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 28c17af..b22138f 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -2992,8 +2992,6 @@ main(int argc, char *argv[]) /* Get the number of physical ports. */ nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; /* * Update the global var NUM_PORTS and global array PORTS diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c index d83138d..2d69849 100644 --- a/examples/vhost_xen/main.c +++ b/examples/vhost_xen/main.c @@ -1460,8 +1460,6 @@ main(int argc, char *argv[]) /* Get the number of physical ports. */ nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; /* * Update the global var NUM_PORTS and global array PORTS diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 178af2f..360492b 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -599,8 +599,6 @@ main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "Not enough cores\n"); nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; /* * Update the global var NUM_PORTS and global array PORTS diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 62e1422..617263b 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -662,8 +662,6 @@ main(int argc, char *argv[]) } nb_ports = rte_eth_dev_count(); - if (nb_ports > RTE_MAX_ETHPORTS) - nb_ports = RTE_MAX_ETHPORTS; /* * Update the global var NUM_PORTS and global array PORTS -- 1.9.1