MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mana_mp_mr_create

Function mana_mp_mr_create

dpdk/drivers/net/mana/mp.c:18–62  ·  view source on GitHub ↗

* Process MR request from secondary process. */

Source from the content-addressed store, hash-verified

16 * Process MR request from secondary process.
17 */
18static int
19mana_mp_mr_create(struct mana_priv *priv, uintptr_t addr, uint32_t len)
20{
21 struct ibv_mr *ibv_mr;
22 int ret;
23 struct mana_mr_cache *mr;
24
25 ibv_mr = ibv_reg_mr(priv->ib_pd, (void *)addr, len,
26 IBV_ACCESS_LOCAL_WRITE);
27
28 if (!ibv_mr)
29 return -errno;
30
31 DP_LOG(DEBUG, "MR (2nd) lkey %u addr %p len %zu",
32 ibv_mr->lkey, ibv_mr->addr, ibv_mr->length);
33
34 mr = rte_calloc("MANA MR", 1, sizeof(*mr), 0);
35 if (!mr) {
36 DRV_LOG(ERR, "(2nd) Failed to allocate MR");
37 ret = -ENOMEM;
38 goto fail_alloc;
39 }
40 mr->lkey = ibv_mr->lkey;
41 mr->addr = (uintptr_t)ibv_mr->addr;
42 mr->len = ibv_mr->length;
43 mr->verb_obj = ibv_mr;
44
45 rte_spinlock_lock(&priv->mr_btree_lock);
46 ret = mana_mr_btree_insert(&priv->mr_btree, mr);
47 rte_spinlock_unlock(&priv->mr_btree_lock);
48 if (ret) {
49 DRV_LOG(ERR, "(2nd) Failed to add to global MR btree");
50 goto fail_btree;
51 }
52
53 return 0;
54
55fail_btree:
56 rte_free(mr);
57
58fail_alloc:
59 ibv_dereg_mr(ibv_mr);
60
61 return ret;
62}
63
64static void
65mp_init_msg(struct rte_mp_msg *msg, enum mana_mp_req_type type, int port_id)

Callers 1

mana_mp_primary_handleFunction · 0.85

Calls 5

rte_callocFunction · 0.85
mana_mr_btree_insertFunction · 0.85
rte_freeFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected