Skip to content

Commit cb34be6

Browse files
Achiad Shochatdledford
authored andcommitted
IB/mlx5: Set network_hdr_type upon RoCE responder completion
When handling a responder completion, if the link layer is Ethernet, set the work completion network_hdr_type field according to CQE's info and the IB_WC_WITH_NETWORK_HDR_TYPE flag. Signed-off-by: Achiad Shochat <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 3f89a64 commit cb34be6

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

drivers/infiniband/hw/mlx5/cq.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ enum {
171171
static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe,
172172
struct mlx5_ib_qp *qp)
173173
{
174+
enum rdma_link_layer ll = rdma_port_get_link_layer(qp->ibqp.device, 1);
174175
struct mlx5_ib_dev *dev = to_mdev(qp->ibqp.device);
175176
struct mlx5_ib_srq *srq;
176177
struct mlx5_ib_wq *wq;
@@ -236,6 +237,22 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe,
236237
} else {
237238
wc->pkey_index = 0;
238239
}
240+
241+
if (ll != IB_LINK_LAYER_ETHERNET)
242+
return;
243+
244+
switch (wc->sl & 0x3) {
245+
case MLX5_CQE_ROCE_L3_HEADER_TYPE_GRH:
246+
wc->network_hdr_type = RDMA_NETWORK_IB;
247+
break;
248+
case MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV6:
249+
wc->network_hdr_type = RDMA_NETWORK_IPV6;
250+
break;
251+
case MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV4:
252+
wc->network_hdr_type = RDMA_NETWORK_IPV4;
253+
break;
254+
}
255+
wc->wc_flags |= IB_WC_WITH_NETWORK_HDR_TYPE;
239256
}
240257

241258
static void dump_cqe(struct mlx5_ib_dev *dev, struct mlx5_err_cqe *cqe)

include/linux/mlx5/device.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,12 @@ enum {
628628
CQE_RSS_HTYPE_L4 = 0x3 << 2,
629629
};
630630

631+
enum {
632+
MLX5_CQE_ROCE_L3_HEADER_TYPE_GRH = 0x0,
633+
MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV6 = 0x1,
634+
MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV4 = 0x2,
635+
};
636+
631637
enum {
632638
CQE_L2_OK = 1 << 0,
633639
CQE_L3_OK = 1 << 1,

0 commit comments

Comments
 (0)