Padding more bytes than necessary one broke another variants of

PCIe RealTek chips. Only pad IP packets if the payload is less than
28 bytes.

Obtained from:	NetBSD
PR:		kern/122221
This commit is contained in:
Pyun YongHyeon 2008-03-31 04:03:14 +00:00
parent 5ab512bb8e
commit a4148af5f0
2 changed files with 7 additions and 1 deletions

View File

@ -2171,7 +2171,7 @@ re_encap(sc, m_head)
* offload is enabled, we always manually pad short frames out * offload is enabled, we always manually pad short frames out
* to the minimum ethernet frame size. * to the minimum ethernet frame size.
*/ */
if ((*m_head)->m_pkthdr.len < RL_MIN_FRAMELEN && if ((*m_head)->m_pkthdr.len < RL_IP4CSUMTX_PADLEN &&
((*m_head)->m_pkthdr.csum_flags & CSUM_IP) != 0) { ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) != 0) {
padlen = RL_MIN_FRAMELEN - (*m_head)->m_pkthdr.len; padlen = RL_MIN_FRAMELEN - (*m_head)->m_pkthdr.len;
if (M_WRITABLE(*m_head) == 0) { if (M_WRITABLE(*m_head) == 0) {

View File

@ -497,6 +497,12 @@
#define RL_ETHER_ALIGN 2 #define RL_ETHER_ALIGN 2
/*
* re(4) hardware ip4csum-tx could be mangled with 28 bytes or less IP packets.
*/
#define RL_IP4CSUMTX_MINLEN 28
#define RL_IP4CSUMTX_PADLEN (ETHER_HDR_LEN + RL_IP4CSUMTX_MINLEN)
struct rl_chain_data { struct rl_chain_data {
uint16_t cur_rx; uint16_t cur_rx;
uint8_t *rl_rx_buf; uint8_t *rl_rx_buf;