VAPI_ret_t osmt_mtl_mad_create_mr(osmt_mtl_mad_res_t * res)
{

	VAPI_ret_t ret;

	VAPI_mrw_t mr_in, mr_out;

	res->buf_size =
	    (MAD_SIZE + GRH_LEN) * (res->max_outs_sq + res->max_outs_rq + 1);

	/* Register single memory address region for all buffers */
	res->buf_ptr = VMALLOC(res->buf_size);

	if (res->buf_ptr == ((VAPI_virt_addr_t) NULL)) {
		ret = VAPI_EAGAIN;
		VAPI_CHECK_RET;
	}

	/* Enable local and remote access to memory region */
	mr_in.acl = VAPI_EN_LOCAL_WRITE | VAPI_EN_REMOTE_WRITE;
	mr_in.l_key = 0;
	mr_in.pd_hndl = res->pd_hndl;
	mr_in.r_key = 0;
	mr_in.size = res->buf_size;
	ASSERT_VOIDP2UINTN(res->buf_ptr);
	mr_in.start = (VAPI_virt_addr_t) (res->buf_ptr);
	mr_in.type = VAPI_MR;

	ret = VAPI_register_mr(res->hca_hndl, &mr_in, &(res->mr_hndl), &mr_out);
	VAPI_CHECK_RET;

	res->l_key = mr_out.l_key;

	return (ret);
}
Example #2
0
VDLIST_API void VDLIST_CDECL vdlist_add_first(
	vdlist_t* vdlist,
	void* item) 
{
	vdlist_node_t* node;

	VMALLOC(vdlist, node, vdlist_node_t);
	node->item = item;
	node->prev = 0;
	
			
/* no item on the list */
	if (!vdlist->head) 
	{
		
		vdlist->tail=node;
		node->next = 0;
	}

	else
	{
		node->next = vdlist->head;
		vdlist->head->prev = node;

	}
	vdlist->head = node;

	vdlist->count++;

	VDLIST_RESET_CURSOR(vdlist)
}
Example #3
0
VDLIST_API void VDLIST_CDECL vdlist_add_before_cursor(
	vdlist_t* vdlist,
	void* item) 
{
	vdlist_node_t* node;

/* If there is no node on the list */

	if (!vdlist->cursor) {
		vdlist_add_first(vdlist,item);
		return;
	}

	VMALLOC(vdlist, node, vdlist_node_t);
	node->item = item;
	node->next = vdlist->cursor;

			/* added  for doubly linked list */
			
			if(vdlist->cursor == vdlist->head)
			{
				vdlist->cursor->prev = node;
				node->prev = 0;
				vdlist->head = node;
				
			}
			else
			{
				node->prev = vdlist->cursor->prev;
				vdlist->cursor->prev = node;
				node->prev->next = node;
			}

	vdlist->count++;
}
Example #4
0
VDLIST_API void VDLIST_CDECL vdlist_add_after_cursor(
	vdlist_t* vdlist,
	void* item) 
{
	vdlist_node_t* node;

	if (!vdlist->cursor) {
		vdlist_add_first(vdlist,item);
		return;
	}

	VMALLOC(vdlist, node, vdlist_node_t);
	node->item = item;
	node->next = vdlist->cursor->next;

		
	vdlist->cursor->next = node;
	if (vdlist->cursor == vdlist->tail) {
		vdlist->tail = node;
		/* added  for doubly linked list */
		node->prev = vdlist->cursor;
	

	}

	/* added  for doubly linked list */
	else
	{
			node->next->prev = node;
			node->prev = vdlist->cursor;
	}

	vdlist->count++;
}
Example #5
0
VDLIST_API void VDLIST_CDECL vdlist_add_last(
	vdlist_t* vdlist,
	void* item) 
{
	vdlist_node_t* node;

	if (!vdlist->head) {
		vdlist_add_first(vdlist,item);
		return;
	}

	VMALLOC(vdlist, node, vdlist_node_t);
	node->item = item;
	node->next = 0;

		/* added  for doubly linked list */
		node->prev = vdlist->tail;

	vdlist->tail->next = node;
	vdlist->tail = node;

	vdlist->count++;
}