Skip to content

Commit 07f63fc

Browse files
committed
irdma: Report network header type in UD work completions
irdma: Report network header type in UD work completions Leverage the newly introduced IBV_WC_WITH_NETWORK_HDR_TYPE and IBV_WC_NETWORK_HDR_IPV6 flags when processing Completion Queue Entries (CQEs) for Unreliable Datagram (UD) QPs. The irdma hardware natively parses the IP version and reports it via the 'ipv4' field in the CQE. Translating this state into wc_flags enables the core libibverbs layer to skip expensive software GRH parsing and checksum verifications during address handle creation. Beyond the performance benefits of bypassing payload memory reads, this ensures correct IP version identification. Since some hardware zeroes out the IPv4 header checksum in the buffer, a non-zero checksum calculated in get_grh_header_version() could fail the verification against the buffer's zeroed field, and wrongly misclassify valid IPv4 packets as IPv6. Relying on the explicit CQE state resolves this correctness issue.
1 parent 4d78ba8 commit 07f63fc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

providers/irdma/uverbs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,9 @@ static void irdma_process_cqe(struct ibv_wc *entry, struct irdma_cq_poll_info *c
923923

924924
if (ib_qp->qp_type == IBV_QPT_UD) {
925925
entry->src_qp = cur_cqe->ud_src_qpn;
926-
entry->wc_flags |= IBV_WC_GRH;
926+
entry->wc_flags |= (IBV_WC_GRH | IBV_WC_WITH_NETWORK_HDR_TYPE);
927+
if (!cur_cqe->ipv4)
928+
entry->wc_flags |= IBV_WC_NETWORK_HDR_IPV6;
927929
} else {
928930
entry->src_qp = cur_cqe->qp_id;
929931
}

0 commit comments

Comments
 (0)