@@ -399,6 +399,16 @@ static inline int _mlx4_poll_one_ex(struct mlx4_cq *cq,
if (err != CQ_CONTINUE)
return err;
+ if (wc_flags & IBV_WC_EX_WITH_COMPLETION_TIMESTAMP) {
+ uint16_t timestamp_0_15 = cqe->timestamp_0_7 |
+ cqe->timestamp_8_15 << 8;
+
+ wc_flags_out |= IBV_WC_EX_WITH_COMPLETION_TIMESTAMP;
+ *wc_buffer.b64++ = (((uint64_t)ntohl(cqe->timestamp_16_47)
+ + !timestamp_0_15) << 16) |
+ (uint64_t)timestamp_0_15;
+ }
+
if (is_send) {
switch (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) {
case MLX4_OPCODE_RDMA_WRITE_IMM:
@@ -312,14 +312,29 @@ struct mlx4_cqe {
uint32_t vlan_my_qpn;
uint32_t immed_rss_invalid;
uint32_t g_mlpath_rqpn;
- uint8_t sl_vid;
- uint8_t reserved1;
- uint16_t rlid;
- uint32_t status;
+ union {
+ struct {
+ union {
+ struct {
+ uint8_t sl_vid;
+ uint8_t reserved1;
+ uint16_t rlid;
+ };
+ uint32_t timestamp_16_47;
+ };
+ uint32_t status;
+ };
+ struct {
+ uint16_t reserved2;
+ uint8_t smac[6];
+ };
+ };
uint32_t byte_cnt;
uint16_t wqe_index;
uint16_t checksum;
- uint8_t reserved3[3];
+ uint8_t reserved3;
+ uint8_t timestamp_8_15;
+ uint8_t timestamp_0_7;
uint8_t owner_sr_opcode;
};
@@ -286,7 +286,8 @@ enum {
};
enum {
- CREATE_CQ_SUPPORTED_WC_FLAGS = IBV_WC_STANDARD_FLAGS
+ CREATE_CQ_SUPPORTED_WC_FLAGS = IBV_WC_STANDARD_FLAGS |
+ IBV_WC_EX_WITH_COMPLETION_TIMESTAMP
};
static struct ibv_cq *create_cq(struct ibv_context *context,
Adding support to the extended version of poll_cq verb to read completion timestamp. Reading timestamp isn't supported with reading IBV_WC_EX_WITH_SL and IBV_WC_EX_WITH_SLID. Signed-off-by: Matan Barak <matanb@mellanox.com> --- src/cq.c | 10 ++++++++++ src/mlx4.h | 25 ++++++++++++++++++++----- src/verbs.c | 3 ++- 3 files changed, 32 insertions(+), 6 deletions(-)