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

[UNIKRAFT PATCH v3 3/3] lib/uknetdev: Get feature supported on uk_netdev



The uk_netdev_info provides a way to forward information on netdevice
to the network stack. We extend this with a bitmap of the features
supported on device. The bit 0,1 of the bitmap indicates if the
device supports interrupt.

Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 lib/uknetdev/include/uk/netdev_core.h | 12 ++++++++++++
 plat/drivers/virtio/virtio_net.c      |  1 +
 2 files changed, 13 insertions(+)

diff --git a/lib/uknetdev/include/uk/netdev_core.h 
b/lib/uknetdev/include/uk/netdev_core.h
index e9d9113..c170696 100644
--- a/lib/uknetdev/include/uk/netdev_core.h
+++ b/lib/uknetdev/include/uk/netdev_core.h
@@ -77,6 +77,17 @@ UK_TAILQ_HEAD(uk_netdev_list, struct uk_netdev);
  */
 #define UK_NETDEV_HWADDR_LEN 6 /**< Length of Ethernet address. */
 
+/**
+ * The netdevice support rx/tx interrupt.
+ */
+#define UK_FEATURE_RXQ_INTR_BIT                    0
+#define UK_FEATURE_RXQ_INTR_AVAILABLE  (1UL << UK_FEATURE_RXQ_INTR_BIT)
+#define UK_FEATURE_TXQ_INTR_BIT                    1
+#define UK_FEATURE_TXQ_INTR_AVAILABLE  (1UL << UK_FEATURE_TXQ_INTR_BIT)
+
+#define uk_netdev_rxintr_supported(feature)    \
+       (feature & (UK_FEATURE_RXQ_INTR_AVAILABLE))
+
 struct uk_hwaddr {
        uint8_t addr_bytes[UK_NETDEV_HWADDR_LEN];
 } __packed;
@@ -91,6 +102,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. */
+       uint32_t features; /**< bitmap of the features supported */
 };
 
 /**
diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
index 3025ed3..0a8312d 100644
--- a/plat/drivers/virtio/virtio_net.c
+++ b/plat/drivers/virtio/virtio_net.c
@@ -1052,6 +1052,7 @@ static void virtio_net_info_get(struct uk_netdev *dev,
        dev_info->max_tx_queues = vndev->max_vqueue_pairs;
        dev_info->nb_encap_tx = sizeof(struct virtio_net_hdr_padded);
        dev_info->nb_encap_rx = sizeof(struct virtio_net_hdr_padded);
+       dev_info->features = UK_FEATURE_RXQ_INTR_AVAILABLE;
 }
 
 static int virtio_net_start(struct uk_netdev *n)
-- 
2.7.4




 


Rackspace

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