net: xilinx_ethlite: Don't reset from init

This zeroing-out of the rxbuf variable (ping pong state) is a reset
side effect. Extract into a proper reset.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
This commit is contained in:
Peter Crosthwaite 2014-05-29 02:23:54 -07:00 committed by Edgar E. Iglesias
parent 04bb4d86f1
commit 8c6d96728d

View File

@ -204,6 +204,13 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
return size; return size;
} }
static void xilinx_ethlite_reset(DeviceState *dev)
{
struct xlx_ethlite *s = XILINX_ETHLITE(dev);
s->rxbuf = 0;
}
static void eth_cleanup(NetClientState *nc) static void eth_cleanup(NetClientState *nc)
{ {
struct xlx_ethlite *s = qemu_get_nic_opaque(nc); struct xlx_ethlite *s = qemu_get_nic_opaque(nc);
@ -225,7 +232,6 @@ static int xilinx_ethlite_init(SysBusDevice *sbd)
struct xlx_ethlite *s = XILINX_ETHLITE(dev); struct xlx_ethlite *s = XILINX_ETHLITE(dev);
sysbus_init_irq(sbd, &s->irq); sysbus_init_irq(sbd, &s->irq);
s->rxbuf = 0;
memory_region_init_io(&s->mmio, OBJECT(s), &eth_ops, s, memory_region_init_io(&s->mmio, OBJECT(s), &eth_ops, s,
"xlnx.xps-ethernetlite", R_MAX * 4); "xlnx.xps-ethernetlite", R_MAX * 4);
@ -251,6 +257,7 @@ static void xilinx_ethlite_class_init(ObjectClass *klass, void *data)
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = xilinx_ethlite_init; k->init = xilinx_ethlite_init;
dc->reset = xilinx_ethlite_reset;
dc->props = xilinx_ethlite_properties; dc->props = xilinx_ethlite_properties;
} }