[PATCH 1/1] net/mana: add vlan tagging support
Long Li
longli at microsoft.com
Tue Feb 20 19:59:41 CET 2024
> Not sure if we want to do the same. Two reasons.
>
> 1. Searching the netvsc source, I don't see a place that it set hv->vlan_strip to
> false. It means !hv->vlan_string is always false, and rte_vlan_insert(&m) never
> run.
It's set here:
drivers/net/netvsc/hn_ethdev.c: hv->vlan_strip = !!(rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP);
>
> 2. Usually vlan_strip can be set to true or false if the hardware supports this
> feature. In the mana case, the hardware strips off the vlan tag anyway. There is
> no way to tell the mana hardware to keep the tag. Adding the tag back by
> software not only slows things down, but it also complicates the code and test.
> Not sure if there is any real application needs it.
If MANA always strips the tag, you need to add the tag back if needed.
>
> I am open to add it. But in my opinion, we don't need it. Let me know what you
> think.
> >
> > > pkts[pkt_received++] = mbuf;
> > > rxq->stats.packets++;
> > > rxq->stats.bytes += mbuf->data_len; diff --git
> > > a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c index
> > > 58c4a1d976..f075fcb0f5 100644
> > > --- a/drivers/net/mana/tx.c
> > > +++ b/drivers/net/mana/tx.c
> > > @@ -180,6 +180,15 @@ get_vsq_frame_num(uint32_t vsq)
> > > return v.vsq_frame;
> > > }
> > >
> > > +#define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */
> > > +#define VLAN_PRIO_SHIFT 13
> > > +#define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator
> > > / Drop Eligible Indicator */
> > > +#define VLAN_VID_MASK 0x0fff /* VLAN Identifier */
> > > +
> > > +#define mana_mbuf_vlan_tag_get_id(m) ((m)->vlan_tci &
> > > VLAN_VID_MASK)
> > > +#define mana_mbuf_vlan_tag_get_cfi(m) (!!((m)->vlan_tci &
> > > VLAN_CFI_MASK))
> > > +#define mana_mbuf_vlan_tag_get_prio(m) (((m)->vlan_tci &
> > > VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT)
> > > +
> >
> > Those definitions look like those in @Alan Elder's patch for netvsc.
> > Can we consolidate some of those definitions into a common place?
> >
> > Maybe in "lib/net/rte_ether.h"?
> >
>
> Ok. Will add it to rte_ether.h.
@Alan has sent a patch for some helper marcos for parsing vlan_tci, please use those helper marcos in
https://git.dpdk.org/next/dpdk-next-net/commit/?id=f9c66ea9b5bfd15f314f6d101f156a312121e7e1
Thanks,
Long
More information about the dev
mailing list