Index: sys/dev/bge/if_bge.c =================================================================== --- sys/dev/bge/if_bge.c (revision 255014) +++ sys/dev/bge/if_bge.c (working copy) @@ -121,7 +121,6 @@ __FBSDID("$FreeBSD$"); #include #define BGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP) -#define ETHER_MIN_NOPAD (ETHER_MIN_LEN - ETHER_CRC_LEN) /* i.e., 60 */ MODULE_DEPEND(bge, pci, 1, 1, 1); MODULE_DEPEND(bge, ether, 1, 1, 1); @@ -4466,10 +4465,8 @@ bge_rxcsum(struct bge_softc *sc, struct bge_rx_bd if ((cur_rx->bge_ip_csum ^ 0xFFFF) == 0) m->m_pkthdr.csum_flags |= CSUM_IP_VALID; } - if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM && - m->m_pkthdr.len >= ETHER_MIN_NOPAD) { - m->m_pkthdr.csum_data = - cur_rx->bge_tcp_udp_csum; + if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM) { + m->m_pkthdr.csum_data = cur_rx->bge_tcp_udp_csum; m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; } @@ -5007,51 +5004,6 @@ bge_stats_update(struct bge_softc *sc) #undef READ_STAT } -/* - * Pad outbound frame to ETHER_MIN_NOPAD for an unusual reason. - * The bge hardware will pad out Tx runts to ETHER_MIN_NOPAD, - * but when such padded frames employ the bge IP/TCP checksum offload, - * the hardware checksum assist gives incorrect results (possibly - * from incorporating its own padding into the UDP/TCP checksum; who knows). - * If we pad such runts with zeros, the onboard checksum comes out correct. - */ -static __inline int -bge_cksum_pad(struct mbuf *m) -{ - int padlen = ETHER_MIN_NOPAD - m->m_pkthdr.len; - struct mbuf *last; - - /* If there's only the packet-header and we can pad there, use it. */ - if (m->m_pkthdr.len == m->m_len && M_WRITABLE(m) && - M_TRAILINGSPACE(m) >= padlen) { - last = m; - } else { - /* - * Walk packet chain to find last mbuf. We will either - * pad there, or append a new mbuf and pad it. - */ - for (last = m; last->m_next != NULL; last = last->m_next); - if (!(M_WRITABLE(last) && M_TRAILINGSPACE(last) >= padlen)) { - /* Allocate new empty mbuf, pad it. Compact later. */ - struct mbuf *n; - - MGET(n, M_NOWAIT, MT_DATA); - if (n == NULL) - return (ENOBUFS); - n->m_len = 0; - last->m_next = n; - last = n; - } - } - - /* Now zero the pad area, to avoid the bge cksum-assist bug. */ - memset(mtod(last, caddr_t) + last->m_len, 0, padlen); - last->m_len += padlen; - m->m_pkthdr.len += padlen; - - return (0); -} - static struct mbuf * bge_check_short_dma(struct mbuf *m) { @@ -5191,15 +5143,8 @@ bge_encap(struct bge_softc *sc, struct mbuf **m_he } else if ((m->m_pkthdr.csum_flags & sc->bge_csum_features) != 0) { if (m->m_pkthdr.csum_flags & CSUM_IP) csum_flags |= BGE_TXBDFLAG_IP_CSUM; - if (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) { + if (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) csum_flags |= BGE_TXBDFLAG_TCP_UDP_CSUM; - if (m->m_pkthdr.len < ETHER_MIN_NOPAD && - (error = bge_cksum_pad(m)) != 0) { - m_freem(m); - *m_head = NULL; - return (error); - } - } } if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0) {