vmxnet3_defs.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * QEMU VMWARE VMXNET3 paravirtual NIC
  3. *
  4. * Copyright (c) 2012 Ravello Systems LTD (http://ravellosystems.com)
  5. *
  6. * Developed by Daynix Computing LTD (http://www.daynix.com)
  7. *
  8. * Authors:
  9. * Dmitry Fleytman <dmitry@daynix.com>
  10. * Tamir Shomer <tamirs@daynix.com>
  11. * Yan Vugenfirer <yan@daynix.com>
  12. *
  13. * This work is licensed under the terms of the GNU GPL, version 2.
  14. * See the COPYING file in the top-level directory.
  15. */
  16. #ifndef HW_NET_VMXNET3_DEFS_H
  17. #define HW_NET_VMXNET3_DEFS_H
  18. #include "net/net.h"
  19. #include "hw/net/vmxnet3.h"
  20. #define TYPE_VMXNET3 "vmxnet3"
  21. #define VMXNET3(obj) OBJECT_CHECK(VMXNET3State, (obj), TYPE_VMXNET3)
  22. /* Device state and helper functions */
  23. #define VMXNET3_RX_RINGS_PER_QUEUE (2)
  24. /* Cyclic ring abstraction */
  25. typedef struct {
  26. hwaddr pa;
  27. uint32_t size;
  28. uint32_t cell_size;
  29. uint32_t next;
  30. uint8_t gen;
  31. } Vmxnet3Ring;
  32. typedef struct {
  33. Vmxnet3Ring tx_ring;
  34. Vmxnet3Ring comp_ring;
  35. uint8_t intr_idx;
  36. hwaddr tx_stats_pa;
  37. struct UPT1_TxStats txq_stats;
  38. } Vmxnet3TxqDescr;
  39. typedef struct {
  40. Vmxnet3Ring rx_ring[VMXNET3_RX_RINGS_PER_QUEUE];
  41. Vmxnet3Ring comp_ring;
  42. uint8_t intr_idx;
  43. hwaddr rx_stats_pa;
  44. struct UPT1_RxStats rxq_stats;
  45. } Vmxnet3RxqDescr;
  46. typedef struct {
  47. bool is_masked;
  48. bool is_pending;
  49. bool is_asserted;
  50. } Vmxnet3IntState;
  51. typedef struct {
  52. PCIDevice parent_obj;
  53. NICState *nic;
  54. NICConf conf;
  55. MemoryRegion bar0;
  56. MemoryRegion bar1;
  57. MemoryRegion msix_bar;
  58. Vmxnet3RxqDescr rxq_descr[VMXNET3_DEVICE_MAX_RX_QUEUES];
  59. Vmxnet3TxqDescr txq_descr[VMXNET3_DEVICE_MAX_TX_QUEUES];
  60. /* Whether MSI-X support was installed successfully */
  61. bool msix_used;
  62. hwaddr drv_shmem;
  63. hwaddr temp_shared_guest_driver_memory;
  64. uint8_t txq_num;
  65. /* This boolean tells whether RX packet being indicated has to */
  66. /* be split into head and body chunks from different RX rings */
  67. bool rx_packets_compound;
  68. bool rx_vlan_stripping;
  69. bool lro_supported;
  70. uint8_t rxq_num;
  71. /* Network MTU */
  72. uint32_t mtu;
  73. /* Maximum number of fragments for indicated TX packets */
  74. uint32_t max_tx_frags;
  75. /* Maximum number of fragments for indicated RX packets */
  76. uint16_t max_rx_frags;
  77. /* Index for events interrupt */
  78. uint8_t event_int_idx;
  79. /* Whether automatic interrupts masking enabled */
  80. bool auto_int_masking;
  81. bool peer_has_vhdr;
  82. /* TX packets to QEMU interface */
  83. struct NetTxPkt *tx_pkt;
  84. uint32_t offload_mode;
  85. uint32_t cso_or_gso_size;
  86. uint16_t tci;
  87. bool needs_vlan;
  88. struct NetRxPkt *rx_pkt;
  89. bool tx_sop;
  90. bool skip_current_tx_pkt;
  91. uint32_t device_active;
  92. uint32_t last_command;
  93. uint32_t link_status_and_speed;
  94. Vmxnet3IntState interrupt_states[VMXNET3_MAX_INTRS];
  95. uint32_t temp_mac; /* To store the low part first */
  96. MACAddr perm_mac;
  97. uint32_t vlan_table[VMXNET3_VFT_SIZE];
  98. uint32_t rx_mode;
  99. MACAddr *mcast_list;
  100. uint32_t mcast_list_len;
  101. uint32_t mcast_list_buff_size; /* needed for live migration. */
  102. /* Compatibility flags for migration */
  103. uint32_t compat_flags;
  104. } VMXNET3State;
  105. #endif