[PATCH v9 1/9] net/tap: do not duplicate fd's

Stephen Hemminger stephen at networkplumber.org
Thu May 2 01:53:33 CEST 2024


On Wed, 1 May 2024 12:13:45 +0100
Ferruh Yigit <ferruh.yigit at amd.com> wrote:

> > diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
> > index fa50fe45d7..a78fd50cd4 100644
> > --- a/drivers/net/tap/tap_flow.c
> > +++ b/drivers/net/tap/tap_flow.c
> > @@ -1595,8 +1595,9 @@ tap_flow_isolate(struct rte_eth_dev *dev,
> >  	 * If netdevice is there, setup appropriate flow rules immediately.
> >  	 * Otherwise it will be set when bringing up the netdevice (tun_alloc).
> >  	 */
> > -	if (!process_private->rxq_fds[0])
> > +	if (process_private->fds[0] == -1)
> >  
> 
> change in the condition looks reasonable but not directly related with
> the change, does it require its own patch?

In this case, the array of fds is moving from the rxq to being global.
The old code worked because rxq_fds[] was initialized to zero.
With shared fd's the fds are now initialized to -1.

Using zero as sentinel fd is bad practice, because it is a valid fd;
but POSIX says it always is stdin.


More information about the dev mailing list