diff options
Diffstat (limited to 'hw/spapr_llan.c')
-rw-r--r-- | hw/spapr_llan.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/hw/spapr_llan.c b/hw/spapr_llan.c index cfc777804b..e18d2eb901 100644 --- a/hw/spapr_llan.c +++ b/hw/spapr_llan.c @@ -182,6 +182,15 @@ static NetClientInfo net_spapr_vlan_info = { .receive = spapr_vlan_receive, }; +static void spapr_vlan_reset(VIOsPAPRDevice *sdev) +{ + VIOsPAPRVLANDevice *dev = DO_UPCAST(VIOsPAPRVLANDevice, sdev, sdev); + + dev->buf_list = 0; + dev->rx_bufs = 0; + dev->isopen = 0; +} + static int spapr_vlan_init(VIOsPAPRDevice *sdev) { VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev; @@ -279,21 +288,19 @@ static target_ulong h_register_logical_lan(CPUPPCState *env, if (check_bd(dev, VLAN_VALID_BD(buf_list, SPAPR_VIO_TCE_PAGE_SIZE), SPAPR_VIO_TCE_PAGE_SIZE) < 0) { - hcall_dprintf("Bad buf_list 0x" TARGET_FMT_lx " for " - "H_REGISTER_LOGICAL_LAN\n", buf_list); + hcall_dprintf("Bad buf_list 0x" TARGET_FMT_lx "\n", buf_list); return H_PARAMETER; } filter_list_bd = VLAN_VALID_BD(filter_list, SPAPR_VIO_TCE_PAGE_SIZE); if (check_bd(dev, filter_list_bd, SPAPR_VIO_TCE_PAGE_SIZE) < 0) { - hcall_dprintf("Bad filter_list 0x" TARGET_FMT_lx " for " - "H_REGISTER_LOGICAL_LAN\n", filter_list); + hcall_dprintf("Bad filter_list 0x" TARGET_FMT_lx "\n", filter_list); return H_PARAMETER; } if (!(rec_queue & VLAN_BD_VALID) || (check_bd(dev, rec_queue, VLAN_RQ_ALIGNMENT) < 0)) { - hcall_dprintf("Bad receive queue for H_REGISTER_LOGICAL_LAN\n"); + hcall_dprintf("Bad receive queue\n"); return H_PARAMETER; } @@ -337,9 +344,7 @@ static target_ulong h_free_logical_lan(CPUPPCState *env, sPAPREnvironment *spapr return H_RESOURCE; } - dev->buf_list = 0; - dev->rx_bufs = 0; - dev->isopen = 0; + spapr_vlan_reset(sdev); return H_SUCCESS; } @@ -358,13 +363,13 @@ static target_ulong h_add_logical_lan_buffer(CPUPPCState *env, ", 0x" TARGET_FMT_lx ")\n", reg, buf); if (!sdev) { - hcall_dprintf("Wrong device in h_add_logical_lan_buffer\n"); + hcall_dprintf("Bad device\n"); return H_PARAMETER; } if ((check_bd(dev, buf, 4) < 0) || (VLAN_BD_LEN(buf) < 16)) { - hcall_dprintf("Bad buffer enqueued in h_add_logical_lan_buffer\n"); + hcall_dprintf("Bad buffer enqueued\n"); return H_PARAMETER; } @@ -486,6 +491,7 @@ static void spapr_vlan_class_init(ObjectClass *klass, void *data) VIOsPAPRDeviceClass *k = VIO_SPAPR_DEVICE_CLASS(klass); k->init = spapr_vlan_init; + k->reset = spapr_vlan_reset; k->devnode = spapr_vlan_devnode; k->dt_name = "l-lan"; k->dt_type = "network"; |