src/dpdk/lib/librte_mbuf/rte_mbuf.h
static inline int
rte_validate_tx_offload(const struct rte_mbuf *m)
{
	uint64_t ol_flags = m->ol_flags;

	/* Does packet set any of available offloads? */
	if (!(ol_flags & PKT_TX_OFFLOAD_MASK))
		return 0;

	/* IP checksum can be counted only for IPv4 packet */
	if ((ol_flags & PKT_TX_IP_CKSUM) && (ol_flags & PKT_TX_IPV6))
		return -EINVAL;

	/* IP type not set when required */
	if (ol_flags & (PKT_TX_L4_MASK | PKT_TX_TCP_SEG))
		if (!(ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6)))
			return -EINVAL;

	/* Check requirements for TSO packet */
	if (ol_flags & PKT_TX_TCP_SEG)
		if ((m->tso_segsz == 0) ||
				((ol_flags & PKT_TX_IPV4) &&
				!(ol_flags & PKT_TX_IP_CKSUM)))
			return -EINVAL;

	/* PKT_TX_OUTER_IP_CKSUM set for non outer IPv4 packet. */
	if ((ol_flags & PKT_TX_OUTER_IP_CKSUM) &&
			!(ol_flags & PKT_TX_OUTER_IPV4))
		return -EINVAL;

	return 0;
}
/**
 * Validate general requirements for Tx offload in mbuf.
 *
 * This function checks correctness and completeness of Tx offload settings.
 *
 * @param m
 *   The packet mbuf to be validated.
 * @return
 *   0 if packet is valid
 */
Validate general requirements for Tx offload in mbuf.
This function checks correctness and completeness of Tx offload settings.

@param m
The packet mbuf to be validated.
@return
0 if packet is valid
Validate general requirements for Tx offload in mbuf . This function checks correctness and completeness of Tx offload settings . @param m The packet mbuf to be validated . @return 0 if packet is valid
static inline int
rte_validate_tx_offload(const struct rte_mbuf *m)
{
	uint64_t ol_flags = m->ol_flags;
	if (!(ol_flags & PKT_TX_OFFLOAD_MASK))
		return 0;
	if ((ol_flags & PKT_TX_IP_CKSUM) && (ol_flags & PKT_TX_IPV6))
		return -EINVAL;
	if (ol_flags & (PKT_TX_L4_MASK | PKT_TX_TCP_SEG))
		if (!(ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6)))
			return -EINVAL;
	if (ol_flags & PKT_TX_TCP_SEG)
		if ((m->tso_segsz == 0) ||
				((ol_flags & PKT_TX_IPV4) &&
				!(ol_flags & PKT_TX_IP_CKSUM)))
			return -EINVAL;
	if ((ol_flags & PKT_TX_OUTER_IP_CKSUM) &&
			!(ol_flags & PKT_TX_OUTER_IPV4))
		return -EINVAL;
	return 0;
}
static inline int rte_validate_tx_offload ( const struct rte_mbuf * m ) { uint64_t ol_flags = m -> ol_flags ; if ( ! ( ol_flags & PKT_TX_OFFLOAD_MASK ) ) return 0 ; if ( ( ol_flags & PKT_TX_IP_CKSUM ) && ( ol_flags & PKT_TX_IPV6 ) ) return - EINVAL ; if ( ol_flags & ( PKT_TX_L4_MASK | PKT_TX_TCP_SEG ) ) if ( ! ( ol_flags & ( PKT_TX_IPV4 | PKT_TX_IPV6 ) ) ) return - EINVAL ; if ( ol_flags & PKT_TX_TCP_SEG ) if ( ( m -> tso_segsz == 0 ) || ( ( ol_flags & PKT_TX_IPV4 ) && ! ( ol_flags & PKT_TX_IP_CKSUM ) ) ) return - EINVAL ; if ( ( ol_flags & PKT_TX_OUTER_IP_CKSUM ) && ! ( ol_flags & PKT_TX_OUTER_IPV4 ) ) return - EINVAL ; return 0 ; }
Validate general requirements for Tx offload in mbuf.
Validate general requirements for Tx offload in mbuf .
/* Does packet set any of available offloads? */ /* IP checksum can be counted only for IPv4 packet */ /* IP type not set when required */ /* Check requirements for TSO packet */ /* PKT_TX_OUTER_IP_CKSUM set for non outer IPv4 packet. */