Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

efa: Add unsolicited RDMA write with immediate receive support #1459

Merged
merged 3 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions kernel-headers/rdma/efa-abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,17 @@ enum {
EFA_QP_DRIVER_TYPE_SRD = 0,
};

enum {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use real SHA and not ?? when creating this patch.
The kernel headers are pushed to wip/leon-for-next

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated the commit.

EFA_CREATE_QP_WITH_UNSOLICITED_WRITE_RECV = 1 << 0,
};

struct efa_ibv_create_qp {
__u32 comp_mask;
__u32 rq_ring_size; /* bytes */
__u32 sq_ring_size; /* bytes */
__u32 driver_qp_type;
__u16 flags;
__u8 reserved_90[6];
};

struct efa_ibv_create_qp_resp {
Expand Down Expand Up @@ -123,6 +129,7 @@ enum {
EFA_QUERY_DEVICE_CAPS_CQ_WITH_SGID = 1 << 3,
EFA_QUERY_DEVICE_CAPS_DATA_POLLING_128 = 1 << 4,
EFA_QUERY_DEVICE_CAPS_RDMA_WRITE = 1 << 5,
EFA_QUERY_DEVICE_CAPS_UNSOLICITED_WRITE_RECV = 1 << 6,
};

struct efa_ibv_ex_query_device_resp {
Expand Down
12 changes: 12 additions & 0 deletions kernel-headers/rdma/mana-abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,20 @@

#define MANA_IB_UVERBS_ABI_VERSION 1

enum mana_ib_create_cq_flags {
MANA_IB_CREATE_RNIC_CQ = 1 << 0,
};

struct mana_ib_create_cq {
__aligned_u64 buf_addr;
__u16 flags;
__u16 reserved0;
__u32 reserved1;
};

struct mana_ib_create_cq_resp {
__u32 cqid;
__u32 reserved;
};

struct mana_ib_create_qp {
Expand Down
6 changes: 6 additions & 0 deletions kernel-headers/rdma/rdma_netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,12 @@ enum rdma_nldev_attr {

RDMA_NLDEV_SYS_ATTR_PRIVILEGED_QKEY_MODE, /* u8 */

RDMA_NLDEV_ATTR_DRIVER_DETAILS, /* u8 */
/*
* QP subtype string, used for driver QPs
*/
RDMA_NLDEV_ATTR_RES_SUBTYPE, /* string */

/*
* Always the end
*/
Expand Down
8 changes: 5 additions & 3 deletions providers/efa/efa_io_defs.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
/*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All rights reserved.
* Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
*/

#ifndef _EFA_IO_H_
Expand Down Expand Up @@ -208,7 +208,7 @@ struct efa_io_rx_desc {
struct efa_io_cdesc_common {
/*
* verbs-generated request ID, as provided in the completed tx or rx
* descriptor.
* descriptor.
*/
uint16_t req_id;

Expand All @@ -221,7 +221,8 @@ struct efa_io_cdesc_common {
* 3 : has_imm - indicates that immediate data is
* present - for RX completions only
* 6:4 : op_type - enum efa_io_send_op_type
* 7 : reserved31 - MBZ
* 7 : unsolicited - indicates that there is no
* matching request - for RDMA with imm. RX only
*/
uint8_t flags;

Expand Down Expand Up @@ -301,5 +302,6 @@ struct efa_io_rx_cdesc_ex {
#define EFA_IO_CDESC_COMMON_Q_TYPE_MASK GENMASK(2, 1)
#define EFA_IO_CDESC_COMMON_HAS_IMM_MASK BIT(3)
#define EFA_IO_CDESC_COMMON_OP_TYPE_MASK GENMASK(6, 4)
#define EFA_IO_CDESC_COMMON_UNSOLICITED_MASK BIT(7)

#endif /* _EFA_IO_H_ */
16 changes: 15 additions & 1 deletion providers/efa/efadv.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <stdio.h>
#include <sys/types.h>
#include <stdbool.h>

#include <infiniband/verbs.h>

Expand All @@ -24,10 +25,15 @@ struct ibv_qp *efadv_create_driver_qp(struct ibv_pd *ibvpd,
struct ibv_qp_init_attr *attr,
uint32_t driver_qp_type);

enum {
EFADV_QP_FLAGS_UNSOLICITED_WRITE_RECV = 1 << 0,
};

struct efadv_qp_init_attr {
uint64_t comp_mask;
uint32_t driver_qp_type;
uint8_t reserved[4];
uint16_t flags;
uint8_t reserved[2];
};

struct ibv_qp *efadv_create_qp_ex(struct ibv_context *ibvctx,
Expand All @@ -40,6 +46,7 @@ enum {
EFADV_DEVICE_ATTR_CAPS_RNR_RETRY = 1 << 1,
EFADV_DEVICE_ATTR_CAPS_CQ_WITH_SGID = 1 << 2,
EFADV_DEVICE_ATTR_CAPS_RDMA_WRITE = 1 << 3,
EFADV_DEVICE_ATTR_CAPS_UNSOLICITED_WRITE_RECV = 1 << 4,
};

struct efadv_device_attr {
Expand Down Expand Up @@ -70,10 +77,12 @@ int efadv_query_ah(struct ibv_ah *ibvah, struct efadv_ah_attr *attr,
struct efadv_cq {
uint64_t comp_mask;
int (*wc_read_sgid)(struct efadv_cq *efadv_cq, union ibv_gid *sgid);
bool (*wc_is_unsolicited)(struct efadv_cq *efadv_cq);
};

enum {
EFADV_WC_EX_WITH_SGID = 1 << 0,
EFADV_WC_EX_WITH_IS_UNSOLICITED = 1 << 1,
};

struct efadv_cq_init_attr {
Expand All @@ -94,6 +103,11 @@ static inline int efadv_wc_read_sgid(struct efadv_cq *efadv_cq,
return efadv_cq->wc_read_sgid(efadv_cq, sgid);
}

static inline bool efadv_wc_is_unsolicited(struct efadv_cq *efadv_cq)
{
return efadv_cq->wc_is_unsolicited(efadv_cq);
}

enum {
EFADV_MR_ATTR_VALIDITY_RECV_IC_ID = 1 << 0,
EFADV_MR_ATTR_VALIDITY_RDMA_READ_IC_ID = 1 << 1,
Expand Down
7 changes: 7 additions & 0 deletions providers/efa/man/efadv_create_cq.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,20 @@ struct efadv_cq_init_attr {
EFADV_WC_EX_WITH_SGID:
if source AH is unknown, require sgid in WC.

EFADV_WC_EX_WITH_IS_UNSOLICITED:
request for an option to check whether a receive WC is unsolicited.


# Completion iterator functions

*efadv_wc_read_sgid*
: Get the source GID field from the current completion.
If the AH is known, a negative error value is returned.

*efadv_wc_is_unsolicited*
: Check whether it's an unsolicited receive completion that has no matching work request.
This function is available if the CQ was created with EFADV_WC_EX_WITH_IS_UNSOLICITED.


# RETURN VALUE

Expand Down
9 changes: 8 additions & 1 deletion providers/efa/man/efadv_create_qp_ex.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Compatibility is handled using the comp_mask and inlen fields.
struct efadv_qp_init_attr {
uint64_t comp_mask;
uint32_t driver_qp_type;
uint8_t reserved[4];
uint16_t flags;
uint8_t reserved[2];
};
```

Expand All @@ -60,6 +61,12 @@ struct efadv_qp_init_attr {
EFADV_QP_DRIVER_TYPE_SRD:
Create an SRD QP.

*flags*
: A bitwise OR of the values described below.

EFADV_QP_FLAGS_UNSOLICITED_WRITE_RECV:
Receive WRs will not be consumed for RDMA write with imm.

# RETURN VALUE

efadv_create_qp_ex() returns a pointer to the created QP, or NULL if the request fails.
Expand Down
6 changes: 6 additions & 0 deletions providers/efa/man/efadv_query_device.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ struct efadv_device_attr {
EFADV_DEVICE_ATTR_CAPS_RDMA_WRITE:
RDMA write is supported

EFADV_DEVICE_ATTR_CAPS_UNSOLICITED_WRITE_RECV:
Indicates the device has support for creating QPs that can receive unsolicited
RDMA write with immediate. RQ with this feature enabled will not consume any work
requests in order to receive RDMA write with immediate and a WC generated for such
receive will be marked as unsolicited.

*max_rdma_size*
: Maximum RDMA transfer size in bytes.

Expand Down