From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRVD1-00025I-Ms for qemu-devel@nongnu.org; Mon, 26 Jan 2009 12:25:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRVCx-00022A-Ma for qemu-devel@nongnu.org; Mon, 26 Jan 2009 12:25:12 -0500 Received: from [199.232.76.173] (port=41663 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRVCx-00021z-6Y for qemu-devel@nongnu.org; Mon, 26 Jan 2009 12:25:11 -0500 Received: from mx20.gnu.org ([199.232.41.8]:51774) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LRV2j-0003pp-Sj for qemu-devel@nongnu.org; Mon, 26 Jan 2009 12:14:37 -0500 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LRTbk-0007Q4-Nq for qemu-devel@nongnu.org; Mon, 26 Jan 2009 10:42:40 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LRTWy-0003GQ-IL for qemu-devel@nongnu.org; Mon, 26 Jan 2009 15:37:44 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LRTWy-0003GM-BY for qemu-devel@nongnu.org; Mon, 26 Jan 2009 15:37:44 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Mon, 26 Jan 2009 15:37:44 +0000 Subject: [Qemu-devel] [6444] Handle link status in qemu_sendv_packet() (Mark McLoughlin) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6444 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6444 Author: aliguori Date: 2009-01-26 15:37:44 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Handle link status in qemu_sendv_packet() (Mark McLoughlin) If link is down, pretend that the packet has been successfully sent. Signed-off-by: Mark McLoughlin Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/net.c Modified: trunk/net.c =================================================================== --- trunk/net.c 2009-01-26 15:37:40 UTC (rev 6443) +++ trunk/net.c 2009-01-26 15:37:44 UTC (rev 6444) @@ -421,6 +421,16 @@ return offset; } +static ssize_t calc_iov_length(const struct iovec *iov, int iovcnt) +{ + size_t offset = 0; + int i; + + for (i = 0; i < iovcnt; i++) + offset += iov[i].iov_len; + return offset; +} + ssize_t qemu_sendv_packet(VLANClientState *vc1, const struct iovec *iov, int iovcnt) { @@ -428,12 +438,17 @@ VLANClientState *vc; ssize_t max_len = 0; + if (vc1->link_down) + return calc_iov_length(iov, iovcnt); + for (vc = vlan->first_client; vc != NULL; vc = vc->next) { ssize_t len = 0; if (vc == vc1) continue; + if (vc->link_down) + len = calc_iov_length(iov, iovcnt); if (vc->fd_readv) len = vc->fd_readv(vc->opaque, iov, iovcnt); else if (vc->fd_read)