ethdev: add probing finish function
[dpdk.git] / drivers / net / failsafe / failsafe.c
index dc9b0d0..b35471d 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "failsafe_private.h"
 
+int failsafe_logtype;
+
 const char pmd_failsafe_driver_name[] = FAILSAFE_DRIVER_NAME;
 static const struct rte_eth_link eth_link = {
        .link_speed = ETH_SPEED_NUM_10G,
@@ -224,7 +226,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev)
                                                               mac);
                        if (ret) {
                                ERROR("Failed to set default MAC address");
-                               goto free_args;
+                               goto cancel_alarm;
                        }
                }
        } else {
@@ -257,7 +259,10 @@ fs_eth_dev_create(struct rte_vdev_device *vdev)
                .fd = -1,
                .type = RTE_INTR_HANDLE_EXT,
        };
+       rte_eth_dev_probing_finish(dev);
        return 0;
+cancel_alarm:
+       failsafe_hotplug_alarm_cancel(dev);
 free_args:
        failsafe_args_free(dev);
 free_subs:
@@ -304,11 +309,12 @@ rte_pmd_failsafe_probe(struct rte_vdev_device *vdev)
            strlen(rte_vdev_device_args(vdev)) == 0) {
                eth_dev = rte_eth_dev_attach_secondary(name);
                if (!eth_dev) {
-                       RTE_LOG(ERR, PMD, "Failed to probe %s\n", name);
+                       ERROR("Failed to probe %s", name);
                        return -1;
                }
                /* TODO: request info from primary to set up Rx and Tx */
                eth_dev->dev_ops = &failsafe_ops;
+               rte_eth_dev_probing_finish(eth_dev);
                return 0;
        }
 
@@ -332,3 +338,12 @@ static struct rte_vdev_driver failsafe_drv = {
 
 RTE_PMD_REGISTER_VDEV(net_failsafe, failsafe_drv);
 RTE_PMD_REGISTER_PARAM_STRING(net_failsafe, PMD_FAILSAFE_PARAM_STRING);
+
+RTE_INIT(failsafe_init_log);
+static void
+failsafe_init_log(void)
+{
+       failsafe_logtype = rte_log_register("pmd.net.failsafe");
+       if (failsafe_logtype >= 0)
+               rte_log_set_level(failsafe_logtype, RTE_LOG_NOTICE);
+}