rdma_rxe: API extensions
Subsystems (2)
v5 cover rdma_rxe: API extensions
This patch series is a collection of API extensions for the rdma_rxe driver. With this patch set installed there are no errors in pyverbs run-tests and 31 tests are skipped down from 56. The remaining skipped test cases include
- XRC tests
- ODP tests
- Parent device tests
- Import tests
- Device memory
- MLX5 specific tests
- EFA tests
It continues from the previous (v4) set which implemented memory windows and has had a number of individual patches picked up in for-next.
This set (v5) includes:
Ported to current head of tree
Memory windows patches not yet picked up kernel support for the extended user space APIs:
- ibv_query_device_ex
- ibv_create_cq_ex
- ibv_create_qp_ex
Fixes for multicast which is not currently working
This patch set depends on a matching rdma-core user space library patch set.
In order to run correctly it is necessary to configure by hand the EUI64 link local IPV6 address on systems which use a random link local address (like Ubuntu).
Bob Pearson (12):
rdma_rxe: Separate MEM into MR and MW objects.
rdma_rxe: Enable MW objects
rdma_rxe: Let pools support both keys and indices
rdma_rxe: Add alloc_mw and dealloc_mw verbs
rdma_rxe: Add bind_mw and invalidate_mw verbs
rdma_rxe: Add memory access through MWs
rdma_rxe: Add support for ibv_query_device_ex
rdma_rxe: Add support for extended CQ operations
rdma_rxe: Add support for extended QP operations
rdma_rxe: Fix pool related bugs for multicast
rdma_rxe: Fix multicast group allocation bug
rdma_rxe: Fix bugs in the multicast receive path
drivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe.c | 100 ++++-- drivers/infiniband/sw/rxe/rxe_comp.c | 12 +- drivers/infiniband/sw/rxe/rxe_cq.c | 12 +- drivers/infiniband/sw/rxe/rxe_loc.h | 43 ++- drivers/infiniband/sw/rxe/rxe_mcast.c | 110 ++++--- drivers/infiniband/sw/rxe/rxe_mr.c | 350 +++++++++++---------- drivers/infiniband/sw/rxe/rxe_mw.c | 416 +++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 1 - drivers/infiniband/sw/rxe/rxe_param.h | 10 +- drivers/infiniband/sw/rxe/rxe_pool.c | 330 +++++++++++++------- drivers/infiniband/sw/rxe/rxe_pool.h | 109 +++++-- drivers/infiniband/sw/rxe/rxe_recv.c | 64 ++-- drivers/infiniband/sw/rxe/rxe_req.c | 113 ++++--- drivers/infiniband/sw/rxe/rxe_resp.c | 125 +++++--- drivers/infiniband/sw/rxe/rxe_verbs.c | 101 +++--- drivers/infiniband/sw/rxe/rxe_verbs.h | 64 ++-- include/uapi/rdma/rdma_user_rxe.h | 68 +++- 19 files changed, 1448 insertions(+), 592 deletions(-) create mode 100644 drivers/infiniband/sw/rxe/rxe_mw.c
Signature · 1 line
2.25.1
PATCH v5 1/12 rdma_rxe: Separat MEM into MR and MW objects.
In the original rxe implementation it was intended to use a common object to represent MRs and MWs but it became clear that they are different enough to separate these into two objects.
This allows replacing the mem name with mr for MRs which is more consistent with the style for the other objects and less likely to be confusing. This is a long patch that mostly changes mem to mr where it makes sense and adds a new rxe_mw struct.
--- drivers/infiniband/sw/rxe/rxe_comp.c | 4 +- drivers/infiniband/sw/rxe/rxe_loc.h | 26 +-- drivers/infiniband/sw/rxe/rxe_mr.c | 264 +++++++++++++------------- drivers/infiniband/sw/rxe/rxe_pool.c | 8 +- drivers/infiniband/sw/rxe/rxe_req.c | 6 +- drivers/infiniband/sw/rxe/rxe_resp.c | 30 +-- drivers/infiniband/sw/rxe/rxe_verbs.c | 18 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 51 ++--- 8 files changed, 204 insertions(+), 203 deletions(-)
drivers/infiniband/sw/rxe/rxe_comp.c +2 -2
@@ -345,7 +345,7 @@ static inline enum comp_state do_read(struct rxe_qp *qp, ret =copy_data (qp->pd,IB_ACCESS_LOCAL_WRITE , &wqe->dma,payload_addr (pkt), -payload_size (pkt), to_mem_obj,NULL ); +payload_size (pkt), to_mr_obj,NULL );if (ret)return COMPST_ERROR ;
@@ -365,7 +365,7 @@ static inline enum comp_state do_atomic(struct rxe_qp *qp, ret =copy_data (qp->pd,IB_ACCESS_LOCAL_WRITE , &wqe->dma, &atomic_orig, -sizeof (u64), to_mem_obj,NULL ); +sizeof (u64), to_mr_obj,NULL );if (ret)return COMPST_ERROR ;else
drivers/infiniband/sw/rxe/rxe_loc.h +13 -13
@@ -72,40 +72,40 @@ int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);/* rxe_mr.c */ enum copy_direction { - to_mem_obj, - from_mem_obj, + to_mr_obj, + from_mr_obj, }; -void rxe_mem_init_dma (struct rxe_pd *pd, -int access,struct rxe_mem *mem); +void rxe_mr_init_dma (struct rxe_pd *pd, +int access,struct rxe_mr *mr); -int rxe_mem_init_user (struct rxe_pd *pd,u64 start, +int rxe_mr_init_user (struct rxe_pd *pd,u64 start,u64 length,u64 iova,int access,struct ib_udata *udata, -struct rxe_mem *mr); +struct rxe_mr *mr); -int rxe_mem_init_fast (struct rxe_pd *pd, -int max_pages,struct rxe_mem *mem); +int rxe_mr_init_fast (struct rxe_pd *pd, +int max_pages,struct rxe_mr *mr); -int rxe_mem_copy (struct rxe_mem *mem,u64 iova,void *addr, +int rxe_mr_copy (struct rxe_mr *mr,u64 iova,void *addr,int length,enum copy_direction dir,u32 *crcp);int copy_data (struct rxe_pd *pd,int access,struct rxe_dma_info *dma,void *addr,int length,enum copy_direction dir,u32 *crcp); -void *iova_to_vaddr (struct rxe_mem *mem,u64 iova,int length); +void *iova_to_vaddr (struct rxe_mr *mr,u64 iova,int length);enum lookup_type { lookup_local, lookup_remote, }; -struct rxe_mem *lookup_mem (struct rxe_pd *pd,int access,u32 key, +struct rxe_mr *lookup_mr (struct rxe_pd *pd,int access,u32 key,enum lookup_type type); -int mem_check_range (struct rxe_mem *mem,u64 iova,size_t length); +int mr_check_range (struct rxe_mr *mr,u64 iova,size_t length); -void rxe_mem_cleanup (struct rxe_pool_entry *arg); +void rxe_mr_cleanup (struct rxe_pool_entry *arg);int advance_dma_data (struct rxe_dma_info *dma,unsigned int length);
drivers/infiniband/sw/rxe/rxe_mr.c +132 -132
518 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_pool.c +3 -5
@@ -8,8 +8,6 @@#include "rxe_loc.h" /* info about object pools -* note that mr and mw share a single index space -* so that one can map an lkey to the correct type of object */ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES ] = { [RXE_TYPE_UC ] = {
@@ -50,15 +48,15 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = { }, [RXE_TYPE_MR] = { .name = "rxe-mr", - .size = sizeof(struct rxe_mem), - .cleanup = rxe_mem_cleanup, + .size = sizeof(struct rxe_mr), + .cleanup = rxe_mr_cleanup, .flags = RXE_POOL_INDEX, .max_index = RXE_MAX_MR_INDEX, .min_index = RXE_MIN_MR_INDEX, }, [RXE_TYPE_MW] = { .name = "rxe-mw", - .size = sizeof(struct rxe_mem), + .size = sizeof(struct rxe_mw), .flags = RXE_POOL_INDEX, .max_index = RXE_MAX_MW_INDEX, .min_index = RXE_MIN_MW_INDEX,
drivers/infiniband/sw/rxe/rxe_req.c +3 -3
@@ -465,7 +465,7 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, }else { err =copy_data (qp->pd,0 , &wqe->dma,payload_addr (pkt), paylen, - from_mem_obj, + from_mr_obj, &crc);if (err)return err;
@@ -597,7 +597,7 @@ int rxe_requester(void *arg)if (wqe->mask &WR_REG_MASK ) {if (wqe->wr.opcode ==IB_WR_LOCAL_INV ) {struct rxe_dev *rxe =to_rdev (qp->ibqp.device); -struct rxe_mem *rmr; +struct rxe_mr *rmr; rmr =rxe_pool_get_index (&rxe->mr_pool, wqe->wr.ex.invalidate_rkey >>8 );
@@ -613,7 +613,7 @@ int rxe_requester(void *arg) wqe->state = wqe_state_done; wqe->status =IB_WC_SUCCESS ; }else if (wqe->wr.opcode ==IB_WR_REG_MR ) { -struct rxe_mem *rmr =to_rmr (wqe->wr.wr.reg.mr); +struct rxe_mr *rmr =to_rmr (wqe->wr.wr.reg.mr); rmr->state =RXE_MEM_STATE_VALID ; rmr->access = wqe->wr.wr.reg.access;
drivers/infiniband/sw/rxe/rxe_resp.c +15 -15
@@ -390,7 +390,7 @@ static enum resp_states check_length(struct rxe_qp *qp,static enum resp_states check_rkey (struct rxe_qp *qp,struct rxe_pkt_info *pkt) { -struct rxe_mem *mem =NULL ; +struct rxe_mr *mr =NULL ;u64 va;u32 rkey;u32 resid;
@@ -429,18 +429,18 @@ static enum resp_states check_rkey(struct rxe_qp *qp, resid = qp->resp.resid; pktlen =payload_size (pkt); - mem =lookup_mem (qp->pd, access, rkey, lookup_remote); -if (!mem) { + mr =lookup_mr (qp->pd, access, rkey, lookup_remote); +if (!mr) { state =RESPST_ERR_RKEY_VIOLATION ; goto err; } -if (unlikely (mem->state ==RXE_MEM_STATE_FREE )) { +if (unlikely (mr->state ==RXE_MEM_STATE_FREE )) { state =RESPST_ERR_RKEY_VIOLATION ; goto err; } -if (mem_check_range (mem, va, resid)) { +if (mr_check_range (mr, va, resid)) { state =RESPST_ERR_RKEY_VIOLATION ; goto err; }
@@ -468,12 +468,12 @@ static enum resp_states check_rkey(struct rxe_qp *qp,WARN_ON_ONCE (qp->resp.mr); - qp->resp.mr = mem; + qp->resp.mr = mr;return RESPST_EXECUTE ; err: -if (mem) -rxe_drop_ref (mem); +if (mr) +rxe_drop_ref (mr);return state; }
@@ -483,7 +483,7 @@ static enum resp_states send_data_in(struct rxe_qp *qp, void *data_addr,int err; err =copy_data (qp->pd,IB_ACCESS_LOCAL_WRITE , &qp->resp.wqe->dma, - data_addr, data_len, to_mem_obj,NULL ); + data_addr, data_len, to_mr_obj,NULL );if (unlikely (err))return (err == -ENOSPC ) ?RESPST_ERR_LENGTH :RESPST_ERR_MALFORMED_WQE ;
@@ -498,8 +498,8 @@ static enum resp_states write_data_in(struct rxe_qp *qp,int err;int data_len =payload_size (pkt); - err =rxe_mem_copy (qp->resp.mr, qp->resp.va,payload_addr (pkt), - data_len, to_mem_obj,NULL ); + err =rxe_mr_copy (qp->resp.mr, qp->resp.va,payload_addr (pkt), + data_len, to_mr_obj,NULL );if (err) { rc =RESPST_ERR_RKEY_VIOLATION ; goto out;
@@ -521,7 +521,7 @@ static enum resp_states process_atomic(struct rxe_qp *qp,u64 iova =atmeth_va (pkt);u64 *vaddr;enum resp_states ret; -struct rxe_mem *mr = qp->resp.mr; +struct rxe_mr *mr = qp->resp.mr;if (mr->state !=RXE_MEM_STATE_VALID ) { ret =RESPST_ERR_RKEY_VIOLATION ;
@@ -700,8 +700,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,if (!skb)return RESPST_ERR_RNR ; - err =rxe_mem_copy (res->read.mr, res->read.va,payload_addr (&ack_pkt), - payload, from_mem_obj, &icrc); + err =rxe_mr_copy (res->read.mr, res->read.va,payload_addr (&ack_pkt), + payload, from_mr_obj, &icrc);if (err)pr_err ("Failed copying memory\n" );
@@ -883,7 +883,7 @@ static enum resp_states do_complete(struct rxe_qp *qp, }if (pkt->mask &RXE_IETH_MASK ) { -struct rxe_mem *rmr; +struct rxe_mr *rmr; wc->wc_flags |=IB_WC_WITH_INVALIDATE ; wc->ex.invalidate_rkey =ieth_rkey (pkt);
drivers/infiniband/sw/rxe/rxe_verbs.c +9 -9
@@ -867,7 +867,7 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access) {struct rxe_dev *rxe =to_rdev (ibpd->device);struct rxe_pd *pd =to_rpd (ibpd); -struct rxe_mem *mr; +struct rxe_mr *mr; mr =rxe_alloc (&rxe->mr_pool);if (!mr)
@@ -875,7 +875,7 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access)rxe_add_index (mr);rxe_add_ref (pd); -rxe_mem_init_dma (pd, access, mr); +rxe_mr_init_dma (pd, access, mr);return &mr->ibmr; }
@@ -889,7 +889,7 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,int err;struct rxe_dev *rxe =to_rdev (ibpd->device);struct rxe_pd *pd =to_rpd (ibpd); -struct rxe_mem *mr; +struct rxe_mr *mr; mr =rxe_alloc (&rxe->mr_pool);if (!mr) {
@@ -901,7 +901,7 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,rxe_add_ref (pd); - err =rxe_mem_init_user (pd, start, length, iova, + err =rxe_mr_init_user (pd, start, length, iova, access, udata, mr);if (err) goto err3;
@@ -918,7 +918,7 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,static int rxe_dereg_mr (struct ib_mr *ibmr,struct ib_udata *udata) { -struct rxe_mem *mr =to_rmr (ibmr); +struct rxe_mr *mr =to_rmr (ibmr); mr->state =RXE_MEM_STATE_ZOMBIE ;rxe_drop_ref (mr->pd);
@@ -932,7 +932,7 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, {struct rxe_dev *rxe =to_rdev (ibpd->device);struct rxe_pd *pd =to_rpd (ibpd); -struct rxe_mem *mr; +struct rxe_mr *mr;int err;if (mr_type !=IB_MR_TYPE_MEM_REG )
@@ -948,7 +948,7 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,rxe_add_ref (pd); - err =rxe_mem_init_fast (pd, max_num_sg, mr); + err =rxe_mr_init_fast (pd, max_num_sg, mr);if (err) goto err2;
@@ -964,7 +964,7 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,static int rxe_set_page (struct ib_mr *ibmr,u64 addr) { -struct rxe_mem *mr =to_rmr (ibmr); +struct rxe_mr *mr =to_rmr (ibmr);struct rxe_map *map;struct rxe_phys_buf *buf;
@@ -984,7 +984,7 @@ static int rxe_set_page(struct ib_mr *ibmr, u64 addr)static int rxe_map_mr_sg (struct ib_mr *ibmr,struct scatterlist *sg,int sg_nents,unsigned int *sg_offset) { -struct rxe_mem *mr =to_rmr (ibmr); +struct rxe_mr *mr =to_rmr (ibmr);int n; mr->nbuf =0 ;
drivers/infiniband/sw/rxe/rxe_verbs.h +27 -24
106 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v5 2/12 rdma_rxe: Enable MW objects
In reply to Bob PearsonChange parameters in rxe_param.h so that MAX_MW is the same as MAX_MR. Set device attribute in rxe.c so max_mw = MAX_MW.
--- drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_param.h | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe.c +1 -0
@@ -52,6 +52,7 @@ static void rxe_init_device_param(struct rxe_dev *rxe) rxe->attr.max_cq =RXE_MAX_CQ ; rxe->attr.max_cqe = (1 <<RXE_MAX_LOG_CQE ) -1 ; rxe->attr.max_mr =RXE_MAX_MR ; + rxe->attr.max_mw =RXE_MAX_MW ; rxe->attr.max_pd =RXE_MAX_PD ; rxe->attr.max_qp_rd_atom =RXE_MAX_QP_RD_ATOM ; rxe->attr.max_res_rd_atom =RXE_MAX_RES_RD_ATOM ;
drivers/infiniband/sw/rxe/rxe_param.h +6 -4
@@ -58,7 +58,8 @@ enum rxe_device_param {RXE_MAX_SGE_RD =32 ,RXE_MAX_CQ =16384 ,RXE_MAX_LOG_CQE =15 , -RXE_MAX_MR =256 *1024 , +RXE_MAX_MR =0x40000 , +RXE_MAX_MW =0x40000 ,RXE_MAX_PD =0x7ffc ,RXE_MAX_QP_RD_ATOM =128 , RXE_MAX_RES_RD_ATOM = 0x3f000,
@@ -87,9 +88,10 @@ enum rxe_device_param {RXE_MAX_SRQ_INDEX =0x00040000 ,RXE_MIN_MR_INDEX =0x00000001 , -RXE_MAX_MR_INDEX =0x00040000 , -RXE_MIN_MW_INDEX =0x00040001 , -RXE_MAX_MW_INDEX =0x00060000 , +RXE_MAX_MR_INDEX =RXE_MIN_MR_INDEX +RXE_MAX_MR -1 , +RXE_MIN_MW_INDEX =RXE_MIN_MR_INDEX +RXE_MAX_MR , +RXE_MAX_MW_INDEX =RXE_MIN_MW_INDEX +RXE_MAX_MW -1 , +RXE_MAX_PKT_PER_ACK =64 , RXE_MAX_UNACKED_PSNS = 128,
Signature · 1 line
2.25.1
PATCH v5 3/12 rdma_rxe: Let pools support both keys and indices
In reply to Bob PearsonAllow both indices and keys to exist for objects in pools. Previously you were limited to one or the other. This will support allowing the keys on MWs to change.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 73 ++++++++++++++-------------- drivers/infiniband/sw/rxe/rxe_pool.h | 32 +++++++----- 2 files changed, 58 insertions(+), 47 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +37 -36
@@ -92,18 +92,18 @@ static int rxe_pool_init_index(struct rxe_pool *pool, u32 max, u32 min) goto out; } - pool->max_index = max; - pool->min_index = min; + pool->index.max_index = max; + pool->index.min_index = min; size =BITS_TO_LONGS (max - min +1 ) *sizeof (long ); - pool->table =kmalloc (size,GFP_KERNEL ); -if (!pool->table) { + pool->index.table =kmalloc (size,GFP_KERNEL ); +if (!pool->index.table) { err = -ENOMEM ; goto out; } - pool->table_size = size; -bitmap_zero (pool->table, max - min +1 ); + pool->index.table_size = size; +bitmap_zero (pool->index.table, max - min +1 ); out:return err;
@@ -125,7 +125,8 @@ int rxe_pool_init( pool->max_elem = max_elem; pool->elem_size =ALIGN (size,RXE_POOL_ALIGN ); pool->flags = rxe_type_info[type].flags; - pool->tree =RB_ROOT ; + pool->index.tree =RB_ROOT ; + pool->key.tree =RB_ROOT ; pool->cleanup = rxe_type_info[type].cleanup;atomic_set (&pool->num_elem,0 );
@@ -143,8 +144,8 @@ int rxe_pool_init( }if (rxe_type_info[type].flags &RXE_POOL_KEY ) { - pool->key_offset = rxe_type_info[type].key_offset; - pool->key_size = rxe_type_info[type].key_size; + pool->key.key_offset = rxe_type_info[type].key_offset; + pool->key.key_size = rxe_type_info[type].key_size; } pool->state =RXE_POOL_STATE_VALID ;
@@ -158,7 +159,7 @@ static void rxe_pool_release(struct kref *kref) struct rxe_pool *pool = container_of(kref, struct rxe_pool, ref_cnt); pool->state =RXE_POOL_STATE_INVALID ; -kfree (pool->table); +kfree (pool->index.table); }static void rxe_pool_put (struct rxe_pool *pool)
@@ -183,27 +184,27 @@ void rxe_pool_cleanup(struct rxe_pool *pool)static u32 alloc_index (struct rxe_pool *pool) {u32 index; -u32 range = pool->max_index - pool->min_index +1 ; +u32 range = pool->index.max_index - pool->index.min_index +1 ; - index =find_next_zero_bit (pool->table, range, pool->last); + index =find_next_zero_bit (pool->index.table, range, pool->index.last);if (index >= range) - index =find_first_zero_bit (pool->table, range); + index =find_first_zero_bit (pool->index.table, range);WARN_ON_ONCE (index >= range); -set_bit (index, pool->table); - pool->last = index; -return index + pool->min_index; +set_bit (index, pool->index.table); + pool->index.last = index; +return index + pool->index.min_index; }static void insert_index (struct rxe_pool *pool,struct rxe_pool_entry *new) { -struct rb_node **link = &pool->tree.rb_node; +struct rb_node **link = &pool->index.tree.rb_node;struct rb_node *parent =NULL ;struct rxe_pool_entry *elem;while (*link) { parent = *link; - elem = rb_entry(parent, struct rxe_pool_entry, node); + elem = rb_entry(parent, struct rxe_pool_entry, index_node);if (elem->index == new->index) {pr_warn ("element already exists!\n" );
@@ -216,25 +217,25 @@ static void insert_index(struct rxe_pool *pool, struct rxe_pool_entry *new) link = &(*link)->rb_right; } -rb_link_node (&new->node, parent, link); -rb_insert_color (&new->node, &pool->tree); +rb_link_node (&new->index_node, parent, link); +rb_insert_color (&new->index_node, &pool->index.tree); out:return ; }static void insert_key (struct rxe_pool *pool,struct rxe_pool_entry *new) { -struct rb_node **link = &pool->tree.rb_node; +struct rb_node **link = &pool->key.tree.rb_node;struct rb_node *parent =NULL ;struct rxe_pool_entry *elem;int cmp;while (*link) { parent = *link; - elem = rb_entry(parent, struct rxe_pool_entry, node); + elem = rb_entry(parent, struct rxe_pool_entry, key_node); - cmp =memcmp ((u8 *)elem + pool->key_offset, - (u8 *)new + pool->key_offset, pool->key_size); + cmp =memcmp ((u8 *)elem + pool->key.key_offset, + (u8 *)new + pool->key.key_offset, pool->key.key_size);if (cmp ==0 ) {pr_warn ("key already exists!\n" );
@@ -247,8 +248,8 @@ static void insert_key(struct rxe_pool *pool, struct rxe_pool_entry *new) link = &(*link)->rb_right; } -rb_link_node (&new->node, parent, link); -rb_insert_color (&new->node, &pool->tree); +rb_link_node (&new->key_node, parent, link); +rb_insert_color (&new->key_node, &pool->key.tree); out:return ; }
@@ -260,7 +261,7 @@ void rxe_add_key(void *arg, void *key)unsigned long flags;write_lock_irqsave (&pool->pool_lock, flags); -memcpy ((u8 *)elem + pool->key_offset, key, pool->key_size); +memcpy ((u8 *)elem + pool->key.key_offset, key, pool->key.key_size);insert_key (pool, elem);write_unlock_irqrestore (&pool->pool_lock, flags); }
@@ -272,7 +273,7 @@ void rxe_drop_key(void *arg)unsigned long flags;write_lock_irqsave (&pool->pool_lock, flags); -rb_erase (&elem->node, &pool->tree); +rb_erase (&elem->key_node, &pool->key.tree);write_unlock_irqrestore (&pool->pool_lock, flags); }
@@ -295,8 +296,8 @@ void rxe_drop_index(void *arg)unsigned long flags;write_lock_irqsave (&pool->pool_lock, flags); -clear_bit (elem->index - pool->min_index, pool->table); -rb_erase (&elem->node, &pool->tree); +clear_bit (elem->index - pool->index.min_index, pool->index.table); +rb_erase (&elem->index_node, &pool->index.tree);write_unlock_irqrestore (&pool->pool_lock, flags); }
@@ -400,10 +401,10 @@ void *rxe_pool_get_index(struct rxe_pool *pool, u32 index)if (pool->state !=RXE_POOL_STATE_VALID ) goto out; - node = pool->tree.rb_node; + node = pool->index.tree.rb_node;while (node) { - elem = rb_entry(node, struct rxe_pool_entry, node); + elem = rb_entry(node, struct rxe_pool_entry, index_node);if (elem->index > index) node = node->rb_left;
@@ -432,13 +433,13 @@ void *rxe_pool_get_key(struct rxe_pool *pool, void *key)if (pool->state !=RXE_POOL_STATE_VALID ) goto out; - node = pool->tree.rb_node; + node = pool->key.tree.rb_node;while (node) { - elem = rb_entry(node, struct rxe_pool_entry, node); + elem = rb_entry(node, struct rxe_pool_entry, key_node); - cmp =memcmp ((u8 *)elem + pool->key_offset, - key, pool->key_size); + cmp =memcmp ((u8 *)elem + pool->key.key_offset, + key, pool->key.key_size);if (cmp >0 ) node = node->rb_left;
drivers/infiniband/sw/rxe/rxe_pool.h +21 -11
@@ -56,8 +56,11 @@ struct rxe_pool_entry {struct kref ref_cnt;struct list_head list; -/* only used if indexed or keyed */ -struct rb_node node; +/* only used if keyed */ +struct rb_node key_node; + +/* only used if indexed */ +struct rb_node index_node;u32 index; };
@@ -74,15 +77,22 @@ struct rxe_pool {unsigned int max_elem;atomic_t num_elem; -/* only used if indexed or keyed */ -struct rb_root tree; -unsigned long *table; -size_t table_size; -u32 max_index; -u32 min_index; -u32 last; -size_t key_offset; -size_t key_size; +/* only used if indexed */ +struct { +struct rb_root tree; +unsigned long *table; +size_t table_size; +u32 last; +u32 max_index; +u32 min_index; + } index; + +/* only used if keyed */ +struct { +struct rb_root tree; +size_t key_offset; +size_t key_size; + } key; };/* initialize a pool of objects with given limit on
Signature · 1 line
2.25.1
PATCH v5 4/12 rdma_rxe: Add alloc_mw and dealloc_mw verbs
In reply to Bob Pearson - Add a new file focused on memory windows, rxe_mw.c.
- Add alloc_mw and dealloc_mw verbs and added them to the list of supported user space verbs.
--- drivers/infiniband/sw/rxe/Makefile | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 8 +++ drivers/infiniband/sw/rxe/rxe_mr.c | 77 ++++++++++----------- drivers/infiniband/sw/rxe/rxe_mw.c | 98 +++++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_pool.c | 33 +++++---- drivers/infiniband/sw/rxe/rxe_pool.h | 2 +- drivers/infiniband/sw/rxe/rxe_req.c | 24 +++---- drivers/infiniband/sw/rxe/rxe_resp.c | 4 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 52 +++++++++----- drivers/infiniband/sw/rxe/rxe_verbs.h | 8 +++ include/uapi/rdma/rdma_user_rxe.h | 10 +++ 11 files changed, 232 insertions(+), 85 deletions(-) create mode 100644 drivers/infiniband/sw/rxe/rxe_mw.c
drivers/infiniband/sw/rxe/Makefile +1 -0
@@ -15,6 +15,7 @@ rdma_rxe-y := \ rxe_qp.o \ rxe_cq.o \ rxe_mr.o \ + rxe_mw.o \ rxe_opcode.o \ rxe_mmap.o \ rxe_icrc.o \
drivers/infiniband/sw/rxe/rxe_loc.h +8 -0
@@ -109,6 +109,14 @@ void rxe_mr_cleanup(struct rxe_pool_entry *arg);int advance_dma_data (struct rxe_dma_info *dma,unsigned int length); +/* rxe_mw.c */ +struct ib_mw *rxe_alloc_mw (struct ib_pd *ibpd,enum ib_mw_type type, +struct ib_udata *udata); + +int rxe_dealloc_mw (struct ib_mw *ibmw); + +void rxe_mw_cleanup (struct rxe_pool_entry *arg); +/* rxe_net.c */ void rxe_loopback (struct sk_buff *skb);int rxe_send (struct rxe_pkt_info *pkt,struct sk_buff *skb);
drivers/infiniband/sw/rxe/rxe_mr.c +37 -40
106 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_mw.c new file +98 -0
98 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_pool.c +21 -12
@@ -7,13 +7,12 @@#include "rxe.h" #include "rxe_loc.h" -/* info about object pools -*/ +/* info about object pools */ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES ] = { [RXE_TYPE_UC ] = { .name ="rxe-uc" , .size =sizeof (struct rxe_ucontext ), - .flags =RXE_POOL_NO_ALLOC , + .flags =RXE_POOL_NO_ALLOC , }, [RXE_TYPE_PD ] = { .name ="rxe-pd" ,
@@ -43,23 +42,30 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = { [RXE_TYPE_CQ] = { .name = "rxe-cq", .size = sizeof(struct rxe_cq), - .flags = RXE_POOL_NO_ALLOC, + .flags = RXE_POOL_NO_ALLOC, .cleanup = rxe_cq_cleanup, }, [RXE_TYPE_MR] = { .name = "rxe-mr", .size = sizeof(struct rxe_mr), .cleanup = rxe_mr_cleanup, - .flags = RXE_POOL_INDEX, + .flags =RXE_POOL_INDEX + | RXE_POOL_KEY, .max_index = RXE_MAX_MR_INDEX, .min_index = RXE_MIN_MR_INDEX, + .key_offset = offsetof(struct rxe_mr, ibmr.lkey), + .key_size = sizeof(u32), }, [RXE_TYPE_MW] = { .name = "rxe-mw", .size = sizeof(struct rxe_mw), - .flags = RXE_POOL_INDEX, + .cleanup = rxe_mw_cleanup, + .flags =RXE_POOL_INDEX + | RXE_POOL_KEY, .max_index = RXE_MAX_MW_INDEX, .min_index = RXE_MIN_MW_INDEX, + .key_offset = offsetof(struct rxe_mw, ibmw.rkey), + .key_size = sizeof(u32), }, [RXE_TYPE_MC_GRP] = { .name = "rxe-mc_grp",
@@ -223,7 +229,7 @@ static void insert_index(struct rxe_pool *pool, struct rxe_pool_entry *new)return ; } -static void insert_key (struct rxe_pool *pool,struct rxe_pool_entry *new) +static int insert_key (struct rxe_pool *pool,struct rxe_pool_entry *new) {struct rb_node **link = &pool->key.tree.rb_node;struct rb_node *parent =NULL ;
@@ -239,7 +245,7 @@ static void insert_key(struct rxe_pool *pool, struct rxe_pool_entry *new)if (cmp ==0 ) {pr_warn ("key already exists!\n" ); - goto out; +return -EAGAIN ; }if (cmp >0 )
@@ -250,20 +256,23 @@ static void insert_key(struct rxe_pool *pool, struct rxe_pool_entry *new)rb_link_node (&new->key_node, parent, link);rb_insert_color (&new->key_node, &pool->key.tree); -out: -return ; + +return 0 ; } -void rxe_add_key (void *arg,void *key) +int rxe_add_key (void *arg,void *key) { +int ret;struct rxe_pool_entry *elem = arg;struct rxe_pool *pool = elem->pool;unsigned long flags;write_lock_irqsave (&pool->pool_lock, flags);memcpy ((u8 *)elem + pool->key.key_offset, key, pool->key.key_size); -insert_key (pool, elem); + ret =insert_key (pool, elem);write_unlock_irqrestore (&pool->pool_lock, flags); + +return ret; }void rxe_drop_key (void *arg)
drivers/infiniband/sw/rxe/rxe_pool.h +1 -1
@@ -122,7 +122,7 @@ void rxe_drop_index(void *elem);/* assign a key to a keyed object and insert object into * pool's rb tree */ -void rxe_add_key (void *elem,void *key); +int rxe_add_key (void *elem,void *key);/* remove elem from rb tree */ void rxe_drop_key (void *elem);
drivers/infiniband/sw/rxe/rxe_req.c +12 -12
@@ -597,29 +597,29 @@ int rxe_requester(void *arg)if (wqe->mask &WR_REG_MASK ) {if (wqe->wr.opcode ==IB_WR_LOCAL_INV ) {struct rxe_dev *rxe =to_rdev (qp->ibqp.device); -struct rxe_mr *rmr; +struct rxe_mr *mr; - rmr =rxe_pool_get_index (&rxe->mr_pool, - wqe->wr.ex.invalidate_rkey >>8 ); -if (!rmr) { + mr =rxe_pool_get_key (&rxe->mr_pool, + &wqe->wr.ex.invalidate_rkey); +if (!mr) {pr_err ("No mr for key %#x\n" , wqe->wr.ex.invalidate_rkey); wqe->state = wqe_state_error; wqe->status =IB_WC_MW_BIND_ERR ; goto exit; } - rmr->state =RXE_MEM_STATE_FREE ; -rxe_drop_ref (rmr); + mr->state =RXE_MEM_STATE_FREE ; +rxe_drop_ref (mr); wqe->state = wqe_state_done; wqe->status =IB_WC_SUCCESS ; }else if (wqe->wr.opcode ==IB_WR_REG_MR ) { -struct rxe_mr *rmr =to_rmr (wqe->wr.wr.reg.mr); +struct rxe_mr *mr =to_rmr (wqe->wr.wr.reg.mr); - rmr->state =RXE_MEM_STATE_VALID ; - rmr->access = wqe->wr.wr.reg.access; - rmr->lkey = wqe->wr.wr.reg.key; - rmr->rkey = wqe->wr.wr.reg.key; - rmr->iova = wqe->wr.wr.reg.mr->iova; + mr->state =RXE_MEM_STATE_VALID ; + mr->access = wqe->wr.wr.reg.access; + mr->lkey = wqe->wr.wr.reg.key; + mr->rkey = wqe->wr.wr.reg.key; + mr->iova = wqe->wr.wr.reg.mr->iova; wqe->state = wqe_state_done; wqe->status =IB_WC_SUCCESS ; }else {
drivers/infiniband/sw/rxe/rxe_resp.c +2 -2
@@ -888,8 +888,8 @@ static enum resp_states do_complete(struct rxe_qp *qp, wc->wc_flags |=IB_WC_WITH_INVALIDATE ; wc->ex.invalidate_rkey =ieth_rkey (pkt); - rmr =rxe_pool_get_index (&rxe->mr_pool, - wc->ex.invalidate_rkey >>8 ); + rmr =rxe_pool_get_key (&rxe->mr_pool, + &wc->ex.invalidate_rkey);if (unlikely (!rmr)) {pr_err ("Bad rkey %#x invalidation\n" , wc->ex.invalidate_rkey);
drivers/infiniband/sw/rxe/rxe_verbs.c +34 -18
119 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_verbs.h +8 -0
@@ -319,6 +319,9 @@ struct rxe_mr {struct rxe_map **map; }; +/* use high order bit to separate MW and MR rkeys */ +#define IS_MW (1 << 31) +struct rxe_mw {struct rxe_pool_entry pelem;struct ib_mw ibmw;
@@ -441,6 +444,11 @@ static inline struct rxe_mr *to_rmr(struct ib_mr *mr) return mr ? container_of(mr, struct rxe_mr, ibmr) : NULL; } +static inline struct rxe_mw *to_rmw (struct ib_mw *mw) +{ + return mw ? container_of(mw, struct rxe_mw, ibmw) : NULL; +} +int rxe_register_device (struct rxe_dev *rxe,const char *ibdev_name);void rxe_mc_cleanup (struct rxe_pool_entry *arg);
include/uapi/rdma/rdma_user_rxe.h +10 -0
@@ -175,4 +175,14 @@ struct rxe_modify_srq_cmd { __aligned_u64 mmap_info_addr; }; +struct rxe_reg_mr_resp { +__u32 index; +__u32 reserved; +}; + +struct rxe_alloc_mw_resp { +__u32 index; +__u32 reserved; +}; +#endif /* RDMA_USER_RXE_H */
Signature · 1 line
2.25.1
PATCH v5 5/12 rdma_rxe: Add bind_mw and invalidate_mw verbs
In reply to Bob Pearson - Add code to implement ibv_bind_mw (for type 1 MWs) and post send queue bind_mw (for type 2 MWs).
- Add code to implement local (post send) and remote (send with invalidate) invalidate operations.
- Add rules checking for MW operations from IBA.
--- drivers/infiniband/sw/rxe/rxe_comp.c | 1 + drivers/infiniband/sw/rxe/rxe_loc.h | 2 + drivers/infiniband/sw/rxe/rxe_mr.c | 3 +- drivers/infiniband/sw/rxe/rxe_mw.c | 289 ++++++++++++++++++++++++- drivers/infiniband/sw/rxe/rxe_opcode.c | 11 +- drivers/infiniband/sw/rxe/rxe_opcode.h | 1 - drivers/infiniband/sw/rxe/rxe_req.c | 81 +++++-- drivers/infiniband/sw/rxe/rxe_verbs.c | 2 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 7 + include/uapi/rdma/rdma_user_rxe.h | 34 ++- 10 files changed, 399 insertions(+), 32 deletions(-)
drivers/infiniband/sw/rxe/rxe_comp.c +1 -0
@@ -103,6 +103,7 @@ static enum ib_wc_opcode wr_to_wc_opcode(enum ib_wr_opcode opcode)case IB_WR_RDMA_READ_WITH_INV :return IB_WC_RDMA_READ ;case IB_WR_LOCAL_INV :return IB_WC_LOCAL_INV ;case IB_WR_REG_MR :return IB_WC_REG_MR ; +case IB_WR_BIND_MW :return IB_WC_BIND_MW ;default :return 0xff ;
drivers/infiniband/sw/rxe/rxe_loc.h +2 -0
@@ -117,6 +117,8 @@ int rxe_dealloc_mw(struct ib_mw *ibmw);void rxe_mw_cleanup (struct rxe_pool_entry *arg); +int rxe_bind_mw (struct rxe_qp *qp,struct rxe_send_wqe *wqe); +/* rxe_net.c */ void rxe_loopback (struct sk_buff *skb);int rxe_send (struct rxe_pkt_info *pkt,struct sk_buff *skb);
drivers/infiniband/sw/rxe/rxe_mr.c +2 -1
@@ -543,7 +543,8 @@ void rxe_mr_cleanup(struct rxe_pool_entry *arg)struct rxe_mr *mr =container_of (arg,typeof (*mr), pelem);int i; -ib_umem_release (mr->umem); +if (mr->umem) +ib_umem_release (mr->umem);if (mr->map) {for (i =0 ; i < mr->num_map; i++)
drivers/infiniband/sw/rxe/rxe_mw.c +282 -7
321 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_opcode.c +9 -2
@@ -87,13 +87,20 @@ struct rxe_wr_opcode_info rxe_wr_opcode_info[] = { [IB_WR_LOCAL_INV ] = { .name ="IB_WR_LOCAL_INV" , .mask = { - [IB_QPT_RC ] =WR_REG_MASK , + [IB_QPT_RC ] =WR_LOCAL_MASK , }, }, [IB_WR_REG_MR ] = { .name ="IB_WR_REG_MR" , .mask = { - [IB_QPT_RC ] =WR_REG_MASK , + [IB_QPT_RC ] =WR_LOCAL_MASK , + }, + }, + [IB_WR_BIND_MW ] = { + .name ="IB_WR_BIND_MW" , + .mask = { + [IB_QPT_RC ] =WR_LOCAL_MASK , + [IB_QPT_UC ] =WR_LOCAL_MASK , }, }, };
drivers/infiniband/sw/rxe/rxe_opcode.h +0 -1
@@ -20,7 +20,6 @@ enum rxe_wr_mask {WR_READ_MASK =BIT (3 ),WR_WRITE_MASK =BIT (4 ),WR_LOCAL_MASK =BIT (5 ), -WR_REG_MASK =BIT (6 ),WR_READ_OR_WRITE_MASK =WR_READ_MASK |WR_WRITE_MASK , WR_READ_WRITE_OR_SEND_MASK = WR_READ_OR_WRITE_MASK | WR_SEND_MASK,
drivers/infiniband/sw/rxe/rxe_req.c +62 -19
160 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_verbs.c +1 -1
@@ -577,7 +577,7 @@ static int init_send_wqe(struct rxe_qp *qp, const struct ib_send_wr *ibwr, p += sge->length; } - }else if (mask &WR_REG_MASK ) { + }else if (mask &WR_LOCAL_MASK ) { wqe->mask = mask; wqe->state = wqe_state_posted;return 0 ;
drivers/infiniband/sw/rxe/rxe_verbs.h +7 -0
@@ -316,9 +316,16 @@ struct rxe_mr {u32 max_buf;u32 num_map; +atomic_t num_mw; +struct rxe_map **map; }; +enum rxe_send_flags { +/* flag indicaes bind call came through verbs API */ +RXE_BIND_MW = (1 <<0 ), +}; +/* use high order bit to separate MW and MR rkeys */ #define IS_MW (1 << 31)
include/uapi/rdma/rdma_user_rxe.h +33 -1
@@ -93,7 +93,39 @@ struct rxe_send_wr {__u32 remote_qkey;__u16 pkey_index; } ud; -/* reg is only used by the kernel and is not part of the uapi */ +struct { +__aligned_u64 addr; +__aligned_u64 length; +union { +__u32 mr_index; +__aligned_u64 reserved1; + }; +union { +__u32 mw_index; +__aligned_u64 reserved2; + }; +__u32 rkey; +__u32 access; +__u32 flags; + } umw; +/* The following are only used by the kernel +* and are not part of the uapi +*/ +struct { +__aligned_u64 addr; +__aligned_u64 length; +union { +struct ib_mr *mr; +__aligned_u64 reserved1; + }; +union { +struct ib_mw *mw; +__aligned_u64 reserved2; + }; +__u32 rkey; +__u32 access; +__u32 flags; + } kmw; struct { union { struct ib_mr *mr;
Signature · 1 line
2.25.1
PATCH v5 6/12 rdma_rxe: Add memory access through MWs
In reply to Bob PearsonImplement memory access through MWs.
Add rules checks from IBA.
--- drivers/infiniband/sw/rxe/rxe_loc.h | 17 +++--- drivers/infiniband/sw/rxe/rxe_mr.c | 74 ++++++++++++++++-------- drivers/infiniband/sw/rxe/rxe_mw.c | 57 +++++++++++++++--- drivers/infiniband/sw/rxe/rxe_req.c | 16 ++---- drivers/infiniband/sw/rxe/rxe_resp.c | 83 ++++++++++++++++++++------- drivers/infiniband/sw/rxe/rxe_verbs.h | 1 + 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/infiniband/sw/rxe/rxe_loc.h +10 -7
@@ -100,25 +100,28 @@ enum lookup_type { lookup_remote, }; -struct rxe_mr *lookup_mr (struct rxe_pd *pd,int access,u32 key, -enum lookup_type type); +int advance_dma_data (struct rxe_dma_info *dma,unsigned int length); -int mr_check_range (struct rxe_mr *mr,u64 iova,size_t length); +int rxe_mr_check_access (struct rxe_qp *qp,struct rxe_mr *mr, +int access,u64 va,u32 resid);void rxe_mr_cleanup (struct rxe_pool_entry *arg); -int advance_dma_data (struct rxe_dma_info *dma,unsigned int length); -/* rxe_mw.c */ struct ib_mw *rxe_alloc_mw (struct ib_pd *ibpd,enum ib_mw_type type,struct ib_udata *udata);int rxe_dealloc_mw (struct ib_mw *ibmw); -void rxe_mw_cleanup (struct rxe_pool_entry *arg); -int rxe_bind_mw (struct rxe_qp *qp,struct rxe_send_wqe *wqe); +int rxe_invalidate_mw (struct rxe_qp *qp,struct rxe_mw *mw); + +int rxe_mw_check_access (struct rxe_qp *qp,struct rxe_mw *mw, +int access,u64 va,u32 resid); + +void rxe_mw_cleanup (struct rxe_pool_entry *arg); +/* rxe_net.c */ void rxe_loopback (struct sk_buff *skb);int rxe_send (struct rxe_pkt_info *pkt,struct sk_buff *skb);
drivers/infiniband/sw/rxe/rxe_mr.c +49 -25
109 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_mw.c +49 -8
75 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_req.c +5 -11
@@ -604,7 +604,6 @@ int rxe_requester(void *arg)if (!mr) {pr_err ("No mr for key %#x\n" , wqe->wr.ex.invalidate_rkey); - wqe->state = wqe_state_error; wqe->status =IB_WC_MW_BIND_ERR ; goto err; }
@@ -626,7 +625,6 @@ int rxe_requester(void *arg)case IB_WR_BIND_MW : ret =rxe_bind_mw (qp, wqe);if (ret) { - wqe->state = wqe_state_done; wqe->status =IB_WC_MW_BIND_ERR ; goto err; }
@@ -636,6 +634,7 @@ int rxe_requester(void *arg)default :pr_err_once ("unexpected LOCAL WR opcode = %d\n" , wqe->wr.opcode); + wqe->status =IB_WC_LOC_QP_OP_ERR ; goto err; }
@@ -679,13 +678,7 @@ int rxe_requester(void *arg) payload = (mask &RXE_WRITE_OR_SEND ) ? wqe->dma.resid :0 ;if (payload > mtu) {if (qp_type (qp) ==IB_QPT_UD ) { -/* C10-93.1.1: If the total sum of all the buffer lengths specified for a -* UD message exceeds the MTU of the port as returned by QueryHCA, the CI -* shall not emit any packets for this message. Further, the CI shall not -* generate an error due to this condition. -*/ - -/* fake a successful UD send */ +/* C10-93.1.1: fake a successful UD send */ wqe->first_psn = qp->req.psn; wqe->last_psn = qp->req.psn; qp->req.psn = (qp->req.psn +1 ) &BTH_PSN_MASK ;
@@ -750,6 +743,8 @@ int rxe_requester(void *arg)* to be called again */ wqe->state = wqe_state_error; + qp->req.wqe_index =next_index (qp->sq.queue, + qp->req.wqe_index);__rxe_do_task (&qp->comp.task); ret = -EAGAIN ; goto done;
@@ -765,8 +760,7 @@ int rxe_requester(void *arg) again:/* we come here if we are done with the current wqe but want to -* get called again. Mostly we loop back to next wqe so should -* be all one way or the other +* get called again. */ ret =0 ; goto done;
drivers/infiniband/sw/rxe/rxe_resp.c +62 -21
157 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_verbs.h +1 -0
@@ -183,6 +183,7 @@ struct rxe_resp_info {/* RDMA read / atomic only */ u64 va; +u64 offset;struct rxe_mr *mr;u32 resid;u32 rkey;
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH for-next v5 06/12] rdma_rxe: Add memory access through MWs
Thank you for the patch! Perhaps something to improve:
Hi Bob,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on rdma/for-next]
[also build test WARNING on v5.9-rc5 next-20200918]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Bob-Pearson/rdma_rxe-API-extensions/20200919-051909 base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next config: riscv-randconfig-r031-20200917 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ed79827aea444e6995fb3d36abc2bfd36331773c)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:556:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inb(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:54:76: note: expanded from macro 'inb'
#define inb(c) ({ u8 __v; __io_pbr(); __v = readb_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:87:48: note: expanded from macro 'readb_cpu'
#define readb_cpu(c) ({ u8 __r = __raw_readb(c); __r; })
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:564:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inw(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:55:76: note: expanded from macro 'inw'
#define inw(c) ({ u16 __v; __io_pbr(); __v = readw_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:88:76: note: expanded from macro 'readw_cpu'
#define readw_cpu(c) ({ u16 __r = le16_to_cpu((__force __le16)__raw_readw(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:572:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inl(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:56:76: note: expanded from macro 'inl'
#define inl(c) ({ u32 __v; __io_pbr(); __v = readl_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:89:76: note: expanded from macro 'readl_cpu'
#define readl_cpu(c) ({ u32 __r = le32_to_cpu((__force __le32)__raw_readl(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:580:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
outb(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:58:68: note: expanded from macro 'outb'
#define outb(v,c) ({ __io_pbw(); writeb_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:91:52: note: expanded from macro 'writeb_cpu'
#define writeb_cpu(v, c) ((void)__raw_writeb((v), (c)))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:588:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
outw(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:59:68: note: expanded from macro 'outw'
#define outw(v,c) ({ __io_pbw(); writew_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:92:76: note: expanded from macro 'writew_cpu'
#define writew_cpu(v, c) ((void)__raw_writew((__force u16)cpu_to_le16(v), (c)))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:596:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
outl(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:60:68: note: expanded from macro 'outl'
#define outl(v,c) ({ __io_pbw(); writel_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:93:76: note: expanded from macro 'writel_cpu'
#define writel_cpu(v, c) ((void)__raw_writel((__force u32)cpu_to_le32(v), (c)))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:1017:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^
>> drivers/infiniband/sw/rxe/rxe_mr.c:531:5: warning: no previous prototype for function 'rxe_invalidate_mr' [-Wmissing-prototypes]
int rxe_invalidate_mr(struct rxe_qp *qp, struct rxe_mr *mr)
^ drivers/infiniband/sw/rxe/rxe_mr.c:531:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int rxe_invalidate_mr(struct rxe_qp *qp, struct rxe_mr *mr)
^
static
8 warnings generated.
# https://github.com/0day-ci/linux/commit/ea6524464bcccdce769f9a046224290a51dee110
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bob-Pearson/rdma_rxe-API-extensions/20200919-051909 git checkout ea6524464bcccdce769f9a046224290a51dee110
vim +/rxe_invalidate_mr +531 drivers/infiniband/sw/rxe/rxe_mr.c
530
> 531 int rxe_invalidate_mr(struct rxe_qp *qp, struct rxe_mr *mr)
532 {
533 mr->state = RXE_MEM_STATE_FREE;
534 return 0;
535 }
536
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH v5 7/12 rdma_rxe: Add support for ibv_query_device_ex
In reply to Bob PearsonAdd code to initialize new struct members inib_device_attr as place holders.
--- drivers/infiniband/sw/rxe/rxe.c | 101 ++++++++++++++++++-------- drivers/infiniband/sw/rxe/rxe_verbs.c | 7 +- 2 files changed, 75 insertions(+), 33 deletions(-)
drivers/infiniband/sw/rxe/rxe.c +69 -32
@@ -38,40 +38,77 @@ void rxe_dealloc(struct ib_device *ib_dev)/* initialize rxe device parameters */ static void rxe_init_device_param (struct rxe_dev *rxe) { - rxe->max_inline_data =RXE_MAX_INLINE_DATA ; - - rxe->attr.vendor_id =RXE_VENDOR_ID ; - rxe->attr.max_mr_size =RXE_MAX_MR_SIZE ; - rxe->attr.page_size_cap =RXE_PAGE_SIZE_CAP ; - rxe->attr.max_qp =RXE_MAX_QP ; - rxe->attr.max_qp_wr =RXE_MAX_QP_WR ; - rxe->attr.device_cap_flags =RXE_DEVICE_CAP_FLAGS ; - rxe->attr.max_send_sge =RXE_MAX_SGE ; - rxe->attr.max_recv_sge =RXE_MAX_SGE ; - rxe->attr.max_sge_rd =RXE_MAX_SGE_RD ; - rxe->attr.max_cq =RXE_MAX_CQ ; - rxe->attr.max_cqe = (1 <<RXE_MAX_LOG_CQE ) -1 ; - rxe->attr.max_mr =RXE_MAX_MR ; - rxe->attr.max_mw =RXE_MAX_MW ; - rxe->attr.max_pd =RXE_MAX_PD ; - rxe->attr.max_qp_rd_atom =RXE_MAX_QP_RD_ATOM ; - rxe->attr.max_res_rd_atom =RXE_MAX_RES_RD_ATOM ; - rxe->attr.max_qp_init_rd_atom =RXE_MAX_QP_INIT_RD_ATOM ; - rxe->attr.atomic_cap =IB_ATOMIC_HCA ; - rxe->attr.max_mcast_grp =RXE_MAX_MCAST_GRP ; - rxe->attr.max_mcast_qp_attach =RXE_MAX_MCAST_QP_ATTACH ; - rxe->attr.max_total_mcast_qp_attach =RXE_MAX_TOT_MCAST_QP_ATTACH ; - rxe->attr.max_ah =RXE_MAX_AH ; - rxe->attr.max_srq =RXE_MAX_SRQ ; - rxe->attr.max_srq_wr =RXE_MAX_SRQ_WR ; - rxe->attr.max_srq_sge =RXE_MAX_SRQ_SGE ; - rxe->attr.max_fast_reg_page_list_len =RXE_MAX_FMR_PAGE_LIST_LEN ; - rxe->attr.max_pkeys =RXE_MAX_PKEYS ; - rxe->attr.local_ca_ack_delay =RXE_LOCAL_CA_ACK_DELAY ; -addrconf_addr_eui48 ((unsigned char *)&rxe->attr.sys_image_guid, - rxe->ndev->dev_addr); +struct ib_device_attr *a = &rxe->attr; + rxe->max_inline_data =RXE_MAX_INLINE_DATA ; rxe->max_ucontext =RXE_MAX_UCONTEXT ; + + a->atomic_cap =IB_ATOMIC_HCA ; + a->cq_caps.max_cq_moderation_count =0 ; + a->cq_caps.max_cq_moderation_period =0 ; + a->device_cap_flags =RXE_DEVICE_CAP_FLAGS ; + a->fw_ver =0 ; + a->hca_core_clock =0 ; + a->hw_ver =0 ; + a->local_ca_ack_delay =RXE_LOCAL_CA_ACK_DELAY ; + a->masked_atomic_cap =0 ; + a->max_ah =RXE_MAX_AH ; + a->max_cqe = (1 <<RXE_MAX_LOG_CQE ) -1 ; + a->max_cq =RXE_MAX_CQ ; + a->max_dm_size =0 ; + a->max_ee_init_rd_atom =0 ; + a->max_ee =0 ; + a->max_ee_rd_atom =0 ; + a->max_fast_reg_page_list_len =RXE_MAX_FMR_PAGE_LIST_LEN ; + a->max_mcast_grp =RXE_MAX_MCAST_GRP ; + a->max_mcast_qp_attach =RXE_MAX_MCAST_QP_ATTACH ; + a->max_mr =RXE_MAX_MR ; + a->max_mr_size =RXE_MAX_MR_SIZE ; + a->max_mw =RXE_MAX_MW ; + a->max_pd =RXE_MAX_PD ; + a->max_pi_fast_reg_page_list_len =0 ; + a->max_pkeys =RXE_MAX_PKEYS ; + a->max_qp_init_rd_atom =RXE_MAX_QP_INIT_RD_ATOM ; + a->max_qp_rd_atom =RXE_MAX_QP_RD_ATOM ; + a->max_qp =RXE_MAX_QP ; + a->max_qp_wr =RXE_MAX_QP_WR ; + a->max_raw_ethy_qp =0 ; + a->max_raw_ipv6_qp =0 ; + a->max_rdd =0 ; + a->max_recv_sge =RXE_MAX_SGE ; + a->max_res_rd_atom =RXE_MAX_RES_RD_ATOM ; + a->max_send_sge =RXE_MAX_SGE ; + a->max_sge_rd =RXE_MAX_SGE_RD ; + a->max_sgl_rd =0 ; + a->max_srq =RXE_MAX_SRQ ; + a->max_srq_sge =RXE_MAX_SRQ_SGE ; + a->max_srq_wr =RXE_MAX_SRQ_WR ; + a->max_total_mcast_qp_attach =RXE_MAX_TOT_MCAST_QP_ATTACH ; + a->max_wq_type_rq =0 ; + a->odp_caps.general_caps =0 ; + a->odp_caps.per_transport_caps.rc_odp_caps =0 ; + a->odp_caps.per_transport_caps.uc_odp_caps =0 ; + a->odp_caps.per_transport_caps.ud_odp_caps =0 ; + a->odp_caps.per_transport_caps.xrc_odp_caps =0 ; + a->page_size_cap =RXE_PAGE_SIZE_CAP ; + a->raw_packet_caps =0 ; + a->rss_caps.supported_qpts =0 ; + a->rss_caps.max_rwq_indirection_tables =0 ; + a->rss_caps.max_rwq_indirection_table_size =0 ; + a->sig_guard_cap =0 ; + a->sig_prot_cap =0 ; + a->sys_image_guid =0 ; + a->timestamp_mask =0 ; + a->tm_caps.max_rndv_hdr_size =0 ; + a->tm_caps.max_num_tags =0 ; + a->tm_caps.flags =0 ; + a->tm_caps.max_ops =0 ; + a->tm_caps.max_sge =0 ; + a->vendor_id =RXE_VENDOR_ID ; + a->vendor_part_id =0 ; + +addrconf_addr_eui48 ((unsigned char *)&a->sys_image_guid, + rxe->ndev->dev_addr); }/* initialize port attributes */
drivers/infiniband/sw/rxe/rxe_verbs.c +6 -1
@@ -1149,7 +1149,8 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)dma_coerce_mask_and_coherent (&dev->dev,dma_get_required_mask (&dev->dev)); - dev->uverbs_cmd_mask =BIT_ULL (IB_USER_VERBS_CMD_GET_CONTEXT ) + dev->uverbs_cmd_mask = +BIT_ULL (IB_USER_VERBS_CMD_GET_CONTEXT ) |BIT_ULL (IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL ) |BIT_ULL (IB_USER_VERBS_CMD_QUERY_DEVICE ) |BIT_ULL (IB_USER_VERBS_CMD_QUERY_PORT )
@@ -1184,6 +1185,10 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) | BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_MW) ; + dev->uverbs_ex_cmd_mask = +BIT_ULL (IB_USER_VERBS_EX_CMD_QUERY_DEVICE ) + ; +ib_set_device_ops (dev, &rxe_dev_ops); err =ib_device_set_netdev (&rxe->ib_dev, rxe->ndev,1 );if (err)
Signature · 1 line
2.25.1
Jason Gunthorpe
maintainerRe: [PATCH for-next v5 07/12] rdma_rxe: Add support for ibv_query_device_ex
Quoted 12 lines · Bob Pearson
Add code to initialize new struct members in
ib_device_attras place holders.Signed-off-by Bob Pearson <[email protected]>drivers/infiniband/sw/rxe/rxe.c | 101 ++++++++++++++++++-------- drivers/infiniband/sw/rxe/rxe_verbs.c | 7 +- 2 files changed, 75 insertions(+), 33 deletions(-)drivers/infiniband/sw/rxe/rxe.c +1
-0+++ b/drivers/infiniband/sw/rxe/rxe.c
drivers/infiniband/sw/rxe/rxe.c void rxe_dealloc(struct ib_device *ib_dev) · line 41
Quoted 4 lines
drivers/infiniband/sw/rxe/rxe.c +0
-1@@ -38,40 +38,77 @@ void rxe_dealloc(struct ib_device *ib_dev)/* initialize rxe device parameters */ static void rxe_init_device_param (struct rxe_dev *rxe) { - rxe->max_inline_data =RXE_MAX_INLINE_DATA ;
What actually changed here? Isn't dev_attr zero initialized?
Quoted 15 lines
drivers/infiniband/sw/rxe/rxe.c +0
-0/* initialize port attributes */ drivers/infiniband/sw/rxe/rxe_verbs.c +3
-1+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c@@ -1149,7 +1149,8 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)dma_coerce_mask_and_coherent (&dev->dev,dma_get_required_mask (&dev->dev)); - dev->uverbs_cmd_mask =BIT_ULL (IB_USER_VERBS_CMD_GET_CONTEXT ) + dev->uverbs_cmd_mask = +BIT_ULL (IB_USER_VERBS_CMD_GET_CONTEXT ) |BIT_ULL (IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL ) |BIT_ULL (IB_USER_VERBS_CMD_QUERY_DEVICE ) |BIT_ULL (IB_USER_VERBS_CMD_QUERY_PORT )
drivers/infiniband/sw/rxe/rxe_verbs.c int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) · line 1190
Quoted 6 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +3
-0@@ -1184,6 +1185,10 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) | BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_MW) ; + dev->uverbs_ex_cmd_mask = +BIT_ULL (IB_USER_VERBS_EX_CMD_QUERY_DEVICE ) + ;
Hurm, I don't even know why we have this bit, did you see a reason?
Jason
PATCH v5 8/12 rdma_rxe: Add support for extended CQ operations
In reply to Bob PearsonAdd private members to user/kernel wc struct to carry extensions used by cq_ex.
Add timestamps on completion.
Add ignore overrun support.
Add commands to user API bitmasks.
--- drivers/infiniband/sw/rxe/rxe_comp.c | 7 ++++- drivers/infiniband/sw/rxe/rxe_resp.c | 20 +++++++++----- drivers/infiniband/sw/rxe/rxe_verbs.c | 10 ++++--- drivers/infiniband/sw/rxe/rxe_verbs.h | 3 ++- include/uapi/rdma/rdma_user_rxe.h | 38 ++++++++++++++++++++++----- 5 files changed, 58 insertions(+), 20 deletions(-)
drivers/infiniband/sw/rxe/rxe_comp.c +6 -1
@@ -390,7 +390,7 @@ static void make_send_cqe(struct rxe_qp *qp, struct rxe_send_wqe *wqe, wc->byte_len = wqe->dma.length; wc->qp = &qp->ibqp; }else { -struct ib_uverbs_wc *uwc = &cqe->uibwc; +struct rxe_uverbs_wc *uwc = &cqe->ruwc; uwc->wr_id = wqe->wr.wr_id; uwc->status = wqe->status;
@@ -400,6 +400,11 @@ static void make_send_cqe(struct rxe_qp *qp, struct rxe_send_wqe *wqe, uwc->wc_flags =IB_WC_WITH_IMM ; uwc->byte_len = wqe->dma.length; uwc->qp_num = qp->ibqp.qp_num; +if (qp->scq->flags & +IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION ) { + uwc->timestamp = (u64 )ktime_get (); + uwc->realtime = (u64 )ktime_get_real (); + } } }
drivers/infiniband/sw/rxe/rxe_resp.c +13 -7
@@ -844,7 +844,7 @@ static enum resp_states do_complete(struct rxe_qp *qp, {struct rxe_cqe cqe;struct ib_wc *wc = &cqe.ibwc; -struct ib_uverbs_wc *uwc = &cqe.uibwc; +struct rxe_uverbs_wc *uwc = &cqe.ruwc;struct rxe_recv_wqe *wqe = qp->resp.wqe;struct rxe_dev *rxe =to_rdev (qp->ibqp.device);
@@ -854,13 +854,13 @@ static enum resp_states do_complete(struct rxe_qp *qp,memset (&cqe,0 ,sizeof (cqe));if (qp->rcq->is_user) { - uwc->status = qp->resp.status; - uwc->qp_num = qp->ibqp.qp_num; - uwc->wr_id = wqe->wr_id; + uwc->status = qp->resp.status; + uwc->qp_num = qp->ibqp.qp_num; + uwc->wr_id = wqe->wr_id; }else { - wc->status = qp->resp.status; - wc->qp = &qp->ibqp; - wc->wr_id = wqe->wr_id; + wc->status = qp->resp.status; + wc->qp = &qp->ibqp; + wc->wr_id = wqe->wr_id; }if (wc->status ==IB_WC_SUCCESS ) {
@@ -895,6 +895,12 @@ static enum resp_states do_complete(struct rxe_qp *qp, uwc->src_qp =deth_sqp (pkt); uwc->port_num = qp->attr.port_num; + +if (qp->rcq->flags & +IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION ) { + uwc->timestamp = (u64 )ktime_get (); + uwc->realtime = (u64 )ktime_get_real (); + } }else {struct sk_buff *skb =PKT_TO_SKB (pkt);
drivers/infiniband/sw/rxe/rxe_verbs.c +6 -4
@@ -749,7 +749,8 @@ static int rxe_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,return err; } -static int rxe_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr, +static int rxe_create_cq (struct ib_cq *ibcq, +const struct ib_cq_init_attr *attr,struct ib_udata *udata) {int err;
@@ -764,13 +765,12 @@ static int rxe_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, uresp = udata->outbuf; } -if (attr->flags) -return -EINVAL ; - err =rxe_cq_chk_attr (rxe,NULL , attr->cqe, attr->comp_vector);if (err)return err; + cq->flags = attr->flags; + err =rxe_cq_from_init (rxe, cq, attr->cqe, attr->comp_vector, udata, uresp);if (err)
@@ -1187,6 +1187,8 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) dev->uverbs_ex_cmd_mask =BIT_ULL (IB_USER_VERBS_EX_CMD_QUERY_DEVICE ) + |BIT_ULL (IB_USER_VERBS_EX_CMD_CREATE_CQ ) + |BIT_ULL (IB_USER_VERBS_EX_CMD_MODIFY_CQ ) ;ib_set_device_ops (dev, &rxe_dev_ops);
drivers/infiniband/sw/rxe/rxe_verbs.h +2 -1
@@ -53,7 +53,7 @@ struct rxe_ah {struct rxe_cqe {union {struct ib_wc ibwc; -struct ib_uverbs_wc uibwc; +struct rxe_uverbs_wc ruwc; }; };
@@ -62,6 +62,7 @@ struct rxe_cq {struct rxe_pool_entry pelem;struct rxe_queue *queue;spinlock_t cq_lock; +u32 flags;u8 notify;bool is_dying;int is_user;
include/uapi/rdma/rdma_user_rxe.h +31 -7
@@ -98,29 +98,27 @@ struct rxe_send_wr {__aligned_u64 length;union {__u32 mr_index; -__aligned_u64 reserved1; +__aligned_u64 pad1; };union {__u32 mw_index; -__aligned_u64 reserved2; +__aligned_u64 pad2; };__u32 rkey;__u32 access;__u32 flags; } umw; -/* The following are only used by the kernel -* and are not part of the uapi -*/ +/* below are only used by the kernel */ struct {__aligned_u64 addr;__aligned_u64 length;union {struct ib_mr *mr; -__aligned_u64 reserved1; +__aligned_u64 reserved1; };union {struct ib_mw *mw; -__aligned_u64 reserved2; +__aligned_u64 reserved2; };__u32 rkey;__u32 access;
@@ -184,6 +182,32 @@ struct rxe_recv_wqe {struct rxe_dma_info dma; }; +struct rxe_uverbs_wc { +/* keep these the same as ib_uverbs_wc */ +__aligned_u64 wr_id; +__u32 status; +__u32 opcode; +__u32 vendor_err; +__u32 byte_len; +union { +__be32 imm_data; +__u32 invalidate_rkey; + } ex; +__u32 qp_num; +__u32 src_qp; +__u32 wc_flags; +__u16 pkey_index; +__u16 slid; +__u8 sl; +__u8 dlid_path_bits; +__u8 port_num; +__u8 reserved; + +/* any extras go here */ +__aligned_u64 timestamp; +__aligned_u64 realtime; +}; +struct rxe_create_cq_resp {struct mminfo mi; };
Signature · 1 line
2.25.1
PATCH v5 9/12 rdma_rxe: Add support for extended QP operations
In reply to Bob PearsonAdd bits to user api command bitmask.
--- drivers/infiniband/sw/rxe/rxe_verbs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/sw/rxe/rxe_verbs.c +2 -0
@@ -1187,6 +1187,8 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) dev->uverbs_ex_cmd_mask =BIT_ULL (IB_USER_VERBS_EX_CMD_QUERY_DEVICE ) + |BIT_ULL (IB_USER_VERBS_EX_CMD_CREATE_QP ) + |BIT_ULL (IB_USER_VERBS_EX_CMD_MODIFY_QP ) |BIT_ULL (IB_USER_VERBS_EX_CMD_CREATE_CQ ) |BIT_ULL (IB_USER_VERBS_EX_CMD_MODIFY_CQ ) ;
Signature · 1 line
2.25.1
Jason Gunthorpe
maintainerRe: [PATCH for-next v5 09/12] rdma_rxe: Add support for extended QP operations
Quoted 10 lines · Bob Pearson
Add bits to user api command bitmask.
Signed-off-by Bob Pearson <[email protected]>drivers/infiniband/sw/rxe/rxe_verbs.c | 2 ++ 1 file changed, 2 insertions(+)drivers/infiniband/sw/rxe/rxe_verbs.c +1
-0+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
drivers/infiniband/sw/rxe/rxe_verbs.c int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) · line 1194
Quoted 8 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +2
-0@@ -1187,6 +1187,8 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) dev->uverbs_ex_cmd_mask =BIT_ULL (IB_USER_VERBS_EX_CMD_QUERY_DEVICE ) + |BIT_ULL (IB_USER_VERBS_EX_CMD_CREATE_QP ) + |BIT_ULL (IB_USER_VERBS_EX_CMD_MODIFY_QP ) |BIT_ULL (IB_USER_VERBS_EX_CMD_CREATE_CQ ) |BIT_ULL (IB_USER_VERBS_EX_CMD_MODIFY_CQ ) ;
Again I wonder if we should just set these always in the core code, can you see a reason why not?
I really hate these cmd_masks and want to get rid of them anyhow
Jason
PATCH v5 10/12 rdma_rxe: Fix pool related bugs
In reply to Bob PearsonThis patch does following:
- Replace the rwlock used for pool->pool_lock by a spinlock. Rwlock is a multi-reader single writer lock but there are cases where a multi-writer lock is required, especially where multiple objects can be created at the same time.
- Be more careful about type checking in pool APIs. Originally each object used in rxe had a pool_entry struct as the first member of it's struct. Since then about half have it first and the other half have it later in the struct. The pool APIs used void * as a hack to avoid type checking. This patch changes the APIs so the pool_entry struct is position independent. When used a parameter a macro is used to convert the object pointer to the entry pointer. The offset of the entry is stored for each pool and used to convert the entry address to the object address.
- Provide locked and unlocked versions of the APIs.
The current code uses a lock in each API to allow atomic updates to the pools. But some uses fail to work because they combined multiple pool operations and expect them to be atomic. As an example doing a lookup to see if a matching object exists for a multicast group followed by a create of a new group if it does not. By letting the caller take the pool lock and then combine unlocked operations this problem is fixed.
- Replace calls to pool APIs with the typesafe versions.
- Replaced a few calls to pr_warn with pr_err_once.
--- drivers/infiniband/sw/rxe/rxe_cq.c | 12 +- drivers/infiniband/sw/rxe/rxe_mcast.c | 4 +- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- drivers/infiniband/sw/rxe/rxe_mw.c | 18 ++- drivers/infiniband/sw/rxe/rxe_pool.c | 220 ++++++++++++++++++-------- drivers/infiniband/sw/rxe/rxe_pool.h | 77 ++++++--- drivers/infiniband/sw/rxe/rxe_recv.c | 4 +- drivers/infiniband/sw/rxe/rxe_req.c | 4 +- drivers/infiniband/sw/rxe/rxe_resp.c | 8 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 10 +- 10 files changed, 238 insertions(+), 121 deletions(-)
drivers/infiniband/sw/rxe/rxe_cq.c +6 -6
@@ -14,21 +14,21 @@ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq,int count;if (cqe <=0 ) { -pr_warn ("cqe(%d) <= 0\n" , cqe); +pr_err_once ("%s: cqe(%d) <= 0\n" , __func__, cqe); goto err1; }if (cqe > rxe->attr.max_cqe) { -pr_warn ("cqe(%d) > max_cqe(%d)\n" , - cqe, rxe->attr.max_cqe); +pr_err_once ("%s: cqe(%d) > max_cqe(%d)\n" , + __func__, cqe, rxe->attr.max_cqe); goto err1; }if (cq) { count =queue_count (cq->queue);if (cqe < count) { -pr_warn ("cqe(%d) < current # elements in queue (%d)" , - cqe, count); +pr_err_once ("%s: cqe(%d) < current # elements in queue (%d)" , + __func__, cqe, count); goto err1; } }
@@ -63,7 +63,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe, cq->queue =rxe_queue_init (rxe, &cqe,sizeof (struct rxe_cqe ));if (!cq->queue) { -pr_warn ("unable to create cq\n" ); +pr_err_once ("%s: unable to create cq\n" , __func__);return -ENOMEM ; }
drivers/infiniband/sw/rxe/rxe_mcast.c +2 -2
@@ -18,7 +18,7 @@ int rxe_mcast_get_grp(struct rxe_dev *rxe, union ib_gid *mgid, goto err1; } - grp =rxe_pool_get_key (&rxe->mc_grp_pool, mgid); + grp =rxe_get_key (&rxe->mc_grp_pool, mgid);if (grp) goto done;
@@ -98,7 +98,7 @@ int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,struct rxe_mc_grp *grp;struct rxe_mc_elem *elem, *tmp; - grp =rxe_pool_get_key (&rxe->mc_grp_pool, mgid); + grp =rxe_get_key (&rxe->mc_grp_pool, mgid);if (!grp) goto err1;
drivers/infiniband/sw/rxe/rxe_mr.c +1 -1
@@ -385,7 +385,7 @@ static struct rxe_mr *lookup_mr(struct rxe_pd *pd, int access, u32 lkey)struct rxe_mr *mr;struct rxe_dev *rxe =to_rdev (pd->ibpd.device); - mr =rxe_pool_get_key (&rxe->mr_pool, &lkey); + mr =rxe_get_key (&rxe->mr_pool, &lkey);if (!mr)return NULL ;
drivers/infiniband/sw/rxe/rxe_mw.c +10 -8
@@ -219,8 +219,10 @@ static int do_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe,u32 rkey;u32 new_rkey;struct rxe_mw *duplicate_mw; -struct rxe_dev *rxe =to_rdev (qp->ibqp.device); +struct rxe_pool *pool = mw->pelem.pool; +unsigned long flags; +spin_lock_irqsave (&pool->pool_lock, flags);/* key part of new rkey is provided by user for type 2 * and ibv_bind_mw() for type 1 MWs * there is a very rare chance that the new rkey will
@@ -229,15 +231,17 @@ static int do_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe,*/ rkey = mw->ibmw.rkey; new_rkey = (rkey &0xffffff00 ) | (wqe->wr.wr.umw.rkey &0x000000ff ); - duplicate_mw =rxe_pool_get_key (&rxe->mw_pool, &new_rkey); + duplicate_mw =__get_key (pool, &new_rkey);if (duplicate_mw) { +spin_unlock_irqrestore (&pool->pool_lock, flags);pr_err_once ("new MW key is a duplicate, try another\n" );rxe_drop_ref (duplicate_mw);return -EINVAL ; } -rxe_drop_key (mw); -rxe_add_key (mw, &new_rkey); +drop_key (mw); +add_key (mw, &new_rkey); +spin_unlock_irqrestore (&pool->pool_lock, flags); mw->access = wqe->wr.wr.umw.access; mw->state =RXE_MEM_STATE_VALID ;
@@ -271,16 +275,14 @@ int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe)unsigned long flags;if (qp->is_user) { - mw =rxe_pool_get_index (&rxe->mw_pool, - wqe->wr.wr.umw.mw_index); + mw =rxe_get_index (&rxe->mw_pool, wqe->wr.wr.umw.mw_index);if (!mw) {pr_err_once ("mw with index = %d not found\n" , wqe->wr.wr.umw.mw_index); ret = -EINVAL ; goto err1; } - mr =rxe_pool_get_index (&rxe->mr_pool, - wqe->wr.wr.umw.mr_index); + mr =rxe_get_index (&rxe->mr_pool, wqe->wr.wr.umw.mr_index);if (!mr && wqe->wr.wr.umw.length) {pr_err_once ("mr with index = %d not found\n" , wqe->wr.wr.umw.mr_index);
drivers/infiniband/sw/rxe/rxe_pool.c +150 -70
419 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_pool.h +56 -21
104 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_recv.c +2 -2
@@ -185,7 +185,7 @@ static int hdr_check(struct rxe_pkt_info *pkt)if (qpn !=IB_MULTICAST_QPN ) { index = (qpn ==1 ) ? port->qp_gsi_index : qpn; - qp =rxe_pool_get_index (&rxe->qp_pool, index); + qp =rxe_get_index (&rxe->qp_pool, index);if (unlikely (!qp)) {pr_warn_ratelimited ("no qp matches qpn 0x%x\n" , qpn); goto err1;
@@ -242,7 +242,7 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)memcpy (&dgid, &ipv6_hdr (skb)->daddr,sizeof (dgid));/* lookup mcast group corresponding to mgid, takes a ref */ - mcg =rxe_pool_get_key (&rxe->mc_grp_pool, &dgid); + mcg =rxe_get_key (&rxe->mc_grp_pool, &dgid);if (!mcg) goto err1;/* mcast group not registered */
drivers/infiniband/sw/rxe/rxe_req.c +2 -2
@@ -599,8 +599,8 @@ int rxe_requester(void *arg)if (wqe->mask &WR_LOCAL_MASK ) {switch (wqe->wr.opcode) {case IB_WR_LOCAL_INV : - mr =rxe_pool_get_key (&rxe->mr_pool, - &wqe->wr.ex.invalidate_rkey); + mr =rxe_get_key (&rxe->mr_pool, + &wqe->wr.ex.invalidate_rkey);if (!mr) {pr_err ("No mr for key %#x\n" , wqe->wr.ex.invalidate_rkey);
drivers/infiniband/sw/rxe/rxe_resp.c +4 -4
@@ -439,7 +439,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp,* since the last packet */ if (rkey &IS_MW ) { - mw =rxe_pool_get_key (&rxe->mw_pool, &rkey); + mw =rxe_get_key (&rxe->mw_pool, &rkey);if (!mw) {pr_err_once ("no MW found with rkey = 0x%08x\n" , rkey); state =RESPST_ERR_RKEY_VIOLATION ;
@@ -463,7 +463,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp,spin_unlock_irqrestore (&mw->lock, flags);rxe_drop_ref (mw); }else { - mr =rxe_pool_get_key (&rxe->mr_pool, &rkey); + mr =rxe_get_key (&rxe->mr_pool, &rkey);if (!mr || (mr->rkey != rkey)) {pr_err_once ("no MR found with rkey = 0x%08x\n" , rkey); state =RESPST_ERR_RKEY_VIOLATION ;
@@ -926,8 +926,8 @@ static enum resp_states do_complete(struct rxe_qp *qp, wc->wc_flags |=IB_WC_WITH_INVALIDATE ; wc->ex.invalidate_rkey =ieth_rkey (pkt); - rmr =rxe_pool_get_key (&rxe->mr_pool, - &wc->ex.invalidate_rkey); + rmr =rxe_get_key (&rxe->mr_pool, + &wc->ex.invalidate_rkey);if (unlikely (!rmr)) {pr_err ("Bad rkey %#x invalidation\n" , wc->ex.invalidate_rkey);
drivers/infiniband/sw/rxe/rxe_verbs.c +5 -5
@@ -111,7 +111,7 @@ static int rxe_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)struct rxe_dev *rxe =to_rdev (uctx->device);struct rxe_ucontext *uc =to_ruc (uctx); -return rxe_add_to_pool (&rxe->uc_pool, &uc->pelem); +return rxe_add_to_pool (&rxe->uc_pool, uc); }static void rxe_dealloc_ucontext (struct ib_ucontext *ibuc)
@@ -145,7 +145,7 @@ static int rxe_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)struct rxe_dev *rxe =to_rdev (ibpd->device);struct rxe_pd *pd =to_rpd (ibpd); -return rxe_add_to_pool (&rxe->pd_pool, &pd->pelem); +return rxe_add_to_pool (&rxe->pd_pool, pd); }static int rxe_dealloc_pd (struct ib_pd *ibpd,struct ib_udata *udata)
@@ -169,7 +169,7 @@ static int rxe_create_ah(struct ib_ah *ibah,if (err)return err; - err =rxe_add_to_pool (&rxe->ah_pool, &ah->pelem); + err =rxe_add_to_pool (&rxe->ah_pool, ah);if (err)return err;
@@ -275,7 +275,7 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init,if (err) goto err1; - err =rxe_add_to_pool (&rxe->srq_pool, &srq->pelem); + err =rxe_add_to_pool (&rxe->srq_pool, srq);if (err) goto err1;
@@ -776,7 +776,7 @@ static int rxe_create_cq(struct ib_cq *ibcq,if (err)return err; -return rxe_add_to_pool (&rxe->cq_pool, &cq->pelem); +return rxe_add_to_pool (&rxe->cq_pool, cq); }static int rxe_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata)
Signature · 1 line
2.25.1
Jason Gunthorpe
maintainerRe: [PATCH for-next v5 10/12] rdma_rxe: Fix pool related bugs
Quoted 5 lines · Bob Pearson
This patch does following:
- Replace the rwlock used forpool->pool_lockby a spinlock. Rwlock is a multi-reader single writer lock but there are cases where a multi-writer lock is required, especially where multiple objects can be created at the same time.
Not sure what a multi-write lock is, sounds scary
Quoted 12 lines
- Be more careful about type checking in pool APIs. Originally each object used in rxe had a
pool_entrystruct as the first member of it's struct. Since then about half have it first and the other half have it later in the struct. The pool APIs used void * as a hack to avoid type checking. This patch changes the APIs so thepool_entrystruct is position independent. When used a parameter a macro is used to convert the object pointer to the entry pointer. The offset of the entry is stored for each pool and used to convert the entry address to the object address.
- Provide locked and unlocked versions of the APIs.
The current code uses a lock in each API to allow atomic
Quoted 8 lines
updates to the pools. But some uses fail to work because they combined multiple pool operations and expect them to be atomic. As an example doing a lookup to see if a matching object exists for a multicast group followed by a create of a new group if it does not. By letting the caller take the pool lock and then combine unlocked operations this problem is fixed.
- Replace calls to pool APIs with the typesafe versions.
- Replaced a few calls topr_warnwithpr_err_once.
This probably needs to be split up
Jason
PATCH v5 11/12 rdma_rxe: Fix mcast group allocation bug
In reply to Bob PearsonThis patch does the following:
- Cleans up multicast group create to use an atomic sequence of lookup followed by allocate. This fixes an error that occurred when two QPs were attempting to attach to the same mcast address at the same time.
- Fixes a bug in rxe_mcast_get_grp not initializing err = 0. If the group is found in get_key the routine can return an uninitialized value to caller.
- Changes the variable elem to mce (for mcast elem). This is less likely to confuse readers because of the ambiguity with elem as pool element which is also used.
--- drivers/infiniband/sw/rxe/rxe_mcast.c | 108 ++++++++++++++------------ 1 file changed, 60 insertions(+), 48 deletions(-)
drivers/infiniband/sw/rxe/rxe_mcast.c +60 -48
@@ -7,44 +7,56 @@#include "rxe.h" #include "rxe_loc.h" -int rxe_mcast_get_grp (struct rxe_dev *rxe,union ib_gid *mgid, -struct rxe_mc_grp **grp_p) +/* caller should hold mc_grp_pool->pool_lock */ +static struct rxe_mc_grp *create_grp (struct rxe_dev *rxe, +struct rxe_pool *pool, +union ib_gid *mgid) {int err;struct rxe_mc_grp *grp; -if (rxe->attr.max_mcast_qp_attach ==0 ) { - err = -EINVAL ; - goto err1; - } - - grp =rxe_get_key (&rxe->mc_grp_pool, mgid); -if (grp) - goto done; - - grp =rxe_alloc (&rxe->mc_grp_pool); -if (!grp) { - err = -ENOMEM ; - goto err1; - } + grp =__alloc (&rxe->mc_grp_pool); +if (unlikely (!grp)) +return NULL ;INIT_LIST_HEAD (&grp->qp_list);spin_lock_init (&grp->mcg_lock); grp->rxe = rxe; - -rxe_add_key (grp, mgid); +add_key (grp, mgid); err =rxe_mcast_add (rxe, mgid); -if (err) - goto err2; +if (unlikely (err)) { +drop_key (grp); +rxe_drop_ref (grp); +return NULL ; + } +return grp; +} + +/* atomically lookup or create mc group */ +int rxe_mcast_get_grp (struct rxe_dev *rxe,union ib_gid *mgid, +struct rxe_mc_grp **grp_p) +{ +int err =0 ; +struct rxe_mc_grp *grp; +struct rxe_pool *pool = &rxe->mc_grp_pool; +unsigned long flags; + +if (unlikely (rxe->attr.max_mcast_qp_attach ==0 )) +return -EINVAL ; + +spin_lock_irqsave (&pool->pool_lock, flags); + grp =__get_key (pool, mgid); +if (grp) + goto done; + + grp =create_grp (rxe, pool, mgid); +if (unlikely (!grp)) + err = -ENOMEM ; done: +spin_unlock_irqrestore (&pool->pool_lock, flags); *grp_p = grp; -return 0 ; - -err2: -rxe_drop_ref (grp); -err1:return err; }
@@ -52,13 +64,13 @@ int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_mc_grp *grp) {int err; -struct rxe_mc_elem *elem; +struct rxe_mc_elem *mce;/* check to see of the qp is already a member of the group */ spin_lock_bh (&qp->grp_lock);spin_lock_bh (&grp->mcg_lock); -list_for_each_entry (elem, &grp->qp_list, qp_list) { -if (elem->qp == qp) { +list_for_each_entry (mce, &grp->qp_list, qp_list) { +if (mce->qp == qp) { err =0 ; goto out; }
@@ -69,8 +81,8 @@ int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp, goto out; } - elem =rxe_alloc (&rxe->mc_elem_pool); -if (!elem) { + mce =rxe_alloc (&rxe->mc_elem_pool); +if (!mce) { err = -ENOMEM ; goto out; }
@@ -79,11 +91,11 @@ int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,rxe_add_ref (grp); grp->num_qp++; - elem->qp = qp; - elem->grp = grp; + mce->qp = qp; + mce->grp = grp; -list_add (&elem->qp_list, &grp->qp_list); -list_add (&elem->grp_list, &qp->grp_list); +list_add (&mce->qp_list, &grp->qp_list); +list_add (&mce->grp_list, &qp->grp_list); err =0 ; out:
@@ -96,7 +108,7 @@ int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp, union ib_gid *mgid) {struct rxe_mc_grp *grp; -struct rxe_mc_elem *elem, *tmp; +struct rxe_mc_elem *mce, *tmp; grp =rxe_get_key (&rxe->mc_grp_pool, mgid);if (!grp)
@@ -105,15 +117,15 @@ int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,spin_lock_bh (&qp->grp_lock);spin_lock_bh (&grp->mcg_lock); -list_for_each_entry_safe (elem, tmp, &grp->qp_list, qp_list) { -if (elem->qp == qp) { -list_del (&elem->qp_list); -list_del (&elem->grp_list); +list_for_each_entry_safe (mce, tmp, &grp->qp_list, qp_list) { +if (mce->qp == qp) { +list_del (&mce->qp_list); +list_del (&mce->grp_list); grp->num_qp--;spin_unlock_bh (&grp->mcg_lock);spin_unlock_bh (&qp->grp_lock); -rxe_drop_ref (elem); +rxe_drop_ref (mce);rxe_drop_ref (grp);/* ref held by QP */ rxe_drop_ref (grp);/* ref from get_key */ return 0 ;
@@ -130,7 +142,7 @@ int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,void rxe_drop_all_mcast_groups (struct rxe_qp *qp) {struct rxe_mc_grp *grp; -struct rxe_mc_elem *elem; +struct rxe_mc_elem *mce;while (1 ) {spin_lock_bh (&qp->grp_lock);
@@ -138,24 +150,24 @@ void rxe_drop_all_mcast_groups(struct rxe_qp *qp)spin_unlock_bh (&qp->grp_lock);break ; } - elem = list_first_entry(&qp->grp_list, struct rxe_mc_elem, + mce = list_first_entry(&qp->grp_list, struct rxe_mc_elem, grp_list); -list_del (&elem->grp_list); +list_del (&mce->grp_list);spin_unlock_bh (&qp->grp_lock); - grp = elem->grp; + grp = mce->grp;spin_lock_bh (&grp->mcg_lock); -list_del (&elem->qp_list); +list_del (&mce->qp_list); grp->num_qp--;spin_unlock_bh (&grp->mcg_lock);rxe_drop_ref (grp); -rxe_drop_ref (elem); +rxe_drop_ref (mce); } } -void rxe_mc_cleanup (struct rxe_pool_entry *arg) +void rxe_mc_cleanup (struct rxe_pool_entry *pelem) { -struct rxe_mc_grp *grp =container_of (arg,typeof (*grp), pelem); + struct rxe_mc_grp *grp = container_of(pelem, struct rxe_mc_grp, pelem);struct rxe_dev *rxe = grp->rxe;rxe_drop_key (grp);
Signature · 1 line
2.25.1
PATCH v5 12/12 rdma_rxe: Fix bugs in the multicast receive path
In reply to Bob PearsonThis patch does the following
- Fix a bug in rxe_rcv.
The current code calls rxe_match_dgid which checks to see if the destination ip address (dgid) matches one of the addresses in the gid table. This is ok for unicast adfdresses but not mcast addresses. Because of this all mcast packets were previously dropped.
- Fix a bug in rxe_rcv_mcast_pkt.
The current code is just wrong. It assumed that it could pass the same skb to rxe_rcv_pkt changing the qp pointer as it went when multiple QPs were attached to the same mcast address. In fact each QP needs a separate clone of the skb which it will delete later.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 60 +++++++++++++++++----------- 1 file changed, 36 insertions(+), 24 deletions(-)
drivers/infiniband/sw/rxe/rxe_recv.c +36 -24
@@ -233,6 +233,8 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)struct rxe_mc_elem *mce;struct rxe_qp *qp;union ib_gid dgid; +struct sk_buff *per_qp_skb; +struct rxe_pkt_info *per_qp_pkt;int err;if (skb->protocol ==htons (ETH_P_IP ))
@@ -261,42 +263,37 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)if (err)continue ; -/* if *not* the last qp in the list -* increase the users of the skb then post to the next qp +/* for all but the last qp create a new clone of the +* skb and pass to the qp. +* This effectively reverts an earlier change +* which did not work. The pkt struct is contained +* in the skb so each time you changed pkt you also +* changed all the earlier pkts as well. Caused a mess. */ if (mce->qp_list.next != &mcg->qp_list) -skb_get (skb); + per_qp_skb =skb_clone (skb,GFP_ATOMIC ); +else + per_qp_skb = skb; - pkt->qp = qp; + per_qp_pkt =SKB_TO_PKT (per_qp_skb); + per_qp_pkt->qp = qp;rxe_add_ref (qp); -rxe_rcv_pkt (pkt, skb); +rxe_rcv_pkt (per_qp_pkt, per_qp_skb); }spin_unlock_bh (&mcg->mcg_lock); -rxe_drop_ref (mcg);/* drop ref from rxe_pool_get_key. */ +return ; err1:kfree_skb (skb); +return ; } -static int rxe_match_dgid (struct rxe_dev *rxe,struct sk_buff *skb) +static int rxe_match_dgid (struct rxe_dev *rxe,struct sk_buff *skb, +union ib_gid *pdgid) { -struct rxe_pkt_info *pkt =SKB_TO_PKT (skb);const struct ib_gid_attr *gid_attr; -union ib_gid dgid; -union ib_gid *pdgid; - -if (pkt->mask &RXE_LOOPBACK_MASK ) -return 0 ; - -if (skb->protocol ==htons (ETH_P_IP )) { -ipv6_addr_set_v4mapped (ip_hdr (skb)->daddr, - (struct in6_addr *)&dgid); - pdgid = &dgid; - }else { - pdgid = (union ib_gid *)&ipv6_hdr (skb)->daddr; - } gid_attr = rdma_find_gid_by_port(&rxe->ib_dev, pdgid, IB_GID_TYPE_ROCE_UDP_ENCAP,
@@ -314,17 +311,32 @@ void rxe_rcv(struct sk_buff *skb)int err;struct rxe_pkt_info *pkt =SKB_TO_PKT (skb);struct rxe_dev *rxe = pkt->rxe; +union ib_gid dgid; +union ib_gid *pdgid;__be32 *icrcp;u32 calc_icrc, pack_icrc; +int is_mc; pkt->offset =0 ;if (unlikely (skb->len < pkt->offset +RXE_BTH_BYTES )) goto drop; -if (rxe_match_dgid (rxe, skb) <0 ) { -pr_warn_ratelimited ("failed matching dgid\n" ); - goto drop; +if (skb->protocol ==htons (ETH_P_IP )) { +ipv6_addr_set_v4mapped (ip_hdr (skb)->daddr, + (struct in6_addr *)&dgid); + pdgid = &dgid; + }else { + pdgid = (union ib_gid *)&ipv6_hdr (skb)->daddr; + } + + is_mc =rdma_is_multicast_addr ((struct in6_addr *)pdgid); + +if (!(pkt->mask &RXE_LOOPBACK_MASK ) && !is_mc) { +if (rxe_match_dgid (rxe, skb, pdgid) <0 ) { +pr_warn_ratelimited ("failed matching dgid\n" ); + goto drop; + } } pkt->opcode =bth_opcode (pkt);
Signature · 1 line
2.25.1
Jason Gunthorpe
maintainerQuoted 10 lines · Bob Pearson
This patch series is a collection of API extensions for the
rdma_rxedriver. With this patch set installed there are no errors in pyverbs run-tests and 31 tests are skipped down from 56. The remaining skipped test cases include
- XRC tests
- ODP tests
- Parent device tests
- Import tests
- Device memory
- MLX5 specific tests
- EFA tests
It seems like a big improvement! Thanks!
Zhu, can you look through this too?
Jason
Quoted 11 lines
It continues from the previous (v4) set which implemented memory windows and has had a number of individual patches picked up in for-next.
This set (v5) includes:
Ported to current head of tree
Memory windows patches not yet picked up kernel support for the extended user space APIs:
-ibv_query_device_ex
-ibv_create_cq_ex
-ibv_create_qp_ex
Fixes for multicast which is not currently working
I would like to progress the simple independent obviously OK bits, could you split them out?
Jason
Zhu Yanjun
maintainerQuoted 11 lines · Jason Gunthorpe
Quoted 10 lines · Bob Pearson
This patch series is a collection of API extensions for the
rdma_rxedriver. With this patch set installed there are no errors in pyverbs run-tests and 31 tests are skipped down from 56. The remaining skipped test cases include
- XRC tests
- ODP tests
- Parent device tests
- Import tests
- Device memory
- MLX5 specific tests
- EFA tests
Quoted 3 lines
It seems like a big improvement! Thanks!
Zhu, can you look through this too?
OK. It seems that a problem occurred in this patch set.
Hi, Bob
Please fix this problem. Thanks a lot.
Zhu Yanjun
Quoted 18 lines
Jason
Quoted 11 lines
It continues from the previous (v4) set which implemented memory windows and has had a number of individual patches picked up in for-next.
This set (v5) includes:
Ported to current head of tree
Memory windows patches not yet picked up kernel support for the extended user space APIs:
-ibv_query_device_ex
-ibv_create_cq_ex
-ibv_create_qp_ex
Fixes for multicast which is not currently workingI would like to progress the simple independent obviously OK bits, could you split them out?
Jason
Zhu Yanjun
maintainerQuoted 15 lines · Zhu Yanjun
Quoted 13 lines · Jason Gunthorpe
Quoted 10 lines · Bob Pearson
This patch series is a collection of API extensions for the
rdma_rxedriver. With this patch set installed there are no errors in pyverbs run-tests and 31 tests are skipped down from 56. The remaining skipped test cases include
- XRC tests
- ODP tests
- Parent device tests
- Import tests
- Device memory
- MLX5 specific tests
- EFA testsIt seems like a big improvement! Thanks!
Quoted 7 lines
Quoted 1 line
Zhu, can you look through this too?
OK. It seems that a problem occurred in this patch set.
Hi, Bob
Please fix this problem. Thanks a lot.
The problem mail is in the attachment. Please check and fix it.
Zhu Yanjun
Quoted 21 lines
Zhu Yanjun
Quoted 18 lines
Jason
Quoted 11 lines
It continues from the previous (v4) set which implemented memory windows and has had a number of individual patches picked up in for-next.
This set (v5) includes:
Ported to current head of tree
Memory windows patches not yet picked up kernel support for the extended user space APIs:
-ibv_query_device_ex
-ibv_create_cq_ex
-ibv_create_qp_ex
Fixes for multicast which is not currently workingI would like to progress the simple independent obviously OK bits, could you split them out?
Jason
Hi Bob,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on rdma/for-next]
[also build test WARNING on v5.9-rc5 next-20200918]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Bob-Pearson/rdma_rxe-API-extensions/20200919-051909 base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next config: riscv-randconfig-r031-20200917 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ed79827aea444e6995fb3d36abc2bfd36331773c)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:556:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inb(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:54:76: note: expanded from macro 'inb'
#define inb(c) ({ u8 __v; __io_pbr(); __v = readb_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:87:48: note: expanded from macro 'readb_cpu'
#define readb_cpu(c) ({ u8 __r = __raw_readb(c); __r; })
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:564:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inw(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:55:76: note: expanded from macro 'inw'
#define inw(c) ({ u16 __v; __io_pbr(); __v = readw_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:88:76: note: expanded from macro 'readw_cpu'
#define readw_cpu(c) ({ u16 __r = le16_to_cpu((__force __le16)__raw_readw(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:572:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inl(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:56:76: note: expanded from macro 'inl'
#define inl(c) ({ u32 __v; __io_pbr(); __v = readl_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:89:76: note: expanded from macro 'readl_cpu'
#define readl_cpu(c) ({ u32 __r = le32_to_cpu((__force __le32)__raw_readl(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:580:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
outb(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:58:68: note: expanded from macro 'outb'
#define outb(v,c) ({ __io_pbw(); writeb_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:91:52: note: expanded from macro 'writeb_cpu'
#define writeb_cpu(v, c) ((void)__raw_writeb((v), (c)))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:588:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
outw(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:59:68: note: expanded from macro 'outw'
#define outw(v,c) ({ __io_pbw(); writew_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:92:76: note: expanded from macro 'writew_cpu'
#define writew_cpu(v, c) ((void)__raw_writew((__force u16)cpu_to_le16(v), (c)))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:596:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
outl(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:60:68: note: expanded from macro 'outl'
#define outl(v,c) ({ __io_pbw(); writel_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:93:76: note: expanded from macro 'writel_cpu'
#define writel_cpu(v, c) ((void)__raw_writel((__force u32)cpu_to_le32(v), (c)))
^
In file included from drivers/infiniband/sw/rxe/rxe_mr.c:7:
In file included from drivers/infiniband/sw/rxe/rxe.h:16:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:148:
include/asm-generic/io.h:1017:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^Quoted 1 line
Quoted 1 line
drivers/infiniband/sw/rxe/rxe_mr.c:531:5: warning: no previous prototype for function 'rxe_invalidate_mr' [-Wmissing-prototypes]
int rxe_invalidate_mr(struct rxe_qp *qp, struct rxe_mr *mr)
^
drivers/infiniband/sw/rxe/rxe_mr.c:531:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int rxe_invalidate_mr(struct rxe_qp *qp, struct rxe_mr *mr)
^
static
8 warnings generated.
# https://github.com/0day-ci/linux/commit/ea6524464bcccdce769f9a046224290a51dee110
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bob-Pearson/rdma_rxe-API-extensions/20200919-051909 git checkout ea6524464bcccdce769f9a046224290a51dee110
vim +/rxe_invalidate_mr +531 drivers/infiniband/sw/rxe/rxe_mr.c
530
Quoted 1 line
531 int
rxe_invalidate_mr(struct rxe_qp *qp, struct rxe_mr *mr)
532 {
533 mr->state = RXE_MEM_STATE_FREE;
534 return 0;
535 }
536
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Quoted 20 lines · Zhu Yanjun
Quoted 19 lines · Zhu Yanjun
Quoted 11 lines · Jason Gunthorpe
Quoted 10 lines · Bob Pearson
This patch series is a collection of API extensions for the
rdma_rxedriver. With this patch set installed there are no errors in pyverbs run-tests and 31 tests are skipped down from 56. The remaining skipped test cases include
- XRC tests
- ODP tests
- Parent device tests
- Import tests
- Device memory
- MLX5 specific tests
- EFA testsQuoted 3 lines
It seems like a big improvement! Thanks!
Zhu, can you look through this too?
OK. It seems that a problem occurred in this patch set.
Quoted 31 lines
Quoted 3 lines
Hi, Bob
Please fix this problem. Thanks a lot.
The problem mail is in the attachment. Please check and fix it.
Zhu Yanjun
Quoted 21 lines
Zhu Yanjun
Quoted 18 lines
Jason
Quoted 11 lines
It continues from the previous (v4) set which implemented memory windows and has had a number of individual patches picked up in for-next.
This set (v5) includes:
Ported to current head of tree
Memory windows patches not yet picked up kernel support for the extended user space APIs:
-ibv_query_device_ex
-ibv_create_cq_ex
-ibv_create_qp_ex
Fixes for multicast which is not currently workingI would like to progress the simple independent obviously OK bits, could you split them out?
Jason
Zhu,
The missing prototype was a good catch. (That is resolved now.) But I can't figure out the null pointer arithmetic warnings. They are all in obscure distant header files. Do you have any insight about those?
Bob
Jason Gunthorpe
maintainerQuoted 4 lines · Bob Pearson
The missing prototype was a good catch. (That is resolved now.) But I can't figure out the null pointer arithmetic warnings. They are all in obscure distant header files. Do you have any insight about those?
Just ignore thouse
Jason