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

Function mrvl_rx_queue_setup

dpdk/drivers/net/mvpp2/mrvl_ethdev.c:1988–2055  ·  view source on GitHub ↗

* DPDK callback to configure the receive queue. * * @param dev * Pointer to Ethernet device structure. * @param idx * RX queue index. * @param desc * Number of descriptors to configure in queue. * @param socket * NUMA socket on which memory must be allocated. * @param conf * Thresholds parameters. * @param mp * Memory pool for buffer allocations. * * @return * 0 on su

Source from the content-addressed store, hash-verified

1986 * 0 on success, negative error value otherwise.
1987 */
1988static int
1989mrvl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
1990 unsigned int socket,
1991 const struct rte_eth_rxconf *conf,
1992 struct rte_mempool *mp)
1993{
1994 struct mrvl_priv *priv = dev->data->dev_private;
1995 struct mrvl_rxq *rxq;
1996 uint32_t frame_size, buf_size = rte_pktmbuf_data_room_size(mp);
1997 uint32_t max_rx_pktlen = dev->data->mtu + RTE_ETHER_HDR_LEN;
1998 int ret, tc, inq;
1999 uint64_t offloads;
2000
2001 offloads = conf->offloads | dev->data->dev_conf.rxmode.offloads;
2002
2003 if (priv->rxq_map[idx].tc == MRVL_UNKNOWN_TC) {
2004 /*
2005 * Unknown TC mapping, mapping will not have a correct queue.
2006 */
2007 MRVL_LOG(ERR, "Unknown TC mapping for queue %hu eth%hhu",
2008 idx, priv->ppio_id);
2009 return -EFAULT;
2010 }
2011
2012 frame_size = buf_size - RTE_PKTMBUF_HEADROOM - MRVL_PKT_EFFEC_OFFS;
2013 if (frame_size < max_rx_pktlen) {
2014 MRVL_LOG(WARNING,
2015 "Mbuf size must be increased to %u bytes to hold up "
2016 "to %u bytes of data.",
2017 max_rx_pktlen + buf_size - frame_size,
2018 max_rx_pktlen);
2019 dev->data->mtu = frame_size - RTE_ETHER_HDR_LEN;
2020 MRVL_LOG(INFO, "Setting MTU to %u", dev->data->mtu);
2021 }
2022
2023 if (dev->data->rx_queues[idx]) {
2024 rte_free(dev->data->rx_queues[idx]);
2025 dev->data->rx_queues[idx] = NULL;
2026 }
2027
2028 rxq = rte_zmalloc_socket("rxq", sizeof(*rxq), 0, socket);
2029 if (!rxq)
2030 return -ENOMEM;
2031
2032 rxq->priv = priv;
2033 rxq->mp = mp;
2034 rxq->cksum_enabled = offloads & RTE_ETH_RX_OFFLOAD_IPV4_CKSUM;
2035 rxq->queue_id = idx;
2036 rxq->port_id = dev->data->port_id;
2037 mrvl_port_to_bpool_lookup[rxq->port_id] = priv->bpool;
2038
2039 tc = priv->rxq_map[rxq->queue_id].tc,
2040 inq = priv->rxq_map[rxq->queue_id].inq;
2041 priv->ppio_params.inqs_params.tcs_params[tc].inqs_params[inq].size =
2042 desc;
2043
2044 ret = mrvl_fill_bpool(rxq, desc);
2045 if (ret) {

Callers

nothing calls this directly

Calls 4

rte_freeFunction · 0.85
rte_zmalloc_socketFunction · 0.85
mrvl_fill_bpoolFunction · 0.85

Tested by

no test coverage detected