[dpdk-dev] [PATCH V12 3/3] app/testpmd: use uevent to monitor hotplug

Guo, Jia jia.guo at intel.com
Thu Jan 25 15:58:24 CET 2018



On 1/24/2018 11:21 PM, Wu, Jingjing wrote:
>> +
>> +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?
sure.
>> +	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?
ok,make sense.



More information about the dev mailing list