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

Function ngbe_dev_rx_queue_setup

dpdk/drivers/net/ngbe/ngbe_rxtx.c:2225–2352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2223}
2224
2225int
2226ngbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
2227 uint16_t queue_idx,
2228 uint16_t nb_desc,
2229 unsigned int socket_id,
2230 const struct rte_eth_rxconf *rx_conf,
2231 struct rte_mempool *mp)
2232{
2233 const struct rte_memzone *rz;
2234 struct ngbe_rx_queue *rxq;
2235 struct ngbe_hw *hw;
2236 uint16_t len;
2237 struct ngbe_adapter *adapter = ngbe_dev_adapter(dev);
2238 uint64_t offloads;
2239
2240 PMD_INIT_FUNC_TRACE();
2241 hw = ngbe_dev_hw(dev);
2242
2243 offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads;
2244
2245 /* Free memory prior to re-allocation if needed... */
2246 if (dev->data->rx_queues[queue_idx] != NULL) {
2247 ngbe_rx_queue_release(dev->data->rx_queues[queue_idx]);
2248 dev->data->rx_queues[queue_idx] = NULL;
2249 }
2250
2251 /* First allocate the Rx queue data structure */
2252 rxq = rte_zmalloc_socket("ethdev RX queue",
2253 sizeof(struct ngbe_rx_queue),
2254 RTE_CACHE_LINE_SIZE, socket_id);
2255 if (rxq == NULL)
2256 return -ENOMEM;
2257 rxq->mb_pool = mp;
2258 rxq->nb_rx_desc = nb_desc;
2259 rxq->rx_free_thresh = rx_conf->rx_free_thresh;
2260 rxq->queue_id = queue_idx;
2261 rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
2262 queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
2263 rxq->port_id = dev->data->port_id;
2264 if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC)
2265 rxq->crc_len = RTE_ETHER_CRC_LEN;
2266 else
2267 rxq->crc_len = 0;
2268 rxq->drop_en = rx_conf->rx_drop_en;
2269 rxq->rx_deferred_start = rx_conf->rx_deferred_start;
2270 rxq->offloads = offloads;
2271
2272 /*
2273 * Allocate Rx ring hardware descriptors. A memzone large enough to
2274 * handle the maximum ring size is allocated in order to allow for
2275 * resizing in later calls to the queue setup function.
2276 */
2277 rz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_idx,
2278 RX_RING_SZ, NGBE_ALIGN, socket_id);
2279 if (rz == NULL) {
2280 ngbe_rx_queue_release(rxq);
2281 return -ENOMEM;
2282 }

Callers

nothing calls this directly

Calls 8

ngbe_dev_adapterFunction · 0.85
ngbe_dev_hwFunction · 0.85
ngbe_rx_queue_releaseFunction · 0.85
rte_zmalloc_socketFunction · 0.85
rte_eth_dma_zone_reserveFunction · 0.85
memsetFunction · 0.85
ngbe_reset_rx_queueFunction · 0.85

Tested by

no test coverage detected