]> git.droids-corp.org - dpdk.git/commitdiff
examples: do not probe pci twice
authorThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 26 Sep 2014 11:42:51 +0000 (13:42 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 29 Sep 2014 11:08:53 +0000 (13:08 +0200)
Since commit a155d430119 ("support link bonding device initialization"),
rte_eal_pci_probe() is called in rte_eal_init().
So it doesn't have to be called by application anymore.
It has been fixed for testpmd in commit 2950a769315,
and this patch remove it from other applications.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
29 files changed:
app/test-pipeline/init.c
app/test/test_kni.c
examples/dpdk_qat/main.c
examples/exception_path/main.c
examples/ip_fragmentation/main.c
examples/ip_pipeline/init.c
examples/ip_reassembly/main.c
examples/ipv4_multicast/main.c
examples/kni/main.c
examples/l2fwd-ivshmem/host/host.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/load_balancer/init.c
examples/multi_process/client_server_mp/mp_client/client.c
examples/multi_process/client_server_mp/mp_server/init.c
examples/multi_process/client_server_mp/shared/init_drivers.h [deleted file]
examples/multi_process/l2fwd_fork/main.c
examples/multi_process/symmetric_mp/main.c
examples/netmap_compat/bridge/bridge.c
examples/qos_meter/main.c
examples/qos_sched/init.c
examples/quota_watermark/qw/init.c
examples/vhost/main.c
examples/vhost_xen/main.c
examples/vmdq/main.c

index a4337d0dbca275aa64eb119737082b87f5061bd0..17b6d23dced87524443d7bd343c518081079b471 100644 (file)
@@ -228,11 +228,6 @@ app_init_ports(void)
 {
        uint32_t i;
 
-       /* Init driver */
-       RTE_LOG(INFO, USER1, "Initializing the PMD driver ...\n");
-       if (rte_eal_pci_probe() < 0)
-               rte_panic("Cannot probe PCI\n");
-
        /* Init NIC ports, then start the ports */
        for (i = 0; i < app.n_ports; i++) {
                uint8_t port;
index 2860bf3bff4454adaf70481925a80d35279f427b..108113174bdf1c1b1d7143c27064f4b94984b458 100644 (file)
@@ -508,11 +508,6 @@ test_kni(void)
                printf("fail to create mempool for kni\n");
                return -1;
        }
-       ret = rte_eal_pci_probe();
-       if (ret < 0) {
-               printf("fail to probe PCI devices\n");
-               return -1;
-       }
 
        nb_ports = rte_eth_dev_count();
        if (nb_ports == 0) {
index 1599a0a275e3425545859161cf8a0db774bfb88e..c130ea32498a25421f4725eef6856f2cfd88830f 100644 (file)
@@ -696,9 +696,6 @@ MAIN(int argc, char **argv)
        if (ret < 0)
                return -1;
 
-       if (rte_eal_pci_probe() < 0)
-               rte_panic("Cannot probe PCI\n");
-
        if (check_lcore_params() < 0)
                rte_panic("check_lcore_params failed\n");
 
index f286bf205c7fad16430c08e5cca74dc5f1a60d37..b4859764ad8897c2a88a18bed16aace443def235 100644 (file)
@@ -567,11 +567,6 @@ main(int argc, char** argv)
                return -1;
        }
 
-       /* Scan PCI bus for recognised devices */
-       ret = rte_eal_pci_probe();
-       if (ret < 0)
-               FATAL_ERROR("Could not probe PCI (%d)", ret);
-
        /* Get number of ports found in scan */
        nb_sys_ports = rte_eth_dev_count();
        if (nb_sys_ports == 0)
index 6d309b593869ee1b1fa36ee5d72617d1a38a232c..75028aca98dff7e3f2fdd0a40a3638eae107fc88 100644 (file)
@@ -871,9 +871,6 @@ MAIN(int argc, char **argv)
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "Invalid arguments");
 
-       if (rte_eal_pci_probe() < 0)
-               rte_panic("Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports > RTE_MAX_ETHPORTS)
                nb_ports = RTE_MAX_ETHPORTS;
index e3ebd464d1c6c12d28990765e420f734fd7cc54a..cb7568b66ef3066cf30992e51e69f4e7809b8b5f 100644 (file)
@@ -474,11 +474,6 @@ app_init_ports(void)
 {
        uint32_t i;
 
-       /* Init driver */
-       RTE_LOG(INFO, USER1, "Initializing the PMD driver ...\n");
-       if (rte_eal_pci_probe() < 0)
-               rte_panic("Cannot probe PCI\n");
-
        /* Init NIC ports, then start the ports */
        for (i = 0; i < app.n_ports; i++) {
                uint32_t port;
index b6b4f599d8941406ff06675076e6d5957d23cc0b..9ba3f0a667cbbb4d8ad29fe2d3dff631b595fdc7 100644 (file)
@@ -1078,9 +1078,6 @@ MAIN(int argc, char **argv)
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "Invalid IP reassembly parameters\n");
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports > RTE_MAX_ETHPORTS)
                nb_ports = RTE_MAX_ETHPORTS;
index 35bd842a2c5abbf443316297c4e7a128180cc7c5..5c2ab8691c7e528ddd8cab843ceab66d06c6dbdd 100644 (file)
@@ -754,9 +754,6 @@ MAIN(int argc, char **argv)
        if (clone_pool == NULL)
                rte_exit(EXIT_FAILURE, "Cannot init clone mbuf pool\n");
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports == 0)
                rte_exit(EXIT_FAILURE, "No physical ports!\n");
index 7df1b36468f8472e7b563ec4220eda3354de5856..69d1ef21d35513d443a9dd75f2e1b2b5f5a1d994 100644 (file)
@@ -889,11 +889,6 @@ main(int argc, char** argv)
                return -1;
        }
 
-       /* Scan PCI bus for recognised devices */
-       ret = rte_eal_pci_probe();
-       if (ret < 0)
-               rte_exit(EXIT_FAILURE, "Could not probe PCI (%d)\n", ret);
-
        /* Get number of ports found in scan */
        nb_sys_ports = rte_eth_dev_count();
        if (nb_sys_ports == 0)
index 02e65b979e089d50140e3e947eb0b3ae5f7e5048..1800b3a19b0d726d5fffa8007be10df9aa51b104 100644 (file)
@@ -716,9 +716,6 @@ int main(int argc, char **argv)
        if (l2fwd_ivshmem_pktmbuf_pool == NULL)
                rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports == 0)
                rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
index 4069d7cc3c48f4024cc061e9e0ea469d6add0f9c..e16c9149f977c3b99a30806fc131b0a6e030ca9a 100644 (file)
@@ -615,9 +615,6 @@ MAIN(int argc, char **argv)
        if (l2fwd_pktmbuf_pool == NULL)
                rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports == 0)
                rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
index bafd26a886f92ec3041c46b42e02a2efa7c8c3b5..4dd6b3419155e863f5ae148f71c5d72621b2d378 100644 (file)
@@ -1995,9 +1995,6 @@ MAIN(int argc, char **argv)
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports > RTE_MAX_ETHPORTS)
                nb_ports = RTE_MAX_ETHPORTS;
index a9d5c80bc0e837fe3b215d354f713cdaebeed9f4..3bf63ffb9a76f49fcd910e854a754c42957b77c9 100644 (file)
@@ -1547,9 +1547,6 @@ MAIN(int argc, char **argv)
                rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
 
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports > RTE_MAX_ETHPORTS)
                nb_ports = RTE_MAX_ETHPORTS;
index 7b1e08a8f6b7a0a93537025a3ec31af25dd6bf69..f567aa8b3898a7bcf9afb62e5edead7e6ce8cec8 100644 (file)
@@ -1007,9 +1007,6 @@ MAIN(int argc, char **argv)
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports > RTE_MAX_ETHPORTS)
                nb_ports = RTE_MAX_ETHPORTS;
index e3e34636282fc6f4de97a40adfe3346281e40b3c..01220e3be7a7f202750ef5dc18423f088d2231a3 100644 (file)
@@ -2474,10 +2474,6 @@ MAIN(int argc, char **argv)
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
 
-
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports > RTE_MAX_ETHPORTS)
                nb_ports = RTE_MAX_ETHPORTS;
index 1a8755155d8bae349f84e7ee53b8ca9eb6adf5f8..b8b757120dcb962f3461d3baac3a66a4ad072ccd 100644 (file)
@@ -663,9 +663,6 @@ MAIN(int argc, char **argv)
        if (lsi_pktmbuf_pool == NULL)
                rte_panic("Cannot init mbuf pool\n");
 
-       if (rte_eal_pci_probe() < 0)
-               rte_panic("Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports == 0)
                rte_panic("No Ethernet port - bye\n");
index 2f00a7085c680d8068fe4d0020c7c47402459765..a30070656c9d46944d13f6126da1dd98ae83f9e6 100644 (file)
@@ -450,10 +450,6 @@ app_init_nics(void)
        int ret;
        uint32_t n_rx_queues, n_tx_queues;
 
-       if (rte_eal_pci_probe() < 0) {
-               rte_panic("Cannot probe PCI\n");
-       }
-
        /* Init NIC ports and queues, then start the ports */
        for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
                struct rte_mempool *pool;
index ee2338c191a59c66523383eafc8a223a3ce3aa99..af8f819d950012b23b1cc886eb593e8b7754c838 100644 (file)
@@ -65,7 +65,6 @@
 #include <rte_string_fns.h>
 
 #include "common.h"
-#include "init_drivers.h"
 
 /* Number of packets to attempt to read from queue */
 #define PKT_READ_SIZE  ((uint16_t)32)
@@ -240,8 +239,6 @@ main(int argc, char *argv[])
        if (parse_app_args(argc, argv) < 0)
                rte_exit(EXIT_FAILURE, "Invalid command-line arguments\n");
 
-       if (init_drivers() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot get NIC ports\n");
        if (rte_eth_dev_count() == 0)
                rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
 
index a84d1eed7ab1c4cdd2be8987ad67eb2f5b8bec1e..30518c069b2dc071017b01ad08058e039601dec3 100644 (file)
@@ -66,7 +66,6 @@
 #include <rte_cycles.h>
 
 #include "common.h"
-#include "init_drivers.h"
 #include "args.h"
 #include "init.h"
 #include "main.h"
@@ -308,11 +307,6 @@ init(int argc, char *argv[])
        argc -= retval;
        argv += retval;
 
-       /* initialise the nic drivers */
-       retval = init_drivers();
-       if (retval != 0)
-               rte_exit(EXIT_FAILURE, "Cannot initialise drivers\n");
-
        /* get total number of ports */
        total_ports = rte_eth_dev_count();
 
diff --git a/examples/multi_process/client_server_mp/shared/init_drivers.h b/examples/multi_process/client_server_mp/shared/init_drivers.h
deleted file mode 100644 (file)
index 3c9881f..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _INIT_DRIVERS_H_
-#define _INIT_DRIVERS_H_
-
-/**
- * Initialise all 1G and 10G NICs available
- */
-static inline int
-init_drivers(void)
-{
-       if (rte_eal_pci_probe() < 0)
-               return -1;
-
-       return 0;
-}
-
-#endif
index 03fba55ad96c76944f79dec23746d32d023adcc6..c887b633c453ec7d8d2ace440837067b60981846 100644 (file)
@@ -1050,9 +1050,6 @@ MAIN(int argc, char **argv)
        for (i = 0; i < RTE_MAX_LCORE; i++)
                lcore_resource[i].lcore_id = i;
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        nb_ports = rte_eth_dev_count();
        if (nb_ports == 0)
                rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
index b8f31b31a2cc26d09051371ea0894b1ea9669a05..504a27aae6e75e61ed247b28e7627635035f0d0d 100644 (file)
@@ -461,16 +461,14 @@ main(int argc, char **argv)
        argc -= ret;
        argv += ret;
 
-       /* probe to determine the NIC devices available */
-       proc_type = rte_eal_process_type();
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
+       /* determine the NIC devices available */
        if (rte_eth_dev_count() == 0)
                rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
 
        /* parse application arguments (those after the EAL ones) */
        smp_parse_args(argc, argv);
 
+       proc_type = rte_eal_process_type();
        mp = (proc_type == RTE_PROC_SECONDARY) ?
                        rte_mempool_lookup(_SMP_MBUF_POOL) :
                        rte_mempool_create(_SMP_MBUF_POOL, NB_MBUFS, MBUF_SIZE,
index 898277e532079def82aebba61f682b11201ab9b0..d9ceb423e1a34d705034aee0855edfb7fd34d7d4 100644 (file)
@@ -294,10 +294,6 @@ int main(int argc, char *argv[])
        if (ports.num == 0)
                rte_exit(EXIT_FAILURE, "no ports specified\n");
 
-       err = rte_eal_pci_probe();
-       if (err < 0)
-               rte_exit(EXIT_FAILURE, "rte_eal_pci_probe(): error %d\n", err);
-
        if (rte_eth_dev_count() < 1)
                rte_exit(EXIT_FAILURE, "Not enough ethernet ports available\n");
 
index b4b8c4f01634dd52afadaa62bd19e2b91f871a47..c02ac508514080b550042f43c787a7310c8ed4ed 100644 (file)
@@ -386,9 +386,6 @@ MAIN(int argc, char **argv)
        if (pool == NULL)
                rte_exit(EXIT_FAILURE, "Buffer pool creation error\n");
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "PCI probe error\n");
-
        /* NIC init */
        ret = rte_eth_dev_configure(port_rx, 1, 1, &port_conf);
        if (ret < 0)
index cbfd63f0c3a0d889e1559fce3d1053f64764c68e..f38802e125fba9c6fbb719f4dd4b0c5bd9760b92 100644 (file)
@@ -304,9 +304,6 @@ int app_init(void)
        char ring_name[MAX_NAME_LEN];
        char pool_name[MAX_NAME_LEN];
 
-       if (rte_eal_pci_probe() < 0)
-               rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
-
        if (rte_eth_dev_count() == 0)
                rte_exit(EXIT_FAILURE, "No Ethernet port - bye\n");
 
index a7f8c8504e74417b287cac1698c09a6c2ef4e1f2..9bc5db3368c828e4466a2f616e3547ff10eae0d4 100644 (file)
@@ -136,13 +136,6 @@ void configure_eth_port(uint8_t port_id)
 void
 init_dpdk(void)
 {
-    int ret;
-
-    /* Bind the drivers to usable devices */
-    ret = rte_eal_pci_probe();
-    if (ret < 0)
-        rte_exit(EXIT_FAILURE, "rte_eal_pci_probe(): error %d\n", ret);
-
     if (rte_eth_dev_count() < 2)
         rte_exit(EXIT_FAILURE, "Not enough ethernet port available\n");
 }
index 85ee8b8f11abbc8281d00cc0bbf38d80392aefe5..c81b8f51792347da50073eb3924e6884031aeb71 100644 (file)
@@ -3549,9 +3549,6 @@ MAIN(int argc, char *argv[])
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "Invalid argument\n");
 
-       if (rte_eal_pci_probe() != 0)
-               rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
-
        for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
                if (rte_lcore_is_enabled(lcore_id))
                        lcore_ids[core_id ++] = lcore_id;
index 56ffec8168db6a937e8a030084c5bfb50c332e7a..498de06204e8f704f9d409600019c007fcf7ed69 100644 (file)
@@ -1466,9 +1466,6 @@ MAIN(int argc, char *argv[])
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "Invalid argument\n");
 
-       if (rte_eal_pci_probe() != 0)
-               rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
-
        for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
                if (rte_lcore_is_enabled(lcore_id))
                        lcore_ids[core_id ++] = lcore_id;
index 35df23407a36850f9525508ed1e36139726da18e..a162d8b5d4f54ecd917517022d11bc3bd940475d 100644 (file)
@@ -597,9 +597,6 @@ MAIN(int argc, char *argv[])
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "Invalid VMDQ argument\n");
 
-       if (rte_eal_pci_probe() != 0)
-               rte_exit(EXIT_FAILURE, "Error with NIC driver initialization\n");
-
        for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
                if (rte_lcore_is_enabled(lcore_id))
                        lcore_ids[core_id ++] = lcore_id;