[dpdk-dev] [PATCH] app/testpmd: check Rx VLAN offload flag to print VLAN TCI

Hyong Youb Kim hyonkim at cisco.com
Tue Oct 2 04:29:59 CEST 2018


On Mon, Oct 01, 2018 at 03:01:40PM +0100, Ferruh Yigit wrote:
> On 9/26/2018 4:06 AM, John Daley wrote:
> > From: Hyong Youb Kim <hyonkim at cisco.com>
> > 
> > Since the following commit, PKT_RX_VLAN indicates the presence of
> > mbuf's vlan_tci, not PKT_RX_VLAN_STRIPPED.
> > 
> > commit 380a7aab1ae2 ("mbuf: rename deprecated VLAN flags")
> > Cc: olivier.matz at 6wind.com
> > 
> > Signed-off-by: Hyong Youb Kim <hyonkim at cisco.com>
> > Reviewed-by: John Daley <johndale at cisco.com>
> > ---
> >  app/test-pmd/rxonly.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
> > index a93d80612..e8d226624 100644
> > --- a/app/test-pmd/rxonly.c
> > +++ b/app/test-pmd/rxonly.c
> > @@ -130,7 +130,7 @@ pkt_burst_receive(struct fwd_stream *fs)
> >  		}
> >  		if (ol_flags & PKT_RX_TIMESTAMP)
> >  			printf(" - timestamp %"PRIu64" ", mb->timestamp);
> > -		if (ol_flags & PKT_RX_VLAN_STRIPPED)
> > +		if (ol_flags & PKT_RX_VLAN)
> >  			printf(" - VLAN tci=0x%x", mb->vlan_tci);
> >  		if (ol_flags & PKT_RX_QINQ_STRIPPED)
> >  			printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
> 
> Isn't same also correct for QinQ, PKT_RX_QINQ means mb->vlan_tci &
> mb->vlan_tci_outer are set?
> 

That is a good point.

According to rte_mbuf.h, PKT_RX_QINQ means "The RX packet is a double
VLAN, and the outer tci has been saved in in mbuf->vlan_tci_outer."

Here is a summary.
PKT_RX_VLAN => vlan_tci is set
PKT_RX_QINQ => vlan_tci_outer is set
PKT_RX_VLAN_STRIPPED => must also set PKT_RX_VLAN
PKT_RX_QINQ_STRIPPED => must also set PKT_RX_VLAN, PKT_RX_QINQ,
                        PKT_RX_VLAN_STRIPPED

Looks like i40e is the only driver that is using
PKT_RX_QINQ_STRIPPED. And, it does not set PKT_RX_QINQ. I am CC'ing
i40e maintainers.

Back to rxonly..

+               if (ol_flags & (PKT_RX_QINQ | PKT_RX_VLAN))
                        printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
                                        mb->vlan_tci, mb->vlan_tci_outer);

A change like this would be technically correct, but may break i40e
test cases. Or, if the above message is really meant for 'stripped',
then perhaps add comment or rephrase the message for now?

As for the use of PKT_RX_VLAN, some drivers like enic and ixgbe can
set PKT_RX_VLAN independent of vlan stripping, which led me to writing
this patch. I think Olivier fixed all drivers when he introduced
PKT_RX_VLAN. So using PKT_RX_VLAN in rxonly shouldn't be breaking
anyone's test cases.

-Hyong


More information about the dev mailing list