From patchwork Fri Mar 11 14:48:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Gupta X-Patchwork-Id: 8569371 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4633EC0553 for ; Fri, 11 Mar 2016 21:49:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 911192026D for ; Fri, 11 Mar 2016 21:49:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA5F320260 for ; Fri, 11 Mar 2016 21:49:39 +0000 (UTC) Received: from localhost ([::1]:57833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUwF-0001Yx-8u for patchwork-qemu-devel@patchwork.kernel.org; Fri, 11 Mar 2016 16:49:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeOMk-0000bv-T4 for qemu-devel@nongnu.org; Fri, 11 Mar 2016 09:48:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeOMj-0002Gk-OT for qemu-devel@nongnu.org; Fri, 11 Mar 2016 09:48:34 -0500 Received: from mail-yk0-x231.google.com ([2607:f8b0:4002:c07::231]:32899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeOMj-0002GW-Jn for qemu-devel@nongnu.org; Fri, 11 Mar 2016 09:48:33 -0500 Received: by mail-yk0-x231.google.com with SMTP id z7so49735082yka.0 for ; Fri, 11 Mar 2016 06:48:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=FbPYF3cdxyOHq8gyluKF94Zy01kycppi5RgsV/tfuTI=; b=hNvQL5ttBf8oNvANUQjNfBluk4gEPErLOQaCdHuJB4Bvkof76JsyuJREyiAEvPAins XdRdFXI8XCzqimoIrxVklAi5s0DGNqmFNho9xnJghznZ+YnRSJO8PgLnrSE2RMjPYQnW BoUd7Asf0YKonROe7ooSv+hJSRFVTAvqAMecqp4QjqO4VjhR1w4NbKZTkDGEDN9aSYI4 CJkd5+pDoAM3xb89+kAypjvEAXyXTmYU/uKOyuoDJuRKEHvq8rZIW2+NoAPjoiP2rpcI 7op83hnif80Qv6TN9cvQSjzpiDqXmDOCRlpgZqROd55qa0NkkvEz5VceGkHojbLq7J9L mIGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=FbPYF3cdxyOHq8gyluKF94Zy01kycppi5RgsV/tfuTI=; b=ixMa3xWPGYyvDq0V6aFwOYVC/G5NqvJFwVmT2H8JxhWBudhTj6DRP0RExbiS8/HdS9 Jx4G2fi71nZiDYofAKiRVD4rx+cTZFql05dx5Zj2wN++ljeEZSDNydlgZaP4Mmuez1U2 gh7exFLZpe5PdXDsw4vmjI2cSAluCuhJPkwz8f8kOMJjsQuCvGcHEwzZiBjaD4FYxv5N GTX+hhFC58dUAu+s+Sq8PlDL3SACzU6Qc9EWUXbMfNQjl3vr5nKLeoVxCGC3c3IQw10j HgMUqNZXf1dKRbWl6TyRvFlZo5qUttZalWnnQiQ4JwJ4fQiCC1dI1A/ZkHrMtpCqXgr3 qAdQ== X-Gm-Message-State: AD7BkJLOmYTJD+6VSA95EBVxThzAqARtBbtfs3LyBtdffkKPEsV0pVrljyVPuqNPZtX/9O9uvTLft0Xp7Tzzww== MIME-Version: 1.0 X-Received: by 10.37.231.78 with SMTP id e75mr5424136ybh.130.1457707712867; Fri, 11 Mar 2016 06:48:32 -0800 (PST) Received: by 10.37.210.201 with HTTP; Fri, 11 Mar 2016 06:48:32 -0800 (PST) Date: Fri, 11 Mar 2016 20:18:32 +0530 Message-ID: From: Siddharth Gupta To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c07::231 X-Mailman-Approved-At: Fri, 11 Mar 2016 16:48:37 -0500 Subject: [Qemu-devel] [PATCH] BiteSizedTasks-LargeFrames X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, HTML_MESSAGE, MIME_HTML_MOSTLY, RCVD_IN_DNSWL_HI, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From 032be62f56a207833ae12cc9474e3e8be5ed8eb4 Mon Sep 17 00:00:00 2001 From: Siddharth Gupta Date: Fri, 11 Mar 2016 20:10:41 +0530 Subject: [PATCH] bitesizedtasks-large_frames-hw_dma_xilinx-hw_net_virtio --- hw/dma/xilinx_axidma.c | 5 ++++- hw/net/virtio-net.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index ce5c1e6..9c6bda2 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -255,13 +255,15 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, StreamSlave *tx_control_dev) { uint32_t prev_d; - unsigned char txbuf[16 * 1024]; + unsigned char *txbuf; unsigned int txlen; if (!stream_running(s) || stream_idle(s)) { return; } + txbuf = (unsigned char *) malloc(16 * 1024 * sizeof(unsigned char)); + while (1) { stream_desc_load(s, s->regs[R_CURDESC]); @@ -303,6 +305,7 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, break; } } + free(txbuf); } static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf, diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5798f87..ba6ebac 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1094,7 +1094,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t VirtIONet *n = qemu_get_nic_opaque(nc); VirtIONetQueue *q = virtio_net_get_subqueue(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); - struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE]; + struct iovec *mhdr_sg; struct virtio_net_hdr_mrg_rxbuf mhdr; unsigned mhdr_cnt = 0; size_t offset, i, guest_offset; @@ -1113,6 +1113,8 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t offset = i = 0; + mhdr_sg = (struct iovec *) malloc(VIRTQUEUE_MAX_SIZE * sizeof(struct iovec)); + while (offset < size) { VirtQueueElement *elem; int len, total; @@ -1122,6 +1124,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement)); if (!elem) { + free(mhdr_sg); if (i == 0) return -1; error_report("virtio-net unexpected empty queue: " @@ -1136,11 +1139,15 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t if (elem->in_num < 1) { error_report("virtio-net receive queue contains no in buffers"); + free(mhdr_sg); exit(1); } sg = elem->in_sg; if (i == 0) { + if (offset != 0) { + free(mhdr_sg); + } assert(offset == 0); if (n->mergeable_rx_bufs) { mhdr_cnt = iov_copy(mhdr_sg, ARRAY_SIZE(mhdr_sg), @@ -1168,6 +1175,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t if (!n->mergeable_rx_bufs && offset < size) { virtqueue_discard(q->rx_vq, elem, total); g_free(elem); + free(mhdr_sg); return size; } @@ -1186,6 +1194,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t virtqueue_flush(q->rx_vq, i); virtio_notify(vdev, q->rx_vq); + free(mhdr_sg); return size; } -- 2.5.0 Signed-off-by: Siddharth Gupta