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

Function i40e_dev_rx_queue_setup

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

Source from the content-addressed store, hash-verified

1961}
1962
1963int
1964i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,
1965 uint16_t queue_idx,
1966 uint16_t nb_desc,
1967 unsigned int socket_id,
1968 const struct rte_eth_rxconf *rx_conf,
1969 struct rte_mempool *mp)
1970{
1971 struct i40e_adapter *ad =
1972 I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
1973 struct i40e_vsi *vsi;
1974 struct i40e_pf *pf = NULL;
1975 struct i40e_rx_queue *rxq;
1976 const struct rte_memzone *rz;
1977 uint32_t ring_size;
1978 uint16_t len, i;
1979 uint16_t reg_idx, base, bsf, tc_mapping;
1980 int q_offset, use_def_burst_func = 1;
1981 uint64_t offloads;
1982
1983 offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads;
1984
1985 pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
1986 vsi = i40e_pf_get_vsi_by_qindex(pf, queue_idx);
1987 if (!vsi)
1988 return -EINVAL;
1989 q_offset = i40e_get_queue_offset_by_qindex(pf, queue_idx);
1990 if (q_offset < 0)
1991 return -EINVAL;
1992 reg_idx = vsi->base_queue + q_offset;
1993
1994 if (nb_desc % I40E_ALIGN_RING_DESC != 0 ||
1995 (nb_desc > I40E_MAX_RING_DESC) ||
1996 (nb_desc < I40E_MIN_RING_DESC)) {
1997 PMD_DRV_LOG(ERR, "Number (%u) of receive descriptors is "
1998 "invalid", nb_desc);
1999 return -EINVAL;
2000 }
2001
2002 /* Free memory if needed */
2003 if (dev->data->rx_queues[queue_idx]) {
2004 i40e_rx_queue_release(dev->data->rx_queues[queue_idx]);
2005 dev->data->rx_queues[queue_idx] = NULL;
2006 }
2007
2008 /* Allocate the rx queue data structure */
2009 rxq = rte_zmalloc_socket("i40e rx queue",
2010 sizeof(struct i40e_rx_queue),
2011 RTE_CACHE_LINE_SIZE,
2012 socket_id);
2013 if (!rxq) {
2014 PMD_DRV_LOG(ERR, "Failed to allocate memory for "
2015 "rx queue data structure");
2016 return -ENOMEM;
2017 }
2018 rxq->mp = mp;
2019 rxq->nb_rx_desc = nb_desc;
2020 rxq->rx_free_thresh = rx_conf->rx_free_thresh;

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected