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

Add Yunsilicon User Space RoCE Driver #1500

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ add_subdirectory(providers/mthca)
add_subdirectory(providers/ocrdma)
add_subdirectory(providers/qedr)
add_subdirectory(providers/vmw_pvrdma)
add_subdirectory(providers/xscale)
endif()

add_subdirectory(providers/hfi1verbs)
Expand Down
9 changes: 9 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,12 @@ PYVERBS
M: Edward Srouji <[email protected]>
S: Supported
F: pyverbs/

XSCALE USERSPACE PROVIDER (for xsc_ib.ko)
M: Wei Honggang <[email protected]>
M: Zhao Qianwei <[email protected]>
M: Li Qiang <[email protected]>
M: Tian Xin <[email protected]>
M: Yan Lei <[email protected]>
S: Supported
F: providers/xscale/
2 changes: 2 additions & 0 deletions kernel-headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ publish_internal_headers(rdma
rdma/rvt-abi.h
rdma/siw-abi.h
rdma/vmw_pvrdma-abi.h
rdma/xsc-abi.h
)

publish_internal_headers(rdma/hfi
Expand Down Expand Up @@ -80,6 +81,7 @@ rdma_kernel_provider_abi(
rdma/rdma_user_rxe.h
rdma/siw-abi.h
rdma/vmw_pvrdma-abi.h
rdma/xsc-abi.h
)

publish_headers(infiniband
Expand Down
1 change: 1 addition & 0 deletions kernel-headers/rdma/ib_user_ioctl_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ enum rdma_driver_id {
RDMA_DRIVER_SIW,
RDMA_DRIVER_ERDMA,
RDMA_DRIVER_MANA,
RDMA_DRIVER_XSC,
};

enum ib_uverbs_gid_type {
Expand Down
74 changes: 74 additions & 0 deletions kernel-headers/rdma/xsc-abi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2021 - 2022, Shanghai Yunsilicon Technology Co., Ltd.
* All rights reserved.
*/

#ifndef XSC_ABI_USER_H
#define XSC_ABI_USER_H

#include <linux/types.h>
#include <linux/if_ether.h> /* For ETH_ALEN. */
#include <rdma/ib_user_ioctl_verbs.h>

/* Make sure that all structs defined in this file remain laid out so
* that they pack the same way on 32-bit and 64-bit architectures (to
* avoid incompatibility between 32-bit userspace and 64-bit kernels).
* In particular do not use pointer types -- pass pointers in __u64
* instead.
*/

struct xsc_ib_alloc_ucontext_resp {
__u32 qp_tab_size;
__u32 cache_line_size;
__u16 max_sq_desc_sz;
__u16 max_rq_desc_sz;
__u32 max_send_wr;
__u32 max_recv_wr;
__u16 num_ports;
__u16 device_id;
__aligned_u64 qpm_tx_db;
__aligned_u64 qpm_rx_db;
__aligned_u64 cqm_next_cid_reg;
__aligned_u64 cqm_armdb;
__u32 send_ds_num;
__u32 recv_ds_num;
__u32 resv;
};

struct xsc_ib_create_qp {
__aligned_u64 buf_addr;
__aligned_u64 db_addr;
__u32 sq_wqe_count;
__u32 rq_wqe_count;
__u32 rq_wqe_shift;
__u32 flags;
__u32 resv;
};

struct xsc_ib_create_qp_resp {
__u32 bfreg_index;
__u32 resv;
};

struct xsc_ib_create_cq {
__aligned_u64 buf_addr;
__u32 cqe_size;
};

struct xsc_ib_create_cq_resp {
__u32 cqn;
__u32 reserved;
};

struct xsc_ib_create_ah_resp {
__u32 response_length;
__u8 dmac[ETH_ALEN];
__u8 reserved[6];
};

struct xsc_ib_alloc_pd_resp {
__u32 pdn;
};

#endif /* XSC_ABI_USER_H */
1 change: 1 addition & 0 deletions libibverbs/verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,7 @@ extern const struct verbs_device_ops verbs_provider_qedr;
extern const struct verbs_device_ops verbs_provider_rxe;
extern const struct verbs_device_ops verbs_provider_siw;
extern const struct verbs_device_ops verbs_provider_vmw_pvrdma;
extern const struct verbs_device_ops verbs_provider_xscale;
extern const struct verbs_device_ops verbs_provider_all;
extern const struct verbs_device_ops verbs_provider_none;
void ibv_static_providers(void *unused, ...);
Expand Down
8 changes: 8 additions & 0 deletions providers/xscale/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rdma_provider(xscale
xscale.c
verbs.c
cq.c
qp.c
xsc_hsi.c
buf.c
)
42 changes: 42 additions & 0 deletions providers/xscale/buf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2021 - 2022, Shanghai Yunsilicon Technology Co., Ltd.
* All rights reserved.
*/

#include <config.h>

#include <signal.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

#include "util/util.h"
#include "xscale.h"

int xsc_alloc_buf(struct xsc_buf *buf, size_t size, int page_size)
{
int ret;
int al_size;

al_size = align(size, page_size);
ret = posix_memalign(&buf->buf, page_size, al_size);
if (ret)
return ret;

ret = ibv_dontfork_range(buf->buf, al_size);
if (ret)
free(buf->buf);

buf->length = al_size;

return ret;
}

void xsc_free_buf(struct xsc_buf *buf)
{
ibv_dofork_range(buf->buf, buf->length);
free(buf->buf);
}
Loading