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

Function i40e_fdir_setup_rx_resources

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

Source from the content-addressed store, hash-verified

3118}
3119
3120enum i40e_status_code
3121i40e_fdir_setup_rx_resources(struct i40e_pf *pf)
3122{
3123 struct i40e_rx_queue *rxq;
3124 const struct rte_memzone *rz = NULL;
3125 uint32_t ring_size;
3126 struct rte_eth_dev *dev;
3127
3128 if (!pf) {
3129 PMD_DRV_LOG(ERR, "PF is not available");
3130 return I40E_ERR_BAD_PTR;
3131 }
3132
3133 dev = &rte_eth_devices[pf->dev_data->port_id];
3134
3135 /* Allocate the RX queue data structure. */
3136 rxq = rte_zmalloc_socket("i40e fdir rx queue",
3137 sizeof(struct i40e_rx_queue),
3138 RTE_CACHE_LINE_SIZE,
3139 SOCKET_ID_ANY);
3140 if (!rxq) {
3141 PMD_DRV_LOG(ERR, "Failed to allocate memory for "
3142 "rx queue structure.");
3143 return I40E_ERR_NO_MEMORY;
3144 }
3145
3146 /* Allocate RX hardware ring descriptors. */
3147 ring_size = sizeof(union i40e_rx_desc) * I40E_FDIR_NUM_RX_DESC;
3148 ring_size = RTE_ALIGN(ring_size, I40E_DMA_MEM_ALIGN);
3149
3150 rz = rte_eth_dma_zone_reserve(dev, "fdir_rx_ring",
3151 I40E_FDIR_QUEUE_ID, ring_size,
3152 I40E_RING_BASE_ALIGN, SOCKET_ID_ANY);
3153 if (!rz) {
3154 i40e_rx_queue_release(rxq);
3155 PMD_DRV_LOG(ERR, "Failed to reserve DMA memory for RX.");
3156 return I40E_ERR_NO_MEMORY;
3157 }
3158
3159 rxq->mz = rz;
3160 rxq->nb_rx_desc = I40E_FDIR_NUM_RX_DESC;
3161 rxq->queue_id = I40E_FDIR_QUEUE_ID;
3162 rxq->reg_idx = pf->fdir.fdir_vsi->base_queue;
3163 rxq->vsi = pf->fdir.fdir_vsi;
3164
3165 rxq->rx_ring_phys_addr = rz->iova;
3166 memset(rz->addr, 0, I40E_FDIR_NUM_RX_DESC * sizeof(union i40e_rx_desc));
3167 rxq->rx_ring = (union i40e_rx_desc *)rz->addr;
3168
3169 /*
3170 * Don't need to allocate software ring and reset for the fdir
3171 * rx queue, just set the queue has been configured.
3172 */
3173 rxq->q_set = TRUE;
3174 pf->fdir.rxq = rxq;
3175
3176 return I40E_SUCCESS;
3177}

Callers 1

i40e_fdir_setupFunction · 0.85

Calls 4

rte_zmalloc_socketFunction · 0.85
rte_eth_dma_zone_reserveFunction · 0.85
i40e_rx_queue_releaseFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected