[dpdk-dev] [PATCH RFC v2 07/12] lib/librte_vhost: async event and callback

Xie, Huawei huawei.xie at intel.com
Wed Dec 17 18:51:51 CET 2014


> 
> I got error from checkpatch.pl like followings.
> 
> ERROR: trailing statements should be on next line
> #74: FILE: lib/librte_vhost/vhost_user/fd_man.c:61:
> + for (i = 0; i < pfdset->num && pfdset->fd[i].fd != fd; i++);
Thanks.
This is RFC, so maybe it is far from perfection, :).

> > +	int num = MAX_FDS;
> 
> Is it possible to use pfdset->num?
> 

Had considered this.
It is not performance critical code, and it is easier to use MAX_FDS.
We could improve this after we have processed all the critical things.

> > +
> > +			int added = 0;
> 
> Need a line?

Thanks!
> 
> > +			if (pfdentry->rcb && rfset) {
> > +				FD_SET(pfdentry->fd, rfset);
> > +				added = 1;
> > +			


> > +	fd_set rfds,wfds;
> 
> Need a space between rfds and wfds.

Agree.
> 
> > +	int i, maxfds;
> > +	struct fdentry *pfdentry;
> > +	int num = MAX_FDS;
> 
> Is it possible to use pfdset->num?
>

> > +
> > +	if (pfdset == NULL)
> > +		return;
> > +
> > +	while (1) {
> > +		FD_ZERO(&rfds);
> > +		FD_ZERO(&wfds);
> > +		maxfds = fdset_fill(&rfds, &wfds, pfdset);
> > +		if (maxfds == -1) {
> > +			return;
> > +		}
> > +
> > +		select(maxfds + 1, &rfds, &wfds, NULL, NULL);
> > +
> > +		for (i = 0; i < num; i++) {
> > +			pfdentry = &pfdset->fd[i];
> > +			if (FD_ISSET(pfdentry->fd, &rfds) && pfdentry->rcb)
> > +				pfdentry->rcb(pfdentry->fd, pfdentry->dat);
> > +			if (FD_ISSET(pfdentry->fd, &wfds) && pfdentry->wcb)
> > +				pfdentry->wcb(pfdentry->fd, pfdentry->dat);
> > +		}
> > +	}
> > +}



More information about the dev mailing list