|
|
23f80e |
From a475fe442c97ad5b2c9c761805d89d4774046807 Mon Sep 17 00:00:00 2001
|
|
|
23f80e |
From: Noa Osherovich <noaos@mellanox.com>
|
|
|
23f80e |
Date: Mon, 28 Nov 2016 12:01:37 +0200
|
|
|
23f80e |
Subject: [PATCH rdma-core 4/6] ibverbs: Add an option to poll cvlan value from
|
|
|
23f80e |
a CQ
|
|
|
23f80e |
|
|
|
23f80e |
When a WQ or a QP is created with cvlan stripping option, it is
|
|
|
23f80e |
stripped from the incoming packet and included in the work
|
|
|
23f80e |
completion.
|
|
|
23f80e |
Extend the poll_cq_ex mechanism with a function that reads the
|
|
|
23f80e |
stripped cvlan value from the work completion.
|
|
|
23f80e |
|
|
|
23f80e |
In addition, as a part of introcuding the new functionality in the
|
|
|
23f80e |
man page, align it with current code (typo fix, add a missing field).
|
|
|
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>
|
|
|
23f80e |
---
|
|
|
23f80e |
libibverbs/man/ibv_create_cq_ex.3 | 9 +++++++--
|
|
|
23f80e |
libibverbs/verbs.h | 10 +++++++++-
|
|
|
23f80e |
2 files changed, 16 insertions(+), 3 deletions(-)
|
|
|
23f80e |
|
|
|
23f80e |
diff --git a/libibverbs/man/ibv_create_cq_ex.3 b/libibverbs/man/ibv_create_cq_ex.3
|
|
|
23f80e |
index a6ae7690..020bbb4e 100644
|
|
|
23f80e |
--- a/libibverbs/man/ibv_create_cq_ex.3
|
|
|
23f80e |
+++ b/libibverbs/man/ibv_create_cq_ex.3
|
|
|
23f80e |
@@ -17,10 +17,10 @@ creates a completion queue (CQ) for RDMA device context
|
|
|
23f80e |
.I context\fR.
|
|
|
23f80e |
The argument
|
|
|
23f80e |
.I cq_attr
|
|
|
23f80e |
-is a pointer to struct ibv_create_cq_attr_ex as defined in <infiniband/verbs.h>.
|
|
|
23f80e |
+is a pointer to struct ibv_cq_init_attr_ex as defined in <infiniband/verbs.h>.
|
|
|
23f80e |
.PP
|
|
|
23f80e |
.nf
|
|
|
23f80e |
-struct ibv_create_cq_attr_ex {
|
|
|
23f80e |
+struct ibv_cq_init_attr_ex {
|
|
|
23f80e |
.in +8
|
|
|
23f80e |
int cqe; /* Minimum number of entries required for CQ */
|
|
|
23f80e |
void *cq_context; /* Consumer-supplied context returned for completion events */
|
|
|
23f80e |
@@ -28,6 +28,7 @@ struct ibv_comp_channel *channel; /* Completion channel where completio
|
|
|
23f80e |
int comp_vector; /* Completion vector used to signal completion events. Must be >= 0 and < context->num_comp_vectors. */
|
|
|
23f80e |
uint64_t wc_flags; /* The wc_flags that should be returned in ibv_poll_cq_ex. Or'ed bit of enum ibv_wc_flags_ex. */
|
|
|
23f80e |
uint32_t comp_mask; /* compatibility mask (extended verb). */
|
|
|
23f80e |
+uint32_t flags /* One or more flags from enum ibv_create_cq_attr_flags */
|
|
|
23f80e |
.in -8
|
|
|
23f80e |
};
|
|
|
23f80e |
|
|
|
23f80e |
@@ -40,6 +41,7 @@ enum ibv_wc_flags_ex {
|
|
|
23f80e |
IBV_WC_EX_WITH_SL = 1 << 5, /* Require sl in WC */
|
|
|
23f80e |
IBV_WC_EX_WITH_DLID_PATH_BITS = 1 << 6, /* Require dlid path bits in WC */
|
|
|
23f80e |
IBV_WC_EX_WITH_COMPLETION_TIMESTAMP = 1 << 7, /* Require completion timestamp in WC /*
|
|
|
23f80e |
+ IBV_WC_EX_WITH_CVLAN = 1 << 8, /* Require VLAN info in WC */
|
|
|
23f80e |
};
|
|
|
23f80e |
|
|
|
23f80e |
enum ibv_cq_init_attr_mask {
|
|
|
23f80e |
@@ -128,6 +130,9 @@ Below members and functions are used in order to poll the current completion. Th
|
|
|
23f80e |
.BI "uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex " "*cq"); \c
|
|
|
23f80e |
Get the completion timestamp from the current completion.
|
|
|
23f80e |
|
|
|
23f80e |
+.BI "uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex " "*cq"); \c
|
|
|
23f80e |
+ Get the CVLAN field from the current completion.
|
|
|
23f80e |
+
|
|
|
23f80e |
.SH "RETURN VALUE"
|
|
|
23f80e |
.B ibv_create_cq_ex()
|
|
|
23f80e |
returns a pointer to the CQ, or NULL if the request fails.
|
|
|
23f80e |
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
|
|
|
23f80e |
index c9084ea1..15e93b3e 100644
|
|
|
23f80e |
--- a/libibverbs/verbs.h
|
|
|
23f80e |
+++ b/libibverbs/verbs.h
|
|
|
23f80e |
@@ -435,6 +435,7 @@ enum ibv_create_cq_wc_flags {
|
|
|
23f80e |
IBV_WC_EX_WITH_SL = 1 << 5,
|
|
|
23f80e |
IBV_WC_EX_WITH_DLID_PATH_BITS = 1 << 6,
|
|
|
23f80e |
IBV_WC_EX_WITH_COMPLETION_TIMESTAMP = 1 << 7,
|
|
|
23f80e |
+ IBV_WC_EX_WITH_CVLAN = 1 << 8,
|
|
|
23f80e |
};
|
|
|
23f80e |
|
|
|
23f80e |
enum {
|
|
|
23f80e |
@@ -449,7 +450,8 @@ enum {
|
|
|
23f80e |
|
|
|
23f80e |
enum {
|
|
|
23f80e |
IBV_CREATE_CQ_SUP_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 ibv_wc_flags {
|
|
|
23f80e |
@@ -1092,6 +1094,7 @@ struct ibv_cq_ex {
|
|
|
23f80e |
uint8_t (*read_sl)(struct ibv_cq_ex *current);
|
|
|
23f80e |
uint8_t (*read_dlid_path_bits)(struct ibv_cq_ex *current);
|
|
|
23f80e |
uint64_t (*read_completion_ts)(struct ibv_cq_ex *current);
|
|
|
23f80e |
+ uint16_t (*read_cvlan)(struct ibv_cq_ex *current);
|
|
|
23f80e |
};
|
|
|
23f80e |
|
|
|
23f80e |
static inline struct ibv_cq *ibv_cq_ex_to_cq(struct ibv_cq_ex *cq)
|
|
|
23f80e |
@@ -1170,6 +1173,11 @@ static inline uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex *cq)
|
|
|
23f80e |
return cq->read_completion_ts(cq);
|
|
|
23f80e |
}
|
|
|
23f80e |
|
|
|
23f80e |
+static inline uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex *cq)
|
|
|
23f80e |
+{
|
|
|
23f80e |
+ return cq->read_cvlan(cq);
|
|
|
23f80e |
+}
|
|
|
23f80e |
+
|
|
|
23f80e |
static inline int ibv_post_wq_recv(struct ibv_wq *wq,
|
|
|
23f80e |
struct ibv_recv_wr *recv_wr,
|
|
|
23f80e |
struct ibv_recv_wr **bad_recv_wr)
|
|
|
23f80e |
--
|
|
|
23f80e |
2.12.1
|
|
|
23f80e |
|