Blame SOURCES/0005-mlx5-Add-read_cvlan-support.patch

23f80e
From 6a96ec1ce7af0cee4d4101bcf65a9b7c3fa01886 Mon Sep 17 00:00:00 2001
23f80e
From: Noa Osherovich <noaos@mellanox.com>
23f80e
Date: Sun, 4 Dec 2016 11:18:17 +0200
23f80e
Subject: [PATCH rdma-core 5/6] mlx5: Add read_cvlan support
23f80e
23f80e
When a WQ or a QP is created with cvlan stripping option, the cvlan
23f80e
is stripped from the packet by the hardware and included in the work
23f80e
completion.
23f80e
23f80e
Implement ibv_cq_ex's member function read_cvlan to allow reading the
23f80e
cvlan from the work completion.
23f80e
23f80e
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
23f80e
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
23f80e
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
23f80e
---
23f80e
 providers/mlx5/cq.c    | 9 +++++++++
23f80e
 providers/mlx5/verbs.c | 3 ++-
23f80e
 2 files changed, 11 insertions(+), 1 deletion(-)
23f80e
23f80e
diff --git a/providers/mlx5/cq.c b/providers/mlx5/cq.c
23f80e
index 4ecd4828..85d0c339 100644
23f80e
--- a/providers/mlx5/cq.c
23f80e
+++ b/providers/mlx5/cq.c
23f80e
@@ -1189,6 +1189,13 @@ static inline uint64_t mlx5_cq_read_wc_completion_ts(struct ibv_cq_ex *ibcq)
23f80e
 	return be64toh(cq->cqe64->timestamp);
23f80e
 }
23f80e
 
23f80e
+static inline uint16_t mlx5_cq_read_wc_cvlan(struct ibv_cq_ex *ibcq)
23f80e
+{
23f80e
+	struct mlx5_cq *cq = to_mcq(ibv_cq_ex_to_cq(ibcq));
23f80e
+
23f80e
+	return be16toh(cq->cqe64->vlan_info);
23f80e
+}
23f80e
+
23f80e
 #define BIT(i) (1UL << (i))
23f80e
 
23f80e
 #define SINGLE_THREADED BIT(0)
23f80e
@@ -1261,6 +1268,8 @@ void mlx5_cq_fill_pfns(struct mlx5_cq *cq, const struct ibv_cq_init_attr_ex *cq_
23f80e
 		cq->ibv_cq.read_dlid_path_bits = mlx5_cq_read_wc_dlid_path_bits;
23f80e
 	if (cq_attr->wc_flags & IBV_WC_EX_WITH_COMPLETION_TIMESTAMP)
23f80e
 		cq->ibv_cq.read_completion_ts = mlx5_cq_read_wc_completion_ts;
23f80e
+	if (cq_attr->wc_flags & IBV_WC_EX_WITH_CVLAN)
23f80e
+		cq->ibv_cq.read_cvlan = mlx5_cq_read_wc_cvlan;
23f80e
 }
23f80e
 
23f80e
 int mlx5_arm_cq(struct ibv_cq *ibvcq, int solicited)
23f80e
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
23f80e
index 4d8f26ca..67f9748d 100644
23f80e
--- a/providers/mlx5/verbs.c
23f80e
+++ b/providers/mlx5/verbs.c
23f80e
@@ -327,7 +327,8 @@ static int qp_sig_enabled(void)
23f80e
 
23f80e
 enum {
23f80e
 	CREATE_CQ_SUPPORTED_WC_FLAGS = IBV_WC_STANDARD_FLAGS	|
23f80e
-				       IBV_WC_EX_WITH_COMPLETION_TIMESTAMP
23f80e
+				       IBV_WC_EX_WITH_COMPLETION_TIMESTAMP |
23f80e
+				       IBV_WC_EX_WITH_CVLAN
23f80e
 };
23f80e
 
23f80e
 enum {
23f80e
-- 
23f80e
2.12.1
23f80e