Skip to content

Commit

Permalink
drivers/amazon/net/efa: update to 2.1.0
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sj-aws committed Dec 2, 2022
1 parent 271142d commit 4929d24
Show file tree
Hide file tree
Showing 18 changed files with 1,077 additions and 316 deletions.
3 changes: 2 additions & 1 deletion drivers/amazon/net/efa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

obj-$(CONFIG_AMAZON_EFA_INFINIBAND) += efa.o

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

efa-$(CONFIG_SYSFS) += efa_sysfs.o

Expand Down
43 changes: 22 additions & 21 deletions drivers/amazon/net/efa/config.h
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
#define HAVE_UMEM_SCATTERLIST_IF 1
#define HAVE_MAX_SEND_RCV_SGE 1
#define HAVE_CREATE_CQ_ATTR 1
#define HAVE_IB_MODIFY_QP_IS_OK_FOUR_PARAMS 1
#define HAVE_CREATE_AH_RDMA_ATTR 1
#define HAVE_DEV_PARENT 1
#define HAVE_POST_CONST_WR 1
#define HAVE_CREATE_AH_RDMA_ATTR 1
#define HAVE_PD_CORE_ALLOCATION 1
#define HAVE_MAX_SEND_RCV_SGE 1
#define HAVE_IB_MODIFY_QP_IS_OK_FOUR_PARAMS 1
#define HAVE_IB_DEV_OPS 1
#define HAVE_PD_CORE_ALLOCATION 1
#define HAVE_UCONTEXT_CORE_ALLOCATION 1
#define HAVE_NO_KVERBS_DRIVERS 1
#define HAVE_UDATA_TO_DRV_CONTEXT 1
#define HAVE_AH_CORE_ALLOCATION 1
#define HAVE_SAFE_IB_ALLOC_DEVICE 1
#define HAVE_AH_CORE_ALLOCATION 1
#define HAVE_ALLOC_PD_NO_UCONTEXT 1
#define HAVE_DEREG_MR_UDATA 1
#define HAVE_DESTROY_CQ_UDATA 1
#define HAVE_DESTROY_QP_UDATA 1
#define HAVE_IB_DEVICE_OPS_COMMON 1
#define HAVE_IB_UMEM_FIND_SINGLE_PG_SIZE 1
#define HAVE_UPSTREAM_EFA 1
#define HAVE_IB_QPT_DRIVER 1
#define HAVE_KVZALLOC 1
#define HAVE_IB_DEVICE_OPS_COMMON 1
#define HAVE_CQ_CORE_ALLOCATION 1
#define HAVE_IB_IS_UDATA_CLEARED 1
#define HAVE_IBDEV_PRINT 1
#define HAVE_IB_UMEM_FIND_SINGLE_PG_SIZE 1
#define HAVE_IB_PORT_PHYS_STATE_LINK_UP 1
#define HAVE_KVZALLOC 1
#define HAVE_IBDEV_PRINT_RATELIMITED 1
#define HAVE_IBDEV_PRINT 1
#define HAVE_IB_QPT_DRIVER 1
#define HAVE_IB_IS_UDATA_CLEARED 1
#define HAVE_IB_MR_LENGTH 1
#define HAVE_PCI_VENDOR_ID_AMAZON 1
#define HAVE_IB_UMEM_GET_NO_DMASYNC 1
#define HAVE_CORE_MMAP_XA 1
#define HAVE_RDMA_NODE_UNSPECIFIED 1
#define HAVE_BITFIELD_H 1
#define HAVE_IB_UMEM_GET_DEVICE_PARAM 1
#define HAVE_ATOMIC64_FETCH_INC 1
#define HAVE_IB_ACCESS_OPTIONAL 1
#define HAVE_RDMA_NODE_UNSPECIFIED 1
#define HAVE_CORE_MMAP_XA 1
#define HAVE_IB_UMEM_GET_NO_DMASYNC 1
#define HAVE_CREATE_AH_INIT_ATTR 1
#define HAVE_ATOMIC64_FETCH_INC 1
#define HAVE_DEALLOC_PD_UDATA_RC 1
#define HAVE_IB_INT_DESTROY_CQ 1
#define HAVE_AH_CORE_ALLOCATION_DESTROY_RC 1
#define HAVE_CREATE_AH_INIT_ATTR 1
#define HAVE_IB_INT_DESTROY_CQ 1
#define HAVE_RDMA_UMEM_FOR_EACH_DMA_BLOCK 1
#define HAVE_UVERBS_CMD_MASK_NOT_NEEDED 1
#define HAVE_IB_UMEM_NUM_DMA_BLOCKS 1
#define HAVE_IB_REGISTER_DEVICE_DMA_DEVICE_PARAM 1
#define HAVE_UVERBS_CMD_MASK_NOT_NEEDED 1
#define HAVE_U32_PORT 1
#define HAVE_SPLIT_STATS_ALLOC 1
#define HAVE_SYSFS_EMIT 1
#define HAVE_IB_REGISTER_DEVICE_DMA_DEVICE_PARAM 1
#define HAVE_XARRAY 1
#define HAVE_SPLIT_STATS_ALLOC 1
#define HAVE_QP_CORE_ALLOCATION 1
#define HAVE_EFA_GDR 1
#define HAVE_MR_DMABUF 1
#define HAVE_EFA_P2P 1
4 changes: 3 additions & 1 deletion drivers/amazon/net/efa/efa-abi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
/*
* Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
* Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All rights reserved.
*/

#ifndef EFA_ABI_USER_H
Expand Down Expand Up @@ -54,6 +54,7 @@ struct efa_ibv_alloc_pd_resp {

enum {
EFA_CREATE_CQ_WITH_COMPLETION_CHANNEL = 1 << 0,
EFA_CREATE_CQ_WITH_SGID = 1 << 1,
};

struct efa_ibv_create_cq {
Expand Down Expand Up @@ -118,6 +119,7 @@ enum {
EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0,
EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1,
EFA_QUERY_DEVICE_CAPS_CQ_NOTIFICATIONS = 1 << 2,
EFA_QUERY_DEVICE_CAPS_CQ_WITH_SGID = 1 << 3,
};

struct efa_ibv_ex_query_device_resp {
Expand Down
12 changes: 9 additions & 3 deletions drivers/amazon/net/efa/efa.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ struct efa_pd {
struct efa_mr {
struct ib_mr ibmr;
struct ib_umem *umem;
#ifdef HAVE_EFA_GDR
struct efa_nvmem *nvmem;
u64 nvmem_ticket;
#ifdef HAVE_EFA_P2P
struct efa_p2pmem *p2pmem;
u64 p2p_ticket;
#endif
};

Expand Down Expand Up @@ -219,6 +219,12 @@ struct ib_cq *efa_kzalloc_cq(struct ib_device *ibdev,
struct ib_mr *efa_reg_mr(struct ib_pd *ibpd, u64 start, u64 length,
u64 virt_addr, int access_flags,
struct ib_udata *udata);
#ifdef HAVE_MR_DMABUF
struct ib_mr *efa_reg_user_mr_dmabuf(struct ib_pd *ibpd, u64 start,
u64 length, u64 virt_addr,
int fd, int access_flags,
struct ib_udata *udata);
#endif
#ifdef HAVE_DEREG_MR_UDATA
int efa_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata);
#else
Expand Down
6 changes: 5 additions & 1 deletion drivers/amazon/net/efa/efa_admin_cmds_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,10 @@ struct efa_admin_create_cq_cmd {
/*
* 4:0 : cq_entry_size_words - size of CQ entry in
* 32-bit words, valid values: 4, 8.
* 7:5 : reserved7 - MBZ
* 5 : set_src_addr - If set, source address will be
* filled on RX completions from unknown senders.
* Requires 8 words CQ entry size.
* 7:6 : reserved7 - MBZ
*/
u8 cq_caps_2;

Expand Down Expand Up @@ -980,6 +983,7 @@ struct efa_admin_host_info {
#define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
#define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK BIT(6)
#define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
#define EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR_MASK BIT(5)

/* create_cq_resp */
#define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK BIT(0)
Expand Down
5 changes: 4 additions & 1 deletion drivers/amazon/net/efa/efa_com_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ int efa_com_create_cq(struct efa_com_dev *edev,
EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED, 1);
create_cmd.eqn = params->eqn;
}

if (params->set_src_addr) {
EFA_SET(&create_cmd.cq_caps_2,
EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR, 1);
}
efa_com_set_dma_addr(params->dma_addr,
&create_cmd.cq_ba.mem_addr_high,
&create_cmd.cq_ba.mem_addr_low);
Expand Down
3 changes: 2 additions & 1 deletion drivers/amazon/net/efa/efa_com_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ struct efa_com_create_cq_params {
u16 uarn;
u16 eqn;
u8 entry_size_in_bytes;
bool interrupt_mode_enabled;
u8 interrupt_mode_enabled : 1;
u8 set_src_addr : 1;
};

struct efa_com_create_cq_result {
Expand Down
Loading

0 comments on commit 4929d24

Please sign in to comment.