Skip to content

Commit

Permalink
pyverbs: Add work requests related classes
Browse files Browse the repository at this point in the history
This patch adds SGE, RecvWR and SendWR classes.

Signed-off-by: Noa Osherovich <noaos@mellanox.com>
  • Loading branch information
noaos committed May 6, 2019
1 parent a066e6d commit d3164e3
Show file tree
Hide file tree
Showing 4 changed files with 395 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyverbs/CMakeLists.txt
Expand Up @@ -9,6 +9,7 @@ rdma_cython_module(pyverbs
enums.pyx
mr.pyx
pd.pyx
wr.pyx
)

rdma_python_module(pyverbs
Expand Down
68 changes: 68 additions & 0 deletions pyverbs/libibverbs.pxd
Expand Up @@ -257,6 +257,74 @@ cdef extern from 'infiniband/verbs.h':
ibv_pd *pd
unsigned int handle

cdef struct ibv_sge:
unsigned long addr
unsigned int length
unsigned int lkey

cdef struct ibv_recv_wr:
unsigned long wr_id
ibv_recv_wr *next
ibv_sge *sg_list
int num_sge

cdef struct rdma:
unsigned long remote_addr
unsigned int rkey

cdef struct atomic:
unsigned long remote_addr
unsigned long compare_add
unsigned long swap
unsigned int rkey

cdef struct ud:
ibv_ah *ah
unsigned int remote_qpn
unsigned int remote_qkey

cdef union wr:
rdma rdma
atomic atomic
ud ud

cdef struct ibv_mw_bind_info:
ibv_mr *mr
unsigned long addr
unsigned long length
unsigned int mw_access_flags

cdef struct bind_mw:
ibv_mw *mw
unsigned int rkey
ibv_mw_bind_info bind_info

cdef struct tso:
void *hdr
unsigned short hdr_sz
unsigned short mss

cdef union unnamed:
bind_mw bind_mw
tso tso

cdef struct xrc:
unsigned int remote_srqn

cdef union qp_type:
xrc xrc

cdef struct ibv_send_wr:
unsigned long wr_id
ibv_send_wr *next
ibv_sge *sg_list
int num_sge
ibv_wr_opcode opcode
unsigned int send_flags
wr wr
qp_type qp_type
unnamed unnamed

ibv_device **ibv_get_device_list(int *n)
void ibv_free_device_list(ibv_device **list)
ibv_context *ibv_open_device(ibv_device *device)
Expand Down
16 changes: 16 additions & 0 deletions pyverbs/wr.pxd
@@ -0,0 +1,16 @@
# SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB)
# Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. See COPYING file

from .base cimport PyverbsCM
from pyverbs cimport libibverbs as v


cdef class SGE(PyverbsCM):
cdef v.ibv_sge *sge
cpdef read(self, length, offset)

cdef class RecvWR(PyverbsCM):
cdef v.ibv_recv_wr recv_wr

cdef class SendWR(PyverbsCM):
cdef v.ibv_send_wr send_wr

0 comments on commit d3164e3

Please sign in to comment.