FreeBSD/sys/dev/e1000/if_lem.c
/*********************************************************************
 *
 *  Verify that the hardware indicated that the checksum is valid.
 *  Inform the stack about the status of checksum so that stack
 *  doesn't spend time verifying the checksum.
 *
 *********************************************************************/
Verify that the hardware indicated that the checksum is valid.
Inform the stack about the status of checksum so that stack
doesn't spend time verifying the checksum.
Verify that the hardware indicated that the checksum is valid . Inform the stack about the status of checksum so that stack doesn ' t spend time verifying the checksum .
static void
lem_receive_checksum(struct adapter *adapter,
	    struct e1000_rx_desc *rx_desc, struct mbuf *mp)
{
	if ((adapter->hw.mac.type < e1000_82543) ||
	    (rx_desc->status & E1000_RXD_STAT_IXSM)) {
		mp->m_pkthdr.csum_flags = 0;
		return;
	}
	if (rx_desc->status & E1000_RXD_STAT_IPCS) {
		if (!(rx_desc->errors & E1000_RXD_ERR_IPE)) {
			mp->m_pkthdr.csum_flags = CSUM_IP_CHECKED;
			mp->m_pkthdr.csum_flags |= CSUM_IP_VALID;
		} else {
			mp->m_pkthdr.csum_flags = 0;
		}
	}
	if (rx_desc->status & E1000_RXD_STAT_TCPCS) {
		if (!(rx_desc->errors & E1000_RXD_ERR_TCPE)) {
			mp->m_pkthdr.csum_flags |=
			(CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
			mp->m_pkthdr.csum_data = htons(0xffff);
		}
	}
}
static void lem_receive_checksum ( struct adapter * adapter , struct e1000_rx_desc * rx_desc , struct mbuf * mp ) { if ( ( adapter -> hw . mac . type < e1000_82543 ) || ( rx_desc -> status & E1000_RXD_STAT_IXSM ) ) { mp -> m_pkthdr . csum_flags = 0 ; return ; } if ( rx_desc -> status & E1000_RXD_STAT_IPCS ) { if ( ! ( rx_desc -> errors & E1000_RXD_ERR_IPE ) ) { mp -> m_pkthdr . csum_flags = CSUM_IP_CHECKED ; mp -> m_pkthdr . csum_flags |= CSUM_IP_VALID ; } else { mp -> m_pkthdr . csum_flags = 0 ; } } if ( rx_desc -> status & E1000_RXD_STAT_TCPCS ) { if ( ! ( rx_desc -> errors & E1000_RXD_ERR_TCPE ) ) { mp -> m_pkthdr . csum_flags |= ( CSUM_DATA_VALID | CSUM_PSEUDO_HDR ) ; mp -> m_pkthdr . csum_data = htons ( 0xffff ) ; } } }
Verify that the hardware indicated that the checksum is valid.
Verify that the hardware indicated that the checksum is valid .
/* 82543 or newer only */ /* Ignore Checksum bit is set */ /* Did it pass? */ /* IP Checksum Good */ /* Did it pass? */