[dpdk-dev] [PATCH v2] net/failsafe: fix source port ID in Rx packets

Thomas Monjalon thomas at monjalon.net
Thu Apr 18 17:51:18 CEST 2019


18/04/2019 17:39, Thomas Monjalon:
> 18/04/2019 17:32, Adrien Mazarguil:
> > When passed to the application, Rx packets retain the port ID value
> > originally set by slave devices. Unfortunately these IDs have no meaning to
> > applications, which are typically unaware of their existence.
> > 
> > This confuses those caring about the source port field in mbufs (m->port)
> > which experience issues ranging from traffic drop to crashes.
[...]
> > +/*
> > + * Override source port in Rx packets.
> > + *
> > + * Make Rx packets originate from this PMD instance instead of one of its
> > + * slaves. This is mandatory to avoid breaking applications.
> > + */
> > +static void
> > +failsafe_rx_set_port(struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint16_t port)
> > +{
> > +	unsigned int i;
> > +
> > +	for (i = 0; i != nb_pkts; ++i)
> > +		rx_pkts[i]->port = port;
> > +}
> > +
> >  uint16_t
> >  failsafe_rx_burst(void *queue,
> >  		  struct rte_mbuf **rx_pkts,
> > @@ -87,6 +102,9 @@ failsafe_rx_burst(void *queue,
> >  		sdev = sdev->next;
> >  	} while (nb_rx == 0 && sdev != rxq->sdev);
> >  	rxq->sdev = sdev;
> > +	if (nb_rx)
> > +		failsafe_rx_set_port(rx_pkts, nb_rx,
> > +				     rxq->priv->data->port_id);
> >  	return nb_rx;
> >  }
> 
> I'm afraid the performance drop to be hard.
> How the port id in mbuf is used exactly? What crash are you seeing?

Another way to fix it without performance drop would be to add
a new driver op to set the top-level port id.
This top-level id would be stored in the private structure of the port,
initialized with the port id of the port itself, and used to fill mbufs.

Thoughts?




More information about the dev mailing list