| 1095 | } |
| 1096 | |
| 1097 | int |
| 1098 | cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id) |
| 1099 | { |
| 1100 | struct cpfl_rx_queue *cpfl_rxq; |
| 1101 | struct idpf_rx_queue *rxq; |
| 1102 | uint16_t max_pkt_len; |
| 1103 | uint32_t frame_size; |
| 1104 | int err; |
| 1105 | |
| 1106 | if (rx_queue_id >= dev->data->nb_rx_queues) |
| 1107 | return -EINVAL; |
| 1108 | |
| 1109 | cpfl_rxq = dev->data->rx_queues[rx_queue_id]; |
| 1110 | rxq = &cpfl_rxq->base; |
| 1111 | |
| 1112 | if (rxq == NULL || !rxq->q_set) { |
| 1113 | PMD_DRV_LOG(ERR, "RX queue %u not available or setup", |
| 1114 | rx_queue_id); |
| 1115 | return -EINVAL; |
| 1116 | } |
| 1117 | |
| 1118 | frame_size = dev->data->mtu + CPFL_ETH_OVERHEAD; |
| 1119 | |
| 1120 | max_pkt_len = |
| 1121 | RTE_MIN((uint32_t)CPFL_SUPPORT_CHAIN_NUM * rxq->rx_buf_len, |
| 1122 | frame_size); |
| 1123 | |
| 1124 | rxq->max_pkt_len = max_pkt_len; |
| 1125 | if ((dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) || |
| 1126 | frame_size > rxq->rx_buf_len) |
| 1127 | dev->data->scattered_rx = 1; |
| 1128 | |
| 1129 | err = idpf_qc_ts_mbuf_register(rxq); |
| 1130 | if (err != 0) { |
| 1131 | PMD_DRV_LOG(ERR, "fail to register timestamp mbuf %u", |
| 1132 | rx_queue_id); |
| 1133 | return -EIO; |
| 1134 | } |
| 1135 | |
| 1136 | if (rxq->adapter->is_rx_singleq) { |
| 1137 | /* Single queue */ |
| 1138 | err = idpf_qc_single_rxq_mbufs_alloc(rxq); |
| 1139 | if (err != 0) { |
| 1140 | PMD_DRV_LOG(ERR, "Failed to allocate RX queue mbuf"); |
| 1141 | return err; |
| 1142 | } |
| 1143 | |
| 1144 | rte_wmb(); |
| 1145 | |
| 1146 | /* Init the RX tail register. */ |
| 1147 | IDPF_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); |
| 1148 | } else { |
| 1149 | /* Split queue */ |
| 1150 | if (cpfl_rxq->hairpin_info.hairpin_q) { |
| 1151 | err = cpfl_alloc_split_p2p_rxq_mbufs(rxq->bufq1); |
| 1152 | if (err != 0) { |
| 1153 | PMD_DRV_LOG(ERR, "Failed to allocate p2p RX buffer queue mbuf"); |
| 1154 | return err; |
no test coverage detected