-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1 iQEcBAABAgAGBQJlXF+GAAoJEO8Ells5jWIROT0H/RGk64ds4eiKskWxwG9p8K8s wCLdgadf/PRnKmMLR3i5gMX87Db83nUtX/tEgoNxSGuvTdK/JRuqf2oMLv5AOF27 6573reJW1z0Ho9Se5JW+DPI18hX7YzqwyJQ9QslGOSRXJb20O4iC2rICfI8MeFsW tBTsBcJ4qwsVK4nqY/3Tz57lhZLF2xYZtdgvxS4urqg/PrcbAMq8SSB8cq7tjUUs sgDMQQx4n/r8wlBJE1nnvF/NxtLyTj/rrS9J1rF7ztp/suea/vHxM3t9vTqjLSlY TyFORcfSCK2edp2+QwARJTTU9FlnuSwf28Pnm2lMQjp5HjBO20bpCBIWGQl6C9A= =T88Y -----END PGP SIGNATURE----- Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging # -----BEGIN PGP SIGNATURE----- # Version: GnuPG v1 # # iQEcBAABAgAGBQJlXF+GAAoJEO8Ells5jWIROT0H/RGk64ds4eiKskWxwG9p8K8s # wCLdgadf/PRnKmMLR3i5gMX87Db83nUtX/tEgoNxSGuvTdK/JRuqf2oMLv5AOF27 # 6573reJW1z0Ho9Se5JW+DPI18hX7YzqwyJQ9QslGOSRXJb20O4iC2rICfI8MeFsW # tBTsBcJ4qwsVK4nqY/3Tz57lhZLF2xYZtdgvxS4urqg/PrcbAMq8SSB8cq7tjUUs # sgDMQQx4n/r8wlBJE1nnvF/NxtLyTj/rrS9J1rF7ztp/suea/vHxM3t9vTqjLSlY # TyFORcfSCK2edp2+QwARJTTU9FlnuSwf28Pnm2lMQjp5HjBO20bpCBIWGQl6C9A= # =T88Y # -----END PGP SIGNATURE----- # gpg: Signature made Tue 21 Nov 2023 02:43:02 EST # gpg: using RSA key EF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [full] # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * tag 'net-pull-request' of https://github.com/jasowang/qemu: net: do not delete nics in net_cleanup() net: Update MemReentrancyGuard for NIC net: Provide MemReentrancyGuard * to qemu_new_nic() Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
commit
19c63383a7
@ -824,7 +824,8 @@ static void allwinner_sun8i_emac_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_allwinner_sun8i_emac_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,8 @@ static void aw_emac_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_aw_emac_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
|
||||
fifo8_create(&s->rx_fifo, RX_FIFO_SIZE);
|
||||
|
@ -1743,7 +1743,8 @@ static void gem_realize(DeviceState *dev, Error **errp)
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
||||
s->nic = qemu_new_nic(&net_gem_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
|
||||
if (s->jumbo_max_len > MAX_FRAME_SIZE) {
|
||||
error_setg(errp, "jumbo-max-len is greater than %d",
|
||||
|
@ -913,7 +913,8 @@ static void dp8393x_realize(DeviceState *dev, Error **errp)
|
||||
"dp8393x-regs", SONIC_REG_COUNT << s->it_shift);
|
||||
|
||||
s->nic = qemu_new_nic(&net_dp83932_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
|
||||
s->watchdog = timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s);
|
||||
|
@ -1666,7 +1666,8 @@ static void pci_e1000_realize(PCIDevice *pci_dev, Error **errp)
|
||||
macaddr);
|
||||
|
||||
d->nic = qemu_new_nic(&net_e1000_info, &d->conf,
|
||||
object_get_typename(OBJECT(d)), dev->id, d);
|
||||
object_get_typename(OBJECT(d)), dev->id,
|
||||
&dev->mem_reentrancy_guard, d);
|
||||
|
||||
qemu_format_nic_info_str(qemu_get_queue(d->nic), macaddr);
|
||||
|
||||
|
@ -320,7 +320,7 @@ e1000e_init_net_peer(E1000EState *s, PCIDevice *pci_dev, uint8_t *macaddr)
|
||||
int i;
|
||||
|
||||
s->nic = qemu_new_nic(&net_e1000e_info, &s->conf,
|
||||
object_get_typename(OBJECT(s)), dev->id, s);
|
||||
object_get_typename(OBJECT(s)), dev->id, &dev->mem_reentrancy_guard, s);
|
||||
|
||||
s->core.max_queue_num = s->conf.peers.queues ? s->conf.peers.queues - 1 : 0;
|
||||
|
||||
|
@ -1874,7 +1874,9 @@ static void e100_nic_realize(PCIDevice *pci_dev, Error **errp)
|
||||
nic_reset(s);
|
||||
|
||||
s->nic = qemu_new_nic(&net_eepro100_info, &s->conf,
|
||||
object_get_typename(OBJECT(pci_dev)), pci_dev->qdev.id, s);
|
||||
object_get_typename(OBJECT(pci_dev)),
|
||||
pci_dev->qdev.id,
|
||||
&pci_dev->qdev.mem_reentrancy_guard, s);
|
||||
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
TRACE(OTHER, logout("%s\n", qemu_get_queue(s->nic)->info_str));
|
||||
|
@ -618,7 +618,8 @@ static void etraxfs_eth_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_etraxfs_info, &s->conf,
|
||||
object_get_typename(OBJECT(s)), dev->id, s);
|
||||
object_get_typename(OBJECT(s)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
|
||||
s->phy.read = tdk_read;
|
||||
|
@ -391,7 +391,8 @@ static void etsec_realize(DeviceState *dev, Error **errp)
|
||||
eTSEC *etsec = ETSEC_COMMON(dev);
|
||||
|
||||
etsec->nic = qemu_new_nic(&net_etsec_info, &etsec->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, etsec);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, etsec);
|
||||
qemu_format_nic_info_str(qemu_get_queue(etsec->nic), etsec->conf.macaddr.a);
|
||||
|
||||
etsec->ptimer = ptimer_init(etsec_timer_hit, etsec, PTIMER_POLICY_LEGACY);
|
||||
|
@ -1110,7 +1110,8 @@ static void ftgmac100_realize(DeviceState *dev, Error **errp)
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
||||
s->nic = qemu_new_nic(&net_ftgmac100_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -726,7 +726,7 @@ void i82596_common_init(DeviceState *dev, I82596State *s, NetClientInfo *info)
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
}
|
||||
s->nic = qemu_new_nic(info, &s->conf, object_get_typename(OBJECT(dev)),
|
||||
dev->id, s);
|
||||
dev->id, &dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
|
||||
if (USE_TIMER) {
|
||||
|
@ -325,7 +325,7 @@ igb_init_net_peer(IGBState *s, PCIDevice *pci_dev, uint8_t *macaddr)
|
||||
int i;
|
||||
|
||||
s->nic = qemu_new_nic(&net_igb_info, &s->conf,
|
||||
object_get_typename(OBJECT(s)), dev->id, s);
|
||||
object_get_typename(OBJECT(s)), dev->id, &dev->mem_reentrancy_guard, s);
|
||||
|
||||
s->core.max_queue_num = s->conf.peers.queues ? s->conf.peers.queues - 1 : 0;
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ static void imx_eth_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
s->nic = qemu_new_nic(&imx_eth_net_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)),
|
||||
dev->id, s);
|
||||
dev->id, &dev->mem_reentrancy_guard, s);
|
||||
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
}
|
||||
|
@ -1361,7 +1361,8 @@ static void lan9118_realize(DeviceState *dev, Error **errp)
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
||||
s->nic = qemu_new_nic(&net_lan9118_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
s->eeprom[0] = 0xa5;
|
||||
for (i = 0; i < 6; i++) {
|
||||
|
@ -643,7 +643,8 @@ static void mcf_fec_realize(DeviceState *dev, Error **errp)
|
||||
mcf_fec_state *s = MCF_FEC_NET(dev);
|
||||
|
||||
s->nic = qemu_new_nic(&net_mcf_fec_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,8 @@ static void mipsnet_realize(DeviceState *dev, Error **errp)
|
||||
sysbus_init_irq(sbd, &s->irq);
|
||||
|
||||
s->nic = qemu_new_nic(&net_mipsnet_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -530,7 +530,8 @@ static void msf2_emac_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_msf2_emac_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,8 @@ static void mv88w8618_eth_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
address_space_init(&s->dma_as, s->dma_mr, "emac-dma");
|
||||
s->nic = qemu_new_nic(&net_mv88w8618_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
}
|
||||
|
||||
static const VMStateDescription mv88w8618_eth_vmsd = {
|
||||
|
@ -74,7 +74,8 @@ static void isa_ne2000_realizefn(DeviceState *dev, Error **errp)
|
||||
ne2000_reset(s);
|
||||
|
||||
s->nic = qemu_new_nic(&net_ne2000_isa_info, &s->c,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->c.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,8 @@ static void pci_ne2000_realize(PCIDevice *pci_dev, Error **errp)
|
||||
|
||||
s->nic = qemu_new_nic(&net_ne2000_info, &s->c,
|
||||
object_get_typename(OBJECT(pci_dev)),
|
||||
pci_dev->qdev.id, s);
|
||||
pci_dev->qdev.id,
|
||||
&pci_dev->qdev.mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->c.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -821,7 +821,8 @@ static void npcm7xx_emc_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&emc->conf.macaddr);
|
||||
emc->nic = qemu_new_nic(&net_npcm7xx_emc_info, &emc->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, emc);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, emc);
|
||||
qemu_format_nic_info_str(qemu_get_queue(emc->nic), emc->conf.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -732,7 +732,8 @@ static void sysbus_open_eth_realize(DeviceState *dev, Error **errp)
|
||||
sysbus_init_irq(sbd, &s->irq);
|
||||
|
||||
s->nic = qemu_new_nic(&net_open_eth_info, &s->conf,
|
||||
object_get_typename(OBJECT(s)), dev->id, s);
|
||||
object_get_typename(OBJECT(s)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
}
|
||||
|
||||
static void qdev_open_eth_reset(DeviceState *dev)
|
||||
|
@ -1709,7 +1709,8 @@ void pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info)
|
||||
s->poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, pcnet_poll_timer, s);
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(info, &s->conf, object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
s->nic = qemu_new_nic(info, &s->conf, object_get_typename(OBJECT(dev)),
|
||||
dev->id, &dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
|
||||
/* Initialize the PROM */
|
||||
|
@ -241,8 +241,8 @@ FpPort *fp_port_alloc(Rocker *r, char *sw_name,
|
||||
port->conf.bootindex = -1;
|
||||
port->conf.peers = *peers;
|
||||
|
||||
port->nic = qemu_new_nic(&fp_port_info, &port->conf,
|
||||
sw_name, NULL, port);
|
||||
port->nic = qemu_new_nic(&fp_port_info, &port->conf, sw_name, NULL,
|
||||
&DEVICE(r)->mem_reentrancy_guard, port);
|
||||
qemu_format_nic_info_str(qemu_get_queue(port->nic),
|
||||
port->conf.macaddr.a);
|
||||
|
||||
|
@ -3388,7 +3388,8 @@ static void pci_rtl8139_realize(PCIDevice *dev, Error **errp)
|
||||
s->eeprom.contents[9] = s->conf.macaddr.a[4] | s->conf.macaddr.a[5] << 8;
|
||||
|
||||
s->nic = qemu_new_nic(&net_rtl8139_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), d->id, s);
|
||||
object_get_typename(OBJECT(dev)), d->id,
|
||||
&d->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
|
||||
s->cplus_txbuffer = NULL;
|
||||
|
@ -783,7 +783,8 @@ static void smc91c111_realize(DeviceState *dev, Error **errp)
|
||||
sysbus_init_irq(sbd, &s->irq);
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_smc91c111_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
/* ??? Save/restore. */
|
||||
}
|
||||
|
@ -325,7 +325,8 @@ static void spapr_vlan_realize(SpaprVioDevice *sdev, Error **errp)
|
||||
memcpy(&dev->perm_mac.a, &dev->nicconf.macaddr.a, sizeof(dev->perm_mac.a));
|
||||
|
||||
dev->nic = qemu_new_nic(&net_spapr_vlan_info, &dev->nicconf,
|
||||
object_get_typename(OBJECT(sdev)), sdev->qdev.id, dev);
|
||||
object_get_typename(OBJECT(sdev)), sdev->qdev.id,
|
||||
&sdev->qdev.mem_reentrancy_guard, dev);
|
||||
qemu_format_nic_info_str(qemu_get_queue(dev->nic), dev->nicconf.macaddr.a);
|
||||
|
||||
dev->rxp_timer = timer_new_us(QEMU_CLOCK_VIRTUAL, spapr_vlan_flush_rx_queue,
|
||||
|
@ -492,7 +492,8 @@ static void stellaris_enet_realize(DeviceState *dev, Error **errp)
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
|
||||
s->nic = qemu_new_nic(&net_stellaris_enet_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -1399,7 +1399,7 @@ static void sungem_realize(PCIDevice *pci_dev, Error **errp)
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_sungem_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)),
|
||||
dev->id, s);
|
||||
dev->id, &dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic),
|
||||
s->conf.macaddr.a);
|
||||
}
|
||||
|
@ -881,7 +881,8 @@ static void sunhme_realize(PCIDevice *pci_dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_sunhme_info, &s->conf,
|
||||
object_get_typename(OBJECT(d)), d->id, s);
|
||||
object_get_typename(OBJECT(d)), d->id,
|
||||
&d->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -983,7 +983,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
|
||||
|
||||
s->nic = qemu_new_nic(&net_tulip_info, &s->c,
|
||||
object_get_typename(OBJECT(pci_dev)),
|
||||
pci_dev->qdev.id, s);
|
||||
pci_dev->qdev.id,
|
||||
&pci_dev->qdev.mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->c.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -3714,10 +3714,12 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
|
||||
* Happen when virtio_net_set_netclient_name has been called.
|
||||
*/
|
||||
n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf,
|
||||
n->netclient_type, n->netclient_name, n);
|
||||
n->netclient_type, n->netclient_name,
|
||||
&dev->mem_reentrancy_guard, n);
|
||||
} else {
|
||||
n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, n);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, n);
|
||||
}
|
||||
|
||||
for (i = 0; i < n->max_queue_pairs; i++) {
|
||||
|
@ -2078,7 +2078,7 @@ static void vmxnet3_net_init(VMXNET3State *s)
|
||||
|
||||
s->nic = qemu_new_nic(&net_vmxnet3_info, &s->conf,
|
||||
object_get_typename(OBJECT(s)),
|
||||
d->id, s);
|
||||
d->id, &d->mem_reentrancy_guard, s);
|
||||
|
||||
s->peer_has_vhdr = vmxnet3_peer_has_vnet_hdr(s);
|
||||
s->tx_sop = true;
|
||||
|
@ -325,7 +325,8 @@ static void xen_netdev_realize(XenDevice *xendev, Error **errp)
|
||||
|
||||
netdev->nic = qemu_new_nic(&net_xen_info, &netdev->conf,
|
||||
object_get_typename(OBJECT(xendev)),
|
||||
DEVICE(xendev)->id, netdev);
|
||||
DEVICE(xendev)->id,
|
||||
&xendev->qdev.mem_reentrancy_guard, netdev);
|
||||
|
||||
nc = qemu_get_queue(netdev->nic);
|
||||
qemu_format_nic_info_str(nc, netdev->conf.macaddr.a);
|
||||
|
@ -402,7 +402,8 @@ static void xgmac_enet_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_xgmac_enet_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
|
||||
s->regs[XGMAC_ADDR_HIGH(0)] = (s->conf.macaddr.a[5] << 8) |
|
||||
|
@ -967,7 +967,8 @@ static void xilinx_enet_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_xilinx_enet_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
|
||||
tdk_init(&s->TEMAC.phy);
|
||||
|
@ -235,7 +235,8 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf,
|
||||
object_get_typename(OBJECT(dev)), dev->id, s);
|
||||
object_get_typename(OBJECT(dev)), dev->id,
|
||||
&dev->mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
}
|
||||
|
||||
|
@ -1386,7 +1386,8 @@ static void usb_net_realize(USBDevice *dev, Error **errp)
|
||||
|
||||
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
||||
s->nic = qemu_new_nic(&net_usbnet_info, &s->conf,
|
||||
object_get_typename(OBJECT(s)), s->dev.qdev.id, s);
|
||||
object_get_typename(OBJECT(s)), s->dev.qdev.id,
|
||||
&s->dev.qdev.mem_reentrancy_guard, s);
|
||||
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
|
||||
snprintf(s->usbstring_mac, sizeof(s->usbstring_mac),
|
||||
"%02x%02x%02x%02x%02x%02x",
|
||||
|
@ -126,6 +126,7 @@ typedef QTAILQ_HEAD(NetClientStateList, NetClientState) NetClientStateList;
|
||||
typedef struct NICState {
|
||||
NetClientState *ncs;
|
||||
NICConf *conf;
|
||||
MemReentrancyGuard *reentrancy_guard;
|
||||
void *opaque;
|
||||
bool peer_deleted;
|
||||
} NICState;
|
||||
@ -159,6 +160,7 @@ NICState *qemu_new_nic(NetClientInfo *info,
|
||||
NICConf *conf,
|
||||
const char *model,
|
||||
const char *name,
|
||||
MemReentrancyGuard *reentrancy_guard,
|
||||
void *opaque);
|
||||
void qemu_del_nic(NICState *nic);
|
||||
NetClientState *qemu_get_subqueue(NICState *nic, int queue_index);
|
||||
|
43
net/net.c
43
net/net.c
@ -319,6 +319,7 @@ NICState *qemu_new_nic(NetClientInfo *info,
|
||||
NICConf *conf,
|
||||
const char *model,
|
||||
const char *name,
|
||||
MemReentrancyGuard *reentrancy_guard,
|
||||
void *opaque)
|
||||
{
|
||||
NetClientState **peers = conf->peers.ncs;
|
||||
@ -331,6 +332,7 @@ NICState *qemu_new_nic(NetClientInfo *info,
|
||||
nic = g_malloc0(info->size + sizeof(NetClientState) * queues);
|
||||
nic->ncs = (void *)nic + info->size;
|
||||
nic->conf = conf;
|
||||
nic->reentrancy_guard = reentrancy_guard,
|
||||
nic->opaque = opaque;
|
||||
|
||||
for (i = 0; i < queues; i++) {
|
||||
@ -813,6 +815,7 @@ static ssize_t qemu_deliver_packet_iov(NetClientState *sender,
|
||||
int iovcnt,
|
||||
void *opaque)
|
||||
{
|
||||
MemReentrancyGuard *owned_reentrancy_guard;
|
||||
NetClientState *nc = opaque;
|
||||
int ret;
|
||||
|
||||
@ -825,12 +828,24 @@ static ssize_t qemu_deliver_packet_iov(NetClientState *sender,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (nc->info->type != NET_CLIENT_DRIVER_NIC ||
|
||||
qemu_get_nic(nc)->reentrancy_guard->engaged_in_io) {
|
||||
owned_reentrancy_guard = NULL;
|
||||
} else {
|
||||
owned_reentrancy_guard = qemu_get_nic(nc)->reentrancy_guard;
|
||||
owned_reentrancy_guard->engaged_in_io = true;
|
||||
}
|
||||
|
||||
if (nc->info->receive_iov && !(flags & QEMU_NET_PACKET_FLAG_RAW)) {
|
||||
ret = nc->info->receive_iov(nc, iov, iovcnt);
|
||||
} else {
|
||||
ret = nc_sendv_compat(nc, iov, iovcnt, flags);
|
||||
}
|
||||
|
||||
if (owned_reentrancy_guard) {
|
||||
owned_reentrancy_guard->engaged_in_io = false;
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
nc->receive_disabled = 1;
|
||||
}
|
||||
@ -1499,18 +1514,34 @@ static void net_vm_change_state_handler(void *opaque, bool running,
|
||||
|
||||
void net_cleanup(void)
|
||||
{
|
||||
NetClientState *nc;
|
||||
NetClientState *nc, **p = &QTAILQ_FIRST(&net_clients);
|
||||
|
||||
/*cleanup colo compare module for COLO*/
|
||||
colo_compare_cleanup();
|
||||
|
||||
/* We may del multiple entries during qemu_del_net_client(),
|
||||
* so QTAILQ_FOREACH_SAFE() is also not safe here.
|
||||
/*
|
||||
* Walk the net_clients list and remove the netdevs but *not* any
|
||||
* NET_CLIENT_DRIVER_NIC entries. The latter are owned by the device
|
||||
* model which created them, and in some cases (e.g. xen-net-device)
|
||||
* the device itself may do cleanup at exit and will be upset if we
|
||||
* just delete its NIC from underneath it.
|
||||
*
|
||||
* Since qemu_del_net_client() may delete multiple entries, using
|
||||
* QTAILQ_FOREACH_SAFE() is not safe here. The only safe pointer
|
||||
* to keep as a bookmark is a NET_CLIENT_DRIVER_NIC entry, so keep
|
||||
* 'p' pointing to either the head of the list, or the 'next' field
|
||||
* of the latest NET_CLIENT_DRIVER_NIC, and operate on *p as we walk
|
||||
* the list.
|
||||
*
|
||||
* The 'nc' variable isn't part of the list traversal; it's purely
|
||||
* for convenience as too much '(*p)->' has a tendency to make the
|
||||
* readers' eyes bleed.
|
||||
*/
|
||||
while (!QTAILQ_EMPTY(&net_clients)) {
|
||||
nc = QTAILQ_FIRST(&net_clients);
|
||||
while (*p) {
|
||||
nc = *p;
|
||||
if (nc->info->type == NET_CLIENT_DRIVER_NIC) {
|
||||
qemu_del_nic(qemu_get_nic(nc));
|
||||
/* Skip NET_CLIENT_DRIVER_NIC entries */
|
||||
p = &QTAILQ_NEXT(nc, next);
|
||||
} else {
|
||||
qemu_del_net_client(nc);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user