src/dpdk/drivers/net/vmxnet3/vmxnet3_rxtx.c
static inline void
vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
		struct rte_mbuf *rxm, const uint8_t sop)
{
	uint64_t ol_flags = rxm->ol_flags;
	uint32_t packet_type = rxm->packet_type;

	/* Offloads set in sop */
	if (sop) {
		/* Set packet type */
		packet_type |= RTE_PTYPE_L2_ETHER;

		/* Check large packet receive */
		if (VMXNET3_VERSION_GE_2(hw) &&
		    rcd->type == VMXNET3_CDTYPE_RXCOMP_LRO) {
			const Vmxnet3_RxCompDescExt *rcde =
					(const Vmxnet3_RxCompDescExt *)rcd;

			rxm->tso_segsz = rcde->mss;
			*vmxnet3_segs_dynfield(rxm) = rcde->segCnt;
			ol_flags |= PKT_RX_LRO;
		}
	} else { /* Offloads set in eop */
		/* Check for RSS */
		if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE) {
			ol_flags |= PKT_RX_RSS_HASH;
			rxm->hash.rss = rcd->rssHash;
		}

		/* Check for hardware stripped VLAN tag */
		if (rcd->ts) {
			ol_flags |= (PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
			rxm->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
		}

		/* Check packet type, checksum errors, etc. */
		if (rcd->cnc) {
			ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
		} else {
			if (rcd->v4) {
				packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;

				if (rcd->ipc)
					ol_flags |= PKT_RX_IP_CKSUM_GOOD;
				else
					ol_flags |= PKT_RX_IP_CKSUM_BAD;

				if (rcd->tuc) {
					ol_flags |= PKT_RX_L4_CKSUM_GOOD;
					if (rcd->tcp)
						packet_type |= RTE_PTYPE_L4_TCP;
					else
						packet_type |= RTE_PTYPE_L4_UDP;
				} else {
					if (rcd->tcp) {
						packet_type |= RTE_PTYPE_L4_TCP;
						ol_flags |= PKT_RX_L4_CKSUM_BAD;
					} else if (rcd->udp) {
						packet_type |= RTE_PTYPE_L4_UDP;
						ol_flags |= PKT_RX_L4_CKSUM_BAD;
					}
				}
			} else if (rcd->v6) {
				packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;

				if (rcd->tuc) {
					ol_flags |= PKT_RX_L4_CKSUM_GOOD;
					if (rcd->tcp)
						packet_type |= RTE_PTYPE_L4_TCP;
					else
						packet_type |= RTE_PTYPE_L4_UDP;
				} else {
					if (rcd->tcp) {
						packet_type |= RTE_PTYPE_L4_TCP;
						ol_flags |= PKT_RX_L4_CKSUM_BAD;
					} else if (rcd->udp) {
						packet_type |= RTE_PTYPE_L4_UDP;
						ol_flags |= PKT_RX_L4_CKSUM_BAD;
					}
				}
			} else {
				packet_type |= RTE_PTYPE_UNKNOWN;
			}

			/* Old variants of vmxnet3 do not provide MSS */
			if ((ol_flags & PKT_RX_LRO) && rxm->tso_segsz == 0)
				rxm->tso_segsz = vmxnet3_guess_mss(hw,
						rcd, rxm);
		}
	}

	rxm->ol_flags = ol_flags;
	rxm->packet_type = packet_type;
}
/* Receive side checksum and other offloads */
Receive side checksum and other offloads
Receive side checksum and other offloads
static inline void
vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
		struct rte_mbuf *rxm, const uint8_t sop)
{
	uint64_t ol_flags = rxm->ol_flags;
	uint32_t packet_type = rxm->packet_type;
	if (sop) {
		packet_type |= RTE_PTYPE_L2_ETHER;
		if (VMXNET3_VERSION_GE_2(hw) &&
		    rcd->type == VMXNET3_CDTYPE_RXCOMP_LRO) {
			const Vmxnet3_RxCompDescExt *rcde =
					(const Vmxnet3_RxCompDescExt *)rcd;
			rxm->tso_segsz = rcde->mss;
			*vmxnet3_segs_dynfield(rxm) = rcde->segCnt;
			ol_flags |= PKT_RX_LRO;
		}
	} else { 
		if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE) {
			ol_flags |= PKT_RX_RSS_HASH;
			rxm->hash.rss = rcd->rssHash;
		}
		if (rcd->ts) {
			ol_flags |= (PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
			rxm->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
		}
		if (rcd->cnc) {
			ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
		} else {
			if (rcd->v4) {
				packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
				if (rcd->ipc)
					ol_flags |= PKT_RX_IP_CKSUM_GOOD;
				else
					ol_flags |= PKT_RX_IP_CKSUM_BAD;
				if (rcd->tuc) {
					ol_flags |= PKT_RX_L4_CKSUM_GOOD;
					if (rcd->tcp)
						packet_type |= RTE_PTYPE_L4_TCP;
					else
						packet_type |= RTE_PTYPE_L4_UDP;
				} else {
					if (rcd->tcp) {
						packet_type |= RTE_PTYPE_L4_TCP;
						ol_flags |= PKT_RX_L4_CKSUM_BAD;
					} else if (rcd->udp) {
						packet_type |= RTE_PTYPE_L4_UDP;
						ol_flags |= PKT_RX_L4_CKSUM_BAD;
					}
				}
			} else if (rcd->v6) {
				packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
				if (rcd->tuc) {
					ol_flags |= PKT_RX_L4_CKSUM_GOOD;
					if (rcd->tcp)
						packet_type |= RTE_PTYPE_L4_TCP;
					else
						packet_type |= RTE_PTYPE_L4_UDP;
				} else {
					if (rcd->tcp) {
						packet_type |= RTE_PTYPE_L4_TCP;
						ol_flags |= PKT_RX_L4_CKSUM_BAD;
					} else if (rcd->udp) {
						packet_type |= RTE_PTYPE_L4_UDP;
						ol_flags |= PKT_RX_L4_CKSUM_BAD;
					}
				}
			} else {
				packet_type |= RTE_PTYPE_UNKNOWN;
			}
			if ((ol_flags & PKT_RX_LRO) && rxm->tso_segsz == 0)
				rxm->tso_segsz = vmxnet3_guess_mss(hw,
						rcd, rxm);
		}
	}
	rxm->ol_flags = ol_flags;
	rxm->packet_type = packet_type;
}
static inline void vmxnet3_rx_offload ( struct vmxnet3_hw * hw , const Vmxnet3_RxCompDesc * rcd , struct rte_mbuf * rxm , const uint8_t sop ) { uint64_t ol_flags = rxm -> ol_flags ; uint32_t packet_type = rxm -> packet_type ; if ( sop ) { packet_type |= RTE_PTYPE_L2_ETHER ; if ( VMXNET3_VERSION_GE_2 ( hw ) && rcd -> type == VMXNET3_CDTYPE_RXCOMP_LRO ) { const Vmxnet3_RxCompDescExt * rcde = ( const Vmxnet3_RxCompDescExt * ) rcd ; rxm -> tso_segsz = rcde -> mss ; * vmxnet3_segs_dynfield ( rxm ) = rcde -> segCnt ; ol_flags |= PKT_RX_LRO ; } } else { if ( rcd -> rssType != VMXNET3_RCD_RSS_TYPE_NONE ) { ol_flags |= PKT_RX_RSS_HASH ; rxm -> hash . rss = rcd -> rssHash ; } if ( rcd -> ts ) { ol_flags |= ( PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED ) ; rxm -> vlan_tci = rte_le_to_cpu_16 ( ( uint16_t ) rcd -> tci ) ; } if ( rcd -> cnc ) { ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN ; } else { if ( rcd -> v4 ) { packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN ; if ( rcd -> ipc ) ol_flags |= PKT_RX_IP_CKSUM_GOOD ; else ol_flags |= PKT_RX_IP_CKSUM_BAD ; if ( rcd -> tuc ) { ol_flags |= PKT_RX_L4_CKSUM_GOOD ; if ( rcd -> tcp ) packet_type |= RTE_PTYPE_L4_TCP ; else packet_type |= RTE_PTYPE_L4_UDP ; } else { if ( rcd -> tcp ) { packet_type |= RTE_PTYPE_L4_TCP ; ol_flags |= PKT_RX_L4_CKSUM_BAD ; } else if ( rcd -> udp ) { packet_type |= RTE_PTYPE_L4_UDP ; ol_flags |= PKT_RX_L4_CKSUM_BAD ; } } } else if ( rcd -> v6 ) { packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN ; if ( rcd -> tuc ) { ol_flags |= PKT_RX_L4_CKSUM_GOOD ; if ( rcd -> tcp ) packet_type |= RTE_PTYPE_L4_TCP ; else packet_type |= RTE_PTYPE_L4_UDP ; } else { if ( rcd -> tcp ) { packet_type |= RTE_PTYPE_L4_TCP ; ol_flags |= PKT_RX_L4_CKSUM_BAD ; } else if ( rcd -> udp ) { packet_type |= RTE_PTYPE_L4_UDP ; ol_flags |= PKT_RX_L4_CKSUM_BAD ; } } } else { packet_type |= RTE_PTYPE_UNKNOWN ; } if ( ( ol_flags & PKT_RX_LRO ) && rxm -> tso_segsz == 0 ) rxm -> tso_segsz = vmxnet3_guess_mss ( hw , rcd , rxm ) ; } } rxm -> ol_flags = ol_flags ; rxm -> packet_type = packet_type ; }
Receive side checksum and other offloads
Receive side checksum and other offloads
/* Offloads set in sop */ /* Set packet type */ /* Check large packet receive */ /* Offloads set in eop */ /* Check for RSS */ /* Check for hardware stripped VLAN tag */ /* Check packet type, checksum errors, etc. */ /* Old variants of vmxnet3 do not provide MSS */