* * @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[in] conf * Thresholds parameters. * @param mp * Memory pool for buffer allocations. * * @return * 0 on success, a negative errno value otherwise and r
| 843 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 844 | */ |
| 845 | int |
| 846 | mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, |
| 847 | unsigned int socket, const struct rte_eth_rxconf *conf, |
| 848 | struct rte_mempool *mp) |
| 849 | { |
| 850 | struct mlx5_priv *priv = dev->data->dev_private; |
| 851 | struct mlx5_rxq_priv *rxq; |
| 852 | struct mlx5_rxq_ctrl *rxq_ctrl = NULL; |
| 853 | struct rte_eth_rxseg_split *rx_seg = |
| 854 | (struct rte_eth_rxseg_split *)conf->rx_seg; |
| 855 | struct rte_eth_rxseg_split rx_single = {.mp = mp}; |
| 856 | uint16_t n_seg = conf->rx_nseg; |
| 857 | int res; |
| 858 | uint64_t offloads = conf->offloads | |
| 859 | dev->data->dev_conf.rxmode.offloads; |
| 860 | bool is_extmem = false; |
| 861 | |
| 862 | if ((offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO) && |
| 863 | !priv->sh->config.lro_allowed) { |
| 864 | DRV_LOG(ERR, |
| 865 | "Port %u queue %u LRO is configured but not allowed.", |
| 866 | dev->data->port_id, idx); |
| 867 | rte_errno = EINVAL; |
| 868 | return -rte_errno; |
| 869 | } |
| 870 | if (mp) { |
| 871 | /* |
| 872 | * The parameters should be checked on rte_eth_dev layer. |
| 873 | * If mp is specified it means the compatible configuration |
| 874 | * without buffer split feature tuning. |
| 875 | */ |
| 876 | rx_seg = &rx_single; |
| 877 | n_seg = 1; |
| 878 | is_extmem = rte_pktmbuf_priv_flags(mp) & |
| 879 | RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF; |
| 880 | } |
| 881 | if (n_seg > 1) { |
| 882 | /* The offloads should be checked on rte_eth_dev layer. */ |
| 883 | MLX5_ASSERT(offloads & RTE_ETH_RX_OFFLOAD_SCATTER); |
| 884 | if (!(offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) { |
| 885 | DRV_LOG(ERR, "port %u queue index %u split " |
| 886 | "offload not configured", |
| 887 | dev->data->port_id, idx); |
| 888 | rte_errno = ENOSPC; |
| 889 | return -rte_errno; |
| 890 | } |
| 891 | MLX5_ASSERT(n_seg < MLX5_MAX_RXQ_NSEG); |
| 892 | } |
| 893 | if (conf->share_group > 0) { |
| 894 | if (!priv->sh->cdev->config.hca_attr.mem_rq_rmp) { |
| 895 | DRV_LOG(ERR, "port %u queue index %u shared Rx queue not supported by fw", |
| 896 | dev->data->port_id, idx); |
| 897 | rte_errno = EINVAL; |
| 898 | return -rte_errno; |
| 899 | } |
| 900 | if (priv->obj_ops.rxq_obj_new != devx_obj_ops.rxq_obj_new) { |
| 901 | DRV_LOG(ERR, "port %u queue index %u shared Rx queue needs DevX api", |
| 902 | dev->data->port_id, idx); |
nothing calls this directly
no test coverage detected