On Wed, Jan 16, 2013 at 5:16 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote:
> On Sat, Jan 12, 2013 at 06:09:46PM +0200, Dmitry Fleytman wrote: > > @@ -113,6 +113,8 @@ common-obj-$(CONFIG_PCNET_PCI) += pcnet-pci.o > > common-obj-$(CONFIG_PCNET_COMMON) += pcnet.o > > common-obj-$(CONFIG_E1000_PCI) += e1000.o > > common-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o > > +common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet3.o > > +common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet_tx_pkt.o vmxnet_rx_pkt.o > > The objects can already be built in the earlier patch so clean > compilation can be tested. Please move this to the patch that > introduces these .c files. > Done. > > > +static void vmxnet3_reset(VMXNET3State *s) > > +{ > > + VMW_CBPRN("Resetting vmxnet3..."); > > + > > + vmxnet_tx_pkt_reset(s->tx_pkt); > > + s->tx_sop = true; > > + s->skip_current_tx_pkt = false; > > Not much is reset here? > > Clear rx mac filtering and reset MAC address? > > Reset drv_shmem? > > Reset drv_shmem, MAC address and a number of other fields added. Also state machine switched to "inactive" state on reset. All context fields that being filled "atomically" with device activation left as-is to avoid code/logic duplication. > +static void vmxnet3_net_init(VMXNET3State *s) > > +{ > > + VMW_CBPRN("vmxnet3_net_init called..."); > > + > > + qemu_macaddr_default_if_unset(&s->conf.macaddr); > > + > > + /* Windows guest will query the address that was set on init */ > > + memcpy(&s->perm_mac.a, &s->conf.macaddr.a, sizeof(s->perm_mac.a)); > > + > > + s->mcast_list = NULL; > > + s->mcast_list_len = 0; > > + > > + s->link_status_and_speed = VMXNET3_LINK_SPEED | > VMXNET3_LINK_STATUS_UP; > > + > > + VMW_CFPRN("Permanent MAC: " MAC_FMT, MAC_ARG(s->perm_mac.a)); > > + > > + s->nic = qemu_new_nic(&net_vmxnet3_info, &s->conf, > > + object_get_typename(OBJECT(s)), > > + s->dev.qdev.id, s); > > Missing qemu_del_net_client() to free s->nic in this file. > > Un-init sequence amended. Thanks for pointing out. > > +static void vmxnet3_get_tx_stats_from_file(QEMUFile *f, > > + struct UPT1_TxStats *tx_stat) > > +{ > > + tx_stat->TSOPktsTxOK = qemu_get_be64(f); > > + tx_stat->TSOBytesTxOK = qemu_get_be64(f); > > + tx_stat->ucastPktsTxOK = qemu_get_be64(f); > > + tx_stat->ucastBytesTxOK = qemu_get_be64(f); > > + tx_stat->mcastPktsTxOK = qemu_get_be64(f); > > + tx_stat->mcastBytesTxOK = qemu_get_be64(f); > > + tx_stat->bcastPktsTxOK = qemu_get_be64(f); > > + tx_stat->bcastBytesTxOK = qemu_get_be64(f); > > + tx_stat->pktsTxError = qemu_get_be64(f); > > + tx_stat->pktsTxDiscard = qemu_get_be64(f); > > +} > > 4-space indentation. > > > + > > +static void vmxnet3_put_tx_stats_to_file(QEMUFile *f, > > + struct UPT1_TxStats *tx_stat) > > +{ > > + qemu_put_be64(f, tx_stat->TSOPktsTxOK); > > + qemu_put_be64(f, tx_stat->TSOBytesTxOK); > > + qemu_put_be64(f, tx_stat->ucastPktsTxOK); > > + qemu_put_be64(f, tx_stat->ucastBytesTxOK); > > + qemu_put_be64(f, tx_stat->mcastPktsTxOK); > > + qemu_put_be64(f, tx_stat->mcastBytesTxOK); > > + qemu_put_be64(f, tx_stat->bcastPktsTxOK); > > + qemu_put_be64(f, tx_stat->bcastBytesTxOK); > > + qemu_put_be64(f, tx_stat->pktsTxError); > > + qemu_put_be64(f, tx_stat->pktsTxDiscard); > > +} > > 4-space indentation. > > > +static void vmxnet3_get_rx_stats_from_file(QEMUFile *f, > > + struct UPT1_RxStats *rx_stat) > > +{ > > + rx_stat->LROPktsRxOK = qemu_get_be64(f); > > + rx_stat->LROBytesRxOK = qemu_get_be64(f); > > + rx_stat->ucastPktsRxOK = qemu_get_be64(f); > > + rx_stat->ucastBytesRxOK = qemu_get_be64(f); > > + rx_stat->mcastPktsRxOK = qemu_get_be64(f); > > + rx_stat->mcastBytesRxOK = qemu_get_be64(f); > > + rx_stat->bcastPktsRxOK = qemu_get_be64(f); > > + rx_stat->bcastBytesRxOK = qemu_get_be64(f); > > + rx_stat->pktsRxOutOfBuf = qemu_get_be64(f); > > + rx_stat->pktsRxError = qemu_get_be64(f); > > 4-space indentation. > > > +} > > + > > +static void vmxnet3_put_rx_stats_to_file(QEMUFile *f, > > + struct UPT1_RxStats *rx_stat) > > +{ > > + qemu_put_be64(f, rx_stat->LROPktsRxOK); > > + qemu_put_be64(f, rx_stat->LROBytesRxOK); > > + qemu_put_be64(f, rx_stat->ucastPktsRxOK); > > + qemu_put_be64(f, rx_stat->ucastBytesRxOK); > > + qemu_put_be64(f, rx_stat->mcastPktsRxOK); > > + qemu_put_be64(f, rx_stat->mcastBytesRxOK); > > + qemu_put_be64(f, rx_stat->bcastPktsRxOK); > > + qemu_put_be64(f, rx_stat->bcastBytesRxOK); > > + qemu_put_be64(f, rx_stat->pktsRxOutOfBuf); > > + qemu_put_be64(f, rx_stat->pktsRxError); > > 4-space indentation. > Indentation verified and fixed everywhere. -- Dmitry Fleytman Technology Expert and Consultant, Daynix Computing Ltd. Cell: +972-54-2819481 Skype: dmitry.fleytman