drivers/virtio-net: Use reclaim in ops to finish TODO

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2024-08-05 15:24:20 +08:00 committed by Xiang Xiao
parent d740a8e73c
commit 648c52fc4b

View file

@ -160,6 +160,7 @@ static int virtio_net_rmmac(FAR struct netdev_lowerhalf_s *dev,
static int virtio_net_ioctl(FAR struct netdev_lowerhalf_s *dev,
int cmd, unsigned long arg);
#endif
static void virtio_net_txfree(FAR struct netdev_lowerhalf_s *dev);
static int virtio_net_probe(FAR struct virtio_device *vdev);
static void virtio_net_remove(FAR struct virtio_device *vdev);
@ -189,6 +190,7 @@ static const struct netdev_ops_s g_virtio_net_ops =
#ifdef CONFIG_NETDEV_IOCTL
virtio_net_ioctl,
#endif
virtio_net_txfree
};
/****************************************************************************
@ -460,14 +462,6 @@ static netpkt_t *virtio_net_recv(FAR struct netdev_lowerhalf_s *dev)
virtqueue_enable_cb(vq);
/* We do transmit after recv, now it's time to free TX buffer.
* Depends on upper-half order (Call TX after RX).
*
* TODO: Find a better way to free TX buffer.
*/
virtio_net_txfree((FAR struct netdev_lowerhalf_s *)priv);
vrtinfo("get NULL buffer\n");
return NULL;
}