diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2015-07-27 14:53:42 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-07-27 14:53:42 +0100 |
commit | 122e7dab8ac549c8c5a9e1e13aa2464190e888de (patch) | |
tree | 110679c12752916fc4ae9b011b9d7fa98a2127ae /hw/usb/dev-network.c | |
parent | e40db4c6d391419c0039fe274c74df32a6ca1a28 (diff) | |
parent | f9f7492ea4a9dda538fedeec31399fb940533a16 (diff) | |
download | hqemu-122e7dab8ac549c8c5a9e1e13aa2464190e888de.zip hqemu-122e7dab8ac549c8c5a9e1e13aa2464190e888de.tar.gz |
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Pull request
Here are NIC fixes from Fam Zheng that prevent rx hangs (caused by NIC models
where .can_receive() stops rx but qemu_flush_queued_packets() isn't called).
# gpg: Signature made Mon Jul 27 14:51:48 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>"
* remotes/stefanha/tags/net-pull-request:
axienet: Flush queued packets when rx is done
dp8393x: Flush packets when link comes up
stellaris_enet: Flush queued packets when read done
mipsnet: Flush queued packets when receiving is enabled
milkymist-minimac2: Flush queued packets when link comes up
mcf_fec: Drop mcf_fec_can_receive
etsec: Flush queue when rx buffer is consumed
etsec: Move etsec_can_receive into etsec_receive
usbnet: Drop usbnet_can_receive
eepro100: Drop nic_can_receive
pcnet: Drop pcnet_can_receive
xgmac: Drop packets with eth_can_rx is false.
hw/net: fix mcf_fec driver receiver
hw/net: add simple phy support to mcf_fec driver
hw/net: add ANLPAR bit definitions to generic mii
hw/net: create common collection of MII definitions
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/usb/dev-network.c')
-rw-r--r-- | hw/usb/dev-network.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 5eeb4c6..7800cee 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1268,6 +1268,10 @@ static ssize_t usbnet_receive(NetClientState *nc, const uint8_t *buf, size_t siz uint8_t *in_buf = s->in_buf; size_t total_size = size; + if (!s->dev.config) { + return -1; + } + if (is_rndis(s)) { if (s->rndis_state != RNDIS_DATA_INITIALIZED) { return -1; @@ -1309,21 +1313,6 @@ static ssize_t usbnet_receive(NetClientState *nc, const uint8_t *buf, size_t siz return size; } -static int usbnet_can_receive(NetClientState *nc) -{ - USBNetState *s = qemu_get_nic_opaque(nc); - - if (!s->dev.config) { - return 0; - } - - if (is_rndis(s) && s->rndis_state != RNDIS_DATA_INITIALIZED) { - return 1; - } - - return !s->in_len; -} - static void usbnet_cleanup(NetClientState *nc) { USBNetState *s = qemu_get_nic_opaque(nc); @@ -1343,7 +1332,6 @@ static void usb_net_handle_destroy(USBDevice *dev) static NetClientInfo net_usbnet_info = { .type = NET_CLIENT_OPTIONS_KIND_NIC, .size = sizeof(NICState), - .can_receive = usbnet_can_receive, .receive = usbnet_receive, .cleanup = usbnet_cleanup, }; |