aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorShani Michaeli <shanim@mellanox.com>2013-02-06 11:19:12 -0500
committerRoland Dreier <roland@purestorage.com>2013-02-21 14:51:45 -0500
commit7083e42ee2ff43a11481e0e7211ec4f9ac68cb79 (patch)
treecf2c3f16075fcb37c27bff5ae4524f778df9a482 /net
parent836dc9e3fbbab0c30aa6e664417225f5c1fb1c39 (diff)
IB/core: Add "type 2" memory windows support
This patch enhances the IB core support for Memory Windows (MWs). MWs allow an application to have better/flexible control over remote access to memory. Two types of MWs are supported, with the second type having two flavors: Type 1 - associated with PD only Type 2A - associated with QPN only Type 2B - associated with PD and QPN Applications can allocate a MW once, and then repeatedly bind the MW to different ranges in MRs that are associated to the same PD. Type 1 windows are bound through a verb, while type 2 windows are bound by posting a work request. The 32-bit memory key is composed of a 24-bit index and an 8-bit key. The key is changed with each bind, thus allowing more control over the peer's use of the memory key. The changes introduced are the following: * add memory window type enum and a corresponding parameter to ib_alloc_mw. * type 2 memory window bind work request support. * create a struct that contains the common part of the bind verb struct ibv_mw_bind and the bind work request into a single struct. * add the ib_inc_rkey helper function to advance the tag part of an rkey. Consumer interface details: * new device capability flags IB_DEVICE_MEM_WINDOW_TYPE_2A and IB_DEVICE_MEM_WINDOW_TYPE_2B are added to indicate device support for these features. Devices can set either IB_DEVICE_MEM_WINDOW_TYPE_2A or IB_DEVICE_MEM_WINDOW_TYPE_2B if it supports type 2A or type 2B memory windows. It can set neither to indicate it doesn't support type 2 windows at all. * modify existing provides and consumers code to the new param of ib_alloc_mw and the ib_mw_bind_info structure Signed-off-by: Haggai Eran <haggaie@mellanox.com> Signed-off-by: Shani Michaeli <shanim@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/xprtrdma/verbs.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 745973b729af..93726560eaa8 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -1086,7 +1086,7 @@ rpcrdma_buffer_create(struct rpcrdma_buffer *buf, struct rpcrdma_ep *ep,
1086 case RPCRDMA_MEMWINDOWS: 1086 case RPCRDMA_MEMWINDOWS:
1087 /* Allocate one extra request's worth, for full cycling */ 1087 /* Allocate one extra request's worth, for full cycling */
1088 for (i = (buf->rb_max_requests+1) * RPCRDMA_MAX_SEGS; i; i--) { 1088 for (i = (buf->rb_max_requests+1) * RPCRDMA_MAX_SEGS; i; i--) {
1089 r->r.mw = ib_alloc_mw(ia->ri_pd); 1089 r->r.mw = ib_alloc_mw(ia->ri_pd, IB_MW_TYPE_1);
1090 if (IS_ERR(r->r.mw)) { 1090 if (IS_ERR(r->r.mw)) {
1091 rc = PTR_ERR(r->r.mw); 1091 rc = PTR_ERR(r->r.mw);
1092 dprintk("RPC: %s: ib_alloc_mw" 1092 dprintk("RPC: %s: ib_alloc_mw"
@@ -1673,12 +1673,12 @@ rpcrdma_register_memwin_external(struct rpcrdma_mr_seg *seg,
1673 1673
1674 *nsegs = 1; 1674 *nsegs = 1;
1675 rpcrdma_map_one(ia, seg, writing); 1675 rpcrdma_map_one(ia, seg, writing);
1676 param.mr = ia->ri_bind_mem; 1676 param.bind_info.mr = ia->ri_bind_mem;
1677 param.wr_id = 0ULL; /* no send cookie */ 1677 param.wr_id = 0ULL; /* no send cookie */
1678 param.addr = seg->mr_dma; 1678 param.bind_info.addr = seg->mr_dma;
1679 param.length = seg->mr_len; 1679 param.bind_info.length = seg->mr_len;
1680 param.send_flags = 0; 1680 param.send_flags = 0;
1681 param.mw_access_flags = mem_priv; 1681 param.bind_info.mw_access_flags = mem_priv;
1682 1682
1683 DECR_CQCOUNT(&r_xprt->rx_ep); 1683 DECR_CQCOUNT(&r_xprt->rx_ep);
1684 rc = ib_bind_mw(ia->ri_id->qp, seg->mr_chunk.rl_mw->r.mw, &param); 1684 rc = ib_bind_mw(ia->ri_id->qp, seg->mr_chunk.rl_mw->r.mw, &param);
@@ -1690,7 +1690,7 @@ rpcrdma_register_memwin_external(struct rpcrdma_mr_seg *seg,
1690 rpcrdma_unmap_one(ia, seg); 1690 rpcrdma_unmap_one(ia, seg);
1691 } else { 1691 } else {
1692 seg->mr_rkey = seg->mr_chunk.rl_mw->r.mw->rkey; 1692 seg->mr_rkey = seg->mr_chunk.rl_mw->r.mw->rkey;
1693 seg->mr_base = param.addr; 1693 seg->mr_base = param.bind_info.addr;
1694 seg->mr_nsegs = 1; 1694 seg->mr_nsegs = 1;
1695 } 1695 }
1696 return rc; 1696 return rc;
@@ -1706,10 +1706,10 @@ rpcrdma_deregister_memwin_external(struct rpcrdma_mr_seg *seg,
1706 int rc; 1706 int rc;
1707 1707
1708 BUG_ON(seg->mr_nsegs != 1); 1708 BUG_ON(seg->mr_nsegs != 1);
1709 param.mr = ia->ri_bind_mem; 1709 param.bind_info.mr = ia->ri_bind_mem;
1710 param.addr = 0ULL; /* unbind */ 1710 param.bind_info.addr = 0ULL; /* unbind */
1711 param.length = 0; 1711 param.bind_info.length = 0;
1712 param.mw_access_flags = 0; 1712 param.bind_info.mw_access_flags = 0;
1713 if (*r) { 1713 if (*r) {
1714 param.wr_id = (u64) (unsigned long) *r; 1714 param.wr_id = (u64) (unsigned long) *r;
1715 param.send_flags = IB_SEND_SIGNALED; 1715 param.send_flags = IB_SEND_SIGNALED;