Skip to content

Commit 86c99fb

Browse files
authored
Merge pull request #1607 from amzn/trace-post-length
efa: Add WQE length to post_send tracepoint
2 parents b2ff238 + 6bded47 commit 86c99fb

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

providers/efa/efa_trace.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
22
/*
3-
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
3+
* Copyright 2023-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
44
*/
55

66
#if defined(LTTNG_ENABLED)
@@ -55,7 +55,8 @@ LTTNG_UST_TRACEPOINT_EVENT(
5555
uint8_t, op_type,
5656
uint32_t, src_qp_num,
5757
uint32_t, dst_qp_num,
58-
uint16_t, ah_num
58+
uint16_t, ah_num,
59+
uint32_t, length
5960
),
6061

6162
/* Output event fields */
@@ -66,6 +67,7 @@ LTTNG_UST_TRACEPOINT_EVENT(
6667
lttng_ust_field_integer(uint32_t, src_qp_num, src_qp_num)
6768
lttng_ust_field_integer(uint32_t, dst_qp_num, dst_qp_num)
6869
lttng_ust_field_integer(uint16_t, ah_num, ah_num)
70+
lttng_ust_field_integer(uint32_t, length, length)
6971
)
7072
)
7173

providers/efa/verbs.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,32 @@ static void efa_set_common_ctrl_flags(struct efa_io_tx_meta_desc *desc,
18311831
EFA_SET(&desc->ctrl2, EFA_IO_TX_META_DESC_COMP_REQ, 1);
18321832
}
18331833

1834+
#ifdef LTTNG_ENABLED
1835+
static uint32_t efa_get_wqe_length(struct efa_io_tx_wqe *tx_wqe)
1836+
{
1837+
enum efa_io_send_op_type op_type;
1838+
uint32_t length = 0;
1839+
size_t i;
1840+
1841+
op_type = EFA_GET(&tx_wqe->meta.ctrl1, EFA_IO_TX_META_DESC_OP_TYPE);
1842+
switch (op_type) {
1843+
case EFA_IO_SEND:
1844+
if (EFA_GET(&tx_wqe->meta.ctrl1, EFA_IO_TX_META_DESC_INLINE_MSG))
1845+
return tx_wqe->meta.length;
1846+
1847+
for (i = 0; i < tx_wqe->meta.length; i++)
1848+
length += tx_wqe->data.sgl[i].length;
1849+
1850+
return length;
1851+
case EFA_IO_RDMA_READ:
1852+
case EFA_IO_RDMA_WRITE:
1853+
return tx_wqe->data.rdma_req.remote_mem.length;
1854+
}
1855+
1856+
return 0;
1857+
}
1858+
#endif
1859+
18341860
static int efa_post_send_validate(struct efa_qp *qp,
18351861
unsigned int wr_flags)
18361862
{
@@ -1974,7 +2000,8 @@ int efa_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
19742000
mmio_wc_start();
19752001
}
19762002
rdma_tracepoint(rdma_core_efa, post_send, qp->dev->name, wr->wr_id,
1977-
EFA_IO_SEND, ibvqp->qp_num, meta_desc->dest_qp_num, ah->efa_ah);
2003+
EFA_IO_SEND, ibvqp->qp_num, meta_desc->dest_qp_num,
2004+
ah->efa_ah, efa_get_wqe_length(&tx_wqe));
19782005
wr = wr->next;
19792006
}
19802007

@@ -2256,7 +2283,7 @@ static void efa_send_wr_set_addr(struct ibv_qp_ex *ibvqpx,
22562283

22572284
rdma_tracepoint(rdma_core_efa, post_send, qp->dev->name, ibvqpx->wr_id,
22582285
EFA_GET(&tx_wqe->meta.ctrl1, EFA_IO_TX_META_DESC_OP_TYPE),
2259-
ibvqpx->qp_base.qp_num, remote_qpn, ah->efa_ah);
2286+
ibvqpx->qp_base.qp_num, remote_qpn, ah->efa_ah, efa_get_wqe_length(tx_wqe));
22602287
}
22612288

22622289
static void efa_send_wr_start(struct ibv_qp_ex *ibvqpx)

0 commit comments

Comments
 (0)