[PATCH rdma-core 5/5] mlx5: Add read_flow_tag implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>

Each steering flow may be marked with a tag which exposed in the
completion. Implement read_flow_tag which allows reading the flow tag
from the work completion.

Signed-off-by: Moses Reuben <mosesr@xxxxxxxxxxxx>
Signed-off-by: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>
Reviewed-by: Maor Gottlieb <maorg@xxxxxxxxxxxx>
Reviewed-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
---
 providers/mlx5/cq.c    | 9 +++++++++
 providers/mlx5/mlx5.h  | 4 ++++
 providers/mlx5/verbs.c | 3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/providers/mlx5/cq.c b/providers/mlx5/cq.c
index 85d0c33..2e8b584 100644
--- a/providers/mlx5/cq.c
+++ b/providers/mlx5/cq.c
@@ -1196,6 +1196,13 @@ static inline uint16_t mlx5_cq_read_wc_cvlan(struct ibv_cq_ex *ibcq)
 	return be16toh(cq->cqe64->vlan_info);
 }
 
+static inline uint32_t mlx5_cq_read_flow_tag(struct ibv_cq_ex *ibcq)
+{
+	struct mlx5_cq *cq = to_mcq(ibv_cq_ex_to_cq(ibcq));
+
+	return be32toh(cq->cqe64->sop_drop_qpn) & MLX5_FLOW_TAG_MASK;
+}
+
 #define BIT(i) (1UL << (i))
 
 #define SINGLE_THREADED BIT(0)
@@ -1270,6 +1277,8 @@ void mlx5_cq_fill_pfns(struct mlx5_cq *cq, const struct ibv_cq_init_attr_ex *cq_
 		cq->ibv_cq.read_completion_ts = mlx5_cq_read_wc_completion_ts;
 	if (cq_attr->wc_flags & IBV_WC_EX_WITH_CVLAN)
 		cq->ibv_cq.read_cvlan = mlx5_cq_read_wc_cvlan;
+	if (cq_attr->wc_flags & IBV_WC_EX_WITH_FLOW_TAG)
+		cq->ibv_cq.read_flow_tag = mlx5_cq_read_flow_tag;
 }
 
 int mlx5_arm_cq(struct ibv_cq *ibvcq, int solicited)
diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h
index bb383d4..0de40a8 100644
--- a/providers/mlx5/mlx5.h
+++ b/providers/mlx5/mlx5.h
@@ -184,6 +184,10 @@ enum mlx5_vendor_cap_flags {
 	MLX5_VENDOR_CAP_FLAGS_MPW		= 1 << 0,
 };
 
+enum {
+	MLX5_FLOW_TAG_MASK	= 0x000fffff,
+};
+
 struct mlx5_resource {
 	enum mlx5_rsc_type	type;
 	uint32_t		rsn;
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
index b7a8502..f0e4aab 100644
--- a/providers/mlx5/verbs.c
+++ b/providers/mlx5/verbs.c
@@ -328,7 +328,8 @@ static int qp_sig_enabled(void)
 enum {
 	CREATE_CQ_SUPPORTED_WC_FLAGS = IBV_WC_STANDARD_FLAGS	|
 				       IBV_WC_EX_WITH_COMPLETION_TIMESTAMP |
-				       IBV_WC_EX_WITH_CVLAN
+				       IBV_WC_EX_WITH_CVLAN |
+				       IBV_WC_EX_WITH_FLOW_TAG
 };
 
 enum {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux