ix: fixup hardware vlan tagging and stripping

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ix: fixup hardware vlan tagging and stripping

Mike Belopuhov
hi,

hardware vlan tagging/stripping got broken with the driver update.
freebsd people have changed the code to handle events from the vlan(4)
pseudo-device into the hardware driver.  so when you configure new
vlan a special function is called and driver can setup a vlan filtering
table.  because of this, their driver checks for the num_vlans counter
that's incremented every time you add a new vlan.  in particular, when
stripping tags and configuring rx ring.

as we don't do anything like that, we should just configure rx ring to
do vlan stripping and that's about it.

i've tested it on 82598 and 82599.  ok?

--- dev/pci/if_ix.c
+++ dev/pci/if_ix.c
@@ -3114,8 +3114,7 @@ ixgbe_rxeof(struct ix_queue *que, int count)
  /* Singlet, prepare to send */
  sendmp = mh;
 #if NVLAN > 0
- if ((sc->num_vlans) &&
-    (staterr & IXGBE_RXD_STAT_VP)) {
+ if (staterr & IXGBE_RXD_STAT_VP) {
  sendmp->m_pkthdr.ether_vtag = vtag;
  sendmp->m_flags |= M_VLANTAG;
  }
@@ -3142,8 +3141,7 @@ ixgbe_rxeof(struct ix_queue *que, int count)
  sendmp = mp;
  sendmp->m_pkthdr.len = mp->m_len;
 #if NVLAN > 0
- if ((sc->num_vlans) &&
-    (staterr & IXGBE_RXD_STAT_VP)) {
+ if (staterr & IXGBE_RXD_STAT_VP) {
  sendmp->m_pkthdr.ether_vtag = vtag;
  sendmp->m_flags |= M_VLANTAG;
  }
@@ -3243,15 +3241,6 @@ ixgbe_setup_vlan_hw_support(struct ix_softc *sc)
  int i;
 
  /*
- * We get here thru ixgbe_init, meaning
- * a soft reset, this has already cleared
- * the VFTA and other state, so if there
- * have been no vlan's registered do nothing.
- */
- if (sc->num_vlans == 0)
- return;
-
- /*
  * A soft reset zero's out the VFTA, so
  * we need to repopulate it now.
  */

Reply | Threaded
Open this post in threaded view
|

Re: ix: fixup hardware vlan tagging and stripping

Mike Belopuhov
Hi,

If there's no objections, I'm going to commit it soon.

Thanks

On Tue, Dec 20, 2011 at 15:30 +0100, Mike Belopuhov wrote:

> hi,
>
> hardware vlan tagging/stripping got broken with the driver update.
> freebsd people have changed the code to handle events from the vlan(4)
> pseudo-device into the hardware driver.  so when you configure new
> vlan a special function is called and driver can setup a vlan filtering
> table.  because of this, their driver checks for the num_vlans counter
> that's incremented every time you add a new vlan.  in particular, when
> stripping tags and configuring rx ring.
>
> as we don't do anything like that, we should just configure rx ring to
> do vlan stripping and that's about it.
>
> i've tested it on 82598 and 82599.  ok?
>
> --- dev/pci/if_ix.c
> +++ dev/pci/if_ix.c
> @@ -3114,8 +3114,7 @@ ixgbe_rxeof(struct ix_queue *que, int count)
>   /* Singlet, prepare to send */
>   sendmp = mh;
>  #if NVLAN > 0
> - if ((sc->num_vlans) &&
> -    (staterr & IXGBE_RXD_STAT_VP)) {
> + if (staterr & IXGBE_RXD_STAT_VP) {
>   sendmp->m_pkthdr.ether_vtag = vtag;
>   sendmp->m_flags |= M_VLANTAG;
>   }
> @@ -3142,8 +3141,7 @@ ixgbe_rxeof(struct ix_queue *que, int count)
>   sendmp = mp;
>   sendmp->m_pkthdr.len = mp->m_len;
>  #if NVLAN > 0
> - if ((sc->num_vlans) &&
> -    (staterr & IXGBE_RXD_STAT_VP)) {
> + if (staterr & IXGBE_RXD_STAT_VP) {
>   sendmp->m_pkthdr.ether_vtag = vtag;
>   sendmp->m_flags |= M_VLANTAG;
>   }
> @@ -3243,15 +3241,6 @@ ixgbe_setup_vlan_hw_support(struct ix_softc *sc)
>   int i;
>  
>   /*
> - * We get here thru ixgbe_init, meaning
> - * a soft reset, this has already cleared
> - * the VFTA and other state, so if there
> - * have been no vlan's registered do nothing.
> - */
> - if (sc->num_vlans == 0)
> - return;
> -
> - /*
>   * A soft reset zero's out the VFTA, so
>   * we need to repopulate it now.
>   */