[dpdk-dev] [PATCH V12 3/3] app/testpmd: use uevent to monitor hotplug
Wu, Jingjing
jingjing.wu at intel.com
Wed Jan 24 16:21:04 CET 2018
> +
> +static void
> +add_uevent_callback(void *arg)
> +{
> + char *dev_name = (char *)arg;
> +
> + rte_eal_alarm_cancel(add_uevent_callback, arg);
> +
> + if (!in_hotplug_list(dev_name))
> + return;
> +
> + RTE_LOG(ERR, EAL, "add device: %s\n", dev_name);
It's not an error, replace by printf?
> + attach_port(dev_name);
> +}
> +
> /* This function is used by the interrupt thread */
> static int
> eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
> @@ -1931,6 +2014,82 @@ eth_event_callback(portid_t port_id, enum
> rte_eth_event_type type, void *param,
> }
>
> static int
> +in_hotplug_list(const char *dev_name)
> +{
> + struct hotplug_request *hp_request = NULL;
> +
> + TAILQ_FOREACH(hp_request, &hp_list, next) {
> + if (!strcmp(hp_request->dev_name, dev_name))
> + break;
> + }
> +
> + if (hp_request)
> + return 1;
> +
Is it better to use TRUE and FALSE?
More information about the dev
mailing list