[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 10/15] plat/tap: Setup txq



Tap driver implements the function to setup the txq.

Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 plat/drivers/tap/tap.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/plat/drivers/tap/tap.c b/plat/drivers/tap/tap.c
index bcc8b6e..d564e15 100644
--- a/plat/drivers/tap/tap.c
+++ b/plat/drivers/tap/tap.c
@@ -69,6 +69,7 @@
 
 struct uk_netdev_tx_queue {
        int queue_id;
+       __u16 nb_desc;
        UK_TAILQ_ENTRY(struct uk_netdev_tx_queue) next;
        struct uk_alloc *a;
        /* Set the file descriptor for the tap device */
@@ -293,17 +294,33 @@ static struct uk_netdev_rx_queue 
*tap_netdev_rxq_setup(struct uk_netdev *dev,
 }
 
 static struct uk_netdev_tx_queue *tap_netdev_txq_setup(struct uk_netdev *dev,
-                                                      __u16 queue_id __unused,
-                                                      __u16 nb_desc __unused,
+                                                      __u16 queue_id,
+                                                      __u16 nb_desc,
                                        struct uk_netdev_txqueue_conf *conf)
 {
-       int rc = -EINVAL;
+       int rc = 0;
        struct uk_netdev_tx_queue *txq = NULL;
+       struct tap_net_dev *tdev = NULL;
 
        UK_ASSERT(dev && conf);
 
-       txq = ERR2PTR(rc);
+       tdev = to_tapnetdev(dev);
+       txq = uk_zalloc(conf->a, sizeof(*txq));
+       if (!txq) {
+               uk_pr_err(DRIVER_NAME": Failed to allocate the rx queue\n");
+               rc = -ENOMEM;
+               goto err_exit;
+       }
+
+       txq->queue_id = queue_id;
+       txq->fd = tdev->tap_fd;
+       txq->nb_desc = nb_desc;
+       txq->a = conf->a;
+exit:
        return txq;
+err_exit:
+       txq = ERR2PTR(rc);
+       goto exit;
 }
 
 static int tap_netdev_start(struct uk_netdev *n)
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.