[dpdk-dev] [PATCH] eal: add asynchronous request API to DPDK IPC

Burakov, Anatoly anatoly.burakov at intel.com
Sat Mar 3 13:29:47 CET 2018


On 02-Mar-18 6:48 PM, Stephen Hemminger wrote:
> On Tue, 27 Feb 2018 14:59:29 +0000
> Anatoly Burakov <anatoly.burakov at intel.com> wrote:
> 
>> +rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts)
>>   {
>> +	struct sync_request *dummy;
>> +	struct async_request_shared_param *param = NULL;
>> +	struct rte_mp_reply *reply = NULL;
>> +	int dir_fd, ret = 0;
>> +	DIR *mp_dir;
>> +	struct dirent *ent;
>> +	struct timeval now;
>> +	struct timespec *end = NULL;
>> +
>> +	RTE_LOG(DEBUG, EAL, "request: %s\n", req->name);
>> +
>> +	if (check_input(req) == false)
>> +		return -1;
>> +	if (gettimeofday(&now, NULL) < 0) {
>> +		RTE_LOG(ERR, EAL, "Faile to get current time\n");
>> +		rte_errno = errno;
>> +		return -1;
>> +	}
> 
> gettimeofday is not a good API to use in DPDK.
> It gets changed by NTP; if you have to use system time you want monotonic clock
> 

We need current time because pthread_cond_timedwait() accepts current 
time. So it's either that, or reimplementing pthread_cond_timedwait() in 
DPDK using monotonic clock :) Unless, of course, there already are 
alternatives that use monotonic clock and that don't need other DPDK 
machinery (e.g. rte_malloc) to work (like rte_alarm callbacks).

-- 
Thanks,
Anatoly


More information about the dev mailing list