From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 2E227803B for ; Mon, 9 May 2016 20:08:29 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 09 May 2016 11:08:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,601,1455004800"; d="scan'208";a="699290358" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by FMSMGA003.fm.intel.com with ESMTP; 09 May 2016 11:08:19 -0700 Date: Mon, 9 May 2016 11:12:54 -0700 From: Yuanhan Liu To: "Xie, Huawei" Cc: "dev@dpdk.org" Message-ID: <20160509181254.GE5641@yliu-dev.sh.intel.com> References: <1462603224-29510-1-git-send-email-yuanhan.liu@linux.intel.com> <1462603224-29510-4-git-send-email-yuanhan.liu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH 3/6] vhost: add reconnect ability X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2016 18:08:29 -0000 On Mon, May 09, 2016 at 04:47:02PM +0000, Xie, Huawei wrote: > On 5/7/2016 2:36 PM, Yuanhan Liu wrote: > > +static void * > > +vhost_user_client_reconnect(void *arg) > > +{ > > + struct reconnect_info *reconn = arg; > > + int ret; > > + > > + RTE_LOG(ERR, VHOST_CONFIG, "reconnecting...\n"); > > + while (1) { > > + ret = connect(reconn->fd, (struct sockaddr *)&reconn->un, > > + sizeof(reconn->un)); > > + if (ret == 0) > > + break; > > + sleep(1); > > + } > > + > > + vhost_user_add_connection(reconn->fd, reconn->vsocket); > > + free(reconn); > > + > > + return NULL; > > +} > > + > > We could create hundreds of vhost-user ports in OVS. Wihout connections > with QEMU established, those ports are just inactive. This works fine in > server mode. > With client modes, do we need to create hundreds of vhost threads? This > would be too interruptible. > How about we create only one thread and do the reconnections for all the > unconnected socket? Yes, good point and good suggestion. Will do it in v2. Thanks. --yliu