1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
3 * Copyright(c) 2021 Red Hat, Inc.
12 struct virtqueue **vqs;
13 uint64_t guest_features;
14 uint16_t vtnet_hdr_size;
16 uint8_t weak_barriers;
18 uint8_t has_tx_offload;
19 uint8_t has_rx_offload;
22 uint8_t use_inorder_rx;
23 uint8_t use_inorder_tx;
26 uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
27 uint32_t speed; /* link speed in MB */
32 * App management thread and virtio interrupt handler thread
33 * both can change device state, this lock is meant to avoid
36 rte_spinlock_t state_lock;
37 struct rte_mbuf **inject_pkts;
38 uint16_t max_queue_pairs;
39 uint64_t req_guest_features;
40 struct virtnet_ctl *cvq;
44 void (*read_dev_cfg)(struct virtio_hw *hw, size_t offset, void *dst, int len);
45 void (*write_dev_cfg)(struct virtio_hw *hw, size_t offset, const void *src, int len);
46 uint8_t (*get_status)(struct virtio_hw *hw);
47 void (*set_status)(struct virtio_hw *hw, uint8_t status);
48 uint64_t (*get_features)(struct virtio_hw *hw);
49 void (*set_features)(struct virtio_hw *hw, uint64_t features);
50 int (*features_ok)(struct virtio_hw *hw);
51 uint8_t (*get_isr)(struct virtio_hw *hw);
52 uint16_t (*set_config_irq)(struct virtio_hw *hw, uint16_t vec);
53 uint16_t (*set_queue_irq)(struct virtio_hw *hw, struct virtqueue *vq, uint16_t vec);
54 uint16_t (*get_queue_num)(struct virtio_hw *hw, uint16_t queue_id);
55 int (*setup_queue)(struct virtio_hw *hw, struct virtqueue *vq);
56 void (*del_queue)(struct virtio_hw *hw, struct virtqueue *vq);
57 void (*notify_queue)(struct virtio_hw *hw, struct virtqueue *vq);
58 void (*intr_detect)(struct virtio_hw *hw);
59 int (*dev_close)(struct virtio_hw *hw);
63 * This structure stores per-process data. Only virtio_ops for now.
65 struct virtio_hw_internal {
66 const struct virtio_ops *virtio_ops;
69 #define VIRTIO_OPS(hw) (virtio_hw_internal[(hw)->port_id].virtio_ops)
71 extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS];
74 #endif /* _VIRTIO_H_ */