FreeBSD/sys/dev/e1000/if_em.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
em_receive_checksum(uint32_t status, struct mbuf *mp)
{
	mp->m_pkthdr.csum_flags = 0;
	if (status & E1000_RXD_STAT_IXSM)
		return;
	if ((status & (E1000_RXD_STAT_IPCS | E1000_RXDEXT_STATERR_IPE)) ==
		E1000_RXD_STAT_IPCS) {
		mp->m_pkthdr.csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID);
	}
	if ((status & (E1000_RXD_STAT_TCPCS | E1000_RXDEXT_STATERR_TCPE)) ==
	    E1000_RXD_STAT_TCPCS) {
		mp->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
		mp->m_pkthdr.csum_data = htons(0xffff);
	}
	if (status & E1000_RXD_STAT_UDPCS) {
		mp->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
		mp->m_pkthdr.csum_data = htons(0xffff);
	}
}
static void em_receive_checksum ( uint32_t status , struct mbuf * mp ) { mp -> m_pkthdr . csum_flags = 0 ; if ( status & E1000_RXD_STAT_IXSM ) return ; if ( ( status & ( E1000_RXD_STAT_IPCS | E1000_RXDEXT_STATERR_IPE ) ) == E1000_RXD_STAT_IPCS ) { mp -> m_pkthdr . csum_flags = ( CSUM_IP_CHECKED | CSUM_IP_VALID ) ; } if ( ( status & ( E1000_RXD_STAT_TCPCS | E1000_RXDEXT_STATERR_TCPE ) ) == E1000_RXD_STAT_TCPCS ) { mp -> m_pkthdr . csum_flags |= ( CSUM_DATA_VALID | CSUM_PSEUDO_HDR ) ; mp -> m_pkthdr . csum_data = htons ( 0xffff ) ; } if ( status & E1000_RXD_STAT_UDPCS ) { 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 .
/* Ignore Checksum bit is set */ /* If the IP checksum exists and there is no IP Checksum error */ /* TCP or UDP checksum */