diff options
author | jfv <jfv@FreeBSD.org> | 2010-04-08 00:50:43 +0000 |
---|---|---|
committer | jfv <jfv@FreeBSD.org> | 2010-04-08 00:50:43 +0000 |
commit | 3e6076f696e3705fd7336b6ed13398bc8566f873 (patch) | |
tree | 68a8e409d8b3dd727d5f6e8ef53a40b725755b0f | |
parent | be707c1fafd726b976fe68d176d63ab88f370e4d (diff) | |
download | FreeBSD-src-3e6076f696e3705fd7336b6ed13398bc8566f873.zip FreeBSD-src-3e6076f696e3705fd7336b6ed13398bc8566f873.tar.gz |
Important fix got clobbered in the em driver, keeping
VLAN HWFILTER from being used by default, this breaks
stacked pseudo devices, and as it turns out, also breaks
virtual machines that happen to use VLANS (didn't know that
before :). Put the fix back into the em driver, and for good
measure add the same code to the igb driver where it should
have been anyway.
-rw-r--r-- | sys/dev/e1000/if_em.c | 33 | ||||
-rw-r--r-- | sys/dev/e1000/if_igb.c | 43 |
2 files changed, 67 insertions, 9 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index f8329f8..e5281b2 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -93,7 +93,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.0.0"; +char em_driver_version[] = "7.0.1"; /********************************************************************* @@ -1118,6 +1118,10 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; reinit = 1; } + if (mask & IFCAP_VLAN_HWFILTER) { + ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; + reinit = 1; + } if ((mask & IFCAP_WOL) && (ifp->if_capabilities & IFCAP_WOL) != 0) { if (mask & IFCAP_WOL_MCAST) @@ -1228,8 +1232,18 @@ em_init_locked(struct adapter *adapter) /* Setup VLAN support, basic and offload if available */ E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); - /* Use real VLAN Filter support */ - em_setup_vlan_hw_support(adapter); + /* Use real VLAN Filter support? */ + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + /* Use real VLAN Filter support */ + em_setup_vlan_hw_support(adapter); + else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + } + } /* Set hardware offload abilities */ ifp->if_hwassist = 0; @@ -2656,12 +2670,23 @@ em_setup_interface(device_t dev, struct adapter *adapter) ifp->if_capenable |= IFCAP_TSO4; /* - * Tell the upper layer(s) we support long frames. + * Tell the upper layer(s) we + * support full VLAN capability */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + /* + ** Dont turn this on by default, if vlans are + ** created on another pseudo device (eg. lagg) + ** then vlan events are not passed thru, breaking + ** operation, but with HW FILTER off it works. If + ** using vlans directly on the em driver you can + ** enable this and get full hardware tag filtering. + */ + ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; + #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; #endif diff --git a/sys/dev/e1000/if_igb.c b/sys/dev/e1000/if_igb.c index 5fdd52c..7e0b183 100644 --- a/sys/dev/e1000/if_igb.c +++ b/sys/dev/e1000/if_igb.c @@ -99,7 +99,7 @@ int igb_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char igb_driver_version[] = "version - 1.9.3"; +char igb_driver_version[] = "version - 1.9.4"; /********************************************************************* @@ -1055,6 +1055,10 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; reinit = 1; } + if (mask & IFCAP_VLAN_HWFILTER) { + ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; + reinit = 1; + } if (mask & IFCAP_LRO) { ifp->if_capenable ^= IFCAP_LRO; reinit = 1; @@ -1110,6 +1114,19 @@ igb_init_locked(struct adapter *adapter) E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); + /* Use real VLAN Filter support? */ + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + /* Use real VLAN Filter support */ + igb_setup_vlan_hw_support(adapter); + else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + } + } + /* Set hardware offload abilities */ ifp->if_hwassist = 0; if (ifp->if_capenable & IFCAP_TXCSUM) { @@ -2669,13 +2686,24 @@ igb_setup_interface(device_t dev, struct adapter *adapter) #endif /* - * Tell the upper layer(s) we support long frames. + * Tell the upper layer(s) we + * support full VLAN capability. */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; /* + ** Dont turn this on by default, if vlans are + ** created on another pseudo device (eg. lagg) + ** then vlan events are not passed thru, breaking + ** operation, but with HW FILTER off it works. If + ** using vlans directly on the em driver you can + ** enable this and get full hardware tag filtering. + */ + ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; + + /* * Specify the media types supported by this adapter and register * callbacks to update media and link information */ @@ -3779,6 +3807,9 @@ igb_setup_receive_ring(struct rx_ring *rxr) /* Update descriptor */ rxr->rx_base[j].read.pkt_addr = htole64(pseg[0].ds_addr); } + + /* Setup our descriptor indices */ + rxr->next_to_check = 0; rxr->next_to_refresh = 0; rxr->lro_enabled = FALSE; @@ -4672,10 +4703,12 @@ igb_update_stats_counters(struct adapter *adapter) { struct ifnet *ifp; - if(adapter->hw.phy.media_type == e1000_media_type_copper || + if (adapter->hw.phy.media_type == e1000_media_type_copper || (E1000_READ_REG(&adapter->hw, E1000_STATUS) & E1000_STATUS_LU)) { - adapter->stats.symerrs += E1000_READ_REG(&adapter->hw, E1000_SYMERRS); - adapter->stats.sec += E1000_READ_REG(&adapter->hw, E1000_SEC); + adapter->stats.symerrs += + E1000_READ_REG(&adapter->hw, E1000_SYMERRS); + adapter->stats.sec += + E1000_READ_REG(&adapter->hw, E1000_SEC); } adapter->stats.crcerrs += E1000_READ_REG(&adapter->hw, E1000_CRCERRS); adapter->stats.mpc += E1000_READ_REG(&adapter->hw, E1000_MPC); |