/* This header declares the driver interface we implement */
#include <fman.h>
#include <of.h>
+#include <rte_malloc.h>
#include <rte_dpaa_logs.h>
#include <rte_string_fns.h>
mprop = "fsl,fman-mac";
/* Allocate an object for this network interface */
- __if = malloc(sizeof(*__if));
+ __if = rte_malloc(NULL, sizeof(*__if), RTE_CACHE_LINE_SIZE);
if (!__if) {
FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*__if));
goto err;
uint64_t bpool_host[6] = {0};
const char *pname;
/* Allocate an object for the pool */
- bpool = malloc(sizeof(*bpool));
+ bpool = rte_malloc(NULL, sizeof(*bpool), RTE_CACHE_LINE_SIZE);
if (!bpool) {
FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*bpool));
goto err;
if (!pool_node) {
FMAN_ERR(-ENXIO, "%s: bad fsl,bman-buffer-pools\n",
dname);
- free(bpool);
+ rte_free(bpool);
goto err;
}
pname = pool_node->full_name;
prop = of_get_property(pool_node, "fsl,bpid", &proplen);
if (!prop) {
FMAN_ERR(-EINVAL, "%s: no fsl,bpid\n", pname);
- free(bpool);
+ rte_free(bpool);
goto err;
}
assert(proplen == sizeof(*prop));
-errno, strerror(errno));
printf("Tearing down %s\n", __if->node_path);
list_del(&__if->__if.node);
- free(__if);
+ rte_free(__if);
}
close(fman_ccsr_map_fd);
RTE_LOG(DEBUG, EAL, "DPAA Bus not present. Skipping.\n");
return 0;
}
-
- /* Load the device-tree driver */
- ret = of_init();
- if (ret) {
- DPAA_BUS_LOG(ERR, "of_init failed with ret: %d", ret);
- return -1;
- }
-
- /* Get the interface configurations from device-tree */
- dpaa_netcfg = netcfg_acquire();
- if (!dpaa_netcfg) {
- DPAA_BUS_LOG(ERR, "netcfg_acquire failed");
- return -EINVAL;
- }
-
- RTE_LOG(NOTICE, EAL, "DPAA Bus Detected\n");
-
- if (!dpaa_netcfg->num_ethports) {
- DPAA_BUS_LOG(INFO, "no network interfaces available");
- /* This is not an error */
- return 0;
- }
-
-#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
- dump_netcfg(dpaa_netcfg);
-#endif
-
- DPAA_BUS_LOG(DEBUG, "Number of ethernet devices = %d",
- dpaa_netcfg->num_ethports);
- ret = dpaa_create_device_list();
- if (ret) {
- DPAA_BUS_LOG(ERR, "Unable to create device list. (%d)", ret);
- return ret;
- }
+ /* detected DPAA devices */
+ rte_dpaa_bus.detected = 1;
/* create the key, supplying a function that'll be invoked
* when a portal affined thread will be deleted.
return -1;
}
+static int
+rte_dpaa_bus_dev_build(void)
+{
+ int ret;
+
+ /* Load the device-tree driver */
+ ret = of_init();
+ if (ret) {
+ DPAA_BUS_LOG(ERR, "of_init failed with ret: %d", ret);
+ return -1;
+ }
+
+ /* Get the interface configurations from device-tree */
+ dpaa_netcfg = netcfg_acquire();
+ if (!dpaa_netcfg) {
+ DPAA_BUS_LOG(ERR, "netcfg_acquire failed");
+ return -EINVAL;
+ }
+
+ RTE_LOG(NOTICE, EAL, "DPAA Bus Detected\n");
+
+ if (!dpaa_netcfg->num_ethports) {
+ DPAA_BUS_LOG(INFO, "no network interfaces available");
+ /* This is not an error */
+ return 0;
+ }
+
+#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+ dump_netcfg(dpaa_netcfg);
+#endif
+
+ DPAA_BUS_LOG(DEBUG, "Number of ethernet devices = %d",
+ dpaa_netcfg->num_ethports);
+ ret = dpaa_create_device_list();
+ if (ret) {
+ DPAA_BUS_LOG(ERR, "Unable to create device list. (%d)", ret);
+ return ret;
+ }
+ return 0;
+}
+
static int
rte_dpaa_bus_probe(void)
{
int probe_all = rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST;
/* If DPAA bus is not present nothing needs to be done */
+ if (!rte_dpaa_bus.detected)
+ return 0;
+
+ rte_dpaa_bus_dev_build();
+
+ /* If no device present on DPAA bus nothing needs to be done */
if (TAILQ_EMPTY(&rte_dpaa_bus.device_list))
return 0;