Skip to content

Commit 4929d24

Browse files
committed
drivers/amazon/net/efa: update to 2.1.0
Update EFA Amazon downstream driver to 2.1.0, to support new features of Elastic Fabric Adapter. In detail, copy '*.{c,h}' files from the EFA github repo's 'src/' directory and 'build/src/config.h' that auto-generated from the github repo on a machine running AL 5.15 kernel to 'drivers/amazon/net/efa/', and adds new EFA object files to build in the Makefile. [1] https://github.com/amzn/amzn-drivers/releases/tag/efa_linux_2.1.0 Signed-off-by: SeongJae Park <[email protected]>
1 parent 271142d commit 4929d24

18 files changed

+1077
-316
lines changed

drivers/amazon/net/efa/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
obj-$(CONFIG_AMAZON_EFA_INFINIBAND) += efa.o
66

7-
efa-y := efa_com.o efa_com_cmd.o efa_main.o efa_verbs.o efa_gdr.o
7+
efa-y := efa_com.o efa_com_cmd.o efa_gdr.o efa_main.o efa_neuron.o efa_p2p.o
8+
efa-y += efa_verbs.o
89

910
efa-$(CONFIG_SYSFS) += efa_sysfs.o
1011

drivers/amazon/net/efa/config.h

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
11
#define HAVE_UMEM_SCATTERLIST_IF 1
2-
#define HAVE_MAX_SEND_RCV_SGE 1
32
#define HAVE_CREATE_CQ_ATTR 1
4-
#define HAVE_IB_MODIFY_QP_IS_OK_FOUR_PARAMS 1
3+
#define HAVE_CREATE_AH_RDMA_ATTR 1
54
#define HAVE_DEV_PARENT 1
65
#define HAVE_POST_CONST_WR 1
7-
#define HAVE_CREATE_AH_RDMA_ATTR 1
8-
#define HAVE_PD_CORE_ALLOCATION 1
6+
#define HAVE_MAX_SEND_RCV_SGE 1
7+
#define HAVE_IB_MODIFY_QP_IS_OK_FOUR_PARAMS 1
98
#define HAVE_IB_DEV_OPS 1
9+
#define HAVE_PD_CORE_ALLOCATION 1
1010
#define HAVE_UCONTEXT_CORE_ALLOCATION 1
1111
#define HAVE_NO_KVERBS_DRIVERS 1
1212
#define HAVE_UDATA_TO_DRV_CONTEXT 1
13-
#define HAVE_AH_CORE_ALLOCATION 1
1413
#define HAVE_SAFE_IB_ALLOC_DEVICE 1
14+
#define HAVE_AH_CORE_ALLOCATION 1
1515
#define HAVE_ALLOC_PD_NO_UCONTEXT 1
1616
#define HAVE_DEREG_MR_UDATA 1
1717
#define HAVE_DESTROY_CQ_UDATA 1
1818
#define HAVE_DESTROY_QP_UDATA 1
19-
#define HAVE_IB_DEVICE_OPS_COMMON 1
19+
#define HAVE_IB_UMEM_FIND_SINGLE_PG_SIZE 1
2020
#define HAVE_UPSTREAM_EFA 1
21-
#define HAVE_IB_QPT_DRIVER 1
22-
#define HAVE_KVZALLOC 1
21+
#define HAVE_IB_DEVICE_OPS_COMMON 1
2322
#define HAVE_CQ_CORE_ALLOCATION 1
24-
#define HAVE_IB_IS_UDATA_CLEARED 1
25-
#define HAVE_IBDEV_PRINT 1
26-
#define HAVE_IB_UMEM_FIND_SINGLE_PG_SIZE 1
2723
#define HAVE_IB_PORT_PHYS_STATE_LINK_UP 1
24+
#define HAVE_KVZALLOC 1
2825
#define HAVE_IBDEV_PRINT_RATELIMITED 1
26+
#define HAVE_IBDEV_PRINT 1
27+
#define HAVE_IB_QPT_DRIVER 1
28+
#define HAVE_IB_IS_UDATA_CLEARED 1
2929
#define HAVE_IB_MR_LENGTH 1
3030
#define HAVE_PCI_VENDOR_ID_AMAZON 1
31+
#define HAVE_IB_UMEM_GET_NO_DMASYNC 1
32+
#define HAVE_CORE_MMAP_XA 1
33+
#define HAVE_RDMA_NODE_UNSPECIFIED 1
3134
#define HAVE_BITFIELD_H 1
3235
#define HAVE_IB_UMEM_GET_DEVICE_PARAM 1
33-
#define HAVE_ATOMIC64_FETCH_INC 1
3436
#define HAVE_IB_ACCESS_OPTIONAL 1
35-
#define HAVE_RDMA_NODE_UNSPECIFIED 1
36-
#define HAVE_CORE_MMAP_XA 1
37-
#define HAVE_IB_UMEM_GET_NO_DMASYNC 1
37+
#define HAVE_CREATE_AH_INIT_ATTR 1
38+
#define HAVE_ATOMIC64_FETCH_INC 1
3839
#define HAVE_DEALLOC_PD_UDATA_RC 1
39-
#define HAVE_IB_INT_DESTROY_CQ 1
4040
#define HAVE_AH_CORE_ALLOCATION_DESTROY_RC 1
41-
#define HAVE_CREATE_AH_INIT_ATTR 1
41+
#define HAVE_IB_INT_DESTROY_CQ 1
4242
#define HAVE_RDMA_UMEM_FOR_EACH_DMA_BLOCK 1
43-
#define HAVE_UVERBS_CMD_MASK_NOT_NEEDED 1
4443
#define HAVE_IB_UMEM_NUM_DMA_BLOCKS 1
44+
#define HAVE_IB_REGISTER_DEVICE_DMA_DEVICE_PARAM 1
45+
#define HAVE_UVERBS_CMD_MASK_NOT_NEEDED 1
4546
#define HAVE_U32_PORT 1
47+
#define HAVE_SPLIT_STATS_ALLOC 1
4648
#define HAVE_SYSFS_EMIT 1
47-
#define HAVE_IB_REGISTER_DEVICE_DMA_DEVICE_PARAM 1
4849
#define HAVE_XARRAY 1
49-
#define HAVE_SPLIT_STATS_ALLOC 1
5050
#define HAVE_QP_CORE_ALLOCATION 1
51-
#define HAVE_EFA_GDR 1
51+
#define HAVE_MR_DMABUF 1
52+
#define HAVE_EFA_P2P 1

drivers/amazon/net/efa/efa-abi.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
22
/*
3-
* Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
3+
* Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All rights reserved.
44
*/
55

66
#ifndef EFA_ABI_USER_H
@@ -54,6 +54,7 @@ struct efa_ibv_alloc_pd_resp {
5454

5555
enum {
5656
EFA_CREATE_CQ_WITH_COMPLETION_CHANNEL = 1 << 0,
57+
EFA_CREATE_CQ_WITH_SGID = 1 << 1,
5758
};
5859

5960
struct efa_ibv_create_cq {
@@ -118,6 +119,7 @@ enum {
118119
EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0,
119120
EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1,
120121
EFA_QUERY_DEVICE_CAPS_CQ_NOTIFICATIONS = 1 << 2,
122+
EFA_QUERY_DEVICE_CAPS_CQ_WITH_SGID = 1 << 3,
121123
};
122124

123125
struct efa_ibv_ex_query_device_resp {

drivers/amazon/net/efa/efa.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ struct efa_pd {
9797
struct efa_mr {
9898
struct ib_mr ibmr;
9999
struct ib_umem *umem;
100-
#ifdef HAVE_EFA_GDR
101-
struct efa_nvmem *nvmem;
102-
u64 nvmem_ticket;
100+
#ifdef HAVE_EFA_P2P
101+
struct efa_p2pmem *p2pmem;
102+
u64 p2p_ticket;
103103
#endif
104104
};
105105

@@ -219,6 +219,12 @@ struct ib_cq *efa_kzalloc_cq(struct ib_device *ibdev,
219219
struct ib_mr *efa_reg_mr(struct ib_pd *ibpd, u64 start, u64 length,
220220
u64 virt_addr, int access_flags,
221221
struct ib_udata *udata);
222+
#ifdef HAVE_MR_DMABUF
223+
struct ib_mr *efa_reg_user_mr_dmabuf(struct ib_pd *ibpd, u64 start,
224+
u64 length, u64 virt_addr,
225+
int fd, int access_flags,
226+
struct ib_udata *udata);
227+
#endif
222228
#ifdef HAVE_DEREG_MR_UDATA
223229
int efa_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata);
224230
#else

drivers/amazon/net/efa/efa_admin_cmds_defs.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,10 @@ struct efa_admin_create_cq_cmd {
444444
/*
445445
* 4:0 : cq_entry_size_words - size of CQ entry in
446446
* 32-bit words, valid values: 4, 8.
447-
* 7:5 : reserved7 - MBZ
447+
* 5 : set_src_addr - If set, source address will be
448+
* filled on RX completions from unknown senders.
449+
* Requires 8 words CQ entry size.
450+
* 7:6 : reserved7 - MBZ
448451
*/
449452
u8 cq_caps_2;
450453

@@ -980,6 +983,7 @@ struct efa_admin_host_info {
980983
#define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
981984
#define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK BIT(6)
982985
#define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
986+
#define EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR_MASK BIT(5)
983987

984988
/* create_cq_resp */
985989
#define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK BIT(0)

drivers/amazon/net/efa/efa_com_cmd.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ int efa_com_create_cq(struct efa_com_dev *edev,
168168
EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED, 1);
169169
create_cmd.eqn = params->eqn;
170170
}
171-
171+
if (params->set_src_addr) {
172+
EFA_SET(&create_cmd.cq_caps_2,
173+
EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR, 1);
174+
}
172175
efa_com_set_dma_addr(params->dma_addr,
173176
&create_cmd.cq_ba.mem_addr_high,
174177
&create_cmd.cq_ba.mem_addr_low);

drivers/amazon/net/efa/efa_com_cmd.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ struct efa_com_create_cq_params {
7575
u16 uarn;
7676
u16 eqn;
7777
u8 entry_size_in_bytes;
78-
bool interrupt_mode_enabled;
78+
u8 interrupt_mode_enabled : 1;
79+
u8 set_src_addr : 1;
7980
};
8081

8182
struct efa_com_create_cq_result {

0 commit comments

Comments
 (0)