diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2005-06-12 23:43:30 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2005-06-12 23:43:30 +0000 |
commit | 9e60384e603b7b64967dab1b4ab1b7283a2f479c (patch) | |
tree | ebf85249e71c1cda569f6882d9ba6570d65ee1db /sys | |
parent | e85babcd73c874cc09f1aa54d487da493a66f6f3 (diff) |
Back out revs 1.48 and 1.49. Checksum offloading caused problems on
an 82547EI and may affects others. Ok henning@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_em.c | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 4c10ab4867c..26667673dd5 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ -/* $OpenBSD: if_em.c,v 1.54 2005/06/01 02:07:12 brad Exp $ */ +/* $OpenBSD: if_em.c,v 1.55 2005/06/12 23:43:29 millert Exp $ */ #include "bpfilter.h" #include "vlan.h" @@ -56,8 +56,6 @@ POSSIBILITY OF SUCH DAMAGE. #include <netinet/in_var.h> #include <netinet/ip.h> #include <netinet/if_ether.h> -#include <netinet/tcp.h> -#include <netinet/udp.h> #endif #if NVLAN > 0 @@ -183,7 +181,7 @@ void em_disable_promisc(struct em_softc *); void em_set_multi(struct em_softc *); void em_print_hw_stats(struct em_softc *); void em_update_link_status(struct em_softc *); -int em_get_buf(int, struct em_softc *, +int em_get_buf(int i, struct em_softc *, struct mbuf *); void em_enable_vlans(struct em_softc *); void em_disable_vlans(struct em_softc *); @@ -996,10 +994,11 @@ em_encap(struct em_softc *sc, struct mbuf **m_headp) return (ENOBUFS); } - if (sc->hw.mac_type >= em_82543) - em_transmit_checksum_setup(sc, m_head, &txd_upper, &txd_lower); - else - txd_upper = txd_lower = 0; + +#if 0 + em_transmit_checksum_setup(sc, m_head, &txd_upper, &txd_lower); +#endif + txd_upper = txd_lower = 0; /* Find out if we are in vlan mode */ #if NVLAN > 0 @@ -1657,9 +1656,6 @@ em_setup_interface(struct em_softc *sc) ifp->if_capabilities = IFCAP_VLAN_MTU; - if (sc->hw.mac_type >= em_82543) - ifp->if_capabilities |= IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4; - /* * Specify the media types supported by this adapter and register * callbacks to update media and link information @@ -1994,6 +1990,7 @@ em_free_transmit_structures(struct em_softc *sc) * context only if the protocol type changes. * **********************************************************************/ +#if 0 void em_transmit_checksum_setup(struct em_softc *sc, struct mbuf *mp, @@ -2005,14 +2002,16 @@ em_transmit_checksum_setup(struct em_softc *sc, int curr_txd; if (mp->m_pkthdr.csum_flags) { - if (mp->m_pkthdr.csum_flags & M_TCPV4_CSUM_OUT) { + + if (mp->m_pkthdr.csum_flags & CSUM_TCP) { *txd_upper = E1000_TXD_POPTS_TXSM << 8; *txd_lower = E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; if (sc->active_checksum_context == OFFLOAD_TCP_IP) return; else sc->active_checksum_context = OFFLOAD_TCP_IP; - } else if (mp->m_pkthdr.csum_flags & M_UDPV4_CSUM_OUT) { + + } else if (mp->m_pkthdr.csum_flags & CSUM_UDP) { *txd_upper = E1000_TXD_POPTS_TXSM << 8; *txd_lower = E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; if (sc->active_checksum_context == OFFLOAD_UDP_IP) @@ -2070,6 +2069,7 @@ em_transmit_checksum_setup(struct em_softc *sc, return; } +#endif /********************************************************************** * @@ -2635,24 +2635,14 @@ em_receive_checksum(struct em_softc *sc, (rx_desc->status & E1000_RXD_STAT_IXSM)) return; - if (rx_desc->status & E1000_RXD_STAT_IPCS) { - /* Did it pass? */ - if (!(rx_desc->errors & E1000_RXD_ERR_IPE)) { - /* IP Checksum Good */ - mp->m_pkthdr.csum_flags = M_IPV4_CSUM_IN_OK; + if ((rx_desc->status & (E1000_RXD_STAT_IPCS|E1000_RXD_ERR_IPE)) == + E1000_RXD_STAT_IPCS) + mp->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK; - } else { - mp->m_pkthdr.csum_flags = 0; - } - } - - if (rx_desc->status & E1000_RXD_STAT_TCPCS) { - /* Did it pass? */ - if (!(rx_desc->errors & E1000_RXD_ERR_TCPE)) { - mp->m_pkthdr.csum_flags |= - M_TCP_CSUM_IN_OK | M_UDP_CSUM_IN_OK; - } - } + if ((rx_desc->status & (E1000_RXD_STAT_IPCS|E1000_RXD_ERR_IPE| + E1000_RXD_STAT_TCPCS|E1000_RXD_ERR_TCPE)) == + (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_IPCS)) + mp->m_pkthdr.csum_flags |= M_TCP_CSUM_IN_OK | M_UDP_CSUM_IN_OK; } void |