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

Function i40e_fdir_setup_tx_resources

dpdk/drivers/net/i40e/i40e_rxtx.c:3061–3118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3059}
3060
3061enum i40e_status_code
3062i40e_fdir_setup_tx_resources(struct i40e_pf *pf)
3063{
3064 struct i40e_tx_queue *txq;
3065 const struct rte_memzone *tz = NULL;
3066 struct rte_eth_dev *dev;
3067 uint32_t ring_size;
3068
3069 if (!pf) {
3070 PMD_DRV_LOG(ERR, "PF is not available");
3071 return I40E_ERR_BAD_PTR;
3072 }
3073
3074 dev = &rte_eth_devices[pf->dev_data->port_id];
3075
3076 /* Allocate the TX queue data structure. */
3077 txq = rte_zmalloc_socket("i40e fdir tx queue",
3078 sizeof(struct i40e_tx_queue),
3079 RTE_CACHE_LINE_SIZE,
3080 SOCKET_ID_ANY);
3081 if (!txq) {
3082 PMD_DRV_LOG(ERR, "Failed to allocate memory for "
3083 "tx queue structure.");
3084 return I40E_ERR_NO_MEMORY;
3085 }
3086
3087 /* Allocate TX hardware ring descriptors. */
3088 ring_size = sizeof(struct i40e_tx_desc) * I40E_FDIR_NUM_TX_DESC;
3089 ring_size = RTE_ALIGN(ring_size, I40E_DMA_MEM_ALIGN);
3090
3091 tz = rte_eth_dma_zone_reserve(dev, "fdir_tx_ring",
3092 I40E_FDIR_QUEUE_ID, ring_size,
3093 I40E_RING_BASE_ALIGN, SOCKET_ID_ANY);
3094 if (!tz) {
3095 i40e_tx_queue_release(txq);
3096 PMD_DRV_LOG(ERR, "Failed to reserve DMA memory for TX.");
3097 return I40E_ERR_NO_MEMORY;
3098 }
3099
3100 txq->mz = tz;
3101 txq->nb_tx_desc = I40E_FDIR_NUM_TX_DESC;
3102 txq->queue_id = I40E_FDIR_QUEUE_ID;
3103 txq->reg_idx = pf->fdir.fdir_vsi->base_queue;
3104 txq->vsi = pf->fdir.fdir_vsi;
3105
3106 txq->tx_ring_phys_addr = tz->iova;
3107 txq->tx_ring = (struct i40e_tx_desc *)tz->addr;
3108
3109 /*
3110 * don't need to allocate software ring and reset for the fdir
3111 * program queue just set the queue has been configured.
3112 */
3113 txq->q_set = TRUE;
3114 pf->fdir.txq = txq;
3115 pf->fdir.txq_available_buf_count = I40E_FDIR_PRG_PKT_CNT;
3116
3117 return I40E_SUCCESS;
3118}

Callers 1

i40e_fdir_setupFunction · 0.85

Calls 3

rte_zmalloc_socketFunction · 0.85
rte_eth_dma_zone_reserveFunction · 0.85
i40e_tx_queue_releaseFunction · 0.85

Tested by

no test coverage detected