[dpdk-dev] [PATCH 3/6] vhost: add reconnect ability

Yuanhan Liu yuanhan.liu at linux.intel.com
Mon May 9 20:12:54 CEST 2016


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


More information about the dev mailing list