Skip to content

Commit 3448bf3

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. cq_event 5. resize_cq 6. 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 01aa334 commit 3448bf3

File tree

7 files changed

+1213
-8
lines changed

7 files changed

+1213
-8
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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 "xscale.h"
17+
18+
int xsc_alloc_buf(struct xsc_buf *buf, size_t size, int page_size)
19+
{
20+
int ret;
21+
int al_size;
22+
23+
al_size = align(size, page_size);
24+
ret = posix_memalign(&buf->buf, page_size, al_size);
25+
if (ret)
26+
return ret;
27+
28+
ret = ibv_dontfork_range(buf->buf, al_size);
29+
if (ret)
30+
free(buf->buf);
31+
32+
buf->length = al_size;
33+
34+
return ret;
35+
}
36+
37+
void xsc_free_buf(struct xsc_buf *buf)
38+
{
39+
ibv_dofork_range(buf->buf, buf->length);
40+
free(buf->buf);
41+
}

0 commit comments

Comments
 (0)