_ (VIRTIO_NET_F_CTRL_MAC_ADDR, 23) /* Set MAC address */ \
_ (VIRTIO_F_NOTIFY_ON_EMPTY, 24) \
_ (VHOST_F_LOG_ALL, 26) /* Log all write descriptors */ \
- _ (VIRTIO_F_ANY_LAYOUT, 27) /* Can the device handle any descripor layout */ \
+ _ (VIRTIO_F_ANY_LAYOUT, 27) /* Can the device handle any descriptor layout */ \
_ (VIRTIO_RING_F_INDIRECT_DESC, 28) /* Support indirect buffer descriptors */ \
_ (VIRTIO_RING_F_EVENT_IDX, 29) /* The Guest publishes the used index for which it expects an interrupt \
* at the end of the avail ring. Host should ignore the avail->flags field. */ \
#define TX_QUEUE_ACCESS(X) (X/2)
#define RX_QUEUE_ACCESS(X) (X/2)
+#define foreach_virtio_if_types \
+ _ (TAP, 1) \
+ _ (TUN, 2) \
+ _ (PCI, 3)
+
typedef enum
{
- VIRTIO_IF_TYPE_TAP,
- VIRTIO_IF_TYPE_PCI,
- VIRTIO_IF_N_TYPES,
+#define _(a, b) VIRTIO_IF_TYPE_##a = (1 << b),
+ foreach_virtio_if_types
+#undef _
+ VIRTIO_IF_N_TYPES = (1 << 4),
} virtio_if_type_t;
u8 buffer_pool_index;
u16 size;
u16 queue_id;
+#define VRING_TX_OUT_OF_ORDER 1
u16 flags;
u32 call_file_index;
u32 *buffers;
pci_addr_t pci_addr;
};
u32 per_interface_next_index;
- union
- {
- int fd;
- u32 msix_enabled;
- };
- union
- {
- int tap_fd;
- u32 pci_dev_handle;
- };
+ int *vhost_fds;
+ int tap_fd;
+ u32 msix_enabled;
+ u32 pci_dev_handle;
virtio_vring_t *rxq_vrings;
virtio_vring_t *txq_vrings;
u64 features, remote_features;
u8 host_ip6_prefix_len;
u32 host_mtu_size;
int gso_enabled;
+ int csum_offload_enabled;
int ifindex;
virtio_vring_t *cxq_vring;
} virtio_if_t;
extern void virtio_pci_legacy_notify_queue (vlib_main_t * vm,
virtio_if_t * vif, u16 queue_id);
format_function_t format_virtio_device_name;
+format_function_t format_virtio_log_name;
static_always_inline void
virtio_kick (vlib_main_t * vm, virtio_vring_t * vring, virtio_if_t * vif)
}
}
+
+#define virtio_log_debug(vif, f, ...) \
+{ \
+ vlib_log(VLIB_LOG_LEVEL_DEBUG, virtio_main.log_default, \
+ "%U: " f, format_virtio_log_name, vif, \
+ ##__VA_ARGS__); \
+};
+
+#define virtio_log_warning(vif, f, ...) \
+{ \
+ vlib_log(VLIB_LOG_LEVEL_WARNING, virtio_main.log_default, \
+ "%U: " f, format_virtio_log_name, vif, \
+ ##__VA_ARGS__); \
+};
+
+#define virtio_log_error(vif, f, ...) \
+{ \
+ vlib_log(VLIB_LOG_LEVEL_ERR, virtio_main.log_default, \
+ "%U: " f, format_virtio_log_name, vif, \
+ ##__VA_ARGS__); \
+};
+
#endif /* _VNET_DEVICES_VIRTIO_VIRTIO_H_ */
/*