[dpdk-dev] [PATCH v2 3/4] eal: add synchronous multi-process communication
Tan, Jianfeng
jianfeng.tan at intel.com
Wed Jan 17 14:15:53 CET 2018
On 1/17/2018 9:09 PM, Tan, Jianfeng wrote:
>
>
> On 1/17/2018 6:50 PM, Ananyev, Konstantin wrote:
>
[...]
>> +int
>> +rte_eal_mp_request(const char *action_name,
>> + void *params,
>> + int len_p,
>> + int fds[],
>> + int fds_in,
>> + int fds_out)
>> +{
>> + int i, j;
>> + int sockfd;
>> + int nprocs;
>> + int ret = 0;
>> + struct mp_msghdr *req;
>> + struct timeval tv;
>> + char buf[MAX_MSG_LENGTH];
>> + struct mp_msghdr *hdr;
>> +
>> + RTE_LOG(DEBUG, EAL, "request: %s\n", action_name);
>> +
>> + if (fds_in > SCM_MAX_FD || fds_out > SCM_MAX_FD) {
>> + RTE_LOG(ERR, EAL, "Cannot send more than %d FDs\n",
>> SCM_MAX_FD);
>> + rte_errno = -E2BIG;
>> + return 0;
>> + }
>> +
>> + req = format_msg(action_name, params, len_p, fds_in, MP_REQ);
>> + if (req == NULL)
>> + return 0;
>> +
>> + if ((sockfd = open_unix_fd(0)) < 0) {
>> + free(req);
>> + return 0;
>> + }
>> +
>> + tv.tv_sec = 5; /* 5 Secs Timeout */
>> + tv.tv_usec = 0;
>> + if (setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO,
>> + (const void *)&tv, sizeof(struct timeval)) < 0)
>> + RTE_LOG(INFO, EAL, "Failed to set recv timeout\n");
>>
>> I f you set it just for one call, why do you not restore it?
>
> Yes, original code is buggy, I should have put it into the critical
> section.
>
> Do you mean we just create once and use for ever? if yes, we could put
> the open and setting into mp_init().
A second thought, we shall not put the setting into mp_init(). It'll be
set to non-blocking as of sending msg, but blocking as of receiving msg.
Thanks,
Jianfeng
More information about the dev
mailing list