Commit cb34be6d authored by Achiad Shochat's avatar Achiad Shochat Committed by Doug Ledford

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: default avatarAchiad Shochat <achiad@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 3f89a643
...@@ -171,6 +171,7 @@ enum { ...@@ -171,6 +171,7 @@ enum {
static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe,
struct mlx5_ib_qp *qp) struct mlx5_ib_qp *qp)
{ {
enum rdma_link_layer ll = rdma_port_get_link_layer(qp->ibqp.device, 1);
struct mlx5_ib_dev *dev = to_mdev(qp->ibqp.device); struct mlx5_ib_dev *dev = to_mdev(qp->ibqp.device);
struct mlx5_ib_srq *srq; struct mlx5_ib_srq *srq;
struct mlx5_ib_wq *wq; struct mlx5_ib_wq *wq;
...@@ -236,6 +237,22 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, ...@@ -236,6 +237,22 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe,
} else { } else {
wc->pkey_index = 0; wc->pkey_index = 0;
} }
if (ll != IB_LINK_LAYER_ETHERNET)
return;
switch (wc->sl & 0x3) {
case MLX5_CQE_ROCE_L3_HEADER_TYPE_GRH:
wc->network_hdr_type = RDMA_NETWORK_IB;
break;
case MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV6:
wc->network_hdr_type = RDMA_NETWORK_IPV6;
break;
case MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV4:
wc->network_hdr_type = RDMA_NETWORK_IPV4;
break;
}
wc->wc_flags |= IB_WC_WITH_NETWORK_HDR_TYPE;
} }
static void dump_cqe(struct mlx5_ib_dev *dev, struct mlx5_err_cqe *cqe) static void dump_cqe(struct mlx5_ib_dev *dev, struct mlx5_err_cqe *cqe)
......
...@@ -628,6 +628,12 @@ enum { ...@@ -628,6 +628,12 @@ enum {
CQE_RSS_HTYPE_L4 = 0x3 << 2, CQE_RSS_HTYPE_L4 = 0x3 << 2,
}; };
enum {
MLX5_CQE_ROCE_L3_HEADER_TYPE_GRH = 0x0,
MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV6 = 0x1,
MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV4 = 0x2,
};
enum { enum {
CQE_L2_OK = 1 << 0, CQE_L2_OK = 1 << 0,
CQE_L3_OK = 1 << 1, CQE_L3_OK = 1 << 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment