[dpdk-dev] [PATCH] fm10k: fix wrong VLAN value in RX mbuf

He, Shaopeng shaopeng.he at intel.com
Fri Nov 20 03:33:09 CET 2015


Hi, Mark

> -----Original Message-----
> From: Chen, Jing D
> Sent: Thursday, November 19, 2015 3:05 PM
> To: He, Shaopeng; dev at dpdk.org
> Cc: Qiu, Michael
> Subject: RE: [PATCH] fm10k: fix wrong VLAN value in RX mbuf
> 
> Hi,
> 
> Worth to adding comments that vlan_tci is only valid in case
> RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE  is turned on and Flag
> PKT_RX_VLAN_PKT is set.
Good suggestion. But, actually, we have a little different case in fm10k:
fm10k has a switch core inside, which associates a VLAN ID for each packet.
For those packets coming in without a VLAN, the port default VLAN ID will
be used. So for fm10k, vlan_tci is always valid. 
For Flag PKT_RX_VLAN_PKT, currently it will be set when there is inner VLAN
in the packet. This is not correct, I will fix it by setting PKT_RX_VLAN_PKT
always on in next version.

To verify this, different situations have been tested on
current implementation:
1. Ixia sent VLAN 51 packet, DPDK received: vlan_tci=51, PKT_RX_VLAN_PKT=0
2. sent non-VLAN packet, ether port's default VLAN ID is 1
    received: vlan_tci=1, PKT_RX_VLAN_PKT=0
3. sent double-VLAN packet (outer 51, inner 17),
    received: vlan_tci=51, PKT_RX_VLAN_PKT=1

Thanks,
--Shaopeng
> 
> Best Regards,
> Mark
> 
> 
> > -----Original Message-----
> > From: He, Shaopeng
> > Sent: Wednesday, November 18, 2015 4:50 PM
> > To: dev at dpdk.org
> > Cc: Chen, Jing D; Qiu, Michael; He, Shaopeng
> > Subject: [PATCH] fm10k: fix wrong VLAN value in RX mbuf
> >
> > VLAN value should be copied from RX descriptor to mbuf, this patch
> > fixes this issue.
> >
> > Signed-off-by: Shaopeng He <shaopeng.he at intel.com>
> > ---
> >  drivers/net/fm10k/fm10k_rxtx.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/fm10k/fm10k_rxtx.c
> > b/drivers/net/fm10k/fm10k_rxtx.c index 1bac28d..eeb635e 100644
> > --- a/drivers/net/fm10k/fm10k_rxtx.c
> > +++ b/drivers/net/fm10k/fm10k_rxtx.c
> > @@ -146,6 +146,7 @@ fm10k_recv_pkts(void *rx_queue, struct rte_mbuf
> > **rx_pkts,  #endif
> >
> >  		mbuf->hash.rss = desc.d.rss;
> > +		mbuf->vlan_tci = desc.w.vlan &
> > FM10K_RXD_VLAN_ID_MASK;
> >
> >  		rx_pkts[count] = mbuf;
> >  		if (++next_dd == q->nb_desc) {
> > @@ -292,6 +293,7 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct
> > rte_mbuf **rx_pkts,
> >  		rx_desc_to_ol_flags(first_seg, &desc);  #endif
> >  		first_seg->hash.rss = desc.d.rss;
> > +		first_seg->vlan_tci = desc.w.vlan &
> > FM10K_RXD_VLAN_ID_MASK;
> >
> >  		/* Prefetch data of first segment, if configured to do so. */
> >  		rte_packet_prefetch((char *)first_seg->buf_addr +
> > --
> > 1.9.3


More information about the dev mailing list