From patchwork Fri Mar 11 14:50:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Gupta X-Patchwork-Id: 8565751 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 A5095C0553 for ; Fri, 11 Mar 2016 14:51:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E37332034C for ; Fri, 11 Mar 2016 14:51:01 +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 278372034B for ; Fri, 11 Mar 2016 14:51:01 +0000 (UTC) Received: from localhost ([::1]:55401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeOP6-00032i-HH for patchwork-qemu-devel@patchwork.kernel.org; Fri, 11 Mar 2016 09:51:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeOOo-000305-1y for qemu-devel@nongnu.org; Fri, 11 Mar 2016 09:50:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeOOm-000365-VC for qemu-devel@nongnu.org; Fri, 11 Mar 2016 09:50:41 -0500 Received: from mail-yw0-x22a.google.com ([2607:f8b0:4002:c05::22a]:32834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeOOk-00035a-Qb; Fri, 11 Mar 2016 09:50:38 -0500 Received: by mail-yw0-x22a.google.com with SMTP id d65so95532536ywb.0; Fri, 11 Mar 2016 06:50:38 -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=6CRomjwcQoDBoL3AS3xtBstqcKWDI6tddEIDqd3oV+M=; b=uoCVjuRwpAerMIYatt6q1T4IAGapGlA65+e7mMWpsrUolYB3Q0dEhXFJNUhdz8FxbP FQd5ufRG3ZeJXhSQHWaKU0hbDDaTThcXPk5Uz8ElGpCqh7U35u1J0vE1ELBBqpSfjinx N26Ow4w7wME/NG33/c1J8oPNNuWAKKUfmUwD83Vg+aXDhCHueFa02m3FD0l64RQnMGMR F0OmiI23BNe9vaTyXjaKFd5944PFoZFhuWp6A/zyLPJidBXvz8rjeEfiDTRp+E93HU6N zdExQlIAjTfpwKX9dOuCHY5kgTUA68GeTs3xtKPAocDOF/A6CjFwhDzVEchy/4BE6Dsn SPJA== 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=6CRomjwcQoDBoL3AS3xtBstqcKWDI6tddEIDqd3oV+M=; b=l/Hi6J59oEjzumx72pp4M8A6AdFSyyqYcV+tliGDoLltyQ5aPJ+jMkOZ83MtkYD4xH MqDPUZGkWPIH1E399awZI27WmbgLaIUQoya5AQlEb8DBdIpOmAoixXCLJBP5RU5nNVaW nfzwuhsawCJGA30XUAoOhddWfRqKvjwZaB72FUuBYOrDn3yeJSonkoGu73qAbD44Z859 gfHb/V0+Qwp5yze6WKDa5ma9MJfcoaJjeXVqJwoMaJwMoz5ijJreqHp7jbhlonQVvndG yB1Hz0dciSURoq7+2xQfd3ruz7B9LujUyfRSt3eLn2D1Vw60HY+51SDBPpqzWVXDqa52 cXng== X-Gm-Message-State: AD7BkJLWMMGUikC/H8c8rBtI0M6ApPc3/yxjw79Bd88e2f59p4AHJl6qvHeoZ8grEBsO3eO1hcfXJfgdTHhg/g== MIME-Version: 1.0 X-Received: by 10.13.232.75 with SMTP id r72mr5109844ywe.2.1457707838295; Fri, 11 Mar 2016 06:50:38 -0800 (PST) Received: by 10.37.210.201 with HTTP; Fri, 11 Mar 2016 06:50:38 -0800 (PST) Date: Fri, 11 Mar 2016 20:20:38 +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:c05::22a Cc: qemu-trivial@nongnu.org Subject: [Qemu-devel] [PATCH] BitsSizedTasks-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(-) 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