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

[Minios-devel] [UNIKRAFT PATCH v3 02/12] lib/uknetdev: Add alignment size for packet buffers allocations



Packet buffers may need different alignments, depending on their driver
requirements. For Xen netfront driver, packet buffers have to be page aligned
because they are saved in pages shared between backend and frontend. For KVM
virtio net driver, word size alignments suffice. Therefore, we need to save the
alignment size in order to support multiple drivers.

This patch also squeezes a small fix for setting the max_mtu when retrieving
device information from the virtio net driver.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/uknetdev/include/uk/netdev_core.h | 1 +
 plat/drivers/virtio/virtio_net.c      | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/lib/uknetdev/include/uk/netdev_core.h 
b/lib/uknetdev/include/uk/netdev_core.h
index f073e101..268d54d7 100644
--- a/lib/uknetdev/include/uk/netdev_core.h
+++ b/lib/uknetdev/include/uk/netdev_core.h
@@ -94,6 +94,7 @@ struct uk_netdev_info {
        uint16_t max_mtu;   /**< Maximum supported MTU size. */
        uint16_t nb_encap_tx;  /**< Number of bytes required as headroom for 
tx. */
        uint16_t nb_encap_rx;  /**< Number of bytes required as headroom for 
rx. */
+       uint16_t align;  /**< Alignment required for data address. */
 };
 
 /**
diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
index efc2cb71..9f1873c5 100644
--- a/plat/drivers/virtio/virtio_net.c
+++ b/plat/drivers/virtio/virtio_net.c
@@ -1048,8 +1048,10 @@ static void virtio_net_info_get(struct uk_netdev *dev,
 
        dev_info->max_rx_queues = vndev->max_vqueue_pairs;
        dev_info->max_tx_queues = vndev->max_vqueue_pairs;
+       dev_info->max_mtu = vndev->max_mtu;
        dev_info->nb_encap_tx = sizeof(struct virtio_net_hdr_padded);
        dev_info->nb_encap_rx = sizeof(struct virtio_net_hdr_padded);
+       dev_info->align = sizeof(void *); /* word size alignment */
 }
 
 static int virtio_net_start(struct uk_netdev *n)
-- 
2.20.1


_______________________________________________
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®.