From: Mauricio Vasquez B Date: Tue, 3 May 2016 21:16:57 +0000 (+0200) Subject: examples: remove useless check of port count X-Git-Tag: spdx-start~6911 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b4e0f64ff271ccc78f6275b6bd49194e86fd4f4b;p=dpdk.git examples: remove useless check of port count 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 Acked-by: Ferruh Yigit --- diff --git a/app/proc_info/main.c b/app/proc_info/main.c index 341176db70..5f8309244b 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 59803f7c54..3d56cd29a5 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 03d997793b..2444e36e34 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 e77d67c759..b51b2dc98b 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 a4dbb5452e..779df97db0 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 dc68989a1c..3c6112d7f3 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 81a49187ae..b00f1e6c43 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 c27e73536e..a8aabdcb1a 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 00ab2d84e3..1dc505c1ed 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/kni/main.c b/examples/kni/main.c index 0cf23e771d..f9fc61e029 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -318,8 +318,6 @@ main_loop(__rte_unused void *arg) }; enum lcore_rxtx flag = LCORE_NONE; - nb_ports = (uint8_t)(nb_ports < RTE_MAX_ETHPORTS ? - nb_ports : RTE_MAX_ETHPORTS); for (i = 0; i < nb_ports; i++) { if (!kni_port_params_array[i]) continue; diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index d4e2d8de0e..d18c813b18 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 4bd7c41dde..cd284b7d3a 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 9f3a77d2ea..c19384038b 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 8da89aa15c..4a0d9b645b 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 1ad9488755..c093d4d391 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 c8347a2e90..16f6110e4b 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1917,8 +1917,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 cb42bfb968..f746960e90 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 034c22a702..ca01b112be 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 bf6d88568e..7a79cd2cf7 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 9981598907..04dc3e4066 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 2dc8b829c8..368b309932 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 4ad16eac2a..400daed57a 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 9af030dde5..b8297dd979 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 32a79be458..665886e7aa 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -1421,8 +1421,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 8018677fe8..2b04c959d8 100644 --- a/examples/vhost_xen/main.c +++ b/examples/vhost_xen/main.c @@ -1445,8 +1445,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 178af2f5b9..360492bae7 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 62e1422a85..617263b49b 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