#include "qemu/units.h"
#include "net/net.h"
#include "net/tap.h"
+#include "qemu/module.h"
#include "qemu/range.h"
#include "sysemu/sysemu.h"
+#include "hw/hw.h"
#include "hw/pci/msi.h"
#include "hw/pci/msix.h"
+#include "hw/qdev-properties.h"
+#include "migration/vmstate.h"
#include "e1000_regs.h"
#include "trace.h"
#include "qapi/error.h"
+#include "qom/object.h"
#define TYPE_E1000E "e1000e"
+typedef struct E1000EState E1000EState;
#define E1000E(obj) OBJECT_CHECK(E1000EState, (obj), TYPE_E1000E)
-typedef struct E1000EState {
+struct E1000EState {
PCIDevice parent_obj;
NICState *nic;
NICConf conf;
E1000ECore core;
-} E1000EState;
+};
#define E1000E_MMIO_IDX 0
#define E1000E_FLASH_IDX 1
},
};
-static int
+static bool
e1000e_nc_can_receive(NetClientState *nc)
{
E1000EState *s = qemu_get_nic_opaque(nc);
s->nic = qemu_new_nic(&net_e1000e_info, &s->conf,
object_get_typename(OBJECT(s)), dev->id, s);
- s->core.max_queue_num = s->conf.peers.queues - 1;
+ s->core.max_queue_num = s->conf.peers.queues ? s->conf.peers.queues - 1 : 0;
trace_e1000e_mac_set_permanent(MAC_ARG(macaddr));
memcpy(s->core.permanent_mac, macaddr, sizeof(s->core.permanent_mac));
dc->desc = "Intel 82574L GbE Controller";
dc->reset = e1000e_qdev_reset;
dc->vmsd = &e1000e_vmstate;
- dc->props = e1000e_properties;
e1000e_prop_disable_vnet = qdev_prop_uint8;
e1000e_prop_disable_vnet.description = "Do not use virtio headers, "
e1000e_prop_subsys = qdev_prop_uint16;
e1000e_prop_subsys.description = "PCI device Subsystem ID";
+ device_class_set_props(dc, e1000e_properties);
set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
}
E1000EState *s = E1000E(obj);
device_add_bootindex_property(obj, &s->conf.bootindex,
"bootindex", "/ethernet-phy@0",
- DEVICE(obj), NULL);
+ DEVICE(obj));
}
static const TypeInfo e1000e_info = {