| 3069 | } |
| 3070 | |
| 3071 | int __rte_cold |
| 3072 | ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, |
| 3073 | uint16_t queue_idx, |
| 3074 | uint16_t nb_desc, |
| 3075 | unsigned int socket_id, |
| 3076 | const struct rte_eth_rxconf *rx_conf, |
| 3077 | struct rte_mempool *mp) |
| 3078 | { |
| 3079 | const struct rte_memzone *rz; |
| 3080 | struct ixgbe_rx_queue *rxq; |
| 3081 | struct ixgbe_hw *hw; |
| 3082 | uint16_t len; |
| 3083 | struct ixgbe_adapter *adapter = dev->data->dev_private; |
| 3084 | uint64_t offloads; |
| 3085 | |
| 3086 | PMD_INIT_FUNC_TRACE(); |
| 3087 | hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); |
| 3088 | |
| 3089 | offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads; |
| 3090 | |
| 3091 | /* |
| 3092 | * Validate number of receive descriptors. |
| 3093 | * It must not exceed hardware maximum, and must be multiple |
| 3094 | * of IXGBE_ALIGN. |
| 3095 | */ |
| 3096 | if (nb_desc % IXGBE_RXD_ALIGN != 0 || |
| 3097 | (nb_desc > IXGBE_MAX_RING_DESC) || |
| 3098 | (nb_desc < IXGBE_MIN_RING_DESC)) { |
| 3099 | return -EINVAL; |
| 3100 | } |
| 3101 | |
| 3102 | /* Free memory prior to re-allocation if needed... */ |
| 3103 | if (dev->data->rx_queues[queue_idx] != NULL) { |
| 3104 | ixgbe_rx_queue_release(dev->data->rx_queues[queue_idx]); |
| 3105 | dev->data->rx_queues[queue_idx] = NULL; |
| 3106 | } |
| 3107 | |
| 3108 | /* First allocate the rx queue data structure */ |
| 3109 | rxq = rte_zmalloc_socket("ethdev RX queue", sizeof(struct ixgbe_rx_queue), |
| 3110 | RTE_CACHE_LINE_SIZE, socket_id); |
| 3111 | if (rxq == NULL) |
| 3112 | return -ENOMEM; |
| 3113 | rxq->mb_pool = mp; |
| 3114 | rxq->nb_rx_desc = nb_desc; |
| 3115 | rxq->rx_free_thresh = rx_conf->rx_free_thresh; |
| 3116 | rxq->queue_id = queue_idx; |
| 3117 | rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ? |
| 3118 | queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx); |
| 3119 | rxq->port_id = dev->data->port_id; |
| 3120 | if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC) |
| 3121 | rxq->crc_len = RTE_ETHER_CRC_LEN; |
| 3122 | else |
| 3123 | rxq->crc_len = 0; |
| 3124 | rxq->drop_en = rx_conf->rx_drop_en; |
| 3125 | rxq->rx_deferred_start = rx_conf->rx_deferred_start; |
| 3126 | rxq->offloads = offloads; |
| 3127 | |
| 3128 | /* |
nothing calls this directly
no test coverage detected