Skip to content

Commit ec883bf

Browse files
committed
libxscale: Add support for cq related verbs
This patch adds support for the following cq verbs: 1. create_cq 2. poll_cq 3. req_notify_cq 4. resize_cq 5. destroy_cq Signed-off-by: Tian Xin <[email protected]> Signed-off-by: Wei Honggang <[email protected]> Signed-off-by: Zhao Qianwei <[email protected]> Signed-off-by: Li Qiang <[email protected]> Signed-off-by: Yan Lei <[email protected]>
1 parent 751c968 commit ec883bf

File tree

8 files changed

+1227
-2
lines changed

8 files changed

+1227
-2
lines changed

providers/xscale/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
rdma_provider(xscale
22
xscale.c
33
verbs.c
4+
cq.c
5+
xsc_hsi.c
6+
buf.c
47
)

providers/xscale/buf.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Copyright (c) 2021 - 2022, Shanghai Yunsilicon Technology Co., Ltd.
4+
* All rights reserved.
5+
*/
6+
7+
#include <config.h>
8+
9+
#include <signal.h>
10+
#include <sys/ipc.h>
11+
#include <sys/shm.h>
12+
#include <stdio.h>
13+
#include <stdlib.h>
14+
#include <errno.h>
15+
16+
#include "util/util.h"
17+
#include "xscale.h"
18+
19+
int xsc_alloc_buf(struct xsc_buf *buf, size_t size, int page_size)
20+
{
21+
int ret;
22+
int al_size;
23+
24+
al_size = align(size, page_size);
25+
ret = posix_memalign(&buf->buf, page_size, al_size);
26+
if (ret)
27+
return ret;
28+
29+
ret = ibv_dontfork_range(buf->buf, al_size);
30+
if (ret)
31+
free(buf->buf);
32+
33+
buf->length = al_size;
34+
35+
return ret;
36+
}
37+
38+
void xsc_free_buf(struct xsc_buf *buf)
39+
{
40+
ibv_dofork_range(buf->buf, buf->length);
41+
free(buf->buf);
42+
}

0 commit comments

Comments
 (0)