diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c index c65176ccf..88e80fac3 100644 --- a/libibverbs/verbs.c +++ b/libibverbs/verbs.c @@ -1009,7 +1009,10 @@ int ibv_init_ah_from_wc(struct ibv_context *context, uint8_t port_num, if (wc->wc_flags & IBV_WC_GRH) { ah_attr->is_global = 1; - version = get_grh_header_version(grh); + if (wc->wc_flags & IBV_WC_WITH_NETWORK_HDR_TYPE) + version = (wc->wc_flags & IBV_WC_NETWORK_HDR_IPV6) ? 6 : 4; + else + version = get_grh_header_version(grh); if (version == 4) ret = set_ah_attr_by_ipv4(context, ah_attr, diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 36d120eec..b3729ea8b 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -587,6 +587,8 @@ enum ibv_wc_flags { IBV_WC_TM_SYNC_REQ = 1 << 4, IBV_WC_TM_MATCH = 1 << 5, IBV_WC_TM_DATA_VALID = 1 << 6, + IBV_WC_WITH_NETWORK_HDR_TYPE = 1 << 7, + IBV_WC_NETWORK_HDR_IPV6 = 1 << 8, }; struct ibv_wc { diff --git a/providers/irdma/uverbs.c b/providers/irdma/uverbs.c index 76400aa9f..b53c19ac9 100644 --- a/providers/irdma/uverbs.c +++ b/providers/irdma/uverbs.c @@ -923,7 +923,9 @@ static void irdma_process_cqe(struct ibv_wc *entry, struct irdma_cq_poll_info *c if (ib_qp->qp_type == IBV_QPT_UD) { entry->src_qp = cur_cqe->ud_src_qpn; - entry->wc_flags |= IBV_WC_GRH; + entry->wc_flags |= (IBV_WC_GRH | IBV_WC_WITH_NETWORK_HDR_TYPE); + if (!cur_cqe->ipv4) + entry->wc_flags |= IBV_WC_NETWORK_HDR_IPV6; } else { entry->src_qp = cur_cqe->qp_id; }