From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 241392951 for ; Wed, 17 Jan 2018 14:15:55 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jan 2018 05:15:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,372,1511856000"; d="scan'208";a="22383538" Received: from tanjianf-mobl.ccr.corp.intel.com (HELO [10.255.24.247]) ([10.255.24.247]) by fmsmga004.fm.intel.com with ESMTP; 17 Jan 2018 05:15:53 -0800 To: "Ananyev, Konstantin" , "dev@dpdk.org" , "Burakov, Anatoly" References: <1512067450-59203-1-git-send-email-jianfeng.tan@intel.com> <1515643654-129489-1-git-send-email-jianfeng.tan@intel.com> <1515643654-129489-4-git-send-email-jianfeng.tan@intel.com> <2601191342CEEE43887BDE71AB9772588627E0E5@irsmsx105.ger.corp.intel.com> <5733adcf-ef47-2c07-a39c-7eda01add6e0@intel.com> <2601191342CEEE43887BDE71AB9772588627E2D8@irsmsx105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB9772588627EE16@irsmsx105.ger.corp.intel.com> <74ccd840-86af-4dba-e5ba-494017052841@intel.com> Cc: "Richardson, Bruce" , "thomas@monjalon.net" From: "Tan, Jianfeng" Message-ID: <7944df37-df86-67cc-9d1b-7be137771084@intel.com> Date: Wed, 17 Jan 2018 21:15:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <74ccd840-86af-4dba-e5ba-494017052841@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 3/4] eal: add synchronous multi-process communication X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jan 2018 13:15:56 -0000 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