examples: remove useless check of port count
authorMauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
Tue, 3 May 2016 21:16:57 +0000 (23:16 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 16 May 2016 19:01:51 +0000 (21:01 +0200)
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 <mauricio.vasquezbernal@studenti.polito.it>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
27 files changed:
app/proc_info/main.c
app/test/test_pmd_perf.c
doc/guides/sample_app_ug/l2_forward_job_stats.rst
doc/guides/sample_app_ug/l2_forward_real_virtual.rst
doc/guides/sample_app_ug/link_status_intr.rst
examples/dpdk_qat/main.c
examples/ip_fragmentation/main.c
examples/ip_reassembly/main.c
examples/ipsec-secgw/ipsec-secgw.c
examples/kni/main.c
examples/l2fwd-crypto/main.c
examples/l2fwd-ivshmem/host/host.c
examples/l2fwd-jobstats/main.c
examples/l2fwd-keepalive/main.c
examples/l2fwd/main.c
examples/l3fwd-acl/main.c
examples/l3fwd-power/main.c
examples/l3fwd-vf/main.c
examples/l3fwd/main.c
examples/link_status_interrupt/main.c
examples/multi_process/l2fwd_fork/main.c
examples/performance-thread/l3fwd-thread/main.c
examples/tep_termination/main.c
examples/vhost/main.c
examples/vhost_xen/main.c
examples/vmdq/main.c
examples/vmdq_dcb/main.c

index 341176db70246f6fb2da48c95e8026fe455191dd..5f8309244badff54e8495aa7b83d9735f317aa82 100644 (file)
@@ -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;
index 59803f7c54341ea98fee5f6c0632e84babb8b14b..3d56cd29a5dbcd7468ebdac580b17d680c2c0a2c 100644 (file)
@@ -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));
index 03d997793b508d919f91b081e25c786c337160b8..2444e36e345134e21bec72d18315a61384197806 100644 (file)
@@ -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++)
index e77d67c7599ad0f4d070474c2878e1c062c7c616..b51b2dc98ba0d14e527f35faddb1789b89f404a3 100644 (file)
@@ -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++)
index a4dbb5452e8902a4c5791b5794bb51fa743b6bdb..779df97db0deaa1fdb99786949ea37fefaeef1d4 100644 (file)
@@ -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.
      */
index dc68989a1cf1ac25463a2401899640c40ce7dc5a..3c6112d7f34f56ad236de50c467321770d269186 100644 (file)
@@ -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");
index 81a49187ae32236568ef5be0d2195b9451876075..b00f1e6c43f08081dede733767a9e6582cd54745 100644 (file)
@@ -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();
index c27e73536e27d30df8a9d2384a3808af681474cc..a8aabdcb1a4f2dac40e07d3ff1467035fafbeb1e 100644 (file)
@@ -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();
index 00ab2d84e3c5b609334f2910fc9b187e1459806a..1dc505c1ed932f1ba4bac2bc70a328b6c84497b4 100644 (file)
@@ -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");
index 0cf23e771dd2ddf69c6065db680c5bef3c45cdb1..f9fc61e0290e5323b512def56627a4273d1efa80 100644 (file)
@@ -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;
index d4e2d8de0ee4d19a1317de0f0250a067c9267c12..d18c813b180729901d0f838e0599e720656120f5 100644 (file)
@@ -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;
index 4bd7c41ddeeb004130f54ac377d34cedb89b1d19..cd284b7d3a91322e519f9ca8229e87ce8abf52ce 100644 (file)
@@ -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
index 9f3a77d2ea1b96678940e6c7eac32cc2b0fe9182..c19384038bfe452b369e98113037ca204183c979 100644 (file)
@@ -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;
index 8da89aa15c460fd514c4c31e0e99ab60a37c59ab..4a0d9b645bc5bbbc2732050e4f75b0d11be7b9ce 100644 (file)
@@ -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;
index 1ad9488755474fef8a829ca7197a64d3058e71b7..c093d4d39179faccaf26ce28bd68bf54126f4c06 100644 (file)
@@ -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;
index c8347a2e907f3d94399fd53558eedef15db8e4be..16f6110e4bae61ff91f17703efaa113da645fec7 100644 (file)
@@ -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");
index cb42bfb9686f6c602c09ce8c18b68c32e64dbdde..f746960e90b5388040c116650197b37c7f327a55 100644 (file)
@@ -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");
index 034c22a702c646f2d3ebe6673ef6b1eb66f9e5a7..ca01b112befe82e97acc12f25f757b12e3e1289d 100644 (file)
@@ -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");
index bf6d88568e3a0f2bd4fe396fca691ad177b1ef0a..7a79cd2cf7b7f321f0901cb19d1ab2154e0cdd09 100644 (file)
@@ -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");
index 99815989079fa654cfff7c06b54ef46e7a5c7d0b..04dc3e40660f9b6ffb3fc747e59febaa9fad9f9e 100644 (file)
@@ -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.
         */
index 2dc8b829c82ca19061e0883b6d40610854b4319b..368b3099321314a6c7fbc73493bf6203f1e78d68 100644 (file)
@@ -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 */
index 4ad16eac2a721db000434de73cca21ba9980af98..400daed57a44b3697b713219bc5baf11eb0f870c 100644 (file)
@@ -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");
index 9af030dde5b5e4a98e8a308f1560ce74ef42ac04..b8297dd9797ed926ae8fe58b1e2168bf758b2a29 100644 (file)
@@ -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
index 32a79be458e9a6a20a063b277c2edebca6b3aa37..665886e7aa5b73cc443eec54e21b8438fe99e332 100644 (file)
@@ -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
index 8018677fe805d7eb65d76aefbfa756f9599c39f7..2b04c959d86b8162094b54b5817078ff85dbb5f4 100644 (file)
@@ -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
index 178af2f5b9d98aa06a3814cc9feafec5e2b73c42..360492bae70fbabf76da2e5475f8ed6f961f4abd 100644 (file)
@@ -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
index 62e1422a85e55af511ae4330b2ef2eb906f63c49..617263b49b659284b5e83b8ca582ab405b9a2d69 100644 (file)
@@ -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