コード例 #1
0
ファイル: ecore_ooo.c プロジェクト: FreeBSDFoundation/freebsd
void ecore_ooo_release_all_isles(struct ecore_ooo_info *p_ooo_info)
{
	struct ecore_ooo_archipelago *p_archipelago;
	struct ecore_ooo_buffer *p_buffer;
	struct ecore_ooo_isle *p_isle;
	u32 i;

	for (i = 0; i < p_ooo_info->max_num_archipelagos; i++) {
		p_archipelago = &(p_ooo_info->p_archipelagos_mem[i]);

#if defined(_NTDDK_)
#pragma warning(suppress : 6011 28182)
#endif
		while (!OSAL_LIST_IS_EMPTY(&p_archipelago->isles_list)) {
			p_isle = OSAL_LIST_FIRST_ENTRY(
					&p_archipelago->isles_list,
					struct ecore_ooo_isle, list_entry);

#if defined(_NTDDK_)
#pragma warning(suppress : 6011 28182)
#endif
			OSAL_LIST_REMOVE_ENTRY(&p_isle->list_entry,
					       &p_archipelago->isles_list);

			while (!OSAL_LIST_IS_EMPTY(&p_isle->buffers_list)) {
				p_buffer =
					OSAL_LIST_FIRST_ENTRY(
					&p_isle->buffers_list ,
					struct ecore_ooo_buffer, list_entry);

				if (p_buffer == OSAL_NULL)
					break;
#if defined(_NTDDK_)
#pragma warning(suppress : 6011 28182)
#endif
				OSAL_LIST_REMOVE_ENTRY(&p_buffer->list_entry,
						      &p_isle->buffers_list);
				OSAL_LIST_PUSH_TAIL(&p_buffer->list_entry,
					&p_ooo_info->free_buffers_list);
			}
			OSAL_LIST_PUSH_TAIL(&p_isle->list_entry,
				&p_ooo_info->free_isles_list);
		}
	}
	if (!OSAL_LIST_IS_EMPTY(&p_ooo_info->ready_buffers_list)) {
		OSAL_LIST_SPLICE_TAIL_INIT(&p_ooo_info->ready_buffers_list,
					  &p_ooo_info->free_buffers_list);
	}
}
コード例 #2
0
struct ecore_ptt *ecore_ptt_acquire(struct ecore_hwfn *p_hwfn)
{
	struct ecore_ptt *p_ptt;
	unsigned int i;

	/* Take the free PTT from the list */
	for (i = 0; i < ECORE_BAR_ACQUIRE_TIMEOUT; i++) {
		OSAL_SPIN_LOCK(&p_hwfn->p_ptt_pool->lock);
		if (!OSAL_LIST_IS_EMPTY(&p_hwfn->p_ptt_pool->free_list)) {
			p_ptt = OSAL_LIST_FIRST_ENTRY(
						&p_hwfn->p_ptt_pool->free_list,
						struct ecore_ptt, list_entry);
			OSAL_LIST_REMOVE_ENTRY(&p_ptt->list_entry,
					       &p_hwfn->p_ptt_pool->free_list);

			OSAL_SPIN_UNLOCK(&p_hwfn->p_ptt_pool->lock);

			DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
				   "allocated ptt %d\n", p_ptt->idx);

			return p_ptt;
		}

		OSAL_SPIN_UNLOCK(&p_hwfn->p_ptt_pool->lock);
		OSAL_MSLEEP(1);
	}
コード例 #3
0
ファイル: ecore_ooo.c プロジェクト: FreeBSDFoundation/freebsd
void ecore_ooo_free(struct ecore_hwfn *p_hwfn)
{
	struct ecore_ooo_info *p_ooo_info = p_hwfn->p_ooo_info;
	struct ecore_ooo_buffer *p_buffer;

	if (!p_ooo_info)
		return;

	ecore_ooo_release_all_isles(p_ooo_info);
	while (!OSAL_LIST_IS_EMPTY(&p_ooo_info->free_buffers_list)) {
		p_buffer = OSAL_LIST_FIRST_ENTRY(&p_ooo_info->
						 free_buffers_list,
						 struct ecore_ooo_buffer,
						 list_entry);
		if (p_buffer == OSAL_NULL)
			break;
#if defined(_NTDDK_)
#pragma warning(suppress : 6011 28182)
#endif
		OSAL_LIST_REMOVE_ENTRY(&p_buffer->list_entry,
				       &p_ooo_info->free_buffers_list);
		OSAL_DMA_FREE_COHERENT(p_hwfn->p_dev,
				       p_buffer->rx_buffer_virt_addr,
				       p_buffer->rx_buffer_phys_addr,
				       p_buffer->rx_buffer_size);
		OSAL_FREE(p_hwfn->p_dev, p_buffer);
	}

	OSAL_FREE(p_hwfn->p_dev, p_ooo_info->p_isles_mem);
	OSAL_FREE(p_hwfn->p_dev, p_ooo_info->p_archipelagos_mem);
	OSAL_FREE(p_hwfn->p_dev, p_ooo_info->ooo_history.p_cqes);
	OSAL_FREE(p_hwfn->p_dev, p_ooo_info);
	p_hwfn->p_ooo_info = OSAL_NULL;
}
コード例 #4
0
ファイル: ecore_ooo.c プロジェクト: FreeBSDFoundation/freebsd
void ecore_ooo_release_connection_isles(struct ecore_ooo_info *p_ooo_info,
					u32 cid)
{
	struct ecore_ooo_archipelago *p_archipelago;
	struct ecore_ooo_buffer *p_buffer;
	struct ecore_ooo_isle *p_isle;

	p_archipelago = ecore_ooo_seek_archipelago(p_ooo_info, cid);
	if (!p_archipelago)
		return;

	while (!OSAL_LIST_IS_EMPTY(&p_archipelago->isles_list)) {
		p_isle = OSAL_LIST_FIRST_ENTRY(
				&p_archipelago->isles_list,
				struct ecore_ooo_isle, list_entry);

#if defined(_NTDDK_)
#pragma warning(suppress : 6011 28182)
#endif
		OSAL_LIST_REMOVE_ENTRY(&p_isle->list_entry,
				       &p_archipelago->isles_list);

		while (!OSAL_LIST_IS_EMPTY(&p_isle->buffers_list)) {
			p_buffer =
				OSAL_LIST_FIRST_ENTRY(
				&p_isle->buffers_list ,
				struct ecore_ooo_buffer, list_entry);

			if (p_buffer == OSAL_NULL)
				break;
#if defined(_NTDDK_)
#pragma warning(suppress : 6011 28182)
#endif
			OSAL_LIST_REMOVE_ENTRY(&p_buffer->list_entry,
				      	       &p_isle->buffers_list);
				OSAL_LIST_PUSH_TAIL(&p_buffer->list_entry,
						&p_ooo_info->free_buffers_list);
			}
			OSAL_LIST_PUSH_TAIL(&p_isle->list_entry,
					&p_ooo_info->free_isles_list);
		}

}
コード例 #5
0
ファイル: ecore_ooo.c プロジェクト: FreeBSDFoundation/freebsd
struct ecore_ooo_buffer *
ecore_ooo_get_free_buffer(struct ecore_ooo_info *p_ooo_info)
{
	struct ecore_ooo_buffer	*p_buffer = OSAL_NULL;

	if (!OSAL_LIST_IS_EMPTY(&p_ooo_info->free_buffers_list)) {
		p_buffer =
			OSAL_LIST_FIRST_ENTRY(
			&p_ooo_info->free_buffers_list,
			struct ecore_ooo_buffer, list_entry);

		OSAL_LIST_REMOVE_ENTRY(&p_buffer->list_entry,
				      &p_ooo_info->free_buffers_list);
	}
コード例 #6
0
ファイル: ecore_ooo.c プロジェクト: FreeBSDFoundation/freebsd
static struct ecore_ooo_archipelago *
ecore_ooo_seek_archipelago(struct ecore_ooo_info *p_ooo_info, u32 cid)
{
	u32 idx = (cid & 0xffff) - p_ooo_info->cid_base;
	struct ecore_ooo_archipelago *p_archipelago;

	if (idx >= p_ooo_info->max_num_archipelagos)
		return OSAL_NULL;

	p_archipelago = &p_ooo_info->p_archipelagos_mem[idx];

	if (OSAL_LIST_IS_EMPTY(&p_archipelago->isles_list))
		return OSAL_NULL;

	return p_archipelago;
}