From patchwork Fri Mar 11 15:37:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Gupta X-Patchwork-Id: 8569361 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 A3686C0553 for ; Fri, 11 Mar 2016 21:49:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 83FC12026D for ; Fri, 11 Mar 2016 21:49:17 +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 88B6320260 for ; Fri, 11 Mar 2016 21:49:16 +0000 (UTC) Received: from localhost ([::1]:57826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUvr-0000xS-QW for patchwork-qemu-devel@patchwork.kernel.org; Fri, 11 Mar 2016 16:49:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeP7q-0000mO-3g for qemu-devel@nongnu.org; Fri, 11 Mar 2016 10:37:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeP7o-00021U-Kk for qemu-devel@nongnu.org; Fri, 11 Mar 2016 10:37:14 -0500 Received: from mail-yk0-x233.google.com ([2607:f8b0:4002:c07::233]:33721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeP7k-0001x2-TN; Fri, 11 Mar 2016 10:37:09 -0500 Received: by mail-yk0-x233.google.com with SMTP id z7so50395326yka.0; Fri, 11 Mar 2016 07:37:08 -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:cc; bh=760qgs8nvOelDpzeVydCumbA6RvDCfkh64r9O1mWJsw=; b=B+yURC+63YgaWN48jet7WYQGvdKy/aUghvxOmPV1x4aGoR74CulamBncr7nWkqMg9r iZkZSHXjdj0vE4CBF4rT4CxQMX7SlYHZvaQ1uZtUfyLh4ISKHaSVCcFSgjvDnjfCnZm1 ZOl2sQ9MNH6JuhwGOxQTNGOLscdEP49RBiERh2oc3aHn+2whdGSPvesdfggblWDDmmp3 yvtpYnbBKLlcbEOUeh7p8iGjrTMLkm/ASRz/FHjt36dxwl1G3WXfUvy8TEFSOVFZgFRj hUcXHbO9aLCt7QWpoRlBNMvlPNzF0pxZOPcx+xIrPOHKxLCl7VG3eO3PGOiYnlmtrVNj rwzQ== 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:cc; bh=760qgs8nvOelDpzeVydCumbA6RvDCfkh64r9O1mWJsw=; b=GLjd7QcaegM09rFoCUKwPlMIaJaYxbl+snoSWzw4Lv+XRnqaw9jbP3BpXfhXqRJafo w6oTwxuTlMfVsaYee44qRAyxu9d9/IClXyLuW8MSgChIaybj4volo1zMrhDwkkelBIEL miJNPZZkS6ZX2W/hzeH/CVxTywo5dAyTOrMvxK0Uzw9rfLa9M7b7D9HMYFEBhTqjTJiD YklLukIlf3CUW+v794Yhx3vVZsdFoU0bdIyDZdhvE2EvWeezAFth9dLsBDlqhtlMYCI5 Wy3452Pz20t2kaqgieLR5uxCEwGq+SarXr+rvPMdXIob7VqM5wYpYu/qBgtFfeinIDYq DzMA== X-Gm-Message-State: AD7BkJJQfPDrPnXoVfuj+2vxTRP1oX0ih7+CuKzbj4p4XZoSch212WjOIL5qHaMCa6uIxiI+nFyxqHlzUwI8fA== MIME-Version: 1.0 X-Received: by 10.37.1.138 with SMTP id 132mr5603353ybb.70.1457710628232; Fri, 11 Mar 2016 07:37:08 -0800 (PST) Received: by 10.37.210.201 with HTTP; Fri, 11 Mar 2016 07:37:08 -0800 (PST) Date: Fri, 11 Mar 2016 21:07:08 +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::233 X-Mailman-Approved-At: Fri, 11 Mar 2016 16:48:37 -0500 Cc: qemu-trivial@nongnu.org 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, HTML_MESSAGE, 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(-) 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; } 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;