Hi all,<br>I am trying to use the CM mechanism in the kernal space and come across a problem while creating a service:<br><br><span style="font-size: 10.5pt; font-family: "Times New Roman";" lang="EN-US">[IB_CM][ib_cm_service_create][drivers/infiniband/ib_cm/cm_service_table.c:198]Conflict
between 000000000000b0e0/ffffffffffffffff and 0000000000000000/ffffffffffff0000</span><br clear="all"><br>I am not very clear of the rules while using the Service ID and the Service Mask, could anybody give an explaination?
<br>Thanks very much and here are a piece of my code and the relative code in IBGD-1.8.0:<br><br>================================================================<br>#define TS_KVAPITEST_MSG_SERVICE_ID_VALUE (0xb0e0ULL)<br>
#define TS_KVAPITEST_MSG_SERVICE_ID_MASK (0xFFFFFFFFFFFF0000ULL)<br><br> res = ib_cm_listen(TS_KVAPITEST_MSG_SERVICE_ID_VALUE,<br> TS_KVAPITEST_MSG_SERVICE_ID_MASK,<br> params_p->ib_res.call_back_func,
<br> params_p->ib_res.arg,<br> ¶ms_p->ib_res.listen_hndl);<br> <br>================================================================<br>int ib_cm_service_create(tTS_IB_SERVICE_ID service_id,
<br> tTS_IB_SERVICE_ID service_mask,<br> struct ib_cm_service **service)<br>{<br> struct ib_cm_tree_node *node;<br> struct ib_cm_tree_node *new_node = NULL;<br> struct ib_cm_tree_node *new_parent = NULL;
<br> u64 bit, mask;<br> int child_num;<br> int ret;<br> TS_WINDOWS_SPINLOCK_FLAGS<br><br> *service = NULL;<br><br> new_node = kmem_cache_alloc(node_cache, GFP_KERNEL);<br> new_parent = kmem_cache_alloc(node_cache, GFP_KERNEL);
<br> *service = kmem_cache_alloc(service_cache, GFP_KERNEL);<br><br> if (!new_node || !new_parent || !*service) {<br> ret = -ENOMEM;<br> goto out_free;<br> }<br><br> new_node->id = service_id;
<br> new_node->mask = service_mask;<br> new_node->bit = 0;<br> new_node->ptr.service = *service;<br><br> spin_lock(&tree_lock);<br><br> node = ib_cm_tree_search(service_id, service_mask);
<br><br> if (node) {<br> if ((service_mask & node->id) == (node->mask & service_id)) {<br> TS_REPORT_WARN(MOD_IB_CM,<br> "Conflict between %016" TS_U64_FMT "x/%016" TS_U64_FMT "x "
<br> "and %016" TS_U64_FMT "x/%016" TS_U64_FMT "x",<br> node->id, node->mask,<br> service_id, service_mask);<br> ret = -EADDRINUSE;
<br> goto out;<br> }<br><br> /* find the first bit where we're different -- if there isn't one,<br> then we conflict with the previous service */<br> for (mask = 0x0ULL, bit = 0x8000000000000000ULL;
<br> bit;<br> mask |= bit, bit >>= 1) {<br> if ((bit & service_id) != (bit & node->id))<br> break;<br> }<br><br> if (!bit || mask >= node->mask) {
<br> TS_REPORT_WARN(MOD_IB_CM,<br> "Couldn't find a difference: %016" TS_U64_FMT "x/%016" TS_U64_FMT "x "<br> "and %016" TS_U64_FMT "x/%016" TS_U64_FMT "x",
<br> node->id, node->mask,<br> service_id, service_mask);<br> ret = -EINVAL;<br> goto out;<br> }<br><br> new_parent->id = service_id & mask;
<br> new_parent->mask = mask;<br> new_parent->bit = bit;<br> new_parent->parent = node->parent;<br> new_parent->child_num = node->child_num;<br> if (node->parent) {
<br> node->parent->ptr.child[node->child_num] = new_parent;<br> } else {<br> service_tree = new_parent;<br> }<br><br> child_num = !!(bit & service_id);<br> new_parent->
ptr.child[ child_num] = new_node;<br> new_node->parent = new_parent;<br> new_node->child_num = child_num;<br> new_parent->ptr.child[!child_num] = node;<br> node->parent = new_parent;
<br> node->child_num = !child_num;<br> } else {<br> if (service_tree) {<br> TS_REPORT_WARN(MOD_IB_CM,<br> "No parent found but tree not empty!");
<br> ret = -EINVAL;<br> goto out;<br> }<br><br> /* Don't need the new parent node for the first service we add */<br> kmem_cache_free(node_cache, new_parent);<br><br> service_tree = new_node;
<br> new_node->parent = NULL;<br> }<br><br> (*service)->node = new_node;<br> (*service)->freeing = 0;<br> init_MUTEX_LOCKED(&(*service)->mutex);<br><br> atomic_set(&(*service)->waiters, 0);
<br><br> spin_unlock(&tree_lock);<br><br> return 0;<br><br> out:<br> spin_unlock(&tree_lock);<br><br> out_free:<br> if (new_node)<br> kmem_cache_free(node_cache, new_node);<br><br> if (new_parent)
<br> kmem_cache_free(node_cache, new_parent);<br><br> if (*service)<br> kmem_cache_free(service_cache, *service);<br><br> return ret;<br>}<br><br><br>-- <br>Ian Jiang<br><a href="mailto:ianjiang.ict@gmail.com">
ianjiang.ict@gmail.com</a><br><br>Laboratory of Spatial Information Technology<br>Division of System Architecture<br>Institute of Computing Technology<br>Chinese Academy of Sciences