| 605 | } |
| 606 | |
| 607 | int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, |
| 608 | uint16_t queue_idx, uint16_t nb_desc, |
| 609 | unsigned int socket_id, |
| 610 | const struct rte_eth_rxconf *rx_conf __rte_unused, |
| 611 | struct rte_mempool *mp) |
| 612 | { |
| 613 | unsigned int pkt_len = eth_dev->data->mtu + RTE_ETHER_HDR_LEN + |
| 614 | RTE_ETHER_CRC_LEN; |
| 615 | struct port_info *pi = eth_dev->data->dev_private; |
| 616 | struct adapter *adapter = pi->adapter; |
| 617 | struct rte_eth_dev_info dev_info; |
| 618 | struct sge *s = &adapter->sge; |
| 619 | unsigned int temp_nb_desc; |
| 620 | int err = 0, msi_idx = 0; |
| 621 | struct sge_eth_rxq *rxq; |
| 622 | |
| 623 | rxq = &s->ethrxq[pi->first_rxqset + queue_idx]; |
| 624 | dev_debug(adapter, "%s: eth_dev->data->nb_rx_queues = %d; queue_idx = %d; nb_desc = %d; socket_id = %d; mp = %p\n", |
| 625 | __func__, eth_dev->data->nb_rx_queues, queue_idx, nb_desc, |
| 626 | socket_id, mp); |
| 627 | |
| 628 | err = cxgbe_dev_info_get(eth_dev, &dev_info); |
| 629 | if (err != 0) { |
| 630 | dev_err(adap, "%s: error during getting ethernet device info", |
| 631 | __func__); |
| 632 | return err; |
| 633 | } |
| 634 | |
| 635 | /* Must accommodate at least RTE_ETHER_MIN_MTU */ |
| 636 | if ((pkt_len < dev_info.min_rx_bufsize) || |
| 637 | (pkt_len > dev_info.max_rx_pktlen)) { |
| 638 | dev_err(adap, "%s: max pkt len must be > %d and <= %d\n", |
| 639 | __func__, dev_info.min_rx_bufsize, |
| 640 | dev_info.max_rx_pktlen); |
| 641 | return -EINVAL; |
| 642 | } |
| 643 | |
| 644 | /* Free up the existing queue */ |
| 645 | if (eth_dev->data->rx_queues[queue_idx]) { |
| 646 | cxgbe_dev_rx_queue_release(eth_dev, queue_idx); |
| 647 | eth_dev->data->rx_queues[queue_idx] = NULL; |
| 648 | } |
| 649 | |
| 650 | eth_dev->data->rx_queues[queue_idx] = (void *)rxq; |
| 651 | |
| 652 | /* Sanity Checking |
| 653 | * |
| 654 | * nb_desc should be > 0 and <= CXGBE_MAX_RING_DESC_SIZE |
| 655 | */ |
| 656 | temp_nb_desc = nb_desc; |
| 657 | if (nb_desc < CXGBE_MIN_RING_DESC_SIZE) { |
| 658 | dev_warn(adapter, "%s: number of descriptors must be >= %d. Using default [%d]\n", |
| 659 | __func__, CXGBE_MIN_RING_DESC_SIZE, |
| 660 | CXGBE_DEFAULT_RX_DESC_SIZE); |
| 661 | temp_nb_desc = CXGBE_DEFAULT_RX_DESC_SIZE; |
| 662 | } else if (nb_desc > CXGBE_MAX_RING_DESC_SIZE) { |
| 663 | dev_err(adapter, "%s: number of descriptors must be between %d and %d inclusive. Default [%d]\n", |
| 664 | __func__, CXGBE_MIN_RING_DESC_SIZE, |
nothing calls this directly
no test coverage detected