FreeBSD/sys/dev/ixl/ixl_txrx.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
ixl_rx_checksum(struct mbuf * mp, u32 status, u32 error, u8 ptype)
{
	struct i40e_rx_ptype_decoded decoded;
	decoded = decode_rx_desc_ptype(ptype);
 	if (error & ((1 << I40E_RX_DESC_ERROR_IPE_SHIFT) |
	    (1 << I40E_RX_DESC_ERROR_L4E_SHIFT))) {
		mp->m_pkthdr.csum_flags = 0;
		return;
	}
	if (decoded.outer_ip == I40E_RX_PTYPE_OUTER_IP &&
	    decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV6)
		if (status &
		    (1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT)) {
			mp->m_pkthdr.csum_flags = 0;
			return;
		}
	mp->m_pkthdr.csum_flags = CSUM_IP_CHECKED;
	mp->m_pkthdr.csum_flags |= CSUM_IP_VALID;
	if (status & (1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT)) {
		mp->m_pkthdr.csum_flags |= 
		    (CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
		mp->m_pkthdr.csum_data |= htons(0xffff);
	}
	return;
}
static void ixl_rx_checksum ( struct mbuf * mp , u32 status , u32 error , u8 ptype ) { struct i40e_rx_ptype_decoded decoded ; decoded = decode_rx_desc_ptype ( ptype ) ; if ( error & ( ( 1 << I40E_RX_DESC_ERROR_IPE_SHIFT ) | ( 1 << I40E_RX_DESC_ERROR_L4E_SHIFT ) ) ) { mp -> m_pkthdr . csum_flags = 0 ; return ; } if ( decoded . outer_ip == I40E_RX_PTYPE_OUTER_IP && decoded . outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV6 ) if ( status & ( 1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT ) ) { mp -> m_pkthdr . csum_flags = 0 ; return ; } mp -> m_pkthdr . csum_flags = CSUM_IP_CHECKED ; mp -> m_pkthdr . csum_flags |= CSUM_IP_VALID ; if ( status & ( 1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT ) ) { mp -> m_pkthdr . csum_flags |= ( CSUM_DATA_VALID | CSUM_PSEUDO_HDR ) ; mp -> m_pkthdr . csum_data |= htons ( 0xffff ) ; } return ; }
Verify that the hardware indicated that the checksum is valid.
Verify that the hardware indicated that the checksum is valid .
/* Errors? */ /* IPv6 with extension headers likely have bad csum */ /* IP Checksum Good */