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

Function vmxnet3_dev_rx_queue_setup

dpdk/drivers/net/vmxnet3/vmxnet3_rxtx.c:1189–1318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1187}
1188
1189int
1190vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev,
1191 uint16_t queue_idx,
1192 uint16_t nb_desc,
1193 unsigned int socket_id,
1194 __rte_unused const struct rte_eth_rxconf *rx_conf,
1195 struct rte_mempool *mp)
1196{
1197 const struct rte_memzone *mz;
1198 struct vmxnet3_rx_queue *rxq;
1199 struct vmxnet3_hw *hw = dev->data->dev_private;
1200 struct vmxnet3_cmd_ring *ring0, *ring1, *ring;
1201 struct vmxnet3_comp_ring *comp_ring;
1202 struct vmxnet3_rx_data_ring *data_ring;
1203 int size;
1204 uint8_t i;
1205 char mem_name[32];
1206
1207 PMD_INIT_FUNC_TRACE();
1208
1209 rxq = rte_zmalloc("ethdev_rx_queue", sizeof(struct vmxnet3_rx_queue),
1210 RTE_CACHE_LINE_SIZE);
1211 if (rxq == NULL) {
1212 PMD_INIT_LOG(ERR, "Can not allocate rx queue structure");
1213 return -ENOMEM;
1214 }
1215
1216 rxq->mp = mp;
1217 /* Remember buffer size for initialization in dev start. */
1218 hw->rxdata_buf_size =
1219 rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM;
1220 rxq->queue_id = queue_idx;
1221 rxq->port_id = dev->data->port_id;
1222 rxq->shared = NULL; /* set in vmxnet3_setup_driver_shared() */
1223 rxq->hw = hw;
1224 rxq->qid1 = queue_idx;
1225 rxq->qid2 = queue_idx + hw->num_rx_queues;
1226 rxq->data_ring_qid = queue_idx + 2 * hw->num_rx_queues;
1227 rxq->data_desc_size = hw->rxdata_desc_size;
1228 rxq->stopped = TRUE;
1229
1230 ring0 = &rxq->cmd_ring[0];
1231 ring1 = &rxq->cmd_ring[1];
1232 comp_ring = &rxq->comp_ring;
1233 data_ring = &rxq->data_ring;
1234
1235 /* Rx vmxnet rings length should be between 256-4096 */
1236 if (nb_desc < VMXNET3_DEF_RX_RING_SIZE) {
1237 PMD_INIT_LOG(ERR, "VMXNET3 Rx Ring Size Min: 256");
1238 return -EINVAL;
1239 } else if (nb_desc > VMXNET3_RX_RING_MAX_SIZE) {
1240 PMD_INIT_LOG(ERR, "VMXNET3 Rx Ring Size Max: 4096");
1241 return -EINVAL;
1242 } else {
1243 ring0->size = nb_desc;
1244 if (VMXNET3_VERSION_GE_7(hw))
1245 ring0->size = rte_align32prevpow2(nb_desc);
1246 ring0->size &= ~VMXNET3_RING_SIZE_MASK;

Callers

nothing calls this directly

Calls 6

rte_zmallocFunction · 0.85
rte_eth_dma_zone_reserveFunction · 0.85
memsetFunction · 0.85
snprintfFunction · 0.85
rte_align32prevpow2Function · 0.50

Tested by

no test coverage detected