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

Function virtio_dev_free_mbufs

dpdk/drivers/net/virtio/virtio_ethdev.c:2431–2474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2429}
2430
2431static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
2432{
2433 struct virtio_hw *hw = dev->data->dev_private;
2434 uint16_t nr_vq = virtio_get_nr_vq(hw);
2435 const char *type __rte_unused;
2436 unsigned int i, mbuf_num = 0;
2437 struct virtqueue *vq;
2438 struct rte_mbuf *buf;
2439 int queue_type;
2440
2441 if (hw->vqs == NULL)
2442 return;
2443
2444 for (i = 0; i < nr_vq; i++) {
2445 vq = hw->vqs[i];
2446 if (!vq)
2447 continue;
2448
2449 queue_type = virtio_get_queue_type(hw, i);
2450 if (queue_type == VTNET_RQ)
2451 type = "rxq";
2452 else if (queue_type == VTNET_TQ)
2453 type = "txq";
2454 else
2455 continue;
2456
2457 PMD_INIT_LOG(DEBUG,
2458 "Before freeing %s[%d] used and unused buf",
2459 type, i);
2460 VIRTQUEUE_DUMP(vq);
2461
2462 while ((buf = virtqueue_detach_unused(vq)) != NULL) {
2463 rte_pktmbuf_free(buf);
2464 mbuf_num++;
2465 }
2466
2467 PMD_INIT_LOG(DEBUG,
2468 "After freeing %s[%d] used and unused buf",
2469 type, i);
2470 VIRTQUEUE_DUMP(vq);
2471 }
2472
2473 PMD_INIT_LOG(DEBUG, "%d mbufs freed", mbuf_num);
2474}
2475
2476static void
2477virtio_tx_completed_cleanup(struct rte_eth_dev *dev)

Callers 2

virtio_dev_closeFunction · 0.85
virtio_init_deviceFunction · 0.85

Calls 4

virtio_get_nr_vqFunction · 0.85
virtio_get_queue_typeFunction · 0.85
virtqueue_detach_unusedFunction · 0.85
rte_pktmbuf_freeFunction · 0.85

Tested by

no test coverage detected