예제 #1
0
파일: sfc_tx.c 프로젝트: Leon555/dpdk
static int
sfc_efx_tx_qstart(struct sfc_dp_txq *dp_txq,
		  __rte_unused unsigned int evq_read_ptr,
		  unsigned int txq_desc_index)
{
	/* libefx-based datapath is specific to libefx-based PMD */
	struct sfc_efx_txq *txq = sfc_efx_txq_by_dp_txq(dp_txq);
	struct sfc_txq *ctrl_txq = sfc_txq_by_dp_txq(dp_txq);

	txq->common = ctrl_txq->common;

	txq->pending = txq->completed = txq->added = txq_desc_index;
	txq->hw_vlan_tci = 0;

	txq->flags |= (SFC_EFX_TXQ_FLAG_STARTED | SFC_EFX_TXQ_FLAG_RUNNING);

	return 0;
}
예제 #2
0
파일: sfc_ev.c 프로젝트: DrenfongWong/dpdk
static boolean_t
sfc_ev_txq_flush_done(void *arg, __rte_unused uint32_t txq_hw_index)
{
	struct sfc_evq *evq = arg;
	struct sfc_dp_txq *dp_txq;
	struct sfc_txq *txq;

	dp_txq = evq->dp_txq;
	SFC_ASSERT(dp_txq != NULL);

	txq = sfc_txq_by_dp_txq(dp_txq);
	SFC_ASSERT(txq != NULL);
	SFC_ASSERT(txq->hw_index == txq_hw_index);
	SFC_ASSERT(txq->evq == evq);
	sfc_tx_qflush_done(txq);

	return B_FALSE;
}
예제 #3
0
파일: sfc_tx.c 프로젝트: Leon555/dpdk
static int
sfc_efx_tx_qcreate(uint16_t port_id, uint16_t queue_id,
		   const struct rte_pci_addr *pci_addr,
		   int socket_id,
		   const struct sfc_dp_tx_qcreate_info *info,
		   struct sfc_dp_txq **dp_txqp)
{
	struct sfc_efx_txq *txq;
	struct sfc_txq *ctrl_txq;
	int rc;

	rc = ENOMEM;
	txq = rte_zmalloc_socket("sfc-efx-txq", sizeof(*txq),
				 RTE_CACHE_LINE_SIZE, socket_id);
	if (txq == NULL)
		goto fail_txq_alloc;

	sfc_dp_queue_init(&txq->dp.dpq, port_id, queue_id, pci_addr);

	rc = ENOMEM;
	txq->pend_desc = rte_calloc_socket("sfc-efx-txq-pend-desc",
					   EFX_TXQ_LIMIT(info->txq_entries),
					   sizeof(*txq->pend_desc), 0,
					   socket_id);
	if (txq->pend_desc == NULL)
		goto fail_pend_desc_alloc;

	rc = ENOMEM;
	txq->sw_ring = rte_calloc_socket("sfc-efx-txq-sw_ring",
					 info->txq_entries,
					 sizeof(*txq->sw_ring),
					 RTE_CACHE_LINE_SIZE, socket_id);
	if (txq->sw_ring == NULL)
		goto fail_sw_ring_alloc;

	ctrl_txq = sfc_txq_by_dp_txq(&txq->dp);
	if (ctrl_txq->evq->sa->tso) {
		rc = sfc_efx_tso_alloc_tsoh_objs(txq->sw_ring,
						 info->txq_entries, socket_id);
		if (rc != 0)
			goto fail_alloc_tsoh_objs;
	}

	txq->evq = ctrl_txq->evq;
	txq->ptr_mask = info->txq_entries - 1;
	txq->free_thresh = info->free_thresh;
	txq->dma_desc_size_max = info->dma_desc_size_max;

	*dp_txqp = &txq->dp;
	return 0;

fail_alloc_tsoh_objs:
	rte_free(txq->sw_ring);

fail_sw_ring_alloc:
	rte_free(txq->pend_desc);

fail_pend_desc_alloc:
	rte_free(txq);

fail_txq_alloc:
	return rc;
}